In the previous post, we explained how we used OCR to extract the vocabulary structure from the Repertorio Terminologico per la Schedatura delle Sculture dell’Arte Gandharica. Since our goal is a SKOS thesaurus that we can use as a linked data vocabulary, this post covers the conversion of the abstract tree structure to RDF.
SKOS, the Simple Knowledge Organization System, provides a minimalistic schema for creating and publishing hierarchical vocabularies in RDF. Because it is in RDF, it can be expanded with other RDF schemas.
Since our vocabulary shares similar scopes and contents with the Getty Arts and Architecture Thesaurus (AAT) – although of course much more modest in scope – we took their documentation as a starting point for our own use of RDF. The basic structure is quite simple: we have a hierarchy of language-independent concepts (instances of
skos:Concept) labelled in multiple languages (English and Italian for now). There are, however, a few aspects that we want to maintain but are difficult to express in pure SKOS, therefore we extended the model a bit:
- We use
dct:sourceto specify the resource whence we derived each concept. Initially, all concepts come from the Repertorio, but this mechanism allows us to flag our own contributions or additions from other sources.
- We use
dc:identifierto specify the numerical ID (which is also part of the URI), following AAT’s model.
- We make use of the SKOS eXtension for Labels (SKOS-XL). This makes the structure a bit more complicated, as labels are not simply literals, but instances of their own. However, this allows us to specify not only the source of the concept itself, but also the source of a label. This will become relevant when we add more translations (there is, for example, already a Chinese translation that we might incorporate at some point in the future).
- Instead of the generic
skos:broaderto construct the term hierarchy, we make use of the more nuanced relations from SKOS Thes. Especially, this allows us to differentiate the relation between a specific concept and a more generic one (
skos-thes:broaderGeneric) from a whole-part-relation (
skos-thes:broaderPartitive). This is a distinction that the Repertorio itself makes consistently, and which we wanted to maintain.
- We use
foaf:depictionto point from each concept to the corresponding illustration from the Repertorio.
A very basic example of an entry from the Repertorio then looks like this in its RDF rendering (in Turtle format):
@prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix dct: <http://purl.org/dc/terms/> . @prefix diga_source: <https://w3id.org/diga/source/> . @prefix diga_terms: <https://w3id.org/diga/terms/> . @prefix skos: <http://www.w3.org/2004/02/skos/core#> . @prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> . <https://w3id.org/diga/terms> a skos:ConceptScheme . diga_terms:2838159259 a skos:Concept ; dc:identifier "2838159259" ; dct:source diga_source:repertorio ; skos:topConceptOf <https://w3id.org/diga/terms> ; skosxl:prefLabel diga_terms:1135055502, diga_terms:1266854144 . diga_terms:1135055502 a skosxl:Label ; dct:source diga_source:repertorio ; skosxl:literalForm "tools for working stone"@en . diga_terms:1266854144 a skosxl:Label ; dct:source diga_source:repertorio ; skosxl:literalForm "strumenti per la lavorazione della pietra"@it .
We have a Python Notebook that does the heavy lifting. It takes the tree structure discussed in the previous post, performs some additional cleanup (like splitting preferred and alternative labels), and creates an RDF structure using RDFlib.
The result is then imported into VocBench, for which our university library’s DH Center kindly set up an instance. VocBench is a relatively comfortable SKOS (and RDF) editor that allows our team to make final changes and corrections before publishing it.
There are a few steps left before publication, mainly proofreading the entries one last time, registering the URI prefixes through W3ID, and making the vocabulary available through our SKOSMOS instance. Also, at some point, we want to include crosslinks to other vocabularies, like Getty AAT or IconClass. But we are already quite satisfied that we managed to automatically convert a large portion of the Repertorio from a printed book to a reusable SKOS format that we can use for cataloging our objects.