io.omk_json.vocabulary

vocabulary

Vocabularies (format specification §6–7), and the encoder and decoder that write the types of a set of vocabularies as JSON data and read them back.

A vocabulary is a published, versioned set of names. Here it is a Vocabulary: its URI, preferred prefix and version, one TypeCodec per type it defines, and the identifiers of its tonal and temporal systems. The codecs are written by hand, one small pair of functions per type, and never derived from a class’s Python fields: the specification is the source of truth, and a field renamed in Python must not silently rename it in every document (_plans/json-serialization.md §5.3).

An Encoder and a Decoder each serve one document. The encoder records which vocabularies the document uses; the decoder resolves the document’s own prefixes. Both check the specification’s domains, so a writer refuses what a reader would reject.

Attributes

Name Description
Role

Classes

Name Description
TypeCodec How one type of a vocabulary is written and read.
Vocabulary A published vocabulary: its identity, its types, and its systems.
Encoder Writes the values of one document, and records the vocabularies it uses.
Decoder Reads the values of one document, resolving its prefixes.

Functions

Name Description
qualify A name as a document writes it (§7.1): bare for omk, otherwise prefix:name.
check_template Checks a name template against the grammar of the omk vocabulary: