Hacking on the Zotero database

This week we have been learning about relational databases and how they work. Database management system like MySQL and PostgreSQL power the back end of many dynamic websites across the web, and are worth learning about for that reason alone. We have looked at the WordPress database and got a sense of how posts and pages are stored. But we are doing Digital Humanities here, so we want to explore how databases are useful or necessary to answer humanities research questions.

Since you just set up your Zotero accounts, today, we are going to explore the database structure that Zotero uses to store bibliographic information — that is, the articles, books, and other cultural sources that undergird most research — and what we can do with it.

RIP Paper Machines

Several years ago, Jo Guldi and Cora Johnson-Roberson co-created an add-on tool for Zotero called Paper Machines. This was an impressive set of tools that used the metadata and full-text of any attachments in your collection to perform text analysis and generate a number of visualizations including word clouds, maps, topic models and phrase nets.

The Paper Machines Interface
Paper Machine’s Topic Model visualization leveraging publication date metadata

Sadly, the project has not been maintained and no longer works with the current version of Zotero.

So we are going to have to roll our own hacky versions if we want to do something similar!

Zotero setup in the lab

We are pushing the bleeding edge here so need some setup

SQLite in the browser

Zotero stores its data in an SQLite database, a common form of file database that browsers often use to store your history, for instance.

We are going to explore our Zotero database live using an online SQLite notebook application called Franchise, taking inspiration from this post on Asking Questions of CSV Data, Using SQL In the Browser, With Franchise.

  • Go to Franchise.cloud
  • Find your data directory location and drag your data into the browser window
  • Start to build your notebook by selecting tables, making queries and exploring visualizations.

JavaScript API

We can also explore using the Zotero JavaScript API to investigate our database.

Follow along with the instructions here to enable Chrome’s devtools and try out the JavaScript samples

Leave a Reply

Your email address will not be published. Required fields are marked *