CommentResponse:MS-1

From SPARQL Working Group
Jump to: navigation, search

Status: draft

http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/2010Oct/0058.html


Dear Michael

> Dear working group!

>I was trying to answer a pretty basic question from reading the SPARQL 1.1
> Update working draft (14 October 2010) but was not able to. So either this
> topic has not been addressed, or I may have missed something, but in the
> latter case I suggest to clarify the text.
>
> My question is as follows: If the default graph is updated by means of an
> INSERT operation, does the update operation happen in a "recursive" way?
> What I mean is, if the graph pattern in the WHERE clause is matched, are the
> result triples inserted immediately into the graph, and do the following
> matches depend on the inserted results of the first match? Or does the
> update of the graph happen only after all matches have been performed?

SPARQL Update operations are non-recursive. Hence, the new triples are inserted once, and no further update is performed. Note that particular interactions with Entailment Regimes, e.g. what happens on deletion of implicit triples is not standardized in the current specs and left to implementations, see the informative section on "Entailment Regimes and Updates" in http://www.w3.org/TR/sparql11-entailment/ ).

>I give an example to make the difference clear. Let the original graph be as
>follows:
>
>   { 
>     :A :p :B .
>      :B :p :C .
>     :C :p :D .
>    }
>
>The update expression is defined as follows:
>
>   INSERT { ?x :p ?z }
>    WHERE { 
>        ?x :p ?y .
>        ?y :p ?z . 
>    }
>
> Now, in the case of a non-recursive (non-immediate) update, there would be
> exactly two matches, namely
>
>   ?x = :A , ?y = :B , ?z = :C
>    ?x = :B , ?y = :C , ?z = :D
>
> This would lead to the following result graph:
>
>    {
>      :A :p :B .
>      :B :p :C .
>      :C :p :D .
>      :A :p :C .
>      :B :p :D .
>    }
>

That will indeed be the expected results. The new section "4 SPARQL Update Formal Model" in the SPARQL 1.1 Update document (see http://www.w3.org/2009/sparql/docs/update-1.1/#formalModel for the current Editor's draft) shall clarify this behaviour.

We would be grateful if you would acknowledge that your comment has been answered by sending a reply to this mailing list.

Alex.
on behalf of the SPARQL working group

---

> However, with a recursive update, there would be four matches, namely
>
>   ?x = :A , ?y = :B , ?z = :C
>   ?x = :B , ?y = :C , ?z = :D
>   ?x = :A , ?y = :B , ?z = :D (*)
>   ?x = :A , ?y = :C , ?z = :D (*)
>
> The two matches marked by (*) would happen due to the triples that have been
> inserted into the graph stemming from the first two matches.
>
> The result graph would then be
>
>   {
>     :A :p :B .
>     :B :p :C .
>     :C :p :D .
>     :A :p :C .
>     :B :p :D .
>     :A :p :D . (*)
>   }
>
> The triple (*) in the graph would be the difference.
>
> So, how is INSERT supposed to behave?
>
> Cheers,
> Michael