longeron¶
The spine of your system model. longeron is a Python package that
defines, exports, imports, and executes SysML v2 models. The import
name is longeron. The parsers are generated with
ANTLR 4 from combined SysML v2 and KerML grammars, and the full official
SysML-v2-Release corpus parses and builds
(grammar conformance).
SysML® is a registered trademark of the Object Management Group. This project is not affiliated with or endorsed by OMG, and is not a conformance-certified implementation.
Install¶
pip install longeron
The core install has one hard dependency, the ANTLR runtime. Solver, visualization, and interchange features live behind extras (extras table).
Capabilities¶
Verb |
What you get |
|---|---|
Define |
Parse SysML v2 textual notation into a fully-typed Python object model, import a model from its JSON export, or build models programmatically from dataclasses. Multi-file workspaces merge under one root; a content-addressed cache makes warm loads ~1000x faster. |
Export |
Serialize any model to JSON, back to parseable SysML v2 text, project it onto KerML, or emit OMG Systems-Modeling-API JSON records. Parse → print → parse round-trips preserve the model; JSON → model → JSON is lossless. |
Validate |
|
Execute |
Evaluate expressions, run |
Verify |
|
Analyze |
|
Visualize |
|
Review & edit |
The inspector shows units first-class ( |
Query & retrieve |
Project any model onto RDF ( |
Serve & sync |
|
Full loop |
Read a model, execute it, snapshot the results back into the model as bound part usages, and save ( |
The builder covers the full grammar: every construct the SysML grammar
accepts (interfaces, views, flows, allocations, metadata annotations,
satisfy/verify/frame, filtered imports, …) maps to a model class — there
is no lossy fallback. KerML support is asymmetric by design:
parse_kerml_text validates KerML sources syntactically, and to_kerml
projects SysML models onto the kernel language.
The approach¶
Five principles hold everywhere, stated here as design facts:
Model-derived, never invented. The unit table derives from the model’s own definitional algebra (
newton = kg*m/s^2lives in the vendored library and seeds the table); no unit is hand-coded.verifymines its input domains from the model’s constraints through Z3 and flags any fallback. Geometry renders from M0 populations: the individuals that exist, keyed per configuration. The OMG standard library is vendored, not reimplemented.One truth, many projections. Every surface reads the same model object, and the tutorials assert the agreement where projections overlap: the model’s closed-form payload ceiling matches
verify’s independently bisected edge, the CP-SAT enumeration equals the interpreter’s set, and SPARQL answers are checked against the trade dashboard.Honest refusal over silent corruption. A fake unit is refused with nearest-spelling hints. A rename that would capture a name rolls back and lists the affected references. A workspace save that cannot map a change refuses, names why, and writes nothing.
Honest absence, counted claims. The corpus badge claims only positive acceptance; rejection is its own suite, and the two known permissiveness gaps stay visible as strict xfails. Vacuous verification passes are recorded, never coerced into failures. Covering-array recall is measured against exhaustive ground truth, never assumed.
The interpreter is the sole semantic oracle. Z3, CP-SAT, and Hypothesis only propose; every verdict is the interpreter’s. A SAT witness is believed only after the interpreter re-checks it.
Where to go next¶
Getting started — install, extras, and a parse → validate → simulate quickstart.
Tutorials — nine executable notebooks, one curriculum. The documentation build runs them, so every output on those pages is current.
Guides — one task per page: the command line, workspaces & caching, validation, grammar conformance, choosing an analysis, and development.
API reference — autodoc pages for every module, plus the notation gallery.
Architecture — how a model flows through the package, and what is vendored.
Release notes — what shipped in each release.