Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
The Eclipse VIATRA framework
Dr. István RÁTH
Co-lead @ VIATRA
Managing Director @ IncQuery Labs Ltd.
VIATRA in a nutshell
Application
domains
Model
transformations
Java
API
Xtend
API
Model queries
Reactive query and transformation engine
VIATRA:
open source
foundations
for design tools
Design tools
for systems
engineering
VIATRA Query
Motivation: Early validation of design rules
SystemSignalGroup design rule (from AUTOSAR)
• A SystemSignal and its group must be in the same IPdu
• Challenge: find violations quickly in large models
• New difficulties
• reverse
navigation
• complex
manual
solution
AUTOSAR:
• standardized SW architecture
of the automotive industry
• now supported by modern design tools
Design Rule/Well-formedness constraint:
• each valid car architecture needs to respect
• designers are immediately notified if violated
Challenge:
• >500 design rules in AUTOSAR tools
• >1 million elements in AUTOSAR models
• models constantly evolve by designers
route: Route sp: SwitchPosition
switch: Switchsensor: Sensor
follows
switch
sensor
definedBy
Complex model queries in Java
1
2
0
3
4
// Incoming transition for an entry state
public void getRouteWithoutDefinition(route: Route) {
if (route != null) { // Step 0
for (SwitchPosition sp: route.getFollows()) {// Step 1
if (sp.getSwitch() != null) // Step 2
if (sp.getSwitch().getSensor() != null) // Step 3
if (route != sp.getSwitch().getSensor()) { // Step 4
// do something
}
}}}
Complex model queries in the
VIATRA Query Language (VQL)
// Sensors that are associated with a switch that belongs to a route,
but the sensor is not associated with the same route.
pattern routeSensor(route:Route, sensor:Sensor) {
Route.follows.switch.sensor(route, sensor);
neg find definedBy(route, sensor);
Route.length(route, length);
check(length <= 0);
}
Negative pattern call
Query definition
Query parameters
Type constraint
Attribute or Reference
navigation
route: Route sp: SwitchPosition
switch: Switchsensor: Sensor
follows
switch
sensor
definedBy
Check expression for attribute values
(integrates with Java via Xbase)
Real-world example
VQLJava =
The VIATRA Model Query engine
Query
back-ends
Live
Search-
based
Hybrid
• Performance-first
• Indexing
• in the initialization
phase
• ~10% of model
loading time
• Memory efficient
• Still much faster than
handwritten Java • Blazing fast (<10ms)
• Query result change
notifications
• Requires more
memory (+20-70% tool
footprint)
• Fine-grained fine-
tuning between
backend configurations
Benchmarks
https://github.com/viatra/viatra-cps-benchmark
https://github.com/IncQueryLabs/magicdraw-viatra-benchmark
https://github.com/FTSRG/trainbenchmark
VIATRA Transformations
Model Transformation and Code Generation
Source Model Target CodeCode DOM/AST
M2M M2T
Model-to-Model (M2M)
Transformation
• SRC: In-memory model (objects)
• TRG: In-memory model (objects)
Model-to-Text (M2T) Transformation
• SRC: In-memory model (objects)
• TRG: Textual code (string)
VIATRA
Reactive Transformation
Engine
Reactive Model Transformations
(“rule engine for MT”)
Observed
events
Controlled
events
Notifications
Messages
Model
Event
What has happened?
(external + internal)
Condition
When to react?
(internal)
Action
What to do?
(external+internal)
VIATRA Java/Xtend API
pattern compositeState(state: State, region: Region) {
CompositeElement(state);
CompositeElement.regions(state, region);
neg find initialStates(region, _);
}
private def getInitCompositeStateRule() {
return createRule
.name("initCompositeStateRule")
.precondition(CompositeStateMatcher.querySpecification)
.action(CRUDActivationStateEnum.CREATED) [
val currRegion = it.region
currRegion.createChild(region_Vertices, scPackage.entry)
]
.addLifeCycle(Lifecycles.getDefault).build
}
Model manipulation:
• Internal DSL in Xtend
• Unified interface for
simple / transactional
model edits
• Primitives
• create/Child
• addTo
• Remove
• Set
• moveTo
Precondition:
• Graph pattern in VQL
VIATRA Features & Add-ons
Tools
• Declarative and
powerful query
language
• Integrates with
Java using Xbase
• Xtext-based
Eclipse IDE
• Reactive debugger
• Maven builder
• Test framework
with coverage
support
APIs
• Type safe and
easy-to-use
• Databinding
• Derived features
with notifications
• Model-to-model
and model-to-
code
transformation
primitives
• Java and Xtend
friendly
Runtime
• Headless with
minimal
dependencies
• Advanced
performance
optimizations
• Various back-ends
for different trade-
offs
• Unique feature:
live queries and
reactive
transformations
Add-ons
• VIATRA Validation
• VIATRA Viewers
(view
maintenance)
• VIATRA-DSE
(Design Space
Exploration)
• VIATRA-CEP
(Complex Event
Processing)
Summary
VIATRA History and Roadmap
• (Old) VIATRA2 (2004-2008)  EMF-IncQuery (2009-2013)
•  (New) VIATRA 1.x (2014-)
• Search-based query back-end
• Live queries: up to 50% less memory vs EMF-IncQuery (Eclipse
Collections)
• Reactive transformations, debugger & other add-ons
• Part of Release train since Oxygen (VIATRA 1.6), 1.7 due Dec 20 (O.2)
•  VIATRA 2.x (2018-)
• Server-side “big query” tech (model repositories, graph databases)
• VQL2: usability-first, multi-syntax (single line & graphical queries)
VIATRA in a nutshell
Model
transformations
Application
domains
Design tools
for systems
engineering
Java
API
Xtend
API
Model queries
Reactive query and transformation engine
VIATRA:
open source
foundations
for design tools
Contributors
http://eclipse.org/viatra
http://wiki.eclipse.org/VIATRA
https://github.com/viatra
https://incquerylabs.com/en/page/show/viatra
Resources
Success stories
Thank you!
@IncQueryLabs
istvan.rath@incquerylabs.com
https://incquerylabs.com
info@incquerylabs.com

