FYI  QueryBuilder framework has methods to programmatically build Update
requests as well as queries?



On Thu, Dec 5, 2019 at 4:25 PM Paul Tyson <phty...@sbcglobal.net> wrote:

> Never mind. I missed:
>
> QuadAcc deletes = upd.getDeleteAcc();
> deletes.addTriple(/* triple pattern to delete */);
>
> Regards,
> --Paul
>
>
> On Thu, 2019-12-05 at 09:12 -0600, Paul Tyson wrote:
> > 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
> >
> >
>
>
>

-- 
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren

Reply via email to