Skip to content

Importing Data with OpenRefine (Wikibase)

After uploading your images to Commons you should still have your same project with all columns as they were. We will use these for the Wikibase import.

The specific example is transfering data from Wiki Commons, using data from Open Refine and importing the data to the CPS Wikibase Cloud instance - Main Page

  • Extensions: Wikibase > Manage Wikibase instances...

  • Add Wikibase

  • Paste this manifest.json into the text field:
{
"version": "1.0",
"mediawiki": {
"name": "cps Wikibase Cloud",
"root": "https://computational-publishing-service.wikibase.cloud/wiki/",
"main_page": "https://computational-publishing-service.wikibase.cloud/wiki/Main_Page",
"api": "https://computational-publishing-service.wikibase.cloud/w/api.php"
},
"wikibase": {
"site_iri": "https://computational-publishing-service.wikibase.cloud/entity/",
"maxlag": 5,
"max_edits_per_minute": 60,
"tag": "openrefine-${version}",
"properties": {
"instance_of": "P1",
"subclass_of": "P2"
}
},
"reconciliation": {
"endpoint": "https://kartkod.se/apis/reconciliation/wb/computational-publishing-service.wikibase.cloud/${lang}/api"
}
}

and it should add the cps Wikibase:

First, generate a new column based on filename.

  • right-click on column
  • Edit column > Add column based on this column...
  • change the text in the box to value.replace('.Jpg','') (or whatever your file ending is) and generate your column. Give the column a name of WB name

Now reconcile its contents against cps Wikibase.

  • Reconcile > Actions > Create a new item for each cell...
  • Copy this entire code into an empty .txt file on your PC and rename it to schema.json:
{"entityEdits":[{"type":"wbitemeditexpr","subject":{"type":"wbentityvariable","columnName":"WB name"},"nameDescs":[{"name_type":"LABEL_IF_NEW","value":{"type":"wbmonolingualexpr","language":{"type":"wblanguageconstant","id":"en","label":"en"},"value":{"type":"wbstringvariable","columnName":"WB name"}}},{"name_type":"DESCRIPTION_IF_NEW","value":{"type":"wbmonolingualexpr","language":{"type":"wblanguageconstant","id":"en","label":"en"},"value":{"type":"wbstringvariable","columnName":"description"}}}],"statementGroups":[{"property":{"type":"wbpropconstant","pid":"P61","label":"image","datatype":"commonsMedia"},"statements":[{"value":{"type":"wbstringvariable","columnName":"filename"},"qualifiers":[],"references":[],"mergingStrategy":{"type":"snak","valueMatcher":{"type":"lax"}},"mode":"add_or_merge"}]},{"property":{"type":"wbpropconstant","pid":"P54","label":"copyright statement","datatype":"string"},"statements":[{"value":{"type":"wbstringvariable","columnName":"copyright"},"qualifiers":[],"references":[],"mergingStrategy":{"type":"snak","valueMatcher":{"type":"lax"}},"mode":"add_or_merge"}]},{"property":{"type":"wbpropconstant","pid":"P108","label":"creator","datatype":"string"},"statements":[{"value":{"type":"wbstringvariable","columnName":"creator"},"qualifiers":[],"references":[],"mergingStrategy":{"type":"snak","valueMatcher":{"type":"lax"}},"mode":"add_or_merge"}]},{"property":{"type":"wbpropconstant","pid":"P60","label":"publication date","datatype":"edtf"},"statements":[{"value":{"type":"wbstringvariable","columnName":"date"},"qualifiers":[],"references":[],"mergingStrategy":{"type":"snak","valueMatcher":{"type":"lax"}},"mode":"add_or_merge"}]},{"property":{"type":"wbpropconstant","pid":"P109","label":"described by source","datatype":"url"},"statements":[{"value":{"type":"wbstringvariable","columnName":"source"},"qualifiers":[],"references":[],"mergingStrategy":{"type":"snak","valueMatcher":{"type":"lax"}},"mode":"add_or_merge"}]}]}],"siteIri":"https://computational-publishing-service.wikibase.cloud/entity/","entityTypeSiteIRI":{"item":"https://computational-publishing-service.wikibase.cloud/entity/","property":"https://computational-publishing-service.wikibase.cloud/entity/"},"mediaWikiApiEndpoint":"https://computational-publishing-service.wikibase.cloud/w/api.php"}
  • Go to Extensions: Wikibase > Manage schemas... and upload this file. It should appear as cps_schema in the list after.

  • If you used images you took yourself: Remove the entire described by source parameter.

This is what it should look like (or without source):

  • Go to Extensions: Wikibase > Upload edits to Wikibase…
  • If you have these issues, you can ignore them for now:

  • add a short summary and click Upload edits!

If the upload was successful you should now have links in your WB name column that take you to a page like this on the cps Wikibase:

![](https://upload.wikimedia.org/wikipedia