Java Reference
In-Depth Information
Updating the Mapping Definition
The main change we need to make to our mapping definition is to our
Relationship link. Our DSL includes a Type enumeration with three literals:
DEPENDENCY , INCLUDE , and EXTEND . We now have three separate tools for
these relationship types, so we need to create a mapping for each. Begin by mod-
ifying the existing relationship link mapping to be our dependency link, and then
copy/paste the element and adjust for the include and extend mappings. Table
4-6 shows what the dependency mapping looks like after our changes.
Table 4-6
Updated Mindmap Relationship Link Mapping
Element
Property
Value
Link Mapping
Containment Feature
Map.elements : MapElement
Element
Relationship
MapElement
Source Feature
Relationship.source : Topic
Target Feature
Relationship.target : Topic
Diagram Link
Connection Relationship
Tool
Creation Tool Dependency
Constraint
Body
self.type = Type::DEPENDENCY
Feature Seq Initializer
Element Class
Relationship
MapElement
Feature Value Spec
Feature
Relationship.type : Type
Value Expression
Body
Type::DEPENDENCY
Language
ocl
Feature Label Mapping
Diagram Label
Diagram Label RelationshipName
Features
MapElement.name : EString
Feature Label Mapping
Diagram Label
Diagram Label RelationshipType
Features
Relationship.type : Type
View Pattern
«{0}»
As you can see, the link mapping now has some additional child elements.
First, we add a Constraint to indicate using OCL that self.type =
Type::DEPENDENCY . This enables us to identify each of our Relationship
mappings so that the generator can create code to distinguish nodes based on
their type attribute. Also, we add a Feature Seq Initializer child element
Search WWH ::




Custom Search