Presentation is loading. Please wait.

Presentation is loading. Please wait.

Budapest University of Technology and Economics Department of Computer Science and Information Theory 1 Graph Transformation in Relational Databases Gergely.

Similar presentations


Presentation on theme: "Budapest University of Technology and Economics Department of Computer Science and Information Theory 1 Graph Transformation in Relational Databases Gergely."— Presentation transcript:

1 Budapest University of Technology and Economics Department of Computer Science and Information Theory 1 Graph Transformation in Relational Databases Gergely Varró Katalin Friedl Dániel Varró {gervarro,friedl}@cs.bme.hu varro@mit.bme.hu

2 Budapest University of Technology and Economics Department of Computer Science and Information Theory 2 Introduction Graph transformation –graph query + manipulation –at very high abstraction level Relational database management systems –storage medium for business critical data –the most successful field of SW engineering –close synergy between theory and practice: SQL –manipulation on a low level of abstraction

3 Budapest University of Technology and Economics Department of Computer Science and Information Theory 3 Motivation GT for databases –hybrid (visual + textual) query language based upon GT [Andries, Engels] –Varlet framework [Jahnke, Zündorf]: TGGs for database re-engineering –GRAS (graph-oriented DBMS, underlying database for PROGRES) [Kiesel, Schürr, Westfechtel] Databases for GT –How to do? (Mapping) –How fast? (Performance)

4 Budapest University of Technology and Economics Department of Computer Science and Information Theory 4 Graph transformation blocked releasetokenheld_by next R. Heckel: Compositional verification of reactive systems specified by graph transformation, FASE’98, vol. 1382 of LNCS, pages 138-153 Metamodel (type graph) n1 : next n2 : next p1:Processp2:Process Instance model (instance graph) ProcessResource request

5 Budapest University of Technology and Economics Department of Computer Science and Information Theory 5 r:Resource hb:held_by p:Process reqn:request rn:Resource Rules A resource that has been held by a process is released. r:Resource p:Process r:Resource hb:held_by rel:release p:Process rqn:request rn:Resource ReleaseR p:Process Precondition Right-hand side Left-hand side Negative application condition

6 Budapest University of Technology and Economics Department of Computer Science and Information Theory 6 Pattern matching phase n1 : next n2 : next r:Resource p:Process r:Resource hb:held_by rel:release p:Process rqn:request rn:Resource ReleaseR h1 : held_byh2 : held_by r1:Resourcep1:Processp2:Processr2:Resource rq : request

7 Budapest University of Technology and Economics Department of Computer Science and Information Theory 7 Updating phase r:Resource p:Process r:Resource hb:held_by rel:release p:Process rqn:request rn:Resource ReleaseR n1 : next n2 : next h1 : held_byh2 : held_by r1:Resourcep1:Processp2:Processr2:Resource rl : release rq : request

8 Budapest University of Technology and Economics Department of Computer Science and Information Theory 8 Database introduction I. Projection Selection Cartesian product 1a 2b 1 2 t1 AB 1a 2b 1a AB 1a1a’ 2b1 1a3c 2b3c FROM t1 SELECT A FROM t1 SELECT * WHERE A=1 1a 2b 1a’ 3c t1 AB t2 CD FROM t1, t2 SELECT * σ A=1 (t1) AB t1×t2 ABCD Π A (t1) A

9 Budapest University of Technology and Economics Department of Computer Science and Information Theory 9 Database introduction II. Inner join Left outer join 1a 2b 1a’ 3c t1 AB t2 CD 1a1a’ t1 INNER JOIN t2 ABCD 1a 2b 1a’ 3c t1 AB t2 CD t1 LEFT JOIN t2 ABCD 1a1a’ 2bNN FROM t1, t2 SELECT * WHERE t1.A=t2.C FROM t1 LEFT JOIN t2 SELECT * ON t1.A=t2.C t1.A=t2.C No match for 2 in t2.CNo match for 3 in t1.At1.A=t2.C No match for 2 in t2.C

10 Budapest University of Technology and Economics Department of Computer Science and Information Theory 10 Standard mapping Class  Table Association  Table + FK Inheritance  Foreign key Metamodel representation Resource id next idsrctrg held_by idsrctrg blocked releasetokenheld_by next ProcessResource request Metamodel (type graph) Process id Database schema...

11 Budapest University of Technology and Economics Department of Computer Science and Information Theory 11 Instance model representation r1 r2 n1p1p2 n2p2p1 h1r1p1 h2r2p2 Data Resource id next idsrctrg release idsrctrg held_by idsrctrg n1 : next n2 : next h1 : held_byh2 : held_by r1:Resourcep1:Processp2:Processr2:Resource Instance model (Instance graph) p1 p2 Process id rq : request

12 Budapest University of Technology and Economics Department of Computer Science and Information Theory 12 LHS computation p1h1r1 p2h2r2 Computes the inner join of the corresponding tables r:Resource hb:held_by p:Process LHS  view SELECT Process AS p,held_by AS hb,Resource AS rFROM CREATE VIEW ReleaseR_lhs AS WHEREr.id=hb.srcANDp.id=hb.trg ReleaseR_lhs phbr p.id AS p,hb.id AS hb,r.id AS r AND injectivity_constraints

