25
Budapest University of Technology and Economics Fault Tolerant Systems Research Group TOOLS Europe 2012 Prague, Czech Republic, 2012. 05. 30. Integrating Efficient Model Queries in State- of-the-art EMF Tools Gábor Bergmann, Ábel Hegedüs, Ákos Horváth, István Ráth, Zoltán Ujhelyi and Dániel Varró

EMF-IncQuery presentation at TOOLS 2012

Embed Size (px)

DESCRIPTION

EMF-IncQuery 0.6 (https://viatra.inf.mit.bme.hu/incquery/) has been introduced at the TOOLS 2012 conference (http://tools2012.fit.cvut.cz/).

Citation preview

Page 1: EMF-IncQuery presentation at TOOLS 2012

Budapest University of Technology and EconomicsFault Tolerant Systems Research Group

TOOLS Europe 2012Prague, Czech Republic, 2012. 05. 30.

Integrating Efficient Model Queries in State-of-the-art EMF Tools

Gábor Bergmann, Ábel Hegedüs, Ákos Horváth, István Ráth, Zoltán Ujhelyi and

Dániel Varró

Page 2: EMF-IncQuery presentation at TOOLS 2012

Overview Introduction EMF-INCQUERY overview Transparent query integration Performance considerations Conclusion

Page 3: EMF-IncQuery presentation at TOOLS 2012

MDE today

REQ

SD

IMP

TST

Modeling techniques

IDE

Integrated model-driven tools

Model-based early

analysis Architecture modeling,

DSMLsCode

generation, model-assisted development

Model-based test generation

Page 4: EMF-IncQuery presentation at TOOLS 2012

MDE today

REQ

SD

IMP

TST

Modeling techniques

IDE - Eclipse

Eclipse Modeling Framework

Page 5: EMF-IncQuery presentation at TOOLS 2012

A key problem of MDE Scalability vs. modeling tools

o Issues encountered by several industrial partners using tools based on the Eclipse Modeling Framework (EMF)

o Modeling scenarios can get really complex really quickly• Instance models of size 1-2M and beyond• Performance issues with model transformations and code

generators have an adverse effect on everyday development tasks

Scalability?o Complex

(meta)modelso Large instance modelso Complex query and manipulation scenarios

Recognized e.g. by AUTOSAR tool vendorshttp://wiki.eclipse.org/Auto_IWG_WP2

Page 6: EMF-IncQuery presentation at TOOLS 2012

Focus: model queries Model queries: “a piece of code that retrieves a given set of the

model” Queries are at the heart of MDE

o Every model access/read is a (simple) queryo More complex: Views, content providerso Most complex: Model transformations, code generators, …

Query performance (= the speed of content retrieval) is crucialo First vs. consecutive vs. throughputo Query result vs. query contents

Core problems1. Slow query engines 2. Considerable programming effort necessary to get complex

queries right

Page 7: EMF-IncQuery presentation at TOOLS 2012

EMF-INCQUERY

Page 8: EMF-IncQuery presentation at TOOLS 2012

Overview EMF-INCQUERY: a model query engine

o Supports batch querieso Optimized for incremental queries!

Incremental evaluationo Based on the RETE algorithmo Compute once, update afterwardso Gain: Instant re-evaluationo Price: Uses some more memory• Manageable with proper life cycles

Page 9: EMF-IncQuery presentation at TOOLS 2012

Query engine

RETE networkInput nodes

Intermediate nodes

Outputnodes

Deltamonitor

EMF instance model

Generated query components

Input = Model contents + changes (EMF notifications)

Output = Query results + (subsequent) Query result deltas

Query definition

Page 10: EMF-IncQuery presentation at TOOLS 2012

Benefits of EMF-INCQUERY Makes on-the-fly well-formedness validation, view

maintenance, … feasible over really large instance models

Simplifies writing really complex querieso Graph pattern languageo Highly reusable query libraries

Easy-to-integrate into existing appsoWorks with any EMF domain metamodelo Integrates through Eclipse standards works with

many EMF-based apps out-of-the-box

Page 11: EMF-IncQuery presentation at TOOLS 2012

DEMO School metamodel in EMF

INCQUERY Pattern Language

Page 12: EMF-IncQuery presentation at TOOLS 2012

INCQUERY Pattern Language

Expressive declarative query language by graph patterns

Capture local + global queriesCompositionality + Reusabilility „Arbitrary” Recursion, Negation

Page 13: EMF-IncQuery presentation at TOOLS 2012

New features with version 0.6 Tools

o Xtext2-based language• Content assist (code completion), validation, outline, …

o Unique query language features• Unlimited recursion and transitive closure• Aggregate functions• Match/exceed the expressive power of OCL, while providing more

flexible re-use

Runtimeo Build and execute queries on-the-flyo Strong generative bindings to Javao Efficient incremental transitive closure

Page 14: EMF-IncQuery presentation at TOOLS 2012

INCQUERY Development Tools

Query Explorer

Pattern Editor

Queries are applied & updates on-the-fly

• Works with most EMF-based editors out-of-the-box

• Reveals matches as selection

Page 15: EMF-IncQuery presentation at TOOLS 2012

INCQUERY Model Validation

Markers in the Problems View

Standard Eclipse BPMN Editor

• Works with most EMF-based tools out-of-the-box

• Manages error-warning markers on-the-fly as the user is editing the model = Instantaneous feedback

Page 16: EMF-IncQuery presentation at TOOLS 2012

TRANSPARENT QUERY INTEGRATION

… beyond the development tools

Page 17: EMF-IncQuery presentation at TOOLS 2012

<<derived>>

<<derived>>

<<derived>>

Derived features in EMFDerived features:• Supported by auxiliary

mechanisms (e.g. Java, OCL)• Supported by EMF-based

tools out-of-the-box

Derived edges:• Binary relationships• Supported by binary

INCQUERY patterns

Derived attributes:• Typed scalar values• Supported by

INCQUERY derivatives

Page 18: EMF-IncQuery presentation at TOOLS 2012

INCQUERY derivatives

Derived attribute “hasPrimeWeight”:

True iff pattern “coursePrimeWeight”

matches to host C

You can combine IQPL with (side-effect free, deterministic) Xbase

Key benefits:• Automatic

dependency-aware change notifications for derived features

• Instantaneous result retrieval

Page 19: EMF-IncQuery presentation at TOOLS 2012

PERFORMANCE BENCHMARK

Instantaneous result retrieval?

Page 20: EMF-IncQuery presentation at TOOLS 2012

Benchmarking scenario In-memory models

o Embedded railways control software system design domaino Instance models up to 2.7M elements

Scenario: well-formedness validationo 5 rules, from simple to very complexo Batch validation: loading models + executing querieso On-the-fly revalidation: modifying models + re-executing

queries instantaneously Tools

o Eclipse tools (OCL, INCQUERY, EMF-Java)o RDF/SPARQL engines (for comparison)

http://viatra.inf.mit.bme.hu/publications/trainbenchmark

Page 21: EMF-IncQuery presentation at TOOLS 2012

Revalidation on-the-fly

• Incremental EMF engines typically 5-10x faster

• sub-100ms response times for up to 1.5M elements

SPARQL tools are generally 1-2 Orders-of-Magnitude (OM) slower

than top EMF tools

Page 22: EMF-IncQuery presentation at TOOLS 2012

A closer look at the top

Performance advantage of OCL-IA over OCL is not significant with

complex queries

INCQUERY is 1-1.5 orders-of-magnitude

faster than OCL-IA

Page 23: EMF-IncQuery presentation at TOOLS 2012

Memory usage

• Incremental engines impose a linear memory consumption overhead

• INCQUERY overhead is larger than OCL-IA

• Even the largest models fit into 1GB of RAM

Page 24: EMF-IncQuery presentation at TOOLS 2012

Final points EMF-INCQUERY has been proposed as an

Eclipse.org project under EMFT http://www.eclipse.org/proposals/modeling.emf.incquery/

EMF-INCQUERY 0.6 preview release is available immediatelyo Pointers:

http://viatra.inf.mit.bme.hu/incquery http://viatra.inf.mit.bme.hu/incquery/getting_started http://viatra.inf.mit.bme.hu/performance

Release 0.6 is scheduled shortly after the Eclipse Juno Launch (beginning of July)

Page 25: EMF-IncQuery presentation at TOOLS 2012

Acknowledgements Additional development team members

oMárk Czotter, Tamás Szabó Performance benchmarking

o Benedek Izsó, Zoltán Szatmári Testing, examples

o Attila Csicsely, Tamás Csurgó, Dániel Kávássy, Gábor Szárnyas, Tamás Tóth

Thank you very much!