Survey of Graph Rewriting applied to Model Transformations
Francisco de la Parra and Thomas Dean
School of Computing, Queen’s University, Kingston, Ontario, Canada
Keywords:
Graph Grammars, Graph Rewriting, Model Transformations, Domain Analysis, Model-Driven Engineering.
Abstract:
Model-based software development has become a mainstream approach for efficiently producing designs, test
suites and program code. In this context, model-to-model transformations have become first-class entities and
their classification, formalization and implementation are the subject of ongoing research. This work surveys
the characteristics and properties of graph rewriting systems and their application to formalize and implement
transformations of language-based software models. A model’s structure or behaviour can be abstracted into
the definition of a given graph type. Its structural and behavioural changes can be represented by rule-based
transformation of graphs.
1 INTRODUCTION
Model Driven Engineering (MDE) has become a
sound and efficient alternative for the design and de-
velopment of complex software of the kind found in
industrial and networked applications. Efficient ap-
plication of MDE can produce powerful and reusable
designs, as well as readily verifiable program code
(Neema and Karsai, 2006).
In MDE, model-to-model transformations are
first-class entities and their classification, formaliza-
tion and research has focused on: 1) analyzing their
intrinsic properties; 2) defining formal syntactic and
semantic aspects of their realization; and 3) devel-
oping approaches for their implementation (B
´
ezivin,
2004; Czarnecki and Helsen, 2006; Mens and Gorp,
2006).
Many modeling languages utilize graphs in the
core of their representation. A model’s structure can
be abstracted as a given graph type. Its structural
and behavioural changes can be represented by rule-
based transformations of graphs (Boyd and McBrien,
2005; Karsai, 2010). This work surveys the char-
acteristics of graph rewriting systems, known as: 1)
graph grammars if the emphasis is on studying the
types of graphs they generate (i.e., graph languages),
2) graph transformation systems if the primary inter-
est is in describing the graph rewriting mechanisms
they use; and their application to formalize, specify
and implement transformations on models. The pre-
sentation focuses on providing a concise and system-
oriented view of the more versatile graph rewriting
techniques which could aid MDE researchers in de-
vising rule-based model transformations.
1.1 Background
Graph grammars and graph transformations have
been used in software engineering as formalisms for
representing design and computational aspects of sys-
tems at a very high level of abstraction.
Application Domains and Modeling. Application
domain analysis (Prieto-D
´
ıaz, 1990) provides precise
descriptions and formalizations of the objects and ac-
tivities in a given structured environment. Graphs and
graph transformations are a capable meta-language
to abstract from real systems or other models (Kent,
2002; K
¨
uhne, 2006). In the language-oriented con-
text of MDE, they represent a promisory alternative
to provide more precise syntactic and semantic defi-
nitions of diagrammatic modeling languages.
Graph Grammars. From its intial introduction in
the late 1960’s, graph grammar theory has developed
into a number of approaches: algebraic techniques,
set theoretic approaches, node-label controlled (NLC)
approaches, etc. (Ehrig et al., 1991; Nagl, 1987;
Rozenberg, 1997; Sch
¨
urr, 1995). From a software en-
gineering perspective, the initial focus on graph gram-
mars has shifted from understanding the properties
of the graph languages they generate to an interest
in describing and exploiting the graph transformation
mechanisms they use, how they integrate into graph
431
de la Parra F. and Dean T..
Survey of Graph Rewriting applied to Model Transformations.
DOI: 10.5220/0004731504310441
In Proceedings of the 2nd International Conference on Model-Driven Engineering and Software Development (MODELSWARD-2014), pages 431-441
ISBN: 978-989-758-007-9
Copyright
c
2014 SCITEPRESS (Science and Technology Publications, Lda.)
rewriting systems, and how they can be applied as
high level specifications in modeling systems and pro-
cesses.
Graph Rewriting Tools. Graph
Ed
(Himsolt, 1991)
and Algebraic Graph Grammar (AGG) system
(Taentzer, 2004) represent early efforts to prototype
graph grammars in a standalone fashion. PROGRES
was one of the first integrated environments for in-
teractively prototyping graph grammars and transfor-
mations with the goal of producing software artifacts
(Nagl and Sch
¨
urr, 1991; Sch
¨
urr et al., 1995). The en-
vironment consisted of: 1) a visual/operational speci-
fication language for graphs and graph rewriting rules,
2) a set of tools for editing, analyzing and execut-
ing specifications, and 3) a methodology to use of
the language and tools, denominated graph grammar
engineering. PROGRES can be considered a pre-
cursor for a number of more specialized prototyp-
ing tools dealing with models and model transfor-
mations: AToM
3
(de Lara et al., 2004b), the Graph
Rewriting and Transformation (GReAT) system (Bal-
asubramanian et al., 2006; Karsai et al., 2003), FU-
JABA (Nickel et al., 2000), MOFLON (Weisem
¨
oller
et al., 2011), VIATRA2 (Balogh and Varr
´
o, 2006),
and MATE (Legros et al., 2011).
2 GRAPH GRAMMAR
APPROACHES
2.1 General Concepts
The following is an abbreviated description of key
components.
2.1.1 Graphs and Hypergraphs
A simple labeled directed graph G over a pair of
label alphabets (Σ
V
, Σ
E
) (where Σ
V
= {vl
1
, ..., vl
p
}:
node label alphabet, and Σ
E
= {el
1
, ..., el
q
}: edge la-
bel alphabet) consists of a sextuple (V, E, s
V
, t
V
, l
V
, l
E
)
where V = {v
1
, ..., v
n
} (set of nodes; or vertices),
E = {e
1
, ..., e
m
} (set of directed edges), s
V
: E V
assigns an edge’s source node, t
V
: E V assigns an
edge’s target node, l
V
: V Σ
V
assigns node labels,
l
E
: E Σ
E
assigns edge labels (fig. 1-(a)).
From the previous definition of a simple labeled
graph, one can derive the more specific classes of
graphs: 1) undirected graphs, if for all edges the
source and target are not identified; 2) multigraphs
multiple edges can be defined between a pair of
source and target nodes; 3) unlabeled graph, if the la-
bel alphabets Σ
V
, Σ
E
are empty sets; 4) typed graph,
Figure 1: Graphs and Hypergraphs.
if the sets of node and edge labels are partitioned into
classes called types; 5) attributed graph, if nodes are
assigned attributes of a given data type; and 6) Star
graphs consisting of nonterminal and terminal nodes,
where the node labeled as nonterminal is at the center
of a star configuration (fig. 1-(b)).
Hypergraphs represent an extension of the struc-
tural concept of a graph to contain hyperedges, in-
stead of edges, connecting to multiple source and tar-
get nodes (fig. 1-(c)) (Habel, 1992).
Triples of Graphs extend the idea of a single graph
as the unit of analysis to a triple (LG, CG, RG) con-
sisting of three graphs: LG (left graph), RG (right
graph), and CG (connection graph), of the same class,
where graph CG represents associations between the
elements of graphs LG and RG. Triple graph gram-
mars are the structures associated with generating and
parsing these graph triples (Sch
¨
urr, 1995).
Hierarchical Graphs constitute a most general
structure with higher-order nodes that are abstrac-
tions of graphs and higher-order edges that repre-
sent relations between graphs which are represented
as graphs again. With these structures, it is possible
to abstract an entire sub-graph to a node or to a single
edge between two abstracted nodes (Dean and Cordy,
1995).
2.1.2 Graph Rewriting Productions
The following is a general definition of a production
that is applicable to most graph transformation (i.e.,
graph grammar) approaches found in the literature
(Andries et al., 1999).
A graph rewriting production is a sextuple p =
(LG, K, RG, ac, gl, em)
1
that allows the transforma-
tion of a host graph G into a direct derivation graph
H, whose components are defined as follows:
LG is the production’s left graph. Applying a pro-
duction to a host graph G involves searching for one
or more isomorphic occurrences of LG in G which
will eventually be replaced by instantiations of graph
RG.
1
A production either uses embedding or gluing but not
both simultaneously
MODELSWARD2014-InternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
432
K is the production’s interface graph which is a
sub-graph (i.e., no dangling edges: all its edges have
a target and a source node). LG and RG contain an
isomorphic occurrence of it.
RG is the production’s right graph which will be
attached to an intermediate graph (G LG) K, in
the more common case, using graph gluing or embed-
ding, or both operations, to produce a direct derivation
graph H as the overall result of applying the produc-
tion.
ac are the application conditions under which a
production will be applied. They could represent the
existence or non-existence of certain nodes, edges, or
subgraphs in the host graph G, as well as embedding
restrictions of LG in G or of RG in H.
gl is the gluing operation which consists of three
steps: 1) Build a context graph D which contains the
graph G, minus the nodes and edges of the isomorphic
occurrence of LG in G that are not preserved in RG; 2)
Glue graphs D and LG through K to generate the host
graph G. This operation is the disjoint union of graphs
D and LG; and 3) Glue graphs D and RG through K to
generate the direct derivation graph H. This operation
is the disjoint union of graphs D and RG.
em is the embedding (or connecting) operation,
which creates edges between designated nodes in the
context graph D and nodes in the graph RG, to pro-
duce the final direct derivation graph H.
2.1.3 Graph Grammars
A graph grammar is a quadruple GG = (T, S, P, A)
where:
T is the type or class of graph (e.g., labeled, hy-
pergraph), that can be generated, modified and recog-
nized by applying a set P of productions.
S is the start graph to which a set P of productions
will be initially applied.
P is a set of productions P = {p
1
, ..., p
n
}.
A is a set of additional specifications extending the
scope and nature of applying the set of productions
P to graphs of type T (e.g., attributes, programmed
rules, global application conditions, structural condi-
tions).
The language L(GG) generated by graph grammar
GG is the set of terminal graphs that can be generated
from the start graph S by repeated application of the
graph rewriting productions.
Applying a set of productions P = {p
1
, ..., p
n
}
to one or more graphs involves scheduling the ap-
plication of the individual productions in a non-
deterministic or deterministic manner. Determinis-
tic approaches can utilize ad-hoc programmed rules,
prioritization schemes, application conditions and hy-
brid schemes to schedule productions. It is well
known that these extensions reduce the generative
power of a grammar, making the parsing and recog-
nition of the graphs in the generated language a more
manageable task (Nagl, 1987). In general, they fa-
cilitate using graph grammars in applications such as
subject modeling, entity description, process specifi-
cation and pattern recognition, by increasing their de-
scriptive power (Drewes et al., 2008).
2.2 Context-free Graph Grammars
Context-free grammars replace a single node or edge
by a complete graph when applying a production.
They are important in that graph derivations can be
modelled by derivation trees which produce the same
set of graphs for any different ordering used to apply
the productions (Courcelle, 1987). They are useful in
describing and generating graphs with recursive prop-
erties.
2.2.1 Algorithmic Approaches
These approaches to graph grammars implement a
graph rewriting mechanism which replaces a node v
l
,
labeled with the symbol l from an alphabet Σ, in a
host graph G, by reconnecting to the context graph
D = G v
l
E
d
(E
d
: set of dangling edges in G af-
ter removing v
l
) an isomorphic copy of a grammar
production’s RG graph through edges determined by
path expressions (Nagl, 1987), connection relations
(Rozenberg, 1997), or some other algorithm.
The following three sections introduce the gram-
mar types: NLC, NCE and edNCE, which have com-
pletely local graph rewriting mechanisms, where a
production’s RG graph is reconnected only to the
neighbour nodes of the node being replaced.
NLC Grammars. A node-label-controlled (NLC)
graph grammar is a quadruple (NU, P, C, S) where:
NU = (V, E, Σ, L
v
) is a node-labeled undirected
graph type where: 1) V is a finite set of nodes; 2)
E is a set of undirected edges; 3) Σ = Σ
N
Σ
T
is a fi-
nite alphabet of symbols, with Σ
N
: non-terminals, Σ
T
:
terminals; and 4) l
v
: V Σ is the labelling function
which assigns a terminal or non-terminal symbol to
each node in V .
P = {p
1
, ..., p
n
} is a finite set of productions, with
each p
i
= (L
i
, RG
i
, C
i
), L
i
: non-terminal symbol in Σ
N
(left side of production), RG
i
: graph of type NU (right
side of production), C
i
: connection relation of p
i
.
C = {(ρ, σ)|ρ, σ Σ} =
S
1in
C
i
(C Σ × Σ) is
the connection relation. A pair (ρ, σ) in this relation
indicates that an edge should be created between each
SurveyofGraphRewritingappliedtoModelTransformations
433
node labeled σ in graph RG and each node labeled ρ
in the context graph D.
S is the start graph, usually a single node labeled
with a non-terminal symbol.
The graph replacement and embedding mecha-
nisms in NLC grammars are strictly local to the vicin-
ity of a single labeled node.
NCE Grammars. A neighbourhood controlled em-
bedding (NCE) grammar represents a refinement of a
NLC grammar to provide enhanced control over the
local graph embedding mechanism. It is defined as
a quadruple (NU, P, C, S) where: 1) NU as in a NLC
grammar; 2) P is a set of productions as specified for
NLC grammars, with the addition that the right-hand-
sides of the pairs in the connection relation C
i
of each
production now refer to specific nodes in graph RG;
3) C = {(ρ, v)|ρ Σ, v V } =
S
1in
C
i
(C Σ×V )
is the connection relation. A pair (ρ, v) in this rela-
tion indicates that an edge should be created between
a specific node labeled v in one of the productions
and any node labeled ρ in the context graph; and
4) S is the start graph as defined in a NLC gram-
mar. These grammars still generate undirected node-
labeled graphs with unlabeled edges.
edNCE Grammars. Edge-labeled directed-graph
neighbourhood controlled embedding (edNCE) gram-
mars represent an improvement of NLC grammars
with an enhanced graph embedding mechanism and
enhanced structural rules to generate and recognize
more general classes of graphs. An edNCE gram-
mar is a quadruple (ND, P, C, S) where: 1) ND is de-
fined similarly to NU with the enhancement of la-
beled directed edges; 2) P is a finite set of produc-
tions whose left-hand-sides are defined as in the case
of NLC grammars, whose right-hand-sides are now
graphs of type ND, and the right-hand-sides of the
pairs in the connection relation C
i
refer now to spe-
cific nodes in graph RG; 3) C = {(ρ, v, d)|ρ Σ, v
V, d {in, out}} =
S
1in
C
i
(C Σ ×V ) is the con-
nection relation, a triple (ρ, v, d) in this relation indi-
cates that an incoming (d = in) or outgoing (d = out)
directed edge should be created between a specific
node labeled v in one of the productions and any node
labeled ρ in the context graph; and 4) S is the start
graph as defined for a NLC grammar.
It is well known that some other possible exten-
sions to the graph embedding mechanism, for exam-
ple, allowing flipping directions on edges, or allowing
multiple edges in the tuples of the connection relation,
do not increase the generation power of an edNCE
grammar (Rozenberg, 1997).
Grammars with Arbitrary Embedding. In gen-
eral, the embedding mechanism of a production’s RG
graph can be extended to an arbitrary degree of com-
plexity, beyond local schemes, allowing reconnecting
it to not only neighbour nodes of the node being re-
placed but also to any node in the context graph D.
This would allow a further increase in the generation
power of a grammar using the node reconnecting ap-
proach. However, the trade-off is increased complex-
ity of the generated graphs, which could make parsing
them a very difficult or even intractable task. Further-
more, applying these grammars to modeling could be-
come cumbersome.
The algorithmic approach to grammars can be
used to describe the syntax of simple diagrams such
as object models in UML.
2.2.2 Hypergraph Grammars
The central element of a hypergraph is the hyper-
edge, which is an abstraction consisting of a sin-
gle edge h with N links (“tentacles”) that are con-
nected to a set S(h) of m source nodes and a set
T (h) of n target nodes. Similar to ordinary graphs,
one can define different types of hypergraphs: un-
labeled, directed labeled, etc. A special type is a
directed labeled multi-pointed hypergraph, denomi-
nated an (m, n)-hypergraph, which contains two sets
of labeled sequential nodes: begin and end, with car-
dinalities m and n, representing overall source and tar-
get nodes of the hypergraph, respectively. This struc-
ture provides the elements to implement hyperedge
replacement grammar productions using a node glu-
ing approach, where a single hyperedge is replaced by
a (m,n)-hypergraph. The gluing operation occurs be-
tween the hyperedge’s S(h) and T (h) nodes and sets
begin and end of a (m,n)-hypergraph, respectively.
Hyperedge-Replacement Grammars. A hyper-
edge replacement (HR) grammar is a quadruple
(H
M
, P, C, S) where: 1) H
M
is a (m,n)-hypergraph
specification; 2) P is a set of productions p
i
, each
p
i
= (L
i
, RH
i
, C
i
), L
i
is the label of a single hyperedge
h (production’s left side), RH
i
: hypergraph of type H
M
(production’s right side), C
i
: re-connection mapping
for RH
i
, production p
i
applied to a host hypergraph
GH replaces hyperedge L
i
by hypergraph RH
i
recon-
necting it according to mapping C
i
to produce derived
hypergraph HH; 3) C = {(δ
b
, δ
e
) | δ
b
: π(begin)
S(h), δ
e
: π(end) T (h); δ
b
, δ
e
surjective functions}
(π(begin), π(end): permutations of begin and end, re-
spectively. C =
S
1in
C
i
) is the node-gluing map-
ping; 4) S is the start hypergraph, usually a single
MODELSWARD2014-InternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
434
handle
2
labeled with a non-terminal symbol.
HR-grammars have convenient context-free prop-
erties, mostly due to the fact that their hypergraph re-
placement mechanism is completely local to a single
hyperedge. They are quite flexible structures with a
wide spectrum of generation power, considering that
they can generate graphs and hypergraphs of varying
complexity just by changing the type (i.e., number of
tentacles) on hyperedges. The hyperedge concept is a
fundamental structure in many different types of mod-
els (Habel, 1992), hence it is applicable to consider
HR-grammars as having a wide range of descriptive
power. For example, transitions in Petri nets are more
easily represented as hypergraphs than as complex
subgraphs.
Hypergraph Replacement Grammars. In these
structures, denominated HGR-grammars, productions
can replace arbitrary sub-hypergraphs in a given host
hypergraph. They use the double pushout graph
rewriting technique defined in the algebraic approach
to graph grammars (Section 2.3) to generate derived
hypergraphs. HGR-grammars can provide more flexi-
ble and less granular productions than HR-grammars,
and can be reduced to the latter grammars when the
sub-hypergraph replaced is a single hyperedge.
The generative power of HR- and HGR-grammars
and the classes of languages they generate have been
extensively studied (Habel, 1992; Rozenberg, 1997),
however, the attention has shifted to studying specific
hypergraphs such as jungles
3
(Ehrig et al., 1999) and
their rewriting mechanisms. The nodes and edges of a
jungle can represent the terms and operations of func-
tional or algebraic expressions. This approach allows
a more efficient evaluation of expressions by avoiding
the multiple representation, hence the re-calculation,
of repeated terms.
2.3 Algebraic Approach to Graph
Grammars
The algebraic approach to graph grammars focuses
on the rewriting mechanism of direct derivations of
graphs, rather than on the study of general constructs
to obtain graph languages (Ehrig, 1979; Ehrig et al.,
2006; Rozenberg, 1997). Its basic operation is graph
gluing, where common nodes and edges in a produc-
tion’s LG (left) and RG (right) graphs play a key role
in maintaining graph consistency when replacing LG
2
A handle is a single (m, n)-hyperedge connected to sets
of nodes begin and end.
3
jungles are forests of coalesced trees with shared struc-
tures that can be represented by acyclic hypergraphs
Figure 2: Single and Double Pushout Production Applica-
tion (adapted from (Ehrig et al., 2006)).
by RG in a host graph G. In this approach, given a
node- and edge-labeled simple graph G, the applica-
tion of a production p yields a graph H if the follow-
ing conditions are met:
1) The definition of production p is based on par-
tial graph morphisms between its LG (left graph) and
its RG (right graph) in the case of the single pushout
approach (SPO) (fig. 2-(b)), or is based on total graph
morphisms between LG, RG and an auxiliary inter-
face graph K, containing the nodes and edges required
for gluing RG to a context graph D (fig. 2-(a)), in the
case of the double pushout approach (DPO).
2) The application of production p, represented by
pushout constructions (1) and (2), or (3) in the DPO
and SPO approaches, respectively, removes the nodes
and edges of G that can be mapped to LG but not to
RG, and adds to G the new nodes and edges of RG to
produce H.
Similar to all approaches, a graph grammar GG
consists of a start graph G
0
and a finite set of pro-
ductions P = {p
1
, ... p
n
}, each production as defined
above. The language L(GG) generated by the gram-
mar is the set {G
n
| G
0
G
n
;n = 1, 2, ...}.
The grammars obtained using this approach,
generally context-sensitive, can be highly tuned to
specific graph modeling situations with arbitrary
start graphs and application-specific graph derivation
steps.
The focus on direct graph derivations, typical of
the algebraic approach, facilitates detailed analyses
of comparative properties, structural transformations,
and semantics associated with specific subsets of pro-
ductions in a grammar and on specific graphs of its
generated language, which can be used to find opti-
mized ways to transform graphs of a given class.
If two productions p
1
and p
2
must work coopera-
tively on graphs to model, for example, a concept of
synchronized execution of tasks or updates to systems
states, then they must synchronize their application to
common items accessed by both on those graphs. One
solution to this problem is to amalgamate the shared
SurveyofGraphRewritingappliedtoModelTransformations
435
effects of both productions into a common subproduc-
tion p
s
, embedded in p
1
and p
2
.
If a derivation frequently occurs in some model-
ing situation and the interest concentrates on the ini-
tial and final graphs, it seems natural to search for
an optimization of the productions that would by-
pass the derivation of the intermediate graphs. This
problem translates to finding a derived production
p
: G
0
G
n
. This production exists if, given a
derivation α G
0
p
1
...
p
n
G
n
and an injective mor-
phism G
0
e
0
H
0
, e
0
induces an embedding e : α β
(where β H
0
p
1
...
p
n
H
n
) and H
0
p
H
n
. De-
rived production p
for derivation sequence α is given
by p
= p
1
;...; p
n
(i.e., sequential application of co-
productions p
i
(fig. 2-(b))).
2.4 Triple Graph Grammars
The formalism of triple graph grammars (TGG) was
devised (Sch
¨
urr, 1995) to generate and transform
pairs of related graphs (usually called source and
target graphs) under a well-formed synchronization
mechanism (i.e., a connection graph) which would
preserve the relations in the pair after applying a
transformation. The initial motivation of the formal-
ism was to provide a high-level graph-based model-
ing and specification tool for problems involving re-
lated diagrams (i.e., syntax trees, control flow dia-
grams) and information structures (i.e., requirements,
design and traceability documents) requiring simul-
taneous update for consistency purposes. More re-
cently, key concepts found in TGGs have been used
in the OMG’s QVT model transformation language
standard (Object Management Group, 2011) to de-
fine the ”mappings” of a transformation. Also, appli-
cations of TGGs to the specification of bidirectional
and incremental model transformations are becoming
more common (Czarnecki et al., 2009; Stevens, 2010;
Hermann et al., 2013).
The categorical framework (Ehrig et al., 2006)
is the standard mathematical tool used to describe
TGGs: their elements and operations. TGG’s ele-
mentary unit of transformation is the graph triple, de-
noted as GT (LG
gl
CG
gr
RG), where LG: left
graph, CG: connection graph, RG: right graph (usu-
ally node- and edge-labeled directed graphs, however,
other types of graphs can be used), and gl, gr are
graph morphisms (fig. 3). The transformation oper-
ator is the triple production, denoted as p (l p
lr
cp
rr
rp), and consisting of three monotonic sin-
gle productions
4
: l p (LL, LR), cp (CL, CR) and
4
Production p (L, R) is monotonic if L R.
Figure 3: TGG Production Application (adapted from
(Sch
¨
urr, 1995)).
rp (RL, RR) (with graph morphisms l p : LL LR,
cp : CL CR and rp : RL RR, respectively, and
the induced graph morphisms lr|
CL
: CL LL, rr|
CL
:
CL RL
5
, lr : CR LR and rr : CR RR), which
are applied simultaneously (fig. 3).
Applying a triple production p to a graph triple
GT produces a directly derived triple HT (LH
hl
CH
hr
RH) (fig. 3), derivation denoted as GT
p
HT ,
where the application of each of its component pro-
ductions l p, cp and rp are modeled by the single
pushout categorical construct described in fig. 2-(b).
That is, productions l p, cp and r p, match LL, CL and
RL in graphs LG, CG and RG through total morphisms
lg, cg and rg, respectively. Then, they transform the
latter triple into graphs LH, CH and RH, which are
related to the applied production and original graphs
by the morphism pairs (lh, l p*), (ch, cp*), and (rh,
rp*), respectively (fig. 3).
The basic definition of TGGs with monotonic pro-
ductions, although partially restrictive, makes it more
feasible to specify translation tools based on inter-
graph relationships by simplifying the manipulations
required to obtain a triple’s target graph that an arbi-
trary source graph, as shown below (Sch
¨
urr, 1995).
A triple production p ((LL, LR)
lr
(CL, CR)
rr
(RL, RR)) can be split into a pair of equivalent pro-
ductions: a left-local production p
L
and a left-to-right
production p
LR
, with:
p
L
((LL, LR)
ε
(φ, φ)
ε
(φ, φ))
6
p
LR
((LR, LR)
lr
(CL, CR)
rr
(RL, RR))
When p is applied to a triple GT , of which, only
graph LG is known, denoted by GT
p(lh)
HT (HT : de-
rived triple), if its component productions are mono-
tonic, the following equivalence holds:
5
lr|
CL
and rr|
CL
indicate that lr and rr are total mor-
phisms over graph CL
6
φ: empty graph; ε: inclusion of empty graph in any
graph.
MODELSWARD2014-InternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
436
GT
p(lh)
HT XT | GT
p
L
(lh)
XT
XT
p
LR
(lh)
HT
This result extends to the application of a se-
quence of triple productions p
1
, ..., p
n
in the form of
the following equation:
p
1
(lh
1
) ... p
n
(lh
n
) =
(p
1
L
(lh
1
)... p
n
L
(h
n
))(p
1
LR
(lh
1
)... p
n
LR
(lh
n
))
which translates to say that the application of a se-
quence of triple productions is equivalent to the ap-
plication of a sequence of left-local productions fol-
lowed by the application of a sequence of left-to-right
productions. The previous analysis is also valid for
right-local and right-to-left productions.
3 GRAPH TRANSFORMATION
SYSTEMS
A significant body of concepts is common to all the
graph grammar approaches found in the literature.
Graph types and production types are common ex-
amples of useful abstractions. When extending these
ideas to applications involving large numbers of rules
(i.e., productions) and complex systems, resorting to
proven software engineering principles (i.e., classi-
fication, encapsulation, reuse and module-based se-
mantics) to further structure the graph transformation
process is essential if the requirement is to produce
manageable and scalable graph-based systems.
Graph transformation systems (Ehrig et al., 1999;
Kreowski et al., 2010) is a formalism that focus on
defining encapsulation abstractions such as transfor-
mation units and modules, using precise graph-based
semantics, which can be reused and aggregated to
build larger systems. The basic structuring gener-
alization is a graph transformation approach A =
(G, R , , E , C ), where:
G is a class of graphs of a specified type (i.e., la-
belled graphs, hypergraphs, etc.).
R is a class of rules with the same structure (i.e.,
single pushout, double pushout, etc.).
is a rule application operator that for each rule
r R produces a relation
r
⇒≡ {(g
1
, g
2
) G × G | g
1
r
g
2
}.
E is a class of graph class expressions, where each
one of them defines: a finite enumeration of graphs,
or a set theoretic definition of graphs, or a graph the-
oretic property, or the exhaustive output of a given
transformation unit, or some graph meta-definition
scheme, or the result of boolean operations on graph
classes.
C is a class of elementary control conditions over
a set ID of identifiers, which are expressed as rule ex-
ecution schedules, priority schemes, boolean expres-
sions and regular languages. For a given environment
E, defined by the mapping E : ID 2
G×G 7
, each
c C specifies a relation SEM
E
(c) consisting of pairs
(G, G
0
) G × G, where G: initial graph, G
0
: derived
graph.
This scheme allows to refer to the multiple gram-
mar types in an approach-independent manner that fa-
cilitates the analysis of similarities and differences in
properties, structures and rules.
Given a graph transformation approach, a trans-
formation system consists of a set of transformation
units with the capability to import each other forming
acyclic or cyclic import paths. Each transformation
unit produces an output terminal graph from an ini-
tial graph by interleaving rule applications with calls
to other transformation units, where the latter are ex-
ecuted in an atomic manner.
3.1 Transformation Units
A transformation unit (TU) consists of a set of graph
transformation rules conforming to a graph transfor-
mation approach A and a set of atomic-execution calls
to imported transformation units, where elements of
both sets execute interleaving each other (”interleav-
ing semantics”) to transform an initial graph of a
given class into a specific terminal graph of the same
or another class. The calls to other import transfor-
mation units can be cyclic or acyclic, depending on
whether a “called unit” calls one of its “calling units”
in a given calling path or not.
8
The input and output
graph classes are defined by class expressions.
A TU can also include a control condition (cc)
whose purpose is to regulate, restrict, and possibly
eliminate the inherent non-determinism appearing in
graph transformations due to the fact that: 1) multi-
ple rules can simultaneously be applicable to an ex-
isting graph, 2) there can exist multiple places in a
graph where a given rule could be applied. A cc
can have properties of minimality (i.e., the graphs
transformed by a TU are only the ones allowed by
the cc), invertibility (i.e., for a given cc C, C
1
ex-
ists) and continuity (i.e., given a TU with a cc C
over a sequence of environments {E
1
, ..., E
n
}, then
SEM
E
1
...E
n
(C) = SEM
E
1
(C)... SEM
E
n
(C)). The
following are the most common types of control con-
ditions:
1) Control conditions of language type which only
allow interleaving sequences of rules and imported
7
Given a set A, 2
A
denotes its power set
8
This analysis assumes acyclic calling paths.
SurveyofGraphRewritingappliedtoModelTransformations
437
TUs that can be represented by strings belonging to
a specific control language L.
2) Priorities assigned to the rules of a TU can rep-
resent control conditions that allow only specific pairs
(G, G
0
) SEM
E
(C).
3) Reduced graphs with respect to a control condi-
tion (denoted C!) is a type of control condition where
the only pairs (G, G
0
) G ×G allowed, have the prop-
erty that there is no graph G
00
such that (G
0
, G
00
)
SEM
E
(C!).
4) Rules applied as-long-as-possible (denoted R!)
for a given rule set R constitutes a special type of re-
duced graphs control condition.
5) A TU can be a control condition as it defines a
binary relation on graphs.
As a generative structure, a TU over a graph
transformation approach A is a 5-tuple TU =
(IG, L, R, CC, T G), where: 1) IG and T G are the
initial and terminal graph class expressions, respec-
tively; 2) L is a finite set of identifiers to refer to im-
ported transformation units; 3) R is a finite set of la-
belled rules (R R ), whose identifiers are not in L;
and 4) CC is a control condition.
A TU has a graph-based interleaving operational
semantics, denoted as SEM(TU), implemented by:
1) a function SEM : L 2
G×G
capable of assign-
ing a set of graphs to each identifier associated with
a TU, either a graph transformation rule or an im-
ported transformation unit, 2) a set of graphs resulting
from applying the rules from R. The overall semantics
SEM(TU) of a TU is also a binary relation on graphs
having pairs (G, G
0
) where G and G
0
are compliant
with the initial and terminal graph class expressions,
respectively, and the control condition CC.
3.2 Transformation Modules
A transformation module (Ehrig et al., 1999) is use-
ful in the specification of very large systems to en-
capsulate a set of transformation units, making some
hidden from the outside and some visible through
an export interface. Formally, it is defined over a
graph transformation approach A
9
as a triple MOD =
(IMPORT, BODY, EX PORT ) where: 1) IMPORT is
a set of imported names referring to external TUs; 2)
BODY and is a finite set of local named TUs, each
of which can use TUs from sets BODY and IMPORT
only, and named rules over some set L of names; and
3) EXPORT is a set of exported names referring to
TUs in BODY and/or IMPORT . The following re-
strictions apply: 1) Imported names cannot be reused
for a local rule or TU (i.e., L IMPORT = φ); and 2)
9
The set of all transformation modules over a graph
transformation approach A is denoted τ
A
Figure 4: Modeling and Model Transformation Architec-
ture.
Local TUs use only names that are imported or repre-
sent local TUs to refer to imported TUs.
The semantics of a module over a graph transfor-
mation approach A, denoted as
SEM
E
mod
(MOD), defines an environment E
mod
that
associates binary relations on graphs to each imported
name, each local rule, each locally defined TU, and
each exported name in the EXPORT set. The export
semantics of a module is obtained as the restriction of
E
mod
to names in EX PORT only.
4 GRAPH-BASED MODEL
TRANSFORMATION
The suitable use of graphs and graph transformations
for representing models and model transformations
could potentially provide the tools to define domain
modeling and transformations languages with very
precise syntax and semantics.
4.1 Model Transformations
Reliable transformations on language-based models
have to correctly interpret the syntax and semantics of
the modeling language(s) defining the source models,
and at the same time, correctly reproduce the syntax
and semantics of the modeling language(s). During
software development, the views of the system, rep-
resented by models, can change (i.e., model-to-model
transformations), and models are refined to lower ab-
straction levels to generate system implementations.
The following model, adapted from (Metzger, 2005),
provides a unifying and systemic understanding of
these multiple options occurring in MDE develop-
ment, which would include graph languages: 1) A
modeling language (ML) is a formalism which pre-
cisely defines the notation and meaning of a model
(fig. 4); 2) The MLs notation consists of concrete
and abstract syntax; 3) The MLs meaning consists of
the static and dynamic semantics.
Using the conceptual model of fig. 4, one can de-
fine a model transformation as a mapping:
MODELSWARD2014-InternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
438
f : M
Source
(S)|
ML
Source
M
Target
(S)|
ML
Target
where ML
Source
and ML
Target
are the modeling lan-
guages defining the source ML
Source
(S) and target
M
Target
(S) models of the system S, respectively.
Visualizing and interpreting some of the existing
relationships and elements in fig.4, one can provide
a brief taxonomy of model transformations, based on
the more relevant properties, as follows:
1) Directionality: a unidirectional transforma-
tion only interprets its source and reproduces its
target models. A bidirectional transformation can
also switch interpretation to target and generation to
source models.
2) Degree of Evolution: a horizontal transforma-
tion basically generates an equivalent view of the sys-
tem at the same abstraction level, often using the same
source and target modeling languages. A vertical
transformation generally uses different modeling lan-
guages for source and target models, for example in
code generation, and reduces the abstraction level.
3) Implementation Type: a transformation can be
implemented using a declarative approach based on
rules and pre/post-conditions, or an operational ap-
proach which explicitly specifies the sequence of ac-
tions to transform a model.
4) Atomicity: a transformation can be executed as
a single non-decomposable step or as multiple steps
allowing for partial rollbacks.
5) Degree of Automation: the configuration and
execution of a transformation can be completely au-
tomated by a software tool, or it can be partially auto-
mated, requiring user intervention to complete some
manual steps.
Other classifications of transformations exist
(Czarnecki and Helsen, 2006; Metzger, 2005; Mens
and Gorp, 2006), but the properties considered tend
to be refinements of the five above.
4.2 Model Transformations using
Graphs
Models in MDE routinely express complex structural
and dynamic aspects of a system by using fairly in-
tuitive visual languages. If one formalizes syntactic
and semantic aspects of these languages using graphs,
then one can make use of graph grammars and graph
transformations to specify precisely how these models
should be built and how they should be transformed
(Grunske et al., 2005).
Graph transformations, with their defined graph
types and rule sets, provide a solid foundation for rea-
soning about structural, semantic and operational as-
pects of model transformations in the following roles:
as a semantic domain that directly provides
a generic specification language and semantic
model for very high level definitions of applica-
tion domains, their abstractions and the transfor-
mations of those abstractions to support software
development activities such as the specification of
functional requirements and description of archi-
tectural changes (Buchmann et al., 2008; Grunske
et al., 2005).
as a meta-language to be used in the formal spec-
ification of the syntax, semantic and manipulation
rules of the DSLs and model transformation lan-
guages (MTLs) defining source/target models and
model transformations, respectively (Karsai et al.,
2003; de Lara et al., 2004a).
Graph-based Metamodeling. Metamodeling is a
widely accepted technique used to define the rules
of visual/diagrammatic languages, which provides a
flexible configuration environment, especially useful
when working with DSLs, and allows the checking of
whether a model produced in a specific language is
valid or not (Amelunxen et al., 2008; Levendovzky
et al., 2009). The construction of a metamodel re-
quires two basic elements: 1) a meta-language capa-
ble of describing the metamodel’s structure and rela-
tions between modeling items (e.g., class diagrams,
graphs) and 2) an instantiation relationship indicating
how model instances will be generated as a result of
using the metamodel.
In the context of graphs one can formally think
of metamodels as sets of typed graphs and of mod-
els as sets of instance graphs obtained from enacting
type-instance mappings from the former sets. Fur-
thermore, given a model of a certain type (e.g., dia-
grams, object structure, architectures), one can spec-
ify its transformations (e.g., visual/notational repre-
sentation changes, functional requirements, architec-
tural changes) as graph transformation rules over the
typed graphs of the associated metamodel. These
graph-based transformations are sufficiently generic
to: 1) specify syntactic changes when using different
source and target modeling languages and 2) define
semantic mappings when the target language is used
to define a semantic domain for the source language.
5 OPEN PROBLEMS
AND CONCLUSIONS
Research on the application of graph grammars and
graph transformations to model transformations is
currently fairly active, showing two main trends: 1)
SurveyofGraphRewritingappliedtoModelTransformations
439
mostly theoretical studies characterized by increas-
ingly abstract grammar-based formalisms employed
in analyzing and specifying high level properties of
model transformations, and 2) software engineering
perspectives interested in automating the implemen-
tation of model transformations occurring in specific
domains using graph-based specifications. There is
a noticeable gap between both trends that gives way
to an interesting set of open problems, among them:
1) Specialized graph structures that perform well in
the specification and implementation of graph- and
metamodel-based model transformations would make
the declarative approach suitable for building com-
plex model transformations; 2) Most research proto-
typing tools are often cumbersome to use, offer solu-
tions for very narrow paradigms and incomplete sup-
port for systems integration and management. Mak-
ing graph transformations a solid tool in the context of
MDE requires further research into the requirements
that industrial strength graph-based tools should have,
given the foreseeable nature of applications in engi-
neering and business.
In general, this work has found that there is a large
gap between a theoretical body of numerous graph
grammar and graph transformation approaches and
its application to practical problems in software en-
gineering. Their use in formalizing syntactic and se-
mantic aspects of software artifacts still remains far
removed from proven software engineering method-
ologies and tools that have produced reliable, ef-
ficient, user-friendly and maintainable applications.
The graph transformation research community has re-
cently become aware of these deficiencies and has
responded with studies placing the graph transfor-
mation in a more systemic context of transformation
units and systems, although with a marked theoretical
flavour.
REFERENCES
Amelunxen, C., Legros, E., Sch
¨
urr, A., and St
¨
urmer,
I. (2008). Checking and enforcement of model-
ing guidelines with graph transformations. In AG-
TIVE’07, 3rd International Workshop on Application
of Graph Transformations with Industrial Relevance,
volume 5088 of LNCS, pages 241–255. Springer.
Andries, M., Engels, G., Habel, A., Hoffmann, B., Kre-
owski, H.-J., Kuske, S., Plump, D., Sch
¨
urr, A., and
Taentzer, G. (1999). Graph transformation for speci-
fication and programming. Science of Computer Pro-
gramming, 34:1–54.
Balasubramanian, D., Narayanan, A., van Buskirk, C., and
Karsai, G. (2006). The graph rewriting and trans-
formation language: GReAT. In GraBats 2006, 3rd
International Workshop on Graph Based Tools, vol-
ume 1 of Electronic Communications of the EASST.
Balogh, A. and Varr
´
o, D. (2006). Advanced model transfor-
mation language constructs in the VIATRA2 frame-
work. In SAC’06, 2006 ACM Symposium on Applied
Computing, New York, USA.
B
´
ezivin, J. (2004). In search of a basic principle for model
driven engineering. UPGRADE -The European Jour-
nal for the Informatics Professional, 2:21–24.
Boyd, M. and McBrien, P. (2005). Comparing and trans-
forming between data models via an intermediate hy-
pergraph data model. Data Semantics, 3730:69–109.
Buchmann, T., Dotor, A., Uhrig, S., and Westfechtel, B.
(2008). Model-driven software development with
graph transformations: A comparative case study.
In AGTIVE ’07, 3rd International Workshop on Ap-
plication of Graph Transformations with Industrial
Relevance, volume 5088 of LNCS, pages 273–280.
Springer.
Courcelle, B. (1987). An axiomatic definition of context-
free rewriting and its application to NLC graph gram-
mars. Theoretical Computer Science, 55(2-3):141–
181.
Czarnecki, K., Foster, J., Hu, Z., L
¨
ammel, R., Sch
¨
urr, A.,
and Terwilliger, J. (2009). Bidirectional transforma-
tions: A cross-discipline perspective. In ICMT2009,
Theory and Practice of Model Transformations: Sec-
ond International Conference, volume 32 of LNCS,
pages 260–283. Springer.
Czarnecki, K. and Helsen, S. (2006). Feature-based sur-
vey of model transformation approaches. IBM Sys-
tems Journal, 45(3):621–645.
de Lara, J., Guerra, E., and Vangheluwe, H. (2004a). Meta-
modeling, graph transformation and model checking
for the analysis of hybrid systems. In AGTIVE ’03,
2nd International Workshop on Application of Graph
Transformations with Industrial Relevance, volume
3062 of LNCS, pages 292–298. Springer.
de Lara, J., Vangheluwe, H., and Fonseca, M. (2004b).
Meta-modeling and graph grammars for multi-
paradigm modelling in AToM
3
. Journal of Software
and Systems Modeling, 3(3):194–209.
Dean, T. and Cordy, J. (1995). A syntactic theory of soft-
ware architecture. IEEE Transactions on Software En-
gineering, 21(4):302–313.
Drewes, F., Hofmann, B., and Minas, M. (2008). Adaptive
star grammars for graph models. In ICGT 2008, 4th
International Conference on Graph Transformations,
volume 5214 of LNCS, pages 442–457. Springer.
Ehrig, H. (1979). Introduction to the algebraic theory of
graph grammars (a survey). In International Work-
shop on Graph-Grammars and Their Application to
Computer Science and Biology, volume 73 of LNCS,
pages 1–69. Springer.
Ehrig, H., Ehrig, K., Prange, U., , and Taentzer, G. (2006).
Fundamentals of Algebraic Graph Transformation.
EATCS. Springer.
Ehrig, H., Engels, G., Kreowski, H., and G.Rozenberg, edi-
tors (1999). Handbook of Graph Grammars and Com-
MODELSWARD2014-InternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
440
puting by Graph Transformation, volume 2. World
Scientific Publishing.
Ehrig, H., Habel, A., Kreowski, H.-J., and Parisi-Presicce,
F. (1991). From graph grammars to high level re-
placement systems. In 4th International Workshop
on Graph Grammars and their Application to Com-
puter Science, volume 532 of LNCS, pages 269–291.
Springer.
Grunske, L., Geiger, L., Z
¨
undorf, A., van Eetvelde, N., van
Gorp, P., and Varr
´
o, D. (2005). Using graph transfor-
mation for practical model-driven software engineer-
ing. In Model-Driven Software Development, pages
91–117. Springer.
Habel, A. (1992). Hyperedge Replacement: Grammars and
Languages, volume 643 of LNCS. Springer.
Hermann, F., Ehrig, H., Orejas, F., Czarnecki, K., Diskin,
Z., Xiong, Y., Gottmann, S., and Engel, T. (2013).
Model synchronization based on triple graph gram-
mars: correctness, completeness and invertibility.
Software and Systems Modeling.
Himsolt, M. (1991). Graph
Ed
: An interactive tool for build-
ing graph grammars. In 4th International Workshop
on Graph Grammars and their Application to Com-
puter Science, volume 532 of LNCS, pages 61–65.
Springer.
Karsai, G. (2010). Lessons learned from building a graph
transformation system. In Graph Transformations and
Model-Driven Engineering, volume 5765 of LNCS,
pages 202–223. Springer.
Karsai, G., Agrawal, A., Shi, F., and Sprinkle, J. (2003). On
the use of graph transformation in the formal speci-
fication of model interpreters. Journal of Universal
Computer Science, 9(11):1296–1321.
Kent, S. (2002). Model driven engineering. In 3rd Inter-
national Conference on Integrated Formal Methods,
volume 2335 of LNCS, pages 286–298. Springer.
Kreowski, H.-J., Kuske, S., and von Totth, C. (2010). Step-
ping from graph transformations units to model trans-
formation units. In GraMot 2010, International Col-
loquium on Graph and Model Transformation, vol-
ume 30 of Electronic Communications of the EASST.
K
¨
uhne, T. (2006). Matters of (meta-) modeling. Journal of
Software and Systems Modeling, 5(4):369–385.
Legros, E., Sch
¨
afer, W., Sch
¨
urr, A., and St
¨
urmer, I. (2011).
MATE - a model analysis and transformation envi-
ronment for MATLAB Simulink. In International
Dagstuhl Workshop on Model-Based Engineering of
Embedded Real-Time Systems, volume 6100 of LNCS,
pages 323–328. Springer.
Levendovzky, T., Lengyel, L., and M
´
ez
´
aros, T. (2009). Sup-
porting domain-specific model patterns with meta-
modeling. Journal of Software and Systems Modeling,
8(4):501–520.
Mens, T. and Gorp, P. V. (2006). A taxonomy of model
transformation. In GraMoT 2005, International Work-
shop on Graph and Model Transformation, volume
152 of Electronic Notes in Theoretical Computer Sci-
ence, pages 125–142. Elsevier.
Metzger, A. (2005). A systematic look at model transforma-
tions. In Model-Driven Software Development, pages
19–33. Springer.
Nagl, M. (1987). Set theoretic approaches to graph gram-
mars. In 3rd International Workshop on Graph Gram-
mars and their Application to Computer Science, vol-
ume 291 of LNCS, pages 41–54. Springer.
Nagl, M. and Sch
¨
urr, A. (1991). A specification environ-
ment for graph grammars. In 4th International Work-
shop on Graph Grammars and their Application to
Computer Science, volume 532 of LNCS, pages 599–
609. Springer.
Neema, S. and Karsai, G. (2006). Software for automotive
systems: Model-integrated computing. In Automotive
Software - Connected Services in Mobile Networks,
volume 4147 of LNCS, pages 116–136. Springer.
Nickel, U., Niere, J., and Z
¨
undorf, A. (2000). The FUJABA
environment. In ICSE’00, 22nd International Confer-
ence on Software Engineering, pages 742–745, New
York, NY, USA. ACM.
Object Management Group (2011). Meta Object Facility
(MOF) 2.0 Query / View / Transformation Specifica-
tion, version 1.1, January 2011. version 1.1.
Prieto-D
´
ıaz, R. (1990). Domain analysis: An introduc-
tion. ACM SIGSOFT Software Engineering Notes,
15(2):47–54.
Rozenberg, G., editor (1997). Handbook of Graph Gram-
mars and Computing by Graph Transformation, vol-
ume 1. World Scientific Publishing.
Sch
¨
urr, A. (1995). Specification of graph translators with
triple graph grammars. In 20th International Work-
shop on Graph-Theoretic Concepts in Computer Sci-
ence, volume 903 of LNCS, pages 151–163. Springer.
Sch
¨
urr, A., Winter, A. J., and Z
¨
undorf, A. (1995). Graph
grammar engineering with PROGRES. In ESEC ’95,
5th European Software Engineering Conference, vol-
ume 989 of LNCS, pages 219–234. Springer.
Stevens, P. (2010). Bidirectional model transformations in
QVT: Semantic issues and open questions”, JOUR-
NAL = ”Journal of Software and Systems Modeling.
9(1):7–20.
Taentzer, G. (2004). AGG: A graph transformation envi-
ronment for modeling and validation of software. In
AGTIVE 2003, 2nd International Symposium on Ap-
plications of Graph Transformations with Industrial
Relevance, volume 3062 of LNCS, pages 446–453.
Springer.
Weisem
¨
oller, I., Klar, F., and Sch
¨
urr, A. (2011). Develop-
ment of tool extensions with MOFLON. In Interna-
tional Dagstuhl Workshop on Model-Based Engineer-
ing of Embedded Real-Time Systems, volume 6100 of
LNCS, pages 337–343. Springer.
SurveyofGraphRewritingappliedtoModelTransformations
441