480 likes | 617 Views
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. Contributions of our UML 2004 paper.
E N D
Generic and Meta-Transformations for Model Transformation Engineering Dániel Varró, András Pataricza Budapest University of Technology and Economics Most InfluentialPaperPresentation@MODELS 2014 Valencia, Spain, October 2nd, 2014
Contributions of our UML 2004 paper • Novel MT Concepts • Generic and • Meta-Transformations • Highlight the software engineering aspects of MT • Reusability • Maintainability • Performance • Compactness • 1st prototype of VIATRA2 transformation framework • Impact (Citation) Analysis • Total: 137 (Google Scholar)
(Slideswiththis design aretakenfrommy UML 2004 talk) Generic and Meta-Transformations for Model Transformation Engineering DánielVarróAndrásPataricza Budapest Univ. of Technology and EconomicsDept. 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 PlatformIndep. Trans. (PIT) J. Bézivin, N. Farcet, J.-M. Jézéquel, B. Langlois, and D. Pollet. Reflectivemodeldrivenengineering. InProc. UML 2003: 6th Int. Conf. ontheUnifiedModelingLanguage, LNCS 2863, pp. 175–189. Springer, San Francisco, CA, USA, 2003 UML 2004
Solution 1: Manually written PSTs DB UML Language B Language A Metamodel A Metamodel B conforms to conforms to Model a Model b PlatformIndep. Trans. (PIT) Platform Spec. Trans. (PST) XSLT spec. XT Schema SA Schema SA conforms to conforms to Document da Document db XSLT exec. xt
Solution 1: Manually written PSTs DB UML Language B Language A • 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) Metamodel A Metamodel B conforms to conforms to Model a Model b MOF technological space Platform Spec. Trans. (PST) XSLT spec. XT Schema SA Schema SA conforms to conforms to Document da Document db XSLT exec. xt
Solution 2: PIT Specification DB UML Language B Language A Transf. Spec. T Metamodel A Metamodel B conforms to conforms to Model a QVT Model b UML 2004
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 UML 2004
A:Attribute B:Column name=NM type=TP name=NM type=TP QVT example QVT rule Relation Attr2ColumnR C:Class T:Table Variable :attrs :columns Pattern Attr2Col(A,B) when Cls2Tbl(C,T) Condition UML 2004
A:Attribute B:Column A:Attribute name=NM type=TP name=NM type=TP name=NM type=TP Graph transformation example RHS LHS Cls2Tbl(C,T) Cls2Tbl(C,T) C:Class T:Table C:Class T:Table :attrs :columns :attrs Att2Col(A,B) UML 2004
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 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 Document db 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 • 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? XSLT spec. XT Schema SA Schema SA conforms to conforms to Document da Document db XSLT exec. xt UML 2004
Solution 4: Automatically generated PST DB UML Language B Language A Transf. Spec. T Metamodel A Metamodel B conforms to conforms to Model a Model b Meta-transformation XSLT spec. XT Schema SA Schema SA conforms to conforms to Document da Document db XSLT exec. xt
Solution 4: Automatically generated TST DB UML Language B Language A • Advantages: • transformationspecificationin QVT/MOF/UML • automaticallygenerated XSLT scripts • platform specifictransformers (integratedintothetargettechnologicalspace) • Disadvantages: • PIT2PST is a complexmeta-transformation (e.g. QVT2XSLT) • wehavetodoit ONCE / we HAVE TO doitonce Transf. Spec. T Metamodel A Metamodel B conforms to conforms to Model a Model b XSLT spec. XT Schema SA Schema SA conforms to conforms to Document da Document db XSLT exec. xt
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? 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-OrderTransformations UML 2004
Example: XMI export • Problem: • generate XMI documents • from MOF-based models • when the metamodel is a parameter <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> UML 2004
Advantages General + Powerful Succinct Disadvantages Performance? Implementation as PSTs? Overview of generic transformations Metamodel(Graphs) Generic rules Graph model Generic Trans. Eng. XMI document Generic transformation = Rules with type variables UML 2004
Example: A generic rule Type parameter UML 2004
Overview of meta-transformations • Advantage: • Executed by traditional transformation engines • Prerequisite: • Rules stored as models Meta rules Metamodel(Graphs) “Ordinary” Trans. Eng. “Ordinary” rules TransformationModels Graph model “Ordinary” Trans. Eng. XMI document Meta-Transformation = Rules that consume/generate rules UML 2004
Example: A meta rule Type variablesare data in the RHS resolved prior to main transformation UML 2004
Result of applying a meta rule Ordinary (first order) transformation rule without type variables UML 2004
Generic rules for model maintenance Migration from XMI 1.0 to XMI 1.1 UML 2004
Another scenario of generic and meta-transformations • Advantage: uniform management of • models • transformations Generic & Meta rules “Ordinary” rules Generic Trans. Eng. “Ordinary” rules Graph model “Ordinary” Trans. Eng. XMI document Meta-Transformation = Rules that consume/generate rules UML 2004 Generic Transformation = Rules with type variables
The VIATRA2 Approach • Model management: • 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 • Graph patterns (GP): structural conditions • Graph transformation (GT): elementary transformation steps • Abstract state machines (ASM): complex transformation programs • Code generation: • Special model transformations with • Code templates and code formatters
Generic GT rulesin VIATRA gtrule parentIsAncR(Par,Child,ClsE,ParR,AncR) precondition lhs(Par, Child, P1 ClsE,ParR,AncR) postcondition rhs(Par, Child, P1 ClsE,ParR,AncR) ParR:relation AncR:relation ParR:relation AncR:relation ClsE:entity ClsE:entity P1:relation P1:relation Par:entity Child:entity Par:entity Child:entity E:relation precondition patternlhs(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)
Meta-transformationsin VIATRA • Main ideas: • Transformations stored as models • Processed by an interpreter (GT + ASM) • Executed over models stored in the model space • Unusual consequences: • Self-modifying meta-transformations • Pattern elements appearing in match sets • Scopes of MT rules required • EMF transformation model • Quiz: Sample model space • Graph pattern: chase • Instance model Howmanymatchesdoespatternchasehaveinthemodelspace? 6
Higher-Order Transformation Approaches in Tools: An Outlook With direct contributions from M. Tisi, C. Krause, E. Syriani, H. Vangheluwe, D. Kolovos
Categorization of HOTs 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 ArchitectureFoundations and Applications (ECMDA2009), pp 18–33. Springer, 2009
Henshin https://www.eclipse.org/henshin/examples.php • Generic, dynamically typed MT • Transform metamodels and instance models at the same time • Use special wrapper objects • Meta/Higher-order MT • Henshin allows to mixnormal and HO transformations • 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
Transformationmodelsin RanWei, Dimitris S. Kolovos: Automated Analysis, Validation and Suboptimal CodeDetection in Model Management Programs. In Proc. of the 2nd BigMDEWorkshop,York, UK. 2014 • Ongoing work on • parsing Epsilon programs • into abstract syntax models • that conform to Ecoremetamodels • All task-specific language metamodels extend the core (EOL) language metamodel • Abstract syntax models used to perform • static type checking, • dependency analysis, • sub-optimal code detection
RamificationinTCore • Goal: Customize generic pattern languages to domain-specific use • Generate modeling environment quasi-automatically • Implemented by HOT • Relax – Augment - Modify • Usage: embedding MTs into COTS tools • MetaEdit+ • MatlabSimulink Kühne, T.; Mezei, G.; Syriani, E.; Vangheluwe, H. & Wimmer, M. Systematic Transformation Development. Journal of the ECEASST: 21, Multi-Paradigm Modeling, Denver (2009).
MOFLON • Generic rewrite rules • via JMI model repository • Example: Generic checks • attribute to be checked passed as argument • names of classes to be checked • Reflective rewrite rules • Examine metamodel first and extract properties • Instantiate generic rules on the instance level • Application: • Checking modeling guidelines for Simulink CarstenAmelunxen, ElodieLegros, Andy Schürr: Generic and reflective graph transformations for the checking and enforcement of modeling guidelines. VL/HCC 2008: pp. 211-218
Furtherapproachesfor HOT MOTMOT (2006- ) • Add language constructs to Story Diagrams • Main Usage Scenario • Copying + Adaptation • Business Process Modeling Medini QVT • Generate copy rules from Ecoremetamodels • Refinement transformations • Generic copy rules • Exception rules 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. Thomas Goldschmidt, Guido Wachsmuth: Refinement Transformation Support for QVT Relational Transformations. 3rd Workshop on Model Driven Software Engineering (MDSE 2008)
Evolution of the VIATRA ToolFamily • http://www.eclipse.org/viatra2/ • http://www.eclipse.org/incquery/
VIATRA • Main facts & features: • Written in Prolog • XMI import/export for arbitrary metamodels • UML as rule language • Auto-generated Prolog code • Main applications: • SC2Promela: model checking UML statecharts • UML2DF: fault propagation analysis • SC2SPN: reliability analysis • Major projects: • HIDE + National • Main publications: • ASE 2002, SCP 2002
VIATRA2 • Main Features • Unified storage of • Models + Metamodels + Transformations • Language: • Graph transformation (GT) • Abstract state machines (ASM) • Hybrid pattern matching • Local search + Incremental • Live MT • Event-driven • VIATRA DSM support • Design-space exploration • Main Projects: • DECOS, SENSORIA, DIANA, MOGENTES • Main Publications: • SCP 2007, ICMT 08-09, MODELS09, ASE2011, 3xSOSYM, STTT, AUSE Video: http://vimeo.com/7412871
EMF-IncQuery • Main features: • Define model queries declaratively (with Xtext editors) • Execute queries efficiently and incrementally for EMF models • Integrate queries into EMF apps with no coding (validations, viewers, derived features) • Contributors • BME • IncQuery Labs (Support) • Itemis • Main publications: • MODELS10, ICMT11, MODELS12, ECMFA12, SOSYM14, SCP2014 • Demos at MODELS, ASE, ECMFA, TOOLS, EclipseCon, … CERTIMOT
IncQuery-D • Main features: • Distributed • Storages • Indexers • Incremental Queries • Deployed over cloud infrastructure • Goal: Scalability along • # of machines • Memory/CPU • #of concurrent users • Contributors • BME + IncQuery Labs • Main publications: • Friday@MODELS 2014 • Invited talks at CloudMDE14, GT-VMT14
Acknowledgements • CurrentContributors • István Ráth, PhD • Ákos Horváth, PhD • Gábor Bergmann, PhD • Ábel Hegedüs, PhD candidate, (IncQueryLabs) • Zoltán Ujhelyi, PhD candidate • Dénes Harmath (IncQueryLabs) • 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 • PastContributors • Prof. András Pataricza • Gergely Varró, PhD (TU Darmstadt) • András Balogh, PhD (ThyssenKruppPresta) • András Schmidt (QGears) • Dávid Vágó (Google) • Balázs Grill (ThyssenKruppPresta) • Zoltán Balogh • András Ökrös • Balázs Polgár, PhD • Márk Czotter • Dániel Tóth (NSN) • Péter Pásztor • Gergely Nyilas (Lufthansa Systems) • Zsolt Sándor (Siemens PSE) • http://www.eclipse.org/viatra2/ • http://www.eclipse.org/incquery/
Summary GenericTransformations Meta/Higher-OrderTransformations