Global countries taxonomy

From Open Food Facts wiki
Revision as of 11:39, 12 December 2013 by Stephane (talk | contribs) (using wikidata to build the taxonomy)
Jump to navigation Jump to search

Building a complete taxonomy of countries from Wikidata

Steps:

  • Get a list of all countries
    • query: find objects with property "is an instance of" (P31) "country" (Q6256)
    • http://208.80.153.172/wdq/?q=claim[31:6256] (using http://wikidataquery.eu/ )
      • 124 results
    • use "Sovereign state" (Q3624078) instead?
      • 202 results, 23 are historic or fictional
    • or any state with an Internet top level domain (P78)
      • http://208.80.153.172/wdq/?q=claim[78]
      • 270 results, includes territories like US Virgin Islands, French Polynesia etc.
      • [16,17,20,22,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,43,45,51,55,77,79,96,114,115,117,142,145,148,155, 159,183,184,189,191,211,212,213,214,215,217,218,219,221,222,223,224,225,227,228,229,230,232,233,235,236,237,238,241,242, 244,252,258,262,265,298,327,334,347,398,399,403,408,414,419,423,424,458,574,657,664,668,672,678,683,685,686,691,695,697, 702,709,710,711,712,717,730,733,734,736,739,750,754,757,760,763,766,769,774,778,781,783,784,785,786,790,792,794,796,800, 801,804,805,810,811,813,817,819,822,826,833,836,837,842,843,846,851,854,858,863,865,869,874,878,881,884,889,902,912,916, 917,921,924,928,929,945,948,953,954,958,962,963,965,967,970,971,974,977,983,986,1000,1005,1006,1007,1008,1009,1011,1013, 1014,1016,1019,1020,1025,1027,1028,1029,1030,1032,1033,1036,1037,1039,1041,1042,1044,1045,1049,1050,1183,1410,3769,4628, 5689,5785,6250,7184,8646,9648,9676,11196,11703,12130,13353,14056,14773,15180,16635,16641,16644,16645,16957,17012,17054, 17063,17070,18221,21203,23408,23635,25228,25230,25279,25305,25362,25396,25528,26180,26273,26988,27561,30971,31057,31063, 33788,34020,34617,35086,35555,35672,36004,36704,36823,43448,46197,126125,129003,131083,131198,179313,192184,205047, 219060,407199,842829,927467,1555938,2552742]
  • Get countries
    • we need the aliases and the labels in all languages (or maybe just "main" languages with 2 letter codes)
  • Get the official language property (P37)
    • build a map of object to language code
  • Flags?
    • in SVG format in wikidata, shape varies (e.g. different rectangles, square for Switzerland)

Taxonomy

This is just a small taxonomy for testing purposes, a complete taxonomy (all countries translated to all languages) can be computed automatically from sources such as Wikidata. 2 letters country codes are needed only as en: synonyms


en:Europe, EU
fr:Europe, EU
es:Europa

< en:Europe
en:Belgium, be
fr:Belgique
nl:Belgie
es:Bélgica

< en:Europe
en:France, fr
fr:France
es:Francia

< en:Europe
en:Germany, de
de:Deutschland
fr:Allemagne
es:Alemania

< en:Europe
en:Italy, it
fr:Italie
it:Italia
es:Italia

< en:Europe
en:Spain, es
es:España
fr:Espagne

< en:Europe
en:Switzerland, ch
de:Schweiz
fr:Suisse
es:Suiza

en:North America
fr:Amérique du Nord
es:América del Norte

< en:North America
en:Canada, ca
fr:Canada
es:Canadá

< en:North America
en:Mexico, mx
fr:Mexique
es:México, Méjico

< en:North America
en:United States, us, usa
fr:Etats-Unis
es:Estados Unidos