Giter Club home page Giter Club logo

baglidate's Introduction

Baglidate: a validator for BagIt bags

The baglidate library validates BagIt bags using the "in development" BagIt 1.0 spec. For the most up-to-date spec, see the bagit1.0 branch of the BagIt GitHub page.

All this repo really does is compare the non-normative ABNF grammars in section 7 of the BagIt 1.0 spec to the prose descriptions and examples provided in other areas of that text. It uses the Clojure Instaparse library to create parsers from the supplied BagIt ABNF grammars and compares them against example inputs (BagIt files) that are expected to be valid. If errors are discovered, a new grammar is written (suffixed with _fixed) which accepts the example inputs.

Usage

Assuming you have Clojure >= 1.8 installed, run the tests as you develop:

$ lein test-refresh

Or, just run the tests once:

$ lein test

You should see something like:

Ran 5 tests containing 10 assertions.
0 failures, 0 errors.

Directory Structure

The ABNF grammars are in files with the .abnf extension under resources/. Files with the _fixed suffix are attempts to improve on the otherwise identically named files (which are copied directly from the BagIt 1.0 spec):

├── resources
│   ├── bag_declaration.abnf
│   ├── bag_metadata.abnf
│   ├── bag_metadata_fixed.abnf
│   ├── fetch_file.abnf
│   ├── fetch_file_fixed.abnf
│   ├── payload_manifest.abnf
│   ├── payload_manifest_fixed.abnf
│   └── uri.abnf

The resources/ directory also contains example input files that are assumed to be valid. These are used in the tests:

├── resources
│   ├── sample-bag-info.txt
│   ├── sample-fetch-file.txt
│   ├── sample-manifest-sha256.txt

The logic for reading the grammars and input files, using Instaparse to create parsers from the grammars, and testing the inputs against the parsers is in the sole files in the src/ and test/ directories:

├── src
│   └── bagit_instaparse
│       └── core.clj
└── test
    └── bagit_instaparse
        └── core_test.clj

References

License

Copyright © 2018 Joel Dunham

Distributed under the Eclipse Public License version 1.0.

baglidate's People

Contributors

jrwdunham avatar

Watchers

 avatar  avatar

baglidate's Issues

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.