From c81343a8d7fa5e06f4a5a85b633e0e8b5c9e7149 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Wed, 19 Jun 2019 14:27:42 +0200 Subject: [PATCH 1/3] Mention willful violation of the sparql-update spec --- api-rest.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/api-rest.md b/api-rest.md index 03f7166..9c6d9ff 100644 --- a/api-rest.md +++ b/api-rest.md @@ -332,7 +332,7 @@ MUST use POST (as defined by LDP) to create containers alone. #### Alternative: Using SPARQL -To write data, clients can send an HTTP PATCH request with a SPARQL payload to +To write data, clients can send an HTTP PATCH request with a sparql-update payload to the resource in question. If the resource doesn't exist, it should be created through an LDP POST or through a PUT. @@ -359,6 +359,11 @@ RESPONSE: HTTP/1.1 200 OK ``` +Willful violation of the sparql-update spec: DELETEs that don't match should +result in a 409 response, not a 200 response. +See https://github.com/solid/node-solid-server/issues/1085#issuecomment-461948770 +for more details. + **IMPORTANT:** There is currently no support for blank nodes and RDF lists in our SPARQL patches. @@ -392,4 +397,4 @@ Servers SHOULD send a WAC-Allow response header on HEAD and GET, with a value li ```http WAC-Allow: user="read write append control",public="read" ``` -In general, the format is `user="` + user-permissions = `",public="` + public-permissions + `"`. User-permissions and public-permissions should both be space-separated lists, containing a subset of ['read', 'write', 'append', 'control']. If 'write' is present then 'append' should also be present. \ No newline at end of file +In general, the format is `user="` + user-permissions = `",public="` + public-permissions + `"`. User-permissions and public-permissions should both be space-separated lists, containing a subset of ['read', 'write', 'append', 'control']. If 'write' is present then 'append' should also be present. From f2f62c2506c7ba080ee833193ec6aa1b85748165 Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Thu, 20 Jun 2019 09:45:27 +0200 Subject: [PATCH 2/3] apply review comments --- api-rest.md | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/api-rest.md b/api-rest.md index 9c6d9ff..37d2d96 100644 --- a/api-rest.md +++ b/api-rest.md @@ -330,11 +330,17 @@ If-None-Match](https://tools.ietf.org/html/rfc2616#section-14.24) HTTP headers. because the behavior of PUT (overwrite) is not well defined for containers. You MUST use POST (as defined by LDP) to create containers alone. -#### Alternative: Using SPARQL +#### Alternative: Using SPARQL Update -To write data, clients can send an HTTP PATCH request with a sparql-update payload to +To write data, clients can send an HTTP PATCH request with a [SPARQL Update](https://www.w3.org/TR/sparql11-update/) payload to the resource in question. If the resource doesn't exist, it should be created -through an LDP POST or through a PUT. +through an LDP POST or through a PUT first. +Since PATCH requests only apply to a single graph, identified by the request target, +only a subset of SPARQL Update is supported, namely: + +* [INSERT DATA](https://www.w3.org/TR/sparql11-update/#insertData) +* [DELETE DATA](https://www.w3.org/TR/sparql11-update/#deleteData) +* [INSERT/DELETE](https://www.w3.org/TR/sparql11-update/#deleteInsert) For instance, to update the `title` of the container from the previous example, the client would have to send a DELETE statement, followed by an INSERT @@ -359,10 +365,14 @@ RESPONSE: HTTP/1.1 200 OK ``` -Willful violation of the sparql-update spec: DELETEs that don't match should -result in a 409 response, not a 200 response. -See https://github.com/solid/node-solid-server/issues/1085#issuecomment-461948770 -for more details. +**Willful violation of the sparql-update spec:** +Solid purposely deviates from the SPARQL UPDATE specification. +A WHERE clause should result in _exactly_ one result mapping. +If there are zero matches, or if there is more than one match, +the server MUST reply with a 409. +This mechanism acts as a semaphore, +ensuring that the part of the data affected by the requested update +has not been altered in the meantime. **IMPORTANT:** There is currently no support for blank nodes and RDF lists in our SPARQL patches. From 2a64fb73e4d1d273b276ff928397ddd834e4ee4a Mon Sep 17 00:00:00 2001 From: Michiel de Jong Date: Thu, 20 Jun 2019 15:15:33 +0200 Subject: [PATCH 3/3] correct SPARQL Update --- api-rest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api-rest.md b/api-rest.md index 37d2d96..3514a5e 100644 --- a/api-rest.md +++ b/api-rest.md @@ -365,7 +365,7 @@ RESPONSE: HTTP/1.1 200 OK ``` -**Willful violation of the sparql-update spec:** +**Willful violation of the SPARQL Update spec:** Solid purposely deviates from the SPARQL UPDATE specification. A WHERE clause should result in _exactly_ one result mapping. If there are zero matches, or if there is more than one match,