Haigutus / Energy-Reference-Data

Reference Data for Energy domain using SKOS
0 stars 2 forks source link

content negotiation and semantic redirects #54

Open VladimirAlexiev opened 1 year ago

VladimirAlexiev commented 1 year ago

@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

Haigutus commented 8 months ago

In the current tooling we do not have access to the web-server config, it is hosted directly on github static pages, so all solutions that we can implement are based on HTML built in functionality or by using javascript. All the examples you provided seem to use server side solutions, unfortunately this is currently not available for us.

VladimirAlexiev commented 7 months ago

Who's admin of http://energy.referencedata.eu, is it EU OPOCE?

griddigit-ci commented 7 months ago

It is Kristjan now :), but it will move to ENTSO-E gitHub

VladimirAlexiev commented 7 months ago

Hi @griddigit ! Where is this github? Cheers!

griddigit-ci commented 7 months ago

Hi Vlado, It is in preparation. ENTSO-E is working on it