Open hannahbast opened 2 days ago
I've replicated the error with the following query on the olympics dataset:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX olympics: <http://wallscope.co.uk/ontology/olympics/>
PREFIX medal: <http://wallscope.co.uk/resource/olympics/medal/>
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT * WHERE {
SERVICE <https://qlever.cs.uni-freiburg.de/olympics> {
SELECT ?athlete WHERE {
?athlete dbo:team <http://wallscope.co.uk/resource/olympics/team/Germany> .
}
LIMIT 1
}
}
Whats happening is, the Service puts a SELECT
-clause with the visible variables around the query it gets passed - here SELECT ?athlete WHERE { SELECT ?athlete WHERE { ... } LIMIT 1}
.
So the Service-endpoint in the query above basically computes the same incorrect result as the following nested query:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX olympics: <http://wallscope.co.uk/ontology/olympics/>
PREFIX medal: <http://wallscope.co.uk/resource/olympics/medal/>
PREFIX dbo: <http://dbpedia.org/ontology/>
SELECT ?athlete WHERE {
SELECT ?athlete WHERE {
?athlete dbo:team <http://wallscope.co.uk/resource/olympics/team/Germany> .
}
LIMIT 1
}
It somehow works (returns one row) when ORDER BY ?athlete
is added before LIMIT 1
, however i don't know why that is the case.
@UNEXENU Thanks a lot for the reply. The issue has indeed nothing to do with SERVICE. It happens exactly when there is a subquery with a single index scan and a LIMIT. A minimal dataset-independent example is:
SELECT * WHERE {
SELECT * WHERE { ?s ?p ?o } LIMIT 1
}
The following query should return a single row, but it takes forever because the
SERVICE
query is executed without theLIMIT 1
.@UNEXENU and @joka921 Do you have an idea why that is the case?
https://qlever.cs.uni-freiburg.de/wikidata/RJCTro