What's new in Eclipse VIATRA 2.0
Dr. István RÁTH
Managing Director
IncQuery Labs Ltd.
VIATRA in a nutshell
Model
transformations
Application
domains
Design tools
for systems
engineering
Java
API
Xtend
API
Graph queries
Reactive query and transformation engine
VIATRA:
open source
foundations
for design tools
http://eclipse.org/viatra
http://github.com/viatra
Contributors
Users and partners
Resources
VIATRA Query: 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
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 with VIATRA
(“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)
What’s new in VIATRA 2.0?
• Simplification
• Fewer third party dependencies
• New language features
• Lots of performance and memory optimizations
• Much faster VQL compiler
• Up to 80% less memory usage at runtime
• Java compatibility: Java 8 required & used on API, Java 9/10 supported
• Available in Eclipse Photon
• 2.x will follow “2 new feature
releases per year” cadence
• VIATRA 1.7.x will be maintained
for backward compatibility
IncQuery – cloud-based modeling beyond EMF
Scalable
Language
tailored to
models
Validation
and
analytics
features
Hybrid
database
technology
Tool / Repository
Persistent
index
VIATRA query & xform
engine
In-memory
index
Containerized
microservices 
Horizontal scaling in
the cloud
• MagicDraw &
Teamwork Cloud
• NoSQL & graph DBs,
…
1000x faster than
conventional DB
technology
• OpenAPI / Swagger
interfaces
• High-performance
indexing
• Change updates via
callbacks
Built on
V4MD: VIATRA for MagicDraw
• Open source ”glue code” (EPL v2)
• Demonstrates how to bind EMF-based
tech to MagicDraw
• Deployable as a MD plug-in built with
Gradle
• http://github.com/viatra/v4md
VIATRA 2.1: Sirius VQL Editor
Takeaways
• VIATRA 2.0 is now leaner and faster than ever:
https://www.eclipse.org/viatra/documentation/releases.html#!#viatra-20
• Rich documentation and examples to help you get started with queries and
transformations: https://www.eclipse.org/viatra/documentation/tutorial.html
• Find out more about VIATRA-based commercial tools at
https://www.eclipsecon.org/france2018/session/lessons-learned-building-eclipse-
based-add-ons-commercial-modeling-tools
• Watch out for VIATRA 2.0 in Eclipse Photon today!
Thank you!
@IncQueryLabs
istvanrath@incquerylabs.com
https://eclipse.org/viatra
info@incquerylabs.com

VIATRA 2.0 Webinar

  • 1.
    What's new inEclipse VIATRA 2.0 Dr. István RÁTH Managing Director IncQuery Labs Ltd.
  • 2.
    VIATRA in anutshell Model transformations Application domains Design tools for systems engineering Java API Xtend API Graph queries Reactive query and transformation engine VIATRA: open source foundations for design tools http://eclipse.org/viatra http://github.com/viatra Contributors Users and partners Resources
  • 3.
    VIATRA Query: Earlyvalidation 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
  • 4.
    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 } }}}
  • 5.
    Complex model queriesin 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)
  • 6.
  • 7.
    The VIATRA ModelQuery 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
  • 8.
    Model Transformation andCode 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)
  • 9.
    VIATRA Reactive Transformation Engine Reactive ModelTransformations with VIATRA (“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)
  • 10.
    VIATRA Java/Xtend API patterncompositeState(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
  • 11.
    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)
  • 12.
    What’s new inVIATRA 2.0? • Simplification • Fewer third party dependencies • New language features • Lots of performance and memory optimizations • Much faster VQL compiler • Up to 80% less memory usage at runtime • Java compatibility: Java 8 required & used on API, Java 9/10 supported • Available in Eclipse Photon • 2.x will follow “2 new feature releases per year” cadence • VIATRA 1.7.x will be maintained for backward compatibility
  • 13.
    IncQuery – cloud-basedmodeling beyond EMF Scalable Language tailored to models Validation and analytics features Hybrid database technology Tool / Repository Persistent index VIATRA query & xform engine In-memory index Containerized microservices  Horizontal scaling in the cloud • MagicDraw & Teamwork Cloud • NoSQL & graph DBs, … 1000x faster than conventional DB technology • OpenAPI / Swagger interfaces • High-performance indexing • Change updates via callbacks Built on V4MD: VIATRA for MagicDraw • Open source ”glue code” (EPL v2) • Demonstrates how to bind EMF-based tech to MagicDraw • Deployable as a MD plug-in built with Gradle • http://github.com/viatra/v4md
  • 14.
  • 15.
    Takeaways • VIATRA 2.0is now leaner and faster than ever: https://www.eclipse.org/viatra/documentation/releases.html#!#viatra-20 • Rich documentation and examples to help you get started with queries and transformations: https://www.eclipse.org/viatra/documentation/tutorial.html • Find out more about VIATRA-based commercial tools at https://www.eclipsecon.org/france2018/session/lessons-learned-building-eclipse- based-add-ons-commercial-modeling-tools • Watch out for VIATRA 2.0 in Eclipse Photon today!
  • 16.