31
RDF* and SPARQL* An Alternave Approach to Statement-Level Metadata in RDF Olaf Harg @olaarg

RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

RDF* and SPARQL*An Alternative Approach toStatement-Level Metadata in RDF

Olaf Hartig@olafhartig

Page 2: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

2Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF Pict

ure

sour

ce:h

tp:

//ak

ae.b

logs

pot.s

e/20

08/0

8/di

os-m

o-do

c-ha

s-co

nstr

uido

-una

-mqu

ina.

htm

l

Page 3: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

4Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Property Graphs

htp:

//tin

kerp

op.a

pach

e.or

g/do

cs/c

urre

nt/r

efer

ence

/#in

tro

Pict

ure

sour

ce:h

tp:

//ak

ae.b

logs

pot.s

e/20

08/0

8/di

os-m

o-do

c-ha

s-co

nstr

uido

-una

-mqu

ina.

htm

l

Page 4: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

5Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Technically, RDF is beter in many aspects ...

● Formally defined data model● Various well-defined serialization formats● Well-defined query language with a formal semantics● Natural support for globally unique identifiers● Semantics of data can be made explicit in the data itself● W3C recommendations (i.e., standards!)

Page 5: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

6Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

But ...

Technically, RDF is beter in many aspects ...

● Formally defined data model● Various well-defined serialization formats● Well-defined query language with a formal semantics● Natural support for globally unique identifiers● Semantics of data can be made explicit in the data itself● W3C recommendations (i.e., standards!)

?

? ?

??

Pict

ure

sour

ce:h

tp:

//ak

ae.b

logs

pot.s

e/20

08/0

8/di

os-m

o-do

c-ha

s-co

nstr

uido

-una

-mqu

ina.

htm

l

Page 6: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

7Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Not supported natively in the RDF data model

  Welles  name       "Orson Welles" .  Welles  mentioned  Kubrick .  Kubrick  name    "Stanley Kubrick" .  Kubrick  influencedBy  Welles .  ???  significance  0.8 .

Kubrick WellesinfluencedBy

significance = 0.8name = "Stanley Kubrick" name = "Orson Welles"

mentioned

● RDF triples:

Page 7: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

8Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Main Use Case: Statement-Level Metadata

  Welles  name       "Orson Welles" .  Welles  mentioned  Kubrick .  Kubrick  name    "Stanley Kubrick" .  Kubrick  influencedBy  Welles .  ???  significance  0.8 .

Kubrick WellesinfluencedBy

significance = 0.8name = "Stanley Kubrick" name = "Orson Welles"

mentioned

● RDF triples:

● Certainty scores● Weights● Temporal restrictions● Provenance information● etc.

Page 8: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

9Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Standard RDF Reification

  Welles  name       "Orson Welles" .  Welles  mentioned  Kubrick .  Kubrick  name    "Stanley Kubrick" .  Kubrick  influencedBy  Welles .  s    significance  0.8 .  s  rdf:type    rdf:Statement .  s  rdf:subject    Kubrick .  s  rdf:predicate  influencedBy .  s  rdf:object     Welles .

Kubrick WellesinfluencedBy

significance = 0.8name = "Stanley Kubrick" name = "Orson Welles"

mentioned

Page 9: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

10Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Queries?

  

SELECT ?x WHERE {  ?x       influencedBy  Welles .  ?t   significance  ?sig .  ?t rdf:type    rdf:Statement .  ?t rdf:subject    ?x .  ?t rdf:predicate  influencedBy .  ?t rdf:object     Welles .  FILTER ( ?sig > 0.7 )       }

Example 1:

List all people that Welles had a significant influence on.

Page 10: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

11Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Queries?SELECT ?x WHERE {  ?x  influencedBy  Welles .  Welles  influencedBy  ?x .  ?t1  rdf:type    rdf:Statement .  ?t1  rdf:subject    ?x .  ?t1  rdf:predicate  influencedBy .  ?t1  rdf:object     Welles .  ?t1  significance  ?sig1 .  ?t2  rdf:type    rdf:Statement .  ?t2  rdf:subject    Welles .  ?t2  rdf:predicate  influencedBy .  ?t2  rdf:object     ?x .  ?t2  significance  ?sig2 .  FILTER (?sig1 > 0.7 && ?sig2 > 0.7)}

Example 2:

Page 11: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

12Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Other Proposals: Single-Triple Named Graphs

● Example:

– Query:

g1 { Kubrick  influencedBy  Welles }

