Dynamic Backward Slicing of Model Transformations

71
Budapest University of Technology and Economics Department of Measurement and Informa<on Systems Dynamic Backward Slicing of Model Transforma7ons Zoltán Ujhelyi, Ákos Horváth, Dániel Varró

description

A presentation held at ICST 2012 in Montreal, Canada. The presentation relies on a joint work of Zoltán Ujhelyi, Ákos Horváth and Dániel Varró from the Fault Tolerant Systems Research group at the Budapest University of Technology and Economics.

Transcript of Dynamic Backward Slicing of Model Transformations

Page 1: Dynamic Backward Slicing of Model Transformations

Budapest  University  of  Technology  and  Economics  Department  of  Measurement  and  Informa<on  Systems  

Dynamic  Backward  Slicing  of  Model  Transforma7ons  

Zoltán  Ujhelyi,  Ákos  Horváth,  Dániel  Varró  

Page 2: Dynamic Backward Slicing of Model Transformations

Models  and  Transforma7ons  in  Cri7cal  Systems  

System  Design    Model  

Architecture  Design    Model  

Component  Design  Model  

Refine  

Refine  

Page 3: Dynamic Backward Slicing of Model Transformations

Models  and  Transforma7ons  in  Cri7cal  Systems  

System  Design    Model  

Architecture  Design    Model  

Component  Design  Model  

Refine  

Refine  

Simula7on  

Simula7on  

Simula7on  

Page 4: Dynamic Backward Slicing of Model Transformations

Models  and  Transforma7ons  in  Cri7cal  Systems  

System  Design    Model  

Architecture  Design    Model  

Component  Design  Model  

Refine  

Refine  

Component    V&V  Model  

Architecture  V&V  Model  

System  V&V  Model  

Model  genera7on  

Back-­‐Annota7on  

Model  genera7on  

Back-­‐Annota7on  Model  genera7on  

Back-­‐Annota7on  

Use  

Use  

Horizontal  Model  Transforma7ons  

Formal  methods  

Formal  methods  

Simula7on  

Simula7on  

Simula7on  

Page 5: Dynamic Backward Slicing of Model Transformations

Models  and  Transforma7ons  in  Cri7cal  Systems  

System  Design    Model  

Architecture  Design    Model  

Component  Design  Model  

Refine  

Refine  

Design  +  V&V  Ar7facts    (Source  code,  Glue  code,    

Config.  Tables,  Test  Cases,  Monitors,  Fault  Trees,  etc.)  

Code    Genera7on  

Test  Genera7on  

Ver7cal  Model  Transform

a7ons  

Component    V&V  Model  

Architecture  V&V  Model  

System  V&V  Model  

Model  genera7on  

Back-­‐Annota7on  

Model  genera7on  

Back-­‐Annota7on  Model  genera7on  

Back-­‐Annota7on  

Use  

Use  

Horizontal  Model  Transforma7ons  

Formal  methods  

Formal  methods  

Simula7on  

Simula7on  

Simula7on  

Page 6: Dynamic Backward Slicing of Model Transformations

Models  and  Transforma7ons  in  Cri7cal  Systems  

System  Design    Model  

Architecture  Design    Model  

Component  Design  Model  

Refine  

Refine  

Model  Transforma7ons  •   systema7c  founda7on  of        knowledge  transfer:        theore7cal  resultstools  •   bridge  /  integrate        exis7ng  languages&tools  

Design  +  V&V  Ar7facts    (Source  code,  Glue  code,    

Config.  Tables,  Test  Cases,  Monitors,  Fault  Trees,  etc.)  

Code    Genera7on  

Test  Genera7on  

Ver7cal  Model  Transform

a7ons  

Component    V&V  Model  

Architecture  V&V  Model  

System  V&V  Model  

Model  genera7on  

Back-­‐Annota7on  

Model  genera7on  

Back-­‐Annota7on  Model  genera7on  

Back-­‐Annota7on  

Use  

Use  

Horizontal  Model  Transforma7ons  

Formal  methods  

