Is there a good way to programatically remove a set of triples? As I am updating records in the store, I am removing all triples for a given subject, and then adding new ones later. In my code, I am doing:
Iterator<Resource> personIterator = GraphUtil.getSubjectIterator(newGraph, RDF.TYPE, IInfrastructureSchema.personType);
while (personIterator.hasNext()) {
Resource personResource = personIterator.next();
logger.info("Removing {}", personResource);
conn.remove().statements(personResource, null, null, adContextUri);
}
In the newGraph, I have built up a graph of new triples that will be added. But before there are added, I want to remove all of the existing triples where the subject is in the newGraph. I want to remove a whole set of triples based on the subject.