Upload
aldous-mosley
View
217
Download
1
Embed Size (px)
Citation preview
NECSIS Workshop March 10
NECSIS Workshops 1
Source-to-target model transf.
B…
A T(B)…
Space of M’s instances (models), [[
M]]
T(A)
…
Space of N’s instances (models),
[[ N]]
Metamodel M Metamodel NTransf. def. T
Color Legend:given datacomputed data
NECSIS Workshops
2
:execute T
:execute T
Space mapping [[T]]: [[M]] --> [[N]]
Towards Relational Algebra for Model Translations (just started)
McMaster:Hamid Gholizadeh, Sahar Kokaly, Tom Maibaum
Waterloo: Krzysztof Czarnecki, Michal Antkiewicz, Peiyuan Sun
Zinovy Diskin
NECSIS Workshops 3
Content
• New view of model translation– more abstract– transf. becomes a formal object
manipulateanalyze…..
NECSIS Workshops 4
Source-to-target model transf.
B…
A T(B)…
Space of M’s instances (models), [[
M]]
T(A)
…
Space of N’s instances (models),
[[ N]]
Metamodel M Metamodel NTransf. def. T
Color Legend:given datacomputed data
NECSIS Workshops
5
:execute T
:execute T
Space mapping [[T]]: [[M]] --> [[N]]
Model translation w/out traceability mappings
Model T(A)
Metamod. M
Car
Boat
lv’:LV
Transf. T1:Car -> CV*LV Boat -> LV
and
lv:LV
cv:CV
Metamod. N
Commut.Vehicle
LeisureVehicle
physical objects object roles
Model A
c:Car
b:Boat
NECSIS Workshops 6
up to iso
Model translation w/out traceability mappings
Model T(A)
Metamod. M
Car
Boat
lv’:LV
Transf. T1:Car -> CV*LV Boat -> LV
and
lv:LV
cv:CV
Theorem. [[ T1]] ≅ [[ T2 ]], where [[T1,2]]: [[M]] --> [[N]] are space functions generated by T1,2
Metamod. N
Commut.Vehicle
LeisureVehicle
physical objects object rolesTransf. T2:Car -> LVBoat -> CV*LV
R 11
Model A
c:Car
b:Boat
cb:R
lv:LV
cv:CV
lv’:LV
T1(A) ≅ T2(A)
NECSIS Workshops 7
up to iso
Model translation with traceability mappings
Model T(A)
Metamod. M
Car
Boat
lv’:LV
Transf. T1:Car -> CV*LV Boat -> LV
and
lv:LV
cv:CV
Theorem. [[ T1]] ≅ [[ T2 ]], where T1,2: [[M]] --> [[N]] are space functions generated by T1,2
Metamod. N
Commut.Vehicle
LeisureVehicle
physical objects object rolesTransf. T2:Car -> LVBoat -> CM*LV
R 11
Model A
c:Car
b:Boat
cb:R
lv:LV
cv:CV
lv’:LV
T1(A) ≅ T2(A)
Traceability linksTraceability mappingsTr1(A) ≠ Tr2(A)
Theorem. [[ T1]] ≠ [[ T2 ]], where T1,2: [[M]] --> ([[N]] x Map([[ N]] ,
[[ M]] )) are two-valued (instance x map) functions generated by T1,2
NECSIS Workshops 8
Summary 1: Mappings
• Traceability mappings are a semantic rather than just technological component of MTs
• Provide several benefits:– hold useful info about MTs • carry basic Boolean operations
– help to understand MTs
• Should be treated as first-class citizens
NECSIS Workshops 9
Model T(A)
Metamod. M
Car
Boat
Model A
c:Car
b:Boat lv’:LV
Transf. T1:Car -> CV*LV, Boat -> LV
lv:LV
cv:CV
Metamod. N
Commut.Vehicle
LeisureVehicle
physical objects object roles
cb:R
Traceability mapping
Typing mapping
Typing: What we have
Typing mapping
??
NECSIS Workshops 10
Color Legend:given datagiven datacomputed data
Model T(A)
Metamod. M
Car
Boat
Model A
c:Car
b:Boat lv’:LV
Transf. T1: Car -> CV*LV, Boat -> LV
lv:LV
cv:CV
Metamod. N
Commut.Vehicle
LeisureVehicle
physical objects object roles
cb:R
Traceability mapping
Typing mapping
Typing: What we want
Transf. definition mappings
Typing mapping
NECSIS Workshops 11
Issues to manage
NECSIS Workshops 12
Model T(A)
Metamod. M
Car
Boat
Model Ac:Car
b:Boat lv’:LV
Transf. T1: Car -> CV*LV, Boat -> LV
lv:LV
cv:CV
Metamod. N
Commut.Vehicle
LeisureVehicle
physical objects
object roles
cb:R
Traceability mapping
Typing mappin
g
Transf. definition mappings
Typing mappin
g
NECSIS Workshops 12
• Dynamic thing (a transf.) is encoded by a structural thing (a set of links)
• The mapping that encodes a transf. [[M]]-->[[N]] is directed from N to M
• We need associations between associations (beyond UML?)
Model T(A)
Metamod. M
Car
Boat
Model A
c:Car
b:Boat 3:LV
Transf. T: Car -> CV*LV, Boat -> LV
2:LV
1:CV
Metamod. NCommut.Vehicle
LeisureVehicle
Traceability mapping
map.TCar+Boat LVinM
c’: Car+Boat
b’: Car+Boat
CVinM
Given data:metamodels & modesltrans. definitionComputable data:queriesrelabeling
3:LVinM2:LVinM
1:CVinM
Dynamics via mappings: Queries
NECSIS Workshops13
:relabel
Metamod. T
same
12:same
Algebra and reuse
T1 Q(M)
M N
[[Q]] (A)A
Definitions
Instances
Typing :PB
Relabeling as “pulling Q(M) back” (pullback)
T2
NECSIS Workshops 14
Model T(A)
Metamod. M
Car
Boat
Model A
c:Car
b:Boat
3:LV2:LV
1:CV
Metamod. N
Commut.Vehicle
LeisureVehicle
Traceability mapping
map.T
Car+Boat
c’: Car+Boat
b’: Car+Boat
[=]
Algebra of MTs: T1 \/disj T2
NECSIS Workshops 151’:CV
2’:LV 3’:LV
T1
T2
T1 \/disj T2
Model T(A)
Metamod. M
Car
Boat
Model A
c:Car
b:Boat3:LV
Transf. T: Car -> CV*LV, Boat -> LV
2:LV
1:CV
Metamod. N
Commut.Vehicle
LeisureVehicle
Traceability mapping
map.T
Typing mapping
Car+Boat
c’: Car+Boat
b’: Car+Boat
[=]
Algebra of MTs: T1 /\ T2 and T1 \/ T2
NECSIS Workshops 161’:CV
2:LV 3:LV
T1
T2
T1 \/ T2
T1/\ T2
Model T(A)
Metamod. M
Car
Boat
Model A
c:Car
b:Boat
1:CV
Metamod. N
Commut.Vehicle
LeisureVehicle
Traceability mapping
Car+Boat
c’: Car+Boat
b’: Car+Boat
Algebra of MTs: T1 /\ T2 and T1 \/ T2
T1
T2
NECSIS Workshops 17
T1 \/ T2
T1/\ T2
1’:CV
2:LV 3:LV
T1 (A) \/ T2 (A)
T1(A) /\ T2(A)
T1(A) T2(A)
T1 \/ T2
T1/\ T2
T1 T2
Algebra of MTs. Chaining (seq. composition)
...
Q1(M)
[[Q1]] (A)
Definitions
Instances
Typing:PB
Q2(N)
[[Q2]] (..)
:PB
T1oT2
T2 T1
A
M ON
:PB
NECSIS Workshops 18
Chaining transf. via mapping composition
...
Q1(M)
[[Q1]] (A)
Definitions
Instances
Typing:PB
Q2(N)
[[Q2]] (..)
:PB
T1oT2
T2 T1
A
M ON
How?
Chaining trans. via query substitution
...
Q1(M)
[[Q1]] (A)
Definitions
Instances
Typing:PB
Q2(N)
[[Q2]] (..)
:PB
T1*T2
T2 T1
A
M ON
Q2(Q1(M))
Q2(T1)
T1oT2 Kleisli mapping composition
:PB
Example of chainingMetamod. Q2(N)Metamod. Q1(M)
CommVehicle
Leisure Vehicle
S
Car+Boat
CVinM
LVinM
SinMCar
Boat
CV+LV
Metamod. O
Vehicle
T1 T2
VinN
S’ U
UinN
Metamod. O
Vehicle
U
VinM
T1oT2
UinM
Boat
Metamod. Q2(Q1(M))
Car+Boat
Car
Car+(Car+Boat)
idCar’
Given data:metamodelstrafo definitiontrafo definitions
Computable data:applied query definition applied query definitionderived mapping
Model T(A)
Metamod. M
Car
Boat
Model A
c:Car
b:Boat 3:LV
Transf. T: Car -> CV*LV, Boat -> LV
2:LV
1:CV
Metamod. NCommut.Vehicle
LeisureVehicle
Traceability mapping
map.TCar+Boat LVinM
c’: Car+Boat
b’: Car+Boat
CVinM
Given data:metamodels & modesltrans. definitionComputable data:queriesrelabeling
3:LVinM2:LVinM
1:CVinM
Constraint transfer
NECSIS Workshops22
:relabel
Metamod. T
same
12:same
[0..1][1] [0..1]
[1]
[0..1]
[1]
[cover][disj]
Constraint transfer Metamod. NMetamod. Mclass X
(commV)
class Y(leisV)
S
A+BidA +R [2] *
XinM
YinM
SinM
class A(Car)
class B(Boat)
RR~+ idB [2]
*X+Y
idX
idY
Metamod. O
class Z(Vehicle)
T1 T2
ZinN
S’U
UinN
Metamod. M
A+B
idA + R [2]
class A(Car)
class B(Boat)
R
R~ + idB [2]
ZinMA+(A+B)
idA
idA+B
T1oT2
R’
idA’ + R’
Metamod. O
class Z(Vehicle)
U
UinM
**
[2] [2]
R’
*
[1]
[2]
[2]
[1]
[2][1]
[1]
[1]
[1]
[1]
[1]Given data:metamodelstrafo definitiontrafo definitionsconstraints
Computable data:applied query definition applied query definitionderived constraintderived constraintderived mapping
[1]*
Transf. = Querying + Relabeling (=View computation)
• Separation of concern• Reuse of the same queries • Analysis
NECSIS Workshops 24
Content
• Intro• Model merge (BM: choice) via colimit• Model join (BM: concurrency) via limit• Model translation via Cartesian monads :) • Composing operations into workflows
NECSIS Workshops 25
Composing operations into workflows
NECSIS Workshops 26
V1+V2T
embed1
embed2
traceability
2:merge 4:transf.
1:meet
V2
V1
• The diagram above (a megamodel) is an algebraic term in diagram algebra -- continuity is to be respected!
• Can be executed• Allow term rewriting (based on laws), hence, optimization
T /\ V2 view def. 2
view def. 1
System
5:meet
integrated view
3:univ.property