SPARQL interface

The platform supports data access via the standard SPARQL 1.1. Protocol . The API only accepts SPARQL SELECT, ASK and CONSTRUCT queries and does not support SPARQL update queries.
One can use the

  • HTTP GET operation with the SPARQL query URL encoded in the query parameter query or a
  • HTTP POST request if the SPARQL query is large (which could exceed the maximum length of a URL)

Below is an example request with the following SPARQL query:

SELECT *
WHERE{
  ?s ?p ?o .
} LIMIT 10

The respective API calls ask for the results in the SPARQL JSON format.

GET

curl 'https://proxy.opendatagermany.io/api/ts/v1/kg/sparql?query=SELECT%20*%20WHERE%20%7B%20%3Fs%20%3Fp%20%3Fo%20.%7D%20LIMIT%2010' \
-H 'accept: application/sparql-results+json' \
-H 'x-api-key: <APIKEY>'

POST

curl 'https://proxy.opendatagermany.io/api/ts/v1/kg/sparql' \
-H 'accept: application/sparql-results+json' \
-H 'content-type: text/plain' \
-H 'x-api-key: <APIKEY>' \
--data 'SELECT * WHERE { ?s ?p ?o .} LIMIT 10'

What’s Next