Closed jpullmann closed 5 years ago
That means the kernel asked the remote engine for XML results, and expected to receive a MIME type of application/sparql-results+xml
(i.e. an SPARQL XML response). Instead, it received an RDF document (MIME type application/rdf+xml
) so it complains.
Result formats from SPARQL engines are tricky, there is no clear standard on what they must provide. But in any case I'm afraid that the code does not currently have the possibility to request RDF as a choice; when it says XML
it refers to XML results of a SPARQL query (though if you set the format to ANY
and the server returns RDF, it might be able to render it).
In my case the query is a CONSTRUCT
, according to Sparql 1.1 protocol it'd render to a graph representation as requested by content negotiation. Format XML
would in case of CONSTRUCT
and DESCRIBE
equal to expected media type application/rdf+xml
or to application/sparql-results+xml
otherwise?
No, right now XML
is only valid for SELECT
queries, for CONSTRUCT
queries it won't work, basically because there is no code yet to parse the resulting RDF format.
You may try N3
as format (or use default
, which will automatically select N3 for CONSTRUCT
queries), since N3 can be parsed and represented.
Hi Paulo, this was meant as a suggestion. N3 and the tabular graph rendering is almost unreadable when more then few resources are involved, e.g. sorting does not work, the statements are scattered. I expect this be considerably enhanced with a format like RDF/XML-ABBREV or JSON-LD for graphs.
ok, I see. I'll try to take a look to see what's possible. At the very least raw output should be doable with not much effort.
Ok, I finally got time to take a look at this. Handling it in a totally transparent way is difficult becase I use SPARQLWrapper to create the quaries, and that package has a limited set of allowed formats (it also sends the format in two places: as a query string parameter and as an Accept header, and it predefines what the Accept header will be based on the format).
The 1.3.0 branch (in testing now) allows removing a format request (%format none
), and then the specifics of the format can be negotiated directly with the backend via custom %qparam
and/or %http_header
values. Hopefully with them it is possible to generate a version valid for any backend.
Of course, if the results are in a format that the code cannot parse, the only rendering possible is the raw
one. But it is better than nothing.
Request for RDF/XML rendering (%format XML) results in the following error:
Unexpected response format: application/rdf+xml (requested: xml)
System configuration: