# Tutorials

GMTE: The Graph Transformation Engine (CNRS Licence DL 03998-02)

General Presention

The approach ACG (Abstract Graph Component) that we use is based on graphs and coordination rules to describe the dynamic evolution of architectures. It is also used to simulate the different instantiation component stages, behaviour change during implementation, migration, and other characteristics specific to the distributed systems software architecture.

We propose to model the architecture by an architecture graph (AG), and manage its evolution by the management architecture protocol (GAP). The nodes AG describe software components, and edges describe the dependence relationship between these components. The rules that guide the dynamic evolution are modelled as graphs called rule graphs

(RG) partitioned into four zones that determine the rule application and the changes that occur when a rule is applicable.

We distinguish: :

- The Inv zone: representing a fragment of the RG which must be identified (by homomorphism) in the GA, if several subgraphs are homomorphic to this area, a subgraph is chosen randomly;
- The Abs zone: representing a fragment of RG (containing the fragment Inv) which must do not exit (by homomorphism) in the AG for the rule is applicable;
- The Del zone: is under a fragment of the Inv zone that will be deleted on the application of the rule;
- The Add zone: is the fragment that will be added after the application of the rule.

The protocol management architecture PGA involves coordinating events occurring in the system to the rule of coordination RC (or combination of coordination rules) to be applied to transform architecture. The management architecture protocol involves coordinating events occurring in the system to the rule of coordination RC (or combination of coordination rules) to be applied to transform architecture.

Figure 1 shows a representation of a rule of coordination according to the approach ACG. The Inv zone contains the nodes that represent the components 1 and 3, Abs zone contains the component 4, Del zone contains the component 2, the Add zone contains the components 5 and 6. These components are connected by edges that represent communication links.

Figure 2 shows the application of the coordination rule R on a graph G1. The component 4 was deleted, and it has created two new components 6 and 7, which produced a new graph G2.

Figure: 2 Transformation example.

**Data Structures**

The nodes representing software components are labeled with a list of typed parameters. Two basic types have been taken into account: integers and strings. These parameters typed belong to one of two categories:

- Constant: with a fixed value, this is the case for nodes belonging to the graph of architecture that describe components totally instantiate.
- Variable: with a type variable, as is the case nodes belonging to the graph of the rule of coordination, these nodes do not correspond to actual components, but abstractions of components.

A graph (Figure 3) with N nodes is represented by a matrix (Figure 3), the line i of the matrix represents the node number i , and the case represents the edge label connecting node number i to node number j . In the example in figure 3,, we have a graph composed by four nodes connected by edges taht are labelled by integers, -1 for a non-existent edge between two nodes. For a textual representation we use the following format: {node list}#{edges matrix}

The graph of figure 3 is represented as the following: {{N1,1,1},{N2,1,1},{N3,1,1},{N4,1,1}}#{{-1,-1,5,-1},{9,-1,-1,7},{-1,-1,-1,3},{-1,-1,-1,-1}}

A rule (Figure 4) with N nodes is represented by a matrix. To introduce the concept of variable in the label nodes, we define a type (extendstring) that allows to declare a variable string. An object of this type has two attributes kind and value. The first defines the type of this parameter (constant or variable), and the second its value which is a string. The type extendint can declare a variable parameter on the same model as the type extendstring. An object of this type has two attributes kind (constant or variable) and value which is a integer. For a textual representation we use the following format:

Zone INV

node list

Zone DEL

node list

Zone ABS

node list

Zone ADD

node list edges matrix

The graph of figure 4 is represented as the following:

Zone INV constante N1 constante 1 constante 2 Zone DEL

Zone ABS

Zone ADD constante N1 constante 2 constante 3