Re: PATCH Use Case and Implemented Proposal

On Sep 8, 2013, at 14:03, Andy Seaborne <andy@apache.org> wrote:

> On 08/09/13 16:37, David Wood wrote:
>> On Sep 7, 2013, at 22:39, Sandro Hawke <sandro@w3.org> wrote:
>> 
>>> Thanks for something so concrete, Dave.   For myself, much of the challenge here is that I've not had time to implement, so it remains too abstract.    Some questions and thoughts, inline....
>>> 
>>> On 09/07/2013 09:09 PM, David Wood wrote:
>>>> Hi all,
>>>> 
>>>> The need for a PATCH format for LDP was brought up again in last week's meeting with TimBL [1].  To summarize briefly, Tim made the point that LDP has no generic way to update data without a PATCH format and Arnaud said that the WG wanted one but hadn't yet been able to define it.  Arnaud called for a halt on PATCH formats in May [2]
>>>> 
>>>> The two main approaches would seem to be Andy's proposal [3] which uses basic triple patterns to define what to add or remove from a store and Sandro's TurtlePatch [4].
>>>> 
>>> 
>>> I also did a Trig-based patch format, DataPatch: http://www.w3.org/People/Sandro/datapatch but like TurtlePatch I haven't actually been pushing it.    But it was going the direction the WG said it wanted to go, using TriG.
>>> 
>>>> This message suggests a third approach based on a strictly defined subset of SPARQL Update
>>> 
>>> Isn't that exactly what TurtlePatch was? 
>> 
>> 
>> Yep, sloppy phrasing.  Sorry.
>> 
>> 
>>>     True, your subset is somewhat..
>>> 
>>>> .  Our approach is already implemented in the (Apache 2 licensed) Callimachus Project [5] and documented later in this message.  Henry has already mentioned that a subset of SPARQL Update could work [6] for the WG's purposes.
>>>> 
>>>> A strict subset of SPARQL Update is used in the Callimachus implementation to support the following constructs in a PATCH request. However, each clause can only contain zero or more basic graph patterns and only the default graph can be used.
>>>>      * DELETE DATA
>>>>      * INSERT DATA
>>>>      * DELETE WHERE
>>>>      * INSERT WHERE
>>>>      * DELETE INSERT WHERE
>>>> 
>>>> Callimachus further restricts the SPARQL Update spec such that all nodes are connected and all URIs, in the subject position, before a '#' (if present), are the same.
>>>> 
>>> 
>>> What's the reasoning behind this?   I've always assumed that a basic requirement of Patch was that it be able to patch any RDF graph to any other RDF graph (given enough computing resources).    Is there some other requirement that necessitates this restriction?
>> 
>> 
>> It seems obvious to me that in the context of a REST API you don't want to be able to allow the addressing of one resource to be be able to be used to update another.  So, security and the making of intention concrete are good reasons.  Another is that this approach is easier to validate against the target URI.
> 
> That makes sense for LDP.
> 
> Does the format allow finding that resource by pattern, not just with a URI?
> 
> INSERT { ?this : 123  }
> WHERE { ?this   :InverseFunctionalProperty "key" }


Yes, that is what a Callimachus edit template does.

Regards,
Dave
--
http://about.me/david_wood

Received on Monday, 9 September 2013 00:28:47 UTC