LDQL: A Query Language
for the Web of Linked Data
Olaf Hartig¹ and Jorge Pérez²
¹Hasso Plattner Institute, University of Potsdam, Germany
²Department of Computer Science, Universidad de Chile
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 2
Linked Data Query Processing
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 3
Research Question
What language
can we use to express queries
(in a declarative manner)
?
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 4
Existing Proposals 1/2
● Basic Graph Patterns
– Bounded method [Bouquet, Ghidini, Serafini 2009]
– Navigational method [Bouquet, Ghidini, Serafini 2009]
– Direct access method [Bouquet, Ghidini, Serafini 2009]
– Matching-based query semantics [Hartig 2011]
– Family of authoritativeness-based query semantics
[Harth and Speiser 2012]
– Different inference-based query semantics
[Umbrich et al. 2012]
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 5
Existing Proposals 2/2
● SPARQL 1.0
– Full-Web query semantics [Hartig 2012]
– Family of reachability-based semantics [Hartig 2012]
● cALL-semantics, cNONE-semantics, cMATCH-semantics, …
● SPARQL 1.1 Property Paths Patterns
– Context-based query semantics [Hartig and Pirrò 2015]
● NautiLOD [Fionda, Gutierrez, and Pirrò 2012]
● LDPath (no formal semantics) [Schaffert et al. 2012]
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 6
Limitation of Existing Proposals
● No separation of the following two tasks:
– Select query-relevant regions of the Web of Linked Data
– Evaluate pattern over the data in the selected regions
● For instance, impossible to express queries such as:
– Take all Linked Data reached by following
two foaf:knows links starting from URI u,
and evaluate a given SPARQL pattern
over the union of this data.
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 7
General Idea of LDQL
Query
Specification of
query-relevant
region
( N , Q )
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 8
Our Contributions
● Formal syntax and semantics of LDQL
– Including some rewrite rules (i.e., equivalences)
● Study Web safeness of LDQL queries
– Show a decidable syntactic property of LDQL queries
for which a complete execution is feasible in practice
● Compare LDQL with existing proposals
– Show that LDQL is strictly more expressive
? ?
?
? ?
??
?
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 9
Existing Proposals 2/2
● SPARQL 1.0
– Full-Web query semantics [Hartig 2012]
– Family of reachability-based semantics [Hartig 2012]
● cALL-semantics, cNONE-semantics, cMATCH-semantics, …
● SPARQL 1.1 Property Paths Patterns
– Context-based query semantics [Hartig and Pirrò 2015]
● NautiLOD [Fionda, Gutierrez, and Pirrò 2012]
● LDPath (no formal semantics) [Schaffert et al. 2012]
√
√
√ √ √
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 10
Our Contributions
● Formal syntax and semantics of LDQL
– Including some rewrite rules (i.e., equivalences)
● Study Web safeness of LDQL queries
– Show a decidable syntactic property of LDQL queries
for which a complete execution is feasible in practice
● Compare LDQL with existing proposals
– Show that LDQL is strictly more expressive
? ?
?
? ?
??
?
Let's have a brief look!
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 11
General Idea of LDQL
Query
( N , Q )
Specification of
query-relevant
region
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 12
General Idea of LDQL
SPARQL 1.1
graph pattern
Link Path Expression
(Nested regular
expressions over
an alphabet of so
called link patterns)
Query
( N , Q )
Specification of
query-relevant
region
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 13
Link Patterns
● Each βi is either:
– a URI, or
– a wildcard denoted by _, or
– a placeholder for the context URI denoted by +
● β3 may also be a literal
● Example:
( β1, β2, β3 )
( +, foaf:knows, _ )
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 14
Link Graph
( ua, foaf:knows, ub )
( uc, foaf:knows, ua )
doc(ua)
…
doc(ub)
...
doc(uc)
( +, foaf:knows, _ )
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 15
Link Graph
( ua, foaf:knows, ub )
( uc, foaf:knows, ua )
doc(ua)
…
doc(ub)
...
doc(uc)
( +, foaf:knows, _ )
( ua, foaf:knows, ub ), ub ( uc, foaf:knows, ua ), uc( ua, foaf:knows, ub )
( uc, foaf:knows, ua )
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 16
Link Pattern Matching
( ua, foaf:knows, ub )
( uc, foaf:knows, ua )
doc(ua)
…
doc(ub)
...
doc(uc)
( +, foaf:knows, _ )
( ua, foaf:knows, ub ), ub ( uc, foaf:knows, ua ), uc
A link graph edge labeled with RDF triple (x1, x2, x3) and URI u
matches a link pattern (β1, β2, β3) in the context of URI uctx if:
•  i ∈ {1,2,3} such that βi = _ and xi = u, and
•  i ∈ {1,2,3} (i) βi = xi , (ii) βi = _ , or (iii) βi = + and xi = uctx
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 17
Link Pattern Matching
( ua, foaf:knows, ub )
( uc, foaf:knows, ua )
doc(ua)
…
doc(ub)
...
doc(uc)
( +, foaf:knows, _ )
( ua, foaf:knows, ub ), ub ( uc, foaf:knows, ua ), uc
A link graph edge labeled with RDF triple (x1, x2, x3) and URI u
matches a link pattern (β1, β2, β3) in the context of URI uctx if:
•  i ∈ {1,2,3} such that βi = _ and xi = u, and
•  i ∈ {1,2,3} (i) βi = xi , (ii) βi = _ , or (iii) βi = + and xi = uctx
√ X
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 18
(Algebraic) Syntax of LDQL
q := (lpe, P) | (lpe an LPE, P a SPARQL pattern)
(q AND q) |
(q UNION q) |
πV q | (V a set of variables)
(SEED U q) | (U a set of URIs)
(SEED ?v q) (?v a variable)
lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q)
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 19
(Algebraic) Syntax of LDQL
q := (lpe, P) | (lpe an LPE, P a SPARQL pattern)
(q AND q) |
(q UNION q) |
πV q | (V a set of variables)
(SEED U q) | (U a set of URIs)
(SEED ?v q) (?v a variable)
lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q)
Example: Take all Linked Data reached by following two
foaf:knows links starting from URI u, and evaluate
SPARQL pattern P over the union of this data.
( (+,foaf:knows, _) /(+,foaf:knows, _) , P )
with seeds S = {u }
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 20
(Algebraic) Syntax of LDQL
q := (lpe, P) | (lpe an LPE, P a SPARQL pattern)
(q AND q) |
(q UNION q) |
πV q | (V a set of variables)
(SEED U q) | (U a set of URIs)
(SEED ?v q) (?v a variable)
lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q)
Example: Take all Linked Data reached by following two
foaf:knows links starting from URI u, and evaluate
SPARQL pattern P over the union of this data.
( (+,foaf:knows, _) /(+,foaf:knows, _) , P )
with seeds S = {u }
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 21
(Algebraic) Syntax of LDQL
q := (lpe, P) | (lpe an LPE, P a SPARQL pattern)
(q AND q) |
(q UNION q) |
πV q | (V a set of variables)
(SEED U q) | (U a set of URIs)
(SEED ?v q) (?v a variable)
lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q)
Example: Take all Linked Data reached by following two
foaf:knows links starting from URI u, and evaluate
SPARQL pattern P over the union of this data.
( (+,foaf:knows, _) /(+,foaf:knows, _) , P )
with seeds S = {u }
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 22
(Algebraic) Syntax of LDQL
q := (lpe, P) | (lpe an LPE, P a SPARQL pattern)
(q AND q) |
(q UNION q) |
πV q | (V a set of variables)
(SEED U q) | (U a set of URIs)
(SEED ?v q) (?v a variable)
lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q)
For every LDQL query q',
there exists a semantically equivalent LDQL query q''
such that
every LPE in q'' consists only of ε and lpe* and (?v, q).
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 23
(Algebraic) Syntax of LDQL
q := (lpe, P) | (lpe an LPE, P a SPARQL pattern)
(q AND q) |
(q UNION q) |
πV q | (V a set of variables)
(SEED U q) | (U a set of URIs)
(SEED ?v q) (?v a variable)
Example: ( (lpe1 , P1) AND (SEED ?x q2) )
where P1 is: ((?x,p,?y) FILTER (?y > 3))
lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q)
LDQL: A Query Language for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 24
Summary
● Query language for the Web of Linked Data
● Main feature: separation of ...
… navigational components to select
regions of the Web of Linked Data, and
… query patterns to be matched in the
data of the selected regions
● In the paper we study LDQL
– Web-safeness property
– LDQL is strictly more expressive
than the major existing proposals

LDQL: A Query Language for the Web of Linked Data

  • 1.
    LDQL: A QueryLanguage for the Web of Linked Data Olaf Hartig¹ and Jorge Pérez² ¹Hasso Plattner Institute, University of Potsdam, Germany ²Department of Computer Science, Universidad de Chile
  • 2.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 2 Linked Data Query Processing
  • 3.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 3 Research Question What language can we use to express queries (in a declarative manner) ?
  • 4.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 4 Existing Proposals 1/2 ● Basic Graph Patterns – Bounded method [Bouquet, Ghidini, Serafini 2009] – Navigational method [Bouquet, Ghidini, Serafini 2009] – Direct access method [Bouquet, Ghidini, Serafini 2009] – Matching-based query semantics [Hartig 2011] – Family of authoritativeness-based query semantics [Harth and Speiser 2012] – Different inference-based query semantics [Umbrich et al. 2012]
  • 5.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 5 Existing Proposals 2/2 ● SPARQL 1.0 – Full-Web query semantics [Hartig 2012] – Family of reachability-based semantics [Hartig 2012] ● cALL-semantics, cNONE-semantics, cMATCH-semantics, … ● SPARQL 1.1 Property Paths Patterns – Context-based query semantics [Hartig and Pirrò 2015] ● NautiLOD [Fionda, Gutierrez, and Pirrò 2012] ● LDPath (no formal semantics) [Schaffert et al. 2012]
  • 6.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 6 Limitation of Existing Proposals ● No separation of the following two tasks: – Select query-relevant regions of the Web of Linked Data – Evaluate pattern over the data in the selected regions ● For instance, impossible to express queries such as: – Take all Linked Data reached by following two foaf:knows links starting from URI u, and evaluate a given SPARQL pattern over the union of this data.
  • 7.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 7 General Idea of LDQL Query Specification of query-relevant region ( N , Q )
  • 8.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 8 Our Contributions ● Formal syntax and semantics of LDQL – Including some rewrite rules (i.e., equivalences) ● Study Web safeness of LDQL queries – Show a decidable syntactic property of LDQL queries for which a complete execution is feasible in practice ● Compare LDQL with existing proposals – Show that LDQL is strictly more expressive ? ? ? ? ? ?? ?
  • 9.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 9 Existing Proposals 2/2 ● SPARQL 1.0 – Full-Web query semantics [Hartig 2012] – Family of reachability-based semantics [Hartig 2012] ● cALL-semantics, cNONE-semantics, cMATCH-semantics, … ● SPARQL 1.1 Property Paths Patterns – Context-based query semantics [Hartig and Pirrò 2015] ● NautiLOD [Fionda, Gutierrez, and Pirrò 2012] ● LDPath (no formal semantics) [Schaffert et al. 2012] √ √ √ √ √
  • 10.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 10 Our Contributions ● Formal syntax and semantics of LDQL – Including some rewrite rules (i.e., equivalences) ● Study Web safeness of LDQL queries – Show a decidable syntactic property of LDQL queries for which a complete execution is feasible in practice ● Compare LDQL with existing proposals – Show that LDQL is strictly more expressive ? ? ? ? ? ?? ? Let's have a brief look!
  • 11.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 11 General Idea of LDQL Query ( N , Q ) Specification of query-relevant region
  • 12.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 12 General Idea of LDQL SPARQL 1.1 graph pattern Link Path Expression (Nested regular expressions over an alphabet of so called link patterns) Query ( N , Q ) Specification of query-relevant region
  • 13.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 13 Link Patterns ● Each βi is either: – a URI, or – a wildcard denoted by _, or – a placeholder for the context URI denoted by + ● β3 may also be a literal ● Example: ( β1, β2, β3 ) ( +, foaf:knows, _ )
  • 14.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 14 Link Graph ( ua, foaf:knows, ub ) ( uc, foaf:knows, ua ) doc(ua) … doc(ub) ... doc(uc) ( +, foaf:knows, _ )
  • 15.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 15 Link Graph ( ua, foaf:knows, ub ) ( uc, foaf:knows, ua ) doc(ua) … doc(ub) ... doc(uc) ( +, foaf:knows, _ ) ( ua, foaf:knows, ub ), ub ( uc, foaf:knows, ua ), uc( ua, foaf:knows, ub ) ( uc, foaf:knows, ua )
  • 16.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 16 Link Pattern Matching ( ua, foaf:knows, ub ) ( uc, foaf:knows, ua ) doc(ua) … doc(ub) ... doc(uc) ( +, foaf:knows, _ ) ( ua, foaf:knows, ub ), ub ( uc, foaf:knows, ua ), uc A link graph edge labeled with RDF triple (x1, x2, x3) and URI u matches a link pattern (β1, β2, β3) in the context of URI uctx if: •  i ∈ {1,2,3} such that βi = _ and xi = u, and •  i ∈ {1,2,3} (i) βi = xi , (ii) βi = _ , or (iii) βi = + and xi = uctx
  • 17.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 17 Link Pattern Matching ( ua, foaf:knows, ub ) ( uc, foaf:knows, ua ) doc(ua) … doc(ub) ... doc(uc) ( +, foaf:knows, _ ) ( ua, foaf:knows, ub ), ub ( uc, foaf:knows, ua ), uc A link graph edge labeled with RDF triple (x1, x2, x3) and URI u matches a link pattern (β1, β2, β3) in the context of URI uctx if: •  i ∈ {1,2,3} such that βi = _ and xi = u, and •  i ∈ {1,2,3} (i) βi = xi , (ii) βi = _ , or (iii) βi = + and xi = uctx √ X
  • 18.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 18 (Algebraic) Syntax of LDQL q := (lpe, P) | (lpe an LPE, P a SPARQL pattern) (q AND q) | (q UNION q) | πV q | (V a set of variables) (SEED U q) | (U a set of URIs) (SEED ?v q) (?v a variable) lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q)
  • 19.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 19 (Algebraic) Syntax of LDQL q := (lpe, P) | (lpe an LPE, P a SPARQL pattern) (q AND q) | (q UNION q) | πV q | (V a set of variables) (SEED U q) | (U a set of URIs) (SEED ?v q) (?v a variable) lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q) Example: Take all Linked Data reached by following two foaf:knows links starting from URI u, and evaluate SPARQL pattern P over the union of this data. ( (+,foaf:knows, _) /(+,foaf:knows, _) , P ) with seeds S = {u }
  • 20.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 20 (Algebraic) Syntax of LDQL q := (lpe, P) | (lpe an LPE, P a SPARQL pattern) (q AND q) | (q UNION q) | πV q | (V a set of variables) (SEED U q) | (U a set of URIs) (SEED ?v q) (?v a variable) lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q) Example: Take all Linked Data reached by following two foaf:knows links starting from URI u, and evaluate SPARQL pattern P over the union of this data. ( (+,foaf:knows, _) /(+,foaf:knows, _) , P ) with seeds S = {u }
  • 21.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 21 (Algebraic) Syntax of LDQL q := (lpe, P) | (lpe an LPE, P a SPARQL pattern) (q AND q) | (q UNION q) | πV q | (V a set of variables) (SEED U q) | (U a set of URIs) (SEED ?v q) (?v a variable) lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q) Example: Take all Linked Data reached by following two foaf:knows links starting from URI u, and evaluate SPARQL pattern P over the union of this data. ( (+,foaf:knows, _) /(+,foaf:knows, _) , P ) with seeds S = {u }
  • 22.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 22 (Algebraic) Syntax of LDQL q := (lpe, P) | (lpe an LPE, P a SPARQL pattern) (q AND q) | (q UNION q) | πV q | (V a set of variables) (SEED U q) | (U a set of URIs) (SEED ?v q) (?v a variable) lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q) For every LDQL query q', there exists a semantically equivalent LDQL query q'' such that every LPE in q'' consists only of ε and lpe* and (?v, q).
  • 23.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 23 (Algebraic) Syntax of LDQL q := (lpe, P) | (lpe an LPE, P a SPARQL pattern) (q AND q) | (q UNION q) | πV q | (V a set of variables) (SEED U q) | (U a set of URIs) (SEED ?v q) (?v a variable) Example: ( (lpe1 , P1) AND (SEED ?x q2) ) where P1 is: ((?x,p,?y) FILTER (?y > 3)) lpe := ε | lp | lpe/lpe | lpe|lpe | lpe* | [lpe] | (?v, q)
  • 24.
    LDQL: A QueryLanguage for the Web of Linked Data – Olaf Hartig and Jorge Peréz – ISWC 2015 24 Summary ● Query language for the Web of Linked Data ● Main feature: separation of ... … navigational components to select regions of the Web of Linked Data, and … query patterns to be matched in the data of the selected regions ● In the paper we study LDQL – Web-safeness property – LDQL is strictly more expressive than the major existing proposals