IxWiki:Uploading metadata to Wikidata
This is an information page. It is not one of Wikipedia's policies or guidelines, but rather intends to describe some aspect(s) of Wikipedia's norms, customs, technicalities, or practices. It may reflect varying levels of vetting and consensus. |
QuickStatements can be used to upload metadata (such as area and population figures about populated places) to Wikidata. Templates such as {{Wikidata}} can be then used to retrieve the figures locally and feed them to fields in templates such as {{Infobox settlement}}.
Updating figures
1. Updated population figures are usually published on the website of the national or local statistical office (in the example, the Statistik Austria website).
2a. A list of Wikidata properties for authority control for administrative subdivisions (lists all properties such as P507, P442, etc.) can be found here.
2b. The mappings between Austrian Wikidata IDs for municipalities and municipality keys are available through this Wikidata Query. For other countries, just replace 'P964' in the query with the property found in the previous step (e.g. P771 for Swiss municipalities). See the list of QID - subdivision key mappings below.
2c. The two tables can then be linked through the VLOOKUP function in Excel (or any other spreadsheet program).
3. QuickStatements can be used to rapidly upload hundreds of statements in one go. Choosing the 'Run in background' option is advised, so that the process will continue even if the browser window crashes or is closed.
Austria example
V1 syntax
The example below uploads the updated population of Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q126321) as of 1 January 2018, using the QuickStatements V1 syntax:
Q126321 P1082 14476 P585 +2018-01-01T00:00:00Z/11 S854 "https://www.statistik.at/web_de/klassifikationen/regionale_gliederungen/gemeinden/index.html" S1476 de:"Einwohnerzahl 1.1.2018 nach Gemeinden mit Status, Gebietsstand 1.1.2018" S813 +2019-03-09T00:00:00Z/11 S123 Q358870
csv syntax
The same command, using the csv syntax:
qid,P1082,qal585,S854,s1476,s813,s123 Q126321,14476,+2018-01-01T00:00:00Z/11,""""https://www.statistik.at/web_de/klassifikationen/regionale_gliederungen/gemeinden/index.html",de:"Einwohnerzahl 1.1.2018 nach Gemeinden mit Status Gebietsstand 1.1.2018",+2019-03-09T00:00:00Z/11,Q358870
Note: csv commands cannot include commas.
This uploads this statement to the entity Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q126321):
- P1082: 14476
this qualifier:
- P585: +2018-01-01T00:00:00Z/11
and the following references:
- P854: "https://www.statistik.at/web_de/klassifikationen/regionale_gliederungen/gemeinden/index.html"
- P1476: de:"Einwohnerzahl 1.1.2018 nach Gemeinden mit Status, Gebietsstand 1.1.2018"
- P813: +2019-03-09T00:00:00Z/11
- P123: Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q358870)
Area
The same procedure can be used to update the area figures:
qid,P2046,qal585,S854,s1476,s813,s123 Q126321,42.88U712226,+2018-01-01T00:00:00Z/11,""""http://www.statistik.at/web_de/klassifikationen/regionale_gliederungen/dauersiedlungsraum/index.html",de:"Dauersiedlungsraum der Gemeinden Politischen Bezirke und Bundesländer - Gebietsstand 1.1.2018",+2019-03-10T00:00:00Z/11,Q358870
This uploads this statement to the entity Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q126321):
- P2046: 42.88 Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q712226)
this qualifier:
- P585: +2018-01-01T00:00:00Z/11
and the following references:
- P854: "http://www.statistik.at/web_de/klassifikationen/regionale_gliederungen/dauersiedlungsraum/index.html"
- P1476: de:"Dauersiedlungsraum der Gemeinden Politischen Bezirke und Bundesländer - Gebietsstand 1.1.2018"
- P813: +2019-03-10T00:00:00Z/11
- P123: Lua error in Module:Wd at line 196: attempt to index field 'wikibase' (a nil value). (Q358870)
Retrieving Wikidata figures to populate infoboxes
The following wikicode would transclude population and area statistics as of 1 January 2018 to a Wikipedia article using {{Infobox Settlement}}:
| population_footnotes = {{wikidata|reference|P1082|P585=2018-01-01}} | population_total = {{wikidata|property|raw|P1082|P585=2018-01-01}} | area_footnotes = {{wikidata|reference|P2046|P585=2018-01-01}} | area_total_km2 = {{wikidata|property|raw|P2046|P585=2018-01-01}}
QID - subdivision key mappings
- Austria:
- Municipalities: P964: link to the query.
- France:
- Municipalities: P374: link to the query.
- Germany:
- Municipalities: P439: link to the query.
- Italy:
- Municipalities, provinces and regions: P635: link to the query.
- Japan:
- Municipalities: P429: link to the query.
- Spain:
- Municipalities: P772: link to the query.
- Switzerland:
- Municipalities and districts: P771: link to the query.