Giter Club home page Giter Club logo

loc_mods's Introduction

Library of Congress MODS in Ruby

Gem Version Build Status Code Climate

Purpose

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

This gem is developed using the MODS 3.7 XSD schema.

Usage

Ruby API

require 'loc_mods'

# Single record under `<modsCollection>`
LocMods::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
LocMods::Collection.from_xml(File.read("reference/allrecords-MODS.xml"))

Command line interface

LocMods provides a command-line interface (CLI) for various operations. The main executable is loc-mods.

Detect duplicates

The detect-duplicates command allows you to find duplicate MODS records based on using a "primary ID" that is their DOI (Digital Object Identifier).

Usage:

$ loc-mods detect-duplicates [OPTIONS] <file_or_directory_path>

Options:

  • -r, --recursive: Search for MODS files recursively in subdirectories.

  • -v, --verbose: Display more detailed output.

  • -o, --output FILE: Write the results to a file instead of stdout.

Example:

$ loc-mods detect-duplicates -r -v /path/to/mods/files

This command will:

  1. Search for MODS XML files in the specified directory (and subdirectories if -r is used).

  2. Parse each MODS file and extract the DOI.

  3. Group records with the same DOI.

  4. For each group of duplicates:

    1. Display the shared DOI.

    2. List the filenames of the duplicate records.

    3. Show a detailed comparison of the differences between the records.

The output will highlight differences, removed elements, and missing elements between the duplicate records, helping you identify discrepancies in the metadata.

Testing

bin/update-nist-mods

License

Copyright Ribose.

loc_mods's People

Contributors

ronaldtse avatar camobap avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.