Beispiel #1
0
 @Override
 public void remove(List<Statement> statements) {
   Model graph = null;
   GraphConnection graphConnection = null;
   try {
     graphConnection = openGraph();
     graph = graphConnection.getGraph();
     graph.enterCriticalSection(Lock.WRITE);
     for (Statement nuxStmt : statements) {
       com.hp.hpl.jena.graph.Node subject = getJenaNode(nuxStmt.getSubject());
       com.hp.hpl.jena.graph.Node predicate = getJenaNode(nuxStmt.getPredicate());
       com.hp.hpl.jena.graph.Node object = getJenaNode(nuxStmt.getObject());
       Triple jenaTriple = Triple.create(subject, predicate, object);
       com.hp.hpl.jena.rdf.model.Statement jenaStmt = graph.asStatement(jenaTriple);
       graph.remove(jenaStmt);
       // remove properties
       RSIterator it = graph.listReifiedStatements(jenaStmt);
       while (it.hasNext()) {
         ReifiedStatement rs = it.nextRS();
         rs.removeProperties();
       }
       // remove quadlets
       graph.removeAllReifications(jenaStmt);
       // graph.removeReification(reifiedStmt);
     }
   } finally {
     if (graph != null) {
       graph.leaveCriticalSection();
     }
     if (graphConnection != null) {
       graphConnection.close();
     }
   }
 }
 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());
 }