Towards Transformation Rule Composition

24
McGill University School of Computer Science Ph.D. Candidate in the Modelling, Simulation, and Design Lab MPM’10 Towards Transformation Rule Composition Márk Asztalos, Eugene Syriani, Manuel Wimmer, and Marouane Kessentini

description

Towards Transformation Rule Composition. Márk Asztalos, Eugene Syriani , Manuel Wimmer, and Marouane Kessentini. Outline. Context Rule Composition Composability Criteria Composition Procedure Example: UML  EJB 2.0  EJB 3.0 Conclusion. Context. Enterprise Development Company. - PowerPoint PPT Presentation

Transcript of Towards Transformation Rule Composition

Page 1: Towards Transformation Rule Composition

McGill UniversitySchool of Computer Science

Ph.D. Candidate in the Modelling, Simulation, and Design Lab

MPM’10

Towards Transformation Rule Composition

Márk Asztalos, Eugene Syriani,Manuel Wimmer, and Marouane

Kessentini

Page 2: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

OUTLINE

Context

Rule Composition

Composability Criteria

Composition Procedure

Example: UML EJB 2.0 EJB 3.0

Conclusion

2

Page 3: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

CONTEXT

3

Enterprise Development Company

Requirements DevelopmentDesign Maintenance

Page 4: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

CONTEXT

4

Enterprise Development Company

DevelopmentDesign

Page 5: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

CONTEXT

5

Enterprise Development Company

DevelopmentDesign

v2.0

v3.0

Page 6: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

IS IT POSSIBLE TO AUTOMATICALLY DERIVE T3?That is the question

6

UML meta-model

EJB 3 meta-model

EJB 2 meta-model

T3

T1

T2

?

Page 7: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

IS IT POSSIBLE TO AUTOMATICALLY DERIVE T3?

• In general this is a very hard task

• Instead we will try to solve the problem at the rule level

7

a1:Package

b2:EJBArchive2

a1:Package

b3:DeployDesc

T

c1:EJBArchive2 c1:EJBArchive2 d2:EJBArchive3T

a1:Package d2:EJBArchive3a1:Package T

T3

T1

T2

UML class TO EJB2 archive

EJB2 archive TO EJB3 archive

UML class TO EJB3 archive

Page 8: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

ASSUMPTIONS

Transformation Chain

8

• We assume an exogenous chain of transformations

• Rules of the transformations are algebraic graph transformation rules [1]

• Rules must produce traceability links such that every newly created element must have at least one trace link

[1] H. Ehrig, K. Ehrig, U. Prange, G. Taentzer. Fundamentals of Algebraic Graph Transformation.EATCS, Springer-Verlag, 2006.

a1:Package d2:EJBArchive3a1:Package T

Page 9: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

WHAT DO WE MEAN BY COMPOSITION?

For any model m1, m2 = T1(m1) and m3 = T2(m2) we definem’ = T3(m1) = T2 T1(m1) such that:

• Soundness & Completeness:– m1 is preserved in m’

– All elements produced by T2 are present in m’

– m’ contains no other elements then those in m3

• Elimination:– No element from m2 shall be present in m’

– No traceability link involving elements from MM2 must be present in m’

• Transitivity– If there is a trace link 12 between an element e1 m1 and an element e2 in m2

AND there is a trace link 23 between e2 and an element e3 m3

Then there must be a trace link 13 m’ between e1 and e3

9

Page 10: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

ASSUMPTIONS

Composability Criteria

10

Two rules (LHS1 , RHS1) and (LHS2 , RHS2) are composable if:

Every element in LHS2 that is part of MM2 is present in RHS1

a1:Package

b2:EJBArchive2

a1:Package

b3:DeployDesc

T

c1:EJBArchive2 c1:EJBArchive2 d2:EJBArchive3T

Page 11: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

RULE COMPOSITION PROCEDURE

• The Composability Criteria specifies the pre-condition

• The Composition Definition specifies the post-condition

