I'm trying to construct a SPARQL update like:
DELETE {?r ?p ?o. ?s ?p1 ?r.}
WHERE {?r ex:foo "123"; ex:bar "456"; ?p ?o.
OPTIONAL {?s ?p1 ?r}
}
In other words, delete all triples with subject or object resource that
has certain ex:foo and ex:bar values.
I can't see how to set or modify the DELETE pattern in an UpdateModify
(or UpdateDeleteInsert) object. I'm guessing a visitor must be used,
but I can't put the pieces together. Can someone point out the right
pattern?
UpdateModify upd = new UpdateModify();
upd.setHasDeleteClause(true);
upd.setHasInsertClause(false);
upd.setElement(/* set the where block */);
upd.visit(new UpdateVisitorBase() {
@Override
public void visit(UpdateModify um) {
/* somehow add the DELETE triples??? */
}
});
I intend to use the built-up request in an UpdateRequest to be
submitted by an RDFConnection, like:
UpdateRequest req = UpdateFactory.create().add(upd);
rdfConnection.update(req);
I'm using jena libs 3.13.1.
Thanks and regards,
--Paul