LD4P / rdf2marc

A Bibframe RDF to MARC converter for use within the Sinopia ecosystem.
4 stars 1 forks source link

CircleCI Build Maintainability Test Coverage

rdf2marc

A Bibframe RDF to MARC conversion library for use within the Sinopia ecosystem.

rdf2marc is currently available as a commandline utility and deployed within Sinopia as an AWS lamda (see CircleCI configuration).

Overview

In rdf2marc, the RDF is mapped to a model that represents the data found in a MARC record. The model is then mapped to a MARC record.

This enables supporting RDF variations, where each variation can have its own map to the model. In the context of Sinopia, this allows for supporting multiple resource templates. (This similarity between resource templates possibly allows for sharing mappings to models.)

The mapping is based on Library of Congress's BIBFRAME 2.0 to MARC 21 Conversion Specifications.

When the RDF references an external resource, rdf2marc will attempt to resolve that resource and extract data for populating the model.

Ruby version

As specified in the AWS lambda, rdf2marc used Ruby 2.7.

Usage

Mapping to the model:

$ exe/rdf2model
Usage: rdf2model <instance ttl file> <work ttl file?> <admin metadata ttl file?>
Usage: rdf2model <instance uri>
$ exe/rdf2model instance.ttl work.ttl admin_metadata.ttl
$ exe/rdf2model https://api.stage.sinopia.io/resource/70ac2ed7-95d0-492a-a300-050a40895b74
$ exe/rdf2model https://api.development.sinopia.io/resource/83fe8c98-e34b-42aa-b6d3-07cc11c3faa6

Mapping to MARC:

$ exe/rdf2marc
Usage: rdf2marc <instance ttl file> <work ttl file?> <admin metadata ttl file?>
Usage: rdf2marc <instance uri>
$ exe/rdf2marc instance.ttl work.ttl admin_metadata.ttl
$ exe/rdf2marc https://api.stage.sinopia.io/resource/70ac2ed7-95d0-492a-a300-050a40895b74
$ exe/rdf2marc https://api.development.sinopia.io/resource/83fe8c98-e34b-42aa-b6d3-07cc11c3faa6

In addition to printing the MARC record, this will also output a binary MARC record (record.mar).

Note when using files:

Note when using Instance uri:

Caching

Resolving external resources is slow. To speed this up, responses can be cached. The following caches are supported.

Example configuration:

Rdf2marc::Cache.configure(Rdf2marc::Caches::FileSystemCache.new)
Rdf2marc::Cache.configure(Rdf2marc::Caches::S3Cache.new('rdf2marc-development'))

Current limitations