Transformation rule start
The rule start shown in Fig.
2 creates the node RuleSet as
basic node for all Rule nodes. Note, that the rule could be applied
only once because of the cardinality "0..1" of the node RuleSet in the type graph shown in
Fig. 1. In addition the node TypeGraph
for the instance type graph with the helper node Bound containing two attributes (assoc: String, bound: boolean) is created.
Fig. 2: Transformation rule start
Helper rule createTypegraphEdge
This rule is adding a typeGraphParent
edge between Class nodes
that are
connected by a parent edge.
This edge is needed to store the original
inheritance relation in the type graph by the rule createParentEdge in Fig.11
later.
Fig. 3: Helper rule createTypegraphEdge
Transformation rule addInheritanceRelation
The rule shown in Fig. 4 is needed to build the transitive closure
of the inheritance relation between Class
nodes, a Class node also gets
a parent edge to its
grandparents and so on.
Fig. 4: Transformation rule addInheritanceRelation
Transformation rule createNodeTypeWithoutBound
The rule shown in Fig. 5 adds a Node
to the TypeGraph node of the
target type graph for a Class
node that is not connected to a source association end with
multiplicity 1..1 (what is ensured by the shown NAC) and not visited at
all
(what is ensured by the cardinality constraint of the ref edge
type in
the source type graph). This rule has three other NACs not shown in
Fig. 5, one ensuring that the Class
node is not connected to a target association end with multiplicity
1..1, and two corresponding NACs ensuring that the Class node is not inheriting from
another Class node that is
connected to an association end with multiplicity 1..1.
Fig. 5: Transformation rule createNodeTypeWithoutBound
Transformation rule createNodeTypeWithBound
The rule shown in Fig. 6 adds a Node
to the TypeGraph node of the
target type graph for a Class
node
that is connected to a source association end with multiplicity
1..1 and is not visited at all (what is ensured
by the cardinality constraint of the ref edge type in the source type
graph). For this Node an Edge to a helper Bound-Node is
created, which is needed to handle the application conditions for the
rules creating new Nodes later
(Bound
nodes are used to ensure that a class will be connected exactly once
with an
association in the instance graphs).
Fig. 6: Transformation rule createNodeTypeWithBound
Transformation rule createNodeTypeWithBound_abstract
The rule shown in Fig. 7 adds a Node
to the TypeGraph Node of the
target type graph for a Class
node that inherits from a Class
node
that is connected to a source association end with multiplicity
1..1 and is not visited at all (what is ensured
by the cardinality constraint of the ref
edge type in the source type
graph). For this Node an Edge to a helper Bound-Node is
created, which
is needed to handle the application conditions for the rules creating
new Nodes later.
Fig. 7: Transformation rule createNodeTypeWithBound_abstract
Transformation rule createNodeTypeWithBound2
The rule shown in Fig. 8 adds a Node
to the TypeGraph node of the
target type graph for a Class
node
that is connected to a target association end with multiplicity
1..1 and is not visited at all, this rule is similar to rule createNodeTypeWithBound described
above.
Fig. 8: Transformation rule createNodeTypeWithBound2
Transformation rule createNodeTypeWithBound2_abstract
The rule shown in Fig. 9 adds a Node
to the TypeGraph Node of the
target type graph for a Class
node that inherits from a Class
node
that is connected to a target association end with multiplicity
1..1 and is not visited at all, this rule is similar to rule createNodeTypeWithBound described
above.
Fig. 9: Transformation rule createNodeTypeWithBound2_abstract
Transformation rule createEdgeType
This rule adds an Edge node
(with the corresponding name
attribute) between two Nodes
in the TypeGraph node of the
target type
graph for an unvisited Association between the corresponding Class
nodes in the source type graph.
Fig. 10: Transformation rule createEdgeType
Transformation rule createParentEdge
The rule is adding a parent edge between two Nodes in the TypeGraph those corresponding Class nodes in the source type
graph are connected by a typeGraphParent
edge.
Fig. 11: Transformation rule createParentEdge
After the application of the rules in layer 2 the TypeGraph node of the target type
graph contains a Node node
for each Class node, an Edge node for each Association node and a parent edge for each parent edge of the source type
graph. The following two rules delete the helper nodes of type Visited for each Class (Fig. 12) and Association (Fig. 13) node.
Deletion rule deleteClassVisited
Fig. 12: Deletion rule deleteClassVisited
Deletion rule deleteAssocVisited
Fig. 13: Deletion rule deleteAssocVisited