GTS Families for the flexible composition of graph transformation systems
1. GTS Families
for the flexible composition of graph
transformation systems
Steffen Zschaler and Francisco Durán
FASE 2017
27 April, 2017
2. Motivation
• GTSs are great for specification
– Both graphical and formal
• GTS morphisms are a key ingredient
– Enable many operations: refinement, parametrisation,
import/export interfaces, transformation reuse, GTS
composition, …
– Because structure/relationships are preserved, can guarantee
properties
• Ensure refinement semantics, ensure syntactic correctness of reuse,
ensure semantic correctness of composition, …
27/04/2017 2
4. Graph Transformation Systems (GTSs)
• Collection of transformation rules over graphs
• Typed over a common type graph TG
27/04/2017 3
L K R
l r
TG
type
type
type
7. GTS morphisms
• Relates two GTSs by
– Relating the type graphs
27/04/2017 4
L1 K1 R1
l1 r1
TG1
type1
type1
type1
L2 K2 R2
l2 r2
TG2
type2
type2
type2
fTG
8. GTS morphisms
• Relates two GTSs by
– Relating the type graphs
– Relating the set of rules
27/04/2017 4
L1 K1 R1
l1 r1
TG1
type1
type1
type1
L2 K2 R2
l2 r2
TG2
type2
type2
type2
fL fK fR
fTG
pb pb
9. Problem
• GTSs morphisms are too inflexible
– Require very close match between type-graph structures
– Require very close match between rule structures
• This limits usefulness
– Refinement limited to adding, no reorganisation allowed
– Reuse only for structurally highly aligned systems
27/04/2017 5
10. Example (1)
• Imagine the following abstract GTS
– A server processes elements and keeps track of what it has
produced
27/04/2017 6
TG0
Queue
Server
Element
elts
outin
OutputInput
made
Rules0
Process0
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue
o : Output
in
made
…
11. Example (2)
• Consider the following concrete GTS
– Describes production-line systems
– Machines in a production line produce parts from other parts
27/04/2017 7
Rules2
Process2
…
out
p : Polishert : Tray c : Conveyor
p : Part
in
out
p : Polishert : Tray c : Conveyor
p : Part
in
LHS
RHS
parts
parts
TG2
GenHead GenHandle
Tray
Conveyor
Hammer Handle
Head
Machine
Part
Container
Assemble
Generator
parts
out
in out
Polisher
12. Example (3)
• Can we add output tracking to the production-line
GTS?
– Parametrise as below, then compose GTSs
27/04/2017 8
TG1
Queue
Server
Element
elts
outin
OutputInput
Rules1
Process1
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue
o : Output
in
…
15. Example (4)
• Composition scheme:
• Have results for behaviour protection
– Require GTS morphisms for all arrows
GTS1
GTS0
GTS2
Francisco Durán, Antonio Moreno-Delgado, Fernando Orejas, and Steffen Zschaler: Amalgamation of Domain Specific
Languages with Behaviour. Journal of Logical and Algebraic Methods in Programming, 86(1): 208--235, Jan. 2017
GTScomposed
16. Example (4)
• Composition scheme:
• Have results for behaviour protection
– Require GTS morphisms for all arrows
GTS1
GTS0
GTS2
Francisco Durán, Antonio Moreno-Delgado, Fernando Orejas, and Steffen Zschaler: Amalgamation of Domain Specific
Languages with Behaviour. Journal of Logical and Algebraic Methods in Programming, 86(1): 208--235, Jan. 2017
GTScomposed
Production-line systems are, essentially, servers processing elements,
so we would expect to be able to establish morphisms.
Unfortunately, we cannot!
17. Example (5)
27/04/2017 10
TG2
GenHead GenHandle
Tray
Conveyor
Hammer Handle
Head
Machine
Part
Container
Assemble
Generator
parts
out
in out
Polisher
TG1
Queue
Server
Element
elts
outin
OutputInput
18. Example (5)
27/04/2017 10
TG2
GenHead GenHandle
Tray
Conveyor
Hammer Handle
Head
Machine
Part
Container
Assemble
Generator
parts
out
in out
Polisher
TG1
Queue
Server
Element
elts
outin
OutputInput
19. Example (5)
27/04/2017 10
TG2
GenHead GenHandle
Tray
Conveyor
Hammer Handle
Head
Machine
Part
Container
Assemble
Generator
parts
out
in out
Polisher
TG1
Queue
Server
Element
elts
outin
OutputInput
Cannot both go
to same type
20. Example (5)
27/04/2017 10
Rules1
Process1
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue
o : Output
in
…
Rules2
Process2
…
out
p : Polishert : Tray c : Conveyor
p : Part
in
out
p : Polishert : Tray c : Conveyor
p : Part
in
LHS
RHS
parts
parts
21. Example (5)
27/04/2017 10
Rules1
Process1
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue
o : Output
in
…
Rules2
Process2
…
out
p : Polishert : Tray c : Conveyor
p : Part
in
out
p : Polishert : Tray c : Conveyor
p : Part
in
LHS
RHS
parts
parts
22. Example (5)
27/04/2017 10
Rules1
Process1
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue
o : Output
in
…
Rules2
Process2
…
out
p : Polishert : Tray c : Conveyor
p : Part
in
out
p : Polishert : Tray c : Conveyor
p : Part
in
LHS
RHS
parts
partsGTS2 expects different types
of Queues in the rule
23. Solution Idea
• For static graphs, similar problems have dedicated
solutions:
– Clan morphisms
– Kleisli morphisms
Allow for transformations of the graph before establishing
morphism
• Can we generalise to GTSs?
– Allow for transformations of GTS before establishing morphism
– Want to be able to specify what transformations are acceptable
27/04/2017 11
28. Example extension-preserving transformers
Name Description
IntroSC Non-deterministically introduces sub-classes in the type graph
Does not change set of rules
InhUnfld Does not change type graph
Unfolds inheritance for one rule, one class, and its sub-classes
Copies all other rules
MvAssoc Attempts to move the target of a random association to a sub-class
Does not change the set of rules
27/04/2017 14
29. Example extension-preserving transformers
Name Description
IntroSC Non-deterministically introduces sub-classes in the type graph
Does not change set of rules
InhUnfld Does not change type graph
Unfolds inheritance for one rule, one class, and its sub-classes
Copies all other rules
MvAssoc Attempts to move the target of a random association to a sub-class
Does not change the set of rules
27/04/2017 14
Recently combined into MvAssocTrgt
30. Searching through the family
27/04/2017 15
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue
o : Output
in
QueueServer Element
elts
out
in
Output
Input
31. Searching through the family
27/04/2017 15
IntroSC(Queue, Queue1)
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue
o : Output
in
QueueServer Element
elts
out
in
Output
Input
32. Searching through the family
27/04/2017 15
IntroSC(Queue, Queue1)
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue
o : Output
in
QueueServer Element
elts
out
in
Queue1
Output
Input
33. Searching through the family
27/04/2017 15
IntroSC(Queue, Queue2)
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue
o : Output
in
QueueServer Element
elts
out
in
Queue1
Queue2 Output
Input
34. Searching through the family
27/04/2017 15
MvAssocTrgt(out, Queue, Queue2)
LHS
RHS
out
s : Serverq1 : Queue q2 : Queue2
i : Input
in
elts
elts
out
s : Serverq1 : Queue q2 : Queue2
o : Output
in
QueueServer Element
elts
out
in
Queue1
Queue2 Output
Input
35. Searching through the family
27/04/2017 15
MvAssocTrgt(in, Queue, Queue1)
LHS
RHS
out
s : Serverq1 : Queue1 q2 : Queue2
i : Input
in
elts
elts
out
s : Serverq1 : Queue1 q2 : Queue2
o : Output
in
QueueServer Element
elts
out
in
Queue1
Queue2 Output
Input
36. Process1
Process2
TG2
TG1
Resulting morphism
27/04/2017 16
GenHead GenHandle
Tray
Conveyor
Hammer Handle
Head
Machine
Part
Container
Assemble
Generator
parts
out
in out
Polisher
Server
elts
inout
Output
Input
Element
Queue2
Queue1
Queue
elts
out
p : Polishert : Tray c : Conveyor
p : Part
in
out
p : Polishert : Tray c : Conveyor
p : Part
in
LHS
RHS
parts
parts
LHS
RHS
out
s : Server1q1 : Queue1 q2 : Queue2
i : Input
in
elts
elts
out
s : Server1q1 : Queue1 q2 : Queue2
o : Output
in
37. Conclusions & Outlook
• GTS families are a new way of studying adaptation of
GTSs
– Paper lays out the formal details and provides proofs
• More research required:
– Other scenarios will need other transformer properties
• Behaviour preserving/reflecting, …
– Can TG-level techniques be fully subsumed?
– Other useful transformers?
27/04/2017 17