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

Re: Bnodes in DELETE templates

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Tue, 22 Feb 2011 17:28:41 +0000
Message-ID: <4D63F249.60000@epimorphics.com>
To: Axel Polleres <axel.polleres@deri.org>
CC: Steve Harris <steve.harris@garlik.com>, Paul Gearon <gearon@ieee.org>, SPARQL Working Group <public-rdf-dawg@w3.org>
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.

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

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.

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.  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 17:29:21 GMT

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