Model Transformation Rules


Type graph for model transformation

We start with the description of the source and target type graphs (see Figure 1). On the left of Figure 1 is the meta model source type graph. In our case, a meta model consists of Classes, binary Associations where each association end holds its multiplicity constraints, and inheritance relations between Classes. An Association is connected to its ends by s and t-edges which correspond to  source  and  target  and just keep the reading information. An inheritance relation is represented by a parent edge from the child class to its parent class. In addition type Visited and edge type typeGraphParent are included. Type Visited is needed to keep information which classes and associations have already been processed, edge type typeGraphParent is needed to store the inheritance relations in the TypeGraph node of the target type graph.
On the right hand side of Figure 1 the target type graph is shown. It describes a graph representation of a graph transformation system. The root types are RuleSet and TypeGraph which corresponds to the structural configuration of graph transformation systems. A RuleSet contains a set of Rules which on their part have one left-hand side (LHS), one right-hand side (RHS), and can have negative application conditions (NAC). LHS, RHS, and NAC are graphs which are described by Nodes, possibly with Attributes, and Edges. The different parts of a rule are presented in an integrated way, i.e. a node occurring in LHS and RHS is presented only once but with two edges pointing to it. The TypeGraph contains a set of Nodes (possibly with Attributes), their inheritance relations (parent edge type), and Edges.



Fig. 1: Type graph of meta graph transformation system

The rules are layered, the first rules of layer 0-3 are needed to construct the TypeGraph of the target type graph. They create Node nodes in the target type graph for Class nodes in the source type graph, Edge nodes for  Association nodes and parent edges for parent edges.
Rules in layer 4 are creating the rules of the instance generating graph grammar.
To handle the application conditions of the rules, helper nodes with name Bound are used, that are processed by the rules in layer 5 and in layer 6.
The graph grammar has delete rules that remove the information of the source type graph in layers 7-9.