Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Content-negotiation & rapper #25

Open
ktk opened this issue May 17, 2016 · 1 comment
Open

Content-negotiation & rapper #25

ktk opened this issue May 17, 2016 · 1 comment
Labels
Milestone

Comments

@ktk
Copy link
Contributor

ktk commented May 17, 2016

Currently one does not get any triples back from Trifid-LD when using rapper from Redland RDF Libraries. I filed an issue for rapper: http://bugs.librdf.org/mantis/view.php?id=590 (text taken from there):

Rapper currently (2.0.14) seems to send the following Accept header:

accept: 'application/rdf+xml, text/rdf;q=0.6, application/n-triples, text/plain;q=0.1, text/turtle, application/x-turtle, application/turtle, text/n3;q=0.3, text/rdf+n3;q=0.3, application/rdf+n3;q=0.3, application/x-trig, application/rss;q=0.8, application/rss+xml;q=0.8, text/rss;q=0.8, application/xml;q=0.3, text/xml;q=0.3, application/atom+xml;q=0.3, text/html;q=0.2, application/xhtml+xml;q=0.4, text/html;q=0.6, application/xhtml+xml;q=0.8, text/x-nquads, */*;q=0.1'

This works fine as long as RDF/XML is supported by the server. However, if the server only serves Turtle or NTriples, the server will answer to that with HTML before a RDF serialization.

RDF/XML is no longer supported by all servers out there so I would propose to give Turtle and NTriples a higher priority than HTML to make sure we get RDF back if it is supported by the server.

Dave answered with a question:

Can you be more specific.

Turtle / N3 family 0.1 to 1.0

application/n-triples, text/plain;q=0.1, text/turtle, application/x-turtle, application/turtle, text/n3;q=0.3, text/rdf+n3;q=0.3, application/rdf+n3;q=0.3, application/x-trig

HTML range 0.2-0.8

text/html;q=0.2, application/xhtml+xml;q=0.4, text/html;q=0.6, application/xhtml+xml;q=0.8

What would I raise and what lower?

Redland is still quite popular so I would like to know if we do something wrong or if Redland needs to adjust its request. I'm a bit lost here, maybe @retog could have a look at that and compare it with content-negotiation specs?

@bergos bergos added the bug label May 23, 2016
@ktk
Copy link
Contributor Author

ktk commented Aug 23, 2016

Possible solutions:

Easy solution (efficient but requires config):

  • put supported media-types of the endpoint into the config, if HTML has a higher (or equal) q-value than all of the supported types, return HTML

Other solution:

  • if text/html has a q-value of 1, return HTML
  • else, send HEAD request to SPARQL endpoint with unmodified accept header. If the value of the content-type header of the response is media type of a higher q-value than HTML, do non-html processing. Otherwise do HTML processing

@ktk ktk modified the milestone: V1 Aug 23, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants