RuleML2015: How to combine event stream reasoning with transactions for the Semantic Web

47
How to combine event stream reasoning with transactions for the Semantic Web Ana Sofia Gomes and Jos´ e J´ ulio Alferes NOVA LINCS, Universidade NOVA de Lisboa, August 5, 2015 Jos´ e Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 1 / 16

Transcript of RuleML2015: How to combine event stream reasoning with transactions for the Semantic Web

Page 1: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

How to combine event stream reasoning withtransactions for the Semantic Web

Ana Sofia Gomes and Jose Julio Alferes

NOVA LINCS, Universidade NOVA de Lisboa,

August 5, 2015

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 1 / 16

Page 2: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example: Acting upon traffic violations

Consider a scenario where the police wants to monitor, detect and actupon traffic violations based on a sensor network deployed in roads

A sensor in such a network can identify plates of vehicles anddistinguish between types of vehicles

Based on the information that is published by sensors, andinformation about vehicles, the system must reason about whatvehicles are indulging in traffic violations

For vehicles found to be violating traffic rules, the system must issuefines and notify the corresponding drivers

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 2 / 16

Page 3: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example: Acting upon traffic violations

Consider a scenario where the police wants to monitor, detect and actupon traffic violations based on a sensor network deployed in roads

A sensor in such a network can identify plates of vehicles anddistinguish between types of vehicles

Based on the information that is published by sensors, andinformation about vehicles, the system must reason about whatvehicles are indulging in traffic violations

For vehicles found to be violating traffic rules, the system must issuefines and notify the corresponding drivers

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 2 / 16

Page 4: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example: Acting upon traffic violations

Consider a scenario where the police wants to monitor, detect and actupon traffic violations based on a sensor network deployed in roads

A sensor in such a network can identify plates of vehicles anddistinguish between types of vehicles

Based on the information that is published by sensors, andinformation about vehicles, the system must reason about whatvehicles are indulging in traffic violations

For vehicles found to be violating traffic rules, the system must issuefines and notify the corresponding drivers

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 2 / 16

Page 5: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

Combining data from different types of sensors, for interoperability

Detecting complex events, based on atomic data from sensors

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 6: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

Combining data from different types of sensors, for interoperability

Detecting complex events, based on atomic data from sensors

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 7: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

Combining data from different types of sensors, for interoperability

Detecting complex events, based on atomic data from sensors

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 8: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

Combining data from different types of sensors, for interoperability

Detecting complex events, based on atomic data from sensors

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 9: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

Combining data from different types of sensors, for interoperability

Detecting complex events, based on atomic data from sensors

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 10: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

Combining data from different types of sensors, for interoperability

Detecting complex events, based on atomic data from sensors

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 11: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

E.g. publish data in RDF

Combining data from different types of sensors, for interoperability

Detecting complex events, based on atomic data from sensors

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 12: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

E.g. publish data in RDF

Combining data from different types of sensors, for interoperability

Semantic Sensor Web ontologies

Detecting complex events, based on atomic data from sensors

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 13: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

E.g. publish data in RDF

Combining data from different types of sensors, for interoperability

Semantic Sensor Web ontologies

Detecting complex events, based on atomic data from sensors

Complex event detection languages

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 14: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

E.g. publish data in RDF

Combining data from different types of sensors, for interoperability

Semantic Sensor Web ontologies

Detecting complex events, based on atomic data from sensors

Complex event detection languages

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Ontologies (e.g. in OWL)

Expressing rules describing how to act upon the detection of trafficviolations

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 15: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Required Ingredients

The sensor network (of course!)

Data published by the sensors in some processable way

E.g. publish data in RDF

Combining data from different types of sensors, for interoperability

Semantic Sensor Web ontologies

Detecting complex events, based on atomic data from sensors

Complex event detection languages

Reasoning with sensor data together with data about vehicles,vehicles types, kinds of violations, etc

Ontologies (e.g. in OWL)

Expressing rules describing how to act upon the detection of trafficviolations

Event-Condition-Action rules

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 3 / 16

Page 16: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Reactivity

Reactivity: the ability to detect and react to changes

On event if condition then action

Basic Premisses

Events can be complex

Actions can be complex

Events need to be handled as soon as possible

Actions may trigger events and indirectly execute other actions

Actions can be defined as a transaction

In our example, issuing a fine and notifying the driver must be defined as atransaction

