/** 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"))); }
/** 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); }
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()); }
@Override public int size() { return base.size(); }