Récupérations des données WikiData

Exemples

Fiche wikidata (pour les humains)

  • Commune "L'Abergement-de-Varey" - https://www.wikidata.org/wiki/Q208567
  • Département de Ain - https://www.wikidata.org/wiki/Q3083

Données wikidata (pour les ordinateurs)

  • Commune "L'Abergement-de-Varey" - https://www.wikidata.org/wiki/Special:EntityData/Q208567.json
  • Département de Ain - https://www.wikidata.org/wiki/Special:EntityData/Q3083.json

Logiciels

  • source pour mapping via fichier SILL 2020
  • exemple de logiciel :
    • 7-Zip (Q215051)
      • Json :
        • /wiki/Special:EntityData/Q215051.json?formatversion=2
        • /w/api.php?action=wbgetentities&ids=Q215051&format=json
      • Properties:
        • source code repository (P1324)
        • official website (P856)
        • copyright license (P275)
        • logo image (P154)
        • image (P18)
        • operating system (P306)
        • software version identifier (P348)
        • Framalibre ID (P4107)
        • Open Hub ID (P1972)

Collectivités

  • France (Q142)
  • region of France (Q36784)
  • department of France (Q6465)
  • répertoire géographique des communes (Q20894925)
  • Montpellier Méditerranée Métropole (Q1119873)
  • Communauté d'agglomération Valence Romans (Q3333858)
  • région Île-de-France (Q12545)
    • label
    • official name (P1448)
    • OSM relation ID (P402)
    • locator map image (P242)
    • population (P1082)
    • logo image (P154)
    • official website (P856)
    • Twitter username (P2002)
    • INSEE region code (P2585)
  • département Hérault (Q12545)
    • label
    • OSM relation ID (P402)
    • geoshape (P3896)
    • locator map image (P242)
    • location map (P1943)
    • population (P1082)
    • official website (P856) ----> non pertinant car site web Préfecture
    • INSEE department code (P2586)
    • flag image (P41)
    • coat of arms image (P94) ----> département, mais pas Conseil Départemental
  • ville Monptellier (Q6441)
    • label
    • OSM relation ID (P402)
    • coordinate location (P625)
    • population (P1082)
    • official website (P856)
    • Twitter username (P2002)
    • INSEE municipality code (P374)
    • coat of arms image (P94)

exemple requête sur query.wikidata.org :

Régions

# Régions
SELECT DISTINCT ?region ?regionLabel ?population ?OpenStreetMap ?site_officiel ?code_INSEE ?carte_de_localisation ?image_du_logo 
?Twitter WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". }
  ?region wdt:P31 wd:Q36784.
  OPTIONAL { ?region wdt:P2585 ?code_INSEE. }
  OPTIONAL { ?region wdt:P1082 ?population. }
  OPTIONAL { ?region wdt:P402 ?OpenStreetMap. }
  OPTIONAL { ?region wdt:P242 ?carte_de_localisation. }
  OPTIONAL { ?region wdt:P856 ?site_officiel. }
  OPTIONAL { ?region wdt:P154 ?image_du_logo. }
  OPTIONAL { ?region wdt:P2002 ?Twitter. }
}
LIMIT 100

Départements

# Départements
SELECT DISTINCT ?departement ?code_INSEE ?departementLabel ?population ?OpenStreetMap ?carte_de_localisation ?locationMap ?geoshape WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". }
  ?departement wdt:P31 wd:Q6465;
    wdt:P2586 ?code_INSEE.
  OPTIONAL { ?departement wdt:P1082 ?population. }
  OPTIONAL { ?departement wdt:P402 ?OpenStreetMap. }
  OPTIONAL { ?departement wdt:P242 ?carte_de_localisation. }
  OPTIONAL { ?departement wdt:P1943 ?locationMap. }
  OPTIONAL { ?departement wdt:P3896 ?geoshape. }
}
ORDER BY (?code_INSEE)
LIMIT 125

Départements de la région Ile de France

# Départements de la région Ile de France
SELECT DISTINCT ?departement ?code_INSEE ?departementLabel ?population ?OpenStreetMap  WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". }
  ?departement wdt:P31 wd:Q6465.
  ?departement wdt:P131 wd:Q13917.
  ?departement wdt:P2586 ?code_INSEE.
  OPTIONAL { ?departement wdt:P1082 ?population. }
  OPTIONAL { ?departement wdt:P402 ?OpenStreetMap. }
}
ORDER BY (?code_INSEE)
LIMIT 100

Population of cities and towns in France and their OSM relation id

# Population of cities and towns in France and their OSM relation id
SELECT DISTINCT ?city ?cityLabel ?population ?OSM_relation_ID WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". }
  VALUES ?town_or_city {
    wd:Q3957
    wd:Q515
  }
  ?city (wdt:P31/(wdt:P279*)) ?town_or_city;
    wdt:P17 wd:Q142.
  OPTIONAL { ?city wdt:P1082 ?population. }
  OPTIONAL { ?city wdt:P402 ?OSM_relation_ID. }
}
LIMIT 100

autres exemples :

  • exemple avec filtre

Ressources

  • Glossaire
  • Wikidata:Data_access
    • https://www.wikidata.org/w/api.php?action=help&modules=jsonfm
  • https://edutechwiki.unige.ch/fr/Tutoriel_wikidata
  • https://www.mediawiki.org/wiki/Wikidata_Toolkit
  • https://www.mediawiki.org/wiki/Wikibase/API/fr
  • https://www.wikidata.org/wiki/Wikidata:Bots
  • recherche:
    • https://www.wikidata.org/w/api.php?action=wbsearchentities&language=fr&search=Nimes

voir aussi : #772

Edited Dec 27, 2022 by Fabrice Gangler
Assignee Loading
Time tracking Loading