For this query, you can also use the regular Wikibase search, either skipping the query service completely –
https://www.wikidata.org/wiki/Special:Search/haswbstatement:P31=Q2085381 inlabel:simon@en <https://www.wikidata.org/wiki/Special:Search/haswbstatement:P31=Q2085381 inlabel:simon@en> https://www.wikidata.org/w/api.php?action=query&list=search&srsearch=haswbstatement:P31=Q2085381%20inlabel:simon@en – or combining the query service with the search API via MWAPI <https://www.mediawiki.org/wiki/Wikidata_Query_Service/User_Manual/MWAPI>: SELECT ?publisher ?publisherLabel WHERE { SERVICE wikibase:mwapi { bd:serviceParam wikibase:api "Search"; wikibase:endpoint "www.wikidata.org"; mwapi:srsearch "haswbstatement:P31=Q2085381 inlabel:simon@[AUTO_LANGUAGE]". ?publisher wikibase:apiOutputItem mwapi:title. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } Try it! <https://query.wikidata.org/#SELECT%20%3Fpublisher%20%3FpublisherLabel%20WHERE%20%7B%0A%20%20SERVICE%20wikibase%3Amwapi%20%7B%0A%20%20%20%20bd%3AserviceParam%20wikibase%3Aapi%20%22Search%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20wikibase%3Aendpoint%20%22www.wikidata.org%22%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20mwapi%3Asrsearch%20%22haswbstatement%3AP31%3DQ2085381%20inlabel%3Asimon%40%5BAUTO_LANGUAGE%5D%22.%0A%20%20%20%20%3Fpublisher%20wikibase%3AapiOutputItem%20mwapi%3Atitle.%0A%20%20%7D%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D> On 01.06.19 11:51, Thad Guidry wrote: > 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
_______________________________________________ Wikidata mailing list Wikidata@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata