formal specification and testing of model transformations · formal specification and testing of...
TRANSCRIPT
![Page 1: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/1.jpg)
Formal Specification and Testing of
Model Transformations
Manuel Wimmer, Loli Burgueño, Lars Hamann, Martin Gogolla, Antonio Vallecillo,
Universidad de Málaga/Univertät Bremenhttp://www.lcc.uma.es/~av
![Page 2: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/2.jpg)
Introduction
Progress Bar
![Page 3: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/3.jpg)
MDE
MDE is about formulating SE activities in terms of Models and Model Transformations between them
Models describe different views of the (same) system, at different levels of abstraction
Structural models, analysis models, behavioural models, run-time models, …
Model Transformations describe the relationships between these views
Refinement relations, development relations, abstractionrelations, mapping relations, …
3SFM 2012Formal Specification and Testing of Model Transformations
![Page 4: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/4.jpg)
Model Transformation
A model transformation is(1) The specification of the relationship between one set of source models and one set of output models(2) The process that generates such relationship
• Krzysztof Czarnecki, Simon Helsen: “Feature-based survey of model transformation approaches”. IBM Systems Journal 45(3): 621-646 (2006)
• Davide di Ruscio, Romina Eramo, Alfonso Pierantonio: “Model Transformations”. Proc. of SMF’12, LNCS 7320, 91-136, 2012.
SFM 2012Formal Specification and Testing of Model Transformations 4
![Page 5: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/5.jpg)
Model Transformations
Although specified at a very high level of abstraction, model transformations are becoming very complex as the complexity of the relations they are able to describe grows…
5SFM 2012Formal Specification and Testing of Model Transformations
![Page 6: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/6.jpg)
Model Transformation Challenges
6SFM 2012Formal Specification and Testing of Model Transformations
Chains of TransformationsConsider the MDA scenario: CIM -> PIM -> PSM -> Code
Higher Order TransformationsTransformations may produce transformations that may produce transformations …
Underspecified MetamodelsConsider the UML metamodel: many optional features, …
Complexity of Input ModelsLarge graphs, combinatorial explosion how to combine model elements, …
No model transformation specifications existIs it possible to reuse an existing model transformation for a given scenario?
![Page 7: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/7.jpg)
7
Even very simple transformations may not be that simple!
SFM 2012Formal Specification and Testing of Model Transformations
![Page 8: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/8.jpg)
Example 1
Persons to Families
8SFM 2012Formal Specification and Testing of Model Transformations
![Page 9: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/9.jpg)
Persons2Family Transformation in ATL
SFM 2012Formal Specification and Testing of Model Transformations 9
![Page 10: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/10.jpg)
Persons2Family Transformation in ATL
10
This cannot be wrong!
SFM 2012Formal Specification and Testing of Model Transformations
![Page 11: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/11.jpg)
Persons2Family Transformation in ATL
11
Have you tried this?
SFM 2012Formal Specification and Testing of Model Transformations
![Page 12: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/12.jpg)
Not as easy as one might have thought
12
An internal error occurred during: "Launching Persons2Families".
java.lang.ClassCastException:org.eclipse.m2m.atl.engine.emfvm.lib.OclUndefined cannot be cast toorg.eclipse.m2m.atl.engine.emfvm.lib.HasFields
SFM 2012Formal Specification and Testing of Model Transformations
![Page 13: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/13.jpg)
Example 2
Copy Transformation
13ECMFA 2011Formal Specification and Testing of Model Transformations
UniMMCreate a copy of a model by using a model transformation
![Page 14: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/14.jpg)
Copy Transformation in ATL
module Copier;create OUT : MM2 from IN : MM1;
rule Student {from s1 : MM1!Studentto s2 : MM2!Student (
name <- u1.name)
}
rule Teacher {from t1 : MM1!Teacherto t2 : MM2!Teacher (
name <- u1.name)
}
rule Tutor {from t1 : MM1!Tutorto t2 : MM2!Tutor (
name <- u1.name)
}
14SFM 2012Formal Specification and Testing of Model Transformations
It is so simple - this cannot be wrong!
![Page 15: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/15.jpg)
Let us try it out!
15SFM 2012Formal Specification and Testing of Model Transformations
S1: Student
name = Xavi
T1: Teacher
name = Alonso
S1: Student
name = Xavi
T1: Teacher
name = Alonso
Input Model
Output Model
![Page 16: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/16.jpg)
Not as easy as one might have thought
16
An internal error occurred during: "Launching Copier".
org.eclipse.m2m.atl.engine.emfvm.VMException: Trying to register several rules as default for element DynamicEObjectImpl@T2 (eClass: EClassImpl@1cebdb2a (name: Tutor) …) : Student and Teacher
SFM 2012Formal Specification and Testing of Model Transformations
S1: Student
name = Xavi
T1: Teacher
name = Alonso
T2: TUTOR
name = Iniesta
Input Model
![Page 17: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/17.jpg)
Example 3Class Diagrams 2 Relations Transformation
17ECMFA 2011Formal Specification and Testing of Model Transformations
Class Diagram Relations
Reuse a transformation that implements the “One Table per Class” strategy. But no other documentation is available…
Schema
Tabletables
*
Columntype : String
*columns
Package
classes* attributes*
general
Attributetype : String
Class*
Class2Relations.atlSource MM Target MM
![Page 18: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/18.jpg)
Not as easy as one might have thought
18ECMFA 2011Formal Specification and Testing of Model Transformations
Input Model Output Model
Person
id : String{size < 10}
Student
/id : String{size < 7}
Person
id …
Student
id …id
It turns out that derived attributes are not properly treated by the transformation, i.e., invalid target models are produced
![Page 19: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/19.jpg)
Specification and Testing of Model Transformations
![Page 20: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/20.jpg)
Some questions
What is testing?
What should be tested on a model transformation?
Should all properties to the tested treated equally?
Which are those properties?
Should we always aim for the best?
SFM 2012Formal Specification and Testing of Model Transformations 20
![Page 21: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/21.jpg)
MT Testing Landscape
21Formal Specification and Testing of Model Transformations
Plethora of testing approaches for MTs ranging fromfull verification tolightweight certification
Two classification dimensionsLevel on which they are defined
General ones are usable for all transformations Specific ones have to be defined for each transformation
Related to syntax or semantics“Syntactic” properties are checked on specifications
Conformance (G), Correct output models (S)
“Semantic” properties are checked on executions E.g., Rule confluence (G), termination (G), preservation of some properties (S), etc.
SFM 2012
![Page 22: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/22.jpg)
General Transformation Properties
22SFM 2012Formal Specification and Testing of Model Transformations
TMM
MT Implementation
TM
ATL Metamodel
ATL Model
Ex(TM)
Syntactic Properties
Semantic Properties
SoM TaM
Ex(SoM) Ex(TaM)
![Page 23: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/23.jpg)
Specific Transformation Properties
23SFM 2012Formal Specification and Testing of Model Transformations
TMM
MT Implementation
TM
Ex(TM)
Syntactic Properties
Semantic Properties
SoM TaM
Ex(SoM) Ex(TaM)
SMM
SM
Ex(SM)
describes >
< fulfills
MT Specification
![Page 24: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/24.jpg)
Defining Specific, Syntactical Properties
24SFM 2012Formal Specification and Testing of Model Transformations
Model LevelComplete ModelsModel Fragments
Metamodel LevelGraphical Constraint LanguagesTextual Constraint Languages
![Page 25: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/25.jpg)
Complete Models
Model Fragments
Model Level Specification
25SFM 2012Formal Specification and Testing of Model Transformations
Ex(TM)SoM TaM TaM=
Ex(TM)SoM TaM TaM
ExpectedTarget Model
Actual Target Model
ExpectedTarget Model
Actual Target Model
Pros: Modeling Languages are enough to specify test casesCons: Have to be defined for each new test source model
![Page 26: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/26.jpg)
Graphical Constraint Languages
Textual Constraint Language
Metamodel Level Specification
26SFM 2012Formal Specification and Testing of Model Transformations
P(Mother2Female)Families
m:Member fam:Familymother
f:FemalefirstName=XlastName=Y
fullName=X.concat(“_”).concat(Y)
Persons
context MFDS inv Src_Trg_Mother2Female:Female.allInstances−> forAll( f |
Family.allInstances−> exists ( fam | fam.mother.firstName.concat(’␣’).concat(fam.lastName)= f.fullName
) )
![Page 27: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/27.jpg)
Specifying and Testing Model Transformations:
The Tracts Approach
![Page 28: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/28.jpg)
Motivation for Tracts
In general it is very difficult and expensive (time and computational complexity-wise) to validate in full the correctness of a model transformation (even the simplest ones).
We propose a cost-effective MT testing approach based on the concept of Tract, which is a generalization of the concept of Model Transformation Contract.
28SFM 2012Formal Specification and Testing of Model Transformations
![Page 29: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/29.jpg)
Contracts as Specifications
29SFM 2012Formal Specification and Testing of Model Transformations
Transformation Implementation
Transformation Specification
describesfulfills
Specification: A document that specifies, in a complete, precise, verifiable manner, the requirements, design, behavior, or other characteristics of a system or component… [IEEE Standard Computer Dictionary]
Implementation: (1) The process of translating a design into hardware components, software components, or both. (2) The result of the process in (1)
[IEEE Standard Computer Dictionary]
What?
How?
vs.
Tracts
ATL, ETL, QVT-R, QVT-O, RubyTL,
TGG, GT, …
![Page 30: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/30.jpg)
Contracts as Filters
30SFM 2012Formal Specification and Testing of Model Transformations
Transformation Implementation
Transformation Specification
Valid?
Input Model Output Model
![Page 31: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/31.jpg)
Contracts as Oracles
31SFM 2012Formal Specification and Testing of Model Transformations
Transformation Implementation
Transformation Specification
Valid?
Input Model Output Model
![Page 32: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/32.jpg)
Contracts as Implementation
32SFM 2012Formal Specification and Testing of Model Transformations
Transformation Implementation
Transformation Specification
Input Model Output Model
T
![Page 33: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/33.jpg)
Tracts
A Tract defines a set of constraints on the source and targetmetamodels, a set of source-target constraints, and a tract test suite (a collection of source models satisfying the source constraints)
33SFM 2012Formal Specification and Testing of Model Transformations
![Page 34: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/34.jpg)
34Formal Specification and Testing of Model Transformations
Set-Theory based View on Tracts
SFM 2012
![Page 35: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/35.jpg)
35Formal Specification and Testing of Model Transformations
Set-Theory based View on Tracts
SFM 2012
![Page 36: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/36.jpg)
The elements of a Tract
SFM 2012 36Formal Specification and Testing of Model Transformations
![Page 37: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/37.jpg)
Black-box testing of MTs
For each tractInput test suite models are automatically generated using ASSL
Input models are transformed into output models by the transformation under test
The results are checked with the USE tool against the constraints defined for the transformation
Different tracts are defined for every transformationEach one defines either a use case or a special conditionor a negative test case
37SFM 2012Formal Specification and Testing of Model Transformations
![Page 38: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/38.jpg)
Source Metamodel: FamilyTarget Metamodel: Person
Tracts for the Families 2 Persons MT
SFM 2012Formal Specification and Testing of Model Transformations 38
![Page 39: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/39.jpg)
Tract: Members only - interested in families consisting only of members
Precondition
Test Source Model
Example of Tract: “Members only”
SFM 2012Formal Specification and Testing of Model Transformations 39
![Page 40: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/40.jpg)
Example of Tract: “Members only”
SFM 2012 40Formal Specification and Testing of Model Transformations
Generation of source models is done by means of ASSL (A Snapshot Sequence Language)
ASSL allows to generate Object Diagrams for Class Diagrams
ASSL is an imperative programming language with features for randomly choosing attribute values or association ends
ASSL supports backtracking for finding object diagrams with particular properties
![Page 41: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/41.jpg)
ASSL Code for Input Model Generation
Example of Tract: “Members only”
SFM 2012Formal Specification and Testing of Model Transformations 41
![Page 42: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/42.jpg)
Tract: Members only - interested in families consisting only of members
Postcondition
Transformation Result
Example of Tract: “Members only”
SFM 2012Formal Specification and Testing of Model Transformations 42
![Page 43: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/43.jpg)
Issue in Transformation
Example of Tract: “Members only”
SFM 2012Formal Specification and Testing of Model Transformations 43
![Page 44: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/44.jpg)
Possible Solution: Stronger Precondition
Other Solutions?
Example of Tract: “Members only”
SFM 2012Formal Specification and Testing of Model Transformations 44
![Page 45: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/45.jpg)
Source Metamodel: PersonTarget Metamodel: Family
Tracts for the Person 2 Family MT
SFM 2012Formal Specification and Testing of Model Transformations 45
![Page 46: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/46.jpg)
Tract: mfds - interested in families consisting of one mother, father, daughter, and son
Example of Tract: “mfds”
SFM 2012Formal Specification and Testing of Model Transformations 46
mother(m)-father(f)-daughter(d)-son(s)
![Page 47: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/47.jpg)
Src_Constraints
Trg_Constraint
Src_Trg_Constraint
Tract constraints (1/2)
SFM 2012 47Formal Specification and Testing of Model Transformations
Should we introduce Family.size = Person.size/4?
![Page 48: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/48.jpg)
Tract constraints (2/2)
SFM 2012 48Formal Specification and Testing of Model Transformations
Src_Trg_Constraint
![Page 49: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/49.jpg)
SFM 2012 49Formal Specification and Testing of Model Transformations
Mdfs Tract
![Page 50: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/50.jpg)
ASSL to generate the input models
SFM 2012Formal Specification and Testing of Model Transformations 50
![Page 51: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/51.jpg)
Generation of negative cases
SFM 2012Formal Specification and Testing of Model Transformations 51
![Page 52: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/52.jpg)
Kinds of problems found
Errors in the transformation codeErrors in the Tract specificationSource-target semantic gap/mismatches
Unmarried couples, families with a single father or mother, married couples whose members have maintained their last names,…cannot be transformed.
SFM 2012Formal Specification and Testing of Model Transformations 52
![Page 53: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/53.jpg)
Summary
Pros:Modular: Allows partitioning the input space into smaller, focused behavioural unitsSpecific: allows defining specific tests for the input modelsBlack-box: Tests the MT as-is, independent from implementationCost-effective: Small tests are easy to define and to check
Cons:It does not guarantee full correctness(“certification” vs. full validation)Completeness and coverage of input models is not guaranteedTracts are not easy to specify in general
SFM 2012Formal Specification and Testing of Model Transformations 53
![Page 54: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/54.jpg)
Tracts By-Example
![Page 55: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/55.jpg)
Source MM: State MachineTarget MM: Lookup Table
We want only one lookup tableWhere each entry is an event of the source model
Tract example: SM2T (StateMachine 2 LookUpTable)
![Page 56: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/56.jpg)
SM2T: More restrictions
Source MM: State MachineTarget MM: Lookup Table
Multiplicity constraintsUniqueness on names of the state machinesUniqueness on names of states within the same machine
SFM 2012Formal Specification and Testing of Model Transformations 56
![Page 57: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/57.jpg)
SM2T: More restrictions
Source MM: State MachineTarget MM: Lookup Table
Multiplicity constraintsUniqueness on names of the State MachinesUniqueness on names of states within the same machine
SFM 2012Formal Specification and Testing of Model Transformations 57
![Page 58: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/58.jpg)
Tracts for SM2T Six Tracts to start with
![Page 59: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/59.jpg)
Tracts for SM2T
![Page 60: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/60.jpg)
Tracts for SM2T
![Page 61: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/61.jpg)
Tract example: ConstraintsTract for SM2:
Src_Constraints
Trg_Constraint
![Page 62: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/62.jpg)
Tract example: ConstraintsTract for SM2:
Src_Trg_Constraint
T EventChange
sm fromState toState
x SM2 A B
LookUpTable
![Page 63: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/63.jpg)
ASSL Code for SM2
![Page 64: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/64.jpg)
Exercise 1: Specify and implement
Copy Transformation
64ECMFA 2011Formal Specification and Testing of Model Transformations
UniMMCreate a copy of a model by using a model transformation
a) What tracts do we need?b) Identify use casesc) Write the ATL transformationd) Prove its correctness
![Page 65: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/65.jpg)
Exercise2: nSM2fSM
nSM2fSM: Translate a nested state machine into a flat state machineImplementation: In-place TransformationSpecification: What Tracts do we need?
S1S2
S3S2.1
S2.2
ac
bd
S1 S3S2.1 S2.2a c
bd
b
d
![Page 66: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/66.jpg)
Tractable Model Transformation Typing
![Page 67: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/67.jpg)
Motivation for MT Typing
SFM 2012Formal Specification and Testing of Model Transformations 67
MDE tackles complexity of large systems, but this requires to model-in-the-large
This results in megamodels
Increasing need for precise and abstract mechanismsReason about the designed systemsTest individual components
Assigning types to models and model transformations and arrange them in type hierarchies
Light-weight approach to type model transformations using tracts
![Page 68: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/68.jpg)
[ISO/IEC 10746-2]
Subtype/supertype: A type A is a subtype of a type B, and B is a supertype of A, if every <X> which satisfies A also satisfies B.
Type (of an <X>): A predicate characterizing a collection of <X>s.
Definitions: Type and Subtype/Supertype
![Page 69: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/69.jpg)
Typing models
Model types are needed fo describing the signature of model operations
The type of a model is basically its metamodel
We can talk about “subtyping” and “safe replaceability”
M’ extends M iff M’ contains all classes, attributes and relationships of M, and M’ imposes the same or weakerconstraints than M
SFM 2012Formal Specification and Testing of Model Transformations 69
![Page 70: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/70.jpg)
Typing Models (2/2)CD_struct
Package
classes*
*general
Attributetype : String
Class*
CD_struct_behav
Package
classes*
*general
Attributetype : String
Class* Operation
type : String
operations *isAbstract :
Boolean
![Page 71: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/71.jpg)
Typing MTs (1/2)
TL
T
ATL Metamodel
ATL Model
T
T’
N
N’
M
M’
«conformsTo»
![Page 72: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/72.jpg)
To reason properly about subtype relationships between transformations, the behavioural type of a transformation must be considered
But…Typing model transformation as operations is difficult Type of any behavioral software artefact is complex; manipulating and reasoning about behavioural types expensiveCurrent types capture full behaviour of the artefact independently from any context of useTraditionally requires heavyweight reasoning techniques and tools such as theorem provers
Typing MTs (2/2)
![Page 73: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/73.jpg)
Model Transformation Typing using Tracts
T
T ’
N
N’
M
M’
Legend:M, M’ … Source MMsN, N’ … Target MMsT, T ‘ … Tracts
T
T’
< fulfills
< fulfills
![Page 74: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/74.jpg)
Model Transformation Typing by Example
![Page 75: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/75.jpg)
Model Transformation Typing by ExampleThree Transformations
![Page 76: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/76.jpg)
Model Transformation Typing: Relationships between Transformations
![Page 77: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/77.jpg)
Correctness of a MT implementationcheck that a given transformation conforms to a tract, i.e., it conforms to a certain type
Safe substitutability of MTs; two step process:first input models are automatically generated and thenfor each of these we can check whether the transformation fulfils the associated tract
Incremental and systematic transformation developmentextend source and target metamodels by subtyping through small increments accompanied by corresponding tracts including test suites;benefit: rapid and direct feedback provided
Declarative vs imperative tracts only the relationship between source and target elements can be characterized; but tracts also be described in an operational way when including operations mapping source elements to target elements
Discussion
![Page 78: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/78.jpg)
Tool Support for Tracts
![Page 79: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/79.jpg)
Tracts Tool Support based on USE
SFM 2012Formal Specification and Testing of Model Transformations 79
USE - The UML-based Specification EnvironmentModeling of UML Class Diagrams and Object DiagramsSupport for full OCLASSL for generating Object DiagramsPowerful API for validating models
![Page 80: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/80.jpg)
SFM 2012 80Formal Specification and Testing of Model Transformations
Metamodels as Class Diagrams
![Page 81: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/81.jpg)
SFM 2012 81Formal Specification and Testing of Model Transformations
Models as Object Diagrams
![Page 82: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/82.jpg)
SFM 2012 82Formal Specification and Testing of Model Transformations
Checking the Tracts
![Page 83: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/83.jpg)
Test ATL Model Transformations for EMF-based Models
Bridge EMF and USE
SFM 2012Formal Specification and Testing of Model Transformations 83
![Page 84: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/84.jpg)
Tracts for EMFhttp://atenea.lcc.uma.es/index.php/Main_Page/Resources/Tracts
SFM 2012Formal Specification and Testing of Model Transformations 84
![Page 85: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/85.jpg)
Tracts for EMF
Time for a Tool Demo!
SFM 2012Formal Specification and Testing of Model Transformations 85
![Page 86: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/86.jpg)
The Future of Tracts
![Page 87: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/87.jpg)
Next steps
Incorporate existing works on the effective generation of input test cases, oracles, test inputs coverage
Study tracts properties: composability, subsumption, refinement,…
Tracts for bi-directional transformations
Improve engineering aspectsVisual specification of tracts
Diagnostics
Improve tool support
Define libraries of tracts
87SFM 2012Formal Specification and Testing of Model Transformations
![Page 88: Formal Specification and Testing of Model Transformations · Formal Specification and Testing of Model Transformations SFM 2012 29 Transformation Implementation Transformation Specification](https://reader033.vdocuments.site/reader033/viewer/2022050501/5f93a0c0c777d8149f3198ab/html5/thumbnails/88.jpg)
Manuel Wimmer, Loli Burgueño, Lars Hamann, Martin Gogolla, Antonio Vallecillo,
Universidad de Málaga/Univertät Bremenhttp://www.lcc.uma.es/~av
Thanks!
100 % Completed!