Date post: | 28-Mar-2015 |
Category: |
Documents |
Upload: | zachary-crabtree |
View: | 216 times |
Download: | 2 times |
A Model-based Development approach for Model Transformations
Shekoufeh Kolahdouz Rahimi, Kevin [email protected], [email protected]
Model Transformation Issues• Specification of model
transformations
• Development processes for model transformations
• UML-RSDS: A General Model-Driven Software Development Approach
2
Development Process for Model Transformations
• Requirements
• Abstract Specification
• Explicit Specification and Design
• Implementation
3
Tree to Graph Transformation
4
Transformation
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
• 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
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
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.
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
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)
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)
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
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
Case Study 2: Mapping activities from UML 1.4 to UML 2.2
14
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.
Case Study 3: UML to Relational Database mapping
16
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
Transformation algorithm
18
Questions?
19