kianschmalenbach / rdf-browser

A Firefox Add-on that requests RDF files and renders RDF files as Turtle documents with clickable links
MIT License
16 stars 6 forks source link

Doesn't work without Content-Type header #22

Closed kernc closed 1 year ago

kernc commented 3 years ago

Loading, say, this URL: https://www.lexinfo.net/ontology/3.0/lexinfo, the addon doesn't fire. I see the server in question doesn't return Content-Type header, but since the content is clearly RDF/XML and the browsers recognize it as such (XML), I feel the addon might too. :grin:

aharth commented 3 years ago

One goal of the addon is to help data publishers provide correct Linked Data. As I view it, Linked Data is about making it easier for user agents to consume data on the web.

Should a user agent do content sniffing? Should a user agent fix content encoding errors? Should a user agent fix "simple" syntax errors? Should a user agent parse triples out of HTMLised RDF triples?

To facilitate machine access to data, I would discourage user agents to do content sniffing and require a minimal level of conformance to make it easier for everybody else to consume Linked Data.

kernc commented 3 years ago

Agreed. Yet:

If a Content-Type header field is not present, the recipient MAY either assume a media type of "application/octet-stream" or examine the data to determine its type.

In practice, resource owners do not always properly configure their origin server to provide the correct Content-Type for a given representation ...

https://tools.ietf.org/html/rfc7231#section-3.1.1.5

Mozilla just checks if the file starts with <xml.

Doesn't RDF/XML always also have something like <{rdf_prefix}:RDF\b.

mxmilkiib commented 3 years ago

It would be nice is static RDF docs like https://gitlab.com/lv2/lv2/-/raw/master/lv2/core/lv2core.ttl (the uri is actually http://lv2plug.in/ns/lv2core, but the order differs) or something local like file:///usr/lib/lv2/vitalium.lv2/vitalium.ttl were to be highlighted and linked.

aharth commented 1 year ago

As someone who develops several Linked Data user agents, I am not prepared to put content sniffing functionality in all of my user agents (for all sorts of different serialisation syntaxes).

I realise that Postel's law suggests otherwise.

If you have problems convincing the data publisher to add a Content-Type header, the Pedantic Web group might help convince the data publisher, see https://pedantic-web.org/.