a context-based semantics for sparql property paths over the web

24
A Context-Based Semantics for SPARQL Property Paths over the Web Olaf Hartig and Giuseppe Pirrò

Upload: olaf-hartig

Post on 28-Jul-2015

936 views

Category:

Science


0 download

TRANSCRIPT

Page 1: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semanticsfor SPARQL Property Paths

over the Web

Olaf Hartig and Giuseppe Pirrò

Page 2: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 2

Puzzle

Give me the URL of every Web document that mentions its own URL somewhere in its text.

Page 3: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semanticsfor SPARQL Property Paths

over the Web

Olaf Hartig and Giuseppe Pirrò

Disclaimer:

This work is not about reasoning.

Page 4: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 4

Property Path Pattern (PP Pattern)

(α, path, β)

variable, IRI, literal (orbnode), respectively

property path expression

Page 5: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 5

Property Path Expression

(α, path, β)

variable, IRI, literal (orbnode), respectively

path := p | (IRI)

^path | (inverse)

path / path | (concatenation)

(path | path) | (alternative)

(path)* (recursive concatenation)

Page 6: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 6

path := p | (IRI)

^path | (inverse)

path / path | (concatenation)

(path | path) | (alternative)

(path)* (recursive concatenation)

Example

( ex:bob , foaf:knows / (foaf:made | ^foaf:maker) , ?x )

( ex:bob , foaf:knows , ex:alice )( ex:alice , foaf:made , a:doc1 )

( e:objA , foaf:maker , ex:alice )

Data:

μ1 = { ?x → a:doc1 }

μ2 = { ?x → e:objA }

Page 7: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 7

Example

( ex:bob , foaf:knows / (foaf:made | ^foaf:maker) , ?x )

( ex:bob , foaf:knows , ex:alice )( ex:alice , foaf:made , a:doc1 )

( e:objA , foaf:maker , ex:alice )G =

⟦P⟧G = { μ1, μ2 }

P =

μ1 = { ?x → a:doc1 }

μ2 = { ?x → e:objA }

Page 8: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 8

Example

( ex:bob , foaf:knows / (foaf:made | ^foaf:maker) , ?x )

( ex:bob , foaf:knows , ex:alice )( ex:alice , foaf:made , a:doc1 )

( e:objA , foaf:maker , ex:alice )

P =

Page 9: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 9

Example

( ex:bob , foaf:knows / (foaf:made | ^foaf:maker) , ?x )P =

( ex:alice , foaf:made , a:doc1 )

( ex:bob , foaf:knows , ex:alice )

( e:objA , foaf:maker , ex:alice )

Page 10: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 10

Example

( ex:bob , foaf:knows / (foaf:made | ^foaf:maker) , ?x )P =

⟦P⟧W = ??

What is the expected result of executing Pas a query over the Web of Linked Data?

Can this expected result be computed in practice?

Page 11: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 11

Contributions

● Formal definition of a context-based query semantics to use PP patterns (and SPARQL patterns constructed thereof) as queries over Linked Data in a well-defined manner.

● Web-safeness property of such queries (i.e., the fundamental feasibility of executing such a query in practice over the WWW)

● Decidable syntactic property to identify queries that are Web safe

Page 12: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 12

⟦( u1, p, ?x )⟧W =

Context-Based Query Semantics

…( u1, p, u2 )( u1, p, u3 )

...

{ μ1, μ2 } μ1 = { ?x → u2 } μ2 = { ?x → u3 }

Page 13: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 13

⟦( u1, p / q , ?x )⟧W =

Context-Based Query Semantics

…( u1, p, u2 )( u1, p, u3 )

...

{ μ1, μ2 }

μ1 = { ?x → b } μ2 = { ?x → a }

…( u3, q, a )

...

…( u2, q, b )

...

Page 14: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 14

Context-Based Query Semantics

= { μ={ ?x → u } | for every URI u s.t. ( u, p, a ) in ctxt(u) }⟦( ?x, p, a )⟧W

Page 15: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 15

Main Result

Theorem: A PP-based SPARQL pattern P is Web-safe if cbvars( P | Ø ) = vars(P),

...where cbvars( P | X ) denotes the set ofconditionally bounded variables of P for agiven set X of variables (see paper).

● Open problem:

– Note that the condition is sufficient only.

– Is there an alternative condition that is sufficient and also necessary (and decidable)?

Page 16: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 16

Summary

● Formal definition of a context-based query semantics to use PP patterns (and SPARQL patterns constructed thereof) as queries over Linked Data in a well-defined manner.

● Web-safeness property of such queries (i.e., the fundamental feasibility of executing such a query in practice over the WWW)

