QLever API documentation - ad-freiburg/qlever GitHub Wiki

The API for a SPARQL endpoint is largely dictated by the SPARQL standard. Here is the official document that that defines the format for the media types application/csv (CSV), application/tab-separated-values (TSV), and application/sparql-results+json (JSON): https://www.w3.org/TR/sparql11-results-csv-tsv/

In addition, QLever also supports its own media type application/qlever-results+json. This also provides the query result as JSON (but in a more compact form then with application/sparql-results+json), and additionally information about the running time of the query, the query execution plan, etc. The JSON is self-explanatory: to understand it simply issue the corresponding curl command for a simple query, for example:

curl -s https://qlever.cs.uni-freiburg.de/api/wikidata -H "Accept: application/qlever-results+json" -H "Content-type: application/sparql-query" --data "SELECT * WHERE { ?s ?p ?o } LIMIT 1" | jq

To obtain the curl command line for a particular query in the QLever UI, just click on the button "Share" after you have typed your query. The dialog that opens also provides a variety of URLs to access the query, as well as the query string as a single line (which is useful for a variety of purposes). In the curl command line, the media type is text/tab-separated-values (TSV) for SELECT queries and text/turtle (TTL) for CONSTRUCT queries. If you want the results in a different media type, just change the -H "Accept: ..."` option accordingly.