query-a5ad00fe4708946334aaf454105a70fc
Administrative tree for french communes is possible to have all the administrative levels of this commune? (Q193812)Ambléon Starting from a french commune ex. (Q1724443)canton of Belley Canton= (Q700647)arrondissement of Belley Arrondissement= (Q3083)Ain Departement= (Q18338206)Auvergne-Rhône-Alpes Region= 16:34, 8 May 2020 (UTC)) talk (ValterVBI need it to create all the pages about french communes in a little wiki. --17:37, 8 May 2020 (UTC) JuraFrench contributors of Wikidata tried to phase out the last (or the last to layers) from the "administrative" tree. The last ones should now be in electoral districts. Compared to other countries, the structure is somewhat hard to query as one needs to take in account end dates at various places. It might be easier to select with an identifier. --- Moment, I don't need a list because I work only one common by time , so is possible modify this query to have only actual data? 18:25, 8 May 2020 (UTC)) talk (ValterVBMaybe is better read this data directly from the pages of wikipedia in french. --
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 * WHERE {
{
SELECT DISTINCT ?item ?itemLabel ?lev ?levLabel ?tipoLev ?tipoLevLabel
WHERE {
VALUES ?item { wd:Q193812 } #common item
?item wdt:P7938 ?canton.
?item wdt:P131+ ?lev.
?lev wdt:P31 ?tipoLev.
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
FILTER (?tipoLev in (wd:Q36784,wd:Q6465,wd:Q194203)) #region, departement, arrondissement
}
}
UNION
{
SELECT DISTINCT ?item ?itemLabel ?lev ?levLabel ?tipoLev ?tipoLevLabel
WHERE {
VALUES ?item { wd:Q193812 } #canton
?item wdt:P7938 ?lev.
?lev wdt:P31 ?tipoLev.
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr". }
}
}
}