1 / 26

Model Translation and Mapping in .NECSIS Workshop

Explore source-to-target model translation, metamodels, and mappings in the .NECSIS Workshop on March 10th. Understand the process and benefits of traceability mappings for model translations.

Download Presentation

Model Translation and Mapping in .NECSIS Workshop

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. NECSIS Workshop March 10

  2. Source-to-target model transf. Metamodel M Transf. def. T Metamodel N T(A) :execute T A T(B) :execute T … B … … Space of M’s instances (models), [[ M]] Space of N’s instances (models), [[ N]] Space mapping [[T]]: [[M]] --> [[N]] • Color Legend: • given data • computed data

  3. Towards Relational Algebra for Model Translations (just started) Waterloo: Krzysztof Czarnecki, Michal Antkiewicz, Peiyuan Sun McMaster: Hamid Gholizadeh, Sahar Kokaly, Tom Maibaum Zinovy Diskin

  4. Content • New view of model translation • more abstract • transf. becomes a formal object manipulate analyze …..

  5. Source-to-target model transf. Metamodel M Transf. def. T Metamodel N T(A) :execute T A T(B) :execute T … B … … Space of M’s instances (models), [[ M]] Space of N’s instances (models), [[ N]] Space mapping [[T]]: [[M]] --> [[N]] • Color Legend: • given data • computed data

  6. Model translation w/out traceability mappings physical objects object roles Transf. T1: Car -> CV*LV Boat -> LV and Metamod. M Metamod. N Car Commut. Vehicle 1 idA 1 R 1 S 1 Boat idB Leisure Vehicle up to iso Model A Model T(A) c:Car cv:CV xy:S xy’:S cb:R aa:idA s:S ab:R b:Boat lv:LV lv’:LV bb:idB

  7. Model translation w/out traceability mappings physical objects object roles Transf. T1: Car -> CV*LV Boat -> LV and Transf. T2: Car -> LV Boat -> CV*LV Metamod. M Metamod. N Car Commut. Vehicle 1 idA 1 R 1 S 1 Boat idB Leisure Vehicle Model A Model T(A) c:Car cv:CV cv:CV xy:S xy’:S cb:R aa:idA s:S ab:R b:Boat lv’:LV lv:LV lv:LV lv’:LV bb:idB up to iso Theorem. [[ T1]] ≅ [[ T2 ]], where [[T1,2]]: [[M]] --> [[N]] are space functionsgenerated by T1,2 T1(A) ≅T2(A) lv’:LV

  8. Model translation with traceability mappings physical objects object roles Transf. T1: Car -> CV*LV Boat -> LV and Transf. T2: Car -> LV Boat -> CM*LV Metamod. M Metamod. N Car Commut. Vehicle 1 idA 1 R 1 S 1 Boat idB Leisure Vehicle Traceability mappings Traceability links Model A Tr1(A) ≠ Tr2(A) Model T(A) c:Car cv:CV cv:CV xy:S xy’:S cb:R aa:idA s:S ab:R b:Boat lv’:LV lv:LV lv:LV lv’:LV bb:idB Theorem. [[ T1]] ≅ [[ T2 ]], where T1,2: [[M]] --> [[N]] are space functionsgenerated by T1,2 T1(A) ≅T2(A) Theorem. [[ T1]] ≠ [[ T2 ]], where T1,2: [[M]] --> ([[N]] x Map([[ N]] ,[[ M]] )) are two-valued (instance x map) functionsgenerated by T1,2

  9. 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

  10. Typing: What we have physical objects object roles Transf. T1: Car -> CV*LV, Boat -> LV Metamod. M Metamod. N Car Commut. Vehicle 1 R S 1 Boat Leisure Vehicle ?? • Color Legend: • given data • given data • computed data Typing mapping Typing mapping Traceability mapping xy:S Model A Model T(A) xy’:S aa:idA s:S c:Car ab:R cv:CV bb:idB cb:R b:Boat lv:LV lv’:LV

  11. Typing: What we want Transf. T1: Car -> CV*LV, Boat -> LV physical objects object roles Transf. definition mappings Metamod. M Metamod. N Car Commut. Vehicle 1 R S 1 Boat Leisure Vehicle Typing mapping Typing mapping xy:S Model A Model T(A) xy’:S aa:idA s:S c:Car ab:R cv:CV bb:idB cb:R b:Boat lv:LV lv’:LV Traceability mapping

  12. Issues to manage Transf. T1: Car -> CV*LV, Boat -> LV physical objects object roles Transf. definition mappings Metamod. M Metamod. N • 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?) Commut. Vehicle Car Leisure Vehicle Boat Typing mapping Typing mapping Model A Model T(A) c:Car cv:CV cb:R b:Boat lv:LV lv’:LV Traceability mapping NECSIS Workshops 12

  13. Dynamics via mappings: Queries Transf. T: Car -> CV*LV, Boat -> LV Metamod. T Metamod. N Metamod. M 1 Commut. Vehicle 0..1 Car CVinM 1 map.T 1 same R S Car+Boat 1 LVinM 0..1 Leisure Vehicle :relabel Boat • Given data: • metamodels & modesl • trans. definition • Computable data: • queries • relabeling [=] xy:S xy’:S aa:idA s:S ab:R Model A Model T(A) bb:idB c’: Car+Boat 1:CVinM c:Car 1:CV 2:LVinM 12:same 3:LVinM b’: Car+Boat b:Boat 2:LV 3:LV Traceability mapping

  14. Algebra and reuse [inj] M Q(M) T1 N Definitions ... T2 Typing :PB [key] U2 A [[Q]] (A) Instances [inj] Relabeling as “pulling Q(M) back” (pullback)

  15. Algebra of MTs: T1 \/disjT2 CVinM map.T LVinM T1 \/disj T2 Metamod. M Metamod. N T1 Car Leisure Vehicle Commut. Vehicle 1 R S • Given data: • metamodels & modesl • trans. definition • Computable data: • queries • relabeling Car+Boat 1 T2 Boat Typing mapping [=] xy:S xy’:S aa:idA Model T(A) s:S ab:R Model A bb:idB 1:CV c’: Car+Boat c:Car 2:LV 3:LV b’: Car+Boat 3’:LV b:Boat 2’:LV 1’:CV Traceability mapping

  16. Algebra of MTs: T1 /\T2 and T1 \/ T2 Transf. T: Car -> CV*LV, Boat -> LV CVinM map.T LVinM Metamod. M T1 \/ T2 Metamod. N T1 Car Leisure Vehicle Commut. Vehicle • Given data: • metamodels & modesl • trans. definition • Computable data: • queries • relabeling 1 R T1/\ T2 S Car+Boat 1 T2 Boat Typing mapping [=] xy:S xy’:S aa:idA s:S ab:R Model A Model T(A) bb:idB c’: Car+Boat c:Car 1:CV 2:LV 3:LV 2:LV 3:LV b’: Car+Boat b:Boat 1’:CV Traceability mapping

  17. Algebra of MTs: T1 /\T2 and T1 \/ T2 CVinM LVinM Metamod. M T1 \/ T2 Metamod. N T1 Car T1/\ T2 T1 /\ T2(A) = T1(A) /\ T2(A) Car+Boat Leisure Vehicle Commut. Vehicle 1 T2 R T1\/ T2(A) = T1(A) \/ T2(A) S 1 Boat T1 (A) \/ T2 (A) T1 \/ T2 T1(A) T1 T2(A) T2 xy:S T1(A)/\ T2(A) T1/\ T2 xy’:S aa:idA s:S ab:R Model A Model T(A) bb:idB c’: Car+Boat c:Car 1:CV 2:LV 3:LV b’: Car+Boat b:Boat 1’:CV Traceability mapping

  18. Algebra of MTs. Chaining (seq. composition) [inj] T1oT2 T2 Definitions :PB Q2(N) Q1(M) O N M T1 T2 ... Typing :PB :PB [key] U2 Instances [inj] [[Q1]] (A) [[Q2]] (..) A

  19. Chaining transf. via mapping composition How? [inj] T1oT2 T2 Definitions Q2(N) Q1(M) O N M T1 T2 ... Typing :PB :PB [key] U2 Instances [inj] [[Q1]] (A) [[Q2]] (..) A

  20. Chaining trans. via query substitution T1*T2 [inj] Definitions Kleisli mapping composition T1oT2 Q2(Q1(M)) T2 :PB Q2(N) Q2(T1) Q1(M) O N M T1 T2 ... Typing :PB :PB [key] U2 Instances [inj] [[Q1]] (A) [[Q2]] (..) A

  21. Example of chaining • Given data: • metamodels & modesl • trans. definition • Computable data: • queries • relabeling Metamod. Q2(N) Metamod. Q1(M) T1 T2 Metamod. O Metamod. O Car Comm Vehicle CVinM VinN SinM 2 Vehicle Vehicle CV+LV [2] S T1: A -> X*Y, R->S, IdA->S; B-> Y; * UinN * * LVinM Car+Boat * Leisure Vehicle +B [2] S’ U Boat • Given data: • metamodels • trafo definition • trafo definitions • Computable data: • applied query definition • applied query definition • derived mapping idA Traceability mappings Metamod. Q2(Q1(M)) R’ T1oT2 Car idA + R idA+B VinM 2 Car+(Car+Boat) R~ + idB :m_G [2] UinM Car+Boat [2] * idCar’ U Boat

  22. Constraint transfer Transf. T: Car -> CV*LV, Boat -> LV Metamod. T Metamod. N Metamod. M 1 Commut. Vehicle 0..1 Car [0..1] CVinM 1 map.T [1] 1 [0..1] [cover] same R S Car+Boat [1] 1 [disj] LVinM 0..1 Leisure Vehicle [1] :relabel Boat [0..1] • Given data: • metamodels & modesl • trans. definition • Computable data: • queries • relabeling [=] xy:S xy’:S aa:idA s:S ab:R Model A Model T(A) bb:idB c’: Car+Boat 1:CVinM c:Car 1:CV 2:LVinM 12:same 3:LVinM b’: Car+Boat b:Boat 2:LV 3:LV Traceability mapping

  23. Constraint transfer • Given data: • metamodels & modesl • trans. definition • Computable data: • queries • relabeling Metamod. N Metamod. M T1 T2 Metamod. O Metamod. O class A (Car) class X (commV) idX XinM [1] [1] ZinN * SinM [1] 2 class Z (Vehicle) class Z (Vehicle) [1] S X+Y T1: A -> X*Y, R->S, IdA->S; B-> Y; [2] idA +R UinN [1] [2] * R * YinM [1] * A+B [2] idY class Y (leisV) [2] +B S’ [1] R~+ idB [1] [2] U R’ class B (Boat) [1] • Computable data: • applied query definition • applied query definition • derived constraint • derived constraint • derived mapping • Given data: • metamodels • trafo definition • trafo definitions • constraints Traceability mappings Metamod. M T1oT2 class A (Car) idA [1] ZinM 2 A+(A+B) idA + R [2] :m_G R UinM [2] * * [1] [2] A+B idA+B R~ + idB idA’+ R’ [2] U class B (Boat) R’

  24. Transf. = Querying + Relabeling (=View computation) • Separation of concern • Reuse of the same queries • Analysis

  25. Content • Intro • Model merge (BM: choice) via colimit • Model join (BM: concurrency) via limit • Model translation via Cartesian monads :) • Composing operations into workflows

  26. Composing operations into workflows V2 T /\ V2 view def. 2 System embed2 5:meet 1:meet view def. 1 2:merge 4:transf. T V1+V2 embed1 V1 traceability 3:univ.property integrated view • 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

More Related