query-963d135844b68379c61610736461a632

rq turtle/ttl

Comuni. (Q3685476)abolished municipality in Italy of (P31)instance of . Both {Q|15089} and {Q|15110} have to be considered in order to have a complete set of administrative entities of second level. Since 1-Jan-2018 many comuni have been joined in a new entity, so wikidata items have been (or must be) updated. This comuni have been defined as comuni and then in provincesEach region is divided in

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Italia: regions, provinces and comuni
#defaultView:Tree
SELECT ?italiaLabel ?regione ?regioneLabel ?provincia ?provinciaLabel ?comune ?comuneLabel
WHERE 
{
  ?regione p:P31/ps:P31/wdt:P279* wd:Q16110 .    # Regions of Italia
  ?provincia wdt:P131 ?regione .                 # Administrative divisions in the region

  { ?provincia wdt:P31 wd:Q15089 . }             # List of provinces
  UNION
  { ?provincia wdt:P31 wd:Q15110 . }             # metropolitan cities of Italy
  UNION
  { ?provincia wdt:P31 wd:Q21190155 . }          # Liberi consorzi comunali of Sicily

  ?comune wdt:P131 ?provincia .                  # Administrative divisions in the province
  {
    ?comune wdt:P31 wd:Q747074 .                 # Italian municipality
  }
  UNION
  {
    ?comune wdt:P31 wd:Q954172 .                 # Italian sparse municipality
  } 

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v3("?comune"):::projected v2("?provincia"):::projected v1("?regione"):::projected a1((" ")) a2((" ")) c11(["wd:Q954172"]):::iri c9(["wd:Q21190155"]):::iri c13(["bd:serviceParam"]):::iri c4(["wd:Q16110"]):::iri c8(["wd:Q15110"]):::iri c15(["#91;AUTO_LANGUAGE#93;,en"]):::literal c7(["wd:Q15089"]):::iri c10(["wd:Q747074"]):::iri v1 --"p:P31"--> a1 a1 --"p:statement/P31"--> a2 a2 --"p:direct/P279"--> c4 v2 --"p:direct/P131"--> v1 subgraph union0[" Union "] subgraph union0l[" "] style union0l fill:#abf,stroke-dasharray: 3 3; subgraph union1[" Union "] subgraph union1l[" "] style union1l fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P31"--> c9 end subgraph union1r[" "] style union1r fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P31"--> c8 end union1r <== or ==> union1l end end subgraph union0r[" "] style union0r fill:#abf,stroke-dasharray: 3 3; v2 --"p:direct/P31"--> c7 end union0r <== or ==> union0l end v3 --"p:direct/P131"--> v2 subgraph union2[" Union "] subgraph union2l[" "] style union2l fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> c11 end subgraph union2r[" "] style union2r fill:#abf,stroke-dasharray: 3 3; v3 --"p:direct/P31"--> c10 end union2r <== or ==> union2l end subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c13 --"wikibase:language"--> c15 end