Bene,

Thanks for this. Yes, that works. 

For SELECT queries, the response format is application/sparql-results+xml by default (even without specifying the format parameter), and the only other format I could persuade it to offer was JSON (with format=json).

For CONSTRUCT queries (the useful sort :-) ), you need format=rdf (or format=application/rdf+xml), which returns a lovely RDF XML document.  If you omit the format parameter, you get a 'File not found' error.

If you put format=json, you do get a JSON response, but (a) the file type isn't specified: the response filename is just the generic 'sparql', and (b) the JSON that is returned looks a bit reified to me.  Others can comment on whether this is what they would expect from serializing the results of a CONSTRUCT query in JSON. [1]

Richard

[1] http://wdqs-beta.wmflabs.org/bigdata/namespace/wdq/sparql?query=prefix%20wdt:%20%3Chttp://www.wikidata.org/prop/direct/%3Eprefix%20wd:%20%3Chttp://www.wikidata.org/entity/%3E%20CONSTRUCT%20{?h%20wdt:P734%20?name%20.}%20WHERE%20{%20?h%20wdt:P31%20wd:Q5%20.?h%20wdt:P734%20?name%20.?name%20rdfs:label%20%22Light%22@en}%20LIMIT%20100&format=json

On 27/08/2015 08:24, Bene* wrote:
Hi Richard,

I can only answer the last part of your question but you can access the SPARQL endpoint directly under wdqs-beta.wmflabs.org/bigdata/namespace/wdq/sparql?query= and I think you can also add a format parameter to specify in which format the result should be returned.

Best regards
Bene

Am 27.08.2015 um 09:20 schrieb Richard Light:

Hi,

I am doing some 'kicking the tyres' tests on Wikidata as Linked Data.  I like the SPARQL end-point, which is more helpful than most, and successfully managed a query for "people with the surname Light" last night.  (Only five of them in the world, apparently, but that's another matter. :-) )

What I do have an issue with is the content negotiation.  I kept failing to get an RDF rendition of my results, and as a last resort I read the documentation [1]. 

This described a postfix pattern which delivers RDF XML (e.g. [2]). However, this pattern is itself subject to content negotiation, and an initial 303 response converts the URL to e.g. [3].  I am interested in knowing what pattern of URL will deliver RDF/XML without requiring content negotiation, and the answer to that question is not [2] but [3].  This matters, for example, in scenarios where one wants to use XSLT's document() function to retrieve an RDF XML response directly.  The URL pattern [2] will fail.  So the documentation is currently unhelpful.

In a similar vein, is there a syntax for running a SPARQL query on Wikidata such that the response is delivered as RDF XML?  In many end-points there is a parameter you can add to specify the response format, which allows you to submit searches as HTTP requests and include the results directly in your (in my case XML-based) processing chain.  An HTML results page isn't very machine-processible!

Thanks,

Richard

[1] https://www.wikidata.org/wiki/Wikidata:Data_access
[2] https://www.wikidata.org/entity/Q3807415.rdf
[3] https://www.wikidata.org/wiki/Special:EntityData/Q3807415.rdf

--
Richard Light


_______________________________________________
Wikidata-tech mailing list
Wikidata-tech@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech



_______________________________________________
Wikidata-tech mailing list
Wikidata-tech@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech

--
Richard Light