query-d9e17dc4ba91fd377e978ae6507efb2b
Multi-level localisation 15:12, 28 May 2019 (UTC) B Yanik name of an entity. --(Q55998242)administrative region of Quebec name and the (Q204613)regional county municipality . What would be the query to list the municipality name, the (Q764294)Centre-du-Québec who has P131 (Q1261297)Drummond have P131 (Q141940)Drummondville may be a lower level entity, how can we show upper level entities ? For example, (P131)located in the administrative territorial entity Since } } "en" language:wikibase serviceParam:bd { label:wikibase SERVICE .?county P131:wdt ?item . ?region P131:wdt ?county .Q204613:wd P31:wdt ?county . Q55998242:wd P31:wdt ?region } Q141940:wd { ?item VALUES { WHERE ?regionLabel ?region ?countyLabel ?county ?itemLabel ?item SELECT 11:16, 29 May 2019 (UTC) B Yanik: Well done ! Very interresting those "*". Thank's a lot. --99of9@ 07:16, 29 May 2019 (UTC)) talk (99of9: see if this fits your requirements. --YanikB@I tried to add a level but it does't work.
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 bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?munLabel ?countyLabel ?regionLabel WHERE {
?item wdt:P31 wd:Q1550557 .
?item wdt:P17 wd:Q16 .
?region wdt:P31 wd:Q55998242 .
?county wdt:P31 wd:Q204613.
?mun wdt:P31 wd:Q3327873 .
?county wdt:P131* ?region .
?mun wdt:P131* ?county .
?item wdt:P131* ?mun .
SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
}