Serialization (SML)
All Platform Content represented in SedaroML is open and exportable to human-readable formats — in Sedaro, there is no vendor lock. The interchange form is an SML document: model data and model schema, together in one self-describing, version-controllable text artifact.
Anatomy of an SML Document
An SML document is a multi-document YAML payload. SDKs with the SML document API default to SML 2.0, where each YAML document has a kind and document order is not significant. This abbreviated example shows the data and schema shapes:
# Document 1: instance data
kind: data
namespace: PNzY3Mjc1Nk
instances:
- id: PNzY3Mjc1Nj
type: Pendulum
parent: null
fields:
name: "demo pendulum"
length: 1.0
angle: "(0.1 : rad)"
---
# Document 2: schema
kind: schema
version: "2.0"
ontologies:
- model: Pendulum
supers: []
fields:
length: { type: f64, docs: "The length of the pendulum in meters." }
angle: { type: rad, format: typed, docs: "The angle of the pendulum in radians." }
The Data Document
The data mapping contains a namespace and an instances list. Each instance records its id, type, field values under fields, and composition parent where applicable. In SML 2.0, an ordinary relationship reference carries the target ID and a namespace: null for a target in the same document, or the owning document's namespace for a cross-document target. Composition trees stay within one document. Use the Python ModelSet API to serialize and restore cross-document relationships together. Uncertain quantities serialize as their distribution (type + parameters), not just a nominal value.
Legacy SML 1.x
Legacy SML uses an ordered data-list document followed by a schema mapping, without kind or a document namespace. Relationship values are target IDs rather than namespaced references. The deprecated gen_sml / bulk_gen_sml generators and SML(..., legacy=True) produce this format. SML.read() accepts both legacy and 2.0 documents; raw JSON/YAML data readers are distinct from complete SML file readers.
Choose a format supported by the receiving platform or tool. An SDK's default export format does not establish compatibility with every deployment.
The Schema Document
The type definitions needed to interpret and edit the data:
version— schema format version.ontologies— one entry per ontology: its name, supertypes (supers), and fields. Each field records its SedaroTS type, aformat(rawfor plain values,typedfor typed datums), its documentation, and expositions — extra metadata such as relationship targets/reverses and enum references.enums— enum definitions (name and variants) referenced by fields.categories— optional grouping metadata so editors and UIs can present large ontology libraries in curated groups.
Because documentation is part of the language, docs flow into the schema automatically — a schema is simultaneously machine-readable and human-reference material.
Ontologies can customize their schema presentation (hide internal fields, fix field ordering) without affecting model semantics.
SML documents capture model structure and data; behaviors and their queries are not part of the SML schema. SML generation currently emits YAML.
Generation and parsing APIs are described in the Python Representation.