In VMTL transformations, patterns are expressed as model fragments in the host modeling language. VMTL defines its own textual annotation language for such model fragments. VMTL annotations support pattern specification, model manipulation, and transformation execution control.
As a prerequisite for using VMTL, the host modeling language must support annotations that can be anchored to specific model elements. It must be possible to anchor an annotation to more than one model element, as well as leave it un-anchored.
VMTL annotations are declarative. They consist of one or more clauses connected by logic operators, where a clause is an assertion made about the annotated model elements or about its containing pattern/rule/transformation as a whole. Special variables are used for execution control, and user-defined dynamically-typed variables are used to pass values between clauses and between different patterns.
User-defined variables can be used in any VMTL pattern. They may appear wherever the host modeling language accepts a user-defined meta-attribute value, such as for representing the name of a model element. In addition, they can be manipulated via operators within VMTL annotations.
User-defined variables have global scope within a rule application: once declared, their value can be accessed in all patterns included in the applied rule. Their global scope makes variables suitable for identifying corresponding model elements located in different patterns.
VMTL defines a naming convention for user-defined variables: all variable names are prefixed by the
Apart from the Boolean, Integer, Real, and String types found in many general-purpose languages, VMTL defines the Element type used for variables holding host language model elements.
Regardless of their type, all VMTL variables accept the undefined value:
*. When a variable has this value, it is interpreted as representing any valid value of that data type.
|Boolean||Boolean logic value||
|Integer||Integer value. Implementation details (e.g. minimum and maximum values) depend on the execution engine.||
|Real||Floating point value. Implementation details (e.g. minimum and maximum values) depend on the execution engine.||
|String||Character string enclosed in double quotes. Implementation details (e.g. maximum length) depend on the execution engine.||
|Element||A model element||–|
VMTL defines operators that can be used on both VMTL variables and model element properties. The arithmetic, comparison, and logic operators are similar to those found in many general-purpose languages. The
. model navigation operator is used to access model element properties.
|Arithmetic||Arithmetic operators applicable to Integer and Real values||
|Comparison||Comparison operators applicable to any values||
| ||Logic|| Executes clause ||
|Model navigation||Navigates through attributes, association ends, and operations of a model element.||
VMTL defines special variables as a method of controlling transformation execution (the
steps variables) and accessing the contents of the source model (the
type variables). From a syntactic perspective, special variables are treated just like regular variables.
Each special variable has a scope, identifying the fragment of the transformation specification to which the value of the variable is applicable. For instance, every VMTL rule has its own priority, which is independent from the priority of other rules. Therefore, the scope of the
priority special variable is limited to one rule.
|String||Annotated element||Stores an optional user-defined pattern element identifier in order to facilitate the identification of corresponding elements across patterns.||Find, Produce, Update, Require, Forbid||
|Boolean||Rule|| If the value of this special variable is ||Find, Produce, Update, Require, Forbid||
| ||Integer||Rule||Determines the application priority of a rule. Only positive values are allowed, with lower values implying a higher execution priority. The default rule priority is ∞.||Find, Produce, Update, Require, Forbid||
| ||Element||Annotated element||Represents the annotated model element.||Find, Produce, Update, Require, Forbid||
| ||String||Annotated element||Provides access to the name of the annotated model element's metaclass. Assigning a new value to this special variable modifies the annotated model element's metaclass.||Find, Produce, Update, Require, Forbid||
| ||Integer||Annotated element|| States that the annotated model element, which must represent a relation, can be matched to a chain of relations of the same type (i.e. its transitive closure) in the source model. The length of the relations chain is determined by the value of the ||Find, Update, Require, Forbid||
Clauses are the building blocks of VMTL annotations. Each annotation contains one or more clauses connected by logic operators. Clauses are assertions made about the pattern model elements to which they are anchored, about their containing pattern/rule/transformation as a whole, or about special or regular variables.
Some clauses dictate modifications to the source model (
delete), while others act as constraints on valid matches (
optional). Variable assignment (
:=) is also treated as a clause.
either clause can only be included in annotations anchored to several pattern model elements. All other clauses can be included in annotations anchored to one or more pattern model elements. Anchoring a clause to several model elements promotes compactness of specification. Finally, the variable assignment clause (
:=) can also appear un-anchorerd to any pattern model elements.
|Assigns a value to a variable, special variable, or element attribute.||Find, Produce, Update, Forbid, Require||
| Creates the annotated pattern model element in the target model. |
If a model element not included in the
|Creates the annotated pattern model element in the target model only if it does not exist in the source model.||Produce, Update||
| Deletes the annotated pattern model element from the source model. |
If a model element included in the
|Exactly one of the annotated model elements must be matched in the source model.||Find, Forbid, Require||
|The annotated model element, which must represent a relation, can be matched to a chain of relations of the same type (i.e. its transitive closure) in the source model.||Find, Forbid, Require||
|The annotated model element must not be matched in the source model.||Find, Forbid, Require||
|The annotated model element may or may not be matched in the source model.||Find, Forbid, Require||
| || The annotated model element must be unique within its scope (e.g. package) in the matched model. |
When this annotation is included in an
|Find, Produce, Update, Forbid, Require||