On unifying query languages for RDF streams

24
Department of Informatics On unifying query languages for RDF streams Daniele Dell’Aglio [email protected] http: //dellaglio.org @dandellaglio Stream Reasoning workshop 2016 Berlin, 08.12.2016

Transcript of On unifying query languages for RDF streams

Page 1: On unifying query languages for RDF streams

Department of Informatics

On unifying query languages

for RDF streams

Daniele Dell’Aglio

[email protected] http://dellaglio.org @dandellaglio

Stream Reasoning workshop 2016 Berlin, 08.12.2016

Page 2: On unifying query languages for RDF streams

Stream Processing and RDF Stream Processing

In literature there are two different main approaches to process streams

Data Stream Management Systems (DSMSs)

• Aggregations and filters

• Relies on the notion of sliding window

• DSMS-inspired RSPs: C-SPARQL, CQELS, SPARQLstream

Complex Event Processors (CEPs)

• Search of relevant patterns in the stream

• Non-equi-join on timestamps (after, before, etc.)

• CEP-inspired RSP: EP-SPARQL

• C-SPARQL offers some CEP features through a timestampfunction; CQELS has some initial extension on this

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 2/19

Page 3: On unifying query languages for RDF streams

The problemUnpredictable behaviour

Exec. 1° answer 2° answer

1 :rRoom [6] :bRoom [11]

2 :rRoom [5] :bRoom [10]

3 :rRoom [6] :bRoom [11]

4 - [7] - [12]

Where are :a and :b, when they are

together?

{:a :isIn ?room . :b :isIn ?room}

Let’s consider a tumbling window

W(ω=β=5)

Let’s execute the experiment 4 times

on CSPARQL

G1 G2 G3

t

{:a :isIn :rRoom}

{:b :isIn :rRoom}

{:a :talksIn :bRoom}

G4S1

{:b :talksIn :bRoom}

3 6 92

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 3/19

Page 4: On unifying query languages for RDF streams

The problemDifferent behaviours (1)

Exec. 1° answer 2° answer

1 :rRoom [6] :bRoom [11]

2 :rRoom [5] :bRoom [10]

3 :rRoom [6] :bRoom [11]

4 - [7] - [12]

Exec. 1° answer 2° answer

1 :rRoom [3] :bRoom [9]

2 No answers

3 :rRoom [3] :bRoom [9]

4 No answers

CSPARQL CQELS

G1 G2 G3

t

{:a :isIn :rRoom}

{:b :isIn :rRoom}

{:a :talksIn :bRoom}

G4S1

{:b :talksIn :bRoom}

3 6 92

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 4/19

Page 5: On unifying query languages for RDF streams

The problemDifferent behaviours (2)

Engine 7 8 9

EP-SPARQL

(unrestricted)

:a, :c [1,5]

:b, :d [3,5]

:b, :d [3,7]

:a, :c [1,9]

EP-SPARQL

(chronological)

:a, :c [1,5]

:b, :d [3,5]

EP-SPARQL

(recent)

:b, :d [3,5]

:b, :d [3,7]

C-SPARQL

(sl. win. 7,1)

:b, :d [3,7]

Who is listening to who?

{?att :isIn ?room}

SEQ

{?spe :talksIn ?room}

G1 G2 G3 G4

t

{:a :isIn :rRoom}

{:b :isIn :bRoom}

{:c :talksIn :rRoom,

:d :talksIn :bRoom}

{:d :talksIn :bRoom}

G6

{:e :isIn :bRoom}

S2G5

{:c :talksIn :rRoom}

3 5 91 7 8

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 5/19

Page 6: On unifying query languages for RDF streams

Research Question

In the context of continuous query answering over RDF streams, how can the behaviour of existing systems be captured, compared and contrasted?

Why do we need it?

• Comparison and contrast

• Interoperability

• Standard RSP query language

• Study RDF Stream Processing and Stream Reasoning related problems

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 6/19

Page 7: On unifying query languages for RDF streams

Background data

Streams

RSEP-QL

Applications

RSP-QL BGP evaluation over background

data

BGP evaluation over streams

Event Pattern detection operators

Model to express continous queries

RDF

SPARQL

RSEP-QL

A reference model that formally defines the semantics of RDF Stream Processing engines

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 7/19

Page 8: On unifying query languages for RDF streams

RSEP-QLFrom SPARQL to RSEP-QL

Evaluator

Data layer

Result Formatter

Ans(Q)RDF graphs

E

DS

QF

Query Interface

Q (E, DS, QF)

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 8/19

Page 9: On unifying query languages for RDF streams

Q (E, DS, QF)

RSEP-QLFrom SPARQL to RSEP-QL

