Uploading with Commonsbot

Published: Dec 7, 2021 by Steve Baskauf

A few months ago, as part of our WikiProject Vanderbilt Fine Arts Gallery, we received permission to upload Public Domain works from the Vanderbilt Fine Arts Gallery to Wikimedia Commons, where they will be more accessible to the public.

To make this happen, I put in some more work on Commonsbot, a Python script that I’d been hacking away at for about a year. It’s now nominally functional, and I used it to upload just under 300 high-resolution images of two-dimensional works.

There are existing tools for uploading images to Commons, but Commonsbot not only uploads the images with metadata based on the Artwork template, but it also adds Structured data on Commons that backlinks the Commons media item to its corresponding Wikidata item. It also generates the necessary CSV data for another script I wrote, VanderBot, to create a P18 (image) link from the Wikidata item to the new Commons media item.

For example, one of our works whose image was uploaded to Commons is now linked to its Wikidata item: https://www.wikidata.org/wiki/Q104032737.

We can now do fun stuff with the images like create SPARQL-based visualizations such as an image grid showing Kress collection works donated to the Gallery in the 1960’s.

Share

Latest Posts

Uploading a thousand Gallery images to Commons
Uploading a thousand Gallery images to Commons

I recently finished work on CommonsTool, a Python script to upload artwork images to Wikimedia Commons. In addition to uploading the image files, it creates Structured Data on Commons claims to provide machine-readable metadata about the images and to link them to Wikidata items that describe the underlying artwork objects. It also uploads the images to the Vanderbilt Libraries’ International Image Interoperability Framework (IIIF) server and generates IIIF manifests to display those images in a IIIF viewer.

Making SPARQL queries to Wikidata using Python
Making SPARQL queries to Wikidata using Python

I recently solved several annoying problems that I’d been having when using SPARQL queries to acquire data from Wikidata. My success inspired me to write a comprehensive Python class that will reliably carry out every kind of SPARQL Query and Update, with defaults to easily make SELECT queries to Wikidata.

Birding in Puerto Rico
Birding in Puerto Rico

After recently making a trip to Puerto Rico that was primarily focused on bird watching, I decided to write a blog post to pass on some of what we learned. Much of the information that we got from books or the Internet was outdated or incorrect, so hopefully this post will help others to have an easier time finding good places to bird there.