Formal  methods  

Simula7on  

Simula7on  

Simula7on  

Page 7: Dynamic Backward Slicing of Model Transformations

Overview  of  Model  Transforma7ons  

Modeling  tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  rule  

Page 8: Dynamic Backward Slicing of Model Transformations

Overview  of  Model  Transforma7ons  

Modeling  tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  rule  

Model: Description of a concrete system

Page 9: Dynamic Backward Slicing of Model Transformations

Overview  of  Model  Transforma7ons  

Modeling  tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  rule  

Metamodel: Precise spec of a modeling language

Model: Description of a concrete system

Page 10: Dynamic Backward Slicing of Model Transformations

Overview  of  Model  Transforma7ons  

Modeling  tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  rule  

Metamodel: Precise spec of a modeling language

Model: Description of a concrete system

Model Transformation: How to generate a target equivalent of an arbitrary source model

Page 11: Dynamic Backward Slicing of Model Transformations

Overview  of  Model  Transforma7ons  Eclipse  Framework  

Model  Transforma7on  Tool  

Modeling  tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  rule  

MT  engine  

Page 12: Dynamic Backward Slicing of Model Transformations

Overview  of  Model  Transforma7ons  Eclipse  Framework  

Model  Transforma7on  Tool  

Modeling  tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  rule  

MT  engine  

Transformation engine: Support for querying and manipulating large models

Page 13: Dynamic Backward Slicing of Model Transformations

Overview  of  Model  Transforma7ons  Eclipse  Framework  

Model  Transforma7on  Tool  

Modeling  tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  rule  

MT  engine  

Transformation engine: Support for querying and manipulating large models

VIATRA2:  hYp://www.eclipse.org/gmt/VIATRA2/  

ATL  

QVT  

Page 14: Dynamic Backward Slicing of Model Transformations

Demonstra7ng  example:  Petri  net  Simula7on  

  Petri  nets  o Used  e.g.  in  component  design  analysis  

o Places  and  Transi7ons  o State  of  the  net  •  Tokens  

  Simulator  transforma7on  o In-­‐place  transforma7on  (source  and  target  metamodels  are  iden7cal)  

o Uses  both  impera7ve  and  declara7ve  elements  

14  

Client  

Store  

Server  

Query  

Respond  

Architecture  Design    Model  

Component  Design  Model  

Simula<on  

Page 15: Dynamic Backward Slicing of Model Transformations

Graph  transforma7on  rules  

15  

Client  

Store  

Server  

Query  

Respond  

removeToken  rule  

LHS   RHS  

Page 16: Dynamic Backward Slicing of Model Transformations

Graph  transforma7on  rules  

16  

Client  

Store  

Server  

Query  

Respond  

removeToken  rule  

LHS   RHS  

Page 17: Dynamic Backward Slicing of Model Transformations

Graph  transforma7on  rules  

17  

Client  

Store  

Server  

Query  

Respond  

removeToken  rule  

LHS   RHS  

Page 18: Dynamic Backward Slicing of Model Transformations

Graph  transforma7on  rules  

18  

Client  

Store  

Server  

Query  

Respond  

removeToken  rule  

LHS   RHS  

Page 19: Dynamic Backward Slicing of Model Transformations

Graph  transforma7on  rules  

19  

Client  

Store  

Server  

Query  

Respond  

removeToken  rule  

LHS   RHS  

Page 20: Dynamic Backward Slicing of Model Transformations

Graph  transforma7on  rules  

20  

Client  

Store  

Server  

Query  

Respond  

removeToken  rule  

LHS   RHS  

Page 21: Dynamic Backward Slicing of Model Transformations

Graph  transforma7on  rules  

21  

Client  

Store  

Server  

Query  

Respond  

removeToken  rule  

LHS   RHS  

Page 22: Dynamic Backward Slicing of Model Transformations

Control  Structure  rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

22  

Page 23: Dynamic Backward Slicing of Model Transformations

Debugging  model  transforma7ons  

• Why  is  a  certain  statement  executed?  • Why  is  a  certain  model  element  created?  

