the expressive power of sparql
play

The Expressive Power of SPARQL Renzo Angles and Claudio Gutierrez - PowerPoint PPT Presentation

The Expressive Power of SPARQL Renzo Angles and Claudio Gutierrez Computer Science Department Universidad de Chile 1 / 3 Motivations Current definition of SPARQL semantics is non-standard and unnecesarily complex 2 / 3


  1. The Expressive Power of SPARQL Renzo Angles and Claudio Gutierrez Computer Science Department Universidad de Chile – 1 / 3

  2. Motivations ◮ Current definition of SPARQL semantics is non-standard and unnecesarily complex – 2 / 3

  3. Motivations ◮ Current definition of SPARQL semantics is non-standard and unnecesarily complex This paper: SPARQL has a simple compositional semantics (except very rare corner cases). – 2 / 3

  4. Motivations ◮ Current definition of SPARQL semantics is non-standard and unnecesarily complex This paper: SPARQL has a simple compositional semantics (except very rare corner cases). ◮ What is the expressive power of SPARQL? For example, how does it compare to SQL? – 2 / 3

  5. Motivations ◮ Current definition of SPARQL semantics is non-standard and unnecesarily complex This paper: SPARQL has a simple compositional semantics (except very rare corner cases). ◮ What is the expressive power of SPARQL? For example, how does it compare to SQL? This paper: SPARQL is equivalent in expressive power to Relational Algebra – 2 / 3

  6. Outline ◮ Overview of current definition of SPARQL semantics – 3 / 3

  7. Outline ◮ Overview of current definition of SPARQL semantics ◮ SPARQL is equivalent to SPARQL-S (a version of SPARQL with safe filters) – 3 / 3

  8. Outline ◮ Overview of current definition of SPARQL semantics ◮ SPARQL is equivalent to SPARQL-S (a version of SPARQL with safe filters) ◮ SPARQL-S is equivalent to SPARQL-C, a version of SPARQL with compositional semantics. – 3 / 3

  9. Outline ◮ Overview of current definition of SPARQL semantics ◮ SPARQL is equivalent to SPARQL-S (a version of SPARQL with safe filters) ◮ SPARQL-S is equivalent to SPARQL-C, a version of SPARQL with compositional semantics. ◮ SPARQL-C is equivalent to Relational Algebra – 3 / 3

  10. Expressive power of SPARQL : Tour SPARQL W3C Syntax and Semantics SPARQL

  11. Expressive power of SPARQL : Tour SPARQL W3C Syntax and Semantics SPARQL-S Only safe-filter patterns SPARQL SPARQL-S

  12. Expressive power of SPARQL : Tour SPARQL W3C Syntax and Semantics SPARQL-S Only safe-filter patterns SPARQL SPARQL-S

  13. Expressive power of SPARQL : Tour SPARQL W3C Syntax and Semantics SPARQL-S Only safe-filter patterns SPARQL-C Compositional Semantics SPARQL SPARQL-S SPARQL-C

  14. Expressive power of SPARQL : Tour SPARQL W3C Syntax and Semantics SPARQL-S Only safe-filter patterns SPARQL-C Compositional Semantics SPARQL SPARQL-S SPARQL-C

  15. Expressive power of SPARQL : Tour SPARQL W3C Syntax and Semantics SPARQL-S Datalog Only safe-filter patterns Non-recursive with negation SPARQL-C Compositional Semantics SPARQL SPARQL-S SPARQL-C DATALOG

  16. Expressive power of SPARQL : Tour SPARQL W3C Syntax and Semantics SPARQL-S Datalog Only safe-filter patterns Non-recursive with negation SPARQL-C Compositional Semantics SPARQL SPARQL-S SPARQL-C DATALOG

  17. Expressive power of SPARQL : Tour SPARQL Relational Algebra W3C Syntax and Semantics SPARQL-S Datalog Only safe-filter patterns Non-recursive with negation SPARQL-C Compositional Semantics SPARQL SPARQL-S SPARQL-C DATALOG SQL

  18. Expressive power of SPARQL : Tour SPARQL Relational Algebra W3C Syntax and Semantics SPARQL-S Datalog Only safe-filter patterns Non-recursive with negation SPARQL-C Compositional Semantics SPARQL SPARQL-S SPARQL-C DATALOG SQL

  19. Expressive power of SPARQL : Tour SPARQL Relational Algebra W3C Syntax and Semantics SPARQL-S Datalog Only safe-filter patterns Non-recursive with negation SPARQL-C Compositional Semantics SPARQL SPARQL-S SPARQL-C DATALOG SQL

  20. Expressive power of SPARQL : Tour SPARQL Relational Algebra W3C Syntax and Semantics SPARQL-S Datalog Only safe-filter patterns Non-recursive with negation SPARQL-C Compositional Semantics SPARQL SPARQL-S SPARQL-C DATALOG SQL

  21. SPARQL Query (General structure) � � � � � � � � TRUE - FALSE ���������� CONSTRUCT DESCRIBE SELECT ASK Dataset FROM ������� ������ FROM NAMED � � � � � � � � � � � � WHERE AND UNION Triple OPTIONAL ������ �������� pattern FILTER GRAPH SPARQL

  22. Syntax of SPARQL graph patterns ?X name “George” Triple pattern (RDF triple + variables) SPARQL

  23. Syntax of SPARQL graph patterns ?X name “George” Triple pattern (RDF triple + variables) { P 1 . P 2 } Join of patterns SPARQL

  24. Syntax of SPARQL graph patterns ?X name “George” Triple pattern (RDF triple + variables) { P 1 . P 2 } Join of patterns { P 1 OPTIONAL { P 2 } } Optional patterns SPARQL

  25. Syntax of SPARQL graph patterns ?X name “George” Triple pattern (RDF triple + variables) { P 1 . P 2 } Join of patterns { P 1 OPTIONAL { P 2 } } Optional patterns { P 1 } UNION { P 2 } Union of patterns SPARQL

  26. Syntax of SPARQL graph patterns ?X name “George” Triple pattern (RDF triple + variables) { P 1 . P 2 } Join of patterns { P 1 OPTIONAL { P 2 } } Optional patterns { P 1 } UNION { P 2 } Union of patterns { P 1 FILTER C } Filter conditions over patterns SPARQL

  27. Syntax of SPARQL graph patterns ?X name “George” ( ?X name “George”) { P 1 . P 2 } ( P 1 AND P 2 ) { P 1 OPTIONAL { P 2 } } ( P 1 OPT P 2 ) { P 1 } UNION { P 2 } ( P 1 UNION P 2 ) { P 1 FILTER C } ( P 1 FILTER C ) Original SPARQL syntax Algebraic Syntax SPARQL SPARQL-C

  28. Example of SPARQL query (SELECT) SELECT ?N, ?A, ?E ?N ?A ?E SPARQL

  29. Example of SPARQL query (FROM) SELECT ?N, ?A, ?E FROM G ?N ?A ?E SPARQL

  30. Example of SPARQL query (Triple pattern) SELECT ?N FROM G WHERE (?X name ?N) ?X ?N person1 “George” person2 “John” person3 “Mark” SPARQL

  31. Example of SPARQL query (AND) SELECT ?N, ?A FROM G WHERE ( (?X name ?N) AND (?X age ?A) ) ?X ?N ?A person1 “George” 20 person2 “John” 26 SPARQL

  32. Example of SPARQL query (FILTER) SELECT ?N, ?A FROM G WHERE ( (?X name ?N) AND ( (?X age ?A) FILTER (?A < 25) ) ) ?X ?N ?A person1 “George” 20 SPARQL

  33. Example of SPARQL query (OPTIONAL) SELECT ?N, ?E FROM G WHERE ( (?X,name,?N) AND ( (?X,age,?A) FILTER (?A < 25) ) ) ( (?X name ?N) OPT (?X email ?E) ) ?X ?N ?A person1 “George” 20 ?X ?N ?E person1 “George” person2 “John” person3 “Mark” “Mark@mark.com” SPARQL

  34. Example of SPARQL query (UNION) SELECT ?N, ?A, ?E FROM G WHERE ( ( (?X name ?N) AND ( (?X age ?A) FILTER (?A < 25) ) ) UNION ( (?X name ?N) OPT (?X email ?E) ) ) ?X ?N ?A ?N ?A ?E person1 “George” 20 “George” 20 UNION “George” ?X ?N ?E “John” “Mark” “Mark@mark.com” person1 “George” person2 “John” person3 “Mark” “Mark@mark.com” SPARQL

  35. W3C Semantics of SPARQL

  36. W3C Semantics of SPARQL

  37. W3C Semantics of SPARQL

  38. W3C Semantics of SPARQL

  39. W3C Semantics of SPARQL

  40. Expressive power of SPARQL : Tour SPARQL W3C Syntax and Semantics SPARQL-S Only safe-filter patterns SPARQL SPARQL-S

  41. Notion of Expressive Power ◮ A query is a function from the set of input data to the set of output data. ◮ The expressive power of a query language is given by the set of queries it can express. – 1 / 4

  42. Notion of Expressive Power ◮ A query is a function from the set of input data to the set of output data. ◮ The expressive power of a query language is given by the set of queries it can express. Definition (Equivalence of languages) Two query languages L 1 and L 2 have the same expressive power if they can express the same queries. – 1 / 4

  43. Notion of Expressive Power ◮ A query is a function from the set of input data to the set of output data. ◮ The expressive power of a query language is given by the set of queries it can express. Definition (Equivalence of languages) Two query languages L 1 and L 2 have the same expressive power if they can express the same queries. (If the languages operate over different data inputs and outputs, have to normalize them before.) – 1 / 4

  44. SPARQL-S: Accepting only Safe Patterns What is the meaning of (P FILTER C) when var( C ) �⊆ var( P ) (non-safe filters)? – 2 / 4

  45. SPARQL-S: Accepting only Safe Patterns What is the meaning of (P FILTER C) when var( C ) �⊆ var( P ) (non-safe filters)? Example Possible meanings of (?X name ?Y) FILTER (?Z > 3) – 2 / 4

  46. SPARQL-S: Accepting only Safe Patterns What is the meaning of (P FILTER C) when var( C ) �⊆ var( P ) (non-safe filters)? Example Possible meanings of (?X name ?Y) FILTER (?Z > 3) 1. Non-defined variable ?Z. (Error, False, empty set) – 2 / 4

  47. SPARQL-S: Accepting only Safe Patterns What is the meaning of (P FILTER C) when var( C ) �⊆ var( P ) (non-safe filters)? Example Possible meanings of (?X name ?Y) FILTER (?Z > 3) 1. Non-defined variable ?Z. (Error, False, empty set) 2. All values of ?X, ?Y, ?Z such that the expression matches. – 2 / 4

Recommend


More recommend