Project

metaschema

0.0
The project is in a healthy, maintained state
Parser and generator for NIST Metaschema
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Metaschema

Gem Version Build Status Code Climate

Purpose

This Ruby gem implements a parser and generator for the NIST Metaschema Information Modeling Framework.

Metaschema is a specification for defining information models in a structured format (currently via XML). It provides a way to define and manage information model schemas that can be converted into XML and JSON Schemas.

This library can be used to parse and generate information schemas defined in the Metaschema XML format.

This library can also be used to generate XML schemas and JSON Schemas from Metaschema XML files.

Note
The Metaschema gem is a work in progress and may not yet support all features of the Metaschema specification.
Note
The Metaschema gem will support the generation of data accessors for Metaschema-defined information models in the future.

Features

TODO: This list is a TODO list. None of them have been completed.

  1. Parse, build and round-trip Metaschema XML files

  2. Validate Metaschema XML files against the Metaschema XML Schema

  3. Generate XML (XSD) and JSON Schemas from Metaschema XML files

  4. Generate Lutaml::Model (Ruby) classes that allow access and manipulation of Metaschema-defined information models.

  5. Validate Metaschema-defined information models against the Metaschema XML Schema

Installation

To install the metaschema gem, use one of the following methods.

Add this line to your application’s Gemfile:

gem 'metaschema'

Then execute:

$ bundle install

Or install it directly using:

$ gem install metaschema

After installation, you can start using the metaschema gem in your Ruby projects or via the command-line interface.

Ruby API

require 'metaschema'

# Load a Metaschema file
# Sample at spec/fixtures/metaschema/examples/computer-example.xml
ms = Metaschema::Root.from_file("computer-example.xml")

ms.to_xml
# <METASCHEMA xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
#  xsi:schemaLocation="http://csrc.nist.gov/ns/oscal/metaschema/1.0 ../schema/xml/metaschema.xsd"
#  xmlns="http://csrc.nist.gov/ns/oscal/metaschema/1.0">
#     <schema-name>Computer Model</schema-name>
#     <schema-version>0.0.5</schema-version>

ms.schema_name
# "Computer Model"

ms.schema_version
# "0.0.5"

ms.assemblies
# [Vendor, Computer, ...]

Tests

The spec/fixtures folder contains tests that the Metaschema gem needs to comply with.

Including:

spec/fixtures/metaschema

the submoduled repository from the Metaschema project

spec/fixtures/metaschema/examples

examples of Metaschema XML files (for us to test round-tripping)

spec/fixtures/metaschema/test-suite

the test suite for the Metaschema project. TODO: This library is to be tested against these files.

spec/fixtures/metaschema/test-suite/schema-generation

these files test against individual features of Metaschema. TODO: This library needs to run RSpecs against every directory here each representing a separate feature.

spec/fixtures/metaschema/test-suite/worked-examples

these files are complete Metaschema XML examples that exercises all features of Metaschema. TODO: This library needs to run RSpecs against each of these files.

License

Copyright Ribose.

BSD-3 license.