qlever icon indicating copy to clipboard operation
qlever copied to clipboard

ParseException when using nameservice on a query which contains a comment line

Open graue70 opened this issue 3 years ago • 1 comments

The following javascript code

query = `PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?label WHERE {
  # A line containing only whitespace and a comment breaks the query
  wd:Q90 @en@rdfs:label ?label .
}
LIMIT 10`  // If you remove the comment line from the query, the URL works
name_service = true  // If you change this to false, the URL also works
send = 40

url = new URL("https://qlever.informatik.uni-freiburg.de/api/wikidata-proxy")
url.search = new URLSearchParams({query: query, name_service: name_service, send: send})
url.toString()

leads to the following two URLs (depending on whether name_service is true or false):

https://qlever.informatik.uni-freiburg.de/api/wikidata-proxy?query=PREFIX+wd%3A+%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0ASELECT+%3Flabel+WHERE+%7B%0A++%23+A+line+containing+only+whitespace+and+a+comment+breaks+the+query%0A++wd%3AQ90+%40en%40rdfs%3Alabel+%3Flabel+.%0A%7D%0ALIMIT+10&name_service=true&send=40

or

https://qlever.informatik.uni-freiburg.de/api/wikidata-proxy?query=PREFIX+wd%3A+%3Chttp%3A%2F%2Fwww.wikidata.org%2Fentity%2F%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0ASELECT+%3Flabel+WHERE+%7B%0A++%23+A+line+containing+only+whitespace+and+a+comment+breaks+the+query%0A++wd%3AQ90+%40en%40rdfs%3Alabel+%3Flabel+.%0A%7D%0ALIMIT+10&name_service=false&send=40

The first one leads to a ParseException, the second one works.

If you remove the comment line from the query, the URL works even with name_service = true. Only the combination of both comment AND name_service fails.

graue70 avatar Jun 01 '21 15:06 graue70

@hannahbast This seems to be an issue in your QleverProxy, qlever itself does not handle the name service, and as I understand the issue, The query without the name service, which is sent to QLever unaltered, works fine.

joka921 avatar Sep 04 '21 10:09 joka921

This is now implemented within the QLever UI and no longer using a proxy script

hannahbast avatar May 28 '23 14:05 hannahbast