More Related Content

Eclipse VIATRA Overview 2017

  • 1. The Eclipse VIATRA framework Dr. István RÁTH Co-lead @ VIATRA Managing Director @ IncQuery Labs Ltd.
  • 2. VIATRA in a nutshell Application domains Model transformations Java API Xtend API Model queries Reactive query and transformation engine VIATRA: open source foundations for design tools Design tools for systems engineering
  • 4. Motivation: Early validation of design rules SystemSignalGroup design rule (from AUTOSAR) • A SystemSignal and its group must be in the same IPdu • Challenge: find violations quickly in large models • New difficulties • reverse navigation • complex manual solution AUTOSAR: • standardized SW architecture of the automotive industry • now supported by modern design tools Design Rule/Well-formedness constraint: • each valid car architecture needs to respect • designers are immediately notified if violated Challenge: • >500 design rules in AUTOSAR tools • >1 million elements in AUTOSAR models • models constantly evolve by designers
  • 5. route: Route sp: SwitchPosition switch: Switchsensor: Sensor follows switch sensor definedBy Complex model queries in Java 1 2 0 3 4 // Incoming transition for an entry state public void getRouteWithoutDefinition(route: Route) { if (route != null) { // Step 0 for (SwitchPosition sp: route.getFollows()) {// Step 1 if (sp.getSwitch() != null) // Step 2 if (sp.getSwitch().getSensor() != null) // Step 3 if (route != sp.getSwitch().getSensor()) { // Step 4 // do something } }}}
  • 6. Complex model queries in the VIATRA Query Language (VQL) // Sensors that are associated with a switch that belongs to a route, but the sensor is not associated with the same route. pattern routeSensor(route:Route, sensor:Sensor) { Route.follows.switch.sensor(route, sensor); neg find definedBy(route, sensor); Route.length(route, length); check(length <= 0); } Negative pattern call Query definition Query parameters Type constraint Attribute or Reference navigation route: Route sp: SwitchPosition switch: Switchsensor: Sensor follows switch sensor definedBy Check expression for attribute values (integrates with Java via Xbase)
  • 8. The VIATRA Model Query engine Query back-ends Live Search- based Hybrid • Performance-first • Indexing • in the initialization phase • ~10% of model loading time • Memory efficient • Still much faster than handwritten Java • Blazing fast (<10ms) • Query result change notifications • Requires more memory (+20-70% tool footprint) • Fine-grained fine- tuning between backend configurations Benchmarks https://github.com/viatra/viatra-cps-benchmark https://github.com/IncQueryLabs/magicdraw-viatra-benchmark https://github.com/FTSRG/trainbenchmark
  • 10. Model Transformation and Code Generation Source Model Target CodeCode DOM/AST M2M M2T Model-to-Model (M2M) Transformation • SRC: In-memory model (objects) • TRG: In-memory model (objects) Model-to-Text (M2T) Transformation • SRC: In-memory model (objects) • TRG: Textual code (string)
  • 11. VIATRA Reactive Transformation Engine Reactive Model Transformations (“rule engine for MT”) Observed events Controlled events Notifications Messages Model Event What has happened? (external + internal) Condition When to react? (internal) Action What to do? (external+internal)
  • 12. VIATRA Java/Xtend API pattern compositeState(state: State, region: Region) { CompositeElement(state); CompositeElement.regions(state, region); neg find initialStates(region, _); } private def getInitCompositeStateRule() { return createRule .name("initCompositeStateRule") .precondition(CompositeStateMatcher.querySpecification) .action(CRUDActivationStateEnum.CREATED) [ val currRegion = it.region currRegion.createChild(region_Vertices, scPackage.entry) ] .addLifeCycle(Lifecycles.getDefault).build } Model manipulation: • Internal DSL in Xtend • Unified interface for simple / transactional model edits • Primitives • create/Child • addTo • Remove • Set • moveTo Precondition: • Graph pattern in VQL
  • 13. VIATRA Features & Add-ons Tools • Declarative and powerful query language • Integrates with Java using Xbase • Xtext-based Eclipse IDE • Reactive debugger • Maven builder • Test framework with coverage support APIs • Type safe and easy-to-use • Databinding • Derived features with notifications • Model-to-model and model-to- code transformation primitives • Java and Xtend friendly Runtime • Headless with minimal dependencies • Advanced performance optimizations • Various back-ends for different trade- offs • Unique feature: live queries and reactive transformations Add-ons • VIATRA Validation • VIATRA Viewers (view maintenance) • VIATRA-DSE (Design Space Exploration) • VIATRA-CEP (Complex Event Processing)
  • 15. VIATRA History and Roadmap • (Old) VIATRA2 (2004-2008)  EMF-IncQuery (2009-2013) •  (New) VIATRA 1.x (2014-) • Search-based query back-end • Live queries: up to 50% less memory vs EMF-IncQuery (Eclipse Collections) • Reactive transformations, debugger & other add-ons • Part of Release train since Oxygen (VIATRA 1.6), 1.7 due Dec 20 (O.2) •  VIATRA 2.x (2018-) • Server-side “big query” tech (model repositories, graph databases) • VQL2: usability-first, multi-syntax (single line & graphical queries)
  • 16. VIATRA in a nutshell Model transformations Application domains Design tools for systems engineering Java API Xtend API Model queries Reactive query and transformation engine VIATRA: open source foundations for design tools Contributors http://eclipse.org/viatra http://wiki.eclipse.org/VIATRA https://github.com/viatra https://incquerylabs.com/en/page/show/viatra Resources Success stories