Meta-model Pruning Sagar Sen, Naouel Moha, Benoit Baudry, Jean-Marc - - PowerPoint PPT Presentation

meta model pruning
SMART_READER_LITE
LIVE PREVIEW

Meta-model Pruning Sagar Sen, Naouel Moha, Benoit Baudry, Jean-Marc - - PowerPoint PPT Presentation

Meta-model Pruning Sagar Sen, Naouel Moha, Benoit Baudry, Jean-Marc Jzquel Equipe TRISKELL, INRIA Rennes Bretagne-Atlantique October 3-9, MODELS 2009 Denver Colorado 1 Outline Where do large meta-models come from? Why a need to


slide-1
SLIDE 1

Meta-model Pruning

Sagar Sen, Naouel Moha, Benoit Baudry, Jean-Marc Jézéquel Equipe TRISKELL, INRIA Rennes Bretagne-Atlantique October 3-9, MODELS 2009 Denver Colorado

1

slide-2
SLIDE 2

Outline

 Where do large meta-models come from?  Why a need to extract subsets of large meta-models ?  How to prune a meta-model to obtain subsets called

effective meta-models ?

 What are the type properties of effective meta-models ?  Illustrative Case Study : French Space Agency

Transformation Input Meta-model

 Conclusion

2

slide-3
SLIDE 3

Where do large me Where do large meta-models come fr ta-models come from?

  • m?

A widely used large meta-model is that of a General Purpose Modelling Language such as the UML

3

slide-4
SLIDE 4

Wh Why is the UML me y is the UML meta-model large? (1) ta-model large? (1)

About 389 official participating stakeholders… Member Space

Contribute to / use…

4

slide-5
SLIDE 5

Wh Why is the UML me y is the UML meta-model large? (2) ta-model large? (2)

Tool Space Editors: Topcased, StarUML, ArgoUML… Code generators: Acceleo, BOUML, Eclipse.. Transformation Tech: Kermeta EMF ATL … Conform to & Use

5

slide-6
SLIDE 6

UML is gr UML is growing t wing to address domain-specif

  • address domain-specific

ic needs… needs…

Domain specific needs have led to the extension of UML to UML Profiles…

UML Testing Profile Real-time Embedded Systems Service Modelling Distributed Objects

6

slide-7
SLIDE 7

Com Comple plexity of UML xity of UML

Very large meta-model spec. : 246 Classes, 583 properties Too large and complex to learn and adopt… Source: Wikipedia on UML Not conducive to application

  • f formal methods…

Infact, many tools need and use

  • nly a small subset of

UML !

7

slide-8
SLIDE 8

Outline

 Where do large meta-models come from?  Why a need to extract subsets of large meta-

models ?

 How to prune a meta-model to obtain subsets called

effective meta-models ?

 What are the type properties of effective meta-models ?  Illustrative Case Study : French Space Agency

Transformation Input Meta-model

 Conclusion

8

slide-9
SLIDE 9

Scenario 1: Why need subsets? UML in Software Process

Rational Unified Process

Analysis Model Design Model Use Case Model Depl. Model Impl. Model Test Model

9

slide-10
SLIDE 10

Scenario 1: RUP models via UML

UML Diagrams

Analysis Model Design Model Class Diagram Component Diagram Use Case Diagram Sequence Diagram Collaboration Diagram Statechart Diagram Use Case Model Depl. Model Impl. Model Test Model Activity Diagram

10

slide-11
SLIDE 11

Scenario 1: RUP models via UML

UML Diagrams

Analysis Model Design Model Class Diagram Component Diagram Use Case Diagram Sequence Diagram Collaboration Diagram Statechart Diagram Use Case Model Depl. Model Impl. Model Test Model Activity Diagram

11

slide-12
SLIDE 12

Scenario 2: Why need subsets? Chain of Model Transformations

MT1 MT2

  • utput domain

conforms to input domain conforms to Large Meta-model Eg: UML Are outputs of MT1 valid inputs for MT2? Do the models use the same concepts? We need to compare subsets first.

12

slide-13
SLIDE 13

Scenario 3

Existence of hand-made subsets of UML

Executable UML Google search : “UML subset“ You will find at least 1,450 hits (done on Sept. 17,2009) screaming out the use of UML subsets… UML subset for FPGA UML subset for Model-based Testing Model checking for executable UML subset ICONIX Process: A Core UML subset and many more…

13

slide-14
SLIDE 14

Outline

 Where do large meta-models come from?  Why extract subsets of large meta-models ?  How to prune a meta-model to obtain subsets

called effective meta-models ?

 What are the type properties of effective meta-models ?  Illustrative Case Study : French Space Agency

Transformation Input Meta-model

 Conclusion

14

slide-15
SLIDE 15

