- From: Martynas Jusevičius <martynas@atomgraph.com>
- Date: Fri, 9 Feb 2024 23:46:06 +0100
- To: Semantic Web <semantic-web@w3.org>, public-lod <public-lod@w3.org>
Hi,
I'm implementing conditional requests in a read-write Linked Data API
and am looking for some existing material on the topic.
I have found a few previous posts on ETags but not much:
https://github.com/solid/specification/issues/340
https://www.w3.org/2012/ldp/track/issues/10
My understanding re. ETags for RDF responses is:
* strong ETags should be used on specific serializations of an RDF
document, e.g. as a tuple <hash(graph), media-type>. Not byte-for-byte
identical as triple order can differ for identical graphs.
* weak ETags should be used to indicate graph equivalence regardless
of the serialization, e.g. as hash(graph).
Just to illustrate this with some HTTP pseudo-examples (please ignore
any incomplete RDF syntax):
# Strong ETags
GET /foo
Accept: application/n-triples
200 OK
Content-Type: application/n-triples
ETag: "123-nt"
<http://s> <http://p> <http://o> .
GET /foo
Accept: application/n-triples
200 OK
Content-Type: application/n-triples
ETag: "123-rdfxml"
<rdf:RDF>
<rdf:Description rdf:about="http://s">
<http:p rdf:resource="http://o"/>
</rdf:Description>
</rdf:RDF>
# Weak ETags
GET /foo
Accept: application/n-triples
200 OK
Content-Type: application/n-triples
ETag: W/"123"
<http://s> <http://p> <http://o> .
GET /foo
Accept: application/n-triples
200 OK
Content-Type: application/n-triples
ETag: W/"123"
<rdf:RDF>
<rdf:Description rdf:about="http://s">
<http:p rdf:resource="http://o"/>
</rdf:Description>
</rdf:RDF>
We are using strong ETags in our system. I have a feeling I've tried
weak ETags as described above and they caused issues either with
browser caching or proxy caching, but I could also be making this
up...
As for updating RDF documents, non-safe methods such as PUT require
strong ETags for conditional request validation (using the If-Match
header [2]).
Would you agree with my summary? Are you using conditional requests
with your Linked Data?
I'd be interested in others' experience on this topic, especially on
updating data.
Martynas
atomgraph.com
[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Conditional_requests
[2] https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-semantics-19#section-13.1.1
Received on Friday, 9 February 2024 22:46:23 UTC