Java Reference
In-Depth Information
The models used in the transformation are installed as part of the QVTO
examples feature. To see the structure of the models, you can use the Metamodel
Explorer (
Window
Metamodel
Explorer
), or you can obtain the Ecore models themselves from the Eclipse CVS
repository and render a diagram. Alternatively, placing the cursor on the
modeltype
declaration at the top of the
Simpleuml_to_Rdb.qvto
file and
pressing
F3
opens the Metamodel Explorer and selects the model in the tree.
The M2M QVTO example Simple UML model is slightly more complicated
than the one in the specification, but it remains simpler than the actual UML
metamodel.
The
rdb.ecore
model provided in the sample is much more complex than
the model used in the specification. The example model includes additional
datatypes, views, and constraints subpackages.
The sample project also includes an instance of the Simple UML model to
allow for invocation of the script. To run, expand the
Run
button on the main
toolbar and select the
SimpleUML to RDB
launch configuration. A
Simpleuml_
to_Rdb.rdb
model appears in the root of the sample project. You can open this
and the source
pim.simpleuml
model to compare input and output results in
the context of the discussion to follow.
The mapping between these two models is straightforward. Although the
OML has no graphical notation, the notation used to describe the Relational
implementation can be helpful in understanding the mapping. In fact, you could
use GMF to implement a similar notation and diagram for QVTO. This exercise
is left to you, with the suggestion that you consider contributing the solution to
the M2M project.
Let's begin with the transformation declaration. Both the Simple UML and
RDBMS models are declared using
modeltype
statements at the top of the file,
along with the
transformation
declaration itself. Note that there is no
strict
qualifier in the modeltype statements, leaving you free to modify the model and
reuse this script—that is, as long as you don't change it so that it breaks the
script. Also, no
where
clauses restrict our input model from being passed to the
transformation.
→
Show View
→
Other
→
Operational QVT
→
modeltype UML uses
'http://www.eclipse.org/qvt/1.0.0/Operational/examples/simpleuml';
modeltype
RDB
uses
'http://www.eclipse.org/qvt/1.0.0/Operational/examples/rdb';
transformation
Simpleuml_To_Rdb(
in
uml : UML,
out
RDB);
Notice that the sample uses a shorter notation for the
uses
clause, compared
to the version in the specification, opting to not surround the URI with the model
Search WWH ::
Custom Search