it can never be the case that the fine is issued and the driver is notnotified, nor vice-versa

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 4 / 16

Page 17: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Reactivity

Reactivity: the ability to detect and react to changes

On event if condition then action

Basic Premisses

Events can be complex

Actions can be complex

Events need to be handled as soon as possible

Actions may trigger events and indirectly execute other actions

Actions can be defined as a transaction

In our example, issuing a fine and notifying the driver must be defined as atransaction

it can never be the case that the fine is issued and the driver is notnotified, nor vice-versa

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 4 / 16

Page 18: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Our goal

Goal

Combine in a declarative, rule-based language all the above describedrequirements:

detection of complex events

combining events with ontological data

definition of reactive rules

ability to define transactions

We do this based on an extension of Transaction Logic, called T Rev

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 5 / 16

Page 19: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Our goal

Goal

Combine in a declarative, rule-based language all the above describedrequirements:

detection of complex events

combining events with ontological data

definition of reactive rules

ability to define transactions

We do this based on an extension of Transaction Logic, called T Rev

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 5 / 16

Page 20: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Transaction Logic

Abstract logic to reason about how a transaction executes

Evaluates complex formulas over paths

P,D1, . . . ,Dn |= φ

φ can execute transactionally in program P, over the path D1, . . . ,Dn

φ causes the Knowledge Base to evolve from state D1 into state Dn

Finds the paths where formulas can execute transactionally

Transactions and states are abstract

T R can use several different semantics of state changeReasoning about what primitives are true in a state, and statetransitions is outsourced to Oracles

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 6 / 16

Page 21: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Transaction Logic

Can reason about transactions

Can also reason about complex events

reason about what events have become true in a pathP,D1, . . . ,Dn |= φφ occurs over the path D1, . . . ,Dn

(almost) as expressible as SNOOP’s event algebra (more details in thepaper)

What is Missing?

Reactivity: the ability to reason and react to events

T R can reason about transactions and events individually, but notwith both simultaneously

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 7 / 16

Page 22: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Transaction Logic with Events (T Rev)

Extends T R with the ability to detect and react to complex events

Key Concepts

formulas are partitioned into transactions and events

transaction formulas depend on what event formulas are truetransactions only succeed on paths where all events are responded as atransaction

if an event is triggered during a transaction, the transaction isexpanded with the event response

if the event formula o(e) is true on a path π, then this path needs tobe expanded with the execution of the transaction r(e)

non-monotonic behavior

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 8 / 16

Page 23: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Transaction Logic with Events (T Rev)

Extends T R with the ability to detect and react to complex events

Key Concepts

formulas are partitioned into transactions and events

transaction formulas depend on what event formulas are truetransactions only succeed on paths where all events are responded as atransaction

if an event is triggered during a transaction, the transaction isexpanded with the event response

if the event formula o(e) is true on a path π, then this path needs tobe expanded with the execution of the transaction r(e)

non-monotonic behavior

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 8 / 16

Page 24: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example

p ← a.ins ⊗ b.ins

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

c.inso(e1)

o(b.ins) o(c.ins)

b.ins

{a}{}

a.ins

p

o(a.ins)

{a, b}o(b.ins)

b.ins

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

o(e1)

o(b.ins) o(c.ins)

b.ins

c.ins

o(e2)

a.del

o(a.del)

{b, c}

p ← a.ins ⊗ b.insr(e1) ← c .inso(e1) ← o(b.ins)

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

c.inso(e1)

o(b.ins) o(c.ins)

b.ins

{a}{}

a.ins

p

o(a.ins)

{a, b}o(b.ins)

b.ins

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

o(e1)

o(b.ins) o(c.ins)

b.ins

c.ins

o(e2)

a.del

o(a.del)

{b, c}

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 9 / 16

Page 25: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example

p ← a.ins ⊗ b.ins

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

c.inso(e1)

o(b.ins) o(c.ins)

b.ins

{a}{}

a.ins

p

o(a.ins)

{a, b}o(b.ins)

b.ins

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

o(e1)

o(b.ins) o(c.ins)

b.ins

c.ins

o(e2)

a.del

o(a.del)

{b, c}

p ← a.ins ⊗ b.insr(e1) ← c .inso(e1) ← o(b.ins)

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

c.inso(e1)

o(b.ins) o(c.ins)

b.ins

{a}{}

a.ins

p

o(a.ins)

