A System for Stratified Datalog Programs - Master's thesis presentation

855 views

Published on

Research has made big steps in the field of database theory, leading to large technological improvements of the existing systems. These systems ensure efficiency and suitable computational power to handle the so-called
“big data”. In particular, relational DBMSs provide high performance on read/write operations, and support a query language sufficiently expressive such as SQL. Furthermore, there exist logic-based systems - the so-called Deductive Database Systems (DDS) - that provide support to recursive queries, enabling complex reasoning capabilities and allowing querying of databases, using Datalog-like rules. Among the available DDS systems, one of the most known implementation is DLV. In particular, there is an extension of DLV - called DLVDB - that merges the potential of a DDS with the well-known optimization techniques implemented in the current DBMSs, improving rea-
soning efficiency on big data sets. DLVDB can evaluate a Datalog program having EDBs stored on a relational DBMS. Unfortunately, it can not handle database types in a satisfying way, and it does not support all DBMSs.
Moreover, it is difficult to integrate DLVDB into a real system, due to the lack of an API that simplifies the interoperability with third-party software.

In this thesis, we present two new software systems that address these problems. The first one is called RelGrounder, which is an evaluator of stratified Datalog programs with EDBs stored on relational databases. Unlike
DLVDB , it is database-independent, and can manage the data types. The second one is called RESTdlv, a RESTful web service for remote calls to RelGrounder, DLVDB and DLV.

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
855
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

