ad-freiburg / qlever

Very fast SPARQL Engine, which can handle very large knowledge graphs like the complete Wikidata, offers context-sensitive autocompletion for SPARQL queries, and allows combination with text search. It's faster than engines like Blazegraph or Virtuoso, especially for queries involving large result sets.
Apache License 2.0
376 stars 45 forks source link

QLever API documentation #1483

Closed pfps closed 3 weeks ago

pfps commented 3 weeks ago

Is there a complete description of the API documentation? I'm in particular looking for a way to get execution statistics on queries such as time taken and space used.

It would be great if there was a way of getting a compact result (e.g., CSV) plus the execution statistics. It would be even better if there was a way of just getting the number of results plus execution statistics (without having to use COUNT).

hannahbast commented 3 weeks ago

@pfps The API for standard media types like application/csv, application/tab-separated-values, and application/sparql-results+json is dictated by the SPARQL standard, see https://www.w3.org/TR/sparql11-results-csv-tsv . In particular, we can't just add timing information to the TSV or CSV because that would violate the standard.

Instead, QLever additionally supports an own media type application/qlever-results+json, which, in particular, is used by the QLever UI. When you ask for that media type, you get the result as a JSON (in a more compact form then with application/sparql-results+json) and also information about the running time of the query, the query execution plan, etc. The JSON is self-explanatory, just 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
pfps commented 3 weeks ago

Thanks

hannahbast commented 3 weeks ago

@pfps I have now also created a page on the QLever Wiki providing that information: https://github.com/ad-freiburg/qlever/wiki/QLever-API-documentation

pfps commented 3 weeks ago

Excellent.

pfps commented 3 weeks ago

I'm using that interface and it works well, except that it seems to limit the number of results to 1000000. I don't mind having only (!) 1000000 results in the response but the resultsize value is also 1000000 when it would be useful to have it be the real value.

pfps commented 3 weeks ago

Also, is there a way to clear the cache like you can do in the GUI?