bio2rdf / bio2rdf-rest-talend

A RESTful interface to the Bio2RDF network of data.
MIT License
5 stars 1 forks source link

Incorrect handling of content negotiation header #1

Open micheldumontier opened 10 years ago

micheldumontier commented 10 years ago

It looks like whatever libraries are being used to handle the content-negotiation at the Bio2RDF end are not dealing with these complex (but valid!) request headers.

curl -H 'Accept: application/rdf+xml, application/xml; q=0.8, text/xml; q=0.7, application/rss+xml; q=0.3, /; q=0.2' --dump-header -http://bio2rdf.org/hgnc_vocabulary:approved-name HTTP/1.1 404 Not Found Date: Fri, 13 Jun 2014 08:02:39 GMT Server: Jetty(8.1.12.v20130726) Content-Length: 0

$ curl -H 'Accept: application/rdf+xml' --dump-header -http://bio2rdf.org/hgnc_vocabulary:approved-name HTTP/1.1 200 OK Date: Fri, 13 Jun 2014 08:03:11 GMT Server: Jetty(8.1.12.v20130726) Content-Type: application/rdf+xml Content-Length: 1720

@VEmonet

vemonet commented 10 years ago

http://www.w3.org/TR/swbp-vocab-pub/#negotiation https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/RDFDataMgr.html

ansell commented 10 years ago

The previous version webapp passed the following test-case, including the Accept header that Michel mentions above and other major browsers common headers:

https://github.com/ansell/queryall/blob/develop/content-negotiation/src/test/java/org/queryall/negotiation/test/QueryallContentNegotiatorTest.java

vemonet commented 10 years ago

Issue fixed on http://beta.bio2rdf.org/

curl -i -H 'Accept: application/rdf+xml, application/xml; q=0.8, text/xml; q=0.7, application/rss+xml; q=0.3, /; q=0.2' http://beta.bio2rdf.org/hgnc_vocabulary:approved-name

HTTP/1.1 200 OK
Date: Thu, 19 Jun 2014 21:01:18 GMT
Server: Jetty(8.1.14.v20131031)
Content-Type: application/rdf+xml
Content-Length: 1593

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:j.0="http://bio2rdf.org/hgnc_vocabulary:"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:void="http://rdfs.org/ns/void#"
    xmlns:ns5="http://bio2rdf.org/bio2rdf_vocabulary:"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" > 
  <rdf:Description rdf:about="http://bio2rdf.org/hgnc_vocabulary:approved-name">
    <ns5:uri rdf:datatype="http://www.w3.org/2001/XMLSchema#string">http://bio2rdf.org/hgnc_vocabulary:approved-name</ns5:uri>
    <dc:identifier>hgnc_vocabulary:approved-name</dc:identifier>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/>
    <rdfs:label xml:lang="en">approved name [hgnc_vocabulary:approved-name]</rdfs:label>
    <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string">approved name [hgnc_vocabulary:approved-name]</rdfs:label>
    <ns5:namespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">hgnc_vocabulary</ns5:namespace>
    <dcterms:title xml:lang="en">approved name</dcterms:title>
    <rdf:type rdf:resource="http://bio2rdf.org/hgnc_vocabulary:Resource"/>
    <ns5:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">approved-name</ns5:identifier>
    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">hgnc_vocabulary:approved-name</dcterms:identifier>
    <void:inDataset rdf:resource="http://bio2rdf.org/hgnc_resource:bio2rdf.dataset.hgnc.R3"/>
  </rdf:Description>
</rdf:RDF>

The service will return result for those MIME types :

(the json-ld will come when the REST service will handle that)

Let me know if you find some issues with this or if I can deploy it on bio2rdf.org !

@micheldumontier

micheldumontier commented 10 years ago

Great! go ahead and deploy on bio2rdf.org

micheldumontier commented 9 years ago

Hi. We need to support other content-types: application/x-ntriples application/x-nquads application/x-trig

possible?

vemonet commented 9 years ago

I'll take a look when the datahub update will be done

ansell commented 9 years ago

Standardising on application/n-triples (RDF-1.1 N-Triples) and application/trig (RDF-1.1 TriG) and application/n-quads (RDF-1.1 N-Quads) would also be useful if the underlying RDF library actually outputs them.

vemonet commented 9 years ago

We are using Jena library to generate the RDF in different formats