Analysing Meta-Model Product Lines Esther Guerra, Juan de Lara - - PowerPoint PPT Presentation

analysing meta model product lines
SMART_READER_LITE
LIVE PREVIEW

Analysing Meta-Model Product Lines Esther Guerra, Juan de Lara - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

Analysing Meta-Model Product Lines

Esther Guerra, Juan de Lara

Universidad Aut´

  • noma de Madrid (Spain)

Marsha Chechik, Rick Salay

University of Toronto (Canada)

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 1 / 27

slide-2
SLIDE 2

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

slide-3
SLIDE 3

Motivation

Example: variants of Petri nets

Different realizations

posTokens inv: self.itokens >= 0 Place

itokens: int in

Transition

  • ut

* * places 1 * trans * 1

PetriNet

tokens as attributes

Place

in

Transition

  • ut

* *

Token

tokens * 1 places 1 trans * 1

PetriNet

*

tokens as objects

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 3 / 27

slide-4
SLIDE 4

Motivation

Example: variants of Petri nets

Different realizations

posTokens inv: self.itokens >= 0 Place

itokens: int in

Transition

  • ut

* * places 1 * trans * 1

PetriNet

tokens as attributes

Place

in

Transition

  • ut

* *

Token

tokens * 1 places 1 trans * 1

PetriNet

*

tokens as objects

Different features

Place

in

Transition

  • ut

* * places 1 * trans * 1

PetriNet Token

tokens * 1

isHierarchical inv: (self.places→size()> 0 or self.trans→size()> 0) implies (self.in→size() + self.out→size() = 0)

hierarchical nets

Place

itokens: int in

Transition

  • ut

1 1

posTokens inv: self.itokens >= 0

places 1 trans 1

PetriNet

* *

state-machine nets

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 3 / 27

slide-5
SLIDE 5

Motivation

Example: variants of Petri nets

Different realizations

posTokens inv: self.itokens >= 0 Place

itokens: int in

Transition

  • ut

* * places 1 * trans * 1

PetriNet

tokens as attributes

Place

in

Transition

  • ut

* *

Token

tokens * 1 places 1 trans * 1

PetriNet

*

tokens as objects

Different features

Place

in

Transition

  • ut

* * places 1 * trans * 1

PetriNet Token

tokens * 1

isHierarchical inv: (self.places→size()> 0 or self.trans→size()> 0) implies (self.in→size() + self.out→size() = 0)

hierarchical nets

Place

itokens: int in

Transition

  • ut

1 1

posTokens inv: self.itokens >= 0

places 1 trans 1

PetriNet

* *

state-machine nets

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 3 / 27

8 possible meta-models

slide-6
SLIDE 6

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

slide-7
SLIDE 7

Motivation

Meta-model product lines (MMPLs)

Meta-model product line:

compact representation of all meta-model variants Feature Model

PetriNets Tokens Simple Object Hierarchical     ฀  ฀   StateMachine

Valid feature configurations: Simple xor Object StateMachine is optional Hierarchical is optional

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 4 / 27

slide-8
SLIDE 8

Motivation

Meta-model product lines (MMPLs)

Meta-model product line:

compact representation of all meta-model variants 150-Meta-Model

in

posTokens inv: self.itokens >= 0 Place

itokens: int

PetriNet Transition

  • ut

places Simple 1 * trans * 1

Token

tokens * 1 Object Object

isHierarchical inv: (self.places→size() > 0 or self.trans→size() > 0) implies (self.in→size() + self.out→size() = 0)

Simple StateMachine [min=1, max=1] StateMachine [min=1, max=1] * * net net not Hierarchical [del]

Presence conditions Cardinality modifiers

min max

Inheritance modifiers

add del

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 4 / 27

slide-9
SLIDE 9

Motivation

Meta-model product lines (MMPLs)

Meta-model product line:

compact representation of all meta-model variants Feature Configuration <Object, Hierarchical> Meta-Model Derivation

Place

in

Transition

  • ut