Basic  debugging  ques7ons  

• Hidden  data  dependencies  • Declara7ve  rules  

Finding  dependencies  

23  

Page 24: Dynamic Backward Slicing of Model Transformations

Debugging  model  transforma7ons  

• Why  is  a  certain  statement  executed?  • Why  is  a  certain  model  element  created?  

Basic  debugging  ques7ons  

• Hidden  data  dependencies  • Declara7ve  rules  

Finding  dependencies  

24  

‘Dynamic  backward  slicing’  problem  

Page 25: Dynamic Backward Slicing of Model Transformations

Program  Slicing    Dependency  analysis    Use  cases  

o  Debugging  solware  o  Impact  analysis  o  ...  

  Types  of  slicing  o  Dynamic/sta7c  o  Backward/Forward  

Example    1.  int  i; 2.  int  sum  =  0; 3.  int  product  =  1; 4.  for(i  =  1;  i  <  N;  ++i)  { 5.     sum  =  sum  +  i; 6.     product  =  product  *i; 7.  } 8.  write(sum); 9.  write(product);

25  

Page 26: Dynamic Backward Slicing of Model Transformations

Program  Slicing    Dependency  analysis    Use  cases  

o  Debugging  solware  o  Impact  analysis  o  ...  

  Types  of  slicing  o  Dynamic/sta7c  o  Backward/Forward  

Example    1.  int  i; 2.  int  sum  =  0; 3.  int  product  =  1; 4.  for(i  =  1;  i  <  N;  ++i)  { 5.     sum  =  sum  +  i; 6.     product  =  product  *i; 7.  } 8.  write(sum); 9.  write(product);

26  

Slicing  criterion:  a  statement  and  a  variable  

Page 27: Dynamic Backward Slicing of Model Transformations

Program  Slicing    Dependency  analysis    Use  cases  

o  Debugging  solware  o  Impact  analysis  o  ...  

  Types  of  slicing  o  Dynamic/sta7c  o  Backward/Forward  

Example    1.  int  i; 2.  int  sum  =  0; 3.  int  product  =  1; 4.  for(i  =  1;  i  <  N;  ++i)  { 5.     sum  =  sum  +  i; 6.     product  =  product  *i; 7.  } 8.  write(sum); 9.  write(product);

27  

Slice:  statements  the  criterion  depends  on  

Page 28: Dynamic Backward Slicing of Model Transformations

Program  Slicing    Dependency  analysis    Use  cases  

o  Debugging  solware  o  Impact  analysis  o  ...  

  Types  of  slicing  o  Dynamic/sta7c  o  Backward/Forward  

Example    1.  int  i; 2.  int  sum  =  0; 3.  int  product  =  1; 4.  for(i  =  1;  i  <  N;  ++i)  { 5.     sum  =  sum  +  i; 6.     product  =  product  *i; 7.  } 8.  write(sum); 9.  write(product);

28  

Slice:  statements  the  criterion  depends  on  

Page 29: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons    Similar  to  program  slicing    BUT:  processing  (input)  models  is  required  

  Our  approach:  

29  

Model  transforma7on  

slicing  

Transforma7on  

Models  

Transforma7on  Slice  

Model  Slice  

Criterion  

Page 30: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

30  

Page 31: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model   1.  Execu7ng  the  

Transforma7on  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

31  

Page 32: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model   1.  Execu7ng  the  

Transforma7on  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

32  

Output  model  

Page 33: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

33  

Output  model  

Page 34: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

For  each  statement  record:  •  Variable  Usage  •  Model  Usage  •  Model  Manipula7on  

Approach  

34  

Output  model  

Page 35: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

35  

Output  model  

Page 36: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

3.  Calcula7ng  the  Slice  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

36  

Output  model  

Page 37: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

3.  Calcula7ng  the  Slice  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

37  

Output  model  

Criteria:  Model  element  

Page 38: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

3.  Calcula7ng  the  Slice  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Criteria:  Program  statement  (and  a  variable)  

