ad-freiburg / qlever-ui

A user interface for QLever
Apache License 2.0
19 stars 12 forks source link

Prefix completion for literals only checks ^<prefix and not ^\"prefix #8

Closed hannahbast closed 4 years ago

hannahbast commented 4 years ago

Consider the following query to http://qlever.informatik.uni-freiburg.de/Wikidata_Full with the cursor at the indicated position.

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?country WHERE {
  ?country wdt:P31 wd:Q6256 .
  ?country rdfs:label A[cursor]
}
ORDER BY ASC(?name)

The suggestion query is a UNION of several things of which only the part filtering the ?query_entity is relevant for this query (because the completions are all literals). Here is relevant part:

PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?qleverui_entity ?qleverui_count WHERE {
  { 
    SELECT ?qleverui_entity (COUNT(?qleverui_entity) AS ?qleverui_count) WHERE {
      ?country wdt:P31 wd:Q6256 .
      ?country @en@rdfs:label ?qleverui_entity .
    }
    GROUP BY ?qleverui_entity
    HAVING regex(?qleverui_entity, '^<A')
  }
}

For the query to work for Wikidata Full, the second argument of the HAVING clause should be '^\"A' and not '^<A'. To work in all cases, a union of the cases is needed.

hannahbast commented 4 years ago

This is no longer relevant with the new completely freely configurable templates from https://github.com/jbuerklin/qleverUI/pull/10