Ready to Learn?Ex Libris products all provide open APIs

Tech Blog

 

Alternate Formats for Linked Data in Alma

Josh Weisman on August 28th, 2018

As we've discussed previously, the Linked Data features in Alma now allow bibliographic records to be retrieved in three different formats- BIBFRAME, RDA/RDF and JSON-LD. In addition, staff users can view records in BIBFRAME directly from the record view:

Alternative Linked Data Formats - BIBFRAME in Alma

For some linked data experts, these formats may be perfectly readable as-is. But they were intended to be consumed by computer systems and are therefore less human-readable. However, there are other linked data presentations that are perhaps more appropriate for human consumption, and it's possible to use common tools to display the records in these alternative presentation formats.

A Word About RDF and N3

Alternative Linked Data Formats - Turtle There are plenty of resources on the Internet which can do a much better job of introducing RDF than I could. For our purposes, we'll just recall that RDF, or Resource Description Framework, intends to make statements about entities or resources. These statements take the form of triples, or subject-predicate-object. For example, a certain work (the subject) has a title (the predicate) of "The Complete Works of Dr. Suess" (the object). 

The Notation3 (or "N3") format, is a more compact and (some might say) easier-to-read format than RDF XML. Turtle syntax is a subset of N3. This syntax shows the subject on a single line followed by lines which show the predicate and object pairs. This can be represented as follows:

subject
  predicate object

Or as the example in Wikipedia shows:

 @prefix dc: <http://purl.org/dc/elements/1.1/>.

 <http://en.wikipedia.org/wiki/Tony_Benn>
   dc:title "Tony Benn";
   dc:publisher "Wikipedia".

RDF XML in Alma

Alma provides the BIBFRAME and RDA/RDF linked data formats in RDF XML, which is verbose and not so manageable. 

<rdf:RDF xmlns:madsrdf="http://www.loc.gov/mads/rdf/v1#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdac="http://rdaregistry.info/Elements/c/"
xmlns:rdaw="http://rdaregistry.info/Elements/w/"
xmlns:rdae="http://rdaregistry.info/Elements/e/"
xmlns:rdam="http://rdaregistry.info/Elements/m/"
xmlns:rdai="http://rdaregistry.info/Elements/i/"
xmlns:rdaa="http://rdaregistry.info/Elements/a/">
<rdac:Work rdf:about="https://open-na.hosted.exlibrisgroup.com/alma/TR_INTEGRATION_INST/rda/entity/work/9042525315621421256">
<rdaw:titleOfTheWork>Harry Potter and the prisoner of Azkaban /</rdaw:titleOfTheWork>
<rdaw:SubjectRelationshipOf>Lectura</rdaw:SubjectRelationshipOf>
<rdaw:SubjectRelationshipOf rdf:resource="http://id.loc.gov/authorities/subjects/sh00002633"/>
<rdaw:SubjectRelationshipOf>England Fiction.</rdaw:SubjectRelationshipOf>
<rdaw:creator rdf:resource="http://id.loc.gov/authorities/names/n97108433"/>
<rdaw:creator rdf:resource="http://id.loc.gov/authorities/names/n97108433"/>
<rdaw:SubjectRelationshipOf>Schools Fiction.</rdaw:SubjectRelationshipOf>
<rdaw:SubjectRelationshipOf>Magic Fiction.</rdaw:SubjectRelationshipOf>
<rdaw:SubjectRelationshipOf>Wizards Fiction.</rdaw:SubjectRelationshipOf>
<rdaw:SubjectRelationshipOf rdf:resource="http://id.loc.gov/authorities/subjects/sh2008111273"/>
<rdaw:SubjectRelationshipOf rdf:resource="http://id.loc.gov/authorities/subjects/sh2008107181"/>
<rdaw:SubjectRelationshipOf rdf:resource="http://id.loc.gov/authorities/subjects/sh2008113556"/>
<rdaw:SubjectRelationshipOf rdf:resource="http://id.loc.gov/authorities/subjects/sh2008114937"/>
<rdaw:manifestationOfWork rdf:resource="https://open-na.hosted.exlibrisgroup.com/alma/TR_INTEGRATION_INST/rda/entity/manifestation/9941441400561"/>
<rdaw:manifestationOfWork rdf:resource="https://open-na.hosted.exlibrisgroup.com/alma/TR_INTEGRATION_INST/rda/entity/manifestation/991308290000541"/>
</rdac:Work>
</rdf:RDF>

But we can use a tool such as the RDF Translator (powered by RDFLib) to translate the XML into the more readable N3 format. The RDF translator offers a web interface which accepts a URI or the XML body:

Alternative Linked Data Formats - RDF Translator

If we paste the response body of the Alma RDA/RDF Work API for a record in our repository, we receive the following output:

@prefix rdac: <http://rdaregistry.info/Elements/c/> .
@prefix rdam: <http://rdaregistry.info/Elements/m/> .
@prefix rdaw: <http://rdaregistry.info/Elements/w/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

<https://open-na.hosted.exlibrisgroup.com/alma/TR_INTEGRATION_INST/rda/entity/work/9042525315621421256> a rdac:Work ;
    rdaw:SubjectRelationshipOf "England Fiction.",
        "England Juvenile fiction.",
        "Hogwarts School of Witchcraft and Wizardry (Imaginary place) Juvenile fiction.",
        "Magic Fiction.",
        "Magic Juvenile fiction.",
        "Schools Fiction.",
        "Schools Juvenile fiction.",
        "Wizards Fiction.",
        "Wizards Juvenile fiction." ;
    rdaw:creator "Rowling, J. K." ;
    rdaw:manifestationOfWork <https://open-na.hosted.exlibrisgroup.com/alma/TR_INTEGRATION_INST/rda/entity/manifestation/991308290000541>,
        <https://open-na.hosted.exlibrisgroup.com/alma/TR_INTEGRATION_INST/rda/entity/manifestation/9941441400561> ;
    rdaw:titleOfTheWork "Harry Potter and the prisoner of Azkaban /" .

This is of course just the beginning. The translator supports other formats and can be executed programmatically. 

We'd love to hear about your experience with Linked Data in Ex Libris projects. Sound off in the comments or the forum.

 

 

Turtle image available under CC BY-SA 3.0