W3C home > Mailing lists > Public > semantic-web@w3.org > September 2014

Turtle Patch simplification (N3 Patch?)

From: <henry.story@bblfish.net>
Date: Sat, 20 Sep 2014 12:57:53 +0200
Message-Id: <D0E67C04-D66D-44C7-9C8C-3D374178C709@bblfish.net>
To: public-ldp-comments@w3.org, public-ldp <public-ldp@w3.org>, Semantic Web <semantic-web@w3.org>
Turtle Patch [1] makes it obvious that being able to name the bnode
URIs in a patch request makes patching exceedingly easy to 
implement as well as very easy to create patches. All that is needed for 
a client implementation is to know what triples it needs to remove:
there is no need to find a pattern that would identify those triples
among all others. The main problem with Turtle Patch is that it
requires one to then make a new HTTP request with genid blank nodes,
to get the patchable format of the resource, or to always request them
and then sadly turn all bnodes de facto into URIs.

Where there is usually a valid concern about naming bnodes - the
point of bnodes is that they the server publishing them should not have to
maintain references to them add eternam - in the case of a PATCH
the action is directly on the graph in question, and so there is in this
case no problem of cross reference with other resources.

Given this I think one should be able to have a simpler version of Turtle 
patch without the need for genids, that keep the bnodes local to the
resource and that also don't require the extra request to be made to the
server ( the one that is required to GET the graphs with the genids using
the "Prefer: return=representation blank-nodes=use-genid" header ).

It could simply be decided that a resource that advertises the given
Patch Format - lets call it N3-Patch - understands there to be an automatic
mapping from the order of bnodes in their representation to a set 
of explicit bnodes such as _:bn1 to _:bnN . One could then have something like
the following document at /asterix

GET /asterix HTTP/1.1


HTTP/1.1 200 Ok 
E-Tag: "slab v2"

[] foaf:name "Asterix".
   foaf:knows [ foaf:name "Julius Caesar";
                foaf:homePage <http://palace.rome/> ].

[] foaf:name "Obelix" .

And patch it with the following PATCH Request

PATCH /asterix HTTP/1.1
Content-Type: text/n3
If-Match: "slab v2"

@prefix foaf: <http://xmlns.com/foaf/0.1/> 

{ _:bnx1 foaf:knows _:bnx2 } patch:replaceWith { _:bnx1 foaf:knows _:bnx3 }

Which would result in a following request 

GET /asterix HTTP/1.1
Accept: text/turtle

HTTP/1.1 200 Ok
Content-Type: text/turtle

[] foaf:name "Asterix".
   foaf:knows [ foaf:name "Obelix" ].

[] foaf:name "Julius Caesar";
   foaf:homePage <http://palace.rome/>


Henry


[1] http://www.w3.org/2001/sw/wiki/TurtlePatch


Social Web Architect
http://bblfish.net/
Received on Saturday, 20 September 2014 10:58:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 1 March 2016 07:42:53 UTC