A System for Stratified Datalog Programs - Master's thesis presentation

  1. 1. Dipartimento di Matematica e Informatica A System for Stratified Datalog Programs SUPERVISOR Prof. Francesco Ricca STUDENT Simone Spaccarotella 138937
  2. 2. Recursion DLV Semi Naive Method Fixpoint DLVDB Datalog Tp Operator Stratification
  3. 3.  DLVDB  is DBMS-dependent  does not handle the Data-Types properly  It lacks a Standard API for DLV/DLVDB
  4. 4. Recursion DLV DLVDB Semi Naive Method Rel Grounder Datalog Fixpoint Tp Operator Stratification DLV Wrapper RESTdlv REST Remote API Front-End Web Service
  5. 5.  RelGrounder  A new Evaluator of Stratified Datalog Programs  Developed in Java  DBMS-independent  Handles Data Types  RESTdlv  An umbrella project that cover RESTdlv WS and RESTdlv Client  … and SudokuLogic (a PoC for RESTdlv WS)  DLVWrapper uses RESTdlv Client
  6. 6. RelGrounder Datalog INPUT Translation Layer Persistence Layer Mapping EXECUTE DB SQL Statement SQL Statement Datalog Rule
  7. 7.  Non-ground Atom  Relation Schema  Predicate Symbol  Relation Name  Terms  Attributes  Ground Atoms  Tuples  XML Mapping File
  8. 8. evaluator = EvaluatorInjector.getInstance(properties); evaluator.init(program); evaluator.storeProgramFacts(programScanner.getFacts()); evaluator.storeMappingFacts(); // for each strongly-connected component while (programScanner.hasNextComponent()) { StronglyConnectedComponent component = null; component = programScanner.nextComponent(); evaluator.evaluateExitRules(component); evaluator.evaluateRecursiveRules(component); } evaluator.commit();
  9. 9. p(X,Y,Z) :- ....., ....., ..... INSERT INTO p(X,Y,Z) ( SELECT .... FROM .... [WHERE] .... )
  10. 10. p(X,Y) :- t(X,Y), s(Y), Y >= 10, Y <= 50 SELECT t.X, t.Y FROM t, s WHERE t.Y = s.Y AND t.Y >= 10 AND t.Y <= 50
  11. 11. rich(X) :- worker(X,_), salary(X,Y), Y >= 2500. subsidy(X,500) :- worker(X,_), not rich(X). INSERT INTO subsidy(X) ( SELECT worker.X, 500 FROM worker WHERE worker.X NOT IN ( SELECT rich.X FROM rich ) )
  12. 12. INSERT INTO q(X,Y) ( SELECT t.X, t.Y FROM table as t ) X Y 7 2 13 9 2 0 9 11 5 10 11 3 2 0 11 3
  13. 13. INSERT INTO q(X,Y) ( SELECT t.X, t.Y FROM table as t EXCEPT ( SELECT * FROM q ) ) X Y 7 2 13 9 0 9 11 5 10 3 2 0 11 3
  14. 14. INSERT INTO q(X,Y) ( SELECT t.X, t.Y FROM table as t WHERE NOT EXISTS ( SELECT X, Y FROM q WHERE t.X = q.X AND t.Y = q.Y ) )
  15. 15. INSERT INTO q(X,Y) ( SELECT t.X, t.Y FROM table as t WHERE NOT EXISTS ( SELECT X, Y FROM q WHERE t.X = q.X AND t.Y = q.Y ) ) table X Y 7 2 13 9 2 9 11 5 10 11
  16. 16. INSERT INTO q(X,Y) ( SELECT DISTINCT t.X, t.Y FROM table as t WHERE NOT EXISTS ( SELECT X, Y FROM q WHERE t.X = q.X AND t.Y = q.Y ) ) table X Y 7 2 13 9 2 9 11 5 10 11
  17. 17. INSERT INTO q(X,Y) ( SELECT DISTINCT ...... FROM ...... UNION SELECT DISTINCT ...... FROM ...... ) Source 1 Source 2 X Y X Y 7 2 13 9 9 11 5 10 10 2 4 7 14 11 3 9
  18. 18. Tk-1 T0 T1 Tk-2 ∆T0 n=0 ∆T1 n=1 ... ∆Tk-1 n = k-1  Fixpoint
  19. 19. t(X,Y) :- t(X,Z), t(Z,Y), …, t(Y,X), q(X,Y). ∆Tk = ∆Tk-1 Tk-1 … Tk-1 Tk-2 ∆Tk-1 … Tk-1 …………… Tk-2 Tk-2 … ∆Tk-1 Qu Qu Q
  20. 20. t(X,Y) :- t(X,Z), t(Z,Y), …, t(Y,X), q(X,Y). ∆Tk-1 Tk-1 … Tk-1 Qu… ∆Tk-1 Tk-2 … Tk-2 Q u ∆Tk-1 ∆Tk-1 … Tk-2 Q u ∆Tk-1 Tk-2 … ∆Tk-1 Q u ∆Tk-1 ∆Tk-1 … ∆Tk-1 Q u
  21. 21.  Auxiliary-table Approach  ID-based Approach
  22. 22. Auxiliary-table Approach DLVDB Strategy DLVDB-like Strategy
  23. 23. P P P_d1 P_d ∆ at k-1 ∆ at k
  24. 24. P P P_new P_old ∆ at k Tk-1 P_temp
  25. 25. P P
  26. 26. P 50 30 10
  27. 27.  a RESTful web service for DLV (aka web API)  a remote workspace for Datalog Programs  a simple way to use DLV/DLVDB functionalities  developed in Java
  28. 28. <HTTP VERB, URI> RESTdlv WS JSON XML Network Bean RESTdlv Bean Client
  29. 29. URI RESTdlv WS Resource Servlet HTTP Verb •POST •GET •PUT •DELETE Method •C •R •U •D
  30. 30. RESTdlv Bean WS Bean Network RESTdlv Client
  31. 31. RESTdlv WS Datalog Programs
  32. 32. DLV Wrapper use RESTdlv Client use RESTdlv Client (Java) Third-Party SW RESTdlv WS N E T W O R K (Java) Third-Party SW (any) Web App (HTML + Javascript) Mobile App (Android, iOS, ecc)
  33. 33.  A DEMO of the Sudoku game  A proof of concept for RESTdlv WS
  34. 34. Bean WS Network Bean Client
  35. 35.  RelGrounder  Three implementations of the Semi-Naïve method  RESTdlv WS + SudokuLogic  RESTdlv Client (integrated in DLVWrapper)
  36. 36. Thank you all.

×