- From: Martynas Jusevičius <martynas@atomgraph.com>
- Date: Wed, 7 Nov 2018 22:02:14 +0100
- To: public-sparql-dev@w3.org
Hi,
I'm implementing a basic SPARQL UI using a generic URI to XML resolver [1].
The resolver does not know about the nature of the SPARQL query being
executed, its only input is the request URI. It can control request
headers though.
So I was wondering what kind of generic Accept header should it send
to get the right XML response: RDF/XML in case DESCRIBE/CONSTRUCT,
SPARQL XML results in case of SELECT/ASK.
I tried Accept: application/rdf+xml, application/sparql-results+xml first.
Executing both a CONSTRUCT and SELECT on DBpedia:
curl -v -H "Accept: application/rdf+xml,
application/sparql-results+xml"
http://dbpedia.org/sparql?query=construct+%7B+%3Fs+%3Fp+%3Fo+%7D+where+%7B%3Fs+%3Fp+%3Fo+%7D+LIMIT+1
curl -v -H "Accept: application/rdf+xml,
application/sparql-results+xml"
http://dbpedia.org/sparql?query=select+*+where+%7B%3Fs+%3Fp+%3Fo+%7D+LIMIT+1
Both responses came back with Content-Type: application/rdf+xml, which
is incorrect in the case of SELECT.
I executed the same queries on Wikidata's BlazeGraph:
curl -v -H "Accept: application/rdf+xml,
application/sparql-results+xml"
https://query.wikidata.org/bigdata/namespace/wdq/sparql?query=construct+%7B+%3Fs+%3Fp+%3Fo+%7D+where+%7B%3Fs+%3Fp+%3Fo+%7D+LIMIT+1
curl -v -H "Accept: application/rdf+xml,
application/sparql-results+xml"
https://query.wikidata.org/bigdata/namespace/wdq/sparql?query=select+*+where+%7B%3Fs+%3Fp+%3Fo+%7D+LIMIT+1
As expected, CONSTRUCT returned Content-Type: application/rdf+xml,
while SELECT returned Content-Type: application/sparql-results+xml.
Then I tried a single generic Accept: application/xml, but that didn't
work because I guess it's not compatible with the +xml types.
So here comes the questions:
- is DBPedia/Virtuoso or Wikidata/BlazeGraph doing the right thing here?
- should an endpoint use different conneg for different query types?
- does the Protocol spec define this somewhere?
- what should be the generic Accept header, if not Accept:
application/rdf+xml, application/sparql-results+xml?
The resolver could of course try to parse the URL to try to determine
the query type, but that just smells of a bad solution.
[1] https://docs.oracle.com/javase/8/docs/api/index.html?javax/xml/transform/URIResolver.html
Martynas
Received on Wednesday, 7 November 2018 21:02:46 UTC