I\'m trying to do a fuzzy (ie.. partial or case-insensitive) entity label lookup in Wikidata with Sparql (via the online endpoint). Unfortunately these return a \"Query
You can do this online if you change your filter to use the "contains
" function.
Example:
SELECT ?item WHERE {
?item rdfs:label ?label .
FILTER( contains(lcase(?label), 'arles lin' ))
}
LIMIT 20
Reference:
contains
is listed as one of the XPath functions you can use in SPARQL. See: https://www.w3.org/2009/sparql/wiki/Feature:FunctionLibrary#XQuery_1.0_and_XPath_2.0_Functions_and_Operators
Example 2: (with more triples to optimise results)
PREFIX skos:
SELECT ?item ?label WHERE {
?item rdfs:label ?label .
?item rdf:type dbo:Person #Works with our without this too, also try skos:Category
FILTER( contains(lcase(?label), 'arles lin' ) && LANGMATCHES(LANG(?label), "en"))
}
LIMIT 20