Java Reference
In-Depth Information
6.5 M2M QVT Operational Mapping Language
OML is an Object Constraint Language (OCL)-based procedural language that
provides a low-level method for defining model-to-model transformations. OCL
provides the “Query” in QVT, and “low-level” refers to the difference between
OML and its high-level counterpart, the QVT Relations language. Much as with
a Java class file, an OML definition ( *.qvto file) has a list of imported models,
a main operation, a series of mappings and queries that resemble class methods,
and so on. Aside from the need to be familiar with the OCL and some extensions
added to produce side effects, OML should be fairly easy for most developers to
get started using. Those already familiar with OCL should find it much easier to
use. This section discusses the basic structure of an OML file and the language.
I've provided an implementation of the OML as a component of the M2M
project. Here we look at the features of this project before going through a
worked example.
6.5.1 QVT Project
QVT OML provides its own project wizard that installs the appropriate nature
and builder. The DSL Toolkit project wizard from Amalgam also installs the
QVT OML nature and builder. The QVT Operational Project wizard can be
invoked from the Eclipse New dialog (Ctrl+N) in the Model to Model Trans-
formation category. You can specify a source container for transformation loca-
tion within the project structure, with the default being /transforms .
Specifying a source container enables you to place transformation definitions in
any project folder without having to specify the folder in the namespace of the
definition itself, similar to a Java source folder concept.
The project wizard supports the creation of a library or transformation file
during project creation. Otherwise, you can use a QVT Operational Library and
QVT Operational Transformation wizard to add these elements to an existing
QVT project. Figure 6-3 shows the QVT project wizard dialog.
To resolve workspace domain models, a QVT project includes Metamodel
Mappings in its properties, as seen in Figure 6-4. Entries made here allow the
engine to map an NS URI to a physical .ecore model in the workspace. Note
that it's also possible to use an eclipse platform:/plugin/... or platform:/
resource/... URI directly in a modeltype declaration.
 
Search WWH ::




Custom Search