Analysing Meta-Model Product Lines Esther Guerra, Juan de Lara Universidad Aut´ onoma de Madrid (Spain) Marsha Chechik, Rick Salay University of Toronto (Canada) Esther Guerra Analysing Meta-Model Product Lines SLE 2018 1 / 27
Motivation Meta-model variants Meta-models are used to define modelling languages Different variants of a modelling language depending on scenario, project, goal... Having a meta-model for each variant is challenging to construct, analyse and maintain Esther Guerra Analysing Meta-Model Product Lines SLE 2018 2 / 27
Motivation Example: variants of Petri nets PetriNet PetriNet 1 1 1 1 places trans places trans * * in * * in Different * Place Transition Place * Transition * out itokens: int * realizations 1 out tokens * posTokens inv : self .itokens >= 0 Token tokens as attributes tokens as objects Esther Guerra Analysing Meta-Model Product Lines SLE 2018 3 / 27
Motivation Example: variants of Petri nets PetriNet PetriNet 1 1 1 1 places trans places trans * * in * * in Different * Place Transition Place * Transition * out itokens: int * realizations 1 out tokens * posTokens inv : self .itokens >= 0 Token tokens as attributes tokens as objects PetriNet PetriNet 1 1 trans places * 1 1 * in places trans Place * Transition * * * in out Different Place 1 Transition 1 isHierarchical inv : 1 tokens itokens: int features (self.places→size()> 0 or * out self.trans→size()> 0) Token implies (self.in→size() + posTokens inv : self .itokens >= 0 self.out→size() = 0) state-machine nets hierarchical nets Esther Guerra Analysing Meta-Model Product Lines SLE 2018 3 / 27
Motivation Example: variants of Petri nets PetriNet PetriNet 1 1 1 1 places trans places trans * * in * * in Different * Place Transition Place * Transition * out itokens: int * realizations 1 out tokens * posTokens inv : self .itokens >= 0 Token tokens as attributes tokens as objects 8 possible meta-models PetriNet PetriNet 1 1 trans places * 1 1 * in places trans Place * Transition * * * in out Different Place 1 Transition 1 isHierarchical inv : 1 tokens itokens: int features (self.places→size()> 0 or * out self.trans→size()> 0) Token implies (self.in→size() + posTokens inv : self .itokens >= 0 self.out→size() = 0) state-machine nets hierarchical nets Esther Guerra Analysing Meta-Model Product Lines SLE 2018 3 / 27
Motivation Meta-model product lines (MMPLs) Meta-model product line: compact representation of all meta-model variants Esther Guerra Analysing Meta-Model Product Lines SLE 2018 4 / 27
Motivation Meta-model product lines (MMPLs) Meta-model product line: compact representation of all meta-model variants Feature Model Valid feature configurations: PetriNets Simple xor Object StateMachine is optional Tokens StateMachine Hierarchical Hierarchical is optional Simple Object Esther Guerra Analysing Meta-Model Product Lines SLE 2018 4 / 27
Motivation Meta-model product lines (MMPLs) Meta-model product line: compact representation of all meta-model variants 150-Meta-Model Presence conditions PetriNet Cardinality modifiers 1 net net 1 not Hierarchical min [del] max places * * trans StateMachine in Place [min=1, max=1] Inheritance modifiers * Transition * StateMachine Simple itokens: int add out [min=1, max=1] 1 del isHierarchical inv : Object (self.places→size() > 0 or tokens * Simple self.trans→size() > 0) posTokens inv : Token implies (self.in→size() + self.itokens >= 0 Object self.out→size() = 0) Esther Guerra Analysing Meta-Model Product Lines SLE 2018 4 / 27
Motivation Meta-model product lines (MMPLs) Meta-model product line: compact representation of all meta-model variants Feature Configuration Meta-Model Derivation < Object, Hierarchical > PetriNet 1 1 places trans * * in Place Transition * * out 1 isHierarchical inv : tokens (self.places→size()> 0 or * self.trans→size()> 0) Token implies (self.in→size() + self.out→size() = 0) Esther Guerra Analysing Meta-Model Product Lines SLE 2018 4 / 27
Motivation Correctness of MMPLs How to ensure a MMPL is correct? 1 ensure each meta-model is syntactically correct e.g., the target class of each meta-model reference belongs to the meta-model 2 ensure desirable properties in meta-model instances e.g., instantiability There are well-known techniques to analyse this for a single meta-model. However, generating and analysing each meta-model in the MMPL separately is time-consuming... Esther Guerra Analysing Meta-Model Product Lines SLE 2018 5 / 27
Contribution We lift meta-model analysis techniques to the product line level: syntactic analysis of meta-models satisfiability checking of meta-model properties in order to improve performance Based on a declarative notion of MMPL considers OCL well-formedness constraints amenable to automated analysis Tool support Evaluation of effectiveness of lifted analyses Esther Guerra Analysing Meta-Model Product Lines SLE 2018 6 / 27
Ensuring Well-formedness of Meta-Model Product Lines Esther Guerra Analysing Meta-Model Product Lines SLE 2018 7 / 27
Ensuring MMPL well-formedness Lifted analysis of well-formed structure Every field is owned by one class How: PC of field = ⇒ PC of its owner-class Every reference points to a class How: PC of reference = ⇒ PC of its target-class Cardinality and inheritance are uniquely determined How: PC of min i ∧ PC of min j is unsat (similar for max, inheritance) There are no inheritance cyles How (roughly): given a cycle in the 150MM, the conjunction of the PC of each inheritance relation is unsat Esther Guerra Analysing Meta-Model Product Lines SLE 2018 8 / 27
Ensuring MMPL well-formedness Lifted syntactic analysis of invariants If an invariant is present, the accessed elements are also present How: PC of invariant = ⇒ PC of accessed fields + owner classes Example: PC of self.itokens > = 0 = ⇒ PC of itokens and PC of Place Simple = ⇒ Simple ∧ true Operators are applied on fields with appropriate cardinality How: if a collection operator is applied on a field, the PC of invariant ∧ PC of any max=1 is unsat Esther Guerra Analysing Meta-Model Product Lines SLE 2018 9 / 27
Analysing Properties of Meta-Model Instances Esther Guerra Analysing Meta-Model Product Lines SLE 2018 10 / 27
Analysing instance properties Meta-model validation by model finding Is the set of models accepted by a meta-model the one intended? … … property P MM m 1 L(MM) m 1 P In the simplest case, if P is empty, this method permits assessing whether a meta-model has instances. Esther Guerra Analysing Meta-Model Product Lines SLE 2018 11 / 27
Analysing instance properties MMPL validation Is the set of models accepted by each meta-model the one intended? property P MMPL Prod(MMPL) … … MM 1 MM i MM n m 1 L(MM 1 ) L(MM i ) L(MM n ) m 1 P In the simplest case, if P is empty, this method permits assessing whether some meta-model in the MMPL has instances. Esther Guerra Analysing Meta-Model Product Lines SLE 2018 12 / 27
Analysing instance properties Classification of property types Property specification structural mixed Esther Guerra Analysing Meta-Model Product Lines SLE 2018 13 / 27
Analysing instance properties Classification of property types Property Search strategy specification structural mixed Search Property satisfiability scope Config Feature exists m forAll m scope exercising notExists m partial total Esther Guerra Analysing Meta-Model Product Lines SLE 2018 13 / 27
Analysing instance properties Classification of property types Property Result Search strategy specification Decision structural mixed Search Property Artefact condition satisfiability scope exists MM forAll MM Solutions Config Feature Type exists m forAll m ing scope exercising notExists MM notExists m one all model config partial total Esther Guerra Analysing Meta-Model Product Lines SLE 2018 13 / 27
Analysing instance properties Property types Some analyses of interest (8 more in the paper): MMPL instantiability: configuration that yields an instantiable MM Configuration: < one, config, total, exists m > Global invariant: is a property satisfied by every model of every MM? Example: all Petri nets have at least one place Configuration: < forAll MM , forAll m , ... > Property: Place.all() → notEmpty() Safety property: is a property satisfied by no model? Example: no model has isolated transitions Configuration: < forAll MM , notExists m , ... > Property: Transition.all() → exists(in → isEmpty() and out → isEmpty()) Esther Guerra Analysing Meta-Model Product Lines SLE 2018 14 / 27
Analysing instance properties Property types We also consider mixed properties Example: Are transitions with one input only possible on state machines? Configuration: < mixed, ... > Property: Transition.all() → forAll(in → size() = 1) implies StateMachine Esther Guerra Analysing Meta-Model Product Lines SLE 2018 15 / 27
Recommend
More recommend