Found my answer !!!  had to go back to the SPARQL Tutorial page and re-read the
section on FILTER
<https://www.wikidata.org/wiki/Wikidata:SPARQL_tutorial#FILTER>
...specifically...

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* ...


yes, I do want to have an expression about a label..., in fact, 95% of the
time that's what I want to do...so why doesn't the darn label service help
me do that better?

The reason why this doesn’t work is that the label service adds its
> variables very late during query evaluation; at the point where we try to
> filter on ?humanLabel, the label service hasn’t created that variable yet.
> Fortunately, the label service isn’t the only way to get an item’s label.
> Labels are also stored as regular triples, using the predicate rdfs:label.
> Of course, this means all labels, not just English ones; if we only want
> English labels, we’ll have to filter on the language of the label:


AH !  label service does things AFTER the query returns results.

So this works, and is how you actually handle label filtering *without*
using the label service, and instead getting the label stored as a triple
(and it's twice as fast as well)...

SELECT ?publisher ?label
WHERE
{
  ?publisher wdt:P31 wd:Q2085381;
         rdfs:label ?label.
  FILTER(LANG(?label) = "[AUTO_LANGUAGE]").
  FILTER CONTAINS(LCASE(?label), "simon").
}

Thad
https://www.linkedin.com/in/thadguidry/
_______________________________________________
Wikidata mailing list
Wikidata@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata

Reply via email to