Upload
aniya-javins
View
218
Download
0
Tags:
Embed Size (px)
Citation preview
Higher-Order Transformation
Eugene Syriani and Hans Vangheluwe
2
Higher-Order TransformationOutline
1. What is a Higher-Order Transformation (HOT)?
2. Uses of HOT
3. Precise Modelling of Transformations
4. HOT in action
3
Higher-Order Transformation1 What is a Higher-Order Transformation (HOT)?
“A higher-order transformation is a model transformation such that its input and/or output models are themselves transformation
models.”
[Tisi09]
At least one of the input or output artefacts of the HOT must be a transformation model.
• Transformation model Transformation model
• Model* Transformation
• Transformation Model*
• Transformation (generation through grammar)
[Tisi09] Tisi, M.; Jouault, F.; Fraternali, P.; Ceri, S. & Bézivin, J. On the Use of Higher-Order Model Transformations. ECMDA-FA, LNCS: 5562,pp. 18-33 , Springer-Verlag. Enschede (The Netherlands), June 2009
4
Higher-Order TransformationClassification
• A HOT is just a transformation:
• The same classification as for simple model transformations can be applied
• Keeping in mind that the input and/or output models are transformations themselves.
5
Higher-Order Transformation2 Uses of HOT (inspiration from [Tisi09])
• Transformation Synthesis
Input: or Model – Output: Transformation
• Mapping Implementation
Reduce abstraction level:QVT-Relations QVT-Core (w.r.t. traces) [OMG08]
Declarative to Operational specification:TGG rules TGG operational rules [Klar07]
TGG rule
TGG operational rules
[OMG08] OMG. Meta Object Facility 2.0 Query/View/Transformation Specification. April 2008.[Klar07] Klar, F.; Königs, A. & Schürr, A. Model transformation in the large. ESEC/FSE, pp. 285-294, ACM. Dubrovnik (Croatia), 2007.
6
Higher-Order TransformationUses of HOT
• Transformation Synthesis
Input: or Model – Output: Transformation
• Generic Transformation
• Input or output meta-models of a transformation is not known a priori: generate a transformation on-the-fly specific to the input or output meta-models.
HOT takes as input a meta-model MM and outputs a transformation model T.T takes as input two models that conform to MM and outputs the difference model between them: union of both models + annotations (similar, from left, from right) [Graaf07]
[Graaf07] Graaf, B. & van Deursen, A. Using MDE for generic comparison of views. Models in Software Engineering, INRIA. Nashville (USA), October 2007.
7
Higher-Order TransformationUses of HOT
• Transformation Analysis
Input: Transformation – Output: Model*
• Generate data information from a transformation for analysis purposes
• Query a transformation model
Transform the operational semantics of a Petri-Net-like language defined as a graph transformation, together with an instance model of the language into a Petri-Net. [Lara10]This Petri-Net can be used for analysis.
[Lara10] de Lara, J. & Vangheluwe, H. Automating the transformation-based analysis of visual languages. Formal Aspects of Computing,22, no. 3-4, pp. 297-326, Springer. May 2010.
8
Higher-Order TransformationUses of HOT
• Transformation Composition / Decomposition
Input: [1..*] Transformation – Output: [1..*] Transformation
• Compose two transformations into one: complex merge of the rules
• Weaving of transformations: chain transformations with separate concerns(e.g. multi-stage)
See “Application” part of this lecture: adding animation concern to a Petri-Net simulator
9
Higher-Order TransformationUses of HOT
• Transformation Migration
Input: Model – Output: Transformation
• When a language evolves, all associated transformations must be adapted.
10
Higher-Order TransformationUses of HOT
• Transformation Modification
Input: Transformation – Output: Transformation (INPLACE)
• Modify the semantics of the transformation engine
• Add a copy operator rules
• Add a grouping mechanism in the patterns
• Transformation Optimization
• Improve the transformation definition for more efficient results
• Refactor a transformation with best practices
[0..1]
11
Higher-Order Transformation3 Precise Modelling of Transformations
“A higher-order transformation is a model transformation such that its input and/or output models are themselves transformation
models.”
• The notion of model transformation
Manipulation of any model (see “Model Transformation” talk).
• The notion of transformation model
Transformations must be modelled and thus conform to a meta-model.
• Model everything explicitly... But in which formalism? Which meta-model?
12
Higher-Order TransformationModels, Meta-Models, and Transformations
• T: operation that transforms the model M1 into M2.
• MT: model of a transformation that transforms any model of MM1 into a model of MM2.
• MMT: meta-model of all transformations that transform any meta-model.
• MMM: meta-model of the language used to describe meta-models.
M M’
T
MM1 MM2MMT
MMM
MT
conforms to
is modelled by
transformed to
13
Higher-Order TransformationWhat is the most appropriate formalism for MMT?
• MMTU: meta-model of the transformation units (rules, primitive operators, ...)
• MMSC: meta-model of the scheduling language
• MMPL: meta-model of the pattern language
M M’
T
MM1 MM2MMT
MMM
MT
14
Higher-Order TransformationPrecise Modelling of Transformations
MoTif transformation language [Syriani10]
[Syriani10] Syriani, E. & Vangheluwe, H. A Modular Timed Model Transformation Language. McGill University, no. SOCS-TR-2010.4,School of Computer Science. March 2010.
MMSC
MMTU
15
Higher-Order TransformationWhat about MMPL? [Kuhne09]
• Unlike the transformation units and scheduling sub-languages, the pattern language depends on other languages: the domains of the transformation.
1. Generic pattern language+ Most economic solution - Generic concrete syntax (MOF-like) - Allow to specify patterns that will never occur
2. Customized pattern language+ Concrete syntax adapted to the source/target languages (DSL)+ Exclude patterns that do not have a chance to match - More work for the tool builder
[Kuhne09] Kühne, T.; Mezei, G.; Syriani, E.; Vangheluwe, H. & Wimmer, M. Explicit Transformation Modeling. MODELS 2009 Workshops,LNCS: 6002, pp. 240-255, Springer. Denver (USA) 2010.
16
Higher-Order TransformationWhat about MMPL?
RAM process:
(quasi-)Automatically generated environment for pattern language
Input Meta-Model Output Meta-Model
Relax Augment Modify
Customized Pattern Meta-Model
17
Higher-Order TransformationWhat about MMPL?
RAM process: generate pre-/post-condition patterns meta-models
Relaxation:
• Concretize abstract entities
• Reduce minimal multiplicity constraint
• Constraints (automatic?)
• Free form: no constraints
• Valid elements: ensure typing
• Valid multiplicities: enforce (relaxed) multiplicities
• Valid constraints: enforce (a subset of) meta-model constraints
18
Higher-Order TransformationWhat about MMPL?
RAM process: generate pre-/post-condition patterns meta-models
Augmentation:
• Type all meta-model entities to MT(pre/post)_Element
• Add model transformation specific properties
• Labels
• Parameter passing (pivots)
• Allow abstract rules*
• Other (e.g., isProcessed)
• Generic elements
• Trace elements
19
Higher-Order TransformationWhat about MMPL?
RAM process: generate pre-/post-condition patterns meta-models
Modification:
• Pre-condition pattern
• Attributes are of type constraint
• Post-condition pattern
• Attributes are of type action
• Concrete syntax
• Abstract classes
• Association ends
• Other (e.g., replace topological visual syntax constraints)
20
Higher-Order TransformationWhat about MMPL?
RAM process: Generate the MMPL for Finite State Automata
Relax Augment Modify
21
Higher-Order TransformationIs RAM a HOT?
Answer:
• It takes as input the meta-models of the source and target languages.
• It produces as output a meta-model of transformations models.
• So it doesn’t take as input nor generate a transformation.
22
Higher-Order Transformation4 HOT in Action [Kuhne09]
Translate
Simulate
Animate
[Kuhne09] Kühne, T.; Mezei, G.; Syriani, E.; Vangheluwe, H. & Wimmer, M. Explicit Transformation Modeling. MODELS 2009 Workshops,LNCS: 6002, pp. 240-255, Springer. Denver (USA) 2010.
23
Higher-Order TransformationMeta-Model Definitions
The meta-models of the domain
24
Higher-Order TransformationTransformation Meta-Model
The meta-model of the transformation language
25
Higher-Order TransformationTransformation Meta-Model
The meta-model of the pattern language for the transformation (result of RAM)
26
Higher-Order TransformationTranslation
Translate: Denotational Semantics of Finite State
Automata
27
Higher-Order TransformationSimulation
Simulate: Operational Semantics of Petri-Net
28
Higher-Order TransformationHOT in Action
Meta-Models must include animation support
• The user adds correspondence links.
• Therefore the meta-models have evolved.
• We want to evolve the transformations without affecting the existing transformations.
HOT: Transform the Simulate transformation to include animation support.
29
Higher-Order TransformationExpected outcome of HOT
The animation transformation
30
Higher-Order TransformationHOT in Action
At the rule level, when an PN element is created from an FSA element,add a correspondence link between them.
31
Higher-Order TransformationHOT in Action
At the scheduling level, add the animate rules at the last step of the simulator’s loop.