Skip to content
This repository was archived by the owner on Apr 13, 2022. It is now read-only.

Commit f2f62c2

Browse files
apply review comments
1 parent c81343a commit f2f62c2

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

api-rest.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -330,11 +330,17 @@ If-None-Match](https://tools.ietf.org/html/rfc2616#section-14.24) HTTP headers.
330330
because the behavior of PUT (overwrite) is not well defined for containers. You
331331
MUST use POST (as defined by LDP) to create containers alone.
332332

333-
#### Alternative: Using SPARQL
333+
#### Alternative: Using SPARQL Update
334334

335-
To write data, clients can send an HTTP PATCH request with a sparql-update payload to
335+
To write data, clients can send an HTTP PATCH request with a [SPARQL Update](https://www.w3.org/TR/sparql11-update/) payload to
336336
the resource in question. If the resource doesn't exist, it should be created
337-
through an LDP POST or through a PUT.
337+
through an LDP POST or through a PUT first.
338+
Since PATCH requests only apply to a single graph, identified by the request target,
339+
only a subset of SPARQL Update is supported, namely:
340+
341+
* [INSERT DATA](https://www.w3.org/TR/sparql11-update/#insertData)
342+
* [DELETE DATA](https://www.w3.org/TR/sparql11-update/#deleteData)
343+
* [INSERT/DELETE](https://www.w3.org/TR/sparql11-update/#deleteInsert)
338344

339345
For instance, to update the `title` of the container from the previous example,
340346
the client would have to send a DELETE statement, followed by an INSERT
@@ -359,10 +365,14 @@ RESPONSE:
359365
HTTP/1.1 200 OK
360366
```
361367

362-
Willful violation of the sparql-update spec: DELETEs that don't match should
363-
result in a 409 response, not a 200 response.
364-
See https://github.com/solid/node-solid-server/issues/1085#issuecomment-461948770
365-
for more details.
368+
**Willful violation of the sparql-update spec:**
369+
Solid purposely deviates from the SPARQL UPDATE specification.
370+
A WHERE clause should result in _exactly_ one result mapping.
371+
If there are zero matches, or if there is more than one match,
372+
the server MUST reply with a 409.
373+
This mechanism acts as a semaphore,
374+
ensuring that the part of the data affected by the requested update
375+
has not been altered in the meantime.
366376

367377
**IMPORTANT:** There is currently no support for blank nodes and RDF lists in
368378
our SPARQL patches.

0 commit comments

Comments
 (0)