- From: Martynas Jusevičius <martynas@atomgraph.com>
- Date: Wed, 7 Nov 2018 23:27:27 +0100
- To: Gregory Williams <greg@evilfunhouse.com>
- Cc: public-sparql-dev@w3.org
I meant SELECT/ASK -> ResultSet -> SPARQL results -> ... On Wed, Nov 7, 2018 at 11:26 PM Martynas Jusevičius <martynas@atomgraph.com> wrote: > > Accept: application/sparql-results+xml;q=1.0, application/rdf+xml;q=0.9 > > This seems to solve the issue. Thanks for the tip :) > > As for the "2 different sets"... It's probably irrelevant now, but I > think I failed to explain it properly. I've implemented a SPARQL > endpoint using Jena and JAX-RS. > > In Jena, SELECT/ASK and DESCRIBE/CONSTRUCT return 2 different data > structures: ResultSet and Model. And in JAX-RS, serializers map data > structure (class) to a format/media type. So it ends up with 2 > different serialization paths: > > SELECT/ASK -> ResultSet -> SPARQL XML results -> { > application/sparql-results+xml, application/sparql-results+json, ... } > DESCRIBE/CONSTRUCT -> Model -> RDF -> { text/turtle, application/rdf+xml, ... } > > JAX-RS cannot apply the Model serializers to ResultSets, and vice > versa. I assumed this would be similar in other implementations. > On Wed, Nov 7, 2018 at 11:03 PM Gregory Williams <greg@evilfunhouse.com> wrote: > > > > On Nov 7, 2018, at 1:46 PM, Martynas Jusevičius <martynas@atomgraph.com> wrote: > > > > > > On Wed, Nov 7, 2018 at 10:22 PM Gregory Williams <greg@evilfunhouse.com> wrote: > > >> > > >> It looks to me like DBPedia is doing a perfectly fine thing sending you back rdf/xml for the select query, because it’s using an rdf/xml serialization of a result set. I don’t think this format was ever standardized, but it’s used within the SPARQL test suite. > > > > > > Well, OK. But it's prioritizing a non-standard format over a standard > > > one. The request does not specify such priority. > > > > The server almost certainly doesn’t know which formats are “non-standard.” Your request has told the server that either of the media types are equally acceptable, so it chose one. The solution to this is to tell the server which media types you prefer. > > > > >> If you prefer the standardized "SPARQL Query Results XML Format” (or JSON, CSV, or TSV), then you should use an appropriate q-value in your Accept header to indicate that. > > >> > > >>> - should an endpoint use different conneg for different query types? > > >> > > >> The query type isn’t the important part here. It’s the serialization format of the result of that query type. > > > > > > Really though? If, unlike Virtuoso, my SPARQL endpoint implementation > > > does not have an RDF/XML serializer for SPARQL results, then it has to > > > send 406 Not Acceptable when RDF/XML is requested for SELECT/ASK. > > > > I’m not sure what the *endpoint* using “different conneg” means in this context. If the client requests a media type that isn’t available, the server can response with 406. But that isn’t a requirement. RFC7231 has this to say: > > > > """ > > If the header field is present in a request and none of the available representations for the response have a media type that is listed as acceptable, the origin server can either honor the header field by sending a 406 (Not Acceptable) response or disregard the header field by treating the response as if it is not subject to content negotiation. > > """ > > > > > In other words, my implementation has to maintain 2 different sets of > > > variants for those 2 query types. > > > > I’m not sure on why you think this is true. Will the example I gave with different q-values not handle your use-case? It should be able to gracefully handle the two different XML formats we’ve been discussing. > > > > thanks, > > .greg > >
Received on Wednesday, 7 November 2018 22:27:59 UTC