{a, b}o(b.ins)

b.ins

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

o(e1)

o(b.ins) o(c.ins)

b.ins

c.ins

o(e2)

a.del

o(a.del)

{b, c}

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 9 / 16

Page 26: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example

p ← a.ins ⊗ b.ins

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

c.inso(e1)

o(b.ins) o(c.ins)

b.ins

{a}{}

a.ins

p

o(a.ins)

{a, b}o(b.ins)

b.ins

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

o(e1)

o(b.ins) o(c.ins)

b.ins

c.ins

o(e2)

a.del

o(a.del)

{b, c}

p ← a.ins ⊗ b.insr(e1) ← c .inso(e1) ← o(b.ins)

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

c.inso(e1)

o(b.ins) o(c.ins)

b.ins

{a}{}

a.ins

p

o(a.ins)

{a, b}o(b.ins)

b.ins

{a}

r(e1)

{}

a.ins

p

o(a.ins)

{a, b} {a, b, c}

o(e1)

o(b.ins) o(c.ins)

b.ins

c.ins

o(e2)

a.del

o(a.del)

{b, c}

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 9 / 16

Page 27: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Interpretations and states

Definition (Interpretation)

An interpretation M is a mapping assigning a set of atoms to everypossible path, with the restrictions (where Di s are states, and ϕ an atom):ϕ ∈ M(〈D〉) if ϕ ∈ Od(D)

{ϕ, o(ϕ)} ⊆ M(〈D1o(ϕ)→D2〉) if ϕ ∈ Ot(D1,D2) ∧ ϕ ∈ POa

o(ϕ) ∈ M(〈D1o(ϕ)→D2〉) if o(ϕ) ∈ Ot(D1,D2) ∧ o(ϕ) ∈ POe

o(e) ∈ M(〈D o(e)→D〉)

The definition of states depends on the application at hands, and theirmeaning is formalised by the oracles Od and Ot

in the examples of the previous slide, states Di are simply sets ofatoms

in our motivating example, states are RDF graphs

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 10 / 16

Page 28: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Interpretations and states

Definition (Interpretation)

An interpretation M is a mapping assigning a set of atoms to everypossible path, with the restrictions (where Di s are states, and ϕ an atom):ϕ ∈ M(〈D〉) if ϕ ∈ Od(D)

{ϕ, o(ϕ)} ⊆ M(〈D1o(ϕ)→D2〉) if ϕ ∈ Ot(D1,D2) ∧ ϕ ∈ POa

o(ϕ) ∈ M(〈D1o(ϕ)→D2〉) if o(ϕ) ∈ Ot(D1,D2) ∧ o(ϕ) ∈ POe

o(e) ∈ M(〈D o(e)→D〉)

The definition of states depends on the application at hands, and theirmeaning is formalised by the oracles Od and Ot

in the examples of the previous slide, states Di are simply sets ofatoms

in our motivating example, states are RDF graphs

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 10 / 16

Page 29: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Oracles for RDF graphs

Definition (RDF data Oracle)

A state is an RDF graph G , i.e., a set of RDF triples of the form (s p o)together with an OWL ontology. The data oracle (Od) is defined suchthat Od(G ) |= (s p o) iff (s p o) ∈ Closure(G ), where Closure(G ) is theclosure of the graph under the ontology.

Definition (RDF transition Oracle)

Let g1 be an RDF graph, i.e., a set of RDF triples of the form (s p o).Ot(D1,D2) |= g1.ins iff both statements are true:

D2 = D1 ∪ {(s p o) : (s p o) ∈ g1} and;Ot(D1,D2) = {g1.ins} ∪ {o((s p o).ins) : (s p o) ∈Closure(D2)\Closure(D1)}

Ot(D1,D2) |= g1.del iff both statements are true:

D2 = D1 ∩ {(s p o) : (s p o) ∈ g1} and;Ot(D1,D2) = {g1.del} ∪ {o((s p o).del) : (s p o) ∈Closure(D1)\Closure(D2)}

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 11 / 16

Page 30: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Oracles for RDF graphs

Definition (RDF data Oracle)

A state is an RDF graph G , i.e., a set of RDF triples of the form (s p o)together with an OWL ontology. The data oracle (Od) is defined suchthat Od(G ) |= (s p o) iff (s p o) ∈ Closure(G ), where Closure(G ) is theclosure of the graph under the ontology.