13 Budapest University of Technology and Economics Department of Computer Science and Information Theory 13 NAC computation Computes the inner join of the corresponding tables rqn:request rn:Resource NAC  view p:Process SELECT p.id AS p, rqn.id AS rqn, rn.id AS rn Process AS p,request AS rqn,Resource AS rn FROM CREATE VIEW ReleaseR_nac AS WHEREp.id=rqn.srcANDrn.id=rqn.trg ReleaseR_nac prqnrn Exactly the same method as for LHS p2rqr2

14 Budapest University of Technology and Economics Department of Computer Science and Information Theory 14 Precondition computation lhs phbr p1h1r1 p2h2r2 p1h1r1NNN p2h2r2p2rqr2 Computes the left outer join of LHS and NAC SELECT lhs.* ReleaseR_lhs AS lhsLEFT JOINReleaseR_nacFROM CREATE VIEW ReleaseR AS WHEREnac.p IS NULL ON lhs.p=nac.p ReleaseR phbr lhs LEFT JOIN nac phbrprqnrn p1h1r1 p2h2r2 nac prqnrn r:Resource hb:held_by p:Process rqn:request rn:Resource Successful matching Precondition  view p2rqr2

15 Budapest University of Technology and Economics Department of Computer Science and Information Theory 15 n1 : next n2 : next h1 : held_byh2 : held_by r1:Resourcep1:Processp2:Processr2:Resource Updating tables I. h2r2p2 held_by idsrctrg r:Resource hb:held_by p:Process rqn:request rn:Resource ReleaseR DELETE FROM held_by WHEREid=h1 h1r1p1

16 Budapest University of Technology and Economics Department of Computer Science and Information Theory 16 Updating tables II. n1 : next n2 : next h2 : held_by r1:Resourcep1:Processp2:Processr2:Resource rl : release release idsrctrg rlr1p1 INSERT INTO VALUES(rl,r1,p1) release (id,src,trg) p:Process r:Resource rel:release ReleaseR

17 Budapest University of Technology and Economics Department of Computer Science and Information Theory 17 Categorization Style –interpreted: AGG, Progres –compiled: Fujaba, DB based approach Base algorithm –constraint satisfaction: AGG, VIATRA, DB based approach variables + constraints –local searches: Fujaba, Progres step-by-step extension of the matching Single pushout approach with injective matchings

18 Budapest University of Technology and Economics Department of Computer Science and Information Theory 18 Tool comparison I. Same set of test cases –Short transformation sequences deterministic execution order length between 25 and 5000 –Long transformation sequences deterministic execution order (no matchings in some cases) up to 60000 rule applications –Few matches on large models as long as possible rule application

19 Budapest University of Technology and Economics Department of Computer Science and Information Theory 19 Tool comparison II. Tool specific issues: –AGG Without GUI, controlled by a Java program –Progres Interpreted version with GRAS Prolog-style cuts (determinism) Measurements on a second scale –Fujaba Always (Many-)To-Many associations Without DOBS Additional node for storing processes and resources –Our approach PostgreSQL + No additional optimization

20 Budapest University of Technology and Economics Department of Computer Science and Information Theory 20 Quantitative comparison I.

21 Budapest University of Technology and Economics Department of Computer Science and Information Theory 21 Quantitative comparison II.

22 Budapest University of Technology and Economics Department of Computer Science and Information Theory 22 Evaluation I. AGG + good PM strategy even for large models –update strategy: linear in model size (!!!) due to compilation into categories Progres + good, if relatively large number of matches compared to the model size –worst execution results (especially if large models + few matches)

23 Budapest University of Technology and Economics Department of Computer Science and Information Theory 23 Evaluation II. Fujaba + extremely good for small models –performance problems with large models –could be much better if DFS graph traversal is supported DB + runs on all test cases –relatively large overhead for as long as possible rule applications (always from scratch) + BUT STILL THE BEST FOR LARGE MODELS

24 Budapest University of Technology and Economics Department of Computer Science and Information Theory 24 Future work Interface definition –to enable the integration of the engine to several GT tools Comparison to other tools –VIATRA –GReAT Comparison on other test cases Incremental transformations –Now in Darmstadt (Segravis)

25 Budapest University of Technology and Economics Department of Computer Science and Information Theory 25 Before saying thank you for your kind attention... I have some additional surprise if you are interested.

26 Budapest University of Technology and Economics Department of Computer Science and Information Theory 26 AGG (match vs. update)

27 Budapest University of Technology and Economics Department of Computer Science and Information Theory 27 Fujaba extra I.

28 Budapest University of Technology and Economics Department of Computer Science and Information Theory 28 Fujaba extra II.

29 Budapest University of Technology and Economics Department of Computer Science and Information Theory 29 Results of tool comparison I. ProcMod.TSAGGProgresFujabaDB sizelengthavgsumavgsumavgsumavgsum ###ms 5172410525121253000238481150 10030249911055047104252000045223793517459 100030024999409TO 260TO140700419 421250014536281197242000129263484951 10005001600011952TO920TO7794TO2571544621 10504078311110040001351918723 301501207489262252700014517421333909 50250200831668034569000639127874377332 10050040012851047657263000506120245893815000 2001000800315251706129410350006918TO5140581

30 Budapest University of Technology and Economics Department of Computer Science and Information Theory 30 Conclusion Outperformed GT engines based on interpreted approaches Fujaba comparison –better in case of large models –worse in case of small models Worst-case assessment method More simple rules –join of few tables –independent of the number of rules


Download ppt "Budapest University of Technology and Economics Department of Computer Science and Information Theory 1 Graph Transformation in Relational Databases Gergely."

Similar presentations


Ads by Google