Prune based on required concepts

Effective Meta-model

  • 1. Large Meta-model

INPUT OUTPUT

MM MMe

Meta-model Pruner

  • 2. Initial Required Types

(Classes, Enumerations, Primitives) Tinitial

  • 3. Initial Required Properties

Pinitial

15

Where does this come from? Static Analysis of a Model Transformation

  • r

Manually Specified

slide-16
SLIDE 16

Pruning controlled by options

Effective Meta-model

  • 1. Large Meta-model

INPUT OUTPUT

MM MMe

Meta-model Pruner

  • 2. Initial Required Types

(Classes, Enumerations, Primitives) Tinitial

  • 3. Initial Required Properties

Pinitial

OPTIONS

16

slide-17
SLIDE 17

Meta-model Pruning Internals

Meta-model Pruner So, what is pruned?

17

slide-18
SLIDE 18

Meta-model Pruning

  • 1. Rules to find set of required types (classes,

enumerations, primitives)

  • 2. Rules to find set of required properties
  • 3. Optional rules to add additional types/properties
  • 4. Repeat 1,2,3 until rules cannot be applied

anymore Lets look at some of these rules…

18

slide-19
SLIDE 19

Meta-model Pruning

Couple of rules to conserve types…

19

slide-20
SLIDE 20

Finding Required Types Rule: Conser ule: Conserve Initial R e Initial Req equired Class uired Class

Classi

Conserve in Tinitial  Treq Classi Treq + , if Classi

20

slide-21
SLIDE 21

Finding Required Types Rule: Conser ule: Conserve All Super Classes of e All Super Classes of Req equired Class uired Class

Conserve  Treq SuperClassi Treq + Classi SuperClassa SuperClassd SuperClassb SuperClassc , if Classi SuperClassi is derived from

21

slide-22
SLIDE 22

Meta-model Pruning

Couple of rules to conserve properties…

22

slide-23
SLIDE 23

Finding Required Properties Rule: Conser ule: Conserve Pr e Proper

  • perty of R

ty of Req equired T uired Type ype

Classi

if property.type = Classj in Conserve

Classj

property[0, b]

  • pposite

Preq Preq

property + Preq Preq

  • pposite

+ Treq

23

slide-24
SLIDE 24

Finding Required Properties Rule: Conser ule: Conserve Multiplicity Pr e Multiplicity Proper

  • perty

ty

Classi

attribute: PrimitiveType[>0, a ] if property.lower > 0 and Classi in Treq, Conserve

Classj

reference [>0, b]

  • pposite

Preq Preq

property + Preq Preq

  • pposite

+

24

 Treq Classj Treq +

slide-25
SLIDE 25

Meta-model Pruning

A rule to illustrate options…

25

slide-26
SLIDE 26

Optional R Optional Rule: Conser ule: Conserve Zer e Zero Multiplicity

  • Multiplicity

Pr Proper

  • perty

ty

Classi

if property.lower == 0 and property.type.isInstanceOf(Class), Conserve

Classj

property[0, b]

  • pposite

Preq Preq

property + Preq Preq

  • pposite

+ Need not be Required Class

26

slide-27
SLIDE 27

Meta-model Pruning

Apply rules (about 16) until no rule can be applied anymore…

27

slide-28
SLIDE 28

Meta-model Pruning

Remove types and properties not conserved…

28

slide-29
SLIDE 29

Meta-model Pruning Implementation