Evaluator

Data layer

Result Formatter

Ans(Q)RDF graphs

E

DS

QF

RDF graphsRDF streams

Query Interface

SDS

Q (E, SDS, QF)

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 8/19

Page 10: On unifying query languages for RDF streams

Q (E, DS, QF)

RSEP-QLFrom SPARQL to RSEP-QL

Evaluator

Data layer

Result Formatter

Ans(Q)RDF graphs

E

DS

QFContinuous EvaluatorET

RDF graphsRDF streams

Query Interface

SDS

Q (E, SDS, QF)

Q (E, SDS, ET, QF)

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 8/19

Page 11: On unifying query languages for RDF streams

Q (E, DS, QF)

RSEP-QLFrom SPARQL to RSEP-QL

Evaluator

Data layer

Result Formatter

Ans(Q)RDF graphs

E

DS

QFContinuous EvaluatorET

RDF graphsRDF streams

Query Interface

SDS

Q (E, SDS, QF)

Q (E, SDS, ET, QF)

Q (SE, SDS, ET, QF)

SE

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 8/19

Page 12: On unifying query languages for RDF streams

RSEP-QL: DataRDF Streams and windows

An RDF stream is an (infinite) ordered sequence of time-annotated data items (RDF graphs)

𝕎(3,1,0)

𝕃(1)

𝑊(2,5] (Fixed) Window

Landmark window

Sliding window

G1 G2 G3 G4

{:a :isIn :rRoom}

{:b :isIn :bRoom}

{:c :talksIn :rRoom,

:d :talksIn :bRoom}

{:d :talksIn :bRoom}

G6

{:e :isIn :bRoom}

S2G5

{:c :talksIn :rRoom}

3 5 91 7 8

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 9/19

Page 13: On unifying query languages for RDF streams

RSEP-QL: Operators

• SPARQL operators

• Stream Processing operators (RSP-QL)• WINDOW to specify that the active element is a window

(similar to GRAPH)• RStream, IStream, DStream to create the output stream

• Event Processing operators (RSEP-QL)• MATCH to describe an event pattern• EVENT w P Basic Event Pattern• FIRST E• LAST E• E1 SEQ E2

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 10/19

Page 14: On unifying query languages for RDF streams

RSEP-QL: Instantaneous Evaluation Semantics

The SPARQL evaluation function is defined as

⟦𝑃⟧𝐷𝑆(𝐺)

Two evaluation functions in RSEP-QL:

• For SPARQL and RSP-QL operators: ⟪𝑃⟫𝑆𝐷𝑆(𝐴)𝑡

• For event processing operators: ⦅𝐸⦆ 𝑜,𝑐𝑡

The two functions co-exist

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 11/19

Page 15: On unifying query languages for RDF streams

The evaluations usually do not occur at every time instant, but only at some of them (evaluation time instants)

• We indicate with ET the set of evaluation time instants

It is not always possible to define ET a priori

• ET is expressed through a Report Policy (from the SECRET framework)

Report Policy examples:

• WC Window Close: an evaluation occurs every time the active window closes

• C-SPARQL, SPARQLstream

• CC Content Change: an evaluation occurs every time the stream content changes.

• CQELS, EP-SPARQL

RSEP-QL: Continuous EvaluationEvaluation time instants

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 12/19

Page 16: On unifying query languages for RDF streams

RSEP-QL: Continuous EvaluationConsumption policies

The evaluations in a sequence are not always independent

• Some data may be involved in the current evaluation only if it was not before

We need a mechanism to move this information between evaluations

• Consumption policies are functions to describe the input for the next evaluation

Two policies for our needs

• 𝒫𝑢: the input is the one selected by the window

• 𝒫𝑛: the input is the one selected by the window and that was not used to produce results in the previous evaluations

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 13/19

Page 17: On unifying query languages for RDF streams

Execution 1° answer 2° answer

1 :rRoom [6] :bRoom [11]

2 :rRoom [5] :bRoom [10]

3 :rRoom [6] :bRoom [11]

4 - [7] - [12]

Window 1° answer 2° answer

t0=0 :rRoom [5] :bRoom [10]

RSEP-QL in actionUnpredictable behaviours

G1 G2 G3

t

{:a :isIn :rRoom}

{:b :isIn :rRoom}

{:a :talksIn :bRoom}

G4S1

{:b :talksIn :bRoom}

3 6 92

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 14/19

Page 18: On unifying query languages for RDF streams

Execution 1° answer 2° answer

1 :rRoom [6] :bRoom [11]

2 :rRoom [5] :bRoom [10]

3 :rRoom [6] :bRoom [11]

