Skip to content

About

Metanorma Knowledge Objects (MN 116) — the machine serialization format: wire schema, bundle layout, generated JSON Schemas, edition diffs, reference MCP server

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

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

About

Metanorma Knowledge Objects (MN 116) — the machine serialization format: wire schema, bundle layout, generated JSON Schemas, edition diffs, reference MCP server

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages