Using CURL to access a SPARQL endpoint
You can use the command line tool curl
to access a SPARQL endpoint, e.g. from Sesame 2. Just do like this:
curl -H "Accept: application/sparql-results+xml" "http://REPOSITORY_URI?query=ESCAPED_QUERY"
The interesting bit is the -H
parameter, where you specify header information. What you do here is to tell the endpoint what kind of result format you accept. I always forget how to do that...
Edit:
To get JSON back, the mimetype has to be application/sparql-results+json
, at least on SESAME 2. This mimetype was defined in this W3C note.
Labels: command line, header, http, json, shell, sparql, xml