Table of Contents

Mapping model

Here is presented the mapping model and its constituents.

The mapping model defines the relationships among the elements of the three previous models.

It is in this model, for example, that may be defined that the domain element Login has as graphical representation the Login graphical element and has as creation tool the Login tool. It also allows the initialization attributes and definition of rules.

The image below shows the mapping model.

Element mapping

Choose a domain element in Element, a graphical representation in Visual Representation/Diagram Node and the creation tool in Visual Representation/Tool. the image below shows an example.

Mapping of a element's label

Insert a Feature Label Mapping in the Node Mapping belonging to the Element one wants to create the label for. In the properties choose the attribute to show as label in Domain meta information/Features to display. Next, choose the graphical representation of the label (which must be previously created in the graphical model) in Misc/Diagram Label.

The image below shows an example.

Connector's Mapping

Connector mapping is very similar to element mapping.

Besides that, one must define the attribute to use as source in Source Feature and the attribute to use as destination in Target Feature.

The image below shows an example.

Initialization of a connector's label

The connectors' labels must reflect its type so they must not be editable and should be initialized automatically.

This automatic initialization is achieved through the insertion of an element named Feature Seq Initializer in Link Mapping. Next, insert an element Feature Value Spec and choose the element to initialize. Finally, insert an element Value Expression and choose the value to give in the initialization, in this case the String with the connector's type.

The image below shows an example.

Rule definition

It is also in the mapping model one may create integrity rules for the model.

For that purpose, create an Audit Container and inside it create the rules using one Audit Rule element for each rule.

The image below shows an example of the properties to fill for a rule.

Inside an Audit Rule must be created two elements: the rule (Constraint) and a reference to the domain element to apply the rule to.

Rules

Here are presented all the rules created.

InitNotDestination

This rule ensures that the Init node is not a destination of a connector.

Domain element: Connector.

The rule's code is implemented in OCL, as presented:

not self.destination.oclIsTypeOf(Init)

For any connector its destination cannot be of type Init.

EndNotSource

This rule ensures that the End node is not a source of a connector.

Domain element: Connector.

The rule's code is implemented in OCL, as presented:

not self.source.oclIsTypeOf(End)

For any connector its source cannot be of type End.

OneEndPerContainer

This rule ensures that there's only one End node in a model.

Domain element: Model

not (self.nodes->select(oclIsTypeOf(End))->size() > 1)

The number of nodes of type End cannot be greater than 1.

OneInitPerContainer

This rule ensures that there's only one Init node in a model.

Domain element: Model

not (self.nodes->select(oclIsTypeOf(Init))->size() > 1)

The number of nodes of type Init cannot be greater than 1.

EmptyName

This rule ensures that there's no node without a name.

Domain attribute: Element.name

self.size()>0

The size of the attribute must be greater than 0.

EmptyNumber

This rule ensures that there's no node without a number.

Domain attribute: Element.number

self.size()>0

The size of the attribute must be greater than 0.

EmptyTitle

This rule ensures that there's no node without a title.

Domain attribute: Model.title

self.size()>0

The size of the attribute must be greater than 0.

NameUnique

This rule ensures that there's no two nodes with the same name.

Domain element: Model

self.nodes->forAll(c1, c2 | c1<>c2 implies c1.name<>c2.name)

For all elements, if c1 and c2 are different than their names are different.

NumberUnique

This rule ensures that there's no two nodes with the same number.

Domain element: Model

self.nodes->forAll(c1, c2 | c1<>c2 implies c1.number<>c2.number)

For all elements, if c1 and c2 are different than their numbers are different.

InitToEnd

This rule ensures that there's no connector connecting Init to End.

Domain element: Connector

self.source.oclIsTypeOf(Init) implies not self.destination.oclIsTypeOf(End)

If the source of a connector is of type Init than its destination must not be a node of type End.

ConnectElementToItself

This rule ensures that there's no connector connecting one element to itself.

Domain element: Connector

self.source <> self.destination

The source and the destination of a connector must be different.

SameTypeSameSourceSameDestination

This rule ensures that there aren't two connectors of the same type connecting the same elements.

Domain element: Model

self.relations->forAll(c1, c2 |
 c1<>c2 and c1.source = c2.source implies c1.destination <> c2.destination)

For all connectors, if c1 and c2 are different and have the same source than their destinations must be different.

NoGroupOverlap

This rule ensures that there's no element that belongs to two groups.

Domain element: Group

Group.allInstances()->forAll(g1,g2|
 g1<>g2 implies
 (g1.nodes->intersection(g2.nodes) = g1.nodes) or
 (g1.nodes->intersection(g2.nodes) = g2.nodes) or
 ((g1.nodes->intersection(g2.nodes))->size()=0))

For all instances of Group, if two instances are different than their intersection's result is one of them or an empty group.

Group>1Elems

Regra para evitar Group com menos que dois elementos. This rule ensures that a Group never has less than two elements.

Domain element: Group

self.nodes->size() > 1

The number of nodes inside a group is greater than one.

<< Tools model


GMF models