+ All Categories
Home > Documents > A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano...

A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano...

Date post: 28-Mar-2015
Category:
Upload: zachary-crabtree
View: 216 times
Download: 2 times
Share this document with a friend
Popular Tags:
19
A Model-based Development approach for Model Transformations Shekoufeh Kolahdouz Rahimi, Kevin Lano [email protected] , [email protected]
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,

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,

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,

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,

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,

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,

• 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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

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,

Questions?

19


Recommended