query-driven soft interconnection of emf models
DESCRIPTION
Query-driven soft links using EMF-IncQuery (http://viatra.inf.mit.bme.hu/incquery/) has been presented at the MODELS 2012 conference (http://www.modelsconference.org/).TRANSCRIPT
Budapest University of Technology and EconomicsDepartment of Measurement and Information Systems
Query-driven soft interconnection of EMF models
Ábel Hegedüs, Ákos Horváth, István Ráth and Dániel Varró
Budapest University of Technology and EconomicsMODELS 2012, Innsbruck, Austria,
October 3rd 2012
23
System architecture model
Account management system
Order management system
Create user
Find address
List items Set order state
Business process management example
Entry Task JobPreparation Prepare package Find addressCompletion Ship order Set order state
Business process model
Operator checklist
24
System architecture model
Account management system
Order management system
Create user
Find address
List items Set order state
Business process management example
Entry Task JobPreparation Prepare package Find addressCompletion Ship order Set order state
Business process model
Operator checklist
25
System architecture model
Account management system
Order management system
Create user
Find address
List items Set order state
Business process management example
Entry Task JobPreparation Prepare package Find addressCompletion Ship order Set order state
Business process model
Operator checklist
26
System architecture model
Account management system
Order management system
Create user
Find address
List items Set order state
Business process management example
Entry Task JobPreparation Prepare package Find addressCompletion Ship order Set order state
Business process model
Operator checklist
27
System architecture model
Account management system
Order management system
Create user
Find address
List items Set order state
Business process management example
Entry Task JobPreparation Prepare package Find addressCompletion Ship order Set order state
Business process model
Operator checklist
Multiple interconnected models
Multiple interconnected models
Multiple interconnected models
28
Business process management example
Multiple interconnected models
29
Business process management example
Multiple interconnected models
Integration with existing tool
(TIBCO)
30
Business process management example
Multiple interconnected models
Persisted separately
Integration with existing tool
(TIBCO)
31
Business process management example
Multiple interconnected models
Circular model dependencyPersisted
separately
Integration with existing tool
(TIBCO)
Collaboration on model fragmentsProcess engineer System engineerHard interconnections
32
Collaboration on model fragmentsProcess engineer System engineerHard interconnections
Edits process model
Open1
33
Collaboration on model fragmentsProcess engineer System engineerHard interconnections
Edits process model
Open1
X
34
Collaboration on model fragmentsProcess engineer System engineerHard interconnections
SaveEdits process model
Open1
X
35
Collaboration on model fragmentsProcess engineer System engineerHard interconnections
SaveEdits process model
Open1
Inconsistent process and system model!
Open
2
XOrder management system
List items
36
Collaboration on model fragmentsProcess engineer System engineerHard interconnections
SaveEdits process model
Open1
Inconsistent process and system model!
Open
2
XOrder management system
List items
Broken link
37
Collaboration on model fragmentsProcess engineer System engineerHard interconnections
SaveEdits process model
Open1
Inconsistent process and system model!
Open
2
XOrder management system
List items
Workaround: Keep all models open• Performance impact• Not supported by third-party tools• Strict file location• Circular model dependencies
Broken link
38
Idea of soft linksProcess engineer System engineerRemove hard interconnections
Order management system
List items
39
Idea of soft linksProcess engineer System engineerRemove hard interconnections
Order management system
List items
Link computed when models are available
40
Idea of soft linksProcess engineer System engineerRemove hard interconnections
Edits process model
Open1
Order management system
List items
Link computed when models are available
41
Idea of soft linksProcess engineer System engineerRemove hard interconnections
Edits process model
Open1
XOrder management system
List items
Link computed when models are available
42
Idea of soft linksProcess engineer System engineerRemove hard interconnections
SaveEdits process model
Open1
XOrder management system
List items
43
Idea of soft linksProcess engineer System engineerRemove hard interconnections
SaveEdits process model
Open1
Inconsistent process and system model!
Open
2
XOrder management system
List items
44
Idea of soft linksProcess engineer System engineerRemove hard interconnections
SaveEdits process model
Open1
Inconsistent process and system model!
Open
2
XOrder management system
List items
Warning: cannot find task (Finalize order)!
X
45
Idea of soft linksProcess engineer System engineerRemove hard interconnections
SaveEdits process model
Open1
Inconsistent process and system model!
Open
2
XOrder management system
List items
Warning: cannot find task (Finalize order)!
Soft links:• Persisted as identifiers• Computed when required• Can be implemented in Java/Xcore
X
46
Idea of soft linksProcess engineer System engineerRemove hard interconnections
SaveEdits process model
Open1
Inconsistent process and system model!
Open
2
XOrder management system
List items
Warning: cannot find task (Finalize order)!
Soft links:• Persisted as identifiers• Computed when required• Can be implemented in Java/Xcore
X
• Link defined as a model query• Live computaton by EMF-INCQUERY• Change notifications• Automatically provided based on
high-level query definition47
EMF-INCQUERY Overview A model query engine for batch and live queries
• Expressive graph pattern-based query language
• Focus on reusability: query libraries, recursive pattern calls
Definition
• Incrementalevaluation
• Instantaneous response for complex queries over large models
Execution
• On-the-fly well-formedness validation
• Incremental view maintenance
• Model synchronization• Structural features
defined by queries
Use cases
http://viatra.inf.mit.bme.hu/incquery http://viatra.inf.mit.bme.hu/incquery/getting_started http://www.eclipse.org/proposals/modeling.emf.incquery/
48
• Declarative model queries
• Minimize imperative code
Definition
• Incrementalre-evaluation
• Notification support
Execution
• Fragmented models
• Traceability management
Use cases
Overview of soft links
49
• Declarative model queries
• Minimize imperative code
Definition
• Incrementalre-evaluation
• Notification support
Execution
• Fragmented models
• Traceability management
Use cases
Soft links: Definition
50
51
Soft links in the motivating example
52
Soft links in the motivating example
These jobs are executed when operator performs the checklist entry
Soft Link
53
Soft links in the motivating example
These jobs are executed when operator performs the checklist entry
Persisted in different models
Persisted in different modelsSoft Link
54
Soft links in the motivating example
These jobs are executed when operator performs the checklist entry
Corresponding jobs are identified by
system and job name
Persisted in different models
Persisted in different modelsSoft Link
Soft link can be represented as:o A set of relevant elements from the modelo Visible as a structural (derived) feature
Soft links as model queries
55
Soft link can be represented as:o A set of relevant elements from the modelo Visible as a structural (derived) feature
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft links as model queries
Model query
56
Soft link can be represented as:o A set of relevant elements from the modelo Visible as a structural (derived) feature
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft links as model queries
Model query
ModelQuery(A,B): • tuples of model elements A, B• satisfying the query condition• enumerate 1 / all instances• A,B can be input or output
57
Soft link can be represented as:o A set of relevant elements from the modelo Visible as a structural (derived) feature
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft links as model queries
Model query
ModelQuery(A,B): • tuples of model elements A, B• satisfying the query condition• enumerate 1 / all instances• A,B can be input or output
Soft Link
CLE.jobs
58
Soft link can be represented as:o A set of relevant elements from the modelo Visible as a structural (derived) feature
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft links as model queries
Model query
ModelQuery(A,B): • tuples of model elements A, B• satisfying the query condition• enumerate 1 / all instances• A,B can be input or output
Soft Link
CLE.jobs
Persistence:• soft link not saved in files• system and job name stored as paths
59
60
Advanced model queries
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft Link
CLE.jobs
61
pattern EntryJobCorrespondence( CLE : CheckListEntry, J : Job) = { Job.name(J,JobName); System.name(S,SysName); Job.runsOn(J,System); ChecklistEntry.jobPaths(CLE,JobPath); check(JobPath == SysName+'/'+JobName);}
Advanced model queries
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft Link
CLE.jobs
62
pattern EntryJobCorrespondence( CLE : CheckListEntry, J : Job) = { Job.name(J,JobName); System.name(S,SysName); Job.runsOn(J,System); ChecklistEntry.jobPaths(CLE,JobPath); check(JobPath == SysName+'/'+JobName);}
Advanced model queries
Query parameters (with type condition)
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft Link
CLE.jobs
63
pattern EntryJobCorrespondence( CLE : CheckListEntry, J : Job) = { Job.name(J,JobName); System.name(S,SysName); Job.runsOn(J,System); ChecklistEntry.jobPaths(CLE,JobPath); check(JobPath == SysName+'/'+JobName);}
Advanced model queries
Query parameters (with type condition)
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft Link
CLE.jobs
Path condition
64
pattern EntryJobCorrespondence( CLE : CheckListEntry, J : Job) = { Job.name(J,JobName); System.name(S,SysName); Job.runsOn(J,System); ChecklistEntry.jobPaths(CLE,JobPath); check(JobPath == SysName+'/'+JobName);}
Advanced model queries
Query parameters (with type condition)
Attribute condition
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft Link
CLE.jobs
Path condition
65
pattern EntryJobCorrespondence( CLE : CheckListEntry, J : Job) = { Job.name(J,JobName); System.name(S,SysName); Job.runsOn(J,System); ChecklistEntry.jobPaths(CLE,JobPath); check(JobPath == SysName+'/'+JobName);}
Advanced model queries
Query parameters (with type condition)
Attribute condition
Also available:• Pattern reuse• Negative application conditions• Match counting• Transitive closure
CLE:CLEntry J:Job
S:System
JobName:EStringname
SysName:EStringname
runsOnjobPaths
check (JobPath == SysName + ’/’ + JobName)
EntryJobCorrespondence(CLE,Job)
JobPath:EString
Soft Link
CLE.jobs
Path condition
1. Define feature and „storage” in metamodel
Developing soft links
66
1. Define feature and „storage” in metamodel
@DerivedFeaturepattern readingTasks(D: Data, T: Task) = { Task.id(T,TaskId); Data.readingTaskIds(D,TaskId);}
1. Define feature and „storage” in metamodel
2. Define model query with EMF-IncQuery
Developing soft links
67
1. Define feature and „storage” in metamodel
private IncqueryDerivedFeature readingTasksHandler;public EList<Task> getReadingTasks() { if (readingTaskHandler == null) { readingTaskHandler = IncqueryFeatureHelper.getIncqueryDerivedFeature( this, SystemPackageImpl.Literals.DATA__READING_TASK, "system.queries.DataTaskReadCorrespondence", "Data", "Task", FeatureKind.MANY_REFERENCE, true, false);} return readingTaskHandler.getManyReferenceValueAsEList(this);}
@DerivedFeaturepattern readingTasks(D: Data, T: Task) = { Task.id(T,TaskId); Data.readingTaskIds(D,TaskId);}
1. Define feature and „storage” in metamodel
2. Define model query with EMF-IncQuery
3. Generate glue code automatically
Developing soft links
68
1. Define feature and „storage” in metamodel
private IncqueryDerivedFeature readingTasksHandler;public EList<Task> getReadingTasks() { if (readingTaskHandler == null) { readingTaskHandler = IncqueryFeatureHelper.getIncqueryDerivedFeature( this, SystemPackageImpl.Literals.DATA__READING_TASK, "system.queries.DataTaskReadCorrespondence", "Data", "Task", FeatureKind.MANY_REFERENCE, true, false);} return readingTaskHandler.getManyReferenceValueAsEList(this);}
@DerivedFeaturepattern readingTasks(D: Data, T: Task) = { Task.id(T,TaskId); Data.readingTaskIds(D,TaskId);}
1. Define feature and „storage” in metamodel
2. Define model query with EMF-IncQuery
3. Generate glue code automatically
Developing soft links
Efficient, declarative derived features• Solves a long standing EMF shortcoming• Details in our ECMFA 2012 paper
69
1. Define feature and „storage” in metamodel
•Declarative model queries•Minimize imperative code
Definition
•Incrementalre-evaluation•Notification support
Execution
•Fragmented models•Traceability management
Use cases
Soft links: Execution
70
•Declarative model queries•Minimize imperative code
Definition
•Incrementalre-evaluation•Notification support
Execution
•Fragmented models•Traceability management
Use cases
Soft links: Execution
71
Efficient soft links
Soft link life cycle
Application
EMFModel
Soft Link Handler
Incremental Query engine
72
Efficient soft links
Soft link life cycle
Application
EMFModel
Soft Link Handler
Incremental Query engine
Initialization + Model
manipulation
A1
Incremental update
73
Efficient soft links
Soft link life cycle
Application
EMFModel
Soft Link Handler
Incremental Query engine
EMF model reference + Change notifications
Initialization + Model
manipulation
A1
A2
Incremental update
Order management system
List items
74
Efficient soft links
Soft link life cycle
Application
EMFModel
Soft Link Handler
Incremental Query engine
EMF model reference + Change notifications
Initialization + Model
manipulation Deltamonitors
A3A1
A2
Incremental update
Order management system
List items
75
Efficient soft links
Soft link life cycle
Application
EMFModel
Soft Link Handler
Incremental Query engine
EMF model reference + Change notifications
Initialization + Model
manipulation Deltamonitors
A3A1
A2
A4
Incremental update
Order management system
List items
76
Efficient soft links
Soft link life cycle
Application
EMFModel
Soft Link Handler
Incremental Query engine
EMF model reference + Change notifications
Initialization + Model
manipulation Deltamonitors
Requestsoft link
A3A1
A2
A4
B1
Incremental update
Value retrieval from cache
Order management system
List items
77
Efficient soft links
Soft link life cycle
Application
EMFModel
Soft Link Handler
Incremental Query engine
EMF model reference + Change notifications
Initialization + Model
manipulation Deltamonitors
Requestsoft link
A3A1
A2
A4
B1
B2
Get current value
Incremental update
Value retrieval from cache
Order management system
List items
78
12552 23036 43468 88642 176520 361468 715870 1423308 28375141
10
100
1,000
10,000
100,000
1,000,000
Read+Check1 Edit+Check2Number of objects
Time [ms]
Performance of EMF-IncQuery
79
12552 23036 43468 88642 176520 361468 715870 1423308 28375141
10
100
1,000
10,000
100,000
1,000,000
Read+Check1 Edit+Check2Number of objects
Time [ms]
Performance of EMF-IncQuery
Model size from 10k objects to 2,8M objects
80
12552 23036 43468 88642 176520 361468 715870 1423308 28375141
10
100
1,000
10,000
100,000
1,000,000
Read+Check1 Edit+Check2Number of objects
Time [ms]
Performance of EMF-IncQuery
Model size from 10k objects to 2,8M objects
Logarithmic scale
81
12552 23036 43468 88642 176520 361468 715870 1423308 28375141
10
100
1,000
10,000
100,000
1,000,000
Read+Check1 Edit+Check2Number of objects
Time [ms]
Performance of EMF-IncQuery
Model size from 10k objects to 2,8M objects
First evaluation (including EMF load)
Logarithmic scale
82
12552 23036 43468 88642 176520 361468 715870 1423308 28375141
10
100
1,000
10,000
100,000
1,000,000
Read+Check1 Edit+Check2Number of objects
Time [ms]
Performance of EMF-IncQuery
Model size from 10k objects to 2,8M objects
First evaluation (including EMF load)
Re-evaluation (including modification)
Logarithmic scale
83
12552 23036 43468 88642 176520 361468 715870 1423308 28375141
10
100
1,000
10,000
100,000
1,000,000
Read+Check1 Edit+Check2Number of objects
Time [ms]
Performance of EMF-IncQuery
More details and comparison with other tools: http://viatra.inf.mit.bme.hu/performance
Model size from 10k objects to 2,8M objects
First evaluation (including EMF load)
Re-evaluation (including modification)
Logarithmic scale
84
•Declarative model queries•Minimize imperative code
Definition
•Incrementalre-evaluation•Notification support
Execution
•Fragmented models•Traceability management
Use cases
Soft links: Use cases
85
•Declarative model queries•Minimize imperative code
Definition
•Incrementalre-evaluation•Notification support
Execution
•Fragmented models•Traceability management
Use cases
Soft links: Use cases
86
Traditional traceability management
T T
87
Traditional traceability management
T T
Model
88
Traditional traceability management
T T
Model
Traceability links
89
Traditional traceability management
T T
Model
Traceability links
Explicit unidirectionalreferences
90
Soft links in traceability management
T T
Model
91
Soft links in traceability management
Model
Query-basedderived feature
92
Soft links in traceability management
Model
Query-basedderived feature
Calculated bidirectionalreferences
93
Soft links in traceability management
Model
Query-basedderived feature
Calculated bidirectionalreferences
94
Soft links in traceability management
Model
Query-basedderived feature
Calculated bidirectionalreferences
Traceability query
95
Soft links in traceability management
Model
Query-basedderived feature
Calculated bidirectionalreferences
pattern DataReadByCheckListEntry( CLE : CheckListEntry, T : Task, D : Data) = { CheckListEntry.task(CLE,T); Data.readingTasks(D,T);}
Traceability query
96
Soft links in traceability management
T
Model
Query-basedderived feature
Calculated bidirectionalreferences
pattern DataReadByCheckListEntry( CLE : CheckListEntry, T : Task, D : Data) = { CheckListEntry.task(CLE,T); Data.readingTasks(D,T);}
Traceability query
97
Soft links in traceability management
T
Model
Query-basedderived feature
Calculated bidirectionalreferences
pattern DataReadByCheckListEntry( CLE : CheckListEntry, T : Task, D : Data) = { CheckListEntry.task(CLE,T); Data.readingTasks(D,T);}
Soft links!
Traceability query
98
Graceful degradation of broken soft links
T T
T
Broken hard links:• Fails upon loading EMF model• Difficult to repair• Available information
not readable (e.g. XMI path)
99
Graceful degradation of broken soft links
T T
T
Broken hard links:• Fails upon loading EMF model• Difficult to repair• Available information
not readable (e.g. XMI path)
Broken soft links:• No effect on loading EMF model• Easy to repair• Available information readable
(e.g. identifier and query definition)
100
Graceful degradation of broken soft links
T T
T
Broken hard links:• Fails upon loading EMF model• Difficult to repair• Available information
not readable (e.g. XMI path)
Broken soft links:• No effect on loading EMF model• Easy to repair• Available information readable
(e.g. identifier and query definition)
EMF-IncQuery provides on-the-fly validation support based on queries
101
On-the-fly validation of traceability models
102
On-the-fly validation of traceability models
103
• Expressive, graph-based model query
• Derived features
Definition
• Incrementalevaluation technique
• Graceful degradation
Execution
• Transparent behavior• Easy integration through code
generation
EMF integration
Summary of soft linksEfficient and flexible soft interlinking between EMF model fragments
104
• Expressive, graph-based model query
• Derived features
Definition
• Incrementalevaluation technique
• Graceful degradation
Execution
• Transparent behavior• Easy integration through code
generation
EMF integration
Summary of soft linksEfficient and flexible soft interlinking between EMF model fragments
Future work„Setters” for derived features defined by queries
Entirely transparent to applications
Derived objects basedon model queries
Represent query results as model objectsLife cycle managed by EMF-INCQUERY
105
• Expressive, graph-based model query
• Derived features
Definition
• Incrementalevaluation technique
• Graceful degradation
Execution
• Transparent behavior• Easy integration through code
generation
EMF integration
Summary of soft linksEfficient and flexible soft interlinking between EMF model fragments
Future work„Setters” for derived features defined by queries
Entirely transparent to applications
Derived objects basedon model queries
Represent query results as model objectsLife cycle managed by EMF-INCQUERY
EMF-INCQUERY• 0.6.5 release is available• Complete support for soft links
viatra.inf.mit.bme.hu/incquery/new/examples/query-driven-soft-links
106