buda-base / lds-pdi

http://purl.bdrc.io BDRC Linked Data Server
Apache License 2.0
2 stars 0 forks source link

a bit more semantic headers #63

Closed eroux closed 6 years ago

eroux commented 6 years ago

Looking at some other semantic systems, I think there are a few additional headers we could use. For instance

$ curl -I http://dbpedia.org/resource/Shantideva -H "Accept: text/turtle"

gives an interesting result:

HTTP/1.1 303 See Other
Date: Tue, 29 May 2018 09:18:45 GMT
Content-Type: text/turtle
Content-Length: 0
Connection: keep-alive
Server: Virtuoso/07.20.3228 (Linux) i686-generic-linux-glibc25-64  VDB
TCN: choice
Vary: negotiate,accept
Alternates: {"/data/Shantideva.atom" 0.500000 {type application/atom+xml}}, {"/data/Shantideva.jrdf" 0.600000 {type application/rdf+json}}, {"/data/Shantideva.jsod" 0.500000 {type application/odata+json}}, {"/data/Shantideva.json" 0.600000 {type application/json}}, {"/data/Shantideva.jsonld" 0.500000 {type application/ld+json}}, {"/data/Shantideva.n3" 0.800000 {type text/n3}}, {"/data/Shantideva.nt" 0.800000 {type text/rdf+n3}}, {"/data/Shantideva.ntriples" 0.500000 {type application/n-triples}}, {"/data/Shantideva.ttl" 0.700000 {type text/turtle}}, {"/data/Shantideva.xml" 0.950000 {type application/rdf+xml}}
Link: <http://creativecommons.org/licenses/by-sa/3.0/>;rel="license",<http://mementoarchive.lanl.gov/dbpedia/timegate/http://dbpedia.org/resource/Shantideva>; rel="timegate"
Location: http://dbpedia.org/data/Shantideva.ttl

In our case we can serve the .ttl directly and not care about the redirection, but the TCN and Alternates headers are interesting and I think we should use them.

The Links would certainly be a little convoluted to produce so I don't think it's really interesting for us...

As we have direct links for ttl, jsonld, etc. we should also use the Content-Location header, for instance when doing

curl -I http://purl.bdrc.io/resource/P1583 -H "Accept: application/rdf+xml"

we should see:

Content-Location: P1583.xml
MarcAgate commented 6 years ago

Implemented as of commit f391dfa

I considered that a url is an alternate to itself, which is logically true. Therefore, I didn't parse the accept header to remove the current url from the alternates list (I tried but realized that it was a whole different story and I am not sure it worth the effort).