New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: SPARQL result format and protocol #360
Comments
@LorenzBuehmann Thank you for your comment, we have finally addressed this with #362 . The format is supported via header "Accept: application/sparql-results+json" (the standard way) as well as via URL parameter action=sparql_json_export (useful in contexts, where only a URL can be specified). Currently, the default format (when no Accept header or action argument is specified) is still QLever's own JSON format (which is more compact and contains meta information about the query processing). Let us know if you think that it's important that application/sparql-results+json is the default format. |
Hi, I guess we have to reopen this issue. You made a small mistake in the SPARQL JSON format, you're returning
but in fact the format specifies only the type See https://www.w3.org/TR/sparql11-results-json/#select-encode-terms |
You have a very good timing. We have discovered the same bug among others (Variables are "someVariable" and not "?someVariable" and blank nodes were returned as literals) at the end of last week. I have drafted a quick fix this morning which we will hopefully merge soon (#677) |
@joka921 This is resolved, is it not? |
I can confirm I get JSON results back: curl -H "Accept: application/sparql-results+json" 'https://qlever.cs.uni-freiburg.de/api/wikidata?query=PREFIX+wd%3A+%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX+wt%3A+%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fdirect%2F%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0ASELECT+DISTINCT+%3Fname+%3Fpopulation+WHERE+%7B%0A++%3Fcity+wdt%3AP31%2Fwdt%3AP279*+wd%3AQ515+.%0A++%3Fcity+wdt%3AP17+wd%3AQ183+.%0A++%3Fcity+wdt%3AP1082+%3Fpopulation+.%0A++%3Fcity+rdfs%3Alabel+%3Fname+.%0A++FILTER+(LANG(%3Fname)+%3D+%22de%22)%0A%7D%0AORDER+BY+DESC(%3Fpopulation)&send=100' But not XML results however: curl -H "Accept: application/sparql-results+xml" 'https://qlever.cs.uni-freiburg.de/api/wikidata?query=PREFIX+wd%3A+%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX+wdt%3A+%3Chttp%3A%2F%2Fwww.wikidata.org%2Fprop%2Fdirect%2F%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0ASELECT+DISTINCT+%3Fname+%3Fpopulation+WHERE+%7B%0A++%3Fcity+wdt%3AP31%2Fwdt%3AP279*+wd%3AQ515+.%0A++%3Fcity+wdt%3AP17+wd%3AQ183+.%0A++%3Fcity+wdt%3AP1082+%3Fpopulation+.%0A++%3Fcity+rdfs%3Alabel+%3Fname+.%0A++FILTER+(LANG(%3Fname)+%3D+%22de%22)%0A%7D%0AORDER+BY+DESC(%3Fpopulation)&send=100' This returns |
In the meantime we export results as TSV as well as as XML. |
Hi QLever team,
first of all, very interesting and impressive work, congratulations!
I'm playing around with it right now, but it looks like QLever doesn't support a proper SPARQL resultset format like SPARQL JSON? Is this correct? Any plans to add it in the future?
I'm asking because the current result format makes it impossible to use some of the more popular SPARQL APIs like Apache Jena, rdf4j, rdflib(sparqlwrapper) etc. without writing an own SPARQL result parser.
Thanks in advance and well done, nice work!
PS: Looks like your public demo doesn't work, at least I'm getting a backend connection error notification when choosing a dataset.
The text was updated successfully, but these errors were encountered: