W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > May 2011

Re: [COMMENT] Behavior of SPARQL Update INSERT on default graphs

From: Alexandre Passant <alexandre.passant@deri.org>
Date: Wed, 4 May 2011 08:00:28 +0100
Message-Id: <8F22EE2E-727C-447D-A4B9-CF1296500FE0@deri.org>
To: public-rdf-dawg-comments@w3.org, schneid@fzi.de
Dear Michael,

Sorry for the delayed answer

> 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
>   { 
>     :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.

on behalf of the SPARQL working group
Received on Wednesday, 4 May 2011 07:00:59 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:52:11 UTC