RAMEN Core
    Preparing search index...

    Export and Import

    export() writes the Edition model, its base models and its annotation shapes into one JSON file. This continues the Edition example:

    import type { RamenFile } from '@ramen-suite/core/ramen';

    const file: RamenFile = edition.export();
    const json: string = JSON.stringify(file, null, 2);

    const parsed: unknown = JSON.parse(json);
    const restored: RamenModel = RamenModel.import(parsed);

    The file follows the RAMEN file schema. Its models list identifies RAMEN and Edition. Each node, relationship and annotation shape appears once with the modelId of its declaring model. Node superTypes preserve inheritance. The importing tool can read the complete model without assembling separate files.

    import() restores the levels. openLevel() opens a project level for editing; the packaged RAMEN reference model stays read-only. RAMEN_MODEL and RAMEN_ELEMENT are frozen constants; getModel() and getModels() return detached copies. getModel() returns only the current project document. Both schemas also ship in @ramen-suite/core/schemas/.

    See JSON Schemas for all packaged schemas and their purposes.

    Import requires the supported file format and the current RAMEN reference version and definitions. Reference descriptions and declaration order may differ. Older files are accepted when they meet these requirements; import preserves their definitions without migrating them.

    An unsupported file format throws UnsupportedModelFormatError. Reference mismatches are reported through RAMEN diagnostics. Model evolution can describe changes, but does not migrate recorded data.