0.0
The project is in a healthy, maintained state
The MN 116 wire contract as code: typed unit schema, bundle layout with manifest verification, hash-addressed assets, edition diffs, interlingual alignment, generated JSON Schemas, and the reference MCP server. metanorma-document composes this gem to export; polyglot consumers validate against the published schemas.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.0
~> 3.0

Runtime

~> 0.8, >= 0.8.22
~> 0.6
 Project Readme

metanorma-mko

Metanorma Knowledge Objects (MKO, MN 116) — the machine serialization format for Metanorma documents, as code.

What this gem owns

The FORMAT contract:

  • the MN 116 wire schema (typed units, edges, document identity, manifest) as lutaml-model classes — Metanorma::Mko::Schema;

  • the bundle layout and manifest verification — Mko::Bundle, Mko::Writer;

  • hash-addressed assets (Mko::Assets);

  • structured edition diffs (Mko::Diff) and interlingual alignment (Mko::Alignment);

  • the generated JSON Schemas — Mko.json_schemas (the schema classes are the single source of truth; TS/Python consumers validate against these, never hand-rolled copies);

  • language resolution (Mko::Language) — W3C XML §2.12 nearest ancestor-or-self xml:lang, then an honest stopword-ratio langid (en/fr/es/de) over the element’s own text, then the declared document language, then an explicit en fallback. Every resolution reports its provenance (markup / heuristic / default / fallback); units carry it as lang_source. Consumer-side of metanorma-standoc#1243: element-level xml:lang wins automatically the day the converter emits it;

  • the reference MCP server over any conforming bundle — Mko::Mcp::Server (search_units / get_unit / walk_edges / edition_diff; JSON-RPC 2.0 over stdio).

What it does not own

The model side — the projection walk, collection orchestration, flavor resolution — lives in metanorma-document, which depends on this gem and reopens Metanorma::Mko with the export entry points (Mko.export, Mko::Collection.export).

Usage

Consumers validate against the published contract:

require "metanorma/mko"
Metanorma::Mko.json_schemas["unit"]
# => { "$schema" => "https://json-schema.org/draft/2020-12/schema", ... }

Agent consumers mount the reference MCP server:

Metanorma::Mko::Mcp::Server.new("oiml-r-60-1.mko").run