Meta-model Pruner

 Implemented in Kermeta (http://www.kermeta.org)  Conforms to the EMF Ecore file format for input  Download at: http://www.irisa.fr/triskell/softwares-fr/protos/metamodelpruner/

29

slide-30
SLIDE 30

Outline

 Where do large meta-models come from?  Why extract subsets of large meta-models ?  How to prune a meta-model to obtain subsets called

effective meta-models ?

 What are the type properties of an effective meta-

model ?

 Illustrative Case Study : French Space Agency

Transformation Input Meta-model

 Conclusion

30

slide-31
SLIDE 31

Model Typing

Meta-model MMe Meta-model MM

 Does the effective meta-model MMe match the large meta-model MM ?

 Meta-model MMe matches another meta-model MM iff for each class C in MM,

there is one and only one corresponding class C’ in MMe

 Set of rules guarantees a subtype relationship btw the two MMs [Steel 07, SoSyM]  If transformation T works for MM, and if MMe is a model subtype of MM, then T

works with MMe

0..1 aCTwo 0..1 aC2

matches ?

slide-32
SLIDE 32

What are properties of an effective meta-model?

 We verify that an effective meta-model is super-type of the

large meta-model using model typing.

 This implies all transformations written for the effective

meta-model are also valid for the large meta-model

 All instances (models) of the effective meta-model are also

instances of the large meta-model.

 The instances are compatible with the large meta-model

because we preserve concept names.

 The effective meta-model can live its own life much like a

DSML!

32

slide-33
SLIDE 33

Outline

 Where do large meta-models come from?  Why extract subsets of large meta-models ?  How to prune a meta-model to obtain subsets called

effective meta-models ?

 What are the type properties of an effective meta-model ?  Illustrative Case Study : French Space Agency

Transformation Input Meta-model

 Conclusion

33

slide-34
SLIDE 34

French Space Agency Transformation Case Study

 Transformation for generation embedded system code from a

subset of UML Activity Diagrams

 Transformation analysis : Gives a set of required classes and

properties in the UML

 Meta-model pruning: Gives an output effective meta-model

which is a super type and subset of UML.

34

slide-35
SLIDE 35

Set of Required Classes in UML (Total = 10)

 ActivityEdge  ActivityNode  ControlFlow  OpaqueExpression  DecisionNode  InitialNode  ReadStructuralFeatureAction  AcceptEventAction  ActivityFinalNode  CallOperationAction

35

slide-36
SLIDE 36

Effective UML for Case Study

CallOperationAction Operation

1..1

  • peration

Using Conserve Property Multiplicity Rule

36

slide-37
SLIDE 37

Effective UML for Case Study

Using Conserve All Super Classes of Required Class

37

slide-38
SLIDE 38

Observations

  • 1. A significant reduction in size of the input meta-model for the

transformation: 31 Classes and 15 Properties Vs. 246 Classes and 583 Properties

  • 2. We obtain the subset of UML that is truly transformed. This

minimizes errors in model construction.

  • 3. The Effective UML meta-model is a super type of UML. (We verify

this in the impl.)

  • 4. All instances of operations of the effective UML meta-model are

compatible with UML itself.

38

slide-39
SLIDE 39

Outline

 Where do large meta-models come from?  Why extract subsets of large meta-models ?  How to prune a meta-model to obtain subsets called

effective meta-models ?

 What are the type properties of effective meta-models ?  Illustrative Case Study : French Space Agency

Transformation Input Meta-model

 Conclusion

39

slide-40
SLIDE 40

Conclusion

 We present an important problem associated with using large meta-

models such as the UML

 We show how to work around the problem by extracting a

smaller effective meta-model via meta-model pruning.

 We show that that the effective meta-model is a super type of

the original large meta-model.

 All instances and operations of the effective meta-model are

backward compatible with the large meta-model.

 We demonstrate our approach to obtain the effective meta-model

  • n an industrial case study.

 Often, there is a significant difference in sizes of the effective

and the original large meta-model!

40

slide-41
SLIDE 41

Future Work

 Atomic pruning operators that generate super-types of input meta-

model

 Any sequence of these operators lead to a super-type by

  • construction. Thanks to transitivity.

 For now, we verify that the result is a super-type using model typing.  Meta-model pruning demonstrates the possibility for a whole family of

  • algorithms. Ours is just an example.

 A new pruning operator could possibly deal with flattening the meta-

model inheritance hierarchy

41

slide-42
SLIDE 42

Thank You!

42

slide-43
SLIDE 43

Annexe : Model Typing

43

slide-44
SLIDE 44

Model Typing : Type properties of MMe

matches ?

context Class def: localMatchFor ( c : Class ) : Boolean = not c.isAbstract implies not self.isAbstract and c.ownedProperty -> forAll ( p | self.ownedProperty -> exists ( p2 | p2.localMatchFor (p) ) ) and c.ownedOperation -> forAll ( o | self.ownedOperation -> exists ( o2 | o2.localMatchFor (o) ) )

0..1 aC2 0..1 aCTwo

 Does the effective meta-model MMe match the large meta-model MM ?

These matching rules for model types are defined in [Steel 05, MODELS]

44

slide-45
SLIDE 45

context Property def: localMatchFor ( p : Property ) : Boolean = self.name = p.name and self.multiplicityMatchFor(p) and not p.isReadOnly implies not self.isReadOnly and self.isComposite = p.isComposite and not p.opposite -> isOclUndefined implies not self.opposite -> isOclUndefined and ( self.opposite.name = p.opposite.name )

Model Typing

matches ?

0..1 0..1 aC2 aCTwo

 Does the effective meta-model MMe match the large meta-model MM ?

45

slide-46
SLIDE 46

context MultiplicityElement def : multiplicityMatchFor ( m : MultiplicityElement ) : Boolean = (m.upper = 1) implies (self.upper = 1) and self.upper <= m.upper and self.lower >= m.lower and m.isOrdered implies self.isOrdered and self.isUnique = m.isUnique

Model Typing

matches ?  Does the effective meta-model MMe match the large meta-model MM ?

46