Approach  

38  

Output  model  

Criteria:  Model  element  

Page 39: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

3.  Calcula7ng  the  Slice  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

39  

Output  model  

Page 40: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

3.  Calcula7ng  the  Slice  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

•  Traversing  Trace  Records  Backwards  •  Selec7ng  Dependent  Trace  Records  

Approach  

40  

Output  model  

Page 41: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

3.  Calcula7ng  the  Slice  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

41  

Output  model  

Page 42: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

3.  Calcula7ng  the  Slice  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

42  

Output  model  

Page 43: Dynamic Backward Slicing of Model Transformations

Transforma7on  Program  

Input  model  

2.  Genera7ng  an  Execu7on  Trace  

1.  Execu7ng  the  Transforma7on  

3.  Calcula7ng  the  Slice  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }  

Approach  

43  

Output  model  

Sliced  model  

Page 44: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

44  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 45: Dynamic Backward Slicing of Model Transformations

10.  apply  addToken(Pl) Uses  variable:  Pl  Uses  model:  Server  Modifies  model:  Token

Slicing  Model  Transforma7ons  –  An  Example  

45  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 46: Dynamic Backward Slicing of Model Transformations

10.  apply  addToken(Pl) Uses  variable:  Pl  Uses  model:  Server  Modifies  model:  Token

Slicing  Model  Transforma7ons  –  An  Example  

46  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  variable  Pl  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 47: Dynamic Backward Slicing of Model Transformations

9.  find  targetPlace(T,Pl)  Modifies  variable:  Pl  Uses  variable:  T  Uses  model:  Server,  Query

Slicing  Model  Transforma7ons  –  An  Example  

47  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  variable  Pl  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 48: Dynamic Backward Slicing of Model Transformations

9.  find  targetPlace(T,Pl)  Modifies  variable:  Pl  Uses  variable:  T  Uses  model:  Server,  Query

Slicing  Model  Transforma7ons  –  An  Example  

48  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Data/model  dependency  

Page 49: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

49  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

8.  apply  addToken(Pl) Uses  variable:  Pl  Uses  model:  Store  Modifies  model:  Token

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 50: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

50  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

7.  find  targetPlace(T,Pl)  Modifies  variable:  Pl  Uses  variable:  T  Uses  model:  Store,  Query

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 51: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

51  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

6.  forall  Pl    

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 52: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

52  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

6.  forall  Pl    

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Control  dependency  

Page 53: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

53  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

5.  apply  removeToken(Pl) Uses  variable:  Pl  Uses  model:  Client  Removes  model:  Token

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 54: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

54  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

4.  find  sourcePlace(T,Pl)  Modifies  variable:  Pl  Uses  variable:  T  Uses  model:  Client,  Query

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 55: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

55  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

3.  forall  Pl    

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 56: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

56  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

2.  if  (find  isFireable(T))  Uses  variable:  T  Uses  model:  Client,  Query  

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 57: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

57  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

2.  if  (find  isFireable(T))  Uses  variable:  T  Uses  model:  Client,  Query  

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Control  dependency  

Page 58: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

58  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

1.  rule  fireTransition(in  T)   Modifies:  variable  T  

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

variable  T  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Page 59: Dynamic Backward Slicing of Model Transformations

Slicing  Model  Transforma7ons  –  An  Example  

59  