4 - [7] - [12]

Window 1° answer 2° answer

t0=0 :rRoom [5] :bRoom [10]

t0=1 :rRoom [6] :bRoom [11]

RSEP-QL in actionUnpredictable behaviours

G1 G2 G3

t

{:a :isIn :rRoom}

{:b :isIn :rRoom}

{:a :talksIn :bRoom}

G4S1

{:b :talksIn :bRoom}

3 6 92

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 14/19

Page 19: On unifying query languages for RDF streams

Execution 1° answer 2° answer

1 :rRoom [6] :bRoom [11]

2 :rRoom [5] :bRoom [10]

3 :rRoom [6] :bRoom [11]

4 - [7] - [12]

Window 1° answer 2° answer

t0=0 :rRoom [5] :bRoom [10]

t0=1 :rRoom [6] :bRoom [11]

t0=2 - [7] - [12]

RSEP-QL in actionUnpredictable behaviours

G1 G2 G3

t

{:a :isIn :rRoom}

{:b :isIn :rRoom}

{:a :talksIn :bRoom}

G4S1

{:b :talksIn :bRoom}

3 6 92

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 14/19

Page 20: On unifying query languages for RDF streams

RSEP-QL in actionDifferent behaviours (1)

Exec. 1° answer 2° answer

1 :rRoom [6] :bRoom [11]

2 :rRoom [5] :bRoom [10]

3 :rRoom [6] :bRoom [11]

4 - [7] - [12]

Exec. 1° answer 2° answer

1 :rRoom [3] :bRoom [9]

2 No answers

3 :rRoom [3] :bRoom [9]

4 No answers

CSPARQL CQELS

G1 G2 G3

t

{:a :isIn :rRoom}

{:b :isIn :rRoom}

{:a :talksIn :bRoom}

G4S1

{:b :talksIn :bRoom}

3 6 92CQELS

CSPARQL

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 15/19

Page 21: On unifying query languages for RDF streams

Engine 7 9

EP-SPARQL

(unrestricted)

:a, :c [1,5]

:b, :d [3,5]

:b, :d [3,7]

:a, :c [1,9]

EP-SPARQL

(chronological)

:a, :c [1,5]

:b, :d [3,5]

EP-SPARQL

(recent)

:b, :d [3,5]

:b, :d [3,7]

C-SPARQL

(sl. win. 7,1)

:b, :d [3,7]

G1 G2 G3 G4

t

{:a :isIn :rRoom}

{:b :isIn :bRoom}

{:c :talksIn :rRoom,

:d :talksIn :bRoom}

{:d :talksIn :bRoom}

G6

{:e :isIn :bRoom}

S2G5

{:c :talksIn :rRoom}

3 5 91 7 8

RSEP-QL in actionDifferent behaviours (2)

SEQ operators with different selection policies• E1 SEQ E2

• EP-SPARQL (unr.)• E1 SEQc E2

• EP-SPARQL (chr.)• E1 SEQr E2

• EP-SPARQL (rec.)• E1 SEQn E2

•C-SPARQL

Different consumption policies

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 16/19

Page 22: On unifying query languages for RDF streams

Captured behaviours

System Report

policy

Streaming

operator

Window

operator

Sequencin

g operator

Consumpti

on policy

CQELS Content

change

Istream Sliding SEQ 𝒫𝑢

SPARQLstream Window

close

Rstream,

Dstream,

Istream

Sliding - 𝒫𝑢

C-SPARQL Window

close

Rstream Sliding SEQn

(timestamp

function)

𝒫𝑢

EP-SPARQL

(unrestricted)

Content

change

Rstream Landmark SEQ 𝒫𝑢

EP-SPARQL

(chronological)

Content

change

Rstream Landmark SEQc 𝒫𝑛

EP-SPARQL

(recent)

Content

change

Rstream Landmark SEQr 𝒫𝑛

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 17/19

Page 23: On unifying query languages for RDF streams

Conclusions

The dynamics introduced in the continuous query evlauation process have not been totally understood

• Not fully captured by existing models

RSEP-QL captures those dynamics, and the behaviours of existing RDF Stream Processing engines

• DSMS-based (RSP-QL)

• CEP-based (RSEP-QL)

What’s next

• Continuous query answering and reasoning

• Further investigation about the relation of RSEP-QL with other models (SPARQL, LARS)

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 18/19

Page 24: On unifying query languages for RDF streams

Thank you! Questions?

On unifying query languages for RDF streams

Daniele Dell’Aglio

[email protected]

http://dellaglio.org

@dandellaglio

08.12.2016 Daniele Dell'Aglio - Stream Reasoning worksho 2016 19/19