query-729a1f4d1401b4b184232d029bcb7ef4
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. } } "en" language:wikibase serviceParam:bd { label:wikibase SERVICE . ?mun P131:wdt ?item . ?county P131:wdt ?mun . ?region P131:wdt ?county . Q3327873:wd P31:wdt ?mun .Q204613:wd P31:wdt ?county . Q55998242:wd P31:wdt ?region . Q16:wd P17:wdt ?item . Q1550557:wd P31:wdt ?item { WHERE ?regionLabel ?countyLabel ?munLabel ?itemLabel ?item SELECT 11:38, 31 May 2019 (UTC) B Yanik --
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 DISTINCT ?item ?itemLabel ?mun ?munLabel ?county ?countyLabel ?region ?regionLabel
WHERE
{
?item wdt:P31/wdt:P279* wd:Q486972 .
?item wdt:P17 wd:Q16 .
?item wdt:P131/wdt:P131* ?mun .
?mun wdt:P31/wdt:P279* wd:Q3327873 .
OPTIONAL
{
?mun wdt:P131/wdt:P131* ?county .
?county wdt:P31/wdt:P279* wd:Q204613.
}
OPTIONAL
{
?mun wdt:P131/wdt:P131* ?region .
?region wdt:P31/wdt:P279* wd:Q55998242 .
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}