Definition (RDF transition Oracle)

Let g1 be an RDF graph, i.e., a set of RDF triples of the form (s p o).Ot(D1,D2) |= g1.ins iff both statements are true:

D2 = D1 ∪ {(s p o) : (s p o) ∈ g1} and;Ot(D1,D2) = {g1.ins} ∪ {o((s p o).ins) : (s p o) ∈Closure(D2)\Closure(D1)}

Ot(D1,D2) |= g1.del iff both statements are true:

D2 = D1 ∩ {(s p o) : (s p o) ∈ g1} and;Ot(D1,D2) = {g1.del} ∪ {o((s p o).del) : (s p o) ∈Closure(D1)\Closure(D2)}

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 11 / 16

Page 31: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Oracles for RDF graphs

Definition (RDF data Oracle)

A state is an RDF graph G , i.e., a set of RDF triples of the form (s p o)together with an OWL ontology. The data oracle (Od) is defined suchthat Od(G ) |= (s p o) iff (s p o) ∈ Closure(G ), where Closure(G ) is theclosure of the graph under the ontology.

Definition (RDF transition Oracle)

Let g1 be an RDF graph, i.e., a set of RDF triples of the form (s p o).Ot(D1,D2) |= g1.ins iff both statements are true:

D2 = D1 ∪ {(s p o) : (s p o) ∈ g1} and;Ot(D1,D2) = {g1.ins} ∪ {o((s p o).ins) : (s p o) ∈Closure(D2)\Closure(D1)}

Ot(D1,D2) |= g1.del iff both statements are true:

D2 = D1 ∩ {(s p o) : (s p o) ∈ g1} and;Ot(D1,D2) = {g1.del} ∪ {o((s p o).del) : (s p o) ∈Closure(D1)\Closure(D2)}

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 11 / 16

Page 32: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example in T Rev

Application specific RDF data

ov : vehicle rdf : type owl : Class .ov : motorVehicle rdfs : subClassOf ov : vehicle .ov : lightVehicle rdfs : subClassOf ov : motorVehicle .ov : heavyVehicle rdfs : subClassOf ov : vehicle .ov : sensor rdf : type owl : Class .ov : sensor1 rdf : type ov : sensor .ov : sensor2 rdf : type ov : sensor .

Definition of transactions

processViolation(P, DT, V)← fineCost(V, Cost)⊗ isDriver(P, D)⊗fineIssued(P, D, DT, Cost).ins⊗ notifyFine(P, D, DT, Cost)

notifyFine(P, D, DT, Cost)← hasAddress(D, Addr)⊗sendLetter(D, Addr, P, DT, Cost)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 12 / 16

Page 33: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example in T Rev

Application specific RDF data

ov : vehicle rdf : type owl : Class .ov : motorVehicle rdfs : subClassOf ov : vehicle .ov : lightVehicle rdfs : subClassOf ov : motorVehicle .ov : heavyVehicle rdfs : subClassOf ov : vehicle .ov : sensor rdf : type owl : Class .ov : sensor1 rdf : type ov : sensor .ov : sensor2 rdf : type ov : sensor .

Definition of transactions

processViolation(P, DT, V)← fineCost(V, Cost)⊗ isDriver(P, D)⊗fineIssued(P, D, DT, Cost).ins⊗ notifyFine(P, D, DT, Cost)

notifyFine(P, D, DT, Cost)← hasAddress(D, Addr)⊗sendLetter(D, Addr, P, DT, Cost)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 12 / 16

Page 34: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example in T Rev

Application specific RDF data

ov : vehicle rdf : type owl : Class .ov : motorVehicle rdfs : subClassOf ov : vehicle .ov : lightVehicle rdfs : subClassOf ov : motorVehicle .ov : heavyVehicle rdfs : subClassOf ov : vehicle .ov : sensor rdf : type owl : Class .ov : sensor1 rdf : type ov : sensor .ov : sensor2 rdf : type ov : sensor .

Definition of transactions

processViolation(P, DT, V)← fineCost(V, Cost)⊗ isDriver(P, D)⊗fineIssued(P, D, DT, Cost).ins⊗ notifyFine(P, D, DT, Cost)

notifyFine(P, D, DT, Cost)← hasAddress(D, Addr)⊗sendLetter(D, Addr, P, DT, Cost)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 12 / 16

Page 35: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example in T Rev

Event Detection

