- ffice@big.tuwien.ac.at, www.big.tuwien.ac.at
Introduction to Model Versioning
SFM-12: MDE
June 22, 2012 Petra Brosch, Gerti Kappel, Philip Langer, Martina Seidl, Konrad Wieland, and Manuel Wimmer
Introduction to Model Versioning SFM-12: MDE June 22, 2012 Petra - - PowerPoint PPT Presentation
Introduction to Model Versioning SFM-12: MDE June 22, 2012 Petra Brosch, Gerti Kappel, Philip Langer, Martina Seidl, Konrad Wieland, and Manuel Wimmer Business Informatics Group Institute of Software Technology and Interactive Systems
Introduction to Model Versioning
SFM-12: MDE
June 22, 2012 Petra Brosch, Gerti Kappel, Philip Langer, Martina Seidl, Konrad Wieland, and Manuel Wimmer
Outline
2
Evolution
Definition
http://www.merriam-webster.com/dictionary/evolution
higher, more complex, or better state
shutdown.
3
Software Evolution aka Software Aging
David Lorge Parnas: Software aging. In Proc. of the International Conference on Software Engineering (ICSE’94), pages 279–287. IEEE Computer Society Press, 1994.
4
Software Evolution aka Software Maintenance
5
Evolution
6
Is Software resistant to change? Of course, not!
will be modified, thus its entropy increases.
Everything changes…
7
Evolution in Model-driven Software Engineering Model Requirements
fulfillsPlatform
is_deployedChange Change
instanceOfMetamodel Change Model Change
Evolution in Model-driven Software Engineering
8
Modeling Languages evolve too! Model Requirements
fulfillsPlatform
is_deployedChange Change
instanceOfMetamodel Change Model Change
Modeling Language Evolution
Metamodels are the central artefacts!
9
Metamodel
Textual Concrete Syntax Graphical Concrete Syntax Models Model 2 Model Transformations Model 2 Code Transformations OCL Constraints Inplace Transformations
Co-Evolution
Consequence of Metamodel Evolution
the change of a related entity
entities, each of which is also evolving in response to a set of entities
related model
10
a a' b b' ∆ ∆
Metamodel Evolution
Mainly models, i.e., instances of metamodels, are currently co-evolved!
11
Metamodel
Textual Concrete Syntax Graphical Concrete Syntax Models Model 2 Model Transformations Model 2 Code Transformations OCL Constraints Simulators
Evolution in Model-driven Software Engineering
12
Platforms (Software and Hardware) evolve rapidly! Model Requirements
fulfillsPlatform
is_deployedChange Change
instanceOfMetamodel Change Model Change
Platforms evolve rapidly!
13
Plaforms are represented by metamodels
MMa MMb
Source Metamodel Target Metamodel
t1
Modeling Language Platform Deployment
t1 … Forward Transformation
14 MMa MMb MMb‘
Platform Evolution
t1 t2
t1 … Forward Transformation t2, t3 … Migration Transformation
v1.0 v2.0
Metamodel/Transformation (Co-)Evolution
Platform evolution is reflected by target metamodel evolution
Target Metamodel
v3.0
MMb‘‘
t3
Source Metamodel
15 MMa MMb MMb‘
Source Metamodel
Platform Evolution
t1 t2 v1.0 v2.0
Metamodel/Transformation (Co-)Evolution
Transformation chains for tackling platform evolution
Target Metamodel
v3.0
MMb‘‘
t3
t1 … Forward Transformation t2, t3 … Migration Transformation
Evolution in Model-driven Software Engineering
16
Is modeling a one woman-show? Model Requirements
fulfillsPlatform
is_deployedChange Change
instanceOfMetamodel Change Change
Evolution in Model-driven Software Engineering
17
No, support for team-based development is needed! Model Requirements
fulfillsPlatform
is_deployedChange Change
instanceOfMetamodel Change Change
Support for Team-based Development of Models is Needed!
– David Lorge Parnas, 1975
they are built by teams of engineers – Carlo Ghezzi, Mehdi Jazayeri, and Dino Mandrioli , 2002
18
∆a
Initial Modelma m0 mb mc md
Revised Models Consolidated Modelm1
∆b ∆c ∆d
m1 := ma ⊕ mb ⊕ mc ⊕ md pre := parallelIndependent(∆d, ∆c, ∆b, ∆a)
Evolution Scenarios at a Glance
19
a a' a a' b b' a a1 a2 a' ∆ ∆ ∆ ∆ ∆
Outline
20
Versioning
Configuration Management for software in late 1970s Software Configuration Management was born (with SCCS)
a series of changes”
21
Estublier, J., Leblang, D., van der Hoek, A., Conradi, R., Clemm, G., Tichy, W., & Wiborg-Weber, D. (2005). Impact of Software Engineering Research on the Practice of Software Configuration Management. ACM Transactions on Software Engineering and Methodology, 14(4), 383-430.History of Versioning Systems
22
Based on http://codicesoftware.blogspot.com/2010/11/version-control-timeline.html
local to central … central to distributed …1972
sccs
discourage branching … everything is a branch …Versioning Paradigms
Update-update, Delete-update
23
Model Versioning
24
Overview on Optimistic Model Versioning
Model Versioning
Is getting more and more important
25
Wieland, K., Fitzpatrick, G., Kappel, G., Seidl, M., and Wimmer, M. (2012). Towards an Understanding of Requirements for Model Versioning Support. To appear in the International Journal of People-Oriented Programming, IGI Global.The Model Versioning Process Revised
26
V0 V0’ V0’’ V0’+V0’’
A A A A A A A A C C A A CV1
A AWhy not SVN with Unix diff?
27
Design Dimensions of Versioning Systems
28
Artifact Representation Delta Identification
Graph-based artifact representation State-based delta identification Text-based artifact representation State-based delta identification Graph-based artifact representation Operation-based delta identification Text-based artifact representation Operation-based delta identification
State-based Operation-based Text-based Graph-based
Text-based Merging
Example
29
Text-based Representation Version 0 Version 1Version 2
1: class Human { 2: string[1..1] name 3: } 4: class Vehicle { 5: integer[0..1] carNo 6: } 1: class Person { 2: string[1..1] name 3: Vehicle[0..*] owns 4: } 5: class Vehicle { 6: integer[1..1] carNo 7: } 1: class Human { 2: string[1..1] name 3: } 4: class Car { 5: integer[0..1] regId 6: } Grammar Class:= "class" name=ID "{" (references+=Reference)* (attribute+=Attribute)* "}"; Reference:= target=[Class] "[" lower=BOUND ".." upper=BOUND "]" name=ID; Attribute:= type=ID "[" lower=BOUND ".." upper=CARD "]" name=ID; terminal ID:= ('a'..'z'|'A'..'Z'|'_')+; terminal BOUND:= (('0'..'9')+)|('*');Text-based and State-based Merging
30
Version 0 Version 1Version 2
1: class Human { 2: string[1..1] name 3: } 4: class Vehicle { 5: integer[0..1] carNo 6: } 1: class Person { 2: string[1..1] name 3: Vehicle[0..*] owns 4: } 5: class Vehicle { 6: integer[1..1] carNo 7: } 1: class Human { 2: string[1..1] name 3: } 4: class Car { 5: integer[0..1] regId 6: }Version 3
1: class Person { 2: string[1..1] name 3: Vehicle[0..*] owns 4: } 5: class Car { 6: <<UP/UP>> 7: } a: integer[1..1] carNo b: integer[0..1] regId c: integer[1..1] regIdText-based and Operation-based Merging
31
Version 0 Version 1Version 2
1: class Human { 2: string[1..1] name 3: } 4: class Vehicle { 5: integer[0..1] carNo 6: } 1: class Person { 2: string[1..1] name 3: Vehicle[0..*] owns 4: } 5: class Vehicle { 6: integer[1..1] carNo 7: } 1: class Human { 2: string[1..1] name 3: } 4: class Car { 5: integer[0..1] regId 6: }Version 3
1: class Person { 2: string[1..1] name 3: Car[0..*] owns 4: } 5: class Car { 6: <<UP/UP>> 7: } a: integer[1..1] carNo b: integer[0..1] regId c: integer[1..1] regId Rename-Op: change Class.name; update Property.type pre@Class.name with post@Class.name;Graph-based Merging
Example
32
Human : Class Vehicle : Class name : Attribute type = string lower = 1 upper = 1Graph-based and State-based Merging
33
Heuristic-based Matching
Human : Class Vehicle : Class name : Attribute type = string lower = 1 upper = 1Graph-based and State-based Merging
34
Match Model based on Heuristic (Name + Structure Equivalence)
Human : Class Vehicle : Class name : Attribute type = string lower = 1 upper = 1Graph-based and State-based Merging
35
Match Model + Diff Model
Human : Class Vehicle : Class name : Attribute type = string lower = 1 upper = 1Graph-based and State-based Merging
36
ID-based Matching
Human : Class Vehicle : Class name : Attribute type = string lower = 1 upper = 11 2 3 4 1 2 3 4 5 1 2 3 4 1 2 3 4 5
State-based Merge Algorithm (agnostic of representation & match and diff realization)
37
Design Decisions
either V1 or V2
towards operation-based merging
for each n0 ∊ V0 n1 := match(n0 in V1) n2 := match(n0 in V2) if hasMatch(n0 in V1) && hasMatch(n0 in V2) if diff(n0, n1) && not diff(n0, n2) -> use n1 if not diff(n0, n1) && diff(n0, n2) -> use n2 if diff(n0, n1) && diff(n0, n2)Outline
38
Conflict Examples
Contradicting Change
39
Person Person getName()
Person
Conflict Examples
Equivalent Change
40
Person Employee Person Employee Person Employee Person
Conflict Examples
Equivalent Change
41 Employee Person Employee Person Employee Person
Employee Person Employee Person Employee Person
Class
superClassGeneralization
subClasses UML Metamodel V2 1..1 1..* name:StringClass
superClasses 0..* UML Metamodel V1 name:String name=“Person“c1:Class
name=“Employee“c2:Class
name=“Employee“c3:Class
name=“Person“c1:Class
Sally Harry name=“Person“c1:Class
name=“Employee“c2:Class g1:Generalization
name=“Person“c1:Class
name=“Employee“c3:Class g2:Generalization
Sally HarryMetamodel Model (AS) Model (CS)
Car Engine
has 1*
Car Engine
has 1Conflict Examples
Syntactic Inconsistency
42
Car Engine
hasCar Engine
has*
1Conflict Categorization
43
affect the merge result Operation-based conflicts The set of applied operations and a specification
but no language specific knowledge
State-based conflicts A merged state and consistency rules are required
Contradicting Operations Inconsistent State Parallel Dependence Non- Commutativity Syntactic Inconsistency Semantic Inconsistency Vo Vr1 Vr2 m2 m1 m1 m2 Vm Vo Vr1 Vr2 m2 m1 m1 m2 Vm Vo Vr1 Vr2 m2 m1 m1 m2 Vm' Vm'' ≠Conflict Categorization
44
Which information/knowledge is required for detection?
Metamodel Operation ContractGeneric information
Modeling Language Dependent Extra Knowledge necessary
Contradicting Operations: Update/Update
45
V*
Equivalent Operations: Add/Add
46
Employee Employee VEquivalent Operations: Delete/Delete
47
Employee contract Employee VRedundancy: Language Knowledge
48
Developer Manager Developer Manager managedBy Developer 1 VRedundancy: Language Knowledge
49
Employee contract Company * 1 Employee Company * * Contract Contract Company * 1 Employee * 1 {nonunique} VRedundancy: Domain Knowledge
50
Person Person lastname: String Person surname: String VMetamodel Violation
51
:A :B t t+1 :A :B t t+1 :A :B t t+1 VOperation Contract Violation
52
Assistent Professor Researcher getLectures() Assistent getLectures() Professor getLectures() Researcher ProjectAss Assistent Professor Researcher getLectures() getLectures() VCommon Knowledge Violation
53
Circle Square Shape Rectangle Circle Quadrangle Shape Square Rectangle Circle Square Shape Rectangle Rhomboid VUser-defined Knowledge Violation
54
:A CM turnOn() makeCoffee() ON ON :A CM turnOn() makeCoffee() ON OFF turnOff() :A CM turnOn() makeCoffee() ON makeTea() ON VOutline
55
AMOR: Adaptable Model Versioning
56
Overview
By Demonstration“, TU Wien, 2011.
www.modelversioning.org
Adaptable Model Versioning
57
Overview
Adaptable Model Versioning
58
Versioning Process Resolution Operation Detection Operation-based Conflict Detection Conflict-tolerant Merge State-based Conflict Detection
V
Vr2
Adaptable Model Versioning
59
Versioning Process Resolution Operation Detection Operation-based Conflict Detection Conflict-tolerant Merge State-based Conflict Detection
V
Vr2
MVo●Vr1 DVo●Vr1 MVo●Vr2 DVo●Vr2
Adaptable Model Versioning
60
Versioning Process Resolution Operation Detection Operation-based Conflict Detection Conflict-tolerant Merge State-based Conflict Detection
V
Vr2
MVo●Vr1 DVo●Vr1 MVo●Vr2 DVo●Vr2 CV1●Vr2
Adaptable Model Versioning
61
Versioning Process Resolution Operation Detection Operation-based Conflict Detection Conflict-tolerant Merge State-based Conflict Detection
V
Vr2
MVo●Vr1 DVo●Vr1 MVo●Vr2 DVo●Vr2 CV1●Vr2
Vm+oc
Adaptable Model Versioning
62
Versioning Process Resolution Operation Detection Operation-based Conflict Detection Conflict-tolerant Merge State-based Conflict Detection
V
Vr2
MVo●Vr1 DVo●Vr1 MVo●Vr2 DVo●Vr2 CV1●Vr2
Vm+oc+sc
Adaptable Model Versioning
63
Versioning Process Resolution Operation Detection Operation-based Conflict Detection Conflict-tolerant Merge State-based Conflict Detection
V
Vr2
MVo●Vr1 DVo●Vr1 MVo●Vr2 DVo●Vr2 CV1●Vr2
Vm
Adaptable Model Versioning
64
Versioning Process: Step by step
Operation Detection
65
Two approaches for obtaining applied operations
compared artifacts necessary
Operation Detection
66
Overview
V
DVo●Vr1
Phase 2
MVo●Vr1
Phase 1 Phase 3
DVo●Vr1
copOperation Detection: Phase 1 – Matching
67
Goal
Operation Detection: Phase 1 – Matching
68
Metamodel and Example Model
by a match model (weaving model)
Match Metamodel
State Machine Model Vr
: MatchMatch Model State Machine Model Vo
: Unmatch side = Revised : Unmatch side = Original : Match : Match : Match : Match : MatchModelOperation Detection: Phase 1 – Matching
69
Metamodel and Example Model
by a match model (weaving model)
Match Metamodel
State Machine Model Vr
: MatchMatch Model State Machine Model Vo
: Unmatch side = Revised : Unmatch side = Original : Match : Match : Match : Match : MatchModel : StateMachine : CompositeState name = "Active" : SingleState name = "Cooling" : SingleState name = "Heating" : SingleState name = "Idle" : Transition name = "switch" states states states states transitions target : StateMachine : CompositeState name = "Active" : SingleState name = "Cooling" : SingleState name = "Heating" : Transition name = "switch" states states states transitions target : Transition name = "switch" transitions targetOperation Detection: Phase 2 – Comparison
70
Operation Detection: Phase 2 – Comparison
71
Difference Metamodel
DifferenceModel FeatureChange ObjectChange * containment Feature EStructuralFeature (from Ecore) InsertObject DeleteObject EObject (from Ecore) changed Feature changed Object valueOperation Detection: Phase 2 – Comparison
72
Difference Model Example State Machine Model Vr State Machine Model Vo
Operation Detection: Phase 2 – Comparison
73
Difference Model Example State Machine Model Vr State Machine Model Vo
: StateMachine : CompositeState name = "Active" : SingleState name = "Cooling" : SingleState name = "Heating" : SingleState name = "Idle" : Transition name = "switch" states states states states transitions target : StateMachine : CompositeState name = "Active" : SingleState name = "Cooling" : SingleState name = "Heating" : Transition name = "switch" states states states transitions target : Transition name = "switch" transitions targetDifference Model DVo,Vr
: InsertFeatureValue : DeleteFeatureValue : Move source target : DeleteFeatureValue : DeleteObject : InsertFeatureValue : InsertObject featureOperation featureOperation value affectedObject affectedObject affectedObject value value value affectedObject : EReference name = "states" containment = trueState Machine Metamodel
: EClass name = "StateMachine" : EClass name = "SinlgeState" feature feature feature feature features features type1 2 3
Operation Detection: Phase 3
74
Composite operation detection process
Operation SpecificationsDVo●Vr1/2 DVo●Vr1/2
cop1 2 3
Operation Detection: Phase 3
75
Composite operation detection process
Operation SpecificationsDVo●Vr1/2 DVo●Vr1/2
copWhere do operation specifications come from?
Operation Specifications
76
How to specify operation specifications
Common goal should be respected during merge Thus, they should be detected
Allow modelers themselves to specify them
Operation Specifications
77
How to specify operation specifications
*
examinee Professor name Professor:Class name:Property name:Property name Student:Class examiner:Property examinee:Property examines examines:AssocModel Transformation by Demonstration (MTBD)
Derive the general transformation automatically from a demonstration of these changes applied to an example model
Preconditions Actions Postconditions Operation Specification
Can also be used as selectors. Can also be used for computing target values.
MTBD Example: Introduce Composite State
79
Idle DialTone Dialing lift dial dial hang_up hang_up Active Idle DialTone lift dial dial hang_up DialingMTBD Process
80
Overview
Wizard Initial model Working model Create initial model Copy initial model Performupdates State-based comparison Diff model Imply conditions Edit conditions Conditions
[implied]Generate OSM Operation Specification Model Revised model Conditions
[revised]Generate specific artifacts Refactoring Wizard
Modeling Configuration & Generation
… 1 2 3 5 4 6 7 8
automatic manualLegend
MTBD Process
81
Step 1: Create Initial Model
Wizard Initial model Working model Create initial model Copy initial model Performupdates State-based comparison Diff model Imply conditions Edit conditions Conditions
[implied]Generate OSM Operation Specification Model Revised model Conditions
[revised]Generate specific artifacts Refactoring Wizard
Modeling Configuration & Generation
… 1 2 3 5 4 6 7 8
automatic manualLegend
Outside IntoStart JustInto toFold toFold start Outside CompositeState IntoStart JustInto toFold startModel elements, which are… Required for execution Handled differently
MTBD Process
82
Step 2: Copy Initial Model
Wizard Initial model Working model Create initial model Copy initial model Performupdates State-based comparison Diff model Imply conditions Edit conditions Conditions
[implied]Generate OSM Operation Specification Model Revised model Conditions
[revised]Generate specific artifacts Refactoring Wizard
Modeling Configuration & Generation
… 1 2 3 5 4 6 7 8
automatic manualLegend
Unique IDs preserve relationship
MTBD Process
83
Step 3: Perform updates
Wizard Initial model Working model Create initial model Copy initial model Performupdates State-based comparison Diff model Imply conditions Edit conditions Conditions
[implied]Generate OSM Operation Specification Model Revised model Conditions
[revised]Generate specific artifacts Refactoring Wizard
Modeling Configuration & Generation
… 1 2 3 5 4 6 7 8
automatic manualLegend
Outside CompositeState IntoStart JustInto toFold startIllustrate composite operation
MTBD Process
84
Step 4: State-based Comparison
Wizard Initial model Working model Create initial model Copy initial model Performupdates State-based comparison Diff model Imply conditions Edit conditions Conditions
[implied]Generate OSM Operation Specification Model Revised model Conditions
[revised]Generate specific artifacts Refactoring Wizard
Modeling Configuration & Generation
… 1 2 3 5 4 6 7 8
automatic manualLegend
State-based Comparison
MTBD Process
85
Step 5: Imply Conditions
Wizard Initial model Working model Create initial model Copy initial model Performupdates State-based comparison Diff model Imply conditions Edit conditions Conditions
[implied]Generate OSM Operation Specification Model Revised model Conditions
[revised]Generate specific artifacts Refactoring Wizard
Modeling Configuration & Generation
… 1 2 3 5 4 6 7 8
automatic manualLegend
Generic Condition Generation
MTBD Process
86
Step 5: Imply Conditions
Wizard Initial model Working model Create initial model Copy initial model Performupdates State-based comparison Diff model Imply conditions Edit conditions Conditions
[implied]Generate OSM Operation Specification Model Revised model Conditions
[revised]Generate specific artifacts Refactoring Wizard
Modeling Configuration & Generation
… 1 2 3 5 4 6 7 8
automatic manualLegend
Generic Condition Generation
MTBD Process
87
Step 6: Edit Conditions
Wizard Initial model Working model Create initial model Copy initial model Performupdates State-based comparison Diff model Imply conditions Edit conditions Conditions
[implied]Generate OSM Operation Specification Model Revised model Conditions
[revised]Generate specific artifacts Refactoring Wizard
Modeling Configuration & Generation
… 1 2 3 5 4 6 7 8
automatic manualLegend
Configuration
Default configuration: Relaxing
MTBD Process
88
Step 7 and Step 8
Wizard Initial model Working model Create initial model Copy initial model Performupdates State-based comparison Diff model Imply conditions Edit conditions Conditions
[implied]Generate OSM Operation Specification Model Revised model Conditions
[revised]Generate specific artifacts Refactoring Wizard
Modeling Configuration & Generation
… 1 2 3 5 4 6 7 8
automatic manualLegend
MTBD: Tooling
cle&id=68&Itemid=89
89
Initial Model Revised Model Preconditions Postconditions Diff Model & AnnotationsOperation-based Conflict Detection
90
Overview
DVo●Vr1 DVo●Vr2 CV1●Vr2
cop copAtomic Operation-based Conflict Detection
91
Atomic Conflict Metamodel
Atomic Operation-based Conflict Detection
92
Conflict Pattern 1: Delete/Use Conflict
S1 S2 S1 S1 S2 Example Pattern
Atomic Operation-based Conflict Detection
93
Conflict Pattern 2: Delete/Update Conflict
There are several more patterns!
do: DeleteObject fc : FeatureChangePattern S1_1 Example S1
Composite Operation Conflict Detection
94
DVo●Vr1
copcop1..i
Vo Vr1 Vr2DVo●Vr2
copcop1..i
Composite Operation Conflict Detection
95
Introduce Composite State Rename hangup
Composite Operation Conflict Detection
96
Introduce Composite State
SingleState_0 Transition_1 Transition_2 Transition_0 SingleState_1 SingleState_2 Original match SingleState_0 Transition_1 Transition_2 Transition_0 SingleState_1 SingleState_2Precondition of composite
violated!
Transition_1.name = Transition_2.nameDVo●Vr1
copRename hangup
Conflict-tolerant Merge
How to support developers when merging different versions?
Final version does not reflect all intentions of the modelers
They should be subject of discussion
However, a merged model is helpful for deciding how to resolve conflicts
collaborative conflict resolution process
97
Conflict-tolerant Merge
Solution
98
Conflict-tolerant Merge Rules
99
Prioritize one change or omit both changes
Conflict-tolerant Merge Rules
100
Example: Update-update Conflict
Conflict-tolerant Merge Rules
101
Example: Delete-update Conflict
Conflict Annotations
102
Using Annotations in the Merged Model for Marking Conflicts
On top of the concrete syntax of the merged model
Conflict Annotations
103
Profile for Merge Conflicts
Model children container rootElement 1 0..1 * Change affectedElement 1 * changedBy Conflict Violation UpdateUpdate DeleteUpdate Annotation annotations * DeleteUse DeleteMove Warning MoveUpdate Update Delete Insert Move MetaInfo * metaInfo ModelElement * Use MoveMove UseUpdate UseMoveConflict Annotations
104
Example Apply conflict-tolerant merge rules Annotate conflicts (i.e., apply conflict profile)
Conflict Annotations
105
Applied Conflict Profile
Conflict Annotations
106
Applied Conflict Profile
EMF Profiles
Overall Goal of EMF Profiles
107
“Adopt the notion of UML Profiles to DSMLs residing in EMF”
UML Profiles: A Short Introduction
108
Profile specification Profile application
«profile» EJB«enumeration» StateKind stateless stateful
UserModel
«apply» «SessionBean» Customer state=stateless Component «stereotype» Bean «stereotype» EntityBean «stereotype» SessionBean state: StateKind «metaclass»
Motivation
109
UML Profiles vs DSMLs
110
Reuse UML’s language concepts and existing UML editors! Create a lean language that is straight to the point! You’ll end up with an overloaded and imprecise language! You’ll have to create the whole infrastructure by yourself!
UML Profiles vs DSMLs
111
These debates concern adopting either UML Profiles or DSMLs for creating new languages. What about extending existing languages?
It’s your language… just extend your metamodel.
Motivating Scenario
112
Data Modeling Language
Meta model Concrete Syntax Editor
… generates Ruby on Rails. … generates JavaServer Faces. … generates DB Schema.
I want to additionally specify “Finder SQL” statements! I want to additionally specify the bean scope! Leave it as it is! If you introduce every imaginable feature that I don’t need, I could have used UML in the first place.
Motivating Scenario
113
Data Modeling Language
Meta model Concrete Syntax Editor
… generates Ruby on Rails. … generates JavaServer Faces. … generates DB Schema.
I want to additionally specify “Finder SQL” statements! I want to additionally specify the bean scope! Leave it as it is! If you introduce every imaginable feature that I don’t need, I could have used UML in the first place.
You need a lightweight extension mechanism: Profiles! Other scenarios
I can’t address all your requirements!
Benefits of Profiles for DSMLs
frameworks)
114
The Challenge
115
Okay, so let’s use profiles! But wait, that’s not so easy with EMF!
M3 UML
Core Profiles
«import»M2 M1
UML aProfile
«instanceOf» «instanceOf» «instanceOf» «instanceOf»aUML Model aProfile Application
«extend» «extend»EMF
Ecore Profile MM
«instanceOf»aProfile
«instanceOf»aProfile Application
«instanceOf»Solution: Metalevel Lifting by Inheritance
116
M3 M2 M1
Profile Definition Metalevel Lifting by Inheritance
Ecore Profile MM
« instanceOf »aProfile
« instanceOf »Solution: Metalevel Lifting by Inheritance
117
M3 M2 M1
Profile Definition Metalevel Lifting by Inheritance
Ecore Profile MM
« instanceOf »aProfile
« instanceOf » « inheritsFrom »Solution*: Metalevel Lifting by Inheritance
118
M3 M2 M1
Profile Definition Metalevel Lifting by Inheritance
Ecore Profile MM
« instanceOf »aProfile
« instanceOf »aProfile Application
« inheritsFrom » « instanceOf »* There is an alternative solution as well (i.e., transformation to a model at M2).
EMF Profile Metamodel
119
Profile iconPath : EString Stereotype Profile Ecore abstract: EBoolean eSuperTypes : EClass … EClass nsURI : EString eClassifiers : EClassifier … EPackage base 1 base 0..* Standard EMF Profile ProfileApplication ProfileApplication 0..* appliedTo : EObject StereotypeApplication stereotype Applications «import»EMF Profile Metamodel and its Instantiation
120
Profile iconPath : EString Stereotype Profile Ecore abstract: EBoolean eSuperTypes : EClass … EClass nsURI : EString eClassifiers : EClassifier … EPackage base 1 base 0..* Standard EMF Profile ProfileApplication ProfileApplication 0..* appliedTo : EObject StereotypeApplication : Stereotype : EAttribute name=“isStateful” eAttributesA Profile Specification
: Profile eClassifiers : EClass base name=“Entity” stereotype Applications name=“SessionBean” «import»EMF Profile Metamodel and its Instantiation
121
Profile iconPath : EString Stereotype Profile Ecore abstract: EBoolean eSuperTypes : EClass … EClass nsURI : EString eClassifiers : EClassifier … EPackage base 1 base 0..* Standard EMF Profile ProfileApplication ProfileApplication 0..* appliedTo : EObject StereotypeApplication : Stereotype : EAttribute name=“isStateful” eAttributesA Profile Specification
eSuperTypes name=“SessionBean” «onSave» : Profile eClassifiers : EClass base name=“Entity” stereotype Applications «import»122
EMF Profile Metamodel and its Instantiation
Profile iconPath : EString Stereotype Profile Ecore abstract: EBoolean eSuperTypes : EClass … EClass nsURI : EString eClassifiers : EClassifier … EPackage base 1 base 0..* Standard EMF Profile ProfileApplication ProfileApplication 0..* appliedTo : EObject StereotypeApplication : Profile : Stereotype : EAttribute name=“isStateful” eClassifiers eAttributesA Profile Specification
eSuperTypes name=“SessionBean” : EClass baseA Profile Application
: ProfileApplication : SessionBean name=“Entity” : Entity appliedTo stereotype Applications stereotype Applications isStateful=true «instanceOf» «instanceOf» «instanceOf» «import» «instanceOf» «instanceOf» «instanceOf»123
EMF Profile Metamodel and its Instantiation
Profile iconPath : EString Stereotype Profile Ecore abstract: EBoolean eSuperTypes : EClass … EClass nsURI : EString eClassifiers : EClassifier … EPackage base 1 base 0..* Standard EMF Profile ProfileApplication ProfileApplication 0..* appliedTo : EObject StereotypeApplication : Profile : Stereotype : EAttribute name=“isStateful” eClassifiers eAttributesA Profile Specification
eSuperTypes name=“SessionBean” : EClass baseA Profile Application
: ProfileApplication : SessionBean name=“Entity” : Entity appliedTo stereotype Applications stereotype Applications isStateful=true «instanceOf» «instanceOf» «instanceOf» «import» «instanceOf»M3 M3 M2 M2 M2 M1 M1
«instanceOf» «instanceOf»M1
124
EMF Profile Metamodel and its Instantiation
Profile iconPath : EString Stereotype Profile Ecore abstract: EBoolean eSuperTypes : EClass … EClass nsURI : EString eClassifiers : EClassifier … EPackage base 1 base 0..* Standard EMF Profile ProfileApplication ProfileApplication 0..* appliedTo : EObject StereotypeApplication : Profile : Stereotype : EAttribute name=“isStateful” eClassifiers eAttributesA Profile Specification
eSuperTypes name=“SessionBean” : EClass baseA Profile Application
: ProfileApplication : SessionBean name=“Entity” : Entity appliedTo stereotype Applications stereotype Applications isStateful=true «instanceOf» «instanceOf» «instanceOf» «import» «instanceOf»M3 M3 M2 M2 M2 M1 M1 M1/2 M2/3
«instanceOf» «instanceOf»M1
Example: EJB Profile Specification
125
Example: EJB Profile Application
126
From UML Profiles to EMF Profiles and Beyond
No need for further reuse of profiles for other languages
Reuse a profile for more than one language
127
Generic Profiles
128
name : EString «generictype» Container «stereotype» EntityBean isUserManaged : EBoolean «stereotype» IDAttribute «stereotype» SessionBean isStateful : EBoolean «generictype» Property <<profile>> EJB Container, Property ER «bind» <Container->Entity, Property->Attribute> Entity Attribute 0..* name : String name : String ER Entity Attribute 0..* name : String name : String ER Entity Attribute 0..* name : String name : StringMeta Profiles
129
Implementation
http://www.modelversioning.org/emf-profiles-updatesite/
130
State-based Conflict Detection
131
Validate of the Result from Conflict-tolerant Merging
the resulting state is validated
New state-based conflict annotation
Resolution
132
Resolution
133
Conflict Resolution Model: The Lifecycle of Conflicts
Model children container rootElement 1 0..1 * Change affectedElement 1 * changedBy Annotation annotations * MetaInfo * metaInfo ModelElement * prioritizedChange 0..* conflictingChange 2..* 0..* 0..1 Diff 0..1 XOR customResolution 1..* proposed Resolution Resolution proposed Resolution User assignedTo state : ConflictStateExample: Conflict-tolerant Merging Improves the Result
134
Issues of Current Versioning/Resolution Protocol
Car Employee type name bday V1 Alice Car Employee carType color name birthday V1a Harry Car Employee name doB V1c*
type engine Joe Employee name birthday carType color V2 Sally Employee name bday type V1b Sally Model stored in the RepositoryCar as part of
Employee One class for efficient querying One car for several employees
Delete/Update Conflict!
1 1 1Example: Conflict-tolerant Merging Improves the Result
135
Issues of Current Versioning/Resolution Protocol
Car Employee type name bday V1 Alice Car Employee carType color name birthday V1a Harry Car Employee name doB V1c*
type engine Joe Employee name birthday carType color V2 Sally Employee name bday type V1b Sally Car Employee name doB color V3*
engine Joe carTypeDelete/Update Conflict! Update/Update Conflict!
1 1 1 1 Model stored in the RepositoryExample: Conflict-tolerant Merging Improves the Result
Result of Conflict-tolerant Merge
Car Employee type name bday V1 Alice Car Employee carType color name birthday V1a Harry Car Employee name doB V1c*
type engine Joe Employee name bday type V1b Sally Car Employee color name birthday carType V2 Car Employee name bday carType V3*
color engine1 2 1 2 6 4 5
Delete/Update Delete/Update Violation Delete/Update Update/Update Model stored in the Repository 1 1 1 1 13
Move/Update Warning3
136
Example: Conflict-tolerant Merging Improves the Result
Collaborative Resolution based on Conflict-tolerant Merge
Car Employee name doB*
color engine1 2 6 4
Delete/Update Delete/Update Violation Delete/Update Update/Update bdayResult of Standard Versioning Process
Sally Joe Harry Alice carType 53
Move/Update Warning birthday Car Employee name doB color V3*
engine Joe 1137
Semi-Automated Resolution
138
Example: Resolution Recommender
139 Pull Up Field Add class “SoccerM”
Event Concert artist Exhibition artist Event artist Concert Exhibition Event Concert artist Exhibition artist Event artist Concert Exhibition SoccerM SoccerMThe preconditions
“Pull Up Field” are violated! AddForbid(SoccerM)
Example: Resolution Recommender
140
Event artist Concert Exhibition SoccerMThe preconditions
“Pull Up Field” are violated! AddForbid(SoccerM) Resolve AddForbid(SoccerM) by introducing intermediate class?
Event #UserInput artist SoccerM Concert Exhibition Conflict Resolution PatternsOutline
141
Future Challenges
142
Consistency-aware Versioning
even if both versions are consistent Trace back to the relevant changes causing the violation
V0 V1 V2 :A :B t t+1 :A :B t t+1 :A :B t t+1 :A :B t t+1 V3 Lopez-Herrejon, R.E., & Egyed, A. (2010). Detecting Inconsistencies in Multi-View Models with Variability.Future Challenges
143
Intention-aware Versioning
intentions of each modeler Treat composite operations such as model refactorings as first-class entities Going beyond composite operations: E.g., a set of operations has been applied in order to fix a bug… is the bug still fixed after merging? Other ways to capture and respect the intention?
V0 V1 V2 Assistent Professor Researcher getLectures() Assistent getLectures() Professor getLectures() Researcher ProjectAss Assistent Professor Researcher getLectures() getLectures() Dig, D., Manzoor, K., Johnson, R., & Nguyen, T.N. (2007). Refactoring-aware Configuration Management for Object-oriented Programs. Proc. of the 29th International Conference on Software Engineering (ICSE), IEEE Computer Society, 427-436.Future Challenges
144
Semantics-aware Versioning
Formal definition of the modeling language’s semantics Mapping between modeling language and semantic domain Including intra-model dependencies
V0 V1 V2 A1 A2 B A1 A2 B A1 A2 BDifferent syntax, equal semantics
Nejati, S., Sabetzadeh, M., Chechik, M., Easterbrook, S., & Zave, P. (2007). Matching and Merging of StatechartsFuture Challenges
145
Conflict Dependencies
Efficient detection between more complex changes like refactorings
Optimal order for resolving conflicts
Delete(z) Add(x) Move(y x) Update(z) Delete(y)
d d i d…dependent i…independent c…conflicting c c Koegel M, Herrmannsdoerfer M, Wesendonk O., & Helming J. (2010). Operation-based Conflict Detection onFuture Challenges
146
Diagram Versioning
Which concurrently performed layout change is in fact a contradicting change of the layout (more fuzziness required than for models)? Respect the preservation of mental map when merging diagram changes!
Ohst, D., Welle, M. & Kelter, U. (2003). Differences Between Versions of UML Diagrams. Proc. of the 9th European Software Engineering Conference, ACM, 227-236. Mehra, A., Grundy J.C., & Hosking, J.G. (2005). A Generic Approach to Supporting Diagram Differencing and Merging for Collaborative Design. Proc. of the 20th International Conference on Automated Software Engineering, ACM, 204-213.Future Challenges
147
Avoid conflicts through awareness
Notification when modelers work on the same model fragment(!)
Model partitioning
How to separate a model? Find appropriate mechanisms for separation of concerns techniques
Avoiding Conflicts
Future Challenges
148
Model/Code Versioning
149
The AMOR Team
150
These Slides are Based on the Following Papers (1/2)
151
These Slides are Based on the Following Papers (2/2)
152
References and Further Reading (1/4)
153
References and Further Reading (2/4)
154
References and Further Reading (3/4)
155
References and Further Reading (4/4)
156