query-d9e17dc4ba91fd377e978ae6507efb2b

rq turtle/ttl

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

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" }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?county") v1("?item"):::projected v4("?mun") v2("?region") c4(["wd:Q16"]):::iri c7(["wd:Q3327873"]):::iri c10(["bd:serviceParam"]):::iri c2(["wd:Q1550557"]):::iri c12(["en"]):::literal c5(["wd:Q55998242"]):::iri c6(["wd:Q204613"]):::iri v1 --"wdt:P31"--> c2 v1 --"wdt:P17"--> c4 v2 --"wdt:P31"--> c5 v3 --"wdt:P31"--> c6 v4 --"wdt:P31"--> c7 v3 --"wdt:P131"--> v2 v4 --"wdt:P131"--> v3 v1 --"wdt:P131"--> v4 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end