o(passingWrongWay(P, DT1))←[o((Obs1 ov:plateRead P).ins)∧ o((Obs1 ov:vehicleDetected motorVehicle).ins)∧ o((Obs1 ov:dateTime DT1).ins) ∧ o((Obs1 ov:readBy sensor2).ins)]⊗[o((Obs2 ov:plateRead P).ins)∧ o((Obs2 ov:vehicleDetected motorVehicle).ins)∧ o((Obs2 ov:dateTime DT2).ins) ∧ o((Obs2 ov:readBy sensor1).ins))]∧ (DT1 < DT2)

Event Response

r(passingWrongWay(P, DT))← processViolation(P, DT, wrongWay)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 13 / 16

Page 36: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example in T Rev

Event Detection

o(passingWrongWay(P, DT1))←[o((Obs1 ov:plateRead P).ins)∧ o((Obs1 ov:vehicleDetected motorVehicle).ins)∧ o((Obs1 ov:dateTime DT1).ins) ∧ o((Obs1 ov:readBy sensor2).ins)]⊗[o((Obs2 ov:plateRead P).ins)∧ o((Obs2 ov:vehicleDetected motorVehicle).ins)∧ o((Obs2 ov:dateTime DT2).ins) ∧ o((Obs2 ov:readBy sensor1).ins))]∧ (DT1 < DT2)

Event Response

r(passingWrongWay(P, DT))← processViolation(P, DT, wrongWay)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 13 / 16

Page 37: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Example in T Rev

Usage

Prove statements of the form:

P,S1– |= (ov:obs1).ins⊗ (ov:obs2).ins . . .

where S1 is the initial RDF graph and obsi are the RDF triples observed ateach moment.

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 14 / 16

Page 38: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Behaviour in a concrete situation

ov : obs1 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213000 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor1 .

ov : obs2 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213516 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor2 .