g1  significance  0.8 .

SELECT ?x WHERE {    GRAPH ?g {      ?x  influencedBy  Welles    }

    ?g  significance  ?sig .    FILTER ( ?sig > 0.7 )}

Page 12: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

13Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Other Proposals: Singleton Properties

● Example:

– Query:

Kubrick  influencedBy  Welles .Kubrick       p1       Welles .p1  singletonPropertyOf influencedBy .p1  significance  0.8 .

SELECT ?x WHERE { ?x  influencedBy  Welles . ?x       ?p       Welles . ?p  singletonPropertyOf influencedBy . ?p  significance  ?sig . FILTER ( ?sig > 0.7 )}

Page 13: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

15Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Our Proposal: Nested Triples

<<Kubrik influencedBy Welles>> significance 0.8

subject predicate object

Kubrick  influencedBy  Welles .s  rdf:type  rdf:Statement .s  rdf:subject    Kubrick .s  rdf:predicate  influencedBy .s  rdf:object     Welles .s  significance  0.8 .

Page 14: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

16Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

… and Nested Triple Paterns

SELECT ?x WHERE {  ?x influencedBy  Welles .  ?t significance  ?sig .  ?t rdf:type  rdf:Statement .  ?t rdf:subject    ?x .  ?t rdf:predicate  influencedBy .  ?t rdf:object     Welles .  FILTER ( ?sig > 0.7 )     }

SELECT ?x WHERE { <<?x influencedBy Welles>> significance ?sig  FILTER (?sig > 0.7)}

Page 15: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

17Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Grouping of Paterns with the Same Subject

SELECT ?x WHERE {  ?x influencedBy  Welles .  ?t significance  ?sig ;     rdf:type  rdf:Statement ;     rdf:subject    ?x ;     rdf:predicate  influencedBy ;     rdf:object     Welles .  FILTER ( ?sig > 0.7 )     }

SELECT ?x ?sig ?src WHERE {  <<?x influencedBy Welles>> significance ?sig ;                             source    ?src . }

● By the standard SPARQL syntax, we may write:

● Hence, we may easily query for multiple metadata triples:

Page 16: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

18Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Extension of the BIND Clause

● Assign matching triples to variables:

SELECT ?x ?sig ?src WHERE {  BIND(<<?x influencedBy Welles>> AS ?t)  ?t  significance ?sig ;      source    ?src .}

SELECT ?x ?sig ?src WHERE {  <<?x influencedBy Welles>> significance ?sig ;                             source    ?src . }

Page 17: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

19Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Extension of the BIND Clause

● Assign matching triples to variables:

● Now, we may even output triples in query results:

SELECT ?x ?sig ?src WHERE {  BIND(<<?x influencedBy Welles>> AS ?t)  ?t  significance ?sig ;      source    ?src .}

SELECT ?t ?c WHERE {  BIND(<<?x influencedBy Welles>> AS ?t)  ?t  certainty  ?c .}

Page 18: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

20Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Example Query 2 RevisitedSELECT ?x WHERE {  ?x  influencedBy  Welles .  Welles  influencedBy  ?x .

  ?t1  rdf:type    rdf:Statement .  ?t1  rdf:subject    ?x .  ?t1  rdf:predicate  influencedBy .  ?t1  rdf:object     Welles .

  ?t1  significance  ?sig1 .

  ?t2  rdf:type    rdf:Statement .  ?t2  rdf:subject    Welles .  ?t2  rdf:predicate  influencedBy .  ?t2  rdf:object     ?x .

  ?t2  significance  ?sig2 .

  FILTER (?sig1 > 0.7 && ?sig2 > 0.7)}

Page 19: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

21Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Example Query 2 RevisitedSELECT ?x WHERE {  ?x  influencedBy  Welles .  Welles  influencedBy  ?x .

  ?t1  rdf:type    rdf:Statement .  ?t1  rdf:subject    ?x .  ?t1  rdf:predicate  influencedBy .  ?t1  rdf:object     Welles .

  ?t1  significance  ?sig1 .

  ?t2  rdf:type    rdf:Statement .  ?t2  rdf:subject    Welles .  ?t2  rdf:predicate  influencedBy .  ?t2  rdf:object     ?x .

  ?t2  significance  ?sig2 .

  FILTER (?sig1 > 0.7 && ?sig2 > 0.7)}

SELECT ?x WHERE { <<?x influencedBy Welles>>  significance  ?sig1 . <<Welles influencedBy ?x>>  significance  ?sig2 .

 FILTER (?sig1 > 0.7 && ?sig2 > 0.7)}

