InseeFr / InseeFr/Metadata-API
Service descendants pays
- Ngôn ngữ chính
- Java
- Star
- 1
- Fork
- 7
- Merge trung bình
- 21 giờ 42 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
## **Services territoires descendants**
### **Pays**
Les descendants des pays sont des « territoires ». Comme pour les pays, ils n’ont pas de nom sans article et ils ont un nom en forme longue. Par contres les codes de la norme ISO 3166 ne sont pas fournis.
#### *Requête*
|**Méthode**|**Requête**|**Description**|
| :- | :- | :- |
|GET|/pays/{code}/descendants|Récupérer les informations concernant les territoires inclus dans le pays {code}|
#### *Paramètres*
|**Paramètres**|**Description**|**Type**|
| :- | :- | :- |
|date|Filtre pour utiliser le pays actif à la date donnée. Par défaut, c’est la date courante.|Date|
|type|
Filtre sur le type du ou des territoires renvoyés (par compatibilité)
- territoire
|String|#### *Exemples de requête*
/geo/pays/99132/descendants
/geo/pays/99132/descendants?date=1950-01-01
/geo/pays/99132/descendants?type=departement
/geo/pays/99132/descendants?date=1950-01-01&type=departement
#### *Champs de la réponse*
|**Champ**|**Description**|
| :- | :- |
|URI|URI du pays|
|Type|« Territoire »|
|Code|Code Insee du territoire|
|Intitule|Nom du territoire|
|IntituleEntier|Nom du territoire en forme longue (composition du territoire)|
|DateCreation|Date de création du territoire|
|DateSuppression|Date de suppression du territoire s’il a été supprimé|
#### *Exemple de réponse en XML*
```xml
Territoires britanniques en Méditerranée
Gibraltar , Akrotiri , Dhekelia
1964-09-21
Dépendances de la Couronne britannique
Île de Man , Jersey , Guernesey
1943-01-01
...
Pitcairn
Pitcairn
1980-07-30
```
#### *Exemple de réponse en JSON*
```json
[
{
"type": "Territoire",
"code": "99133",
"uri": "http://id.insee.fr/geo/territoire/1af281f6-f58a-4197-a40c-3c1514ebd9c5",
"intitule": "Territoires britanniques en Méditerranée",
"IntituleEntier": "Gibraltar , Akrotiri , Dhekelia",
"dateCreation": "1943-01-01"
},
{
"type": "Territoire",
"code": "99161",
"uri": "http://id.insee.fr/geo/territoire/f2d890cc-2d4f-4838-b9aa-50b12367d1c8",
"intitule": "Dépendances de la Couronne britannique",
"IntituleEntier": "Île de Man , Jersey , Guernesey",
"dateCreation": "1943-01-01"
},
...
{
"type": "Territoire",
"code": "99503",
"uri": "http://id.insee.fr/geo/territoire/957a0eb7-3154-4c4c-aab7-761553b76754",
"intitule": "Pitcairn",
"IntituleEntier": "Pitcairn",
"dateCreation": "1980-07-30"
}
]
```
#### *Exemple de requête SPARQL*
```sparql
PREFIX :
PREFIX xsd:
SELECT ?uri ?type ?code ?nom ?nomLong ?dateCreation ?dateSuppression
WHERE {
{
SELECT DISTINCT ?uri ?type ?code ?nom ?nomLong ?dateCreation ?dateSuppression ?dateCreationParent ?dateSuppressionParent
WHERE {
?parent a :Pays ;
:codeINSEE '99132' ;
(^:subdivisionDirecteDe)+ ?ressource .
?ressource a ?typeRDF;
:codeINSEE ?code ;
:nom ?nom .
OPTIONAL {?ressource :nomLong ?nomLong .}
BIND(STR(?typeRDF) AS ?type).
BIND(STR(?ressource) AS ?uri).
OPTIONAL {?parent (^:creation/:date) ?dateCreationParent.}
OPTIONAL {?parent (^:suppression/:date) ?dateSuppressionParent.}
OPTIONAL {?ressource (^:creation/:date) ?dateCreation.}
OPTIONAL {?ressource (^:suppression/:date) ?dateSuppression.}
}
}
FILTER(!BOUND(?dateCreationParent) || xsd:dateTime(?dateCreationParent) <= NOW())
FILTER(!BOUND(?dateSuppressionParent) || xsd:dateTime(?dateSuppressionParent) > NOW())
FILTER(!BOUND(?dateCreation) || xsd:dateTime(?dateCreation) <= NOW())
FILTER(!BOUND(?dateSuppression) || xsd:dateTime(?dateSuppression) > NOW())
}
ORDER BY ?type ?code
```
Avec le paramètre date :
```sparql
PREFIX :
PREFIX xsd:
SELECT ?uri ?type ?code ?nom ?nomLong ?dateCreation ?dateSuppression
WHERE {
{
SELECT DISTINCT ?uri ?type ?code ?nom ?nomLong ?dateCreation ?dateSuppression ?dateCreationParent ?dateSuppressionParent
WHERE {
?parent a :Pays ;
:codeINSEE '99132' ;
(^:subdivisionDirecteDe)+ ?ressource .
?ressource a ?typeRDF;
:codeINSEE ?code ;
:nom ?nom .
OPTIONAL {?ressource :nomLong ?nomLong .}
BIND(STR(?typeRDF) AS ?type).
BIND(STR(?ressource) AS ?uri).
OPTIONAL {?parent (^:creation/:date) ?dateCreationParent.}
OPTIONAL {?parent (^:suppression/:date) ?dateSuppressionParent.}
OPTIONAL {?ressource (^:creation/:date) ?dateCreation.}
OPTIONAL {?ressource (^:suppression/:date) ?dateSuppression.}
}
}
FILTER(!BOUND(?dateCreationParent) || ?dateCreationParent <= '1950-01-01'^^xsd:date)
FILTER(!BOUND(?dateSuppressionParent) || ?dateSuppressionParent > '1950-01-01'^^xsd:date)
FILTER(!BOUND(?dateCreation) || ?dateCreation <= '1950-01-01'^^xsd:date)
FILTER(!BOUND(?dateSuppression) || ?dateSuppression > '1950-01-01'^^xsd:date)
}
ORDER BY ?type ?code
```
Avec le paramètre type :
```sparql
PREFIX :
PREFIX xsd:
SELECT ?uri ?type ?code ?nom ?nomLong ?dateCreation ?dateSuppression
WHERE {
{
SELECT DISTINCT ?uri ?type ?code ?nom ?nomLong ?dateCreation ?dateSuppression ?dateCreationParent ?dateSuppressionParent
WHERE {
?parent a :Pays ;
:codeINSEE '99132' ;
(^:subdivisionDirecteDe)+ ?ressource .
?ressource a ?typeRDF;
a :Territoire ;
:codeINSEE ?code ;
:nom ?nom .
OPTIONAL {?ressource :nomLong ?nomLong .}
BIND(STR(?typeRDF) AS ?type).
BIND(STR(?ressource) AS ?uri).
OPTIONAL {?parent (^:creation/:date) ?dateCreationParent.}
OPTIONAL {?parent (^:suppression/:date) ?dateSuppressionParent.}
OPTIONAL {?ressource (^:creation/:date) ?dateCreation.}
OPTIONAL {?ressource (^:suppression/:date) ?dateSuppression.}
}
}
FILTER(!BOUND(?dateCreationParent) || xsd:dateTime(?dateCreationParent) <= NOW())
FILTER(!BOUND(?dateSuppressionParent) || xsd:dateTime(?dateSuppressionParent) > NOW())
FILTER(!BOUND(?dateCreation) || xsd:dateTime(?dateCreation) <= NOW())
FILTER(!BOUND(?dateSuppression) || xsd:dateTime(?dateSuppression) > NOW())
}
ORDER BY ?type ?code
```
Avec le paramètre type et le paramètre date :
```sparql
PREFIX :
PREFIX xsd:
SELECT ?uri ?type ?code ?nom ?nomLong ?dateCreation ?dateSuppression
WHERE {
{
SELECT DISTINCT ?uri ?type ?code ?nom ?nomLong ?dateCreation ?dateSuppression ?dateCreationParent ?dateSuppressionParent
WHERE {
?parent a :Pays ;
:codeINSEE '99132' ;
(^:subdivisionDirecteDe)+ ?ressource .
?ressource a ?typeRDF;
a :Territoire ;
:codeINSEE ?code ;
:nom ?nom .
OPTIONAL {?ressource :nomLong ?nomLong .}
BIND(STR(?typeRDF) AS ?type).
BIND(STR(?ressource) AS ?uri).
OPTIONAL {?parent (^:creation/:date) ?dateCreationParent.}
OPTIONAL {?parent (^:suppression/:date) ?dateSuppressionParent.}
OPTIONAL {?ressource (^:creation/:date) ?dateCreation.}
OPTIONAL {?ressource (^:suppression/:date) ?dateSuppression.}
}
}
FILTER(!BOUND(?dateCreationParent) || ?dateCreationParent <= '1950-01-01'^^xsd:date)
FILTER(!BOUND(?dateSuppressionParent) || ?dateSuppressionParent > '1950-01-01'^^xsd:date)
FILTER(!BOUND(?dateCreation) || ?dateCreation <= '1950-01-01'^^xsd:date)
FILTER(!BOUND(?dateSuppression) || ?dateSuppression > '1950-01-01'^^xsd:date)
}
ORDER BY ?type ?code
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.