130 likes | 338 Views
Transformation Patterns. Al, Jean, Jeff, Kerry, Krzysztof, William, ??. Transformation Patterns. What is a transformation pattern? common patterns I have seen structures. Examples. MOF 1.3 EMF more constructs in MOF than in EMF want bi-directional (EMF MOF 1.3)
E N D
Transformation Patterns Al, Jean, Jeff, Kerry, Krzysztof, William, ??
Transformation Patterns • What is a transformation pattern? • common patterns I have seen • structures
Examples • MOF 1.3 EMF • more constructs in MOF than in EMF • want bi-directional (EMF MOF 1.3) • e.g. MOF constraint into EMF annotation • annotation had information on how to go back to EMF • Details • a) Normal EMF MOF is pretty easy • b) But if the annotations have been changed, completing the round-trip is a serious problem • Only allow round-trip if it is consistent; otherwise (a)
More Examples • UML to MOF • UML XMI transform to MOF XMI • example of a tool writing in ATL • UML Activity to BPEL • MOF to JMI • CGI to EJB • JavaDoc • Genealogy data
More Examples… • Cross-compilation • OQL to SQL • etc • Databases • Normalizations • Logical to physical
Common pattern B A C Y X Z
Concrete Example:Database Logical Physical Class Table Attribute Column
Characterizing Transformationsas a whole • 7) HOT (higher order transformation) • 6) Ma Mb (nothing) • 5) Ma Mb Exists MMa – MMp – MMb • 4) Ma Mb MMa “contains” MMb • 3) Ma Mb MMa “in” MMb • 2) Ma Mb MMa = MMb • 1) Ma Ma (within same model)
optimizations codeexpansion Vertical vs. Horizontal Transformations
Kinds of Transformation • Property-Preserving • property P we have P(Ma) implies P(Mb) when Ma Mb • Evolution • platform Ma:MMa Ma’:MMa’ semantics-preserving: Meaning(Ma) = Meaning (Mb) • functional (change in requirements) Ma:MMa Mb:MMa • Compilation • generally semantics-preserving • Optimization • one that is P-preserving, Q-reducing • Refactoring • changing structure, semantics preserving • Its like also optimization (Q is “-ility” or “niceness” metric)
Source Target • Cardinality • all cases • 1:1 1:M M:1 M:M • Effect at type level • Does it increase or decrease number of types • For case ?:M • Homogeneous • Heterogeneous
Explosion/Contraction • State Explosion • Two states • adding intermediate states into a transition • Permutation • Elaborating all combinations of information • Version explosion • multiple models coming in that are variants of each other • Like Query languages • projection • selection • order • transitive closure
Philosophical Interlude • What is different from Functional programming? • In functional programming • main structure is a tree • In Model-driven approach • main structure is a graph • moving from trees to graphs gives more power • (but text can be better than pictures for some uses) • All the meta-models are OO • Working with OO structures – graphs