• In [1], Ehrig et. al. have proven that the composition of two graph transformation rules is possible

11

[1] H. Ehrig, K. Ehrig, U. Prange, G. Taentzer. Fundamentals of Algebraic Graph Transformation.EATCS, Springer-Verlag, 2006.

Page 12: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

GRAPH TRANSFORMATION RULE APPLICATION

12

right

right

left

right

left

up down up down

right

L K R

G

gLink gLink

gLink

pLink fLink

right

left

right

left

up down up down

H

gLink

pLink fLink

m

If there exists an occurrence of L in G then replace it with R

Page 13: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

RULE COMPOSITION PROCEDURE

• In [1], Ehrig et. al. have proven that the composition of two graph transformation rules is possible– By computing the so-called E-concurrent graph of the two rules

• BUT the theorem does not say how to precisely construct the new rule

r’ = r2 r1

• How to construct the L,K, and R parts of r’?

13

[1] H. Ehrig, K. Ehrig, U. Prange, G. Taentzer. Fundamentals of Algebraic Graph Transformation.EATCS, Springer-Verlag, 2006.

Page 14: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

RULE COMPOSITION PROCEDURE

Eliminate MM2 elements and related trace links and compute transitive trace links

14

b2:EJBArchive2

a1:Package

b3:DeployDesc

a1,b2 d2:EJBArchive3

a1,b3

b2,d2

a1,d2

Page 15: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

RULE COMPOSITION PROCEDURE

15

a1:Package

b2:EJBArchive2

a1:Package

b3:DeployDesc

T

c1:EJBArchive2 c1:EJBArchive2 d2:EJBArchive3T

r1:

r2:

E:b2:EJBArchive2

a1:Package T

a1:Packager3:

R3: b2:EJBArchive2

a1:Package

b3:DeployDesc

T

d2:EJBArchive3

T

T

Ta1:Package d2:EJBArchive3T

b2:EJBArchive2

a1:Package T

b2:EJBArchive2

a1:Package

b3:DeployDesc

T

c1:EJBArchive2 d2:EJBArchive3T

a1:Package d2:EJBArchive3T

Page 16: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

RULE COMPOSITION PROCEDURE

Negative Application Conditions

16

• If the NAC of r1 corresponds to its RHS, then add a NAC to r3 that corresponds to its RHS

• If the NAC of r2 corresponds to its RHS, then it is taken into account when applying r2 on E

• Considering other arbitrary NACs is not trivial, as they can be– Overlapping with the LHS– Completely independent from the LHSIn either case, need knowledge of other rules involved

Page 17: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

SOLVING THE UMLEJB2 EJB3 MIGRATION CASE

17

UML meta-model

EJB 3 meta-model

EJB 2 meta-model

T3

T1

T2

Page 18: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

UMLEJB2 EJB3 COMPOSITION

UML Class Diagram TO EJB 2.0

18

a1:Package

b2:EJBArchive2

a1:Packageb3:DeployDesc

T

a1:Package

b2:EJBArchive2

b3:DeployDesc

isPersistent = truea4:Class

a1:Package

b2:EJBArchive2

b3:DeployDesc

a4:Classname = a4.name

b5:EntityBean

name = a4.name

b6:Interface

b7:EntityEntryT

T

T

a1:Package

b2:EJBArchive2

b3:DeployDesc

isPersistent = falsea4:Class

a1:Package

b2:EJBArchive2

b3:DeployDesc

a4:Classname = a4.name

b5:SessionBean

name = a4.nameb6:Interface

b7:SessionEntryisStateful = false

T

T

T

R1:

R2:

R3:

b2:EJBArchive2

a1:Packageb3:DeployDesc

T

a1:Package

b2:EJBArchive2

b3:DeployDesc

a4:Classname = a4.name

b5:EntityBean

name = a4.name

b6:Interface

b7:EntityEntry

T

T

a1:Package

b2:EJBArchive2

b3:DeployDesc

