- From: Andy Seaborne <andy.seaborne@talis.com>
- Date: Thu, 03 Dec 2009 19:06:34 +0000
- To: Paul Gearon <gearon@ieee.org>
- CC: Steve Harris <steve.harris@garlik.com>, SPARQL Working Group <public-rdf-dawg@w3.org>
Paul Gearon wrote:
On 03/12/2009 16:38, Paul Gearon wrote to Steve:
>>> >> I expected them to come out of the WHERE, so yes, they do. The only
>>> >> binding that occurs in the above example is in the WHERE
clause. The
>>> >> INSERTs are just using an already bound set of variables.
>> >
>> > To me that seems very strange.
> I see where you are coming from, but recall that the ; characters are
> just there to separate the various INSERTs and DELETEs. They are all
> supposed to be part of the same command, and that command has a single
> WHERE clause.
I don't recall that :-) My understanding is that ";" separates
operations, not directives. It was introduced because of the problems
because WHERE is optional.
Andy Seaborne wrote:
>> What's the limit of what can be done in a single operation?
> My understanding was that there should not be a limit.
I can understand all in /request/ as a desirable goal but not all in one
/operation/.
---- One request, two operations
# Move someone from one organisation to another
# 1/ Update the people database
# 2/ Move the details from the graph from one division to another
WITH <people>
DELETE { ?x :organisation ?org }
INSERT { ?x :organisation <http://example/org/computerMaufacturing> }
WHERE
{ ?x foaf:name "John Smith" ;
:organisation ?org
}
WITH <computerDivision>
DELETE { ?x ?p ?o }
INSERT { GRAPH <servicesDivision> { ?x ?p ?o } }
WHERE { ?x foaf:name "John Smith" ; ?x ?p ?o }
----
Here, each is well delimited. But if the first were
# No WITH, no WHERE. Abbreviated DELETE - implicit WHERE
DELETE { GRAPH <people> { ?x :organisation ?org } }
and the second was written:
DELETE { GRAPH <computerDivision> { ?x ?p ?o }
INSERT { GRAPH <servicesDivision> { ?x ?p ?o } }
WHERE
{ GRAPH <computerDivision>
{ ?x foaf:name "John Smith" ; ?x ?p ?o }
}
then it is ambiguous as to what the WHERE applies to.
See also:
>>>> (2)
>>>> WITH <people_graph>
>>>> INSERT INTO <email_graph> {?person foaf:mbox ?email };
>>>> INSERT INTO <name_graph> {?person foaf:name ?name }
>>>> WHERE {
>>>> ?person a foaf:Person
>>>> OPTIONAL { ?person foaf:mbox ?email }
>>>> OPTIONAL { ?person foaf:name ?name }
>>>> }
Why isn't that:
WITH <people_graph>
INSERT INTO <email_graph> {?person foaf:mbox ?email } ;
-- end operation --
INSERT INTO <name_graph> {?person foaf:name ?name }
WHERE { ... }
Andy
Received on Thursday, 3 December 2009 19:07:19 UTC