Wikidata:WikiProject France/Queries/List of current French departments

From Wikidata
Jump to navigation Jump to search
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[edit]

Generally, 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)
Current list of French departments

Alternatives[edit]

If 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]

Insights[edit]

Related queries[edit]

References[edit]

See also[edit]