● Decidable syntactic property to identify queries that are Web safe

Page 17: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 17

Backup Slides

Page 18: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 18

Web-Safeness

A PP-based SPARQL pattern P is Web-safe if there exists an algorithm that, for any Web of Linked Data W = (D, adoc), computes ⟦P⟧W without assuming an a-priori availability of information about the sets D and dom(adoc).

Page 19: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 19

Conditionally Bounded Variables

● cbvars( P | X ) denotes the set of conditionally bounded variables of P for a given set X of variables

● Defined recursively for all types of patterns

– If P is ( P1 AND P2 ) s.t. cbvars( P1 | X ) = vars(P1)and cbvars( P2 | X U sbvars(P1) ) = vars(P2), thencbvars( P | X ) = vars(P).

– If P is (u, p, β), then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x in X, then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x not in X, then cbvars( P | X ) = Ø.

– etc.

Page 20: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 20

Conditionally Bounded Variables

● cbvars( P | X ) denotes the set of conditionally bounded variables of P for a given set X of variables

● Defined recursively for all types of patterns

– If P is ( P1 AND P2 ) s.t. cbvars( P1 | X ) = vars(P1)and cbvars( P2 | X U sbvars(P1) ) = vars(P2), thencbvars( P | X ) = vars(P).

– If P is (u, p, β), then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x in X, then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x not in X, then cbvars( P | X ) = Ø.

– etc.

Pex = ( ( u1, p, ?x ) AND ( ?x, q, ?y ) )

cbvars( Pex | Ø ) = ?

Example

Page 21: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 21

Conditionally Bounded Variables

● cbvars( P | X ) denotes the set of conditionally bounded variables of P for a given set X of variables

● Defined recursively for all types of patterns

– If P is ( P1 AND P2 ) s.t. cbvars( P1 | X ) = vars(P1)and cbvars( P2 | X U sbvars(P1) ) = vars(P2), thencbvars( P | X ) = vars(P).

– If P is (u, p, β), then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x in X, then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x not in X, then cbvars( P | X ) = Ø.

– etc.

Pex = ( ( u1, p, ?x ) AND ( ?x, q, ?y ) )

cbvars( P1 | Ø ) = {?x} cbvars( P2 | Ø ) = Ø

Example

Page 22: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 22

Conditionally Bounded Variables

● cbvars( P | X ) denotes the set of conditionally bounded variables of P for a given set X of variables

● Defined recursively for all types of patterns

– If P is ( P1 AND P2 ) s.t. cbvars( P1 | X ) = vars(P1)and cbvars( P2 | X U sbvars(P1) ) = vars(P2), thencbvars( P | X ) = vars(P).

– If P is (u, p, β), then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x in X, then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x not in X, then cbvars( P | X ) = Ø.

– etc.

Pex = ( ( u1, p, ?x ) AND ( ?x, q, ?y ) )

cbvars( P1 | Ø ) = {?x} cbvars( P2 | sbvars(P1) )

Example

Page 23: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 23

Conditionally Bounded Variables

● cbvars( P | X ) denotes the set of conditionally bounded variables of P for a given set X of variables

● Defined recursively for all types of patterns

– If P is ( P1 AND P2 ) s.t. cbvars( P1 | X ) = vars(P1)and cbvars( P2 | X U sbvars(P1) ) = vars(P2), thencbvars( P | X ) = vars(P).

– If P is (u, p, β), then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x in X, then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x not in X, then cbvars( P | X ) = Ø.

– etc.

Pex = ( ( u1, p, ?x ) AND ( ?x, q, ?y ) )

cbvars( P1 | Ø ) = {?x} cbvars( P2 | {?x} ) = {?x,?y}

Example

Page 24: A Context-Based Semantics for SPARQL Property Paths over the Web

A Context-Based Semantics for SPARQL Property Paths over the Web - Olaf Hartig and Giuseppe Pirrò 24

Conditionally Bounded Variables

● cbvars( P | X ) denotes the set of conditionally bounded variables of P for a given set X of variables

● Defined recursively for all types of patterns

– If P is ( P1 AND P2 ) s.t. cbvars( P1 | X ) = vars(P1)and cbvars( P2 | X U sbvars(P1) ) = vars(P2), thencbvars( P | X ) = vars(P).

– If P is (u, p, β), then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x in X, then cbvars( P | X ) = vars(P).

– If P is (?x, p, β) s.t. ?x not in X, then cbvars( P | X ) = Ø.

– etc.

Pex = ( ( u1, p, ?x ) AND ( ?x, q, ?y ) )

cbvars( Pex | Ø ) = vars(Pex) = {?x,?y}

Example