SlideShare a Scribd company logo
1 of 48
Dipartimento di Matematica e Informatica

A System for Stratified Datalog Programs

SUPERVISOR
Prof. Francesco Ricca

STUDENT
Simone Spaccarotella
138937
Recursion

DLV

Semi
Naive
Method

Fixpoint

DLVDB

Datalog

Tp
Operator

Stratification


DLVDB
 is DBMS-dependent
 does not handle the Data-Types properly



It lacks a Standard API for DLV/DLVDB
Recursion

DLV

DLVDB

Semi
Naive
Method

Rel
Grounder

Datalog

Fixpoint

Tp
Operator

Stratification

DLV
Wrapper

RESTdlv

REST

Remote
API

Front-End

Web
Service


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
RelGrounder

Datalog
INPUT

Translation
Layer

Persistence
Layer

Mapping

EXECUTE

DB

SQL
Statement

SQL
Statement

Datalog
Rule


Non-ground Atom  Relation Schema
 Predicate Symbol  Relation Name
 Terms  Attributes



Ground Atoms  Tuples



XML Mapping File
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();
p(X,Y,Z) :- ....., ....., .....

INSERT INTO p(X,Y,Z) (
SELECT ....
FROM ....
[WHERE] ....
)
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
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
)
)
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
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
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
)
)
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
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
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
Tk-1

T0
T1
Tk-2

∆T0

n=0

∆T1

n=1

...
∆Tk-1

n = k-1



Fixpoint
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
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


Auxiliary-table Approach



ID-based Approach
Auxiliary-table
Approach

DLVDB
Strategy

DLVDB-like
Strategy
P

P

P_d1

P_d

∆ at k-1

∆ at k
P

P

P_new

P_old

∆ at k

Tk-1

P_temp
P

P
P
50

30
10


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
<HTTP VERB, URI>

RESTdlv
WS

JSON
XML

Network

Bean

RESTdlv
Bean
Client
URI

RESTdlv WS

Resource
Servlet

HTTP
Verb
•POST
•GET
•PUT
•DELETE

Method

•C
•R
•U
•D
RESTdlv
Bean
WS

Bean

Network

RESTdlv
Client
RESTdlv
WS

Datalog Programs
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)


A DEMO of the Sudoku game



A proof of concept for RESTdlv WS
Bean
WS

Network

Bean
Client


RelGrounder



Three implementations of the Semi-Naïve method



RESTdlv WS + SudokuLogic



RESTdlv Client (integrated in DLVWrapper)
Thank you all.

More Related Content

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

JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development Experiences
Peter Pilgrim
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
phanleson
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
leminhvuong
 
Pointcuts and Analysis
Pointcuts and AnalysisPointcuts and Analysis
Pointcuts and Analysis
Wiwat Ruengmee
 

Similar to A System for Stratified Datalog Programs - Master's thesis presentation (20)

QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
QR Factorizations and SVDs for Tall-and-skinny Matrices in MapReduce Architec...
 
Lec 08 - DESIGN PROCEDURE
Lec 08 - DESIGN PROCEDURELec 08 - DESIGN PROCEDURE
Lec 08 - DESIGN PROCEDURE
 
Stratosphere Intro (Java and Scala Interface)
Stratosphere Intro (Java and Scala Interface)Stratosphere Intro (Java and Scala Interface)
Stratosphere Intro (Java and Scala Interface)
 
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter PilgrimJavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
JavaCro'14 - Scala and Java EE 7 Development Experiences – Peter Pilgrim
 
JavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development ExperiencesJavaCro 2014 Scala and Java EE 7 Development Experiences
JavaCro 2014 Scala and Java EE 7 Development Experiences
 
ICSM07.ppt
ICSM07.pptICSM07.ppt
ICSM07.ppt
 
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn TớiTech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
Tech Talk #4 : RxJava and Using RxJava in MVP - Dương Văn Tới
 
Observer design for descriptor linear systems
Observer design for descriptor linear systemsObserver design for descriptor linear systems
Observer design for descriptor linear systems
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
 
Functional programming with clojure
Functional programming with clojureFunctional programming with clojure
Functional programming with clojure
 
TreSQL
TreSQL TreSQL
TreSQL
 
An Introduction to RxJava
An Introduction to RxJavaAn Introduction to RxJava
An Introduction to RxJava
 
DDL and DML statements.pptx
DDL and DML statements.pptxDDL and DML statements.pptx
DDL and DML statements.pptx
 
«Практическое применение Akka Streams» — Алексей Романчук, 2ГИС
«Практическое применение Akka Streams» — Алексей Романчук, 2ГИС«Практическое применение Akka Streams» — Алексей Романчук, 2ГИС
«Практическое применение Akka Streams» — Алексей Романчук, 2ГИС
 
Практическое применения Akka Streams
Практическое применения Akka StreamsПрактическое применения Akka Streams
Практическое применения Akka Streams
 
Introduction to R programming
Introduction to R programmingIntroduction to R programming
Introduction to R programming
 
Pointcuts and Analysis
Pointcuts and AnalysisPointcuts and Analysis
Pointcuts and Analysis
 
User Defined Aggregation in Apache Spark: A Love Story
User Defined Aggregation in Apache Spark: A Love StoryUser Defined Aggregation in Apache Spark: A Love Story
User Defined Aggregation in Apache Spark: A Love Story
 
User Defined Aggregation in Apache Spark: A Love Story
User Defined Aggregation in Apache Spark: A Love StoryUser Defined Aggregation in Apache Spark: A Love Story
User Defined Aggregation in Apache Spark: A Love Story
 

More from Simone Spaccarotella

More from Simone Spaccarotella (7)

BBC Sounds Update 28 November 2019
BBC Sounds Update 28 November 2019BBC Sounds Update 28 November 2019
BBC Sounds Update 28 November 2019
 
BBC Sounds Update - Play team (Snowy Edition)
BBC Sounds Update - Play team (Snowy Edition)BBC Sounds Update - Play team (Snowy Edition)
BBC Sounds Update - Play team (Snowy Edition)
 
BBC Sounds Web Next Architecture
BBC Sounds Web Next ArchitectureBBC Sounds Web Next Architecture
BBC Sounds Web Next Architecture
 
HTTP/2 and web development practices
HTTP/2 and web development practicesHTTP/2 and web development practices
HTTP/2 and web development practices
 
Recommendations assumptions
Recommendations assumptionsRecommendations assumptions
Recommendations assumptions
 
AWS account migration for BBC iPlayer Radio
AWS account migration for BBC iPlayer RadioAWS account migration for BBC iPlayer Radio
AWS account migration for BBC iPlayer Radio
 
MicroWSMO editor - Bachelor's thesis presentation
MicroWSMO editor - Bachelor's thesis presentationMicroWSMO editor - Bachelor's thesis presentation
MicroWSMO editor - Bachelor's thesis presentation
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 

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