Java Reference
In-Depth Information
11.3.2 Top Node Reference
A
Top Node Reference
represents elements that are created on the diagram
surface. This element contains a
Child
reference to a single
Node Mapping
.
Elements must be contained somewhere in the corresponding domain model
when they are instantiated as diagram elements. The
Containment Feature
property specifies where to add these new objects and, by default, where to
retrieve them.
A common pattern in modeling involves having a single containment refer-
ence for a generic type that is used to store model objects, while a derived attrib-
ute of a specific type is used to retrieve objects. As an example, consider the
mindmap domain model used in this topic, shown again in Figure 11-8 for
convenience.
Figure 11-8
Mindmap model
Here, an
elements
containment reference is used to hold all
MapElement
objects in the
Map
. To obtain a list of root
Topic
objects, a derived
rootTopics
reference is provided and implemented using OCL (refer back to Section 3.3.5,
“Adding OCL”).
In some models, you might find it necessary to specify both the
Containment Feature
and a
Children Feature
for a
Top Node
Search WWH ::
Custom Search