Creating properties with statements using Wikidata Integrator
Wikidata Integrator is a Python library that simplifies data integration from Wikidata (and other Wikibases). It is written in Python, is focused on Wikibase concepts (as opposed to some libraries which are MediaWiki focused) and has a user-friendly interface.
I’m currently working on a demo Wikibase and decided to bring all of the data into the Wikibase making use of a Jupyter notebook, and Wikidata integrator was my choice library to use for this task. (Jupyter notebooks are interactive coding environments that allow users to create and share documents containing live code, visualizations, and explanations.)
Along that journey I found the Wikidata Integrator documentation lacking slightly, but I managed to get initial property and item creation working with little effort. However, I couldn’t get properties to create with statements already on them (needed a subsequent edit instead).
After searching around and reaching out to some other Wikidata Integrator users I ended up in the small telegram channel (which you can find linked on the GitHub repo) where Andra showed me some code examples that I had already seen, but pointed out the part adding statements.
Maybe this is just for properties (I’m yet to fully experiment with items as part of Wikidata Integrator), but if you find yourself unable to create properties with statements, the key part is to add them to the
data element on initial object creation, rather than appending them to the
statements attribute of the object.
So instead of this…
You want something like this…