* * places 1 * trans * 1

PetriNet Token

tokens * 1

isHierarchical inv: (self.places→size()> 0 or self.trans→size()> 0) implies (self.in→size() + self.out→size() = 0)

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 4 / 27

slide-10
SLIDE 10

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

slide-11
SLIDE 11

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

slide-12
SLIDE 12

Ensuring Well-formedness

  • f

Meta-Model Product Lines

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 7 / 27

slide-13
SLIDE 13

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 mini ∧ PC of minj 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

slide-14
SLIDE 14

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

slide-15
SLIDE 15

Analysing Properties

  • f

Meta-Model Instances

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 10 / 27

slide-16
SLIDE 16

Analysing instance properties

Meta-model validation by model finding

Is the set of models accepted by a meta-model the one intended?

MM property P m1 m1 P

… …

L(MM)

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

slide-17
SLIDE 17

Analysing instance properties

MMPL validation

Is the set of models accepted by each meta-model the one intended?

MM1 property P MMPL MMi Prod(MMPL)

MMn

L(MM1) L(MMn) L(MMi) m1 m1 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

slide-18
SLIDE 18

Analysing instance properties

Classification of property types

Property specification structural mixed

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 13 / 27

slide-19
SLIDE 19

Analysing instance properties

Classification of property types

Property specification structural mixed

Search strategy Property satisfiability Search scope existsm forAllm Config scope Feature exercising total partial notExistsm

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 13 / 27

slide-20
SLIDE 20

Analysing instance properties

Classification of property types

Property specification structural mixed

Search strategy Property satisfiability Search scope existsm forAllm Config scope Feature exercising total partial notExistsm Solutions Result model config

  • ne all

ing Artefact Decision condition existsMM forAllMM notExistsMM Type

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 13 / 27

slide-21
SLIDE 21

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, existsm > Global invariant: is a property satisfied by every model of every MM? Example: all Petri nets have at least one place Configuration: < forAllMM, forAllm, ... > Property: Place.all()→notEmpty() Safety property: is a property satisfied by no model? Example: no model has isolated transitions Configuration: < forAllMM, notExistsm, ... > Property: Transition.all()→exists(in→isEmpty() and out→isEmpty())

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 14 / 27

slide-22
SLIDE 22

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

slide-23
SLIDE 23

Lifted analysis of meta-model instances

(1) Encoding of MMPL as a regular meta-model

Feature-explicit meta-model

in

posTokens inv: fm.Simple implies self.itokens >= 0 wc-tokens inv: if not fm.Object then self.tokens→size() = 0 else self.tokens→size() >= 0 endif wc-itokens inv: if not fm.Simple then self.itokens.oclIsUndefined() else not self.itokens.oclIsUndefined() endif wc-net inv: not fm.Hierarchical implies not self.net.oclIsKindOf(Transition) Place

itokens[0..1]: int

PetriNet Transition

  • ut

places 1 * trans * 1

Token

tokens * 1 * *

BC

1 fm

isHierarchical inv: fm.Hierarchical implies ((self.places→size() > 0 or self.trans→size() > 0) implies (self.in→size() + self.out→size() = 0)) wc-in inv: fm.StateMachine implies self.in→size() = 1 wc-out inv: fm.StateMachine implies self.out→size() = 1 wc-del-inh inv: not fm.Hierarchical implies (self.places→size() = 0 and self.trans→size() = 0) wc-net inv: not fm.Hierarchical implies not self.net.oclIsKindOf(Transition) FMC

Simple: boolean Tokens: boolean Hierarchical: boolean Object: boolean StateMachine: boolean PetriNet: boolean

ΦMMPL inv: PetriNets and Tokens and ((Simple and not Object) or (not Simple and Object)) wc-Token inv: not Object implies Token.allInstances()→size() = 0

net net

150MM Feature model is class FMC, where features are booleans PCs and modifiers are invariants Property to check is invariant

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 16 / 27

slide-24
SLIDE 24

