Java Reference
In-Depth Information
The previous signature states that the
uml2rdb
transformation will take as
an input a uml model instance of type UML and return an rdb model instance of
type RDB. From the
modeltype
statements, we know that these map to models
found in our environment by name or URI. Parameters have a direction (
in
,
out
,
or
inout
), an identifier, and a type. Parameters that are designated as
in
param-
eters are not changed, those designated as
inout
are updated (these are some-
times referred to as
in-place
transformations), and those designated as
out
are
assigned the newly created result. Note that it's possible to have abstract trans-
formations, where the
main()
mapping is disallowed.
13.1.1 In-Place Transformations
It is possible to invoke a transformation for the purpose of modifying an exist-
ing model. Potential uses for this capability are model cleansing, refactoring, or
refinement. Section 6.2, “Model Refactoring,” provides an example of an
in-place transformation. Part of this example is provided again here:
transformation
requirements2requirements(
inout
model : requirements);
property
groupCounter :
Integer
=
null
;
property
reqCounter : Integer = null;
mapping main
(
inout
req : requirements::Model@model) {
-- ...
}
mapping inout
requirements::RequirementGroup::resetValues() {
-- ...
}
The key to using QVT for in-place transformations is to use
inout
declara-
tions in the transformation signature, main mapping, and mapping definitions
that modify the model.
13.1.2 Extends and Access
A transformation can extend another transformation or library. For example,
suppose that we have a
BaseUml2Rdb
transformation and
UmlUtil
library that
we want to extend. Furthermore, we want to access a
typeUtil
library. To indi-
cate this, we simply add the following
extends
and
access
keywords with
transformation names to the end of our signature. In the case of extension, map-
ping definitions can override those in the extended transformation.
Search WWH ::
Custom Search