Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Model visualization made easy: Incremental query-driven views in modeling tools
1. Model visualization made easy:
Incremental query-driven views
in modeling tools
Ákos Horváth, Ábel Hegedüs, Zoltán Ujhelyi, István Ráth
IncQuery Labs Ltd.
Gábor Bergmann, Csaba Debreceni, Dániel Varró
Budapest University of Technology and Economics
2. Outline
Motivation and
background
Queries
Query-based view models
• Overview
• Evaluation
Sirius integration
• Overview
• Evaluation
Conclusion
• Conclusion
Main Contributors
o Csaba Debreceni
o Ádám Lengyel
o Gábor Bergmann
o Ábel Hegedüs
o Zoltán Ujhelyi
o István Ráth
o Ákos Horváth
o Dániel Varró
3. Introduction
??
I don’t need all that
information
Can I define a
simplified model?
Can I define a view
to visualize it?
Maintanence
Incrementally
Immediately
Maintenance:
• Incrementally
• Immediately
Viewpoint:
• Different view of the
underlying model
• Abstraction hide
complexity
4. Motivating scenario
Avionics research project
• MDD toolchain
• Allocate SWs onto HWs
Simplified Example
FAM_PilotControl
: Function
FAM_Navigation
: Function
FAM_FMS
: Function
FAM_EMS
: Function
nav2ems
:InformationLink
provider
consumer
subFunctions
provider
consumer
PilotControl
SubS1
Navigation
FMS
SubS2
EMS
tag: func
tag: func
tag: func
tag: func
EMS: Engine Management System
FMS: Flight Management SystemInPort/OutPort
nav2fms
:InformationLink
Simulink FAM
Id
Id Other SubSystem without tag
Function SubSystem with "func" tag)
Port Blocks
id:Function id:InformationLink
View
More details on Matlab Simulink and Eclipse integration: https://github.com/FTSRG/massif
5. Background: Incremental queries
Key observation: model queries are expensive
• Models are getting larger (1-5-10+ M elements)
• Queries are complex (attribute value checks +
navigation/joins + iterations)
• An other industrial example: well-formedness
validation of a 4M element AUTOSAR model takes
30+ minutes
o Despite being hand-coded in Java (no OCL, …)
Usability issues
Productivity issues
How to address this?
• Lazy evaluation
• Incrementality: calculate once, update afterwards
6. Background: Comparison
Normal queries
• Java, OCL, …
Live (incremental)
queries
Query Model
Evaluator
Results
Model change
Query Model
Evaluator
Updated results
Model change
Result deltas
Efficient change
propagation
1. Always up-to-date results
without model traversal
2. Track changes of your model
in terms of queries
3. Can provide detailed delta from
fix point
(Re-)traversal necessary if
the model is changed
7. EMF-INCQUERY
An EMF model query engine for live graph search
• Expressive query
language based on
graph patterns and
Xbase
Language
• Incremental
evaluation based
on the Rete
algorithm
• Instantaneous
response for
complex queries
over large models
Execution
• Incremental model
processing
(validation,
synchronization, ...)
Tools
http://eclipse.org/incquery
9. EMF
Model
Live
Queries
2. Change
Notifications
1. Model
Modification
Live
Queries
Derived
Model
UI
3. Continuous,
efficient
synchronization
4. UI updates
Labeled, hierarchic
property graph
On-the-fly abstractions
over the model
Visualize things that are not (directly) present in your model
Provides an easy-to-use API for integration into your presentation
layer
o Eclipse Data Binding
o Simple callbacks
Query-based view models
10. Definition of derived models
Derivation rules
• Graph patterns with annotations
o Precondition: a pattern match
o Execution rule: defined in annotations
• Query Based Object / Feature
function(ss)
@TraceLookup(src = ss, trg = f)
@QBO(eClass = Function)
@QBF(src = f, trg = id, f = id)
functionIdentifier(ss, id)
@TraceLookup(src = ssys, trg = s)
@QBF(src = p, trg = s, f =subFunctions)
subFunction(psys, ssys)
function(psys)
B:psys B:ssys
function(ssys)
...
subBlock+
@TraceLookup(src = psys, trg = p)
11. More matches can appear at the same time
• Ordered execution schema (priority for rules)
Internal traceability for created objects
• Explicit definition
Execution of motivating example
11
FAM_PilotControl
: Function
FAM_Navigation
: Function
FAM_FMS
: Function
subFunctions
consumer
PilotControl
SubS1
Navigation
FMS
tag: func
tag: func
tag: func
Simulink FAM
subFunctions
Query results Traceability
function
f_1
f_2
f_3
Trace
Trace
Trace
a 2 3appear create add
Query results
functionIdentifier
f_1 i_1
f_2 i_2
f_3 i_3
subFunction
f_1 i_1
f_2 i_2
b appear 4 set
12. Viewers related annotations
Special annotations
• Uses a specific target metamodel (notation)
• Simplifies the tracing of (notation) model
elements
• Enables faster implementation on user side
12
item(func) @Item(label = "$func.id")
@ContainsItem(src = par, trg = sub)containment(p, s)
@Edge(src = provider, trg = consumer)subFunction(p, c)
13. Chaining of view models
FAM_PilotControl
: Function
FAM_Navigation
: Function
FAM_FMS
: Function
provider
subFunctions
consumer
nav2fms
:InformationLink
FAM
subFunctions
Traceability
Trace
Trace
Trace
Query results
item
edge
c_1p_1
containment
p_1 s_1
p_2 s_2
f_1
f_2
f_3
Notation
Item
Item
Item
Containment
Contaimnent
Edge
Trace
Trace
Trace
target
source
target
source
target
source
1 2 3appear create add
Source model Target model
Traceability model
View model
…
QBO
QBF
Target metamodel
View
model
Render
Module
QBO: Query Based Object
QBF: Query Based Feature
Zest
JFace
yFiles
14. Updating view models
Initial setup of derivation rules
• EClassifiers, EStructuralFeatures
Query result deltas rule activations
• Delta = (Found, Lost, Updated)
Intergration architecture
Source model
Derivation rules
Query engine
Event-Driven
Virtual Machine
View model
Change
notifications
Match set
delta
Application
Model
manipulation
Configuration
Model
manipulation
1
2
3
4
More details on the Event-Driven Virtual machine: http://www.eclipse.org/viatra/
15. TrainBenchmark
• 6 different size examples
• Source: 6.000 – 180.000 | View models: 150 – 4.500
• Wide variety of patterns such as transitive closure, attribute checks, etc.
Evaluation
More details on the TrainBenchmark: https://github.com/FTSRG/trainbenchmark
17. Background: Sirius
Sirius
• Custom concrete syntax for visualization
o Tree, table, graph, etc.
• Provides viewpoint definition over EMF models
• Abstraction can be defined using interpreted
expressions
o MTL – Acceleo Model-to-Text language
o OCL- Object Constraint language
o AQL (recommended as of 3.1) – Acceleo Query
Language
• Supports several viewpoints over
the same abstract syntax
18. VSM Render
Overview: IQPL as query language for Sirius
Sirius provides API to provide custom
expression interpreter
• org.eclipse.sirius.common.expressionInterpreter
• org.eclipse.sirius.common.proposalProvider
4. UI updates
EMF
Model
B. Change
Notifications
A. Model
Modification
Live
Queries
Live
Queries
2. Get
queries
3. Query results
1. UI refresh
More details EMF-IncQuery to Sirius integration: https://github.com/FTSRG/iq-sirius-integration
19. Evaluation: Sirius Interpreted expression
0
5000
10000
15000
20000
25000
30000
35000
MTL AQL EIQ MTL AQL EIQ MTL AQL EIQ
Small Medium Large
ExecutionTime[Ms]
Model Size
First Execution Recalculation
Models EObjects EReferences Eattributes Diagram nodesDiagram edges
Small 3550 34222 9471 12 17
Medium 6994 124708 22129 17 13
Large 63580 1233581 457230 167 6154
Complex query
with long
navigation
Profiler was used
to isolate query
execution time
Sirius AQL
• provides good
performance
• Low memory
profile
IncQuery
• Recalculations
< 100 ms
• Requires up to
2x memory
o Large ~1.2 Gb
20. Conclusions
Summary
• Deriving and synchronizing view models
o Incrementally and live
Fast recalculation
o Derivation rules
Definition
• Annotation over graph queries for JFace
• EMF Configuration
Explicit tracing mechanism
• Multiple visualization modules support
o Open-source: Zest, JFace, Sirius
o Commercial: yFiles
21. Final points
The examples and more details are available
form
• EMF-IncQuery viewers:
https://wiki.eclipse.org/EMFIncQuery/UserDocumentation/IncQuery_Vie
wers
• EMF-IncQuery Sirius integration:
https://github.com/FTSRG/iq-sirius-integration
• Complex example:
https://github.com/IncQueryLabs/incquery-examples-cps
Your contributions (feedback, forum posts,
ideas, patches) are very welcome!
• To what direction should we enhance this approach?
Notas del editor
Johnathan presentation on Looom
MTL -- Acceleo Model-to-Text language
AQL – Acceleo Query language
EIQ – EMF-IncQuery pattern language