a4:Classname = a4.name

b5:SessionBean

name = a4.nameb6:Interface

b7:SessionEntryisStateful = false

T

T

Page 19: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

UMLEJB2 EJB3 COMPOSITION

EJB 2.0 TO EJB 3.0

19

R1:

R2:

R3:

c1:EJBArchive2 c1:EJBArchive2 d2:EJBArchive3

c1:EJBArchive2

d2:EJBArchive3

c4:EntityBean

c1:EJBArchive2

d2:EJBArchive3

c4:EntityBean

d6:EntityBean

d7:Interface

name = c4.name

name = c4.name

c1:EJBArchive2

d2:EJBArchive3

c3:SessionBean

c5:SessionEntry

c1:EJBArchive2

d2:EJBArchive3

c3:SessionBean

c5:SessionEntry

d6:SessionBean

d7:Interface

d8:StatelessisStateful = false

name = c3.name

name = c3.name

T

T

T

T

TT

T

c1:EJBArchive2

d2:EJBArchive3

c3:SessionBean

c5:SessionEntry

c1:EJBArchive2

d2:EJBArchive3

c3:SessionBean

c5:SessionEntry

d6:SessionBean

d7:Interface

d8:StatefulisStateful = true

name = c3.name

name = c3.name

T

T

T

c1:EJBArchive2 d2:EJBArchive3T

c1:EJBArchive2

d2:EJBArchive3

c4:EntityBean

d6:EntityBean

d7:Interface

name = c4.name

name = c4.name

T

T

c1:EJBArchive2

d2:EJBArchive3

c3:SessionBean

c5:SessionEntry

d6:SessionBean

d7:Interface

d8:Stateless

name = c3.name

name = c3.name

T

T

c1:EJBArchive2

d2:EJBArchive3

c3:SessionBean

c5:SessionEntry

d6:SessionBean

d7:Interface

d8:Stateful

name = c3.name

name = c3.name

T

TR4:

Page 20: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

UMLEJB2 EJB3 COMPOSITION

Composability Matrix

20

T2 T1 T2:R1 T2:R2 T2:R3 T2:R4

T1:R1 YES NO NO NO

T1:R2 YES YES NO NO

T1:R3 YES NO YES NO

Page 21: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

UMLEJB2 EJB3 COMPOSITIONT3:R1 = T2:R1 T1:R1

21

a1:Package d2:EJBArchive3a1:Package Td2:EJBArchive3a1:Package T

=

a1:Package

b2:EJBArchive2

a1:Packageb3:DeployDesc

Tb2:EJBArchive2

a1:Packageb3:DeployDesc

T

c1:EJBArchive2 c1:EJBArchive2 d2:EJBArchive3Tc1:EJBArchive2 d2:EJBArchive3T

Page 22: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

c1:EJBArchive2

d2:EJBArchive3

c4:EntityBean

c1:EJBArchive2

d2:EJBArchive3

c4:EntityBean

d6:EntityBean

d7:Interface

name = c4.name

name = c4.name

T

T

T

c1:EJBArchive2

d2:EJBArchive3

c4:EntityBean

d6:EntityBean

d7:Interface

name = c4.name

name = c4.name

T

T

UMLEJB2 EJB3 COMPOSITIONT3:R2 = T2:R2 T1:R2

22

=

Page 23: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

UMLEJB2 EJB3 COMPOSITIONT3:R3 = T2:R3 T1:R3

23

=

Page 24: Towards Transformation Rule Composition

Towards Transformation Rule CompositionMPM’10

CONCLUSION

• Composition procedure– Given two transformation rules– Produces the composite of the two rules (transitive closure)

• Composition detection

• Implemented in– ATL: compiled to graph transformation rules– EMF Tiger:

detect composable rules Output the composite rule

• How to deal with more complex transformation?– Arbitrary NACs– Arbitrary attribute constraints– Workflow structure (priority, layer, explicit control flow, ...)

24