Page 20: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

22Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Two Perspectives on RDF* and SPARQL*

2. A logical model in its own right, with the possibility of a dedicated physical schema– Extension of the

RDF data modeland of SPARQL to capture the notionof nested triples

– Supported by Blazegraph

1. Purely syntactic sugar on top of standard RDF and SPARQL– Can be parsed directly

into standard RDF and SPARQL

– Can be implemented easily by a small wrapper on top of any existing RDF DBMS

Page 21: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

23Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Further Possible Applications of SPARQL*

2. A logical model in its own right, with the possibility of a dedicated physical schema

1. Purely syntactic sugar on top of standard RDF and SPARQL

● Query datasets that use RDF reification(or singleton properties, or single-triple named graphs)– By straightforward translation into ordinary SPARQL queries

● Query Property Graphs including their edge properties – By translation into Gremlin, Cypher, etc.

Page 22: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

24Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Contributions (Perspective 1)

1. Purely syntactic sugar on top of standard RDF and SPARQL

2. A logical model in its own right, with the possibility of a dedicated physical schema

● Definition of desirable properties of RDF*-to-RDF mappings– Information preservation and query result preservation

● Definition of RDF reification related mappings andproof that they possess the desirable properties

Page 23: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

25Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Contributions (Perspective 2)

2. A logical model in its own right, with the possibility of a dedicated physical schema

● Formalization of the RDF* data model – Extends the RDF data model with the notions

of an RDF* triple and an RDF* graph● Definition of syntax and formal semantics of SPARQL*

– Extends the semantics of SPARQL by defining the result of a SPARQL* query Q over an RDF* graph G eval(Q,G) = { m1, m2, …, mn }

1. Purely syntactic sugar on top of standard RDF and SPARQL

Page 24: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

26Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Contributions (Perspective 2), cont’d

2. A logical model in its own right, with the possibility of a dedicated physical schema

1. Purely syntactic sugar on top of standard RDF and SPARQL

● Results regarding redundancy in RDF* graphs– Example:

<<Kubrik influencedBy Welles>> certainty 0.8 .  Kubrik  influencedBy  Welles .

– Query results are equivalent no matter whetherthere is redundancy in an RDF* graph or not

redundant

Page 25: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

27Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Contributions in Detail

2. A logical model in its own right, with the possibility of a dedicated physical schema

1. Purely syntactic sugar on top of standard RDF and SPARQL

● O Hartig: “Foundations of RDF* and SPARQL* - An Alternative Approach to Statement-Level Metadata in RDF.” In Proc. of the11th Alberto Mendelzon International Workshop on Foundations ofData Management (AMW), 2017.

● O Hartig and Bryan Thompson: “Foundations of an Alternative Approach to Reification in RDF.” CoRR abs/1406.3399, 2014– Specifies Turtle*– All relevant extensions of the SPARQL spec

Page 26: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

28Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Hold on!

… is this all theory only???

Page 27: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

29Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Implementations

● Full support in the Blazegraph triple store– “Reification done right” (RDR)

● Turtle* parser (https://github.com/RDFstar/RDFstarTools)

● Ongoing:– Conversion tools

(RDF* ↔ RDF, SPARQL* → SPARQL, RDF* ↔ PGs)

– RDF* store

● Other implementation attempts– Oracle Research, OpenLink (Virtuoso), Franz (AllegroGraph)

have indicated interest in standardizing something along the lines of RDF* & SPARQL*

Page 28: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

30Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

Streaming data?

Page 29: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

31Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

How can RDF*/SPARQL* be appliedin Web stream processing?

● Extension as in the static-data context

● Abstraction to model and formalize triple streams

Page 30: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

32Olaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF

RDF* and SPARQL* in a Nutshell

2. A logical model in its own right, with the possibility of a dedicated physical schema

1. Purely syntactic sugar on top of standard RDF and SPARQL

<<Kubrik influencedBy Welles>> significance 0.8

subject predicate object

SELECT ?x WHERE { <<?x influencedBy Welles>> significance ?sig  FILTER (?sig > 0.7)}

Page 31: RDF* and SPARQL* - Olaf Hartigolafhartig.de/slides/RDFStarInvitedTalkWSP2018.pdfOlaf Hartig – The RDF*/SPARQL* Approach to Statement-Level Metadata in RDF 27 Contributions in Detail

www.liu.se