コード例 #1
0
 /** Check that the standard reifier will note, but not hide, reification quads. */
 public void testStandard() {
   Graph g = getGraph();
   assertFalse(ReifierStd.hasTriple(g, triple("s p o")));
   g.add(NodeCreateUtils.createTriple("x rdf:subject s"));
   assertEquals(1, g.size());
   g.add(NodeCreateUtils.createTriple("x rdf:predicate p"));
   assertEquals(2, g.size());
   g.add(NodeCreateUtils.createTriple("x rdf:object o"));
   assertEquals(3, g.size());
   g.add(NodeCreateUtils.createTriple("x rdf:type rdf:Statement"));
   assertEquals(4, g.size());
   assertTrue(ReifierStd.hasTriple(g, triple("s p o")));
 }
コード例 #2
0
 /** Test that the Standard reifier will expose implicit quads arising from reifyAs(). */
 public void testStandardExplode() {
   Graph g = getGraph();
   ReifierStd.reifyAs(g, node("a"), triple("p Q r"));
   Graph r = Factory.createDefaultGraph();
   graphAdd(r, "a rdf:type rdf:Statement; a rdf:subject p; a rdf:predicate Q; a rdf:object r");
   assertEquals(4, g.size());
   assertIsomorphic(r, g);
 }
コード例 #3
0
 public void testQuadRemove() {
   Graph g = getGraph();
   assertEquals(0, g.size());
   Triple s = NodeCreateUtils.createTriple("x rdf:subject s");
   Triple p = NodeCreateUtils.createTriple("x rdf:predicate p");
   Triple o = NodeCreateUtils.createTriple("x rdf:object o");
   Triple t = NodeCreateUtils.createTriple("x rdf:type rdf:Statement");
   g.add(s);
   g.add(p);
   g.add(o);
   g.add(t);
   assertEquals(4, g.size());
   g.delete(s);
   g.delete(p);
   g.delete(o);
   g.delete(t);
   assertEquals(0, g.size());
 }
コード例 #4
0
ファイル: WrappedGraph.java プロジェクト: hmottestad/jena
 @Override
 public int size() {
   return base.size();
 }