I have been trying to delete a triple from a model using Jena with no success. Things work well when the subject, predicate and object are URIs or literals, but for anonymous nodes it doesn't seem to work. For example, consider this triple in a model:
_:A68d23cacX3aX13f793fa898X3aXX2dX7ffd <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> "class" .
I would like to delete it using:
Node nodeSubject = Node.createAnon(); //or Node.ANY
Node nodePredicate = Node.createURI("http://www.w3.org/1999/02/22-rdf-syntax-ns#value");
Node nodeObject = Node.createLiteral("class");
Triple triple = Triple.create(nodeSubject, nodePredicate, nodeObject);
inMemModel.getGraph().delete(triple);
I can't delete the triple regardless if I use createAnon
or Node.ANY
.
I wouldn't want to use a AnonId just cause if I run my code on another machine I doubt that the same anonymous id will be generated.