Lifted analysis of meta-model instances

(2) Analysing feature-explicit meta-model

Look for an instance of the FEMM using a model finder MMPL instantiability, weak properties (MMs where some model satisfies P): finding a solution implies satisfaction

:PetriNet :Place :Token :FMC Simple=false Object=true Tokens=true Hierarchical=false StateMachine=false PetriNet=true

feature-explicit model

:PetriNet :Place :Token

model configuration

+

extract

Safety properties (MMs where no model satisfies P): find all configs where some model satisfies P, and then return the rest Global invariants (MMs where all models satisfy P): find all configs where some model satisfies not P, and then return the rest

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 17 / 27

slide-25
SLIDE 25

Tooling

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 18 / 27

slide-26
SLIDE 26

Eclipse plugin: http://miso.es/tools/merlin Feature model specified with FeatureIDE 150MM specified as an Ecore meta-model with annotations Static analysis of OCL uses Eclipse OCL project and Sat4J USE Validator model finder

Merlin

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 19 / 27

slide-27
SLIDE 27

Evaluation

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 20 / 27

slide-28
SLIDE 28

Evaluation

Efficiency of syntactic analysis

Enumerative approach vs Lifted analysis

Name #Feats #MMs #classes/#invs /#PCs/#modifs Lifted time Enum time Running example 6 8 4/2/5/2 0,039s 0,19s

Relational DDBB

10 24 7/0/17/0 0,094s 0,45s

Graphs [29]

16 256 5/6/14/3 0,103s 22,36s

Automata

20 2.016 6/5/18/0 0,135s 102,9s

Role modelling [27]

48 >2.395.000 40/0/32/9 0,735s >1h

= ⇒ Lifted analysis was much faster

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 21 / 27

slide-29
SLIDE 29

Evaluation

Efficiency of instance property analysis

Enumerative approach vs Lifted analysis MMPL instantiability (finding an instantiable meta-model)

Enumerative approach:

1

generate product meta-model

2

check meta-model instantiability by model finding

3

if the meta-model has instances, conclude

4

else, go to 1

22 variants of the Automata MMPL, each with a different percentage

  • f instantiable meta-models

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 22 / 27

slide-30
SLIDE 30

Evaluation

Efficiency of instance property analysis

1 10 100 1000 10000 100000 20 40 60 80 100 TIME (MS) % INSTANTIABLE META-MODELS Lifted average

  • Enum. average
  • Enum. best
  • Enum. worst

Lifted analysis is (up to 1.000x) faster if <85% instantiable MMs In the rest of cases, lifted analysis is slightly slower (120 vs 100 ms) Rationale: 1 more complex search (lift.) vs many simpler searches (enum.) = ⇒ The fewer MMs satisfy a property, the faster lifted analysis is

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 23 / 27

slide-31
SLIDE 31

Conclusions and Future Work

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 24 / 27

slide-32
SLIDE 32

Summary

MMPLS: Declarative specification of meta-model variants Lifting of existing meta-model analysis techniques to the PL level

syntactic correctness of meta-models checking properties on meta-model instances

Initial implementation and evaluation

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 25 / 27

slide-33
SLIDE 33

Current and next steps

Transformation product lines, coupled to MMPLs

Model transformation product lines. Juan de Lara, Esther Guerra, Marsha Chechik, Rick

  • Salay. Proc. of ACM/IEEE MoDELS’18. pp. 67-77. ACM.

Extend definition of MMPL with type modifiers for references Expand analyses, e.g., to discover subsumption of MM variants Extend the evaluation for other kinds of properties

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 26 / 27

slide-34
SLIDE 34

Analysing Meta-Model Product Lines

Esther Guerra, Juan de Lara

Universidad Aut´

  • noma de Madrid (Spain)

Marsha Chechik, Rick Salay

University of Toronto (Canada)

esther.guerra@uam.es http://miso.es/tools/merlin

Questions?

Esther Guerra Analysing Meta-Model Product Lines SLE 2018 27 / 27