Java Reference
In-Depth Information
As you will see shortly, within the context of a mapping or query, the con-
textual parameter is accessed using the
self
variable. The final predefined vari-
able, also discussed in detail soon, is the
result
variable, which accesses the
result parameter or tuple of a mapping or helper.
13.1.7 Null
Within the context of a transformation, the literal
null
complies to any type and
is used to mean the absence of value. It can be used as the return of an opera-
tion, either explicitly or implicitly. From OCL, the type OclAny also represents
an object of any type, while the type OclVoid represents an undefined value and
conforms to all types. The OclAny operation oclIsUndefined returns
true
when
its argument is undefined.
Often you can reuse query, mapping, and type definitions in transformations.
When this is the case, they are defined in
library
modules and imported as dis-
cussed earlier using
access
or
extends
statements in a transformation signa-
ture. Using
access
implies import semantics, whereas
extends
implies
inheritance semantics.
The main differences between a library and a transformation are that no
main
entry point is defined for execution in a library and that models listed in
its signature are those it operates on, not parameters. Following is a library def-
inition
UmlRdbUtil
that operates on UML model instances, extends the
UmlUtil
library, and accesses the
RdbUtil
library:
library
UmlRdbUtil(UML)
extends
UmlUtil
access
RdbUtil;
Note that QVT defines a standard library
StdLib
that is implicitly imported
in every transformation definition. This is similar in concept to the
java.
lang.*
package, which is imported automatically in every Java class.
OML
mapping
operations are the refinement of a relation and provide the fun-
damental behavior of transformations. Mappings take one or more source model
elements and return one or more target model elements. Following is the general
Search WWH ::
Custom Search