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()));
 }
Ejemplo n.º 2
0
 private void testResource(final Model model, final Resource r, final int numProps) {
   final Literal tvLiteral = model.createLiteral("test 12 string 2");
   final Resource tvResource = model.createResource();
   final String lang = "fr";
   //
   Assert.assertTrue(
       r.addLiteral(RDF.value, AbstractModelTestBase.tvBoolean)
           .hasLiteral(RDF.value, AbstractModelTestBase.tvBoolean));
   Assert.assertTrue(
       r.addLiteral(RDF.value, AbstractModelTestBase.tvByte)
           .hasLiteral(RDF.value, AbstractModelTestBase.tvByte));
   Assert.assertTrue(
       r.addLiteral(RDF.value, AbstractModelTestBase.tvShort)
           .hasLiteral(RDF.value, AbstractModelTestBase.tvShort));
   Assert.assertTrue(
       r.addLiteral(RDF.value, AbstractModelTestBase.tvInt)
           .hasLiteral(RDF.value, AbstractModelTestBase.tvInt));
   Assert.assertTrue(
       r.addLiteral(RDF.value, AbstractModelTestBase.tvLong)
           .hasLiteral(RDF.value, AbstractModelTestBase.tvLong));
   Assert.assertTrue(
       r.addLiteral(RDF.value, AbstractModelTestBase.tvChar)
           .hasLiteral(RDF.value, AbstractModelTestBase.tvChar));
   Assert.assertTrue(
       r.addLiteral(RDF.value, AbstractModelTestBase.tvFloat)
           .hasLiteral(RDF.value, AbstractModelTestBase.tvFloat));
   Assert.assertTrue(
       r.addLiteral(RDF.value, AbstractModelTestBase.tvDouble)
           .hasLiteral(RDF.value, AbstractModelTestBase.tvDouble));
   Assert.assertTrue(
       r.addProperty(RDF.value, AbstractModelTestBase.tvString)
           .hasProperty(RDF.value, AbstractModelTestBase.tvString));
   Assert.assertTrue(
       r.addProperty(RDF.value, AbstractModelTestBase.tvString, lang)
           .hasProperty(RDF.value, AbstractModelTestBase.tvString, lang));
   Assert.assertTrue(
       r.addLiteral(RDF.value, AbstractModelTestBase.tvObject)
           .hasLiteral(RDF.value, AbstractModelTestBase.tvObject));
   Assert.assertTrue(r.addProperty(RDF.value, tvLiteral).hasProperty(RDF.value, tvLiteral));
   Assert.assertTrue(r.addProperty(RDF.value, tvResource).hasProperty(RDF.value, tvResource));
   Assert.assertTrue(r.getRequiredProperty(RDF.value).getSubject().equals(r));
   //
   final Property p = model.createProperty("foo/", "bar");
   try {
     r.getRequiredProperty(p);
     Assert.fail("should detect missing property");
   } catch (final PropertyNotFoundException e) {
     JenaTestBase.pass();
   }
   //
   Assert.assertEquals(13, GraphTestBase.iteratorToSet(r.listProperties(RDF.value)).size());
   Assert.assertEquals(
       setOf(r),
       GraphTestBase.iteratorToSet(
           r.listProperties(RDF.value).mapWith(Statement.Util.getSubject)));
   //
   Assert.assertEquals(0, GraphTestBase.iteratorToSet(r.listProperties(p)).size());
   Assert.assertEquals(
       new HashSet<Resource>(),
       GraphTestBase.iteratorToSet(r.listProperties(p).mapWith(Statement.Util.getSubject)));
   //
   Assert.assertEquals(13 + numProps, GraphTestBase.iteratorToSet(r.listProperties()).size());
   Assert.assertEquals(
       setOf(r),
       GraphTestBase.iteratorToSet(r.listProperties().mapWith(Statement.Util.getSubject)));
   //
   r.removeProperties();
   Assert.assertEquals(0, model.query(new SimpleSelector(r, null, (RDFNode) null)).size());
 }
 public Set getSetRS(Model m, Statement st) {
   return GraphTestBase.iteratorToSet(m.listReifiedStatements(st));
 }