30
Two Basic Correctness Properties for Transformations: Executability and Coverage Elena Planas Jordi Cabot Cristina Gómez Universitat Oberta de Catalunya (Spain) École des Mines de Nantes – INRIA (France) Universitat Politècnica de Catalunya (Spain) MtATL 2011: 3rd International Workshop on Model Transformation with ATL July 1st, 2011 - Zürich, Switzerland

Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Embed Size (px)

Citation preview

Page 1: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Two Basic Correctness Properties for Transformations:

Executability and Coverage

Elena PlanasJordi Cabot

Cristina Gómez

Universitat Oberta de Catalunya (Spain)École des Mines de Nantes – INRIA (France)Universitat Politècnica de Catalunya (Spain)

MtATL 2011: 3rd International Workshop on Model Transformation with ATLJuly 1st, 2011 - Zürich, Switzerland

Page 2: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

model transformations play a key role with the emergence of MDE.

the quality of the transformation process depends on the quality of the model transformations.

Related work

tools

analysis

testinglightweigh

t verificatio

n1/20

Page 3: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Define two basic correctness properties of model transformations rulesPropose a method to check these properties

goal

Lightweight (efficient) verification method Feedback suggesting possible corrections

method features

matched rules (declarative rules)focus

2/20

Page 4: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Property #1:

weak executability of an rule

3/20

Page 5: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

An rule is weakly executable if it has a chance of being successfully executed (the rule’s execution generates a target model consistent with the target metamodel integrity constraints).Source

MetaModel

Target MetaMod

el

rule

Conf

orm

s To

Conf

orm

s To

4/20

Page 6: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name college c ), c: StudentMM!College ( name p.collegeName )}

rule

Person

name: Stringage: IntegercollegeName: String

**

Knows

{Sym}

PersonMM

Student

name: StringSubject* IsEnrolledIn 1..*

id: String

College

name: String* StudiesAt 1

StudentMM

name: Erikage: 21collegeName: UOC

name: Erik

name: UOC

Studie

sAt

NOT

Con

form

s To

Conf

orm

s To

5/20

Page 7: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

A

dependency

6/20

Page 8: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

from an update up1 to another update up2 expresses that up2 must be included in all rules where up1 appears to avoid violating the metamodel constraints.

A

dependency

6/20

Page 9: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

A

dependency

Create a new object… to o: TargetMM!A …

Initialize its mandatory attributes… to o: TargetMM!A( attrA value) …

Create its mandatory links… to o: TargetMM!A( b obj) …

Every time we… we must… … and…

TargetMM

B* 1

attrB: Type

A

attrA: Type

6/20

Page 10: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute dependencies

Mapdependencies

1

All dependenciesmapped?

2

rule

ruleis weakly executable

ruleis not weakly executable

FEEDBACK

no yes

7/20

Page 11: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name college c ), c: StudentMM!College ( name p.collegeName )}

Compute dependencies

Mapdependencies

1

All dependenciesmapped?

2

rule

is weakly executable

ruleis not weakly executable

FEEDBACK

no yes

rule

Subject* IsEnrolledIn 1..*

id: String

College

name: String* StudiesAt 1

Student

name: String

rule

Create a new Student requires:Initialize its name attributeCreate 1 link of StudiesAt associationCreate at least 1 link of IsEnrolledIn association

Create a new College requires:Initialize its name attribute

Dependencies

8/20

Page 12: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute dependencies

Mapdependencies

1

2

rule

All dependenciesmapped?

ruleis weakly executable

ruleis not weakly executable

FEEDBACK

no yes

DependenciesCreate a new Student requires:

Initialize its name attributeCreate 1 link of StudiesAt associationCreate at least 1 link of IsEnrolledIn association

Create a new College requires:Initialize its name attribute

rule

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name college c ), c: StudentMM!College ( name p.collegeName )}

9/20

Page 13: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute dependencies

Mapdependencies

1

2

rule

All dependenciesmapped?

ruleis weakly executable

ruleis not weakly executable

FEEDBACK

no yes

DependenciesCreate a new Student requires:

Initialize its name attributeCreate 1 link of StudiesAt associationCreate at least 1 link of IsEnrolledIn association

Create a new College requires:Initialize its name attribute

rule

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name college c ), c: StudentMM!College ( name p.collegeName )}

9/20

Page 14: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute dependencies

Mapdependencies

1

2

rule

All dependenciesmapped?

ruleis weakly executable

ruleis not weakly executable

FEEDBACK

no yes

DependenciesCreate a new Student requires:

Initialize its name attributeCreate 1 link of StudiesAt associationCreate at least 1 link of IsEnrolledIn association

Create a new College requires:Initialize its name attribute

rule

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name college c ), c: StudentMM!College ( name p.collegeName )}

9/20

Page 15: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute dependencies

Mapdependencies

1

2

rule

All dependenciesmapped?

ruleis weakly executable

ruleis not weakly executable