rule  fireTransition(in  T)  =  {    if  (find  isFireable(T))  {        //  remove  tokens  from  source  places        forall  Pl              with  find  sourcePlace(T,Pl)              do  apply  removeToken(Pl);        //  creates  tokens  on  target  places        forall  Pl              with  find  targetPlace(T,Pl)            do  apply  addToken(Pl);    } }

Client  

Server  

Query  

Respond  

1.  rule  fireTransition(in  T)   Modifies:  variable  T  

Store  

Criteria:  rule  call  addToken,  variable  Pl

Lookup:  

(1)  (2)  

(3)  (4)  (5)  

(6)  (7)  (9)  (8)  (10)  

Code   Instance  model  

Trace  Records:  

Data/model  dependency  

Page 60: Dynamic Backward Slicing of Model Transformations

Implementa7on  Architecture  Model  Transforma7on  Tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  program  

MT  engine  

Page 61: Dynamic Backward Slicing of Model Transformations

Implementa7on  Architecture  Model  Transforma7on  Tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  program  

MT  engine  

Execu7on  Trace  

Page 62: Dynamic Backward Slicing of Model Transformations

Implementa7on  Architecture  Model  Transforma7on  Tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  program  

MT  engine  

Execu7on  Trace  

Trace  metamodel  defined  for  adaptability  

Page 63: Dynamic Backward Slicing of Model Transformations

Implementa7on  Architecture  Model  Transforma7on  Tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  program  

MT  engine  

Execu7on  Trace  

Page 64: Dynamic Backward Slicing of Model Transformations

Implementa7on  Architecture  Model  Transforma7on  Tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  program  

MT  engine  

Execu7on  Trace  

Slicing  algorithm  

Page 65: Dynamic Backward Slicing of Model Transformations

Implementa7on  Architecture  Model  Transforma7on  Tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  program  

MT  engine  

Execu7on  Trace  

Slicing  algorithm  Model  Slice  

Page 66: Dynamic Backward Slicing of Model Transformations

Implementa7on  Architecture  Model  Transforma7on  Tool  

Source  model  

Source  metamodel  

Target  model  

Target  metamodel  MT  program  

MT  engine  

Execu7on  Trace  

Slicing  algorithm  Model  Slice  

Program  Slice  

Page 67: Dynamic Backward Slicing of Model Transformations

Case  Studies  

Petri  net  simula7on  • Simple  transforma7on,  large  models  

Antworld  Case  Study  • Complex  simula7on  • Ever-­‐growing  models  

BPEL2SAL  transforma7on  • Complex  impera7ve  control  structure  

Reengineering  Case  Study  • Model  Extrac7on  

67  

Page 68: Dynamic Backward Slicing of Model Transformations

Evalua7on  

Measurements:  Size  of  

• Model  slice  • Transforma7on  slice  

Manually  selected  slicing  criteria  

• Mul7ple  for  each  transforma7on  

• Covering  all  phases  of  the  program  

Ques7ons:  

•  Independence  of  model  slice  from  selected  statement  

•  Independence  of  program  slice  from  model  instances  

68  

Page 69: Dynamic Backward Slicing of Model Transformations

Evalua7on  

Measurements:  Size  of  

• Model  slice  • Transforma7on  slice  

Manually  selected  slicing  criteria  

• Mul7ple  for  each  transforma7on  

• Covering  all  phases  of  the  program  

Ques7ons:  

•  Independence  of  model  slice  from  selected  statement  

•  Independence  of  program  slice  from  model  instances  

69  

Data-­‐driven  transforma7ons  or  more  impera7ve  style  

Page 70: Dynamic Backward Slicing of Model Transformations

Lessons  Learned  (Evalua7on  of  Case  Studies)  

Petri  net  simula7on  • Transforma7on  slice  largely  model  independent  •  Sta7c  slices  would  be  similar  

Antworld  Case  Study  • Transforma7on  slices  more  model-­‐dependent  

BPEL2SAL  transforma7on  • Well-­‐separated  phases  •  Few  dependencies  between  •  Small  slices  

Reengineering  Case  Study  • Many  dependencies  between  phases  

•  Ignored  model  elements  missing  from  trace  and  slice  •  Small  slices  

70  

Page 71: Dynamic Backward Slicing of Model Transformations

Conclusion  

• Models  and  transforma7on  simultaneously  

Dynamic  backward  slicing  of  model  transforma7ons  

•  Various  transforma7on  case  studies  •  Using  the  VIATRA2  transforma7on  framework  

Implementa7on  and  evalua7on  

•  Transforma7on  debugging  support  •  Por7ng  to  other  transforma7ons  tools  •  Back-­‐annota7on  between  trace  and  concrete  syntax  necessary  

Future  plans  

71