EMF-IncQuery: Incremental evaluation of model queries over EMF models

  • View
    285

  • Download
    7

Embed Size (px)

DESCRIPTION

Tutorial at MODELS 2010.

Transcript

  • 1. EMF-INCQUERY Incremental evalua7on of model queries over EMF models Gbor Bergmann, kos Horvth, Istvn Rth, Dniel Varr Andrs Balogh, Zoltn Balogh, Andrs krs, Zoltn Ujhelyi Budapest University of Technology and Economics OptXware Research and Development LLC Budapest University of Technology and Economics Department of Measurement and Informa

2. MOTIVATION 3. Hi Jane, what do you do at work? Jane Detect! Gen Report! Query / View Boss Constraint 4. Hi Jane, you look so sad. What is wrong? It takes me hours to write a Why dont you use a declara7ve query of an EMF model query language (like OCL)? Jane Boss 5. Hi Jane, you look so sad. What is wrong? It takes me hours to write a query of an EMF model I need to re-run the checks Why dont you try from scratch every 7me something incremental? Jane Boss 6. Hi Jane, you look so sad. What is wrong? It takes me hours to write a query of an EMF model I need to re-run the checks from scratch every 7me I go to have lunch while running well-formedness Oh, Jane, you must eat a lot! checks on large UML models Jane Boss 7. STATE OF THE ART 8. Problem 1: Expressiveness EMF Query (declara7ve) oLow expressiveness oLimited navigability no cycles ? OCL (declara7ve) oVerbose oLack of reusability support oLocal constraints of a model element oPoor handling of recursion Challenging to use 9. Problem 2: Incrementality Goal: Incremental evala7on of model queries oIncremental maintenance of result set oAvoid unnecessary re-computa7on Related work: oConstraint evalua7on (by A. Egyed) Arbitrary constraint descrip7on Can be a boeleneck for complex constraints Always local to a model element Listen to model no7ca7ons Calculate which constraints need to be reevaluated oNo other related technology directly over EMF oResearch MT tools: with varying degrees of support 10. Problem 3: Performance Na7ve EMF queries (Java program code): Lack of oReverse naviga7on along references oEnumera7on of all instances by type oSmart Caching Scalability of (academic) MT tools oQueries over >100K model elements (several proofs): FUJABA, VIATRA2 (Java), GrGEN, VMTS (.Net), Egyeds tools 11. Contribu7ons Expressive declara7ve query language by graph paeerns Incremental cache of matches (materialized view) High performance for large models 12. Contribu7ons Expressive declara7ve query language by graph paeerns oCapture local + global queries oComposi7onality + Reusabilility oArbitrary Recursion, Nega7on Incremental cache of matches (materialized view) oCheap maintenance of cache (only memory overhead) oNo7fy about relevant changes oEnable reac7ons to complex structural events High performance for large models oLinear overhead for loading oInstant response for queries o> 1 million model elements (on desktop PC) 13. QUERY LANGUAGE 14. Contribu7ons Expressive declara7ve query language by graph paeerns oCapture local + global queries oComposi7onality + Reusabilility oArbitrary Recursion, Nega7on Incremental cache of matches (materialized view) High performance for large models 15. Paeern deni7on Graphical nota7on implements paeern siblingClass(C1,C2) UI Model superClass S: Class S GComp Cmd Iface S1:superClass S2:superClass Class C1 Bueon ImageBueon C2 C1: Class C2: Class matching s1:implement Graph Paeern: o Structural condi7on that have to be GComp:Class Cmd:Iface fullled by a part of the model space s2:included Graph paeern matching: s1:superClass i2:implement: Iface o A model (i.e. part of the model space) Bueon:Class ImageBueon:Class can sa7sfy a graph paeern, o if the paeern can be matched to a subgraph of the model Instance Model 16. Graph paeerns (VTCL) // B is a sibling class of AsiblingClass(A,B) pattern siblingClass(A, B) ={P: Class Class(A);s1:superClass s2:superClass Class.superClass(S1, A, P); Class(P);A: Class B: Class Class.superClass(S2, B, P); Class(B); }// S is locally substitutable by AlocallySubs (A, S, X) pattern localSubs(A, S, X) = { Class(A); X: Iface Iface(X); Class.implements(I1, A, X); I1:implements I2:implements Class(S); Class.implements(I2, S, X);A: Class S:Class } or {OR Class(A); X: Class OR paeern Class(X); Class.superClass(P1, X, X);s1:superClass s2: superClass Class(S);A: Class S:Class Class.superClass(P2, S, X); } 17. Posi7ve and Nega7ve paeerns (VTCL) topLevelClass(A) pattern topLevelClass(A) = { Nega7ve Class(A);A: Class paeern neg find subClass(A); wSuperClass(X) }X pattern wSuperClass(X) = {neg findX: Class A: Class Class(X); wSuperClasss1:superClass Class.superClass(S1, X, A); Class(A);suspiciousClass(X) }pattern suspiciousClass(X) = { X: Class A: Class Class(X);Posi7ve S1:superClass find topLevelClass(X); IA:isAbstract paeern Class.superClass(S1, A, X);XfindB: Boolean Class(A);topLevelClassClass.isAbstract(IA, A, B); Boolean(B);check (B == false); check (value(B) == "false");} 18. Recursive paeerns (VTCL) pattern descendant(X, D) = {paeern descendant(X,D) Class(X);X: Class Class.superClass(S, Ch, X); S:superClass OR paeern Class(Ch);Recursive paeern find descendant(Ch, D) Ch: Class D: Class Class(D);} or {Class(X); XDClass.superClass(S, D, X);find descendantClass(D);OR } S:superClass D: Class X: Class 19. Origins of the idea Model transforma7ons by VIATRA2 o Transforma7on language Declara7ve paeerns for model queries Graph transforma7on rules for elementary mapping specica7ons ASM rules for control structure o Matching strategy Local search-based (op7mized search plans) Incremental paNern matching (based on RETE) Hybrid paeern matching (adap7ve combina7on of INC and LS) Development team oDeveloped by BUTE and OptXware Ltd. o9 developers More info o hep://eclipse.org/gmt/VIATRA2 o hep://wiki.eclipse.org/VIATRA2 20. Applica7ons of VIATRA2 Stand-alone model transforma7ons Early model-based analysis (DECOS, SecureChange) Integrated features for graphical DSMLs (ViatraDSM) Model execu7on/analysis (stochas7c GT) (Development) tool integra7on (DECOS, SENSORIA, MOGENTES) Model op7miza7on / constraint solving (DIANA) 21. INCREMENTAL PATTERN MATCHING 22. Contribu7ons Expressive declara7ve query language by graph paeerns oCapture local + global queries oComposi7onality + Reusabilility oArbitrary Recursion, Nega7on Incremental cache of matches (materialized view) oCheap maintenance of cache (only memory overhead) oNo7fy about relevant changes (new match lost match) oEnable reac7ons to complex structural events High performance for large models 23. Incremental graph paeern matching Goal: retrieve the match set quickly How? RETE network oStore (cache) matches oIncrementally update them as the model changes Update precisely Experimental results: good, if oThere is enough memory oTransac7onal model manipula7on 24. RETE net RETE network a b c ISignal objects o node: (par7al) matches of a (sub)paeern EMF RISignal.systemSignal edges esourceSet xz wSystemSignal objects EMF no