Vitruvius/Development/MIR
Language for Mappings, Invariants, and Responses (MIR)
This page is no longer up to date.
Prepare Development Environment
- Perform all steps necessary to prepare the Vitruvius development environment
- Execute the Xtext MWE 2 Workflow for the MIR language
- Generate the model code with the genmodel of the intermediate mapping language
- (You might have to refresh the files from the filesystem and clean up your Eclipse build several times and you should not close any of the plug-in projects named *.mir.*)
Run the MIR editor
To run the MIR editor a .mir file has to be opened in a new Eclipse instance that is started from the Eclipse in which all plug-ins where checked out as specified above (this can be obtained e.g. by creating a new run configuration with default settings).
An example .mir file can be found in the PCM-UML casestudy plug-in project.
Create a new .mir file
If you create a new .mir file in a new project, Eclipse will automatically ask you for the Xtext nature (if the .mir.ui plug-in project is correctly opened in the host Eclipse instance) but you have to perform a manual step: Currently, you have to add the plug-in "org.eclipse.xtext.xbase.lib" to the list of required bundles of the project that contains your .mir file.
Import metamodels in .mir file
When you import existing metamodels in the header of your MIR-file you have to add the bundles containing the model code for the metamodels to the list of required bundles of the project that contains your .mir file.
Language Documentation
The language documentation is currently under development.
Syntax
MIR File
A MIR File begins with a header containing generation, bundle, and metamodel information and lists one or several map blocks:
generates package vitruv.test1 generates type TestMIRExecutor bundle de.uka.ipd.sdq.pcm bundle org.eclipse.uml2.uml import package "http://sdq.ipd.uka.de/PalladioComponentModel/Repository/5.0" as repo import package "http://www.eclipse.org/uml2/2.1.0/UML" as uml map ...
map blocks
A map block specifies two metaclasses of two different metamodels and may contain a when-where block, a with block and nested map blocks:
map repo.repository.BasicComponent as bc and uml.Package as up { when-where { ... } with-block { ... } with map ... and ... { ... } ... }
when-where blocks
A when-where block specifies a) pre-conditions and b) post-conditions that are a) checked to determine whether a map-block has to be considered for two given instances of the specified metaclasses and b) enforced once the pre-conditions hold.
Pre-conditions (when) can currently only be specified as literal equality checks:
metaClassVarName.attributeName == LiteralExpr
Post-conditions (where) can currently only be specified as literal assignment expressions:
metaClassVarName.attributeName = LiteralExpr
with blocks
With blocks can be used to map attributes in a way such that the corresponding attribute value can be computed using a restricted set of conversion operators. They are currently under development.
nested map blocks
Map blocks that are nested within other map blocks using the keyword with
can be used to map a) attributes with identical values (no braces and no body) and b) references to instances of other metaclasses (braces and body as for map blocks that are not nested).
Semantics
TODO