Ticket #5 (closed enhancement: fixed)
Allow selection of SPARQL result format via URL parameter
| Reported by: | Richard Cyganiak <richard@…> | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | Unknown | Version: | 1.0 |
| Keywords: | Cc: |
Description
In its SPARQL protocol implementation, 4store allows selection of the result format (JSON, XML, plain text) via content negotiation, that is, by providing an "Accept" HTTP header in the request.
Please also allow specifying the format via an URL parameter, that is, by adding something like "&output=json" to the query URL (or to the POSTed parameters).
There is a quasi-standard for this, which I believe started with Andy Seaborne's Joseki server. By default, XML is returned. If "output=json" is specified, then JSON is returned. This behaviour works at least on Joseki and Virtuoso. But any other param name/value would be fine with me.
The benefit over the content negotiation method: It would allow users to override the default preferences of the HTTP client. For example, it would allow me to get JSON or XML from inside a web browser, which currently is impossible if the web browser's Accept header prefers plain text. This is crucial for making one feature in Snorql (a very simple browser-based SPARQL client that I'm maintaining) work with 4store.

This should be fixed in f60ac8397060c2b263d61426d552da10c7cbb5ca
specifically output=json will return JSON, output=text will return TSV and output=sparql will returbn SPARQL XML format.