15
Towards a Framework for Multidirectional Model Transformations Nuno Macedo Alcino Cunha Hugo Pacheco BX 2014 March 28, Athens, Greece

Towards a Framework for Multidirectional Model Transformations

Embed Size (px)

Citation preview

Page 1: Towards a Framework for Multidirectional Model Transformations

Towards a Framework for Multidirectional ModelTransformations

Nuno Macedo Alcino Cunha Hugo Pacheco

BX 2014March 28, Athens, Greece

Page 2: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

MDE

• In MDE models are the primary development artifact;• Multiple models must coexist in a consistent manner;• Keeping two of those models consistent has been a main focusof research in BX;

• However, not all consistency relations can be decomposed intothe BX scenario.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 2 / 15

Page 3: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

QVT-R

• QVT-R is able to specify consistency between any number ofmodels;

• The standard semantics has known issues;• Extensive work has been done on the bidirectional scenario;• However, the multidirectional scenario has been disregarded.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 3 / 15

Page 4: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Multidirectional Scenario

name : StringFeature

name : Stringmandatory: bool

Feature

• Consider the (very simplified) problem of keeping a featuremodel consistent with k configurations;

• Mandatory features MF :• MF CFi : every mandatory feature is selected in every CFi ;• MF FM: features selected in every configuration are set as

mandatory – not representable as BX;

• Optional features OF : selected features must exist in thefeature model.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 4 / 15

Page 5: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Multidirectional QVT-R Checking

• Extension of the bidirectional forall-there-exists quantifierpatterns with a single target;

• One predicate for every model: for all elements in all sourcemodels, there exists at least one element in the target model.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 5 / 15

Page 6: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Multidirectional QVT-R Checking

top relation MF { n : String;domain cf1 s1 : Feature { name = n }domain cf2 s2 : Feature { name = n }domain fm f : Feature { name = n,

mandatory = true } }

CF1 CF2 FM CF1 CF2 FM CF1 CF2 FM

MF FM MF CF1 MF CF2

Nuno Macedo, Alcino Cunha, Hugo Pacheco 6 / 15

Page 7: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Multidirectional QVT-R Checking

∅ name : "f"f1 : Feature

name : "f"mandatory: True

f : Feature

cf 1 cf 2 fm

CF1 CF2 FM

∀ n : String, s1 : Featurecf 1 , s2 : Featurecf 2) |n = s1.name ∧ n = s2.name⇒

(∃ f : Featurefm | n = f .name ∧ f ∈ mandatory)

• Desired behavior.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 7 / 15

Page 8: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Multidirectional QVT-R Checking

∅ name : "f"f1 : Feature

name : "f"mandatory: True

f : Feature

cf 1 cf 2 fm

CF1 CF2 FM

∀ n : String, f : Featurefm, s2 : Featurecf 2 |n = f .name ∧ n = s2.name ∧ f ∈ mandatory⇒

(∃ s1 : Featurecf 1 | n = s1.name)

• Trivially true: no extra conditions would fix it.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 8 / 15

Page 9: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Relation Dependencies

• No fixed combination of dependencies could specify thetransformation intentions;

• OF is not representable: QVT-R does not support asymmetricrelations;

• The model dependencies must be customizable;• We propose an extension to handle these issues.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 9 / 15

Page 10: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Relation Dependencies

• We introduce the notion of consistency dependency;• {M1, ...,M2} → MT , MT 6= Mi ;• A single target model depends on a set of source domains;• Checking semantics runs a predicate for each dependency.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 10 / 15

Page 11: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Example Revisited

• MF : {CF1 CF2 → FM, FM→ CF1, FM→ CF2}

CF1 CF2 FM CF1 CF2 FM CF1 CF2 FM

• OF : {CF1 → FM, CF2 → FM}• Conservative extensions: standard semantics can be easilyimplemented.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 11 / 15

Page 12: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Relation Invocations

• The direction of invocations should follow the direction of thecurrent check;

• Each dependency predicate should invoke relations under thesame dependency;

• May not exist: a relation R can be called by another S if thedependencies of R entail those of S .

Nuno Macedo, Alcino Cunha, Hugo Pacheco 12 / 15

Page 13: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Multidirectional QVT-R Enforcement

• The standard enforcement semantics also follow theforall-there-exists pattern;

• A single target model is generated from all the sources;

•−−→MF : CF1 × CF2 → FM,

−−→MF : CF2 × FM→ CF1,−−→

MF : CF1 × FM→ CF2

• Too restrictive: consider the update of the feature model FM.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 13 / 15

Page 14: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Enforcement Semantics

• In previous work we proposed enforcement semantics based onthe principle of least change;

• Given a consistency relation and a model distance ∆, calculatethe closest consistent model;

• This can be trivially adapted to the multidirectional scenarioconsidering ∆ is generalized;

• The transformation shapes are specified by different ∆;

• E.g., ∆CF1×CF2 gives rise to−−→MF : FM→ CF1 × CF2

Nuno Macedo, Alcino Cunha, Hugo Pacheco 14 / 15

Page 15: Towards a Framework for Multidirectional Model Transformations

Introduction MX Dependencies Conclusion

Conclusions

• We have explored multidirectional transformations underQVT-R and shown that the language is too restrictive;

• We proposed an initial extension that allows the specificationof interesting examples;

• Also improves expressiveness in the bidirectional scenario:allows the definition of asymmetric relations;

• Further work is required to test the expressiveness of thedependency language.

Nuno Macedo, Alcino Cunha, Hugo Pacheco 15 / 15