Safely Reusing Model Transformations through Family Polymorphism - - PDF document

safely reusing model transformations through family
SMART_READER_LITE
LIVE PREVIEW

Safely Reusing Model Transformations through Family Polymorphism - - PDF document

02/10/2014 Safely Reusing Model Transformations through Family Polymorphism Director of IRISA


slide-1
SLIDE 1

02/10/2014 1

  • Safely Reusing Model

Transformations through Family Polymorphism

  • Director of IRISA
  • 2

02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

  • !

"#$ ! %

& ' ( !

) $(*( +(,

+ ! -&-(

slide-2
SLIDE 2

02/10/2014 2

3 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

Aerodynamics Authorities Avionics Safety Regulations Airlines Propulsion System Mechanical Structure Environmenta l Impact Navigation Communications Human- Machine Interaction

4 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

4 Aerodynamics Authorities Avionics Safety Regulations Airlines Propulsion System Mechanical Structure Environmenta l Impact Navigation Communications Human- Machine Interaction

Heterogeneous Modeling Languages

slide-3
SLIDE 3

02/10/2014 3

5 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

. - /'' 0(

) 1(23

) 0 .-/!

– 50+ variants of StateCharts have been reported!

  • My problem

My favorite toolbox Very « square »: fully formal LOt of TOoling Support

Reuse? Reuse?

The DSL Approach

6 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

  • 4'5

! 6

7 !

ffmpeg -i input.avi -b:v 64k -bufsize 64k output.avi

) + '' '

0 !''

' '

) 8"99 ('/':;< '

8 999,

  • '=' ''%

=( ( .-/

slide-4
SLIDE 4

02/10/2014 4

7 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

> ' '.-/,

+ (!9*(!9 9 '

) 099- 9+ , ) 3+69?' 9+,

,=' .-/

&' ' 0 .-/ 8'

/.-/%

.-/> + 0''

8 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

  • .-/

& "8& 8& & *.-/ !''':'-< 0!.-/(! '

/''':7 <

  • 36 *(9'

&

slide-5
SLIDE 5

02/10/2014 5

9 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

7 &

>

➠Visit http://gemoc.org

10 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

> 6

) 0 .-/

@ .-/2 @( !' 2

⇒ > .0-/0,

⇒ (' > * .-/

slide-6
SLIDE 6

02/10/2014 6

11 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(-(

) =(( 6 *' (

8* ?( & ( 8 ,

) 1 * (( 2

11

12 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

36'A7' -6

A Model is a simplified representation of an aspect of the World for a specific purpose

slide-7
SLIDE 7

02/10/2014 7

13 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

36'0!*'

  • require "StateMachine.ecore"
  • require “StaticSemantics.ocl”
  • require “DynamicSemantics.xtend”
  • run()

reset()

FSM

name: EString step()

State

input: EString

  • utput: EString

fire()

Transition

initialState 1

  • wningFSM

1

  • wnedState

* currentState 0..1 source 1

  • utgoingTransition

* target 1 incomingTransition 0..1

Context FSM inv: ownedState->forAll(s1,s2| s1.name=s2.name implies s1=s2) class FSM { * () { currentState = initialState }}

class Minimizer { public def FSM minimize (source: FSM) {…} }

14 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

) ' ! B !"C

# $$ %#$ %&' & $ ()' )($%

=(D

Finite State Machine

<<conformsTo>>

lookup table

When can we reuse such a transformation?

slide-8
SLIDE 8

02/10/2014 8

15 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D $ *

) 8 ! '

+,-%$$$' %) ,''.)/0%)' ,%%' &#$,%$%' $$/

⇒ ='' ' E&? * ⇒ - .-/ ' ⇒ % $' '

⇒ need to specialize it!!

if (true) { …

modeltype CDFG { …

  • peration elim() is do

reachability end } modeltype Datapath extends CDFG { …

  • peration elim() is do

revert super() end } 16 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

) & ' *

( ( " ⇒ *(' ( (%%% ⇒ &' ( ( (

=(D

slide-9
SLIDE 9

02/10/2014 9

17 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

Guy et al. – On Model Subtyping

+'B390$=+-FFFC

) -**(('* '**('

Animal a = Animal.new Food f = Food.new a.eat(f) Animal a = Cow.new Food f = Food.new a.eat(f) Animal a = Cow.new Food f = Grass.new a.eat(f) Animal a = Cow.new Food f = Hamburger.new a.eat(f) Animal a = Animal.new Food f = Food.new a.eat(f) Cow a = Cow.new Grass f = Grass.new a.eat(f) Animal a = Animal.new Food f = Food.new a.eat(f)

18 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D

) - :< * A>

* * 6 6' ( $ 6 ! + :<

slide-10
SLIDE 10

02/10/2014 10

19 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D

) 3 ' :!"< * (' * ( ( ) 7' matching * (

  • matching ≅ subtyping :*('<

20 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

8A>+'

) + +G:+H;+G<

  • &+*9( *
  • ∀ +G9+ '

) 1 ) 1( ) 1' D & D 1 ( D 1 D 1 I *

  • ∀ +G(9+ '(

) 1 ) 1( ) 1 ) 1 I + * ) 1 :(< ) &+( (9 ( ( (

  • 0( ((+ +G

(

<# ?

MT1 MT2

Same names If C1 is abstract, it can only match another abstract class ∀ C2 operation, C1 must have a corresponding operation ∀ C2 operation, C1 must have a corresponding operation

  • With the same name

∀ C2 operation, C1 must have a corresponding operation

  • With the same name
  • With covariant return type

∀ C2 operation, C1 must have a corresponding operation

  • With the same name
  • With covariant return type
  • With corresponding parameters
  • In the same order
  • With contravariant types
  • With same multiplicities
  • With the same isUnique

∀ C2 operation, C1 must have a corresponding operation

  • With the same name
  • With covariant return type
  • With corresponding parameters
  • In the same order
  • With contravariant types
  • With same multiplicities

∀ C2 operation, C1 must have a corresponding operation

  • With the same name
  • With covariant return type
  • With corresponding parameters
  • In the same order
  • With contravariant types

∀ C2 operation, C1 must have a corresponding operation

  • With the same name
  • With covariant return type
  • With corresponding parameters
  • In the same order

∀ C2 property, C1 must have a corresponding property

  • With the same name
  • With covariant type
  • With the same multiplicities
  • With the same isUnique
  • With the same isComposite
  • With an opposite with the

same name

  • If C1 property is read only, it

can only corresponds to another read only property

∀ C2 property, C1 must have a corresponding property

  • With the same name
  • With covariant type
  • With the same multiplicities
  • With the same isUnique
  • With the same isComposite
  • With an opposite with the

same name

Every mandatory property in C1 must correspond to a C2 property ∀ C2 operation, C1 must have a corresponding operation

  • With the same name
  • With covariant return type
  • With corresponding parameters

∀ C2 property, C1 must have a corresponding property

  • With the same name
  • With covariant type
  • With the same multiplicities
  • With the same isUnique
  • With the same isComposite

∀ C2 property, C1 must have a corresponding property

  • With the same name
  • With covariant type
  • With the same multiplicities

∀ C2 property, C1 must have a corresponding property

  • With the same name
  • With covariant type

∀ C2 property, C1 must have a corresponding property

  • With the same name

∀ C2 property, C1 must have a corresponding property

slide-11
SLIDE 11

02/10/2014 11

21 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D

Match ?

<<match>> <<match>> <<match>> <<match>>

22 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

A Basic FSM Operation Applied on a Final States FSM

=(D

modeltype basic_fsm_type { basic_fsm :: FSM , basic_fsm :: State , basic_fsm :: Transition } modeltype finalstates_fsm_type { finalstates_fsm :: FSM , finalstates_fsm :: State , finalstates_fsm :: Transition , finalstates_fsm :: FinalState } class Serializer<MT : basic_fsm_type> {

  • peration printFSM(fsm : MT :: FSM) is do

fsm.ownedState.each{s| stdio.writeln(“State :" + s.name) s.outgoingTransition.each{t| var outputText : String if (t.output != void and t.output != “”) then

  • utputText := t.output

else

  • utputText := "NC“

end stdio.writeln(“Transition :" + t.source.name + “-(“ + t.input + "/" + outputText + ") ->" + t.target.name) } } end }

Basic FSM Model Type Final States FSM Model Type

slide-12
SLIDE 12

02/10/2014 12

23 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

) -

:>-< '' ( :(< * :( +

  • +9 <

⇒ * (

) .

' initialState( 3 ' ( *(State Collection<State> 12% '3

=(D

  • 24

02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D ' '

) &

:'99 9 < ( ( ( * ' ( * ' ( 6 ' ( *

slide-13
SLIDE 13
  • !"#$"#
  • %&'
  • !$"#$"#
slide-14
SLIDE 14

02/10/2014 13

25 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D ' '

) ' ! ' B, !4C

56 65 ,7-)' $% & &

% '$$% % %'$%/

⇒ ' : <

How to reuse such transformation?

26 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D ' '

) &( ' '

  • ( '' : (<

' G ( ' * '' #$ % & & $ J ( ' '

slide-15
SLIDE 15

02/10/2014 14

27 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

1 7 % I ?' 2 K +I ?'

=(D ' '

28 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D ' '

3 K +8'

slide-16
SLIDE 16

02/10/2014 15

29 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D ' '

4 K +8(' I

30 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

3 /-*('?

) 8 (*(=** (*(=G2 ) =*

  • '* (

+!*('

slide-17
SLIDE 17

02/10/2014 16

31 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

  • '

) &

= =G + ' '

) $

  • *

==G

MT2 MT1

32 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

+!

) =

1( (*(= & (*(=G!

)

1( (*(= '& (*(=G !

) &9'

=

  • ) &9 =G

MT2 MT1 MT2’

slide-18
SLIDE 18

02/10/2014 17

33 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

J-*(' ?

) =

'

)

L'

) =

L8

)

L'L8

B1 <# B2 A1 <# A2 <<totalIso>> <<totalIso>> <<partialIso>> A1’ <# A2 <<totalIso>> B1 <# B2 f(A1) <<totalIso>> <<totalNoniso>> <<partialNoniso>>

34 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

+-*=('

) + ('

* ' *('

  • ⇒ %% # 33
slide-19
SLIDE 19

02/10/2014 18

35 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

=(D $ * %

  • ) &

$.-/

⇒ .-/ ( :'9'<

( *

⇒ $(

? ' ( ' *(

⇒ : < '

+ ! E

( 36 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

?

''9' 9 : 9 ,<

  • **(

:'9 *9 <

  • 0!

9*9

1+'

slide-20
SLIDE 20
  • )'

!$"#$"#

slide-21
SLIDE 21

02/10/2014 19

37 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

( *(

*'*6

@*6''2

''*(* !

) 1'(2 ) 1) ''**2 ) 1 ') !''2 ) 1 ')! ''2

+'.-/(

38 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

@''*2

) (* '*'' ) **('*(

– the set of services it offers to other language units and the set of services it requires from other language units.

)

– introduced by components-based software engineering approaches. – But... What is the meaning of “provided and required services" in the context of software languages?

) *( E**(

– Extends vs. uses

+'.-/(

slide-22
SLIDE 22

02/10/2014 20

39 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

> ( ''

/6 -/0''

8'

$4599*

' '*( '

'' :9* (!<

) (*(:9* (!< ) ( ':* <

+'M*(' /''>

40 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

8*(!*(

*(

) 0'--+

+(!*(

*(

) 0'=!7+,

  • *(

*(

) 0'&(

  • N. M*(
slide-23
SLIDE 23

02/10/2014 21

41 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

3' M*( 0(

) M*( '

.-/> K' /''0''

) M*('

' *( . 6 '' Variability Variability

42 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

O

''(* 62 +' * ! 2 8' (*( 2 . ('2

"#.'*(+9='

+'M EM

slide-24
SLIDE 24

02/10/2014 22

43 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

> ' '.-/,

+ (!9*(!9 9'

) 099- 9+ , ) 3+69?' 9+,

,=' .-/

&' ' 0 .-/ .-/ 8'

(

+

44 02/10/2014

INSTITUT DE RECHERCHE EN INFORMATIQUE ET SYSTEMES ALEATOIRES

8 * ( ' .-0 &?&-8&

% #& #%%

86'