My goal is to query Wikidata and obtain a list of living persons whose label contains a specific string.
For instance, with this code I searched for Silvio Berlusconi and obtained as a result Pier Silvio Berlusconi, because Silvio is dead and Pier Silvio is still leaving.
SELECT DISTINCT ?item ?itemLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
{
SELECT DISTINCT ?item WHERE {
?item p:P31 ?statement0.
?statement0 (ps:P31/(wdt:P279*)) wd:Q5.
MINUS {
?item p:P570 ?statement_1.
?statement_1 psv:P570 ?statementValue_1.
?statementValue_1 wikibase:timeValue ?P570_1.
}
?item p:P735 ?statement2.
?statement2 (ps:P735/(wdt:P279*)) wd:Q539504.
?item p:P734 ?statement3.
?statement3 (ps:P734/(wdt:P279*)) wd:Q24073854.
}
LIMIT 10
}
}
The result is fine, but the problem is that I used separate properties for the person's name (P735 = given name, P734 = family name) and set each of them equal to specific values (Q539504 = Silvio, Q24073854 = Berlusconi). I need to search for just a string (e.g. "Silvio Berlusconi) withing the items' labels, without separating the string into multiple values (given name = Silvio, family name = Berlusconi).