/** "dirty" reifications - those with conflicting quadlets - should fail. */
 public void testDirtyReification() {
   Resource R = model.createResource(aURI);
   model.add(R, RDF.type, RDF.Statement);
   model.add(R, RDF.subject, S);
   model.add(R, RDF.subject, P);
   testDoesNotReify("boo", R);
 }
 /**
  * the simplest case: if we assert all the components of a reification quad, we can get a
  * ReifiedStatement that represents the reified statement.
  */
 public void testBasicReification() {
   if (model.getReificationStyle() != ModelFactory.Minimal) {
     Resource R = model.createResource(aURI);
     model.add(R, RDF.type, RDF.Statement);
     model.add(R, RDF.subject, S);
     model.add(R, RDF.predicate, P);
     model.add(R, RDF.object, O);
     RDFNode rs = R.as(ReifiedStatement.class);
     assertEquals("can recover statement", SPO, ((ReifiedStatement) rs).getStatement());
   }
 }
 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 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());
 }
 /**
  * walk down the set of statements (represented as an array), recursing with and without each
  * statement being present. The mask bits record those statements that are in the model. At the
  * bottom of the recursion (n == 0), check that R can be reified exactly when all four quad
  * components are present; the other statements don't matter.
  */
 private void testCombinations(Model m, Resource R, int mask, Object[][] statements, int n) {
   if (n == 0) {
     try {
       // System.err.println( "| hello. mask = " + mask );
       ReifiedStatement rs = (ReifiedStatement) R.as(ReifiedStatement.class);
       // System.err.println( "+  we constructed " + rs );
       assertTrue(
           "should not reify: not all components present [" + mask + "]: " + rs,
           (mask & 15) == 15);
       // System.err.println( "+  and we passed the assertion." );
     } catch (DoesNotReifyException e) { // System.err.println( "+  we exploded" );
       assertFalse("should reify: all components present", mask == 15);
     }
   } else {
     int i = n - 1;
     Statement s = (Statement) statements[i][0];
     int bits = ((Integer) statements[i][1]).intValue();
     testCombinations(m, R, mask, statements, i);
     m.add(s);
     testCombinations(m, R, mask + bits, statements, i);
     m.remove(s);
   }
 }
 public void testThisWillBreak() {
   Resource R = model.createResource(aURI);
   SPO.createReifiedStatement(aURI);
   model.add(R, RDF.subject, R);
 }