public void testRR() { Statement st = SPO; Model m = model; ReifiedStatement rs1 = m.createReifiedStatement(aURI, st); ReifiedStatement rs2 = m.createReifiedStatement(anotherURI, st); m.removeReification(rs1); testNotReifying(m, aURI); assertTrue("st is still reified", st.isReified()); m.removeReification(rs2); assertFalse("st should no longer be reified", st.isReified()); }
public void testListReifiedSpecificStatements() { assertEquals("no statements should match st", empty, getSetRS(model, SPO)); /* */ ReifiedStatement rs = model.createReifiedStatement(aURI, SPO); ReifiedStatement rs2 = model.createReifiedStatement(anotherURI, SPO2); model.add(rs, P, O); // assertEquals( "still no matching statement", empty, getSetRS( m, stOther ) ); /* */ Set justRS2 = arrayToSet(new Object[] {rs2}); model.add(rs2, P, O); assertEquals("now one matching statement", justRS2, getSetRS(model, SPO2)); }
/** * test that listReifiedStatements produces an iterator that contains the right reified * statements. We *don't* test that they're not duplicated, because they might be; disallowing * duplicates could be expensive. */ public void testListReifiedStatements() { assertEquals("initially: no reified statements", empty, getSetRS(model)); ReifiedStatement rs = model.createReifiedStatement(aURI, SPO); // assertEquals( "still: no reified statements", empty, getSetRS( m ) ); /* */ model.add(rs, P, O); Set justRS = arrayToSet(new Object[] {rs}); assertEquals("post-add: one reified statement", justRS, getSetRS(model)); model.add(S, P, rs); assertEquals("post-add: still one reified statement", justRS, getSetRS(model)); /* */ ReifiedStatement rs2 = model.createReifiedStatement(anotherURI, SPO2); Set bothRS = arrayToSet(new Object[] {rs, rs2}); model.add(rs2, P, O); assertEquals("post-add: still one reified statement", bothRS, getSetRS(model)); }
public void testConstructionByURI() { ReifiedStatement rs = model.createReifiedStatement("spoo:handle", SPO); ReifiedStatement rs2 = SPO.createReifiedStatement("spoo:gripper"); assertEquals("recover statement (URI)", SPO, rs.getStatement()); assertEquals("recover URI", "spoo:handle", rs.getURI()); assertEquals("recover URI", "spoo:gripper", rs2.getURI()); }
public void testRemoveReificationWorks() { Statement st = SPO; Model m = model; m.createReifiedStatement(aURI, st); assertTrue("st is now reified", st.isReified()); m.removeAllReifications(st); assertFalse("st is no longer reified", st.isReified()); }
public void testStatementListReifiedStatements() { Statement st = SPO; Model m = model; assertEquals( "it's not there yet", empty, GraphTestBase.iteratorToSet(st.listReifiedStatements())); ReifiedStatement rs = m.createReifiedStatement(aURI, st); Set justRS = arrayToSet(new Object[] {rs}); m.add(rs, P, O); assertEquals("it's here now", justRS, GraphTestBase.iteratorToSet(st.listReifiedStatements())); }
public void testIsReified() { ReifiedStatement rs = model.createReifiedStatement(aURI, SPO); Resource BS = model.createResource(anchor + "BS"); Property BP = model.createProperty(anchor + "BP"); RDFNode BO = model.createProperty(anchor + "BO"); model.add(rs, P, O); assertTrue("st should be reified now", SPO.isReified()); assertTrue("m should have st reified now", model.isReified(SPO)); assertFalse( "this new statement should not be reified", model.createStatement(BS, BP, BO).isReified()); }
public void testDoesNotReifyElsewhere() { final String uri = "spoo:rubbish"; Model m2 = getModel(); model.createReifiedStatement(uri, SPO); testDoesNotReify("blue model should not reify rubbish", m2.createResource(uri)); }
/** * this test appeared when TestStatementResources crashed using reified statements as a step-0 * implementation for asSubject()/asObject(). Looks like there was a problem in * modelReifier().getRS(), which we're fixing ... */ public void testListDoesntCrash() { model.createReifiedStatement(SPO); model.createReifiedStatement(SPO2); assertTrue("should be non-empty", model.listReifiedStatements().hasNext()); }
public void testConstructionFromModels() { testStatementAndModel("fromModel", model.createReifiedStatement(SPO), model, SPO); }
public void testConversion() { final String uri = "spoo:handle"; model.createReifiedStatement(uri, SPO); ReifiedStatement rs2 = (ReifiedStatement) model.createResource(uri).as(ReifiedStatement.class); assertEquals("recover statement", SPO, rs2.getStatement()); }