Generic and Meta-Transformations
for Model Transformation Engineering
Dániel Varró, András Pataricza
Budapest University of Technology and Economics
Most Influential Paper Presentation@MODELS 2014
Valencia, Spain, October 2nd, 2014
Budapest University of Technology and Economics
Department of Measurement and Information Systems
Contributions of our UML 2004 paper
Novel MT Concepts
Impact (Citation) Analysis
o Generic and
o Meta-Transformations
o Total: 137 (Google Scholar)
None
9%
Highlight the software
engineering aspects of MT
o
o
o
o
Reusability
Maintainability
Performance
Compactness
Citations
Self
8%
Other
6%
Generic&Meta
40%
MT Engineering
10%
1st prototype of VIATRA2
transformation framework
VIATRA
27%
2
Overview
UML 2004 talk
Outlook on Generic and Meta-Transformations
VIATRA History
3
(Slides with this design are taken from my UML 2004 talk)
Generic and
Meta-Transformations for
Model Transformation Engineering
Dániel Varró
András Pataricza
Budapest Univ. of Technology and Economics
Dept. of Measurement and Information Systems
The Model Transformation Problem
DB
UML
Language B
Language A
How to specify?
Metamodel A
Metamodel B
conforms to
conforms to
How to execute?
Model a
Model b
Platform Indep. Trans. (PIT)
J. Bézivin, N. Farcet, J.-M. Jézéquel, B. Langlois, and D. Pollet.
Reflective model driven engineering. In Proc. UML 2003:
6th Int. Conf. on the Unified Modeling Language, LNCS 2863,
pp. 175–189. Springer, San Francisco, CA, USA, 2003
October 14th, 2004
UML 2004
Solution 1: Manually written PSTs
DB
UML
Language A
Language B
Metamodel A
Metamodel B
conforms to
conforms to
Model a
Schema SA
Model b
Platform Indep. Trans. (PIT)
Platform Spec. Trans. (PST)
XSLT spec. XT
Schema SA
conforms to
conforms to
Document da
XSLT exec. xt
Document db
Solution 1: Manually written PSTs
DB
UML
Language B
Language A
Advantages:
+ standard model format (XMI) and transform. language (XSLT)
Metamodel A
Metamodel B
+ extensive tool support (XSLT engines)
conforms to
Disadvantages: conforms to
– knowledge is required
(XSLT)b
Model a in another technological spaceModel
– hard to debug/maintain/understand complex XSLT scripts
– XSLT performanceMOF
problems
(for graph-like
technological
spacestructures, e.g. XMI)
Schema SA
Platform Spec. Trans. (PST)
XSLT spec. XT
Schema SA
conforms to
conforms to
Document da
XSLT exec. xt
Document db
Solution 2: PIT Specification
DB
UML
Language B
Language A
Transf. Spec. T
Metamodel A
Metamodel B
conforms to
conforms to
QVT
Model a
October 14th, 2004
UML 2004
Model b
Solution 2: PIT specification + engine
DB
UML
Language B
Language A
Transf. Spec. T
Metamodel A
Metamodel B
conforms to
conforms to
Model a
Model b
Transf. Exec. t
October 14th, 2004
UML 2004
QVT example
QVT rule
Relation
Attr2ColumnR
C:Class
T:Table
:attrs
Pattern
A:Attribute
:columns
Attr2Col(A,B)
name=NM
type=TP
name=NM
type=TP
when
Cls2Tbl(C,T)
Condition
October 14th, 2004
B:Column
UML 2004
Variable
Graph transformation example
RHS
LHS
Cls2Tbl(C,T)
C:Class
Cls2Tbl(C,T)
C:Class
T:Table
T:Table
:attrs
:attrs
A:Attribute
A:Attribute Att2Col(A,B) B:Column
name=NM
type=TP
name=NM
type=TP
October 14th, 2004
UML 2004
:columns
name=NM
type=TP
Solution 2: PIT specification + engine
DB
UML
Language B
Language A
Transf. Spec. T
Metamodel A
Metamodel B
conforms to
conforms to
Model a
Model b
Transf. Exec. t
Advantages:
+ pattern-based transformation specification in UML/MOF
(upcoming QVT standard)
+ increased performance for complex graph models
Disadvantages:
– lack
of (industrial) model transformation
tools
October 14th, 2004
UML 2004
Solution 3: Model-driven transformation of
PSMs
DB
UML
Language B
Language A
Transf. Spec. T
Metamodel A
Metamodel B
conforms to
conforms to
Model a
Model b
Transf. Exec. t
Schema SA
Schema SA
conforms to
conforms to
Document da
October 14th, 2004
UML 2004
Document db
Solution 3: Model-driven transformation of
PSMs
DB
UML
Language B
Language A
Transf. Spec. T
Metamodel A
Metamodel B
conforms to
conforms to
Model a
Model b
Transf. Exec. t
Advantages: (as before)
XSLT spec.
XT
+ pattern-based transformation
specification
in UML/MOF
Schema SAQVT standard)
Schema SA
(upcoming
+ increased
models
conforms
to (vs. XSLT)
conforms toperformance for complex graph
Disadvantages:
Document daINTO EXISTING TOOLS? Document db
– HOW
TO
INTEGRATE
October 14th, 2004
UML
2004
XSLT
exec. xt
Solution 4: Automatically generated PST
DB
UML
Language B
Language A
Transf. Spec. T
Metamodel A
Metamodel B
conforms to
conforms to
Model a
Schema SA
Model b
Metatransformation
XSLT spec. XT
Schema SA
conforms to
conforms to
Document da
XSLT exec. xt
Document db
Solution 4: Automatically generated TST
DB
UML
Language B
Language A
Advantages:
Transf. Spec. T
+ Metamodel
transformation
specification
in QVT/MOF/UML
A
Metamodel B
+ automatically generated XSLT scripts
conforms to
to
+ platform specificconforms
transformers
(integrated into
the target
technological space)
Model
a
Model b
Disadvantages:
– PIT2PST is a complex meta-transformation (e.g. QVT2XSLT)
– we have to do it ONCE / we HAVE TO do it once
Schema SA
XSLT spec. XT
Schema SA
conforms to
conforms to
Document da
XSLT exec. xt
Document db
Transformation engineering in MDA
Transformation design will be an
engineering principle (if MDA succeeds)
Questions to answer:
– How to specify and execute MTs?
– Compactness / Intuitiveness of MT Specs?
– Automation? - Performance?
– Analysis? - Correctness of transformations?
– Reusability? - Maintainability?
October 14th, 2004
UML 2004
Objectives
How to tackle (some) transware problems?
– By storing/handling transformations
as models
Generic (higher-order) transformations:
– Type / class variables in rules
Meta transformations:
Higher-Order
Transformations
– Consumes (produces) transformation rules as
input (output)
October 14th, 2004
UML 2004
Example: XMI export
Graph
subnodes
Problem:
– generate XMI documents
– from MOF-based models
– when the metamodel is
a parameter
n1 : Node
name = First
isStart = true
outgoing
e1 : Edge
weight = 1
n2 : Node
name = Second
isStart = false
October 14th, 2004
incoming
UML 2004
Node
name : String
isStart : Boolean
outgoing
Edge
weight : Integer
incoming
<Node xmi.id = "n1">
<Node.name>FirstNode</Node.name>
<Node.isStart xmi.value="true" />
<Node.outgoing>
<Edge xmi.idref = "e1"/>
</Node.outgoing>
<Node.subnodes>
<Node xmi.id = "n2"> ... </Node>
</Node.subnodes>
</Node>
Overview of
generic transformations
Metamodel
(Graphs)
Generic
rules
Graph
model
Generic
Trans. Eng.
Advantages
– General + Powerful
– Succinct
Disadvantages
– Performance?
– Implementation
as PSTs?
Generic transformation = Rules with type variables
October 14th, 2004
XMI
document
UML 2004
Example: A generic rule
Obj2ElemR
x:Class
e:XMLElem
name = n
{new}
name = n
Obj2Elem(o,e)
{new}
o:x
{new}
a:XMLAttr
name = "xmi.id"
value = id
identifier = id
Type
parameter
October 14th, 2004
:attributes
UML 2004
{new}
Overview of
meta-transformations
Meta
rules
Advantage:
– Executed by traditional
transformation engines
Prerequisite:
– Rules stored as models
Metamodel
(Graphs)
“Ordinary”
Trans. Eng.
“Ordinary”
rules
Graph
model
“Ordinary”
Trans. Eng.
Meta-Transformation = Rules that consume/generate rules
October 14th, 2004
UML 2004
Transformation
Models
XMI
document
Example: A meta rule
Attr2RuleR
EnumAttr2ElemR(x,att)
x:Class
name = cl
as:attributes
att:Attribute
name = at
Obj2Elem(o,e1)
o:x
{new}
:as
Attr2Rule
e1:XMLElem
Attr2Elem(a,e2)
e2:XMLElem
a:att
value = v
{new}
name = cl+"."+at
{new}
:type
:contains
{new}
:attributes
{new}
y:Class
a2:XMLAttr
isEnum = "true"
name = "xmi.value"
value = v
Type variables are data in the RHS resolved prior to main transformation
October 14th, 2004
UML 2004
Result of applying a meta rule
EnumAttr2ElemR(“Edge”,”weight”)
o:Edge
Obj2Elem(o,e1)
e1:XMLElem
:as
{new}
Attr2Elem(a,e2)
e2:XMLElem
a:weight
value = v
:contains
{new}
{new}
name = "Edge.weight"
{new}
:attributes
{new}
a2:XMLAttr
name = "xmi.value"
value = v
October 14th,
2004
UML 2004
Ordinary
(first
order) transformation rule
without type variables
Generic rules for model maintenance
ChangeXMIAttributesR
e1:XMLElem
{delete}
a:att:Attribute
Attr2Elem(a,e2)
:contains
{delete}
e2.XMLElem
name = n
{delete}
Attr2Attr(a,a2)
{new}
October 14th,
2004XMI 1.0 to XMI 1.1
Migration
from
{delete}
:attributes
{delete}
a1:XMLAttr
name = "xmi.value"
value = v
UML 2004
{new}
:contains
{new}
a2:XMLAttr
name = n
value = v
Another scenario of
generic and meta-transformations
Generic &
Meta rules
Advantage:
uniform management of
– models
– transformations
“Ordinary”
rules
Generic
Trans. Eng.
“Ordinary”
rules
Graph
model
“Ordinary”
Trans. Eng.
Meta-Transformation = Rules that consume/generate rules
October 14th, 2004
UML 2004
Generic Transformation = Rules with type variables
XMI
document
The VIATRA2 Approach
Model management:
o Model space: Unified, global view of
models, metamodels and transformations
• Hierarchical graph model
• Complex type hierarchy
• Multilevel metamodeling
Model manipulation and transformations:
integration of two mathematically precise,
rule and pattern-based formalisms
o Graph patterns (GP): structural conditions
o Graph transformation (GT): elementary transformation steps
o Abstract state machines (ASM): complex transformation programs
Code generation:
o Special model transformations with
o Code templates and code formatters
Generic GT rules in VIATRA
precondition pattern lhs(Par,Child,P1,ClsE,ParR,AncR) =
{
entity(ClsE);
relation(ParR,ClsE,ClsE);
relation(AncR,ClsE,ClsE);
entity(Par);
entity(Child);
relation (P1, Child,Par);
instanceOf(Par, ClsE);
instanceOf(Child, ClsE);
instanceOf(P1, ParR);
} …
Explicit (dynamic)
instanceOf relations
Variables matched
to metamodel
elements (types)
gtrule parentIsAncR(Par,Child,ClsE,ParR,AncR)
precondition lhs(Par, Child, P1
ClsE,ParR,AncR)
ParR:
relation
Par:entity
ClsE:entity
AncR:
relation
P1:relation
Child:entity
postcondition rhs(Par, Child, P1
ClsE,ParR,AncR)
ParR:
relation
Par:entity
ClsE:entity
AncR:
relation
P1:relation
Child:entity
E:relation
Meta-transformations in VIATRA
Main ideas:
Quiz: Sample model space
o Transformations stored as
models
o Processed by an interpreter
(GT + ASM)
o Executed over models
stored in the model space
o Graph pattern: chase
o Instance model
Unusual consequences:
o Self-modifying metatransformations
o Pattern elements appearing
in match sets
Scopes of MT rules required
EMF transformation model
How many matches does pattern
chase have in the model space? 6
29
Higher-Order Transformation
Approaches in Tools: An Outlook
With direct contributions from M. Tisi, C. Krause, E. Syriani,
H. Vangheluwe, D. Kolovos
Our Influencers (in 2004)
Two-level
graph
grammars
• Introduced for the definition of
context-sensitive language grammars
Rewriting
logics
• Meta-theoretical foundations in Maude
• Arbitrary models can be transformed
into their meta-representation
Programming
languages
• Reflective OO programming (Smalltalk)
• Functional programming
31
Categorization of HOTs
MT analysis
MT modification
• Process transformations to
extract meaningful data
• Manipulate the logic of an input
transformation
MT synthesis
MT (de)composition
• Create new transformations from
data modeled in other forms
• Merge /split other MTs according
to a (de)composition criterion
M. Tisi, F. Jouault, P. Fraternali, S. Ceri, and J. Bézivin. On the Use of Higher-Order Model
Transformations. In Proc. of the 5thEuropean Conference on Model-Driven Architecture
32
Foundations and Applications (ECMDA2009), pp 18–33.
Springer, 2009
ATL
Transformation
injection
• Textual
transformation is
translated into a
transformation
model
Higher-order
transformation
• Transformation
models for
• Input+output+HOT
33
Transformation
extraction
• Output model is
serialized into a
textual
transformation
Henshin
Generic, dynamically typed MT
https://www.eclipse.org/henshin/examples.php
o Transform metamodels and
instance models
at the same time
o Use special wrapper objects
Meta/Higher-order MT
o Henshin allows to mix
normal and HO
transformations
o E.g. Ecore2GenModel
(customization)
C. Krause, J. Dyck, H. Giese: Metamodel-Specific Coupled Evolution Based on Dynamically Typed
Graph Transformations. In Proc. of the 6th Int. Conf. on Theory and Practice of Model
Transformations (ICMT2013), pp 79–91. Springer,342013
Transformation models in
Ongoing work on
o parsing Epsilon programs
o into abstract syntax models
o that conform to Ecore metamodels
o All task-specific language metamodels extend the core
(EOL) language metamodel
Abstract syntax models used to perform
o static type checking,
o dependency analysis,
o sub-optimal code detection
Ran Wei, Dimitris S. Kolovos: Automated Analysis, Validation and Suboptimal Code Detection in
Model Management Programs. In Proc. of the 2nd
BigMDE Workshop, York, UK. 2014
35
Ramification in TCore
Goal: Customize generic
pattern languages to
domain-specific use
o Generate modeling
environment
quasi-automatically
o Implemented by HOT
o Relax – Augment - Modify
Usage: embedding MTs
into COTS tools
Input Meta-Model
o MetaEdit+
o Matlab Simulink
Kühne, T.; Mezei, G.; Syriani, E.; Vangheluwe,
H. & Wimmer, M. Systematic Transformation
Development. Journal of the ECEASST: 21,
Multi-Paradigm Modeling, Denver (2009).
Output Meta-Model
Relax Augment Modify
Customized Pattern Meta-Model
36
MOFLON
Generic rewrite rules
o via JMI model repository
o Example: Generic checks
• attribute to be checked
passed as argument
• names of classes to be
checked
Reflective rewrite rules
o Examine metamodel first
and extract properties
o Instantiate generic rules on
the instance level
Application:
o Checking modeling
guidelines for Simulink
Carsten Amelunxen, Elodie Legros, Andy Schürr: Generic and reflective graph transformations
for the checking and enforcement of modeling guidelines.
VL/HCC 2008: pp. 211-218
37
Further approaches for HOT
MOTMOT (2006- )
Add language constructs
to Story Diagrams
Main Usage Scenario
o Copying + Adaptation
o Business Process Modeling
Pieter Van Gorp, H. Schippers, D. Janssens
Copying Subgraphs within Model Repositories.
5th Int. Workshop on Graph Transformation
and Visual Modeling Techniques, ENTCS, pp.
127-139, Vienna, Austria, 1 April 2006. Elsevier.
Medini QVT
Generate copy rules from
Ecore metamodels
Refinement
transformations
o Generic copy rules
o Exception rules
Thomas Goldschmidt, Guido Wachsmuth:
Refinement Transformation Support for QVT
Relational Transformations. 3rd Workshop on
Model Driven Software Engineering (MDSE
2008)
38
VIATRA Retrospective
Evolution of the VIATRA Tool Family
VIATRA2
R3.2
VIATRA
VIATRA2
IncQuery
„VIATRA3”
EMFIncQuery
IncQuery-D
http://www.eclipse.org/viatra2/
http://www.eclipse.org/incquery/
40
VIATRA
Main facts & features:
o Written in Prolog
o XMI import/export for
arbitrary metamodels
o UML as rule language
o Auto-generated Prolog code
Main applications:
o SC2Promela: model checking
UML statecharts
o UML2DF: fault propagation
analysis
o SC2SPN: reliability analysis
Major projects:
Start:
Sep 2000
• XMI export/import
• Metamodel
M1:
Summer
2001
• Auto-generated MT
code from UML rules
• First complex MT
M2:
Summer
2002
• UML2DF transformation
• SC2SPN transformation
End:
Early
2004
o HIDE + National
Main publications:
o ASE 2002, SCP 2002
41
• Development of new
Java/Eclipse version
VIATRA2
Main Features
o Unified storage of
• Models + Metamodels +
Transformations
o Language:
• Graph transformation (GT)
• Abstract state machines (ASM)
o Hybrid pattern matching
• Local search + Incremental
o Live MT
Initial prototype: • Initial prototype: Spring 2004
• Eclipse start: @ GMT Sept 1st, 2005
Summer 2004
R1:
Oct 21, 2005
• Model space + GT + ASM
• 1 PhD + 3 MSc students
R2:
Oct. 10, 2006
• GUI improvements & documentation
• 2 PhD student + 8 MSc students
R3:
June 2, 2008
• EMF-based MT model
• 3 PhD students + 1 developer + *MSc
M3.1:
March 23, 2010
• Incremental & live MT, MT workflow
• 5 PhD students + * MSc
• Event-driven
o VIATRA DSM support
o Design-space exploration
Main Projects:
o DECOS, SENSORIA, DIANA,
MOGENTES
Main Publications:
o SCP 2007, ICMT 08-09, MODELS09,
ASE2011, 3xSOSYM, STTT, AUSE
M3.2:
April 11, 2011
• EMF support + Visualization
• UML2, BPMN, BPEL importers
M3.3:
August, 2013
• Design-space exploration
• Incremental transitive closure
42
Video: http://vimeo.com/7412871
VIATRA3
• Event-driven execution platform
• Complex Event Processing
Selected Applications of VIATRA2
Toolchain for critical embedded systems
•
•
•
•
Model-based tool integration
Workflow-driven interactive design tools
Ontology based consistency checks
Model-driven test generation
Service-oriented applications
•
•
•
•
Formal analysis and back-annotation of BPEL processes
Model based performability analysis
Model-based service deployment
Incremental generation of service configurations
GRaTS
• with R. Heckel (Leicester) and P. Torrini
• Stochastic simulator for graph transformation systems
43
EMF-IncQuery
Main features:
1st internal
release: Spring
2010
o Define model queries
declaratively (with Xtext editors)
o Execute queries efficiently and
incrementally for EMF models
o Integrate queries into EMF apps
with no coding (validations,
viewers, derived features)
Contributors
o BME
o IncQuery Labs (Support)
o Itemis
• Initial version detached from VIATRA
• First performance benchmark
• 1.5 million model elements
Eclipse start:
April 4, 2011
• Project lead: István Ráth
• Team: Z. Ujhely, Á. Horváth, Á. Hegedüs,
G. Bergmann, T. Szabó, (D. Varró)
V0.4.0:
Nov 2011
• IncQuery base: Efficient EMF navigation
• Inverse, allInstances, trans. closure
• Incremental
V0.6.5:
Oct 2012
• Xtext based query editor
• Derived features
• Validation framework
V0.7.0:
July, 2013
• Event-driven VM
• Core viewers
• Xbase
V0.8.0:
July, 2014
• Query libraries + Xcore
• IQ Viewers
• IQ Debugger
Main publications:
o MODELS10, ICMT11, MODELS12,
ECMFA12, SOSYM14, SCP2014
o Demos at MODELS, ASE, ECMFA,
TOOLS, EclipseCon, …
CERTIMOT
44
Selected Applications (EMF-IncQuery)
• Complex traceability
• Query driven views
• Abstract models by
derived objects
• Connect to Matlab
Simulink model
• Export: Matlab2EMF
• Change model in EMF
• Re-import:
EMF2Matlab
• Live models
(refreshed 25
frame/s)
• Complex event
processing
Toolchain for
IMA configs
MATLAB-EMF
Bridge
Gesture
recognition
• Experiments on open
source Java projects
• Local search vs.
Incremental vs.
Native Java code
• Rules for operations
• Complex structural
constraints (as GP)
• Hints and guidance
• Potentially infinite
state space
• Itemis (developer)
• Embraer
• Thales
• ThyssenKrupp
• CERN
Detection of
bad code smells
Design Space
Exploration
Known Users
IncQuery-D
Main features:
o Distributed
• Storages
• Indexers
• Incremental Queries
o Deployed over cloud
infrastructure
o Goal: Scalability along
• # of machines
• Memory/CPU
• #of concurrent users
V0.1
April 2013
• Proof of concept
• Initial architecture
• First performance
benchmark
V0.2
December
2013
• Multiple storage back-ends
• Manual performance
optimizations
V0.3
September
2014
• RDF-IncQuery language
• Monitoring +
Optimized allocation
• First external users
(students)
Contributors
o BME + IncQuery Labs
Main publications:
o Friday@MODELS 2014
o Invited talks at CloudMDE14,
GT-VMT14
46
Acknowledgements
Current Contributors
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
o
István Ráth, PhD
Ákos Horváth, PhD
Gábor Bergmann, PhD
Ábel Hegedüs, PhD candidate,
(IncQuery Labs)
Zoltán Ujhelyi, PhD candidate
Dénes Harmath (IncQuery Labs)
Tamás Szabó (Itemis)
Benedek Izsó
Gábor Szárnyas
Oszkár Semeráth
Csaba Debreceni
István Dávid (Uni-Antwerp)
András Szabolcs Nagy
Márton Búr
József Makai
Dániel Stein
http://www.eclipse.org/viatra2/
Past Contributors
o Prof. András Pataricza
o Gergely Varró, PhD
(TU Darmstadt)
o András Balogh, PhD
(ThyssenKruppPresta)
o András Schmidt (QGears)
o Dávid Vágó (Google)
o Balázs Grill (ThyssenKruppPresta)
o Zoltán Balogh
o András Ökrös
o Balázs Polgár, PhD
o Márk Czotter
o Dániel Tóth (NSN)
o Péter Pásztor
o Gergely Nyilas (Lufthansa Systems)
o Zsolt Sándor (Siemens PSE)
47
http://www.eclipse.org/incquery/
Summary
Metamodel
(Graphs)
Generic
rules
Graph
model
Generic
Trans. Eng.
Generic Transformations
XMI
document
Meta
rules
Meta/Higher-Order Transformations
Metamodel
(Graphs)
Graph
model
“Ordinary”
Trans. Eng.
“Ordinary”
rules
“Ordinary”
Trans. Eng.
XMI
document
© Copyright 2026 Paperzz