Graph Transformation by Rule Sequences

Transformation by rule sequences is a possibility in AGG to apply rules quasi deterministically.
A transformation rule sequence is a control structure which defines an ordered set of rule subsequences and rule iterations.

A dialog allows you to define rule subsequences in order to be applied. This dialog combines three tables and a textual view of the defined subsequences where each line shows one rule subsequence.

The first table contains the rules of the currently selected grammar.
The second table shows the rule subsequences. You can create a new empty subsequence using button New Subsequence. The subsequences are ordered by its position in the table. The order can be changed by pressing and dragging the middle mouse button.
The third table shows the rules of a subsequence. By selecting one or more rules in the first table and clicking on the button Add it can be put into the currently selected subsequence. The rule order of the third table can be changed by pressing and dragging the middle mouse button.

The Iterations field of the second and third tables can be used to set a number of how long a rule subsequence or a single rule should be applied. The star ( * ) is allowed, too, and means "as long as possible".

An example for a rule sequence:

newRoot
(newNode connect){4}
addLoop{*}

Here we can see three rule subsequences to be performed:
- the first subsequence with the rule  newRoot  should be applied only once,
- the second subsequence with the rules  newNode  and   connect  should be applied four times after each other,
- the third subsequence with the rule  addLoop  should be applied as long as possible.

Rule Sequences with Object Flow

Given a rule sequence we can define an Object Flow between its rule pairs.
For this aim the rule sequence we defined before in this dialog will be flattened in a plain sequence:
- each subsequence (resp. each rule) is repeated iterations times;
- the star (*) is converted by two times.

By clicking the button Object Flow a new dialog will appear which contains two lists with rules of the flattened sequence. Please note, that, by default, a host graph, which is the currently selected graph of a grammar, is involved in the object flow. It placed at the index 0 inside the lists of rules.

By selecting a rule | graph in the left list and a rule in the right list and clicking the button Connect we can define an object flow of this rule-rule (resp. graph-rule) pair. Please note, that the first rule is a predecessor of the second rule, so its index should be always smaller then the index of the second rule.

The objects of an object flow are nodes and edges of the RHS and LHS of two different rules. An object of the RHS of the first rule is an output object and an object of the LHS of the second rule is an input object of an object flow. The direction of an object flow is from output to input object, that is from the RHS of the first rule to the LHS of the second rule.

Using opened object flow editor we can now connect (map) an output object to an input object of selected rule-rule or graph-rule pair. Do click at a node left, then at a node right to set a mapping, or at an already mapped node left and at the background right to remove a mapping. Similar for the edges which source and target nodes are already mapped.

So defined object flow can be used for checking applicability criteria of rule sequence but also for graph transformation by rule sequences. Please use the RuleSequence pop-up menu to activate appropriate option.
A defined object flow is saved/loaded together with its rule sequence when you save/load the grammar.