Wikipedia:GLAM/Museum of New Zealand Te Papa Tongarewa/The whole GLAM package/Upload images

With Wikidata up to date, you can now upload your selected images into Wikimedia Commons. You’ll do this in OpenRefine too, along with a table of descriptive metadata and more structured Wikidata statements.

Modelling data for collection objects
Checklist task: Model image metadata

Images loaded to Wikimedia Commons can have both descriptive and structured metadata.



Descriptive metadata is what shows on the page underneath the image. Most images just the standard title, description, creator and license, but you can replace these with much more information if you use a template. See more about using a template below.



Structured metadata connects to Wikidata using statements about the image, like the ones you added earlier about people, places and things. People looking at the image on the Commons can see these too, but the real benefits are what can be done automatically across different Wiki platforms and beyond.

Create a data model for both descriptive and structured metadata so you know what goes into your final export and OpenRefine project. You’ll want a lot of that information to be in both places, so don’t worry if it looks like you’re doubling up.

Include:
 * The label you want to give it when you upload your images
 * Where in your own system the data comes from
 * Any transformations you have to do before uploading
 * For structured data, include both statements and qualifiers to those statements

Find or create a template
Checklist task: Create/prepare template

A template lets you share more detailed information about an image, making it easier for anyone to find, understand and use it. The standard template is called Information, and most other templates look pretty much the same – just with more fields.

About Commons templates

You can use an existing template or create your own, and then do a little work in OpenRefine to combine data from several columns, generating the Wikitext (marked up text that Wiki platforms use for things like headings, tables and links) that will fill it in.

File description pages has some other Commons templates, including for maps and books.

If the available options don’t work for your collections, see how to create a Commons template to make your own custom one.

Whatever you choose, make sure the fields – and fieldnames – in your template and data model are completely lined up. Spelling and capitalisation are really important.

Export your data and images
Checklist task: Prepare and load images

Export your data one last time!

Make sure you include:
 * All the fields for both the descriptive and structured metadata – these might overlap
 * Columns for Wikitext, Filename, Filepath, and any category values you want to add

If different sets of images need different schemas (for example, if you have photographs and artworks), they’ll have to be separated out into their own OpenRefine projects – you can only use one schema at a time.



Export the images you’re going to use to a folder. Make sure the folders and filenames you use match up with what’s in your OpenRefine project.

Load images and data from OpenRefine
There are three main bits of preparation you still need to do:
 * Create Wikitext for descriptive metadata
 * Reconcile Wikidata values and Wikimedia Commons filenames
 * Enter your upload schema

Read the OpenRefine guidance on uploading files for the full details.

Wikitext
OpenRefine lets you transform values in all sorts of ways using little snippets of Javascript or General Refine Expression Language (GREL). You can link together simple instructions to do some really complex changes.

Expressions in OpenRefine

You’re going to use GREL to build the field your selected template will turn into the table of data on each image’s page. Write this up in a text editor like Notepad++ or Sublime Text first – it’s a lot easier to edit there.

How to create a GREL instruction to build Wikitext – OpenRefine recipes

Reconciliation
For each column of QIDs, reconcile the values. This ensures your structured data statements hook up to the right Wikidata items.

Reconciliation in OpenRefine

Now, reconcile the filenames – just the names, not the whole file path. This prepares the pages on Wikimedia Commons you’re going to upload to.

Schema
You now have all the data you need, in the right places. You just have to tell OpenRefine what to do with it.

See “Build your schema” in OpenRefine’s guide to bulk uploading

Follow the instructions to drag and drop your column names into the right slots.



You can now upload your images. Review the OpenRefine instructions to make sure you’ve covered everything.

Tips when uploading your images:
 * Do a test run with a few records and check they look right to you
 * Use a bot password linked to your Wikimedia Commons login
 * Do it as a team – but have snacks ready, because it’ll take a while

When everything’s uploaded, check the images. If there are mistakes, you can always fix them! If you can, add the urls to your collections database – it’s useful to keep track of where your collections end up.

Next up: Create and edit articles