Re: Example updates

On Thu, Dec 3, 2009 at 2:06 PM, Andy Seaborne <andy.seaborne@talis.com> wrote:
>
>
> 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.

That may well be the case, which is why I'm asking people to look at it.

> 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/.

Well, as I said, until yesterday I hadn't even considered that a
request could contain more than 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.

But wasn't the ; separator supposed to identify where multiple DELETEs
belonged to the same operation and where they were separate
operations? Or do I have that completely backwards? People may have
been talking about multiple operations the whole time and I didn't get
it. All the same, now I'm considering separate operations in a single
request, I'm thinking that ; would have been better as the operation
separator.

Anyway, as written, the WHERE is just supposed to apply the operation
that it's a part of, so I didn't see any ambiguity.

> 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
>

Because I wrote it with the intention that ; was to indicate that both
INSERTs were part of the same operation, meaning that the WHERE
applied to both of them.

Paul

Received on Thursday, 3 December 2009 19:27:09 UTC