W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > January to March 2011

Re: Bnodes in DELETE templates

From: Axel Polleres <axel.polleres@deri.org>
Date: Tue, 22 Feb 2011 21:51:39 +0000
Cc: "Steve Harris" <steve.harris@garlik.com>, "Paul Gearon" <gearon@ieee.org>, "SPARQL Working Group" <public-rdf-dawg@w3.org>
Message-Id: <FEC94377-803E-4814-B80D-421ADCD90503@deri.org>
To: Andy Seaborne <andy.seaborne@epimorphics.com>

On 22 Feb 2011, at 17:28, Andy Seaborne wrote:

> rq25 also says:
> 
> """
> If any such instantiation produces a triple containing an unbound
> variable or an illegal RDF construct, such as a literal in subject or
> predicate position, then that triple is not included in the output RDF
> graph.
> """
> N.B. literals-not-objects as well.
> from SPARQL 1.0 which seems sufficient to me, unless we find time to
> include it in the formal section as suggested by Birte.

ok.

> 
> Template instantiation in SPARQL Update can't rely on CONSTRUCT because
> CONSTRUCT constructs graphs, and update works on quads.

yeah, as said in prev. mail, the definition of Dataset(template,P) needs 
some more work, it seems.

> My example of bnodes+unbound variables was to ask in which order
> processing takes places: reduce to legal RDF triples, then apply bnodes
> -as-variables (so not bNodes in predicate position so the join/DISTINCT
> has picked up more terms than needed) or to match and then reduce to
> legal RDF, which needs to explain about named variables at the time of
> matching.

Not sure whether I understand the difference entirely.

As I understood it so far, Dataset(template,P) would create an RDF dataset DS- or, synonymously, 
as you suggested a set of quads - analogously to the way CONSTRUCT creates RDF Graphs - i.e. a set of triples.
DS would then be DIFFed from GS.


> The test cases do not cover this [*], and the current formalisation in
> the doc of Update only works for deleting in the presence of named
> variables, not insertion.

I have added two test cases (the one originally from your mail and the variant I had 
in my mail to Paul) now:

 dawg-delete-insert-08
 dawg-delete-insert-09

but the solution to these depends on which semantics we choose (discussed as Option1-Option2-Option3 in today's TC, cf. [1]
for the moment, I picked Option1-semantics in the test cases, to be decided/discussed next TC (and further on email, I hope). 

We might need more test cases along similar lines for INSERT still, probably: Any suggestions, volunteers welcome!

best,
Axel


1. http://www.w3.org/2009/sparql/meeting/2011-02-22#update_semantics

> It can ignore illegal forms in delete in the
> diff works because its removing things that can't be there.  The same is
> not true for INSERT.
> 
>         Andy
> 
> [*] when I looked yesterday.
> 
> On 22/02/11 09:20, Axel Polleres wrote:
> > Hi Steve,
> >
> > I agree with your understanding of CONSTRUCT.
> >
> >> * but actually, I can't find anywhere in the SPARQL 1.1 draft that explicitly says that. Could well be looking in the wrong places though.
> >
> >
> > As far as I can see, it is not really "formalized", but covered by the following sentence in Section 16.2 [1]
> >
> > "The result is an RDF graph formed by taking each query solution
> > in the solution sequence, substituting for the variables in the graph template,
> > and combining the triples into a single RDF graph by set union."
> >
> > I don't think we need to further formalise that, but it seems to me that it might be clearer to write:
> >
> > "The result is an RDF graph formed by taking each query solution
> > in the solution sequence, substituting for the variables in the graph template,
> > and combining the<a href="http://www.w3.org/TR/2004/REC-rdf-concepts-20040210/#dfn-rdf-triple">valid RDF triples</a>  into a single RDF graph by set union."
> >
> > Opinions?
> >
> > (The treatment of bnodes in CONSTRUCT templates is covered by what is said in Section 16.2.1.)
> >
> > Axel
> >
> >
> >
> > 1. http://www.w3.org/2009/sparql/docs/query-1.1/rq25.xml#construct
> >
> >
> > On 22 Feb 2011, at 08:43, Steve Harris wrote:
> >
> >> My recollection of CONSTRUCT is that the template would match*, but only completely bound triples would be output, so
> >>
> >> CONSTRUCT {
> >>    _:a :p 12 .
> >>    _:a :q ?o .
> >> }
> >> WHERE {
> >>    ?s :r ?q
> >>    OPTIONAL { ?s :s :o }
> >> }
> >>
> >> Would give
> >>
> >> _:b1 :p 12 .
> >>
> >> This seems inline with a usecase for DELETE: "Delete this pattern, and if it exists also this pattern" e.g.
> >>
> >> DELETE {
> >>    ?x :name ?name .
> >>    ?x :phone ?phone .
> >> }
> >> WHERE {
> >>    ?x a :Person .
> >>    OPTIONAL { ?x :name ?name }
> >>    OPTIONAL { ?x :phone ?phone }
> >> }
> >>
> >> When I wrote this pattern, my intention was that it would delete whatever names and phone numbers for people it could find.
> >>
> >> * but actually, I can't find anywhere in the SPARQL 1.1 draft that explicitly says that. Could well be looking in the wrong places though.
> >>
> >> - Steve
> >
> >
> 
Received on Tuesday, 22 February 2011 21:53:15 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:45 GMT