query-222a4523f69e60438e5711643183449a
is related to labels. The label service is very useful if you just want to display the label of a variable. But if you want to do stuff with the label – for example: check if it starts with “Mr. ” – you’ll find that it doesn’t work: FILTERAnother possible use of
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?human ?humanLabel
WHERE
{
?human wdt:P31 wd:Q15632617.
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
# This FILTER does not work!
FILTER(STRSTARTS(?humanLabel, "Mr. ")).
}
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?human"):::projected
v1("?humanLabel"):::projected
c5(["bd:serviceParam"]):::iri
c7(["en"]):::literal
c3(["wd:Q15632617"]):::iri
f0[["starts-with(?humanLabel,'Mr. ')"]]
f0 --> v1
v2 --"wdt:P31"--> c3
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c5 --"wikibase:language"--> c7
end