Skip to content

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

Description

@hannahbast

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions