Java Reference
In-Depth Information
one transformation, in which case the transformation declaration is terminated
by a semicolon. At the time of this writing, QVT Operational (QVTO) currently
supports only one transformation per file, so the previous syntax would result in
a compiler error. Instead, declare transformations as follows:
transformation
uml2rdb(
in
uml:UML,
out
rdb:RDB);
Each model parameter is associated with an MOF extent. The transforma-
tion itself can be considered a class that is instantiated, causing the initialization
of the parameter extents. Output parameters are initialized to empty model
extents. All are accessible using the
this
variable, which refers to the transfor-
mation instance itself. When instantiating objects, the model extent can be
declared to remove ambiguity when multiple models of the same type are in use.
This is done using the
@
sign followed by the name, as shown here:
transformation
mindmap2requirements(
in
inModel : mindmap,
out
oneModel : requirements,
out
outModel2 : requirements);
main
() {
object
Model@oneModel {
}
}
The
modeltype
declaration assigns an alias to a metamodel used in the con-
text of the transformation. The
uses
part of the declaration specifies the model
name and registered URI that the environment uses to resolve the MOF meta-
model definition. In the case of Eclipse QVT OML, MOF is equivalent to EMF's
Ecore metamodel. Therefore, URIs used here are those found in the NS URI field
of packages registered in EMF. To see a list of the models registered in the envi-
ronment, use the
Metamodel Explorer
view provided by the M2M OML com-
ponent. It's also possible to specify modeltypes using Eclipse
platform:/
plugin
and
platform:/resource
Uniform Resource Identifiers (URIs).
Note that it's not necessary to place the URI within parentheses following the
model name. The following is equivalent to our Unified Modeling Language
(UML) modeltype declaration earlier:
modeltype
UML
uses
'http://www.eclipse.org/examples/1.0.0/simpleuml';
You also can simply state the model name, which, in the case of M2M OML,
corresponds to the EMF registered package. This allows some flexibility because
several versions of a model could be registered in the environment, but it also can
Search WWH ::
Custom Search