210 likes | 332 Views
Supporting Parallel Updates with Bidirectional Model Transformations. Yingfei Xiong and Masato Takeichi University of Tokyo, Japan Song Hui Peking University, China Zhenjiang Hu National Institute of Informatics, Japan. Class. Table. Class. Class. Table. name = Book persistent= true.
E N D
Supporting Parallel Updates with BidirectionalModel Transformations YingfeiXiongand Masato Takeichi University of Tokyo, Japan Song Hui Peking University, China Zhenjiang Hu National Institute of Informatics, Japan
Class Table Class Class Table name = Book persistent= true name = Book owner= admin name = Person persistent= true name = Purchase persistent= false name = Person owner= xiong Background: Bidirectional Transformation • Bidirectional transformation maintains the consistency between two models
Forward Transformation Table Table name = Publication owner= xiong name = Book owner= xiong Class name = Publication persistent= true forward A forward transformation updates the target model according to the updated source
Backward Transformation Table name = Publication owner= xiong Class Class name = Book persistent= true name = Publication persistent= true backward A backward transformation updates the source model according to the updated target
Bidirectional Languages relation ClassAndTable { String name; enforce domain uml c:Class{ name=name; persistent=true; } enforce domain dbms t:Table{ name=name; owner=“admin”; } A QVT Program Forward Transformation Backward Transformation
Class Table Class Class Table name = Publication persistent= true name = Book owner= Song name = Person persistent= true name = Purchase persistent= false name = User owner= xiong Parallel Updates • Both models may be updated before any transformation can be applied • Can we handle this using bidirectional transformation?
Class Table Class Class Table name = Publication persistent= true name = Volume owner= admin name = Person persistent= true name = Purchase persistent= false name = Person owner= xiong Parallel Updates • Parallel updates may conflict
How to Synchronize Parallel Updates • In this talk, I will introduce • formal requirements of synchronizing parallel updates • an approach that synchronizes parallel updates using bidirectional transformation with the help of model update representation and model difference approaches
Class Table Class Table Class Table name = Publication persistent= true name = Publication owner= xiong name = Book persistent= true name = Book owner= xiong name = Publication persistent= true name = Book owner= admin Synchronizing Parallel Updates Original Models Updated Models sync Synchronized Models
Class Table Class Table Class Table name = Publication persistent= true name = Book owner= xiong name = Book persistent= true name = Book owner= admin name = Publication persistent= true name = Publication owner= xiong Properties of Synchronizing Parallel Updates: Consistency sync Consistent Output models should be consistent according to the consistency relation R.
Class Table Class Table Class Table name = Book persistent= true name = Book owner= admin name = Book persistent= true name = Book owner= admin name = Book persistent= true name = Book owner= admin Properties of Synchronizing Parallel Updates: Stability sync Equal Equal If no model is changed by users, no model should be changed by the synchronization.
Class Class Table Class Table Table Table name = Book owner= admin name = Book persistent= true name = Publication owner= admin name = Book persistent= true name = Publication owner= admin name = Book persistent= true name = Book owner= admin Properties of Synchronizing Parallel Updates: Preservation sync Preserve name = Publication persistent= true The output model should preserve the user update.
Class Class Class Class name = Volume persistent= true name = Book persistent= true name = Volume persistent= true name = Book persistent= true How to Define Update Preservation • Different updates may lead to the same result • Need to specify what updates we consider • Need to specify how to relate models to the updates rename insert delete
Update Representation and Difference • Model Update Representation [Cicchetti08] • A space of updates • An operation to test whether two updates conflict • An operation compose to compose two non-conflicting updates on the same model • Model Difference [Alanen03,Abi06] • An operation diff to find update by comparing two models
Class Class Class name = Volume persistent= true name = Book persistent= true name = Volume persistent= false Defining Update Preservation • We say that m preserves the update from ma to mbiff exists an update δ where • δ and diff(ma, mb)do not conflict • compose(δ, diff(ma, mb))(ma)=m ma rename diff(ma, mb) mb δ change persistent m
How to Synchronize Parallel Update m n m’ n’ backward temp_m merge forward n’’ m’’ merge(m, m’, m’’) = compose(diff(m, m’), diff(m, temp_m))(m) reports an error when diff(m, m’) and diff(m, temp_m) conflict
Class Table Class Table Class Class name = Book persistent= true name = Book persistent= false name = Book persistent= false name = Book owner= admin name = Book persistent= true name = Book owner= xiong Violating Preservation backward merge forward no element!
Synchronization Algorithm m n m’ n’ backward temp_m test preservation merge forward n’’ m’’
Relation between Properties • Bidirectional transformation properties [Stevens07] lead to synchronization properties Synchronizer forward forward backward backward Correctness Consistency Hippocraticness Stability Preservation
Case Study: Runtime Management Framework High-Level Interface Synchronizer QVT Program Beanbag-based Update Representation and Difference Running System Available at: http://sei.pku.edu.cn/~songhui06/tool-case/rsa/case.html
Conclusion • The requirement of synchronizing parallel updates can be defined through three properties • Consistency • Stability • Preservation • Using existing bidirectional transformations and update representation / model difference approaches, we can construct a synchronizer satisfying the three properties • A case study shows the feasibility of the approach