qlever icon indicating copy to clipboard operation
qlever copied to clipboard

Nameservice hides some results

Open graue70 opened this issue 3 years ago • 3 comments

When ticking the checkbox 'Automatically add names to result', the following query yields 37 results:

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
SELECT DISTINCT ?0 WHERE {
  ?0 wdt:P136 wd:Q11424 .
} LIMIT 300

If I untick the checkbox and run it again, it yields 105 results instead.

These are the respective API requests:

https://qlever.informatik.uni-freiburg.de/api/wikidata-proxy?query=PREFIX%20wd:%20%3Chttp://www.wikidata.org/entity/%3E%20PREFIX%20wdt:%20%3Chttp://www.wikidata.org/prop/direct/%3E%20SELECT%20DISTINCT%20?0%20WHERE%20{%20?0%20wdt:P136%20wd:Q11424%20.%20}%20LIMIT%20300&name_service=true&send=40
https://qlever.informatik.uni-freiburg.de/api/wikidata-proxy?query=PREFIX%20wd:%20%3Chttp://www.wikidata.org/entity/%3E%20PREFIX%20wdt:%20%3Chttp://www.wikidata.org/prop/direct/%3E%20SELECT%20DISTINCT%20?0%20WHERE%20{%20?0%20wdt:P136%20wd:Q11424%20.%20}%20LIMIT%20300&name_service=false&send=40

I expect a name service to add names to entities that have one, but not to hide results that don't have a label.

The generated query is probably missing an 'OPTIONAL'.

graue70 avatar May 14 '21 17:05 graue70

You are absolutely right.

It currently does not have an optional for efficiency reasons and because the OPTIONAL is not yet 100% correct. This will hopefully change soon.

Do you need this for anything or is this just something that occurred to you?

hannahbast avatar May 14 '21 18:05 hannahbast

Do you need this for anything or is this just something that occurred to you?

Not needed. Just unexpected behavior.

graue70 avatar May 14 '21 21:05 graue70

The problem occurs more often than I thought. Check the following example:

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?wife ?child WHERE {
  wd:Q35332 wdt:P26 ?wife .
  OPTIONAL { ?wife wdt:P40 ?child }
}

The API request yields only two results:

https://qlever.informatik.uni-freiburg.de/api/wikidata-proxy?query=PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?wife ?child WHERE { wd:Q35332 wdt:P26 ?wife . OPTIONAL { ?wife wdt:P40 ?child } } &name_service=true&send=40

However, the same request without name_service yields three results:

https://qlever.informatik.uni-freiburg.de/api/wikidata-proxy?query=PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wd: <http://www.wikidata.org/entity/> SELECT ?wife ?child WHERE { wd:Q35332 wdt:P26 ?wife . OPTIONAL { ?wife wdt:P40 ?child } } &name_service=false&send=40

Other than in the first example, this happens even though there is a label for the result that is hidden by the name_service (Q32522 in this case).

Apparently the name_service doesn't let results with any NULL cells pass.

graue70 avatar Jun 08 '21 16:06 graue70