Re: Updates

On Tue, Dec 1, 2009 at 8:58 AM, Andy Seaborne <andy.seaborne@talis.com> wrote:
>
>
> On 01/12/2009 02:05, Paul Gearon wrote:
>>
>> Hi Everyone,
>
> ...
>
> Overall:
>
> Are there exampe cases where WITH/INTO/FROM is better than GRAPH?
> (i.e. am I missing something?)

The idea of WITH (or USING was the other suggestion) was to provide a
default for anything that doesn't mention a graph. This became more
useful when multiple INSERT/DELETE was proposed.

INTO/FROM defines the graph being modified. If these are left out,
then revert to WITH.

The pattern in WHERE is applied to the graph from WITH. This can be
overridden with GRAPH statements in the pattern.

>> - MODIFY is no longer there.
>>
>> - Templated updates start with an optional "WITH", which defines the
>> graph to use when one is not specified in either a template or a WHERE
>> clause.
>
> Shouldn't WITH apply to INSERT DATA / DELETE DATA as well?

It wasn't mentioned. It doesn't offer a lot, since INTO/FROM is also
available, but it would be consistent.

>> - Instead of the strict form of DELETE...INSERT...WHERE, there is now
>> a list of directives of DELETE or INSERT, followed by an optional
>> WHERE. The list is executed in order.
>
> I confess I don't see the arbitrary order of INSERTs and DELETEs as very
> clear.  Is there a reason for multiple INSERTs and DELETEs, and allowing
> INSERTs before DELETEs?

The request seems to have two motivations, both based on modifying
more than one graph at a time. The first is that it provides a syntax
for specifying several graphs (though allowing "GRAPH <uri> {...}"
into the template would also provide this).

The second was to address public concerns that we've had about lack of
transaction support. This didn't make it into the mailing list, but we
were grilled on it at ISWC. The most vocal concern came from Abraham
Bernstein. Should I ask him to write something formal? (I'm surprised
he hasn't already).


> INSERT { ?s :p 23 }
> DELETE { ?s :p 23 }
> WHERE  { ?s :p 24 }
>
> is a no-op?

Yes.

>  If DELETEs go before INSERTs, it makes it clear DELETEs don't
> apply to INSERTs in the same operation.  Or do they?

I was under the impression that it was supposed to be ordered. It
matters more when the WHERE clause gets applied, which is important
when it is implicit (the point you get to next).

>> - If the WHERE clause is missing from the end of a templated update,
>> each template is treated as its own WHERE clause to use for that
>> statement.
>
> Is each abbreviated form is executed on it's own?  The point at which
> patterns are matched matters.

This was my expectation, and yes, the WHERE clauses will get matched
in order. It might be too hard for some implementations otherwise
(Mulgara would be fine, but I can see that it could be problematic for
some - or am I wrong?).

>> - I did not include a ; to separate the DELETE/INSERT list because
>> there appeared to be no need (given that each is followed by a
>> template surrounded by curly braces).
>
> The forms themselves are terminated by } but
>
> directive [ directive ]*
>
> only works if nothing following starts with a directive.
>
> WITH is optional, how do does the parser know when one set of INSERT/DELETE
> ends and another (without WITH) begins?

OK, so I was working on a different assumption. I didn't realize that
unrelated update commands could be found in the same string of text.
If that is the case, then yes, the semicolons would be required.

<snip data="examples and explanation"/>

Regards,
Paul Gearon

Received on Tuesday, 1 December 2009 17:24:25 UTC