1 / 20

From State- to Delta-Based Bidirectional Model Tranformation

From State- to Delta-Based Bidirectional Model Tranformation. Zinovy Diskin, Yingfei Xiong, Krzysztof Czarnecki Generative Software Development Lab The University of Waterloo Canada. Waterloo Model Synchronization Project: Get model sync right! ( :-). Model sync is hard because:

Download Presentation

From State- to Delta-Based Bidirectional Model Tranformation

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. From State- to Delta-Based Bidirectional Model Tranformation Zinovy Diskin,Yingfei Xiong, Krzysztof Czarnecki Generative Software Development Lab The University of Waterloo Canada

  2. Waterloo Model Synchronization Project: Get model sync right! ( :-) Model sync is hard because: • Models are complex & heterog. data struct. • Rel-ships are also complexs and heterog. • .. and often implicit! • Semantics is not clear • Network of model inter-connection is non-trivial (cycles are possible) Space of heterogeneous models and their relationships

  3. This paper addresses a very simple case: • Number of model is extremely simple: n=2 • The relationship is simple: one model is a view to the other A -----> B • Semantics is crystal clear • The corresponding algebraic framework Lenses & Co Ltd. is simple and widely spread. • Nothing to do? ICMT-2010, Malaga

  4. Content of the talk • View update propagation and lenses • State-based BX. Three problems • Deltas do matter • Algebra for update-based BX: u-lenses • Fixing the problems • Conclusions ICMT-2010, Malaga

  5. Deltas (update mappings) do matter Source model: State A View model: State B • One case • = { p1  p1’ p2 p2’ }  • Another case • = { p2p2’ } Source model: State A’ View model: State B bDate=1965-01-01 ICMT-2010, Malaga

  6. Mo-dels Up-dates B1 B0 Update propagation with lenses(Harmony Group; POPL, PODS, ICFP) l A0 B0 :get B A B  :dif :put A’ B’ B’ Roughly, put = dif;put In detail, put(B’,A) = put(,A) = put(dif(A.get, B’)

  7. Problems of state-based (alignment is hidden) frameworks • Automatic alignment may be wrong but tools’ interfaces does not allow the user to control alignment • Sequential composition of state-based BXs may be wrong • Interaction of state-based BX and update composition is difficult to specify (if at all possible) ICMT-2010, Malaga

  8. Problem 1. Automatic alignment may be wrong There are no absolutely reliable keys Homonymy of identification: Key = {fstName, lastName} {fstName, lastName, bDate} {fstName, lastName, bDate, pets, hobby…} SSN!  But fixing a typo creates Synonymy  Thus, dif is almost but still not an algebraic operation. User’s input may be needed but it’s not assumed by the interfaces of sync tool. ICMT-2010, Malaga

  9. Problem 2. What’s wrong with sequential composition of state-based BX k l A0 B0 C0 :k.get :l.get A B C k l :l.put :k.put A’ B’ C’ k.dif(B,B’)  l.dif(B,B’) ICMT-2010, Malaga

  10. PutPut law: How update propagation interacts with update composition l A0 B0 :get A B :put A’ B’ :put :put A’’ B’’ ICMT-2010, Malaga

  11. 1;2={p2p2’’}Id What’s wrong with PutPut Source model: State A View model: State B 1 1 = {p2p2’} Source model: State A’ View model: State B 2 2 = {p2’ p2’’} Source model: State A’’ View model: State B’’ 1965-01-01

  12. (A1 A0) (B0 B1) Delta-based update propagation l A, B are categories, i.e., graphs with composable arrows :get0 B:B0 A:A0 :put b:B1 a:A1 :get1 A’:A0 B’:B0 :get0 ICMT-2010, Malaga

  13. Laws of delta-based upd.prpg :get0 :get0 A B A B :put b1 :put b1;b2 Id Id :get1 A’ B’ :get0 A’ :put b2 B’ :get0 A’’ B’’ put(IdB,A) = IdA (where B=A.get0) put(b1;b2, A) = put(b1, A); put(b2, A’) (where A’=target(put(b1,A)) The same for get The same for get

  14. Summary of laws • Idle updates (identity deltas) are preserved in both directions (GetIdl, PutIdl) • Composition is preserved in both directions (GetGet, PutPut) • Correctness: get of put is the same view updat(PutGet) Definition. An u-lens is given by the following data: -- two categories A, B: nodes are states, arrows are deltas -- functions get0, get1, and put satisfying some or all of the laws. U-lens is well-behavedif (1,3) hold. U-lens is very well-behaved if (2) holds as well. ICMT-2010, Malaga

  15. Problem 1. Solution 3:put 2:user’s input 1:dif B B A 3 1 2 A’ B’ B’

  16. Problem 2. Solution k l A0 B0 C0 :k.get :l.get C A B k k k :l.uput :k.uput A’ B’ C’ No diff in-between k and l ! ICMT-2010, Malaga

  17. Problem 3. Solution: U-lenses with alignment Definition 1.Operation dif: B0xB0-->B1 (DifId) dif(B,B)=1B (DifDif) dif(B, B’,B’’)=dif(B,B’) ; dif(B’,B’’) Def.2.U-lens with alignment (ua-lens) is a pair L=(u,dif) with u a lens A-->B and dif an alignment on B. L is called very wb if u is very wb. L is called very-very wb if dif is also very wb. Theorem 1. Any ua-lens L gives rise to an ordinary s-lens L0. Moreover, if L is very-very wb then L0 is very wb. ICMT-2010, Malaga

  18. Conclusions • Practical: • Alignment and propagation are different problems to be separated & addressed differently • Deltas should be explicit in interfaces of BX tools • Theoretical • Adequate algebraic models of model sync are graph-based • Category theory is inevitable. Particularly, with the same formalism, we can interpret arrows structurally or operationally • Arrow (mapping-based) thinking is fruitful for model sync ICMT-2010, Malaga

  19. Questions/Comments? ICMT-2010, Malaga

  20. Why algebraic models of update propagation are useful • For tool builders: Support a classical rule: First specify then implement • For tool users: Predictability is important for version management • For both: Interfaces are based on adequate specifications ICMT-2010, Malaga

More Related