Developing Metamodels
Metamodels can be used to design new elements which extend the existing set of elements to provide more flexibility in modelling your application. They can even be used to create an entire new set of elements separate from the already existing metamodel.
Metamodel are a natural next step when options no longer provide enough flexibility or become too complex.
- Metamodels can extend exising metamodels to add a new concern by implementing Model extensions.
- Metamodels can also be standalone. In this case they will need a Program
- Once a metamodel starts to take shape, it can be useful to support reuse with Modules.
Getting started
The best way to get started creating a new Metamodel is to use the initializer or create a new metamodel project in the µRadiant.
- nsinit
- µRadiant
nsinit -o my-metamodel/metamodel
Then answer the prompts to set the properties of the project.
Go to Models > select New Metamodel Project
The generated project contains a metamodel
directory with the root of the metamodel and a ontologies
directory, which contains the ElementClasses and References.
Building the project
The scripts in the scripts directory to prepare, expand and build the metamodel project.
scripts/expand.nss
expand the metamodelscripts/build.nss
builds the expanded project
After following these steps, the build will have installed a {groupId}:{artifactId}-core
artifact.
This artifact can be included as a dependency in an expanders project to use the metamodel in its Expanders.
Extending the µRadiant
To extend the µRadiant with a custom metamodel. You will first need to clone the repository:
https://github.com/normalizedsystems/micro-radiant
In this project, modify the following files:
- In
config/conf/expansionSettings.xml
, add the*-metamodel
expansionResource from your metamodel - In
config/editor/editorConfig.xml
, add a component reference with the name of your ontology
Then, you can use the expand-editor.nss
script to expand the µRadiant ui with your metamodel included.
Run the µRadiant according to the instructions in the README.md file or package it and use one of the installers or the zip file.