Reputation: 37
I try to find a city based on a part of its name (typically https://en.wikipedia.org/wiki/Lavo%C3%BBte-sur-Loire, a French city)
The only way I found is to first request for "Lavoute" (without accent) through the following request.
It returns 5 links and then use this information to request through all the results having something like this at the end with the good value (having property P281 means it is a city)
Is there an easier way to do?
Upvotes: 1
Views: 1342
Reputation: 519
As you said that you want to find a city based on a part of its name, here is the solution for your question:
SELECT ?location ?locationLabel WHERE {
?location wdt:P17 wd:Q142.
?location wdt:P31 ?settlement .
?settlement wdt:P279 wd:Q3266850 .
?location rdfs:label ?de_label .
FILTER (lang(?de_label) = "en") .
FILTER (regex((?de_label), "Lavoûte")).
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Refer to this link, you might also get some ideas regarding your question : https://opendata.stackexchange.com/questions/11675/most-efficient-way-to-get-the-wikidata-entity-for-a-city-given-as-a-string
Upvotes: 5