Wikidata:WikiProject France/Queries/List of current French departments
This page is a documented query. All documented queries can be found in Category:Documented query. |
This query provides the current list of French departments (department of France (Q6465)).
The official list of French departments is published in the Code officiel géographique (Q2981593)[1].
There are many difficulties. First, some departments are no longer in the list. We need to add Paris (Q90) which is no longer formally a department but is still considered as a department in the Code officiel géographique (Q2981593).
Main query
editGenerally, French departments are instances of department of France (Q6465). However, there is the exception of Paris which is a territorial collectivity of France with special status (Q22923920) with subject has role (P2868) department of France (Q6465).
Current French departments should also have values for INSEE department code (P2586).
For instances of department of France (Q6465), we keep only items without any value for the end time (P582) qualifier.
The following query returns the following variables :
- ?codeInsee : INSEE code (Q156705) of the department as provided by INSEE department code (P2586)
- ?item : Q-id of the department
- ?itemLabel : label of the department in your default language or in English if the value is missing in the default language
- ?itemDescription : description of the department in your default language or in English
- ?instance : Q-id of the value of instance of (P31)
- ?instanceLabel : label of the value of instance of (P31) in your default language or in English
#title: Current list of French departments
SELECT ?codeInsee ?item ?itemLabel ?itemDescription ?instance ?instanceLabel WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" . }
{
wd:Q6465 ^(wdt:P279*) ?instance.
?item p:P31 ?typeStatement.
?typeStatement ps:P31 ?instance.
FILTER(NOT EXISTS { ?typeStatement pq:P582 _:b2. })
}
UNION
{
?item p:P31 ?typeStatement.
?typeStatement ps:P31 wd:Q22923920;
pq:P2868 wd:Q6465.
}
?item wdt:P2586 ?codeInsee
}
ORDER BY (?codeInsee)
Alternatives
editIf you only look at instance of French department with a value of INSEE department code (P2586) (here (query)), Paris (Q90) will be missing.
Selecting all items with a value of INSEE department code (P2586) without filtering on instance of (P31) (See here (query)) returns some territorial collectivity of France (Q583865) such as Wallis and Futuna (Q35555), French Southern and Antarctic Lands (Q129003) or Saint Barthélemy (Q25362) which are not in the list of departments in the Code officiel géographique (Q2981593).
Tests and checks
edit- Check if Paris (Q90) is included in the results. Since the 1st of January 2019, Paris is no longer a department but a "collectivité territoriale à statut unique" with the powers of a commune and a French department[2]. However Paris is still considered as a department in the Code officiel géographique.
- Check that all departments are in France (query) (country (P17) is France (Q142))
- Compare the results with the latest version of the file "Liste des départements" in the Code officiel géographique (Q2981593)[3].
- In 2022, we find 101 departments in the Code officiel géographique (Q2981593). So we should find 101 results in our query.
Insights
editRelated queries
editReferences
edit- ↑ https://www.data.gouv.fr/fr/datasets/code-officiel-geographique-cog/
- ↑ https://www.vie-publique.fr/fiches/20152-paris-collectivite-territoriale-specifique
- ↑ The CSV for 2022 is available at the following url : https://www.data.gouv.fr/fr/datasets/r/9f13e46b-d788-4739-85ee-3b4b9a41ad77