query-443f92f73825202e925b407c299d7021
Villages with same name via subclass the query returns the exact same 10 items. DISTINCT. Alas, altough using Q486972 (settlement)I'd like to find all villages sharing the same name "Burghausen". Since I don't know the exact type village/city/hamlet I query for subtypes of instead?p:P31/ps:P31/wdt:P279*Should I use How can I limit to German labels only? How can I get every item only once?
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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT DISTINCT ?item ?itemLabel WHERE {
?item wdt:P31/wdt:P279* wd:Q486972;
wdt:P17 wd:Q183;
rdfs:label ?itemLabel
# Using the SERVICE statement leads to timeout
# SERVICE wikibase:label { bd:serviceParam wikibase:language "de"}.
FILTER(STRSTARTS(?itemLabel, "Burghausen"))
}
LIMIT 10
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v2("?item"):::projected
v1("?itemLabel"):::projected
a1((" "))
c4(["wd:Q486972"]):::iri
c6(["wd:Q183"]):::iri
f0[["starts-with(?itemLabel,'Burghausen')"]]
f0 --> v1
v2 --"wdt:P31"--> a1
a1 --"wdt:P279"--> c4
v2 --"wdt:P17"--> c6
v2 --"rdfs:label"--> v1