Metaschema Core API

This module provides a Java API using Metaschema information. This API allows for the full Metaschema model to be explored in code.

The following dependency can be added to your POM to use this library.

<dependency>
  <groupId>gov.nist.secauto.metaschema</groupId>
  <artifactId>metaschema-core</artifactId>
  <version>1.0.0-M1</version>
</dependency>

Metaschema information can be loaded from files or by URL. The following example illustrates how to load a Metaschema definition from a remote resource.

MetaschemaLoader loader = new MetaschemaLoader();
IMetaschema metaschema = loader.loadMetaschema(URI.create(
    "https://raw.githubusercontent.com/usnistgov/OSCAL/v1.0.1/src/metaschema/oscal_complete_metaschema.xml"));
System.out.println(metaschema.getShortName());

Building on the previous example, the following shows how to access the global assembly definition named “property”.

IAssemblyDefinition definition = metaschema.getScopedAssemblyDefinitionByName("property");
System.out.println(definition.getName());