FEEDBACK

no yes

DependenciesCreate a new Student requires:

Initialize its name attributeCreate 1 link of StudiesAt associationCreate at least 1 link of IsEnrolledIn association

Create a new College requires:Initialize its name attribute

rule

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name college c ), c: StudentMM!College ( name p.collegeName )}

9/20

Page 16: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute dependencies

Mapdependencies

1

2

rule

All dependenciesmapped?

ruleis weakly executable

ruleis not weakly executable

FEEDBACK

no yes

DependenciesCreate a new Student requires:

Initialize its name attributeCreate 1 link of StudiesAt associationCreate at least 1 link of IsEnrolledIn association

Create a new College requires:Initialize its name attribute

rule

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name college c ), c: StudentMM!College ( name p.collegeName )}

9/20

Page 17: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute dependencies

Mapdependencies

1

2

rule

All dependenciesmapped?

DependenciesCreate a new Student requires:

Initialize its name attributeCreate 1 link of StudiesAt associationCreate at least 1 link of IsEnrolledIn association

Create a new College requires:Initialize its name attribute

rule

ruleis not weakly executable

FEEDBACK

no

ruleis weakly executable

yes

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name college c ), c: StudentMM!College ( name p.collegeName )}

9/20

is not Weakly Executable

rule Person2Student

ERROR:

Page 18: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute dependencies

Mapdependencies

1

2

rule

All dependenciesmapped?

DependenciesCreate a new Student requires:

Initialize its name attributeCreate 1 link of StudiesAt associationCreate at least 1 link of IsEnrolledIn association

Create a new College requires:Initialize its name attribute

rule

ruleis not weakly executable

FEEDBACK

no

ruleis weakly executable

yes

AD

D F

EED

BA

CK

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name college c ), c: StudentMM!College ( name p.collegeName )}

9/20

is not Weakly Executable

rule Person2Student

ERROR:

Page 19: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Property #2:

coverage of an rule set

10/20

Page 20: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

A set of rules is

covering if it allows addressing all elements of the source and target metamodels.

source perspective

source-coverage

target perspective

target-coverage

11/20

Page 21: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

A set of rules is source-covering when all elements of the source metamodel may be navigated throught the execution of these rules.

…is not source-covering (warning)

rule’s set

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name, college c ), c: StudentMM!College ( name p.collegeName )}

Person

name: Stringage: IntegercollegeName: String

**

Knows

{Sym}

PersonMM

12/20

Page 22: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

A set of rules is target-covering when all elements of the target metamodel may be created or initialized throught the execution of these rules.rule’s set

rule Person2Student { from p: PersonMM!Person to s: StudentMM!Student ( name p.name, college c ), c: StudentMM!College ( name p.collegeName )}

Student

name: StringSubject* IsEnrolledIn 1..*

id: String

College

name: String* StudiesAt 1

StudentMM

…is not target-covering (warning) 13/20

Page 23: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute metamodel

elementsrule setFEEDBACK

Compute addressedelements

Compute non-addressed

elements

1 2 3

14/20

Page 24: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute metamodel

elementsrule setFEEDBACK

Compute addressedelements

Compute non-addressed

elements

1 2 3

14/20

Page 25: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute metamodel

elementsrule setFEEDBACK

Compute addressedelements

Compute non-addressed

elements

1 2 3

15/20

Person classname attribute (of Person)age attribute (of Person)collegeName attribute (of Person)Knows association

Student classname attribute (of Student)College classname attribute (of College)Subject classid attribute (of Subject)StudiesAt associationIsEnrolledIn association

Page 26: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Compute metamodel

elementsrule setFEEDBACK

Compute addressedelements

Compute non-addressed

elements

1 2 3

16/20

Person classname attribute (of Person)age attribute (of Person)collegeName attribute (of Person)Knows association

Student classname attribute (of Student)College classname attribute (of College)Subject classid attribute (of Subject)StudiesAt associationIsEnrolledIn association

Is navigated?

Is created/initialized?

Page 27: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

17/20

Compute metamodel

elementsrule setFEEDBACK

Compute addressedelements

Compute non-addressed

elements

1 2 3

Non-addressed

Non-addressed

Non-addressed

Non-addressed

Non-addressed

rule setis not sourcecovering

WARNING:

is not targetcovering

rule setWARNING:

Is navigated?

Is created/initialized?

Person classname attribute (of Person)age attribute (of Person)collegeName attribute (of Person)Knows association

Student classname attribute (of Student)College classname attribute (of College)Subject classid attribute (of Subject)StudiesAt associationIsEnrolledIn association

Page 28: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Conclusions:

feedback

18/20

Page 29: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Further work:

weak executability coverage

feedbackAddress new correctness properties

Provide tool support

Address other types of rules 19/20

Page 30: Two Basic Correctness Properties for ATL Transformations: Executability and Coverage (MtATL 2011)

Elena Planas [email protected]

Thanks for your attention!

20/20