a model-based development approach for model transformations shekoufeh kolahdouz rahimi, kevin lano...
TRANSCRIPT
![Page 1: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/1.jpg)
A Model-based Development approach for Model Transformations
Shekoufeh Kolahdouz Rahimi, Kevin [email protected], [email protected]
![Page 2: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/2.jpg)
Model Transformation Issues• Specification of model
transformations
• Development processes for model transformations
• UML-RSDS: A General Model-Driven Software Development Approach
2
![Page 3: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/3.jpg)
Development Process for Model Transformations
• Requirements
• Abstract Specification
• Explicit Specification and Design
• Implementation
3
![Page 4: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/4.jpg)
Tree to Graph Transformation
4
Transformation
![Page 5: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/5.jpg)
Requirements
check validity of the source model(no
duplicate names, and no undefined parent trees)
• carry out the mapping upon a valid model Asm1:
Asm2:
5
![Page 6: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/6.jpg)
• property of the tree metamodel
• properties of the graph metamodel
Ens1:
Ens1:
6
Pres is a predicate in OCL over the source metamodelEns is a predicate in OCL over the target metamodelAsm may in general be a predicate over both metamodels
![Page 7: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/7.jpg)
Abstract specification
C1 : For each tree node in the source model there is a graph
node
in the target model with the same name
C2 : For each non-trivial parent relationship in the source
model,
there is an edge representing the relationship in the target
model
7
![Page 8: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/8.jpg)
C3 For each graph node in the target model there is a tree
node
in the source model with the same name
C4 For each edge in the target model, there is a non-trivial parent
relationship in the source model, which the edge represents
C5 The same as Ens2
8
C3 and C4 are duals of C1 and C2C1 and C3 together with the metamodels ensure that there is a 1-1 mapping from trees to nodes, which facilitates change propagation in both directions.
![Page 9: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/9.jpg)
Cons should be sufficient to establish Ens:
Cons should prove that Pres are preserved, via a suitable interpretation from the source language to the target language
9
![Page 10: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/10.jpg)
Explicit specification and design
Phase1 : Map all tree elements to corresponding nodes
Its global specification is C1 and C3, its assumption is Asm
10
for t : Tree do mapTreeToNode(t)
![Page 11: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/11.jpg)
Phase2: Map parent links to corresponding edges.
the global specification C2 and C4 and C5, its assumption is C1
and C3 and
11
for t : Tree do mapTreeToEdge(t)
![Page 12: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/12.jpg)
A ruleset in UML-RSDS is a set of rules (operations), it is defined as a UML class with a behaviour defined by an activity. This controls the allowed order of application of the rules. In this example we can therefore have one ruleset for each phase, each with a single operation.
By composing the two phases in sequence, we can also establish the overall correctness of the transformation:
12
![Page 13: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/13.jpg)
Implementation
In this case a direct change-propagating implementation of Cons is possible, or Java code can be generated from the explicit activities and rules.
13
![Page 14: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/14.jpg)
Case Study 2: Mapping activities from UML 1.4 to UML 2.2
14
![Page 15: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/15.jpg)
Phase1: Establishes the correspondences between each kind of
state vertex and activity node, ie, the axioms F1 to F11 and their inverses.
Phase2: Establishes the correspondences of guards and
transitions with opaque expressions and activity edges, assuming the correspondences of states from phase1.
Phase3: Establishes the correspondences of partitions and
activity graphs with activity partitions and activities, assuming the correspondences of states from phase1 and transitions from phase2.
15
The overall algorithm is specified as the composition of the three
phases: activity1; activity2; activity3.
![Page 16: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/16.jpg)
Case Study 3: UML to Relational Database mapping
16
![Page 17: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/17.jpg)
phase1: replace each association class by two new
associations.
This establishes AssociationClass = {}.
phase2: remove multiple and single inheritance, either by
replacing a generalisation by a 0..1 to 1 association, or by merging a class and its superclass(es). This establishes Generalization = {}.
phase3: Introduce a primary key for each class.
phase4: Replace many-many associations with a new class and
foreign keys, replace 1-many associations by foreign keys. This establishes
Association = {}.
17
![Page 18: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/18.jpg)
Transformation algorithm
18
![Page 19: A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano Shekoufeh.kolahdouzrahimi@kcl.ac.ukShekoufeh.kolahdouzrahimi@kcl.ac.uk,](https://reader035.vdocument.in/reader035/viewer/2022062619/55161012550346a2308b527f/html5/thumbnails/19.jpg)
Questions?
19