Java Reference
In-Depth Information
transformation
uml2rdb(
in
uml:UML,
out
rdb:RDB)
extends
BaseUml2Rdb
extends
library UmlUtil
access
library typeUtil;
At this time, M2M OML does not support access and extension of transfor-
mations and libraries. The M2M project does not yet have a Relations language
implementation, so it also does not yet support the
refines
keyword.
13.1.3 Intermediate Elements
OML supports the definition of
intermediate
classes and properties, which
can be helpful in some transformation definitions. Essentially, the definition of
an
intermediate
class and associated property allows for metamodel exten-
sion in the context of the transformation. The example used in the specification
follows; here, a
LeafAttribute
class is defined to help with mapping complex
type attributes to relational database columns. An
intermediate
property
allows for the storage of
LeafAttributes
in a
Sequence
, accessible as a fea-
ture of the
Class
element.
intermediate class
LeafAttribute {
name : String;
kind : String;
attr : Attribute;
};
intermediate property
Class::leafAttributes : Sequence(LeafAttribute);
Elsewhere in the transformation, the
leafAttributes
property can be
accessed in the same manner as any other feature of the metamodel. For example:
self.leafAttributes := self.attribute->
map
attr2LeafAttrs();
Unfortunately, intermediate classes are not yet implemented in Eclipse M2M
OML. Intermediate properties are supported and can be a Tuple type, providing
somewhat of a workaround for the lack of intermediate classes, as shown next.
Another workaround is to define an intermediate class in a separate
*.ecore
model and use it within the context of the transformation.
intermediate property
UML::Class::leafAttributes :
Sequence
(
Tuple
(name:
String
, kind:
String
,
attr
:Attribute));
Search WWH ::
Custom Search