generic and meta-transformations for model transformation engineering
Post on 30-Dec-2015
28 Views
Preview:
DESCRIPTION
TRANSCRIPT
Budapest University of Technology and EconomicsDepartment of Measurement and Information Systems
Generic and Meta-Transformations for Model Transformation Engineering
Dániel Varró, András PatariczaBudapest University of Technology and Economics
Most Influential Paper Presentation@MODELS 2014 Valencia, Spain, October 2nd, 2014
2
Generic&Meta40%
VIATRA27%
MT Engineering10%
Other6%
Self8%
None9%
Citations
Contributions of our UML 2004 paper Novel MT Concepts
o Generic and o Meta-Transformations
Highlight the software engineering aspects of MTo Reusabilityo Maintainabilityo Performanceo Compactness
1st prototype of VIATRA2 transformation framework
Impact (Citation) Analysiso Total: 137 (Google Scholar)
3
Overview
VIATRA History
Outlook on Generic and Meta-Transformations
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
(Slides with this design are taken from my UML 2004 talk)
October 14th, 2004 UML 2004
The Model Transformation Problem
Metamodel A
Language A Language B
Metamodel B
Model a Model b
How to specify?
How to execute?conforms to conforms to
UML DB
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
Solution 1: Manually written PSTs
Metamodel A
Language A Language B
Metamodel B
Model a Model b
conforms to conforms to
UML DB
Schema SA Schema SA
Document da Document db
XSLT spec. XT
XSLT exec. xt
conforms to conforms to
Platform Spec. Trans. (PST)
Platform Indep. Trans. (PIT)
Solution 1: Manually written PSTs
Metamodel A
Language A Language B
Metamodel B
Model a Model b
conforms to conforms to
UML DB
Schema SA Schema SA
Document da Document db
XSLT spec. XT
XSLT exec. xt
conforms to conforms to
Platform Spec. Trans. (PST)
MOF technological space
Advantages:+ standard model format (XMI) and transform. language (XSLT)+ extensive tool support (XSLT engines)Disadvantages:– knowledge is required in another technological space (XSLT)– hard to debug/maintain/understand complex XSLT scripts – XSLT performance problems (for graph-like structures, e.g. XMI)
October 14th, 2004 UML 2004
Solution 2: PIT Specification
Metamodel A
Language A Language B
Metamodel B
Model a Model b
Transf. Spec. T
conforms to conforms to
UML DB
QVT
October 14th, 2004 UML 2004
Solution 2: PIT specification + engine
Metamodel A
Language A Language B
Metamodel B
Model a Model b
Transf. Spec. T
Transf. Exec. t
conforms to conforms to
UML DB
October 14th, 2004 UML 2004
QVT example
C:Class
:columns
A:Attribute
name=NMtype=TP
:attrs
B:Column
name=NMtype=TP
Cls2Tbl(C,T)
T:Table
Attr2Col(A,B)
Attr2ColumnR
when
Condition
RelationQVT rule
Pattern
Variable
October 14th, 2004 UML 2004
Graph transformation example
C:Class
A:Attribute
name=NMtype=TP
:attrs
T:Table
Cls2Tbl(C,T)
LHS
C:Class
:columns
A:Attribute
name=NMtype=TP
:attrs
B:Column
name=NMtype=TP
T:Table
Cls2Tbl(C,T)
RHS
Att2Col(A,B)
October 14th, 2004 UML 2004
Solution 2: PIT specification + engine
Metamodel A
Language A Language B
Metamodel B
Model a Model b
Transf. Spec. T
Transf. Exec. t
conforms to conforms to
UML DB
Advantages:+ pattern-based transformation specification in UML/MOF (upcoming QVT standard)+ increased performance for complex graph modelsDisadvantages: – lack of (industrial) model transformation tools
October 14th, 2004 UML 2004
Solution 3: Model-driven transformation of PSMs
Metamodel A
Language A Language B
Metamodel B
Model a Model b
conforms to conforms to
UML DB
Schema SA Schema SA
Document da Document db
conforms to conforms to
Transf. Spec. T
Transf. Exec. t
October 14th, 2004 UML 2004
Solution 3: Model-driven transformation of PSMs
Metamodel A
Language A Language B
Metamodel B
Model a Model b
conforms to conforms to
UML DB
Schema SA Schema SA
Document da Document db
XSLT spec. XT
XSLT exec. xt
conforms to conforms to
Transf. Spec. T
Transf. Exec. t
Advantages: (as before)+ pattern-based transformation specification in UML/MOF (upcoming QVT standard)+ increased performance for complex graph models (vs. XSLT)Disadvantages: – HOW TO INTEGRATE INTO EXISTING TOOLS?
Solution 4: Automatically generated PST
Metamodel A
Language A Language B
Metamodel B
Model a Model b
conforms to conforms to
UML DB
Schema SA Schema SA
Document da Document db
conforms to conforms to
Transf. Spec. T
XSLT spec. XT
XSLT exec. xt
Meta-transformation
Solution 4: Automatically generated TST
Metamodel A
Language A Language B
Metamodel B
Model a Model b
conforms to conforms to
UML DB
Schema SA Schema SA
Document da Document db
conforms to conforms to
Transf. Spec. T
XSLT spec. XT
XSLT exec. xt
Advantages:+ transformation specification in QVT/MOF/UML+ automatically generated XSLT scripts+ platform specific transformers (integrated into the target technological space)Disadvantages:– PIT2PST is a complex meta-transformation (e.g. QVT2XSLT)– we have to do it ONCE / we HAVE TO do it once
October 14th, 2004 UML 2004
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:– Consumes (produces) transformation
rules as input (output)
Higher-Order Transformations
October 14th, 2004 UML 2004
Example: XMI export
Problem: – generate XMI
documents – from MOF-based
models– when the metamodel
is a parametername = First
isStart = true
n1 : Node
name = SecondisStart = false
n2 : Node
weight = 1
e1 : Edge
outgoing
incoming
name : StringisStart : Boolean
Node
weight : Integer
Edge
subnodes
outgoing
incoming
Graph
<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>
October 14th, 2004 UML 2004
Overview of generic transformations
Advantages– General +
Powerful– Succinct
Disadvantages– Performance?– Implementation
as PSTs?
Metamodel(Graphs)
Graph model
Generic Trans. Eng.
Generic rules
XMI document
Generic transformation = Rules with type variables
October 14th, 2004 UML 2004
Example: A generic rule
identifier = id
o:x
name = n
x:Class
name = n
e:XMLElem
name = "xmi.id"value = id
a:XMLAttr
:attributesObj2Elem(o,e)
{new}
{new}
{new}
{new}
Obj2ElemR
Type paramete
r
October 14th, 2004 UML 2004
Overview of meta-transformations
Advantage:– Executed by
traditional transformation engines
Prerequisite:– Rules stored as
modelsMetamodel(Graphs)
Graph model
“Ordinary” Trans. Eng.
Meta rules
XMI document
“Ordinary” Trans. Eng.
“Ordinary” rules
Meta-Transformation = Rules that consume/generate rules
Transformation Models
October 14th, 2004 UML 2004
Example: A meta rule
name = at
att:Attribute
name = cl
x:Class
as:attributes
isEnum = "true"
y:Class
:type
EnumAttr2ElemR(x,att)
value = v
a:att
o:x
:as{new}
{new} :contains
e1:XMLElem
name = cl+"."+at
e2:XMLElem
name = "xmi.value"value = v
a2:XMLAttr
:attributes
Attr2Elem(a,e2)
Obj2Elem(o,e1)
{new}{new}
{new}
Attr2Rule
Attr2RuleR
Type variables are data in the RHS resolved prior to main transformation
October 14th, 2004 UML 2004
Result of applying a meta rule
value = v
a:weight
o:Edge
:as{new}
{new} :contains
e1:XMLElem
name = "Edge.weight"
e2:XMLElem
name = "xmi.value"value = v
a2:XMLAttr
:attributes{new}{new}
Attr2Elem(a,e2)
EnumAttr2ElemR(“Edge”,”weight”)
{new}
Obj2Elem(o,e1)
Ordinary (first order) transformation rule without type variables
October 14th, 2004 UML 2004
Generic rules for model maintenance
a:att:Attribute
:contains
e1:XMLElem
name = n
e2.XMLElem
name = "xmi.value"value = v
a1:XMLAttr
:attributes
Attr2Elem(a,e2)
{delete}name = nvalue = v
a2:XMLAttr
:contains
Attr2Attr(a,a2)
{new}
{delete}{delete}
{delete}
{delete}
{new}
{new}
ChangeXMIAttributesR
Migration from XMI 1.0 to XMI 1.1
October 14th, 2004 UML 2004
Another scenario of generic and meta-transformations
Advantage: uniform management of– models– transformations“Ordinary”
rules
Graph model
Generic Trans. Eng.
Generic & Meta rules
XMI document
“Ordinary” Trans. Eng.
“Ordinary” rules
Meta-Transformation = Rules that consume/generate rulesGeneric Transformation = Rules with type variables
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 conditionso 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
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);} …
Generic GT rules in VIATRA Explicit (dynamic)
instanceOf relations Variables matched
to metamodel elements (types)
precondition lhs(Par, Child, P1ClsE,ParR,AncR)
Par:entityP1:relation
Child:entity
gtrule parentIsAncR(Par,Child,ClsE,ParR,AncR)
ClsE:entityAncR:relation
ParR:relation
postcondition rhs(Par, Child, P1 ClsE,ParR,AncR)
Par:entityP1:relation
Child:entity
ClsE:entityAncR:relation
ParR:relation
E:relation
29
Meta-transformations in VIATRA Main ideas:
o Transformations stored as models
o Processed by an interpreter (GT + ASM)
o Executed over models stored in the model space
Unusual consequences:o Self-modifying meta-
transformationso Pattern elements appearing
in match setsScopes of MT rules requiredEMF transformation model
Quiz: Sample model spaceo Graph pattern: chase
o Instance model
How many matches does pattern chase have in the model space? 6
Higher-Order Transformation Approaches in Tools: An Outlook
With direct contributions from M. Tisi, C. Krause, E. Syriani, H. Vangheluwe, D. Kolovos
31
Our Influencers (in 2004)
•Introduced for the definition of context-sensitive language grammars
Two-level graph
grammars
•Meta-theoretical foundations in Maude
•Arbitrary models can be transformed into their meta-representation
Rewriting logics
•Reflective OO programming (Smalltalk)
•Functional programming
Programming languages
32
Categorization of HOTsMT analysis• Process transformations to
extract meaningful data
MT synthesis• Create new transformations from
data modeled in other forms
MT modification• Manipulate the logic of an input
transformation
MT (de)composition• 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 Foundations and Applications (ECMDA2009), pp 18–33. Springer, 2009
33
ATLTransformation
injection
• Textual transformation is translated into a transformation model
Higher-order transformation
• Transformation models for
• Input+output+HOT
Transformation extraction
• Output model is serialized into a textual transformation
34
Henshin Generic, dynamically typed MT
o Transform metamodels and instance models at the same time
o Use special wrapper objects Meta/Higher-order MT
o Henshin allows to mixnormal 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, 2013
https://www.eclipse.org/henshin/examples.php
35
Transformation models in Ongoing work on
o parsing Epsilon programs o into abstract syntax models o that conform to Ecore metamodelso 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
36
Ramification in TCore Goal: Customize generic
pattern languages to domain-specific use o Generate modeling
environment quasi-automatically
o Implemented by HOTo Relax – Augment - Modify
Usage: embedding MTs into COTS toolso 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).
Input Meta-Model Output Meta-Model
Relax Augment Modify
Customized Pattern Meta-Model
37
MOFLON Generic rewrite rules
o via JMI model repositoryo Example: Generic checks
• attribute to be checked passed as argument
• names of classes to be checked
Reflective rewrite ruleso Examine metamodel first
and extract propertieso 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
38
Further approaches for HOTMOTMOT (2006- ) Add language constructs
to Story Diagrams Main Usage Scenario
o Copying + Adaptationo Business Process Modeling
Medini QVT Generate copy rules from
Ecore metamodels Refinement
transformationso Generic copy ruleso Exception rules
Pieter Van Gorp, H. Schippers, D. JanssensCopying Subgraphs within Model Repositories. 5th Int. Workshop on Graph Transformation and Visual Modeling Techniques, ENTCS, pp. 127-139, Vienna, Austria, 1 April 2006. Elsevier.
Thomas Goldschmidt, Guido Wachsmuth: Refinement Transformation Support for QVT Relational Transformations. 3rd Workshop on Model Driven Software Engineering (MDSE 2008)
VIATRA Retrospective
40
Evolution of the VIATRA Tool Family
VIATRA VIATRA2
VIATRA2 R3.2 „VIATRA3”
IncQuery
EMF-IncQuery
IncQuery-D
http://www.eclipse.org/incquery/
http://www.eclipse.org/viatra2/
41
VIATRA Main facts & features:
o Written in Prologo XMI import/export for arbitrary
metamodelso UML as rule languageo Auto-generated Prolog code
Main applications:o SC2Promela: model checking UML
statechartso UML2DF: fault propagation
analysiso SC2SPN: reliability analysis
Major projects:o HIDE + National
Main publications: o ASE 2002, SCP 2002
•XMI export/import
•Metamodel
Start: Sep 2000
•Auto-generated MT code from UML rules
•First complex MT
M1: Summer
2001
•UML2DF transformation
•SC2SPN transformation
M2: Summer
2002
•Development of new Java/Eclipse version
End: Early 2004
42
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• Event-driven
o VIATRA DSM supporto Design-space exploration
Main Projects:o DECOS, SENSORIA, DIANA, MOGENTES
Main Publications:o SCP 2007, ICMT 08-09, MODELS09,
ASE2011, 3xSOSYM, STTT, AUSE
• Initial prototype: Spring 2004
• Eclipse start: @ GMT Sept 1st, 2005
Initial prototype: Summer 2004
•Model space + GT + ASM
•1 PhD + 3 MSc students
R1: Oct 21, 2005
•GUI improvements & documentation
•2 PhD student + 8 MSc students
R2: Oct. 10, 2006
•EMF-based MT model
•3 PhD students + 1 developer + *MSc
R3: June 2, 2008
•Incremental & live MT, MT workflow
•5 PhD students + * MSc
M3.1: March 23, 2010
•EMF support + Visualization
•UML2, BPMN, BPEL importers
M3.2: April 11, 2011
•Design-space exploration
•Incremental transitive closure
M3.3: August, 2013
•Event-driven execution platform
•Complex Event Processing
VIATRA3
Video: http://vimeo.com/7412871
43
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
44
EMF-IncQuery Main features:
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)
Contributorso BMEo IncQuery Labs (Support)o Itemis
Main publications:o MODELS10, ICMT11, MODELS12,
ECMFA12, SOSYM14, SCP2014o Demos at MODELS, ASE, ECMFA,
TOOLS, EclipseCon, …
•Initial version detached from VIATRA
•First performance benchmark
•1.5 million model elements
1st internal release: Spring
2010
•Project lead: István Ráth
•Team: Z. Ujhely, Á. Horváth, Á. Hegedüs, G. Bergmann, T. Szabó, (D. Varró)
Eclipse start: April 4, 2011
•IncQuery base: Efficient EMF navigation
•Inverse, allInstances, trans. closure
•Incremental
V0.4.0:Nov 2011
•Xtext based query editor
•Derived features
•Validation framework
V0.6.5:Oct 2012
•Event-driven VM
•Core viewers
•Xbase
V0.7.0: July, 2013
•Query libraries + Xcore
•IQ Viewers
•IQ Debugger
V0.8.0: July, 2014CERTIMO
T
Selected Applications (EMF-IncQuery)• Complex traceability• Query driven views• Abstract models by
derived objects
Toolchain for IMA configs
• Connect to Matlab Simulink model
• Export: Matlab2EMF• Change model in EMF• Re-import:
EMF2Matlab
MATLAB-EMF Bridge
• Live models (refreshed 25 frame/s)
• Complex event processing
Gesture recognition
• Experiments on open source Java projects
• Local search vs. Incremental vs. Native Java code
Detection of bad code smells
• Rules for operations• Complex structural
constraints (as GP)• Hints and guidance• Potentially infinite
state space
Design Space Exploration
• Itemis (developer)• Embraer• Thales• ThyssenKrupp• CERN
Known Users
46
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
Contributorso BME + IncQuery Labs
Main publications:o Friday@MODELS 2014o Invited talks at CloudMDE14, GT-
VMT14
•Proof of concept
•Initial architecture
•First performance benchmark
V0.1 April 2013
•Multiple storage back-ends
•Manual performance optimizations
V0.2 December
2013
•RDF-IncQuery language
•Monitoring + Optimized allocation
•First external users (students)
V0.3September
2014
47
Current Contributorso István Ráth, PhDo Ákos Horváth, PhDo Gábor Bergmann, PhDo Ábel Hegedüs, PhD candidate, (IncQuery
Labs)o Zoltán Ujhelyi, PhD candidateo Dénes Harmath (IncQuery Labs)o Tamás Szabó (Itemis)o Benedek Izsóo Gábor Szárnyaso Oszkár Semerátho Csaba Debreceni o István Dávid (Uni-Antwerp)o András Szabolcs Nagyo Márton Búro József Makaio Dániel Stein
Past Contributorso Prof. András Patariczao 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 Balogho András Ökröso Balázs Polgár, PhDo Márk Czottero Dániel Tóth (NSN)o Péter Pásztoro Gergely Nyilas (Lufthansa Systems)o Zsolt Sándor (Siemens PSE)
Acknowledgements
http://www.eclipse.org/incquery/http://www.eclipse.org/viatra2/
Summary
Metamodel(Graphs)
Graph model
“Ordinary” Trans. Eng.
Meta rules
XMI document
“Ordinary” Trans. Eng.
“Ordinary” rules
Meta/Higher-Order Transformations
Metamodel(Graphs)
Graph model
Generic Trans. Eng.
Generic rules
XMI document
Generic Transformations
top related