LionWeb-MPS converts Languages and instance models between several different representations. We provide concepts to easily configure and execute all available converters.
To use the converters, add the language io.lionweb.mps.converter.lang
to your model.
Create the desired converter as root node.
Execute the conversion through an intention on the converter.
Check the Messages Pane for results.
Technical name: ExportMpsLanguageToJson
/ Language2JsonConverter
Converts a list of MPS Languages to LionCore JSON. We use MPS' Runtime Language representation.
Requires a file path to write the JSON file to. We can use path variables.
Caution
|
Existing files will be overwritten without notice! |
MPS Language A
depends on all languages that are listed in A.structure
's Model Properties Dependencies.
We can choose the scope of conversion:
listed |
Only convert the listed languages. Fails if any of the converted languages depends on a non-listed language. |
indirect |
Convert all listed languages, and (transitive) dependencies. |
fineGrainedClosure |
Converts all listed languages completely. If any element in the listed languages uses an element from a non-listed language, we include the element of the non-listed language — but not any other elements of that non-listed language. We apply this strategy (known as tree shaking) transitively until we included all used elements. |
We can set some flags for special annotation handling:
export description annotations |
Whether concept descriptions should be exported as instances of |
export special annotations |
Whether special concept annotations should be exported:
|
Technical name: ExportInstanceToJson
/ AMps2LionWebConverter
Converts a list of MPS nodes to LionWeb JSON.
Requires a file path to write the JSON file to. We can use path variables.
Caution
|
Existing files will be overwritten without notice! |
We can choose the scope of conversion:
listed |
Only converts the listed nodes. |
descendants |
Converts the listed nodes, and all descendants of each listed node. |
closure |
Converts the listed nodes, all descendants, and all referenced nodes. We apply this strategy until we include all Annotation, Containment, and Reference targets. |
The following table lists for each scope whether we include the target node / target node’s id into the conversion. Example: For descendants scope, we include both the target node and the target id of annotations and children; we do not include the target node of references, but we do include the target id of references.
Scope | Annotations + Children | References | Parents |
---|---|---|---|
listed |
no / yes |
no / yes |
no / yes |
descendants |
yes / yes |
no / yes |
no / yes |
closure |
yes / yes |
yes / yes |
no / yes |
Technical name: ImportInstanceFromJson
/ MergingLionWeb2MpsConverter
Converts a LionWeb JSON file into MPS nodes, stored into the current model. If the current model already contains a node with the same id as an imported node, we merge them.
Requires a file path of the JSON file to read. We can use path variables.
Technical name: ExportLanguageToJson
/ LionCore2JsonConverter
Converts a list of io.lionweb.mps.m3
instances to LionCore JSON.
Requires a file path to write the JSON file to. We can use path variables.
Caution
|
Existing files will be overwritten without notice! |
Technical name: ImportLanguageFromJson
/ Json2LionCoreConverter
Converts a LionCore JSON file to io.lionweb.mps.m3
instances, stored into the current model.
Requires a file path of the JSON file to read. We can use path variables.
Technical name: ConvertLanguageToLionCore
/ Language2LionCoreConverter
/ Mps2LionCoreConverter
Converts a list of MPS Languages to io.lionweb.mps.m3
instances.
We can convert either the Language Nodes (i.e. the structure aspect of the MPS Language) or the Runtime Language (i.e. SLanguage). In doubt, use Language Nodes.