
Generates full metamodel implementations from OMG XMI: interfaces, in-memory realisations with factories/resolvers, builder DSL, OCL-derived properties, and AGL types for transforms.
Kotlin Multiplatform implementations of OMG metamodels (UML, KerML, SysML and others), for JVM, JS and Wasm (JS).
The Kotlin code for each metamodel is generated from the OMG's own XMI file of that metamodel. A Gradle task reads the XMI and runs a set of AGL format templates over it. The templates produce:
asString and the
derived properties and operations translated from the OCL in the XMI;| Metamodel | Folder | Modules | Source XMI |
|---|---|---|---|
| UML 2.5.1 | uml/v2_5_1 |
api, ram, agl-types, xmi (model reader), gui-compose, demo-diagrams | ptc-18-01-01 |
| KerML 1.0 | kerml/v1_0 |
api, ram, agl-types | ptc-25-04-04, patched |
| SysML 2.0 | sysml/v2_0 |
api, ram (includes KerML), agl-types | ptc-25-02-15, patched |
| Systems Modeling API 1.0 | sysmod-api/v1_0 |
api | ptc-25-02-29 |
| Diagram Definition 1.1 | dd/v1_1 |
api, ram, agl-types | DD 2013-10-01 |
| MOF 2.5.1 | mof |
api, ram (hand written, not generated) | ptc-14-08-10 |
Each metamodel folder has a specs folder with the XMI and specification PDF the code is generated from.
The KerML 1.0, SysML 2.0 and UML 2.5.1 XMI files are the OMG's official machine-readable files: on 15 November 2026 they were checked against the OMG machine-readable pages and are the latest releases (see spec-problems.md). They are not from the SysML v2 release repository (Systems-Modeling/SysML-v2-Release), which has no metamodel XMI. Where the other files (DD, MOF, Systems Modeling API, SysML 1.7 profile, the PDFs) were downloaded from is not recorded; their names follow OMG document numbers.
The KerML and SysML XMI from the OMG has errors in its OCL (and does not set aggregations), so the code is generated
from patched copies: kerml_patched.xmi and sysml_patched.xmi. Each change is listed in the specs/ocl-fixes.md
file next to it, and spec-problems.md summarises the problems found in
the KerML, SysML and UML specs and XMI. The UML XMI is used as published.
sysml/v1_7/specs holds only the SysML 1.7 profile XMI. It is used to test reading SysML 1.x models with the UML XMI
reader; there is no generated SysML 1.7 code.
| Module | Contents |
|---|---|
diagram/diagram-model |
A generic diagram model (nodes, compartments, ports, edges) that knows nothing about the modelling language, with its AGL types and a conversion to the layout-graph Compose view |
_simple-mof-for-xmi |
The generator: reads MOF XMI into a simple MOF model, translates OCL to Kotlin, runs the templates |
_templates |
The AGL format templates for api, ram and agl-types |
_testmodel |
A small test metamodel (specs/testmodel.xmi) generated with the real templates, with tests of the generated code |
These modules are not published: _simple-mof-for-xmi, _templates, _testmodel (testmodel-api, testmodel-ram).
uml-2_5_1-demo-diagrams is a demo. mof/mof-gen is not part of the build (its build file is named
build.gradle.kts_).
Release 2.4.0 of these four UML modules is on Maven Central, for the JVM only, with the group net.akehurst.omg:
uml-2_5_1-api, uml-2_5_1-ram, uml-2_5_1-xmi and uml-2_5_1-agl-types.
// build.gradle.kts
repositories {
mavenCentral()
}
kotlin {
sourceSets {
jvmMain {
dependencies {
implementation("net.akehurst.omg:uml-2_5_1-ram:2.4.0")
}
}
}
}The JS and Wasm (JS) variants of these modules, and all other modules (KerML, SysML, Systems Modeling API, DD, MOF,
diagram, and uml-2_5_1-gui-compose), are not on Maven Central yet. To use them, build them to your local Maven
repository (see below), add mavenLocal() to repositories, and use the module name as the artifact and the version
in gradle/libs.versions.toml (project). The mof modules have version 2.5.1.
Building a small UML model with the generated builder:
val factory = UML_ModelFactoryRam("myModel")
val model = UML_ModelBuilder.Model(factory, "test") {
packagedElementSet {
Package("P1") {
name("P1")
packagedElementSet {
Class("C1") { name("C1") }
}
}
}
}
model.nestedPackageSet.single().ownedTypeSet.map { it.name } // [C1], derived from packagedElement
println(UML_ModelAsString.Model_asString(model))The Gradle project is in the net.akehurst.omg/ folder, so run Gradle from there. The Gradle wrapper (Gradle 9.5.0,
gradle/wrapper/gradle-wrapper.jar included) is checked in, so ./gradlew works in a fresh clone.
It depends on these other projects. When their versions in gradle/libs.versions.toml are -SNAPSHOT, build each one
with publishToMavenLocal first, in this order:
nak-kotlinx); this needs
net.akehurst.kotlin.gradle.plugin firstnal-agl); the generator in
0_build-logic uses agl-processor, so this must be in Maven local before omg is configurednak-compose), for
layout-graph, used by the diagram modulescd net.akehurst.omg
./gradlew assemble
./gradlew jvmTest # JVM tests (use jvmTest, not test)
./gradlew :uml-2_5_1-ram:generate # only regenerate the code of one module
./gradlew publishToMavenLocalThe generated code is written to .gradle-build/<module>/generated/sources/generator/commonMain/kotlin and is not
checked in. Compiling a generated module runs its generate task first.
The generated modules are large. If the Kotlin daemon runs out of memory, use --max-workers=1 and give Gradle more
heap in gradle.properties (org.gradle.jvmargs).
A generated module applies the code-generator plugin from 0_build-logic and configures its generate task:
plugins {
id("project-conventions")
id("code-generator")
}
tasks.named<generator.GenerateTask>("generate") {
modelName = "UML" // prefix of the generated top-level names, e.g. UML_ModelFactory
instanceRoots = listOf("Model") // metaclasses that get a root function in the builder and asString
sourceXmiPaths = listOf(layout.projectDirectory.file("../specs/UML_2-5-1_ASM_ptc-18-01-01.xmi"))
generateDir.set(layout.projectDirectory.dir("../../../_templates/api")) // api, ram or agl-types
parameters = mapOf(
"TARGET_PACKAGE" to "net.akehurst.omg.uml.v2_5_1",
"COPYRIGHT" to "...", // header of each generated file
"EXCLUDE_PACKAGE" to emptyList<String>() // metamodel packages to leave out
)
referencedTypeMapping = mapOf( // types referenced from outside the XMI, by href
"http://www.omg.org/spec/UML/20131001/PrimitiveTypes.xmi#String" to "String",
)
}Every *.agl-fmt file in generateDir is run. Several XMI files can be given; the SysML modules read the UML
primitive types, the patched KerML and the patched SysML XMI together.
REQ-x.y.specs/ocl-fixes.md (KerML, SysML): every change made in the patched XMI.specs/derived-unions.md (each metamodel): notes on the derived unions in the XMI and the properties that subset them.Apache License 2.0, see LICENSE.
Kotlin Multiplatform implementations of OMG metamodels (UML, KerML, SysML and others), for JVM, JS and Wasm (JS).
The Kotlin code for each metamodel is generated from the OMG's own XMI file of that metamodel. A Gradle task reads the XMI and runs a set of AGL format templates over it. The templates produce:
asString and the
derived properties and operations translated from the OCL in the XMI;| Metamodel | Folder | Modules | Source XMI |
|---|---|---|---|
| UML 2.5.1 | uml/v2_5_1 |
api, ram, agl-types, xmi (model reader), gui-compose, demo-diagrams | ptc-18-01-01 |
| KerML 1.0 | kerml/v1_0 |
api, ram, agl-types | ptc-25-04-04, patched |
| SysML 2.0 | sysml/v2_0 |
api, ram (includes KerML), agl-types | ptc-25-02-15, patched |
| Systems Modeling API 1.0 | sysmod-api/v1_0 |
api | ptc-25-02-29 |
| Diagram Definition 1.1 | dd/v1_1 |
api, ram, agl-types | DD 2013-10-01 |
| MOF 2.5.1 | mof |
api, ram (hand written, not generated) | ptc-14-08-10 |
Each metamodel folder has a specs folder with the XMI and specification PDF the code is generated from.
The KerML 1.0, SysML 2.0 and UML 2.5.1 XMI files are the OMG's official machine-readable files: on 15 November 2026 they were checked against the OMG machine-readable pages and are the latest releases (see spec-problems.md). They are not from the SysML v2 release repository (Systems-Modeling/SysML-v2-Release), which has no metamodel XMI. Where the other files (DD, MOF, Systems Modeling API, SysML 1.7 profile, the PDFs) were downloaded from is not recorded; their names follow OMG document numbers.
The KerML and SysML XMI from the OMG has errors in its OCL (and does not set aggregations), so the code is generated
from patched copies: kerml_patched.xmi and sysml_patched.xmi. Each change is listed in the specs/ocl-fixes.md
file next to it, and spec-problems.md summarises the problems found in
the KerML, SysML and UML specs and XMI. The UML XMI is used as published.
sysml/v1_7/specs holds only the SysML 1.7 profile XMI. It is used to test reading SysML 1.x models with the UML XMI
reader; there is no generated SysML 1.7 code.
| Module | Contents |
|---|---|
diagram/diagram-model |
A generic diagram model (nodes, compartments, ports, edges) that knows nothing about the modelling language, with its AGL types and a conversion to the layout-graph Compose view |
_simple-mof-for-xmi |
The generator: reads MOF XMI into a simple MOF model, translates OCL to Kotlin, runs the templates |
_templates |
The AGL format templates for api, ram and agl-types |
_testmodel |
A small test metamodel (specs/testmodel.xmi) generated with the real templates, with tests of the generated code |
These modules are not published: _simple-mof-for-xmi, _templates, _testmodel (testmodel-api, testmodel-ram).
uml-2_5_1-demo-diagrams is a demo. mof/mof-gen is not part of the build (its build file is named
build.gradle.kts_).
Release 2.4.0 of these four UML modules is on Maven Central, for the JVM only, with the group net.akehurst.omg:
uml-2_5_1-api, uml-2_5_1-ram, uml-2_5_1-xmi and uml-2_5_1-agl-types.
// build.gradle.kts
repositories {
mavenCentral()
}
kotlin {
sourceSets {
jvmMain {
dependencies {
implementation("net.akehurst.omg:uml-2_5_1-ram:2.4.0")
}
}
}
}The JS and Wasm (JS) variants of these modules, and all other modules (KerML, SysML, Systems Modeling API, DD, MOF,
diagram, and uml-2_5_1-gui-compose), are not on Maven Central yet. To use them, build them to your local Maven
repository (see below), add mavenLocal() to repositories, and use the module name as the artifact and the version
in gradle/libs.versions.toml (project). The mof modules have version 2.5.1.
Building a small UML model with the generated builder:
val factory = UML_ModelFactoryRam("myModel")
val model = UML_ModelBuilder.Model(factory, "test") {
packagedElementSet {
Package("P1") {
name("P1")
packagedElementSet {
Class("C1") { name("C1") }
}
}
}
}
model.nestedPackageSet.single().ownedTypeSet.map { it.name } // [C1], derived from packagedElement
println(UML_ModelAsString.Model_asString(model))The Gradle project is in the net.akehurst.omg/ folder, so run Gradle from there. The Gradle wrapper (Gradle 9.5.0,
gradle/wrapper/gradle-wrapper.jar included) is checked in, so ./gradlew works in a fresh clone.
It depends on these other projects. When their versions in gradle/libs.versions.toml are -SNAPSHOT, build each one
with publishToMavenLocal first, in this order:
nak-kotlinx); this needs
net.akehurst.kotlin.gradle.plugin firstnal-agl); the generator in
0_build-logic uses agl-processor, so this must be in Maven local before omg is configurednak-compose), for
layout-graph, used by the diagram modulescd net.akehurst.omg
./gradlew assemble
./gradlew jvmTest # JVM tests (use jvmTest, not test)
./gradlew :uml-2_5_1-ram:generate # only regenerate the code of one module
./gradlew publishToMavenLocalThe generated code is written to .gradle-build/<module>/generated/sources/generator/commonMain/kotlin and is not
checked in. Compiling a generated module runs its generate task first.
The generated modules are large. If the Kotlin daemon runs out of memory, use --max-workers=1 and give Gradle more
heap in gradle.properties (org.gradle.jvmargs).
A generated module applies the code-generator plugin from 0_build-logic and configures its generate task:
plugins {
id("project-conventions")
id("code-generator")
}
tasks.named<generator.GenerateTask>("generate") {
modelName = "UML" // prefix of the generated top-level names, e.g. UML_ModelFactory
instanceRoots = listOf("Model") // metaclasses that get a root function in the builder and asString
sourceXmiPaths = listOf(layout.projectDirectory.file("../specs/UML_2-5-1_ASM_ptc-18-01-01.xmi"))
generateDir.set(layout.projectDirectory.dir("../../../_templates/api")) // api, ram or agl-types
parameters = mapOf(
"TARGET_PACKAGE" to "net.akehurst.omg.uml.v2_5_1",
"COPYRIGHT" to "...", // header of each generated file
"EXCLUDE_PACKAGE" to emptyList<String>() // metamodel packages to leave out
)
referencedTypeMapping = mapOf( // types referenced from outside the XMI, by href
"http://www.omg.org/spec/UML/20131001/PrimitiveTypes.xmi#String" to "String",
)
}Every *.agl-fmt file in generateDir is run. Several XMI files can be given; the SysML modules read the UML
primitive types, the patched KerML and the patched SysML XMI together.
REQ-x.y.specs/ocl-fixes.md (KerML, SysML): every change made in the patched XMI.specs/derived-unions.md (each metamodel): notes on the derived unions in the XMI and the properties that subset them.Apache License 2.0, see LICENSE.