Information Technology Reference
In-Depth Information
The oAW expression language.
The oAW expression
language is a syntactical mixture of Java and OCL.
For instance, to access a model element property, the
following syntax is used:
myModelElement.property
.
Respectively, a boolean expression looks like this:
!("textExample".startsWith('t') && ! false)
. The
expression language provides several literals for built-in
types, for example, the boolean literals are
true
and
false
.
Like OCL, the expression language also defines several
special operations on collections such as
select
,
collect
,
reject
,
forAll
and
exist
between others. For instance,
the
forAll
operation allows specifying a boolean expression,
which must be
true
for all objects in a collection in order for
the
forAll
operation to return
true
:
collection.forAll
(v | boolean-expression-with-v)
. The expression
language includes conditional expressions (if and switch
expressions), expressions to instantiate new objects (create
expressions) and expressions to define local variables
(let expressions) among others.
3.6.4.
The Xtend language
The Xtend language is a textual and functional
transformation language. As said before, Xtend is built
on the common type system and expression language of oAW.
Listing 3.10 presents an example of an Xtend file including
transformation rules to transform models that conform
to the class metamodel from Figure 3.2 into models that
conform to a metamodel of relational database schemas for a
relational database management system. The metamodel of
the relational database schema has two metaconcepts,
Table
and
Column
.A
Table
contains
columns
and both
Table
and
Column
have a
name
property.
In line 1 and line 2 of Listing 3.10,
import
statements are
usedtoimportthenamespacesofseveraltypes;inthiscase,the
types corresponding to metaconcepts of the
classMetamodel
Search WWH ::
Custom Search