Project

loc_marc

0.0
The project is in a healthy, maintained state
Library of Congress MARC 21 / MODS / MADS parser
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 5
~> 1.18.0
>= 0
>= 0
 Project Readme

Library of Congress MARC 21 in Ruby

Gem Version Build Status Code Climate

Purpose

This is a class-oriented Ruby library that parses LOC’s MARC 21 data.

This gem is developed using the MARC 21 Slim XSD schema.

Usage

require 'loc-marc'

# Single record under `<collection>`
LocMarc::Collection.from_xml(File.read("spec/fixtures/record_1.xml"))

# Full NIST Tech Pubs records
# https://github.com/usnistgov/NIST-Tech-Pubs/tree/nist-pages/xml
# The file has been split because of GitHub size limits
LocMarc::Collection.from_xml(File.read("reference/allrecords-1.xml"))
LocMarc::Collection.from_xml(File.read("reference/allrecords-2.xml"))

This gem also provides code lists provide by MARC 21.

require 'loc-marc'

LocMarc::Codes::Relator.lookup('wam')
=> {:code=>"wam", :description=>"Writer of accompanying material", :deprecated=>false}

LocMarc::Codes::Language.lookup('en')
=> {:code=>"en", :description=>"Europe, Northern", :deprecated=>false}

LocMarc::Codes::Country.lookup('us')
=> {:code=>"us", :description=>"United States", :deprecated=>true}

LocMarc::Codes::Country.lookup('us')
=>{:code=>"xxu", :description=>"United States", :deprecated=>false},

LocMarc::Codes::GeographicArea.lookup('a-cc-hk')
=> {:code=>"a-cc-hk", :description=>"Hong Kong (China)", :deprecated=>false}

License

Copyright Ribose.