Since, from the ontology, heavyVehicle v vehicle,o((ov:obs1 ov:vehicleDetected motorVehicle).ins) holds in thesame transition as o((ov:obs1).ins)Similarly o((ov:obs2 ov:vehicleDetected motorVehicle).ins)holds together with o((ov:obs1).ins)So, o(passingWrongWay("01-01-AA", 1426325213000) holds in thesame transition where actions (ov:obs1).ins⊗ (ov:obs2).ins occurThus (ov:obs1).ins⊗ (ov:obs2).ins only success in a path where thedriver of vehicle "01-01-AA" is fined and notified for the infraction ofpassing the road in the wrong way

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 15 / 16

Page 39: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Behaviour in a concrete situation

ov : obs1 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213000 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor1 .

ov : obs2 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213516 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor2 .

Since, from the ontology, heavyVehicle v vehicle,o((ov:obs1 ov:vehicleDetected motorVehicle).ins) holds in thesame transition as o((ov:obs1).ins)

Similarly o((ov:obs2 ov:vehicleDetected motorVehicle).ins)holds together with o((ov:obs1).ins)So, o(passingWrongWay("01-01-AA", 1426325213000) holds in thesame transition where actions (ov:obs1).ins⊗ (ov:obs2).ins occurThus (ov:obs1).ins⊗ (ov:obs2).ins only success in a path where thedriver of vehicle "01-01-AA" is fined and notified for the infraction ofpassing the road in the wrong way

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 15 / 16

Page 40: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Behaviour in a concrete situation

ov : obs1 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213000 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor1 .

ov : obs2 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213516 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor2 .

Since, from the ontology, heavyVehicle v vehicle,o((ov:obs1 ov:vehicleDetected motorVehicle).ins) holds in thesame transition as o((ov:obs1).ins)Similarly o((ov:obs2 ov:vehicleDetected motorVehicle).ins)holds together with o((ov:obs1).ins)

So, o(passingWrongWay("01-01-AA", 1426325213000) holds in thesame transition where actions (ov:obs1).ins⊗ (ov:obs2).ins occurThus (ov:obs1).ins⊗ (ov:obs2).ins only success in a path where thedriver of vehicle "01-01-AA" is fined and notified for the infraction ofpassing the road in the wrong way

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 15 / 16

Page 41: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Behaviour in a concrete situation

ov : obs1 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213000 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor1 .

ov : obs2 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213516 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor2 .

Since, from the ontology, heavyVehicle v vehicle,o((ov:obs1 ov:vehicleDetected motorVehicle).ins) holds in thesame transition as o((ov:obs1).ins)Similarly o((ov:obs2 ov:vehicleDetected motorVehicle).ins)holds together with o((ov:obs1).ins)So, o(passingWrongWay("01-01-AA", 1426325213000) holds in thesame transition where actions (ov:obs1).ins⊗ (ov:obs2).ins occur

Thus (ov:obs1).ins⊗ (ov:obs2).ins only success in a path where thedriver of vehicle "01-01-AA" is fined and notified for the infraction ofpassing the road in the wrong way

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 15 / 16

Page 42: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Behaviour in a concrete situation

ov : obs1 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213000 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor1 .

ov : obs2 rdf : type ov : Observation ;ov : plateRead "01-01-AA" ;ov : dateTime 1426325213516 ;ov : vehicleDetected ov : heavyVehicle ;ov : readBy ov : sensor2 .

Since, from the ontology, heavyVehicle v vehicle,o((ov:obs1 ov:vehicleDetected motorVehicle).ins) holds in thesame transition as o((ov:obs1).ins)Similarly o((ov:obs2 ov:vehicleDetected motorVehicle).ins)holds together with o((ov:obs1).ins)So, o(passingWrongWay("01-01-AA", 1426325213000) holds in thesame transition where actions (ov:obs1).ins⊗ (ov:obs2).ins occurThus (ov:obs1).ins⊗ (ov:obs2).ins only success in a path where thedriver of vehicle "01-01-AA" is fined and notified for the infraction ofpassing the road in the wrong way

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 15 / 16

Page 43: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Conclusions

We proposed a set of oracle instantiations to make T Rev useful fordomains involving sensor networks and Semantic Web technologies

We’ve shown how T Rev can be used to reason about what complexevents occur, and what transactions need to be executed to respondto these events

As in stream reasoning, we can use the domain’s applicationknowledge to reason about what complex events occur

All this is done by a single rule-based language, with a clearly defineddeclarative semantics

The semantics is equipped with correct proof procedures that serve asbasis for implementations (cf. presentation this morning in RR)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 16 / 16

Page 44: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Conclusions

We proposed a set of oracle instantiations to make T Rev useful fordomains involving sensor networks and Semantic Web technologies

We’ve shown how T Rev can be used to reason about what complexevents occur, and what transactions need to be executed to respondto these events

As in stream reasoning, we can use the domain’s applicationknowledge to reason about what complex events occur

All this is done by a single rule-based language, with a clearly defineddeclarative semantics

The semantics is equipped with correct proof procedures that serve asbasis for implementations (cf. presentation this morning in RR)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 16 / 16

Page 45: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Conclusions

We proposed a set of oracle instantiations to make T Rev useful fordomains involving sensor networks and Semantic Web technologies

We’ve shown how T Rev can be used to reason about what complexevents occur, and what transactions need to be executed to respondto these events

As in stream reasoning, we can use the domain’s applicationknowledge to reason about what complex events occur

All this is done by a single rule-based language, with a clearly defineddeclarative semantics

The semantics is equipped with correct proof procedures that serve asbasis for implementations (cf. presentation this morning in RR)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 16 / 16

Page 46: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Conclusions

We proposed a set of oracle instantiations to make T Rev useful fordomains involving sensor networks and Semantic Web technologies

We’ve shown how T Rev can be used to reason about what complexevents occur, and what transactions need to be executed to respondto these events

As in stream reasoning, we can use the domain’s applicationknowledge to reason about what complex events occur

All this is done by a single rule-based language, with a clearly defineddeclarative semantics

The semantics is equipped with correct proof procedures that serve asbasis for implementations (cf. presentation this morning in RR)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 16 / 16

Page 47: RuleML2015:   How to combine event stream reasoning with transactions for the Semantic Web

Conclusions

We proposed a set of oracle instantiations to make T Rev useful fordomains involving sensor networks and Semantic Web technologies

We’ve shown how T Rev can be used to reason about what complexevents occur, and what transactions need to be executed to respondto these events

As in stream reasoning, we can use the domain’s applicationknowledge to reason about what complex events occur

All this is done by a single rule-based language, with a clearly defineddeclarative semantics

The semantics is equipped with correct proof procedures that serve asbasis for implementations (cf. presentation this morning in RR)

Jose Alferes (NOVA LINCS) Combining Streams with Transactions August 5, 2015 16 / 16