Skip to content

content negotiation and semantic redirects #54

@VladimirAlexiev

Description

@VladimirAlexiev

@Haigutus @Sveino @gridDigIt
Here's how the current service lists the 3 semantic formats:

$ curl -L  http://energy.referencedata.eu/EIC/11W0-0000-0038-O
<html>
    <head>
        <link rel="alternate" type="application/rdf+xml" href="../11W0-0000-0038-O.rdf" title="RDF/XML" />
        <link rel="alternate" type="application/ld+json" href="../11W0-0000-0038-O.jsonld" title="JSON-LD" />
        <link rel="alternate" type="text/turtle" href="../11W0-0000-0038-O.ttl" title="Turtle" />
    </head>
    <body>
        <meta http-equiv = "refresh" content = "0; url = ../11W0-0000-0038-O.rdf" />
    </body>
</html>

Content negotiation is not supported:

$ curl -LI -Haccept:application:rdf+xml  http://energy.referencedata.eu/EIC/11W0-0000-0038-O
...
Content-Type: text/html; charset=utf-8  # same as above

Curl cannot enact http-equiv=refresh, see https://everything.curl.dev/http/redirects#non-http-redirects.
So to get an RDF resource in an easy way (without using eg a headless browser), you need to use a URL with extension:

$ curl -LI  http://energy.referencedata.eu/EIC/11W0-0000-0038-O.rdf
HTTP/1.1 200 OK
Content-Length: 1395
Content-Type: application/rdf+xml

The current setup uses an obsolete http-equiv=refresh technique.
It doesn't match any of the alternatives described in Best Practice Recipes for Publishing RDF Vocabularies.
You can check with http://linkeddata.uriburner.com:8000/vapour that the current setup fails best practices (sorry, the styles in this app are broken).
The proper way is to support content negotiation, and redirect to the final URL using a 303 redirect.
You can read how we did it for the Getty at https://vocab.getty.edu/doc/#Semantic_Resolution.

PS: There's a discussion at https://www.wikidata.org/wiki/Property_talk:P1921#h-Only_1_URI-20230807135400

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeston holdIssue is not active due to low priority or other blocking issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions