in section Abstract

in section Table of Contents

in section Appendices

in section Introduction

in section Document Outline

in section Document Conventions

in section Namespaces

in section Data Descriptions

in section Result Descriptions

in section Making Simple Queries

in section Writing a Simple Query

in section Multiple Matches

in section Matching RDF Literals

in section Matching Integers

in section Matching Arbitrary Datatypes

in section Matching Language Tags

in section Value Constraints

in section Restricting the values of strings

in section Restricting the values of numbers

in section Term Constraints

in section Querying Reification Vocabulary

in section Blank Nodes in Query Results

in section SPARQL Term Syntax

in section RDF Term Syntax

in section Syntax for IRIs

in section Syntax for Literals

in section Syntax for Query Variables

in section Syntax for Blank Nodes

in section Syntax for Triple Patterns

in section Predicate-Object Lists

in section Object Lists

in section RDF Collections

in section rdf:type

in section Initial Definitions

in section RDF Terms

let I be the set of all IRIs.

let RDF-L be the set of all
RDF Literals

let RDF-B be the set of all
blank nodes in RDF graphs

The set of RDF Terms, RDF-T, is I union RDF-L union RDF-B.

in section Query Variables

A query variable is a member of the set V where V is infinite and disjoint from RDF-T.

in section Triple Patterns

A triple pattern is member
of the set:

(RDF-T union V) x (I union V) x (RDF-T union V)

in section Graph Pattern

A SPARQL query is a tuple (GP, DS, SM, R) where:

- GP is a graph pattern
- DS is an RDF Dataset
- SM is a set of solution modifiers
- R is a result form

The graph pattern of a query is called the query pattern.

in section Pattern Solutions

A variable substitution is a substitution function from a subset of V, the set of variables, to the set of RDF terms, RDF-T.

A pattern solution, S, is a variable substitution whose domain includes all the variables in V and whose range is a subset of the set of RDF terms.

The result of replacing every member v of V in a graph pattern P by S(v) is written S(P).

If v is not in the domain of S then S(v) is defined to be v.

in section Value Constraints

**Definition:** Value Constraint

A value constraint is a boolean-valued expression of variables and RDF Terms.

For value constraint C, a solution S matches C if S(C) is true, where S(C) is the boolean-valued expression obtained by substitution of the variables mentioned in C.

in section Basic Graph Patterns

An E-entailment regime is a binary relation between subsets of RDF graphs.

A graph in the range of an E-entailment is called well-formed for the E-entailment.

Two basic graph patterns are equivalent if there is a bijection M between the terms of the triple patterns that maps blank nodes to blank nodes and maps variables, literals and IRIs to themselves, such that a triple ( s, p, o ) is in the first pattern if and only if the triple ( M(s), M(p) M(o) ) is in the second.

in section General Framework

The Scoping Graph G' for RDF graph G, is an RDF Graph that is graph-equivalent to G

Given an entailment regime E, a basic graph pattern BGP, and RDF graph G, with scoping graph G', then BGP E-matches with pattern solution S on graph G with respect to scoping set B if:

- BGP' is a basic graph pattern that is graph-equivalent to BGP
- G' and BGP' do not share any blank node labels.
- (G' union S(BGP')) is a well-formed RDF graph for E-entailment
- G E-entails (G' union S(BGP'))
- The RDF terms introduced by S all occur in B.

in section SPARQL Basic Graph Pattern Matching

in section Example of Basic Graph Pattern Matching

in section Basic Graph Patterns in the SPARQL Syntax

in section Graph Patterns

in section Group Graph Patterns

**Definition:** Group Graph Pattern

A group graph pattern GGP is
a set of graph patterns, GP_{i}.

A solution of Group Graph Pattern GGP on graph G is any
solution S such that, for every element GP_{i} of GGP, S
is a solution of GP_{i}.

in section Empty Group Pattern

in section Order of Evaluation

in section Including Optional Values

in section Optional Pattern Matching

in section Constraints in Optional Pattern Matching

in section Multiple Optional Graph Patterns

in section Optional Matching – Formal Definition

An optional graph pattern is a combination of a pair of graph patterns. The second pattern modifies pattern solutions of the first pattern but does not fail matching of the overall optional graph pattern.

If Opt(A, B) is an optional graph pattern, where A and B are graph patterns, then S is a solution of optional graph pattern if S is a pattern solution of A and of B otherwise if S is a solution to A, but not to A and B.

in section Nested Optional Graph Patterns

in section Matching Alternatives

in section Joining Patterns with UNION

in section Union Matching – Formal Definition

**Definition:** Union Graph Pattern

A union graph pattern is a
set of graph patterns GP_{i}.

A union graph pattern matches a graph G with solution S if
there is some GP_{i} such that GP_{i} matches G
with solution S.

in section RDF Dataset

**Definition:** RDF Dataset

An RDF dataset is a set:

{ G, (<u_{1}>, G_{1}),
(<u_{2}>, G_{2}), . . .
(<u_{n}>, G_{n}) }

where G and each G_{i} are graphs, and each
<u_{i}> is an IRI. Each <u_{i}> is
distinct.

G is called the default graph. (<u_{i}>,
G_{i}) are called named graphs.

in section Examples of RDF Datasets

in section Specifying RDF Datasets

in section Specifying the Default Graph

in section Specifying Named Graphs

in section Combining FROM and FROM NAMED

in section Querying the Dataset

If D is a dataset {G, (<u_{1}>,
G_{1}), ... }, and P is a graph pattern then S is a
pattern solution of RDF Dataset Graph Pattern GRAPH(g, P) if
either of:

- g is an IRI where g = <u
_{i}> for some i, and S is pattern solution of P on dataset {G_{i}, (<u_{1}>, G_{1}), ...} - g is a variable, S maps the variable g to
<u
_{j}>, where <u_{j}> is an IRI from a named graph of D, and S is a pattern solution of P on dataset {G_{j}, (<u_{1}>, G_{1}), ...}

in section Accessing Graph Names

in section Restricting by Graph IRI

in section Restricting

in section Named and Default Graphs

in section Query Result Forms

in section Solution Sequences and Result Forms

**Definition:** Solution Sequence

A solution sequence S is a list of solutions.

S = ( S_{0}, S_{1}, . . . ,
S_{n})

**Definition:** Solution Sequence Modifier

A solution sequence modifier is one of:

- Order modifier
- Projection modifier
- Distinct modifier
- Offset modifier
- Limit modifier

If SM is the set of modifiers, and QS is the collection of solutions of a query, we write SM(QS) for the sequence formed by applying SM to the solution sequence formed from QS.

in section ORDER BY

An ordered solution sequence is a solution sequence where the sequence is partially ordered with respect to some ordering condition.

A solution sequence S = ( S_{0}, S_{1}, . .
. , S_{n}) is ordered with respect to an ordering
condition C if, for S_{i}, S_{j}, then i < j
if C orders S_{i} before S_{j}.

in section Projection

**Definition:** Projection

The projection of solution
QS over a set of variables VS is the solution

project(QS, VS) = { (v, QS(v)) | v in VS }

For a solution sequence S = ( S_{0}, S_{1},
. . . , S_{n}) and a finite set of variables VS,

project(S, VS) = ( project(S_{0}, VS), project(S_{1},
VS), . . . , project(S_{n}, VS) )

in section DISTINCT

**Definition:** Distinct Solution Sequence

A Distinct Solution Sequence is a solution sequence in which no two solutions are the same.

Let S_{x} and S_{y} be pattern
solutions

then Sx != Sy if there exists variable v such that S_{x}(v) != S_{y}(v).

Equivalence of RDF terms is defined in Resource Description Framework (RDF): Concepts and Abstract Syntax [CONCEPTS].

@@This text below is a provisional placeholder. Informally, is ":x :p literal1" equivalent to ":x :p literal2" by the e-entailment regime used?

In addition, two literals are the same if they are the same value under the E-entailment regime as used for basic graph pattern matching for the query.

@@end provisional

For a solution sequence S = ( S_{1}, S_{2}, . . . , S_{n}),
then write set(S) for the set of solution sequences in S.

distinct(S) = (S_{i} | S_{i} != S_{j} for all
i != j) and set(distinct(S)) = set(S)

in section OFFSET

An Offset Solution Sequence with respect to another solution sequence S, is one which starts at a given index of S.

For solution sequence S = (S_{0}, S_{1}, . .
. , S_{n}), the offset solution sequence

offset(S, k), k >= 0 is

(S_{k}, S_{k+1}, . . ., S_{n}) if n
>= k

(), the empty sequence, if k > n

in section LIMIT

**Definition:** Limited Solution Sequence

A Limited Solution Sequence has at most a given, fixed number of members.

The limit of solution sequence S = (S_{0},
S_{1}, . . . , S_{n}) is

limit(S, m) =

(S_{0}, S_{1}, . . . , S_{m-1}) if n
> m

(S_{0}, S_{1}, . . . , S_{n}) if n
<= m-1

in section Selecting Variables

**Definition:** SELECT

Given Q = (GP, DS, SM, SELECT VS) where

- GP is a graph pattern
- DS is an RDF Dataset
- SM is a set of solution modifiers
- VS is a set of variables

then, if QS is the set of solutions formed by matching dataset DS with graph pattern GP, the SELECT result is project(SM(QS), VS)

in section Constructing an Output Graph

in section Templates with Blank Nodes

in section Accessing Graphs in the RDF Dataset

**Definition:** Graph Template

A graph template is a set of triple patterns.

If T = { t_{j} | j = 1,2 ... m } is a graph template
and S is a pattern solution then SC(S, t_{j}) is a set
of one RDF triple S(t_{j}) if all variables in
t_{j} are in the domain of S. SC(S, t_{j}) is
the empty set otherwise.

Write SC(S, T) for the union of SC(S, t_{j}).

**Definition:** CONSTRUCT

Let Q = (GP, DS, SM, CONSTRUCT T) where

- GP is a graph pattern
- DS is an RDF Dataset
- SM is a set of solution modifiers
- T is a set of triple patterns

then, if QS is the set of solutions formed by matching
dataset DS with graph pattern GP, then write SM(QS) = {
S_{i} | i = 1,2 ... n }.

Let T_{i} be a sequence of sets of triple patterns,
such that each T_{i} is basic graph pattern equivalent
to T and no T_{i} have a blank node in common and no
T_{i} has a blank node in common with any blank node in
SM(QS).

Let R_{i} be the RDF graph formed from
SC(S_{i,} T_{i}).

The CONSTRUCT result is the
RDF graph formed by the union of R_{i}.

in section Solution Modifiers and CONSTRUCT

in section Descriptions of Resources

in section Explicit IRIs

in section Identifying Resources

in section Descriptions of Resources

**Definition:** DESCRIBE

Let Q = (GP, DS, SM, DESCRIBE V) where

- GP is a graph pattern
- DS is an RDF Dataset
- SM is a set of solution modifiers
- V is a set of variables VS and IRIs, U

then, if QS is the set of solutions formed by matching
dataset DS with graph pattern GP, the DESCRIBE result is an RDF graph formed by
information relating elements of

distinct(U union project(SM(QS), VS)).

This definition intentionally does not prescribe the nature of the relevant information.

in section Asking "yes or no" questions

**Definition:** ASK

Let Q = (GP, DS, SM, ASK) where

- GP is a graph pattern
- DS is an RDF Dataset
- SM is a set of solution modifiers

and QS is the set of solutions formed by matching dataset DS with graph pattern GP then the ASK result is true if SM(QS) is not empty, otherwise it is false.

in section Testing Values

in section Operand Data Types

in section Filter Evaluation

in section Invocation

in section Effective Boolean Value

in section Operator Mapping

in section Operator Extensibility

in section Operators Definitions

in section bound

in section isIRI

in section isBlank

in section isLiteral

in section str

in section lang

in section datatype

in section logical-or

in section logical-and

in section RDFterm-equal

in section sameTerm

in section langMatches

in section regex

in section Constructor Functions

in section Extensible Value Testing

in section SPARQL Grammar

in section SPARQL Query String

in section Codepoint Escape Sequences

in section White Space

in section Comments

in section IRI References

in section Escape sequences in strings

in section Grammar

in section Conformance

in section Security Considerations

in section Collected Formal Definitions

in section Internet Media Type, File Extension and Macintosh File Type (Normative)

in section References

in section Acknowledgements

in section Change Log

$Revision: 1.3 $ of $Date: 2006/10/05 14:32:30 $

generated from $Id: Overview.html,v 1.10 2006/10/04 21:54:03 eric Exp $

via defns.xsl$Id: defns.xsl,v 1.16 2005/12/13 10:46:29 eric Exp $