DAWG Testcases

Document Editor
Steve Harris – IAM, University of Southampton
Version:
$Revision: 1.55 $

Abstract. This document lists a selection of queries that have been used in the discussions of the RDF Data Access Working Group.

Last updated 2005-10-06


Source files

This document is automatically built from the manifest files. Relevant files are:

Schema and documentation
Manifests
Source archives

Contents

dawg-triple-pattern-001
Approved

Simple triple match

dawg-triple-pattern-002
Approved

Simple triple match

dawg-triple-pattern-003
Approved

Simple triple match - repeated variable

dawg-triple-pattern-004
Approved

Simple triple match - two triples, common variable

dawg-bound-query-001

BOUND test case.

sparql-query-example-a
Approved

Example from section 2.1

sparql-query-example-b
Approved

Example from section 2.3

sparql-query-example-c
Approved

Example from section 2.4

sparql-query-example-d
Approved

Example from section 2.5

sparql-query-example-e

Example from section 3

sparql-query-example-Testing-Values-0

Example from section 11

sparql-query-example-Testing-Values-1

2nd Example from section 11

sparql-query-example-Testing-Values-RDFterm-equal

Example from section 11.2.3.1

sparql-query-example-Testing-Values-RDFterm-equal-2

2nd Example from section 11.2.3.1

sparql-query-example-Testing-Values-bound

Example from section 11.2.3.2

sparql-query-example-Testing-Values-bound-2

2nd Example from section 11.2.3.2

sparql-query-example-Testing-Values-isURI

Example from section 11.2.3.3

sparql-query-example-Testing-Values-isBlank

Example from section 11.2.3.4

sparql-query-example-Testing-Values-isLiteral

Example from section 11.2.3.5

sparql-query-example-Testing-Values-str

Example from section 11.2.3.6

sparql-query-example-Testing-Values-lang

Example from section 11.2.3.7

OPTIONAL-FILTER
OPTIONAL - Outer FILTER
OPTIONAL - Outer FILTER with BOUND
Test 'boolean effective value' - true
Test 'boolean effective value' - false
Test 'boolean effective value' - &&
Test 'boolean effective value' - ||
Test 'boolean effective value' - optional
Test 'boolean effective value' - unknown types
str-1
str-2
str-3
str-4
isBlank-1
datatype-1
isURI-1
Equality 1-1
Equality 1-2
Equality 1-3
Equality 1-4
Equality 1-5
Equality - 2 var - test equals
Equality - 2 var - test not equals
Equality 1-1 -- graph
Equality 1-2 -- graph
Equality 1-3 -- graph
Equality 1-4 -- graph
Equality 1-5 -- graph
Equality - 2 var - test equals -- graph
normalization-02
Approved

Example 1 from http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096

normalization-03
Approved

Example 2 from http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096

OPTIONAL-AND

OPTIONAL query with local AND constriant

OPTIONAL - Outer AND

OPTIONAL query with global AND constriant

OPTIONAL - Outer AND with BOUND

OPTIONAL query with global AND constriant and BOUND checking

One optional clause

One optional clause

Two optional clauses

One optional clause

dawg-opt-query-001

Optional triples: single optional triple case.

dawg-opt-query-002

Optional triples: multiple triples in one optional clause. Must find a name for each person known.

dawg-opt-query-003

Optional triples: multiple optional clauses.

dawg-opt-query-004

Optional triples: just a single optional clauses.

regex-query-001

Simple unanchored match test

regex-query-002

Case insensitive unanchored match test

regex-query-003

Use/mention test

regex-query-004

str()+URI test

dawg-select-1

SELECT - one variable in query, one in SELECT

dawg-select-2

SELECT - one variable in query, two in SELECT

dawg-select-3

SELECT - two variables in query, one in SELECT

dawg-triple-pattern-001
Approved

Simple triple match

dawg-triple-pattern-002
Approved

Simple triple match

dawg-triple-pattern-003
Approved

Simple triple match - repeated variable

dawg-triple-pattern-004
Approved

Simple triple match - two triples, common variable

sorting-one-of-one-column
NotApproved

only opaque types with identical lexical and datatypes can be tested for =

sort-1
Approved

Alphabetic sort (ascending) on untyped literals

sort-2

Alphabetic sort (descending) on untyped literals

sort-3

Sort on (possibly unbound) URIs

sort-4

Sort on datatyped (integer) literals

sort-5

Sort first on untyped literals (ascending), then on datatyped (integer) literals (descending

sort-6

Sort on mixed result of uris and literals.

sort-7

Sort on comparable mixed typed literals (integer and float)

sort-8

Sort on several mixed values (bnode, uri, literal)

untrusted-graphs-001

Untrusted graphs query example 1

untrusted-graphs-002

Untrusted graphs query example 2

untrusted-graphs-004

Untrusted graphs query example 4

untrusted-graphs-005

Untrusted graphs query example 5

source-query-001

trivial test

source-query-002

2 file test

source-query-003

selecting 1 file from 2 test

source-query-005

check files cant assert things against models

dawg-source-simple-001

Simple triple match on two graphs

dawg-source-simple-002

Triple match using SOURCE

dawg-source-simple-003

Triple match using SOURCE - SELECTed variables

dawg-source-simple-004

Simple triple match - one named container

dawg-source-simple-005

Simple triple match - no named container

survey-1

Return the names of the authors of publication X

survey-2

Return the name and, if known, the e-mail of the author of publication X

survey-3

Return the labels of all topics and (union) the titles of all publications.

survey-8

Return the person who has classified the publication X.

survey-9

Return the first author of Publication X.

survey-10

Return all resources whose namespace starts with http://example.org/survey-sample/.

survey-11

Return the German label of the topic whose English label is 'Database Management'.

survey-12

Return all publications where the page number is the lexical value '08'.

survey-13

Return all publications where the page number is the integer value 8.

syntax-basic-01.rq
Approved
syntax-basic-02.rq
Approved
syntax-basic-03.rq
Approved
syntax-basic-04.rq
Approved
syntax-basic-05.rq
Approved
syntax-basic-06.rq
Approved
syntax-bnodes-01.rq
Approved
syntax-bnodes-02.rq
Approved
syntax-bnodes-03.rq
Approved
syntax-bnodes-04.rq
Approved
syntax-bnodes-05.rq
Approved
syntax-bnodes-06.rq
Approved
syntax-bnodes-07.rq
Approved
syntax-expr-01.rq
Approved
syntax-expr-02.rq
Approved
syntax-expr-03.rq
Approved
syntax-expr-04.rq
Approved
syntax-expr-05.rq
Approved
syntax-expr-06.rq
Approved
syntax-forms-01.rq
Approved
syntax-forms-02.rq
Approved
syntax-limit-offset-07.rq
Approved
syntax-limit-offset-08.rq
Approved
syntax-limit-offset-09.rq
Approved
syntax-lists-01.rq
Approved
syntax-lists-02.rq
Approved
syntax-lists-03.rq
Approved
syntax-lists-04.rq
Approved
syntax-lists-05.rq
Approved
syntax-lit-01.rq
Approved
syntax-lit-02.rq
Approved
syntax-lit-03.rq
Approved
syntax-lit-04.rq
Approved
syntax-lit-05.rq
Approved
syntax-lit-06.rq
Approved
syntax-lit-07.rq
Approved
syntax-lit-08.rq
Approved
syntax-lit-09.rq
Approved
syntax-lit-10.rq
Approved
syntax-lit-11.rq
Approved
syntax-lit-12.rq
Approved
syntax-lit-13.rq
Approved
syntax-lit-14.rq
Approved
syntax-order-01.rq
Approved
syntax-order-02.rq
Approved
syntax-order-03.rq
Approved
syntax-order-04.rq
Approved
syntax-order-05.rq
Approved
syntax-order-06.rq
Approved
syntax-pat-01.rq
Approved
syntax-pat-02.rq
Approved
syntax-pat-03.rq
Approved
syntax-pat-04.rq
Approved
syntax-qname-07.rq
Approved
syntax-qname-08.rq
Approved
syntax-qname-09.rq
Approved
syntax-qname-10.rq
Approved
syntax-qname-11.rq
Approved
syntax-qname-12.rq
Approved
syntax-qname-13.rq
Approved
syntax-qname-14.rq
Approved
syntax-struct-01.rq
Approved
syntax-struct-02.rq
Approved
syntax-struct-03.rq
Approved
syntax-struct-04.rq
Approved
syntax-struct-05.rq
Approved
syntax-struct-06.rq
Approved
syntax-struct-07.rq
Approved
syntax-struct-08.rq
Approved
syntax-struct-09.rq
Approved
syntax-struct-10.rq
Approved
syntax-union-01.rq
Approved
syntax-union-02.rq
Approved
keyword FILTER as a namespace prefix
keyword FILTER as a local name
keyword UNION as a namespace prefix
syntax-001

Syntax: using ? for variables in triple patterns

syntax-002

Syntax: using $ for variables in triple patterns

syntax-003

Syntax: using $ and ? for variables in triple patterns

syntax-004

Syntax: using . in qname of triple pattern

dawg-unsaid-001

Inference test from http://lists.w3.org/Archives/Public/public-rdf-dawg/2004OctDec/0538.html

dawg-unsaid-002

UNSAID test from http://lists.w3.org/Archives/Public/public-rdf-dawg/2004OctDec/0538.html

dawg-unsaid-003

UNSAID test from http://lists.w3.org/Archives/Public/public-rdf-dawg/2004OctDec/0538.html expressed as an ASK

extendedType-eq-pass
Approved

Only extended types with identical lexical and datatypes can be tested for = .

extendedType-ne-fail
Approved

Opaque types can not be tested for != .

extendedType-literal-eq
NotApproved

Test FILTER match on extended type.

extendedType-literal-ne
NotApproved

Test FILTER negative match on extended type.

extendedType-graph
NotApproved

Test graph match on extended type.


dawg-triple-pattern-001

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Simple triple match

Data

data/simple/data-01.n3

@prefix : <http://example.org/data/> . :x :p :v1 . :x :p :v2 .

Query

data/simple/dawg-tp-01.rq
PREFIX : <http://example.org/data/> SELECT * WHERE { :x ?p ?q . }

Results

data/simple/result-tp-01.n3

qp
<http://example.org/data/v1><http://example.org/data/p>
<http://example.org/data/v2><http://example.org/data/p>

dawg-triple-pattern-002

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Simple triple match

Data

data/simple/data-01.n3

@prefix : <http://example.org/data/> . :x :p :v1 . :x :p :v2 .

Query

data/simple/dawg-tp-02.rq
PREFIX : <http://example.org/data/> SELECT * WHERE { ?x :p ?q . }

Results

data/simple/result-tp-02.n3

xq
<http://example.org/data/x><http://example.org/data/v1>
<http://example.org/data/x><http://example.org/data/v2>

dawg-triple-pattern-003

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Simple triple match - repeated variable

Data

data/simple/data-02.n3

@prefix : <http://example.org/data/> . :y :y :x . :x :y :y . :y :x :y .

Query

data/simple/dawg-tp-03.rq
SELECT * WHERE { ?a ?a ?b . }

Results

data/simple/result-tp-03.n3

ba
<http://example.org/data/x><http://example.org/data/y>

dawg-triple-pattern-004

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Simple triple match - two triples, common variable

Data

data/simple/dawg-data-01.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox <mailto:bob@work> ; foaf:mbox <mailto:bob@home> ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; . _:fred rdf:type foaf:Person ; foaf:mbox <fred@edu> .

Query

data/simple/dawg-tp-04.rq
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?x rdf:type foaf:Person . ?x foaf:name ?name . }

Results

data/simple/result-tp-04.n3

name
"Eve"
"Alice"
"Bob"

dawg-bound-query-001

BOUND test case.

Data

data/bound/data.n3

@prefix : <http://example.org/ns#> . :a1 :b :c1 . :c1 :d :e . :a2 :b :c2 . :c2 :b :f .

Query

data/bound/bound1.rq
PREFIX : <http://example.org/ns#> SELECT ?a ?c WHERE { ?a :b ?c . OPTIONAL { ?c :d ?e } . FILTER (! bound(?e)) }

Results

data/bound/bound1-result.n3

ac
<http://example.org/ns#a2><http://example.org/ns#c2>
<http://example.org/ns#c2><http://example.org/ns#f>

sparql-query-example-a

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Example from section 2.1

Data

data/examples/ex2-1a.n3

<http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> "SPARQL Tutorial" .

Query

data/examples/ex2-1a.rq
SELECT ?title WHERE { <http://example.org/book/book1> <http://purl.org/dc/elements/1.1/title> ?title }

Results

data/examples/ex2-1a-result.n3

title
"SPARQL Tutorial"

sparql-query-example-b

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Example from section 2.3

Data

data/examples/ex2-2a.n3

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . rdf:type rdf:type rdf:Property .

Query

data/examples/ex2-2a.rq
SELECT * WHERE { ?x ?x ?v }

Results

data/examples/ex2-2a-result.n3

vx
<http://www.w3.org/1999/02/22-rdf-syntax-ns#Property><http://www.w3.org/1999/02/22-rdf-syntax-ns#type>

sparql-query-example-c

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Example from section 2.4

Data

data/examples/ex2-3a.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name "Johnny Lee Outlaw" . _:a foaf:mbox <mailto:jlow@example.com> .

Query

data/examples/ex2-3a.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?mbox WHERE { ?x foaf:name "Johnny Lee Outlaw" . ?x foaf:mbox ?mbox . }

Results

data/examples/ex2-3a-result.n3

mbox
<mailto:jlow@example.com>

sparql-query-example-d

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Example from section 2.5

Data

data/examples/ex2-4a.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name "Johnny Lee Outlaw" . _:a foaf:mbox <mailto:jlow@example.com> . _:b foaf:name "Peter Goodguy" . _:b foaf:mbox <mailto:peter@example.org> .

Query

data/examples/ex2-4a.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . ?x foaf:mbox ?mbox . }

Results

data/examples/ex2-4a-result.n3

mboxname
<mailto:peter@example.org>"Peter Goodguy"
<mailto:jlow@example.com>"Johnny Lee Outlaw"

sparql-query-example-e

Example from section 3

Data

data/examples/ex3.n3

@prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix : <http://example.org/book/> . @prefix ns: <http://example.org/ns#> . :book1 dc:title "SPARQL Tutorial" . :book1 ns:price 42 . :book2 dc:title "The Semantic Web" . :book2 ns:price 23 .

Query

data/examples/ex3.rq
PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX ns: <http://example.org/ns#> SELECT ?title ?price WHERE { ?x ns:price ?price . FILTER ( ?price < 30 ) . ?x dc:title ?title . }

Results

data/examples/ex3-result.n3

pricetitle
"23""The Semantic Web"

sparql-query-example-Testing-Values-0

Example from section 11

Data

data/examples/ex11_0.n3

@prefix a: <http://www.w3.org/2000/10/annotation-ns#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . _:a a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . _:a dc:created "2004-12-31T18:00:00-05:00" . _:b a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . _:b dc:created "2004-12-31T18:01:00-05:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

Query

data/examples/ex11_0.rq
PREFIX a: <http://www.w3.org/2000/10/annotation-ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?annot WHERE { ?annot a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . ?annot dc:created ?date . FILTER ( ?date < xsd:dateTime("2005-01-01T00:00:00Z") ) }

Results

data/examples/ex11_0-result.n3

annot
<_:a.1e358>

sparql-query-example-Testing-Values-1

2nd Example from section 11

Data

data/examples/ex11_0.n3

@prefix a: <http://www.w3.org/2000/10/annotation-ns#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . _:a a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . _:a dc:created "2004-12-31T18:00:00-05:00" . _:b a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . _:b dc:created "2004-12-31T18:01:00-05:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

Query

data/examples/ex11_1.rq
PREFIX a: <http://www.w3.org/2000/10/annotation-ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?annot WHERE { ?annot a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . ?annot dc:created ?date . FILTER ( xsd:dateTime(?date) < xsd:dateTime("2005-01-01T00:00:00Z") ) }

Results

data/examples/ex11_1-result.n3

annot
<_:b.ce497>
<_:a.ce497>

sparql-query-example-Testing-Values-RDFterm-equal

Example from section 11.2.3.1

Data

data/examples/ex11.2.3.1_0.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:a foaf:name "Alice". _:a foaf:mbox <mailto:alice@work.example> . _:b foaf:name "Ms A.". _:b foaf:mbox <mailto:alice@work.example> .

Query

data/examples/ex11.2.3.1_0.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name1 ?name2 WHERE { ?x foaf:name ?name1 ; foaf:mbox ?mbox1 . ?y foaf:name ?name2 ; foaf:mbox ?mbox2 . FILTER ( ?mbox1 = ?mbox2 && ?name1 != ?name2 ) }

Results

data/examples/ex11.2.3.1_0-result.n3

name2name1
"Alice""Ms A."
"Ms A.""Alice"

sparql-query-example-Testing-Values-RDFterm-equal-2

2nd Example from section 11.2.3.1

Data

data/examples/ex11.2.3.1_1.n3

@prefix a: <http://www.w3.org/2000/10/annotation-ns#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . _:b a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . _:b dc:created "2004-12-31T19:00:00-05:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

Query

data/examples/ex11.2.3.1_1.rq
PREFIX a: <http://www.w3.org/2000/10/annotation-ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?annotates WHERE { ?annot a:annotates ?annotates . ?annot dc:created ?date . FILTER ( ?date = xsd:dateTime("2004-01-01T00:00:00Z") || ?date = xsd:dateTime("2005-01-01T00:00:00Z") ) }

Results

data/examples/ex11.2.3.1_1-result.n3

annotates
<http://www.w3.org/TR/rdf-sparql-query/>

sparql-query-example-Testing-Values-bound

Example from section 11.2.3.2

Data

data/examples/ex11.2.3.2_0.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix xs: <http://www.w3.org/2001/XMLSchema#> . _:a foaf:name "Alice". _:b foaf:givenName "Bob" . _:b dc:created "2005-04-04T04:04:04Z"^^xs:dateTime .

Query

data/examples/ex11.2.3.2_0.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?name ?givenName WHERE { { ?x foaf:name ?name } UNION { ?x foaf:givenName ?givenName; dc:created ?created } . FILTER ( bound(?name) || ?created < "2005-01-01T00:00:00Z" ) }

Results

data/examples/ex11.2.3.2_0-result.n3

givenNamename
"Alice"

sparql-query-example-Testing-Values-bound-2

2nd Example from section 11.2.3.2

Data

data/examples/ex11.2.3.2_0.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix xs: <http://www.w3.org/2001/XMLSchema#> . _:a foaf:name "Alice". _:b foaf:givenName "Bob" . _:b dc:created "2005-04-04T04:04:04Z"^^xs:dateTime .

Query

data/examples/ex11.2.3.2_1.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?name WHERE { ?x foaf:name ?name . OPTIONAL { ?x dc:created ?created } . FILTER ( !bound(?created)) }

Results

data/examples/ex11.2.3.2_1-result.n3

name
"Alice"

sparql-query-example-Testing-Values-isURI

Example from section 11.2.3.3

Data

data/examples/ex11.2.3.3_0.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:a foaf:name "Alice". _:a foaf:mbox <mailto:alice@work.example> . _:b foaf:name "Bob" . _:b foaf:mbox "bob@work.example" .

Query

data/examples/ex11.2.3.3_0.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name ; foaf:mbox ?mbox . FILTER isUri(?mbox) }

Results

data/examples/ex11.2.3.3_0-result.n3

mboxname
<mailto:alice@work.example>"Alice"

sparql-query-example-Testing-Values-isBlank

Example from section 11.2.3.4

Data

data/examples/ex11.2.3.4_0.n3

@prefix a: <http://www.w3.org/2000/10/annotation-ns#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . _:a dc:creator "Alice B. Toeclips" . _:b a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . _:b dc:creator _:c . _:c foaf:given "Bob". _:c foaf:family "Smith".

Query

data/examples/ex11.2.3.4_0.rq
PREFIX a: <http://www.w3.org/2000/10/annotation-ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?given ?family WHERE { ?annot a:annotates <http://www.w3.org/TR/rdf-sparql-query/> . ?annot dc:creator ?c . OPTIONAL { ?c foaf:given ?given ; foaf:family ?family } . FILTER isBlank(?c) }

Results

data/examples/ex11.2.3.4_0-result.n3

familygiven
"Smith""Bob"

sparql-query-example-Testing-Values-isLiteral

Example from section 11.2.3.5

Data

data/examples/ex11.2.3.5_0.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:a foaf:name "Alice". _:a foaf:mbox <mailto:alice@work.example> . _:b foaf:name "Bob" . _:b foaf:mbox "bob@work.example" .

Query

data/examples/ex11.2.3.5_0.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name ; foaf:mbox ?mbox . FILTER isLiteral(?mbox) }

Results

data/examples/ex11.2.3.5_0-result.n3

mboxname
"bob@work.example""Bob"

sparql-query-example-Testing-Values-str

Example from section 11.2.3.6

Data

data/examples/ex11.2.3.6_0.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . _:a foaf:name "Alice". _:a foaf:mbox <mailto:alice@work.example> . _:b foaf:name "Bob" . _:b foaf:mbox <mailto:bob@home.example> .

Query

data/examples/ex11.2.3.6_0.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name ; foaf:mbox ?mbox . FILTER regex(str(?mbox), "@work.example") }

Results

data/examples/ex11.2.3.6_0-result.n3

mboxname
<mailto:alice@work.example>"Alice"

sparql-query-example-Testing-Values-lang

Example from section 11.2.3.7

Data

data/examples/ex11.2.3.7_0.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . _:a foaf:name "Robert"@EN. _:a foaf:name "Roberto"@ES. _:a foaf:mbox <mailto:bob@work.example> .

Query

data/examples/ex11.2.3.7_0.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name ; foaf:mbox ?mbox . FILTER ( lang(?name) = "ES" ) }

Results

data/examples/ex11.2.3.7_0-result.n3

mboxname
<mailto:bob@work.example>"Roberto"

OPTIONAL-FILTER

Data

data/Expr1/data-1.ttl

@prefix x: <http://example.org/ns#> . @prefix : <http://example.org/books#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . :book1 dc:title "TITLE 1" . :book1 x:price 10 . :book2 dc:title "TITLE 2" . :book2 x:price 20 . :book3 dc:title "TITLE 3" .

Query

data/Expr1/expr-1.rq
PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX x: <http://example.org/ns#> SELECT ?title ?price WHERE { ?book dc:title ?title . OPTIONAL { ?book x:price ?price . FILTER (?price < 15) . } . }

Results

data/Expr1/expr-1-result.ttl

pricetitle
"TITLE 3"
"TITLE 2"
"10""TITLE 1"

OPTIONAL - Outer FILTER

Data

data/Expr1/data-1.ttl

@prefix x: <http://example.org/ns#> . @prefix : <http://example.org/books#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . :book1 dc:title "TITLE 1" . :book1 x:price 10 . :book2 dc:title "TITLE 2" . :book2 x:price 20 . :book3 dc:title "TITLE 3" .

Query

data/Expr1/expr-2.rq
PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX x: <http://example.org/ns#> SELECT ?title ?price WHERE { ?book dc:title ?title . OPTIONAL { ?book x:price ?price } . FILTER (?price < 15) . }

Results

data/Expr1/expr-2-result.ttl

pricetitle
"10""TITLE 1"

OPTIONAL - Outer FILTER with BOUND

Data

data/Expr1/data-1.ttl

@prefix x: <http://example.org/ns#> . @prefix : <http://example.org/books#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . :book1 dc:title "TITLE 1" . :book1 x:price 10 . :book2 dc:title "TITLE 2" . :book2 x:price 20 . :book3 dc:title "TITLE 3" .

Query

data/Expr1/expr-3.rq
PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX x: <http://example.org/ns#> SELECT ?title ?price WHERE { ?book dc:title ?title . OPTIONAL { ?book x:price ?price } . FILTER ( ( ! bound(?price) ) || ( ?price < 15 ) ) . }

Results

data/Expr1/expr-3-result.ttl

pricetitle
"10""TITLE 1"
"TITLE 3"

Test 'boolean effective value' - true

Data

data/Expr2/data-1.ttl

@prefix : <http://example.org/ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . # These object values are true by the boolean effective value rule. :x1 :p 1 . :x2 :p "foo" . :x3 :p "0.01"^^xsd:double . :x4 :p "true"^^xsd:boolean . # These are false :y1 :p 0 . :y2 :p "0.0"^^xsd:double . :y3 :p "" . :y4 :p "false"^^xsd:boolean .

Query

data/Expr2/query-bev-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/ns#> SELECT ?a WHERE { ?a :p ?v . FILTER (?v) . }

Results

data/Expr2/result-bev-1.ttl

a
<http://example.org/ns#x2>
<http://example.org/ns#x3>
<http://example.org/ns#x1>
<http://example.org/ns#x4>

Test 'boolean effective value' - false

Data

data/Expr2/data-1.ttl

@prefix : <http://example.org/ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . # These object values are true by the boolean effective value rule. :x1 :p 1 . :x2 :p "foo" . :x3 :p "0.01"^^xsd:double . :x4 :p "true"^^xsd:boolean . # These are false :y1 :p 0 . :y2 :p "0.0"^^xsd:double . :y3 :p "" . :y4 :p "false"^^xsd:boolean .

Query

data/Expr2/query-bev-2.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/ns#> SELECT ?a WHERE { ?a :p ?v . FILTER ( ! ?v ) . }

Results

data/Expr2/result-bev-2.ttl

a
<http://example.org/ns#y1>
<http://example.org/ns#y3>
<http://example.org/ns#y4>
<http://example.org/ns#y2>

Test 'boolean effective value' - &&

Data

data/Expr2/data-1.ttl

@prefix : <http://example.org/ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . # These object values are true by the boolean effective value rule. :x1 :p 1 . :x2 :p "foo" . :x3 :p "0.01"^^xsd:double . :x4 :p "true"^^xsd:boolean . # These are false :y1 :p 0 . :y2 :p "0.0"^^xsd:double . :y3 :p "" . :y4 :p "false"^^xsd:boolean .

Query

data/Expr2/query-bev-3.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/ns#> SELECT ?a WHERE { ?a :p ?v . FILTER ("true"^^xsd:boolean && ?v) . }

Results

data/Expr2/result-bev-3.ttl

a
<http://example.org/ns#x2>
<http://example.org/ns#x3>
<http://example.org/ns#x1>
<http://example.org/ns#x4>

Test 'boolean effective value' - ||

Data

data/Expr2/data-1.ttl

@prefix : <http://example.org/ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . # These object values are true by the boolean effective value rule. :x1 :p 1 . :x2 :p "foo" . :x3 :p "0.01"^^xsd:double . :x4 :p "true"^^xsd:boolean . # These are false :y1 :p 0 . :y2 :p "0.0"^^xsd:double . :y3 :p "" . :y4 :p "false"^^xsd:boolean .

Query

data/Expr2/query-bev-4.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/ns#> SELECT ?a WHERE { ?a :p ?v . FILTER ("false"^^xsd:boolean || ?v) . }

Results

data/Expr2/result-bev-4.ttl

a
<http://example.org/ns#x3>
<http://example.org/ns#x4>
<http://example.org/ns#x2>
<http://example.org/ns#x1>

Test 'boolean effective value' - optional

Data

data/Expr2/data-2.ttl

@prefix : <http://example.org/ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . # These object values are true by the boolean effective value rule. :x1 :p 1 . :x2 :p "foo" . :x3 :p "0.01"^^xsd:double . :x4 :p "true"^^xsd:boolean . # These are false :y1 :p 0 . :y2 :p "0.0"^^xsd:double . :y3 :p "" . :y4 :p "false"^^xsd:boolean . # Optionals :x1 :q "true"^^xsd:boolean . :x2 :q "false"^^xsd:boolean . :x3 :q "foo"^^:unknown .

Query

data/Expr2/query-bev-5.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/ns#> SELECT ?a WHERE { ?a :p ?v . OPTIONAL { ?a :q ?w } . FILTER (?w) . }

Results

data/Expr2/result-bev-5.ttl

a
<http://example.org/ns#x1>

Test 'boolean effective value' - unknown types

Data

data/Expr2/data-2.ttl

@prefix : <http://example.org/ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . # These object values are true by the boolean effective value rule. :x1 :p 1 . :x2 :p "foo" . :x3 :p "0.01"^^xsd:double . :x4 :p "true"^^xsd:boolean . # These are false :y1 :p 0 . :y2 :p "0.0"^^xsd:double . :y3 :p "" . :y4 :p "false"^^xsd:boolean . # Optionals :x1 :q "true"^^xsd:boolean . :x2 :q "false"^^xsd:boolean . :x3 :q "foo"^^:unknown .

Query

data/Expr2/query-bev-6.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/ns#> SELECT ?a ?w WHERE { ?a :p ?v . OPTIONAL { ?a :q ?w } . FILTER ( ! ?w ) . }

Results

data/Expr2/result-bev-6.ttl

aw
<http://example.org/ns#x2>"false"

str-1

Data

data/ExprBuiltins/data-builtin-1.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . :xb :p _:a .

Query

data/ExprBuiltins/q-str-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( str(?v) = "1" ) . }

Results

data/ExprBuiltins/result-str-1.ttl

xv
<http://example.org/things#xp2>"1"
<http://example.org/things#xd3>"1"
<http://example.org/things#xi2>"1"
<http://example.org/things#xi1>"1"

str-2

Data

data/ExprBuiltins/data-builtin-1.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . :xb :p _:a .

Query

data/ExprBuiltins/q-str-2.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( str(?v) = "01" ) . }

Results

data/ExprBuiltins/result-str-2.ttl

vx
"1"<http://example.org/things#xi3>

str-3

Data

data/ExprBuiltins/data-builtin-1.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . :xb :p _:a .

Query

data/ExprBuiltins/q-str-3.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( str(?v) = "zzz" ) . }

Results

data/ExprBuiltins/result-str-3.ttl

vx
"zzz"<http://example.org/things#xp1>
"zzz"<http://example.org/things#xt1>

str-4

Data

data/ExprBuiltins/data-builtin-1.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . :xb :p _:a .

Query

data/ExprBuiltins/q-str-4.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( str(?v) = "" ) . }

Results

data/ExprBuiltins/result-str-4.ttl

vx
<_:genid2.b70d3><http://example.org/things#xb>

isBlank-1

Data

data/ExprBuiltins/data-builtin-1.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . :xb :p _:a .

Query

data/ExprBuiltins/q-blank-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x ?v WHERE { ?x :p ?v . FILTER isBlank(?v) . }

Results

data/ExprBuiltins/result-blank-1.ttl

vx
<_:genid3.7fb4d><http://example.org/things#xb>

datatype-1

Data

data/ExprBuiltins/data-builtin-1.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . :xb :p _:a .

Query

data/ExprBuiltins/q-datatype-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x ?v WHERE { ?x :p ?v . FILTER ( datatype(?v) = xsd:double ) . }

Results

data/ExprBuiltins/result-datatype-1.ttl

xv
<http://example.org/things#xd3>"1"
<http://example.org/things#xd1>"1.0"
<http://example.org/things#xd2>"1.0"

isURI-1

Data

data/ExprBuiltins/data-builtin-1.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . :xb :p _:a .

Query

data/ExprBuiltins/q-uri-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x ?v WHERE { ?x :p ?v . FILTER isURI(?v) . }

Results

data/ExprBuiltins/result-uri-1.ttl

vx
<http://example.org/things#z><http://example.org/things#xu>

Equality 1-1

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = 1 ) . }

Results

data/ExprEquals/result-eq-1.ttl

x
<http://example.org/things#xi2>
<http://example.org/things#xd3>
<http://example.org/things#xd2>
<http://example.org/things#xi3>
<http://example.org/things#xd1>
<http://example.org/things#xi1>

Equality 1-2

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-2.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = 1.0 ) . }

Results

data/ExprEquals/result-eq-2.ttl

x
<http://example.org/things#xd3>
<http://example.org/things#xd2>
<http://example.org/things#xi3>
<http://example.org/things#xi1>
<http://example.org/things#xi2>
<http://example.org/things#xd1>

Equality 1-3

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-3.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = "1" ) . }

Results

data/ExprEquals/result-eq-3.ttl

x
<http://example.org/things#xp2>

Equality 1-4

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-4.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = "zzz" ) . }

Results

data/ExprEquals/result-eq-4.ttl

x
<http://example.org/things#xp1>

Equality 1-5

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-5.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = :z ) . }

Results

data/ExprEquals/result-eq-5.ttl

x
<http://example.org/things#xu>

Equality - 2 var - test equals

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq2-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?v1 ?v2 WHERE { ?x1 :p ?v1 . ?x2 :p ?v2 . FILTER ( ?v1 = ?v2 ) . }

Results

data/ExprEquals/result-eq2-1.ttl

v1v2
"1.0""1"
"1""1.0"
"1.0""1"
"1""1"
"1""1"
"1""1.0"
"1""1"
"1""1"
<http://example.org/things#z><http://example.org/things#z>
"1""1"
"1.0""1.0"
"1""1"
"zzz""zzz"
"1""1.0"
"1""1"
"1.0""1.0"
"1.0""1.0"
"zzz""zzz"
"1""1"
"1.0""1"
"1""1"
"1""1"
"1""1"
"1.0""1.0"
"1.0""1"
"1""1.0"
"1""1.0"
"1.0""1"
"1.0""1"
"1""1"
"1""1"
"1.0""1"
"1""1"
"1""1"
"1""1.0"
"1""1"
"1.0""1"
"1""1.0"
"1""1"
"1""1.0"

Equality - 2 var - test not equals

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq2-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?v1 ?v2 WHERE { ?x1 :p ?v1 . ?x2 :p ?v2 . FILTER ( ?v1 = ?v2 ) . }

Results

data/ExprEquals/result-eq2-1.ttl

v2v1
"1.0""1"
"1""1"
"1.0""1"
"1""1.0"
"1""1"
"1.0""1"
"1""1"
"1""1"
"1""1.0"
"1""1"
"1""1"
"1""1.0"
"1""1.0"
"1.0""1"
"1.0""1"
"1""1.0"
"1.0""1.0"
"1""1"
"1""1"
"1""1"
"1""1.0"
"1""1"
"zzz""zzz"
"1.0""1.0"
"1.0""1.0"
"1""1"
"1.0""1"
"zzz""zzz"
"1""1"
"1.0""1.0"
"1""1"
<http://example.org/things#z><http://example.org/things#z>
"1""1"
"1""1"
"1.0""1"
"1""1"
"1""1"
"1""1.0"
"1.0""1"
"1""1.0"

Equality 1-1 -- graph

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-graph-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p 1 . }

Results

data/ExprEquals/result-eq-graph-1.ttl

x
<http://example.org/things#xi1>
<http://example.org/things#xi2>
<http://example.org/things#xi3>

Equality 1-2 -- graph

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-graph-2.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p 1.0 . }

Results

data/ExprEquals/result-eq-graph-2.ttl

x
<http://example.org/things#xd3>
<http://example.org/things#xd1>
<http://example.org/things#xd2>

Equality 1-3 -- graph

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-graph-3.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = "1" ) . }

Results

data/ExprEquals/result-eq-graph-3.ttl

x
<http://example.org/things#xp2>

Equality 1-4 -- graph

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-graph-4.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p "zzz" . }

Results

data/ExprEquals/result-eq-graph-4.ttl

x
<http://example.org/things#xp1>

Equality 1-5 -- graph

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq-graph-5.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?x WHERE { ?x :p ?v . FILTER ( ?v = :z ) . }

Results

data/ExprEquals/result-eq-graph-5.ttl

x
<http://example.org/things#xu>

Equality - 2 var - test equals -- graph

Data

data/ExprEquals/data-eq.ttl

@prefix : <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . :xi1 :p 1 . :xi2 :p "1"^^xsd:integer . :xi3 :p "01"^^xsd:integer . :xd1 :p 1.0 . :xd2 :p "1.0"^^xsd:double . :xd3 :p "1"^^xsd:double . :xt1 :p "zzz"^^:myType . :xp1 :p "zzz" . :xp2 :p "1" . :xu :p :z . #:xb :p _:a .

Query

data/ExprEquals/query-eq2-1.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX : <http://example.org/things#> SELECT ?v1 ?v2 WHERE { ?x1 :p ?v1 . ?x2 :p ?v2 . FILTER ( ?v1 = ?v2 ) . }

Results

data/ExprEquals/result-eq2-1.ttl

v1v2
"1""1"
"1""1.0"
"1.0""1"
"1""1"
"1""1.0"
"1""1"
"1""1"
"1.0""1"
"1""1"
"1""1"
"1.0""1"
"1.0""1"
"1""1.0"
"1""1.0"
"1.0""1"
"1.0""1.0"
"1""1"
"1""1"
"1""1"
"1.0""1"
"1""1"
"zzz""zzz"
"1.0""1.0"
"1.0""1.0"
"1""1"
"1""1.0"
"zzz""zzz"
"1""1"
"1.0""1.0"
"1""1"
<http://example.org/things#z><http://example.org/things#z>
"1""1"
"1""1"
"1""1.0"
"1""1"
"1""1"
"1.0""1"
"1""1.0"
"1.0""1"
"1""1.0"

normalization-02

Approved by http://www.w3.org/2005/07/26-dawg-minutes

Example 1 from http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096

Data

data/i18n/normalization-02.ttl

# Example 1 from # http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096 # $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ @prefix : <http://example/vocab#>. :s1 :p <example://a/b/c/%7Bfoo%7D#xyz>. :s2 :p <eXAMPLE://a/./b/../b/%63/%7bfoo%7d#xyz>.

Query

data/i18n/normalization-02.rq
# Example 1 from # http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096 # $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ PREFIX : <http://example/vocab#> PREFIX p1: <eXAMPLE://a/./b/../b/%63/%7bfoo%7d#> SELECT ?S WHERE { ?S :p p1:xyz }

Results

data/i18n/normalization-02-results.ttl

S
<http://example/vocab#s2>

normalization-03

Approved by http://www.w3.org/2005/07/26-dawg-minutes

Example 2 from http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096

Data

data/i18n/normalization-03.ttl

# Example 1 from # http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096 # $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ @prefix : <http://example/vocab#>. :s3 :p <http://example.com:80/#abc>. :s4 :p <http://example.com/#abc>. :s5 :p <http://example.com/#abc>.

Query

data/i18n/normalization-03.rq
# Example 2 from # http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0096 # $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ PREFIX : <http://example/vocab#> PREFIX p2: <http://example.com:80/#> SELECT ?S WHERE { ?S :p p2:abc }

Results

data/i18n/normalization-03-results.ttl

S
<http://example/vocab#s3>

OPTIONAL-AND

OPTIONAL query with local AND constriant

Data

data/local-constr/data-1.ttl

@prefix x: <http://example.org/ns#> . @prefix : <http://example.org/books#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . :book1 dc:title "TITLE 1" . :book1 x:price 10 . :book2 dc:title "TITLE 2" . :book2 x:price 20 . :book3 dc:title "TITLE 3" .

Query

data/local-constr/expr-1.rq
PREFIX x: <http://example.org/ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?title ?price WHERE { ?book dc:title ?title . OPTIONAL { ?book x:price ?price . FILTER(?price < 15) } }

Results

data/local-constr/expr-1-result.ttl

pricetitle
"TITLE 2"
"TITLE 3"
"10""TITLE 1"

OPTIONAL - Outer AND

OPTIONAL query with global AND constriant

Data

data/local-constr/data-1.ttl

@prefix x: <http://example.org/ns#> . @prefix : <http://example.org/books#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . :book1 dc:title "TITLE 1" . :book1 x:price 10 . :book2 dc:title "TITLE 2" . :book2 x:price 20 . :book3 dc:title "TITLE 3" .

Query

data/local-constr/expr-2.rq
PREFIX x: <http://example.org/ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?title ?price WHERE { ?book dc:title ?title . OPTIONAL { ?book x:price ?price . } . FILTER(?price < 15) }

Results

data/local-constr/expr-2-result.ttl

pricetitle
"10""TITLE 1"

OPTIONAL - Outer AND with BOUND

OPTIONAL query with global AND constriant and BOUND checking

Data

data/local-constr/data-1.ttl

@prefix x: <http://example.org/ns#> . @prefix : <http://example.org/books#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . :book1 dc:title "TITLE 1" . :book1 x:price 10 . :book2 dc:title "TITLE 2" . :book2 x:price 20 . :book3 dc:title "TITLE 3" .

Query

data/local-constr/expr-3.rq
PREFIX x: <http://example.org/ns#> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?title ?price WHERE { ?book dc:title ?title . OPTIONAL { ?book x:price ?price . } . FILTER(!bound(?price) || (?price < 15)) }

Results

data/local-constr/expr-3-result.ttl

pricetitle
"10""TITLE 1"
"TITLE 3"

One optional clause

One optional clause

Data

data/Optional/data.ttl

@prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:mbox <mailto:alice@example.net> . _:a foaf:name "Alice" . _:a foaf:nick "WhoMe?" . _:b foaf:mbox <mailto:bert@example.net> . _:b foaf:name "Bert" . _:e foaf:mbox <mailto:eve@example.net> . _:e foaf:nick "DuckSoup" .

Query

data/Optional/q-opt-1.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?mbox ?name { ?x foaf:mbox ?mbox . OPTIONAL { ?x foaf:name ?name } . }

Results

data/Optional/result-opt-1.ttl

namembox
"Bert"<mailto:bert@example.net>
<mailto:eve@example.net>
"Alice"<mailto:alice@example.net>

Two optional clauses

One optional clause

Data

data/Optional/data.ttl

@prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:mbox <mailto:alice@example.net> . _:a foaf:name "Alice" . _:a foaf:nick "WhoMe?" . _:b foaf:mbox <mailto:bert@example.net> . _:b foaf:name "Bert" . _:e foaf:mbox <mailto:eve@example.net> . _:e foaf:nick "DuckSoup" .

Query

data/Optional/q-opt-2.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?mbox ?name ?nick { ?x foaf:mbox ?mbox . OPTIONAL { ?x foaf:name ?name } . OPTIONAL { ?x foaf:nick ?nick } . }

Results

data/Optional/result-opt-2.ttl

namenickmbox
"Bert"<mailto:bert@example.net>
"Alice""WhoMe?"<mailto:alice@example.net>
"DuckSoup"<mailto:eve@example.net>

dawg-opt-query-001

Optional triples: single optional triple case.

Data

data/part1/dawg-data-01.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox <mailto:bob@work> ; foaf:mbox <mailto:bob@home> ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; . _:fred rdf:type foaf:Person ; foaf:mbox <mailto:fred@edu> .

Query

data/part1/dawg-query-001.rq
# Get name, and optionally the mbox, of each person PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?person foaf:name ?name . OPTIONAL { ?person foaf:mbox ?mbox} }

Results

data/part1/dawg-result-001.n3

namembox
"Eve"
"Alice"<mailto:alice@work>
"Bob"<mailto:bob@home>
"Bob"<mailto:bob@work>

dawg-opt-query-002

Optional triples: multiple triples in one optional clause. Must find a name for each person known.

Data

data/part1/dawg-data-01.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox <mailto:bob@work> ; foaf:mbox <mailto:bob@home> ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; . _:fred rdf:type foaf:Person ; foaf:mbox <mailto:fred@edu> .

Query

data/part1/dawg-query-002.rq
# Get names of people, together with the names of people they know. PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?name2 WHERE { ?person foaf:name ?name . OPTIONAL { ?person foaf:knows ?p2 . ?p2 foaf:name ?name2 . } }

Results

data/part1/dawg-result-002.n3

namename2
"Eve"
"Alice""Bob"
"Bob""Alice"

dawg-opt-query-003

Optional triples: multiple optional clauses.

Data

data/part1/dawg-data-01.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox <mailto:bob@work> ; foaf:mbox <mailto:bob@home> ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; . _:fred rdf:type foaf:Person ; foaf:mbox <mailto:fred@edu> .

Query

data/part1/dawg-query-003.rq
# Get names and mboxes, each of which may be optional. PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?name ?mbox WHERE { { ?person rdf:type foaf:Person } . OPTIONAL { ?person foaf:name ?name } . OPTIONAL {?person foaf:mbox ?mbox} . }

Results

data/part1/dawg-result-003.n3

namembox
"Bob"<mailto:bob@work>
"Alice"<mailto:alice@work>
"Eve"
<mailto:fred@edu>
"Bob"<mailto:bob@home>

dawg-opt-query-004

Optional triples: just a single optional clauses.

Data

data/part1/dawg-data-01.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox <mailto:bob@work> ; foaf:mbox <mailto:bob@home> ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; . _:fred rdf:type foaf:Person ; foaf:mbox <mailto:fred@edu> .

Query

data/part1/dawg-query-004.rq
# Get optional get the mbox, of each person PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { OPTIONAL { ?person foaf:name ?name } }

Results

data/part1/dawg-result-004.n3

name
"Bob"
"Eve"
"Alice"

regex-query-001

Simple unanchored match test

Data

data/regex/regex-data-01.n3

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://example.com/#> . ex:foo rdf:value "abcDEFghiJKL" , "ABCdefGHIjkl", "0123456789", <http://example.com/uri>, "http://example.com/literal" .

Query

data/regex/regex-query-001.rq
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ex: <http://example.com/#> SELECT ?val WHERE { ex:foo rdf:value ?val . FILTER regex(?val, "GHI") }

Results

data/regex/regex-result-001.n3

val
"ABCdefGHIjkl"

regex-query-002

Case insensitive unanchored match test

Data

data/regex/regex-data-01.n3

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://example.com/#> . ex:foo rdf:value "abcDEFghiJKL" , "ABCdefGHIjkl", "0123456789", <http://example.com/uri>, "http://example.com/literal" .

Query

data/regex/regex-query-002.rq
PREFIX ex: <http://example.com/#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?val WHERE { ex:foo rdf:value ?val . FILTER regex(?val, "DeFghI", "i") }

Results

data/regex/regex-result-002.n3

val
"abcDEFghiJKL"
"ABCdefGHIjkl"

regex-query-003

Use/mention test

Data

data/regex/regex-data-01.n3

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://example.com/#> . ex:foo rdf:value "abcDEFghiJKL" , "ABCdefGHIjkl", "0123456789", <http://example.com/uri>, "http://example.com/literal" .

Query

data/regex/regex-query-003.rq
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ex: <http://example.com/#> SELECT ?val WHERE { ex:foo rdf:value ?val . FILTER regex(?val, "example\\.com") }

Results

data/regex/regex-result-003.n3

val
"http://example.com/literal"

regex-query-004

str()+URI test

Data

data/regex/regex-data-01.n3

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix ex: <http://example.com/#> . ex:foo rdf:value "abcDEFghiJKL" , "ABCdefGHIjkl", "0123456789", <http://example.com/uri>, "http://example.com/literal" .

Query

data/regex/regex-query-004.rq
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX ex: <http://example.com/#> SELECT ?val WHERE { ex:foo rdf:value ?val . FILTER regex(str(?val), "example\\.com") }

Results

data/regex/regex-result-004.n3

val
<http://example.com/uri>
"http://example.com/literal"

dawg-select-1

SELECT - one variable in query, one in SELECT

Data

data/Select/data-1.ttl

@prefix : <http://example.org/> . :x :p 1 . :x :q 2 .

Query

data/Select/q-select-1.rq
PREFIX : <http://example.org/> SELECT ?x { :x :p ?x }

Results

data/Select/results-select-1.ttl

x
"1"

dawg-select-2

SELECT - one variable in query, two in SELECT

Data

data/Select/data-1.ttl

@prefix : <http://example.org/> . :x :p 1 . :x :q 2 .

Query

data/Select/q-select-2.rq
PREFIX : <http://example.org/> SELECT ?x ?y { :x :p ?x }

Results

data/Select/results-select-2.ttl

xy
"1"

dawg-select-3

SELECT - two variables in query, one in SELECT

Data

data/Select/data-1.ttl

@prefix : <http://example.org/> . :x :p 1 . :x :q 2 .

Query

data/Select/q-select-3.rq
PREFIX : <http://example.org/> SELECT ?x { :x :p ?x . :x :q ?y }

Results

data/Select/results-select-3.ttl

x
"1"

dawg-triple-pattern-001

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Simple triple match

Data

data/simple2/data-01.n3

@prefix : <http://example.org/data/> . :x :p :v1 . :x :p :v2 .

Query

data/simple2/dawg-tp-01.rq
PREFIX : <http://example.org/data/> SELECT * WHERE ( :x ?p ?q )

Results

data/simple2/result-tp-01.n3

pq
<http://example.org/data/p><http://example.org/data/v2>
<http://example.org/data/p><http://example.org/data/v1>

dawg-triple-pattern-002

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Simple triple match

Data

data/simple2/data-01.n3

@prefix : <http://example.org/data/> . :x :p :v1 . :x :p :v2 .

Query

data/simple2/dawg-tp-02.rq
PREFIX : <http://example.org/data/> SELECT * WHERE ( ?x :p ?q )

Results

data/simple2/result-tp-02.n3

xq
<http://example.org/data/x><http://example.org/data/v1>
<http://example.org/data/x><http://example.org/data/v2>

dawg-triple-pattern-003

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Simple triple match - repeated variable

Data

data/simple2/data-02.n3

@prefix : <http://example.org/data/> . :y :y :x . :x :y :y . :y :x :y .

Query

data/simple2/dawg-tp-03.rq
SELECT * WHERE ( ?a ?a ?b )

Results

data/simple2/result-tp-03.n3

ba
<http://example.org/data/x><http://example.org/data/y>

dawg-triple-pattern-004

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JanMar/0358

Simple triple match - two triples, common variable

Data

data/simple2/dawg-data-01.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox <mailto:bob@work> ; foaf:mbox <mailto:bob@home> ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; . _:fred rdf:type foaf:Person ; foaf:mbox <fred@edu> .

Query

data/simple2/dawg-tp-04.rq
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE ( ?x rdf:type foaf:Person) ( ?x foaf:name ?name )

Results

data/simple2/result-tp-04.n3

name
"Eve"
"Alice"
"Bob"

sorting-one-of-one-column

NotApproved

only opaque types with identical lexical and datatypes can be tested for =

Data

data/Sorting/sort-0.n3

# $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ # Generated by <http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/genSort> $Revision: 1.55 $ @prefix r: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix srt: <http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#> . @prefix air: <http://www.daml.org/2001/10/html/airport-ont#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . srt:minus_two srt:str1 "str -2" ; srt:str2 "-2" ; srt:int1 "-2"^^xsd:integer ; srt:bNode1 _:m2 ; srt:bNode2 _:minus_two ; srt:uri1 srt:m2 ; srt:uri2 srt:minus_two . srt:minus_one srt:str1 "str -1" ; srt:str2 "-1" ; srt:int1 "-1"^^xsd:integer ; srt:bNode1 _:m1 ; srt:bNode2 _:minus_one ; srt:uri1 srt:m1 ; srt:uri2 srt:minus_one ; srt:het1 _:minus_one . srt:zero srt:str1 "str 0" ; srt:str2 "0" ; srt:int1 "0"^^xsd:integer ; srt:bNode1 _:p0 ; srt:bNode2 _:zero ; srt:uri1 srt:p0 ; srt:uri2 srt:zero ; srt:het1 srt:hp0 . srt:one srt:str1 "str 1" ; srt:str2 "1" ; srt:int1 "1"^^xsd:integer ; srt:bNode1 _:p1 ; srt:bNode2 _:one ; srt:uri1 srt:p1 ; srt:uri2 srt:one ; srt:het1 "1" . srt:oneB srt:str1 "str 1" ; srt:str2 "1" ; srt:int1 "1"^^xsd:integer ; srt:bNode1 _:p1 ; srt:bNode2 _:oneB ; srt:uri1 srt:p1 ; srt:uri2 srt:one ; srt:het1 "1"@EN . srt:oneC srt:str1 "str 1" ; srt:str2 "1" ; srt:int1 "1"^^xsd:integer ; srt:bNode1 _:p1 ; srt:bNode2 _:oneC ; srt:uri1 srt:p1 ; srt:uri2 srt:one ; srt:het1 "1"^^xsd:string . srt:two srt:str1 "str 2" ; srt:str2 "2" ; srt:int1 "2"^^xsd:integer ; srt:bNode1 _:p2 ; srt:bNode2 _:two ; srt:uri1 srt:p2 ; srt:uri2 srt:two ; srt:het1 "2"^^xsd:integer . srt:three srt:str1 "str 3" ; srt:str2 "3" ; srt:int1 "3"^^xsd:integer ; srt:bNode1 _:p3 ; srt:bNode2 _:three ; srt:uri1 srt:p3 ; srt:uri2 srt:three ; srt:het1 "3"^^xsd:float . srt:four srt:str1 "str 4" ; srt:str2 "4" ; srt:int1 "4"^^xsd:integer ; srt:bNode1 _:p4 ; srt:bNode2 _:four ; srt:uri1 srt:p4 ; srt:uri2 srt:four . srt:five srt:str1 "str 5" ; srt:str2 "5" ; srt:int1 "5"^^xsd:integer ; srt:bNode1 _:p5 ; srt:bNode2 _:five ; srt:uri1 srt:p5 ; srt:uri2 srt:five ; srt:het1 _:five . srt:six srt:str1 "str 6" ; srt:str2 "6" ; srt:int1 "6"^^xsd:integer ; srt:bNode1 _:p6 ; srt:bNode2 _:six ; srt:uri1 srt:p6 ; srt:uri2 srt:six ; srt:het1 srt:hp6 . srt:seven srt:str1 "str 7" ; srt:str2 "7" ; srt:int1 "7"^^xsd:integer ; srt:bNode1 _:p7 ; srt:bNode2 _:seven ; srt:uri1 srt:p7 ; srt:uri2 srt:seven ; srt:het1 "7" . srt:eight srt:str1 "str 8" ; srt:str2 "8" ; srt:int1 "8"^^xsd:integer ; srt:bNode1 _:p8 ; srt:bNode2 _:eight ; srt:uri1 srt:p8 ; srt:uri2 srt:eight ; srt:het1 "8"@EN . srt:eightB srt:str1 "str 8" ; srt:str2 "8" ; srt:int1 "8"^^xsd:integer ; srt:bNode1 _:p8 ; srt:bNode2 _:eightB ; srt:uri1 srt:p8 ; srt:uri2 srt:eight ; srt:het1 "8"^^xsd:string . srt:nine srt:str1 "str 9" ; srt:str2 "9" ; srt:int1 "9"^^xsd:integer ; srt:bNode1 _:p9 ; srt:bNode2 _:nine ; srt:uri1 srt:p9 ; srt:uri2 srt:nine ; srt:het1 "9"^^xsd:integer . srt:ten srt:str1 "str 10" ; srt:str2 "10" ; srt:int1 "10"^^xsd:integer ; srt:bNode1 _:p10 ; srt:bNode2 _:ten ; srt:uri1 srt:p10 ; srt:uri2 srt:ten ; srt:het1 "10"^^xsd:float . srt:eleven srt:str1 "str 11" ; srt:str2 "11" ; srt:int1 "11"^^xsd:integer ; srt:bNode1 _:p11 ; srt:bNode2 _:eleven ; srt:uri1 srt:p11 ; srt:uri2 srt:eleven . srt:twelve srt:str1 "str 12" ; srt:str2 "12" ; srt:int1 "12"^^xsd:integer ; srt:bNode1 _:p12 ; srt:bNode2 _:twelve ; srt:uri1 srt:p12 ; srt:uri2 srt:twelve ; srt:het1 _:twelve . srt:thirteen srt:str1 "str 13" ; srt:str2 "13" ; srt:int1 "13"^^xsd:integer ; srt:bNode1 _:p13 ; srt:bNode2 _:thirteen ; srt:uri1 srt:p13 ; srt:uri2 srt:thirteen ; srt:het1 srt:hp13 . srt:fourteen srt:str1 "str 14" ; srt:str2 "14" ; srt:int1 "14"^^xsd:integer ; srt:bNode1 _:p14 ; srt:bNode2 _:fourteen ; srt:uri1 srt:p14 ; srt:uri2 srt:fourteen ; srt:het1 "14" . srt:fifteen srt:str1 "str 15" ; srt:str2 "15" ; srt:int1 "15"^^xsd:integer ; srt:bNode1 _:p15 ; srt:bNode2 _:fifteen ; srt:uri1 srt:p15 ; srt:uri2 srt:fifteen ; srt:het1 "15"@EN . srt:fifteenB srt:str1 "str 15" ; srt:str2 "15" ; srt:int1 "15"^^xsd:integer ; srt:bNode1 _:p15 ; srt:bNode2 _:fifteenB ; srt:uri1 srt:p15 ; srt:uri2 srt:fifteen ; srt:het1 "15"^^xsd:string . srt:fifteenC srt:str1 "str 15" ; srt:str2 "15" ; srt:int1 "15"^^xsd:integer ; srt:bNode1 _:p15 ; srt:bNode2 _:fifteenC ; srt:uri1 srt:p15 ; srt:uri2 srt:fifteen ; srt:het1 "15"^^xsd:integer . srt:sixteen srt:str1 "str 16" ; srt:str2 "16" ; srt:int1 "16"^^xsd:integer ; srt:bNode1 _:p16 ; srt:bNode2 _:sixteen ; srt:uri1 srt:p16 ; srt:uri2 srt:sixteen ; srt:het1 "16"^^xsd:float . srt:seventeen srt:str1 "str 17" ; srt:str2 "17" ; srt:int1 "17"^^xsd:integer ; srt:bNode1 _:p17 ; srt:bNode2 _:seventeen ; srt:uri1 srt:p17 ; srt:uri2 srt:seventeen . srt:eighteen srt:str1 "str 18" ; srt:str2 "18" ; srt:int1 "18"^^xsd:integer ; srt:bNode1 _:p18 ; srt:bNode2 _:eighteen ; srt:uri1 srt:p18 ; srt:uri2 srt:eighteen ; srt:het1 _:eighteen . srt:nineteen srt:str1 "str 19" ; srt:str2 "19" ; srt:int1 "19"^^xsd:integer ; srt:bNode1 _:p19 ; srt:bNode2 _:nineteen ; srt:uri1 srt:p19 ; srt:uri2 srt:nineteen ; srt:het1 srt:hp19 . srt:twenty srt:str1 "str 20" ; srt:str2 "20" ; srt:int1 "20"^^xsd:integer ; srt:bNode1 _:p20 ; srt:bNode2 _:twenty ; srt:uri1 srt:p20 ; srt:uri2 srt:twenty ; srt:het1 "20" . srt:twenty_one srt:str1 "str 21" ; srt:str2 "21" ; srt:int1 "21"^^xsd:integer ; srt:bNode1 _:p21 ; srt:bNode2 _:twenty_one ; srt:uri1 srt:p21 ; srt:uri2 srt:twenty_one ; srt:het1 "21"@EN . srt:twenty_two srt:str1 "str 22" ; srt:str2 "22" ; srt:int1 "22"^^xsd:integer ; srt:bNode1 _:p22 ; srt:bNode2 _:twenty_two ; srt:uri1 srt:p22 ; srt:uri2 srt:twenty_two ; srt:het1 "22"^^xsd:string . srt:twenty_twoB srt:str1 "str 22" ; srt:str2 "22" ; srt:int1 "22"^^xsd:integer ; srt:bNode1 _:p22 ; srt:bNode2 _:twenty_twoB ; srt:uri1 srt:p22 ; srt:uri2 srt:twenty_two ; srt:het1 "22"^^xsd:integer . srt:twenty_three srt:str1 "str 23" ; srt:str2 "23" ; srt:int1 "23"^^xsd:integer ; srt:bNode1 _:p23 ; srt:bNode2 _:twenty_three ; srt:uri1 srt:p23 ; srt:uri2 srt:twenty_three ; srt:het1 "23"^^xsd:float .

Query

data/Sorting/one-of-one-column.rq
PREFIX srt: <http://www.w3.org/2001/sw/DataAccess/tests/data/Sorting/sort-0#> SELECT ?str1 WHERE {?s srt:str1 ?str1} ORDER BY ASC [?str1]

Results

data/Sorting/one-of-one-column-result.n3

str1
"str 14"
"str 13"
"str 12"
"str 11"
"str 10"
"str 1"
"str 0"
"str -2"
"str -1"
"str 15"
"str 16"
"str 17"
"str 18"
"str 19"
"str 2"
"str 20"
"str 21"
"str 22"
"str 23"
"str 3"
"str 4"
"str 5"
"str 6"
"str 7"
"str 8"
"str 9"

sort-1

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0248.html

Alphabetic sort (ascending) on untyped literals

Data

data/sort/data-sort-1.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name "Eve". _:b foaf:name "Alice" . _:c foaf:name "Fred" . _:e foaf:name "Bob" .

Query

data/sort/query-sort-1.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?x foaf:name ?name } ORDER BY ?name

Results

data/sort/result-sort-1.rdf

name
"Fred"
"Eve"
"Bob"
"Alice"

sort-2

Alphabetic sort (descending) on untyped literals

Data

data/sort/data-sort-1.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name "Eve". _:b foaf:name "Alice" . _:c foaf:name "Fred" . _:e foaf:name "Bob" .

Query

data/sort/query-sort-2.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name WHERE { ?x foaf:name ?name } ORDER BY DESC(?name)

Results

data/sort/result-sort-2.rdf

name
"Alice"
"Bob"
"Eve"
"Fred"

sort-3

Sort on (possibly unbound) URIs

Data

data/sort/data-sort-3.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a rdf:type foaf:Person ; foaf:name "Eve" ; foaf:mbox <mailto:eve@work.example> . _:b rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work.example> . _:c rdf:type foaf:Person ; foaf:mbox <mailto:fred@work.example> ; foaf:name "Fred" . _:e foaf:name "Bob" .

Query

data/sort/query-sort-3.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . OPTIONAL { ?x foaf:mbox ?mbox } } ORDER BY ASC(?mbox)

Results

data/sort/result-sort-3.rdf

mboxname
<mailto:fred@work.example>"Fred"
<mailto:eve@work.example>"Eve"
<mailto:alice@work.example>"Alice"
"Bob"

sort-4

Sort on datatyped (integer) literals

Data

data/sort/data-sort-4.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix ex: <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:a rdf:type foaf:Person ; foaf:name "Eve" ; ex:empId "9"^^xsd:integer . _:b rdf:type foaf:Person ; foaf:name "Alice" ; ex:empId "29"^^xsd:integer . _:c rdf:type foaf:Person ; foaf:name "Fred" ; ex:empId "27"^^xsd:integer . _:e foaf:name "Bob" ; ex:empId "23"^^xsd:integer . _:f foaf:name "Bob" ; ex:empId "30"^^xsd:integer .

Query

data/sort/query-sort-4.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX ex: <http://example.org/things#> SELECT ?name ?emp WHERE { ?x foaf:name ?name ; ex:empId ?emp } ORDER BY ASC(?emp)

Results

data/sort/result-sort-4.rdf

empname
"30""Bob"
"29""Alice"
"27""Fred"
"23""Bob"
"9""Eve"

sort-5

Sort first on untyped literals (ascending), then on datatyped (integer) literals (descending

Data

data/sort/data-sort-4.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix ex: <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:a rdf:type foaf:Person ; foaf:name "Eve" ; ex:empId "9"^^xsd:integer . _:b rdf:type foaf:Person ; foaf:name "Alice" ; ex:empId "29"^^xsd:integer . _:c rdf:type foaf:Person ; foaf:name "Fred" ; ex:empId "27"^^xsd:integer . _:e foaf:name "Bob" ; ex:empId "23"^^xsd:integer . _:f foaf:name "Bob" ; ex:empId "30"^^xsd:integer .

Query

data/sort/query-sort-5.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX ex: <http://example.org/things#> SELECT ?name ?emp WHERE { ?x foaf:name ?name ; ex:empId ?emp } ORDER BY ?name DESC(?emp)

Results

data/sort/result-sort-5.rdf

empname
"27""Fred"
"9""Eve"
"23""Bob"
"30""Bob"
"29""Alice"

sort-6

Sort on mixed result of uris and literals.

Data

data/sort/data-sort-6.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix ex: <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:a rdf:type foaf:Person ; foaf:name "Eve" ; ex:address <http://example.org/eve> . _:b rdf:type foaf:Person ; foaf:name "Alice" ; ex:address "Fascination Street 11" . _:c rdf:type foaf:Person ; foaf:name "Fred" ; ex:address "fred@work.example" . _:e foaf:name "Bob" ; ex:address <mailto:bob@work.example> .

Query

data/sort/query-sort-6.rq
PREFIX ex: <http://example.org/things#> SELECT ?address WHERE { ?x ex:address ?address } ORDER BY ASC(?address)

Results

data/sort/result-sort-6.rdf

address
"fred@work.example"
"Fascination Street 11"
<mailto:bob@work.example>
<http://example.org/eve>

sort-7

Sort on comparable mixed typed literals (integer and float)

Data

data/sort/data-sort-7.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix ex: <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:a rdf:type foaf:Person ; foaf:name "Eve" ; ex:empId "9"^^xsd:integer . _:b rdf:type foaf:Person ; foaf:name "Alice" ; ex:empId "29"^^xsd:integer . _:c rdf:type foaf:Person ; foaf:name "Fred" ; ex:empId "27"^^xsd:integer . _:e foaf:name "Bob" ; ex:empId "23.0"^^xsd:float .

Query

data/sort/query-sort-4.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX ex: <http://example.org/things#> SELECT ?name ?emp WHERE { ?x foaf:name ?name ; ex:empId ?emp } ORDER BY ASC(?emp)

Results

data/sort/result-sort-7.rdf

empname
"27""Fred"
"23.0""Bob"
"9""Eve"
"29""Alice"

sort-8

Sort on several mixed values (bnode, uri, literal)

Data

data/sort/data-sort-8.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix ex: <http://example.org/things#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . _:a foaf:name "Eve" ; ex:empId "9"^^xsd:integer . _:f foaf:name "John" ; ex:empId [ ex:number "29"^^xsd:integer ] . _:g foaf:name "Dirk" ; ex:empId <http://example.org/dirk01> .

Query

data/sort/query-sort-4.rq
PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX ex: <http://example.org/things#> SELECT ?name ?emp WHERE { ?x foaf:name ?name ; ex:empId ?emp } ORDER BY ASC(?emp)

Results

data/sort/result-sort-8.rdf

empname
"9""Eve"
<http://example.org/dirk01>"Dirk"
<_:node0.4cb4f>"John"

untrusted-graphs-001

Untrusted graphs query example 1

Query

data/source-named/untrusted-graph-q1.rq
SELECT * FROM <dft.n3> FROM NAMED <a.n3> FROM NAMED <b.n3> WHERE { ?x ?y ?z . ?z ?r ?s }

Results

data/source-named/untrusted-graph-q1-result.n3

srzyx

untrusted-graphs-002

Untrusted graphs query example 2

Query

data/source-named/untrusted-graph-q2.rq
SELECT * FROM <dft.n3> FROM NAMED <a.n3> FROM NAMED <b.n3> WHERE { GRAPH ?src1 { ?x ?y ?z } . GRAPH ?src2 { ?z ?r ?s } . }

Results

data/source-named/untrusted-graph-q2-result.n3

zyxsrc2src1sr
<http://example.org/ns#c><http://example.org/ns#b><http://example.org/ns#a><test:rb.n3><test:ra.n3><http://example.org/ns#z><http://example.org/ns#p>

untrusted-graphs-004

Untrusted graphs query example 4

Query

data/source-named/untrusted-graph-q4.rq
SELECT * FROM <dft.n3> FROM NAMED <dft.n3> FROM NAMED <a.n3> FROM NAMED <b.n3> WHERE { GRAPH ?src1 { ?x ?y ?z } . GRAPH ?src2 { ?z ?r ?s } }

Results

data/source-named/untrusted-graph-q4-result.n3

src1xysrc2rsz
<test:ra.n3><http://example.org/ns#a><http://example.org/ns#b><test:rb.n3><http://example.org/ns#p><http://example.org/ns#z><http://example.org/ns#c>
<test:rdft.n3><http://example.org/ns#aRoot><http://example.org/ns#q><test:ra.n3><http://example.org/ns#b><http://example.org/ns#c><http://example.org/ns#a>

untrusted-graphs-005

Untrusted graphs query example 5

Query

data/source-named/untrusted-graph-q5.rq
SELECT * FROM NAMED <dft.n3> FROM NAMED <a.n3> FROM NAMED <b.n3> WHERE { GRAPH ?src1 { ?x ?y ?z } . GRAPH ?src2 { ?z ?r ?s } . }

Results

data/source-named/untrusted-graph-q4-result.n3

zsrsrc2yxsrc1
<http://example.org/ns#a><http://example.org/ns#c><http://example.org/ns#b><test:ra.n3><http://example.org/ns#q><http://example.org/ns#aRoot><test:rdft.n3>
<http://example.org/ns#c><http://example.org/ns#z><http://example.org/ns#p><test:rb.n3><http://example.org/ns#b><http://example.org/ns#a><test:ra.n3>

source-query-001

trivial test

Data

data/source-simple2/source-data-01.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox <mailto:bob@work> ; foaf:mbox <mailto:bob@home> ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; .

Query

data/source-simple2/source-query-001
# Get name, and optionally the mbox, of each person PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?name ?source WHERE SOURCE ?snode (?person foaf:name ?name) (?snode dc:source ?source)

Results

data/source-simple2/source-result-001.n3

namesource
"Eve"<file:data/source/source-data-01.n3>
"Alice"<file:data/source/source-data-01.n3>
"Bob"<file:data/source/source-data-01.n3>

source-query-002

2 file test

Data

data/source-simple2/source-data-02.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; .

Query

data/source-simple2/source-query-001
# Get name, and optionally the mbox, of each person PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT ?name ?source WHERE SOURCE ?snode (?person foaf:name ?name) (?snode dc:source ?source)

Results

data/source-simple2/source-result-002.n3

namesource
"Alice"<file:data/source/source-data-02.n3>
"Eve"<file:data/source/source-data-01.n3>
"Alice"<file:data/source/source-data-01.n3>
"Bob"<file:data/source/source-data-01.n3>

source-query-003

selecting 1 file from 2 test

Data

data/source-simple2/source-data-02.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; .

Query

data/source-simple2/source-query-003
# Finds person-name restioans from same source as alice's email address PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT DISTINCT ?name ?mailbox WHERE SOURCE ?snode (?person foaf:name ?name) SOURCE ?snode (?person foaf:mbox ?mailbox) SOURCE ?snode (?x foaf:mbox <mailto:bob@work>)

Results

data/source-simple2/source-result-003.n3

mailboxname
<mailto:alice@work>"Alice"
<mailto:bob@home>"Bob"
<mailto:bob@work>"Bob"

source-query-005

check files cant assert things against models

Data

data/source-simple2/source-data-03.n3

@prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . <file:data/source/source-data-03.n3> <dc:source> <http://example.com> . _:alice rdf:type foaf:Person ; foaf:name "Alice" ; foaf:mbox <mailto:alice@work> ; foaf:knows _:bob ; . _:bob rdf:type foaf:Person ; foaf:name "Bob" ; foaf:knows _:alice ; foaf:mbox <mailto:bob@work> ; foaf:mbox <mailto:bob@home> ; . _:eve rdf:type foaf:Person ; foaf:name "Eve" ; foaf:knows _:fred ; .

Query

data/source-simple2/source-query-005
# Get dc:sources of the SOURCE of this file, check users can't make assertions # about it PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> SELECT DISTINCT ?source WHERE SOURCE ?snode (?person foaf:name ?name) (?snode dc:source ?source)

Results

data/source-simple2/source-result-005.n3

source
<file:data/source/source-data-01.n3>

dawg-source-simple-001

Simple triple match on two graphs

Query

data/SourceSimple/source-simple-01.rq
SELECT * FROM <file:simple-data-1.n3> <file:simple-data-2.n3> WHERE (?x ?y ?z)

Results

data/SourceSimple/result-ss-01.n3

zyx
<http://example.org/c><http://example.org/b><http://example.org/a>

dawg-source-simple-002

Triple match using SOURCE

Query

data/SourceSimple/source-simple-02.rq
SELECT * FROM <file:simple-data-1.n3> <file:simple-data-2.n3> WHERE SOURCE ?src (?x ?y ?z)

Results

data/SourceSimple/result-ss-02.n3

zysrcx
<http://example.org/c><http://example.org/b><file:simple-data-1.n3><http://example.org/a>
<http://example.org/c><http://example.org/b><file:simple-data-2.n3><http://example.org/a>

dawg-source-simple-003

Triple match using SOURCE - SELECTed variables

Query

data/SourceSimple/source-simple-03.rq
SELECT ?x ?y ?z FROM <file:simple-data-1.n3> <file:simple-data-2.n3> WHERE SOURCE ?src (?x ?y ?z)

Results

data/SourceSimple/result-ss-03.n3

xyz
<http://example.org/a><http://example.org/b><http://example.org/c>
<http://example.org/a><http://example.org/b><http://example.org/c>

dawg-source-simple-004

Simple triple match - one named container

Query

data/SourceSimple/source-simple-04.rq
SELECT * FROM <file:simple-data-1.n3> WHERE SOURCE ?src (?x ?y ?z)

Results

data/SourceSimple/result-ss-04.n3

xsrcyz
<http://example.org/a><file:simple-data-1.n3><http://example.org/b><http://example.org/c>

dawg-source-simple-005

Simple triple match - no named container

Data

data/SourceSimple/simple-data-1.n3

@prefix : <http://example.org/> . :a :b :c .

Query

data/SourceSimple/source-simple-05.rq
SELECT * WHERE SOURCE ?src (?x ?y ?z)

Results

data/SourceSimple/result-ss-05.n3

xsrcyz
<http://example.org/a><http://example.org/b><http://example.org/c>

survey-1

Return the names of the authors of publication X

Data

data/survey/survey-sample.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.org/survey-sample/ontology/> . @prefix : <http://example.org/survey-sample/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . <http://example.org/ACMTopic/Information_Systems> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management> ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . <http://example.org/ACMTopic/Information_Systems/Database_Management> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#INTEGER> .

Query

data/survey/query-survey-1.rq
prefix ex: <http://example.org/survey-sample/ontology/> SELECT ?n WHERE { ?x ex:author [ ?li [ ex:name ?n] ]. }

Results

data/survey/result-survey-1.ttl

n
"Willy"
"Mary"
"Bob"
"John"

survey-2

Return the name and, if known, the e-mail of the author of publication X

Data

data/survey/survey-sample.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.org/survey-sample/ontology/> . @prefix : <http://example.org/survey-sample/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . <http://example.org/ACMTopic/Information_Systems> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management> ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . <http://example.org/ACMTopic/Information_Systems/Database_Management> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#INTEGER> .

Query

data/survey/query-survey-2.rq
prefix ex: <http://example.org/survey-sample/ontology/> SELECT ?n ?addr WHERE { ?y ex:author [ ?li ?who ]. ?who ex:name ?n. OPTIONAL { ?who ex:email ?addr } }

Results

data/survey/result-survey-2.ttl

addrn
"Willy"
"mary@example.org""Mary"
"Bob"
"John"

survey-3

Return the labels of all topics and (union) the titles of all publications.

Data

data/survey/survey-sample.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.org/survey-sample/ontology/> . @prefix : <http://example.org/survey-sample/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . <http://example.org/ACMTopic/Information_Systems> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management> ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . <http://example.org/ACMTopic/Information_Systems/Database_Management> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#INTEGER> .

Query

data/survey/query-survey-3.rq
prefix ex: <http://example.org/survey-sample/ontology/> prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?title WHERE { { [] a acm:Topic; rdfs:label ?title } UNION { [] ex:title ?title }}

Results

data/survey/result-survey-3.ttl

title
"Datenbankmanagement"
"Database Management"
"Informationsysteme"
"Information Systems"
"An Overview of RDF Query Languages"
"Anfragesprachen"
"Query Languages"
"Languages"
"Sprachen"

survey-8

Return the person who has classified the publication X.

Data

data/survey/survey-sample.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.org/survey-sample/ontology/> . @prefix : <http://example.org/survey-sample/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . <http://example.org/ACMTopic/Information_Systems> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management> ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . <http://example.org/ACMTopic/Information_Systems/Database_Management> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#INTEGER> .

Query

data/survey/query-survey-8.rq
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix ex: <http://example.org/survey-sample/ontology/> prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> prefix dc: <http://purl.org/dc/elements/1.1/> SELECT ?who WHERE { [ rdf:subject ?work; rdf:predicate ex:isAbout; rdf:object ?topic ] dc:creator ?who }

Results

data/survey/result-survey-8.ttl

who
<http://example.org/survey-sample/person01>

survey-9

Return the first author of Publication X.

Data

data/survey/survey-sample.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.org/survey-sample/ontology/> . @prefix : <http://example.org/survey-sample/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . <http://example.org/ACMTopic/Information_Systems> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management> ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . <http://example.org/ACMTopic/Information_Systems/Database_Management> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#INTEGER> .

Query

data/survey/query-survey-9.rq
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix ex: <http://example.org/survey-sample/ontology/> SELECT ?n WHERE { ?y ex:author [ rdf:_1 [ ex:name ?n] ]. }

Results

data/survey/result-survey-9.ttl

n
"John"

survey-10

Return all resources whose namespace starts with http://example.org/survey-sample/.

Data

data/survey/survey-sample.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.org/survey-sample/ontology/> . @prefix : <http://example.org/survey-sample/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . <http://example.org/ACMTopic/Information_Systems> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management> ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . <http://example.org/ACMTopic/Information_Systems/Database_Management> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#INTEGER> .

Query

data/survey/query-survey-10.rq
select DISTINCT ?R where { ?R ?x ?y. FILTER ( regex(str(?R), "http://example.org/") ) }

Results

data/survey/result-survey-10.ttl

R
<http://example.org/survey-sample/ontology/title>
<http://example.org/survey-sample/ontology/author>
<http://example.org/survey-sample/ontology/Topic>
<http://example.org/survey-sample/ontology/Human>
<http://example.org/survey-sample/ontology/Person>
<http://example.org/survey-sample/ontology/InProceedings>
<http://example.org/survey-sample/ontology/Publication>
<http://example.org/survey-sample/ontology/pages>
<http://example.org/survey-sample/ontology/year>
<http://example.org/survey-sample/ontology/isAbout>
<http://example.org/survey-sample/ontology/name>
<http://example.org/survey-sample/ontology/email>
<http://example.org/survey-sample/person01>
<http://example.org/survey-sample/person02>
<http://example.org/survey-sample/person03>
<http://example.org/survey-sample/person04>
<http://example.org/survey-sample/Paper>
<http://example.org/survey-sample/ontology/reified_triple>
<http://example.org/ACMTopic/Information_Systems>
<http://example.org/ACMTopic/Information_Systems/Database_Management>
<http://example.org/ACMTopic/Information_Systems/Database_Management/Languages>
<http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages>

survey-11

Return the German label of the topic whose English label is 'Database Management'.

Data

data/survey/survey-sample.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.org/survey-sample/ontology/> . @prefix : <http://example.org/survey-sample/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . <http://example.org/ACMTopic/Information_Systems> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management> ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . <http://example.org/ACMTopic/Information_Systems/Database_Management> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#INTEGER> .

Query

data/survey/query-survey-11.rq
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?de WHERE { [ rdfs:label ?de, "Database Management"@en ]. FILTER ( lang(?de) = "de" ) }

Results

data/survey/result-survey-11.ttl

de
"Datenbankmanagement"

survey-12

Return all publications where the page number is the lexical value '08'.

Data

data/survey/survey-sample.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.org/survey-sample/ontology/> . @prefix : <http://example.org/survey-sample/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . <http://example.org/ACMTopic/Information_Systems> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management> ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . <http://example.org/ACMTopic/Information_Systems/Database_Management> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#INTEGER> .

Query

data/survey/query-survey-12.rq
prefix ex: <http://example.org/survey-sample/ontology/> SELECT ?PUB WHERE { ?PUB ex:pages "08" }

Results

data/survey/result-survey-12.ttl

PUB
<http://example.org/survey-sample/Paper>

survey-13

Return all publications where the page number is the integer value 8.

Data

data/survey/survey-sample.ttl

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix ex: <http://example.org/survey-sample/ontology/> . @prefix : <http://example.org/survey-sample/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix acm: <http://daml.umbc.edu/ontologies/topic-ont#> . :person01 a ex:Person ; ex:name "John" . ex:name a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . :person02 a ex:Person , ex:Human ; ex:name "Bob" . ex:author a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range rdf:Seq . ex:Person a rdfs:Class ; rdfs:subClassOf ex:Human . ex:reified_triple a rdf:Statement ; rdf:subject ex:Paper ; rdf:predicate ex:isAbout ; rdf:object <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; dc:creator :person01. :person03 ex:email "mary@example.org" ; ex:name "Mary" . ex:year a rdf:Property ; rdfs:domain ex:Publication . :Paper a ex:InProceedings ; ex:isAbout <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; ex:year "2004" ; ex:pages "08" ; ex:title "An Overview of RDF Query Languages" ; ex:author [ a rdf:Seq ; rdf:_1 :person01 ; rdf:_2 :person02 ; rdf:_3 :person03 ; rdf:_4 :person04 ] . ex:email a rdf:Property ; rdfs:domain ex:Person ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . <http://example.org/ACMTopic/Information_Systems> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management> ; rdfs:label "Informationsysteme"@de , "Information Systems"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> a acm:Topic ; rdfs:label "Anfragesprachen"@de , "Query Languages"@en . <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages/Query_Languages> ; a acm:Topic ; rdfs:label "Sprachen"@de , "Languages"@en . ex:title a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#STRING> . ex:InProceedings a rdfs:Class ; rdfs:subClassOf ex:Publication . ex:isAbout a rdf:Property ; rdfs:range ex:Topic . ex:Topic a rdfs:Class . <http://example.org/ACMTopic/Information_Systems/Database_Management> a acm:Topic ; acm:SubTopic <http://example.org/ACMTopic/Information_Systems/Database_Management/Languages> ; rdfs:label "Datenbankmanagement"@de , "Database Management"@en . :person04 a ex:Human ; ex:name "Willy" . ex:Human a rdfs:Class ; rdfs:subClassOf ex:Person . ex:Publication a rdfs:Class . ex:pages a rdf:Property ; rdfs:domain ex:Publication ; rdfs:range <http://www.w3.org/2001/XMLSchema#INTEGER> .

Query

data/survey/query-survey-13.rq
prefix ex: <http://example.org/survey-sample/ontology/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?PUB WHERE { ?PUB ex:pages ?n. FILTER ( xsd:integer(?n) = 8 ) }

Results

data/survey/result-survey-13.ttl

PUB
<http://example.org/survey-sample/Paper>

syntax-basic-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-basic-01.rq
SELECT * WHERE { }

syntax-basic-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-basic-02.rq
SELECT * {}

syntax-basic-03.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-basic-03.rq
# No trailing dot PREFIX : <http://example.org/ns#> SELECT * WHERE { ?x ?y ?z }

syntax-basic-04.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-basic-04.rq
# With trailing dot SELECT * WHERE { ?x ?y ?z . }

syntax-basic-05.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-basic-05.rq
# Two triples : no trailing dot SELECT * WHERE { ?x ?y ?z . ?a ?b ?c }

syntax-basic-06.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-basic-06.rq
# Two triples : with trailing dot SELECT * WHERE { ?x ?y ?z . ?a ?b ?c . }

syntax-bnodes-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-bnodes-01.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { [:p :q ] }

syntax-bnodes-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-bnodes-02.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { [] :p :q }

syntax-bnodes-03.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-bnodes-03.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { :x [] :q }

syntax-bnodes-04.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-bnodes-04.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { :x _:a :q }

syntax-bnodes-05.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-bnodes-05.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { [ ?x ?y ] :p [ ?pa ?b ] }

syntax-bnodes-06.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-bnodes-06.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { [ :p :q ; ] }

syntax-bnodes-07.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-bnodes-07.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { _:a :p1 :q1 . _:a :p2 :q2 . }

syntax-expr-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-expr-01.rq
SELECT * WHERE { ?s ?p ?o . FILTER (?o) }

syntax-expr-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-expr-02.rq
SELECT * WHERE { ?s ?p ?o . FILTER (?o) }

syntax-expr-03.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-expr-03.rq
SELECT * WHERE { ?s ?p ?o . FILTER REGEX(?o, "foo") }

syntax-expr-04.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-expr-04.rq
SELECT * WHERE { ?s ?p ?o . FILTER REGEX(?o, "foo", "i") }

syntax-expr-05.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-expr-05.rq
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT * WHERE { ?s ?p ?o . FILTER (xsd:integer(?o)) }

syntax-expr-06.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-expr-06.rq
PREFIX : <http://example.org/ns#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT * WHERE { ?s ?p ?o . FILTER (:myFunc(?s,?o)) }

syntax-forms-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-forms-01.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { ( [ ?x ?y ] ) :p ( [ ?pa ?b ] 57 ) }

syntax-forms-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-forms-02.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { ( [] [] ) }

syntax-limit-offset-07.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-limit-offset-07.rq
PREFIX : <http://example.org/ns#> SELECT * { ?s ?p ?o } ORDER BY ?o LIMIT 5

syntax-limit-offset-08.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-limit-offset-08.rq
PREFIX : <http://example.org/ns#> SELECT * { ?s ?p ?o } ORDER BY ?o LIMIT 5 OFFSET 3

syntax-limit-offset-09.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-limit-offset-09.rq
PREFIX : <http://example.org/ns#> SELECT * { ?s ?p ?o } ORDER BY ?o OFFSET 3

syntax-lists-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lists-01.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { ( ?x ) :p ?z }

syntax-lists-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lists-02.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { ?x :p ( ?z ) }

syntax-lists-03.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lists-03.rq
SELECT * WHERE { ( ?z ) }

syntax-lists-04.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lists-04.rq
SELECT * WHERE { ( ( ?z ) ) }

syntax-lists-05.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lists-05.rq
SELECT * WHERE { ( ( ) ) }

syntax-lit-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-01.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p "x" }

syntax-lit-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-02.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p 'x' }

syntax-lit-03.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-03.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p "x\"y'z" }

syntax-lit-04.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-04.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p 'x"y\'z' }

syntax-lit-05.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-05.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p "x\"" }

syntax-lit-06.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-06.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p 'x\'' }

syntax-lit-07.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-07.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p 123 }

syntax-lit-08.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-08.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p 123. . }

syntax-lit-09.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-09.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p """Long "" Literal """ }

syntax-lit-10.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-10.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p '''Long '' """ Literal''' }

syntax-lit-11.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-11.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p """Long""\"Literal""" }

syntax-lit-12.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-12.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p '''Long''\'Literal''' }

syntax-lit-13.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-13.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p """Long\"""Literal""" }

syntax-lit-14.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-lit-14.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { :x :p '''Long\'''Literal''' }

syntax-order-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-order-01.rq
PREFIX : <http://example.org/ns#> SELECT * { ?s ?p ?o } ORDER BY ?o

syntax-order-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-order-02.rq
PREFIX : <http://example.org/ns#> SELECT * { ?s ?p ?o } ORDER BY (?o+5)

syntax-order-03.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-order-03.rq
PREFIX : <http://example.org/ns#> SELECT * { ?s ?p ?o } ORDER BY ASC(?o)

syntax-order-04.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-order-04.rq
PREFIX : <http://example.org/ns#> SELECT * { ?s ?p ?o } ORDER BY DESC(?o)

syntax-order-05.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-order-05.rq
PREFIX : <http://example.org/ns#> SELECT * { ?s ?p ?o } ORDER BY DESC(:func(?s, ?o))

syntax-order-06.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-order-06.rq
PREFIX : <http://example.org/ns#> SELECT * { ?s ?p ?o } ORDER BY DESC(?o+57) :func2(?o) ASC(?s)

syntax-pat-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-pat-01.rq
PREFIX : <http:/example.org/ns#> SELECT * { }

syntax-pat-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-pat-02.rq
# No DOT after optional PREFIX : <http:/example.org/ns#> SELECT * { ?a :b :c OPTIONAL{:x :y :z} :x ?y ?z }

syntax-pat-03.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-pat-03.rq
# No DOT between non-triples patterns PREFIX : <http:/example.org/ns#> SELECT * { ?a :b :c OPTIONAL{:x :y :z} { :x1 :y1 :z1 } UNION { :x2 :y2 :z2 } }

syntax-pat-04.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-pat-04.rq
# No DOT between non-triples patterns PREFIX : <http:/example.org/ns#> SELECT * { OPTIONAL{:x :y :z} ?a :b :c { :x1 :y1 :z1 } UNION { :x2 :y2 :z2 } }

syntax-qname-07.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-qname-07.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { : : : . }

syntax-qname-08.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-qname-08.rq
BASE <http://example.org/> PREFIX : <#> PREFIX x.y: <x#> SELECT * WHERE { :a.b x.y: : . }

syntax-qname-09.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-qname-09.rq
PREFIX : <http://example.org/ns#> SELECT * WHERE { :_1 :p.rdf :z.z . }

syntax-qname-10.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-qname-10.rq
PREFIX : <http://example.org/ns#> PREFIX a: <http://example.org/ns2#> SELECT * WHERE { : a: :a . : : : . }

syntax-qname-11.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-qname-11.rq
PREFIX : <> SELECT * WHERE { : : : . }

syntax-qname-12.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-qname-12.rq
PREFIX : <#> SELECT * WHERE { : : : . }

syntax-qname-13.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-qname-13.rq
BASE <http://example.org/> PREFIX : <#> SELECT * WHERE { : : : . }

syntax-qname-14.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-qname-14.rq
BASE <http://example.org/> PREFIX : <#> PREFIX x.y: <x#> SELECT * WHERE { :a.b x.y: : . }

syntax-struct-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-01.rq
# Operator PREFIX : <http://example.org/ns#> SELECT * { OPTIONAL { } }

syntax-struct-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-02.rq
# Operator PREFIX : <http://example.org/ns#> SELECT * { OPTIONAL { :a :b :c } }

syntax-struct-03.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-03.rq
# Triple, no DOT, operator PREFIX : <http://example.org/ns#> SELECT * { :p :q :r OPTIONAL { :a :b :c } }

syntax-struct-04.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-04.rq
# Triple, DOT, operator PREFIX : <http://example.org/ns#> SELECT * { :p :q :r . OPTIONAL { :a :b :c } }

syntax-struct-05.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-05.rq
# Triple, DOT, operator PREFIX : <http://example.org/ns#> SELECT * { :p :q :r . OPTIONAL { :a :b :c } }

syntax-struct-06.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-06.rq
# Triple, DOT, operator, DOT PREFIX : <http://example.org/ns#> SELECT * { :p :q :r . OPTIONAL { :a :b :c } . }

syntax-struct-07.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-07.rq
# Operator, no DOT PREFIX : <http://example.org/ns#> SELECT * { OPTIONAL { :a :b :c } }

syntax-struct-08.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-08.rq
# Operator, DOT PREFIX : <http://example.org/ns#> SELECT * { OPTIONAL { :a :b :c } . }

syntax-struct-09.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-09.rq
# Operator, triple PREFIX : <http://example.org/ns#> SELECT * { OPTIONAL { :a :b :c } ?x ?y ?z }

syntax-struct-10.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-struct-10.rq
# Operator, DOT triple PREFIX : <http://example.org/ns#> SELECT * { OPTIONAL { :a :b :c } . ?x ?y ?z }

syntax-union-01.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-union-01.rq
PREFIX : <http://example.org/ns#> SELECT * { { ?s ?p ?o } UNION { ?a ?b ?c } }

syntax-union-02.rq

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005AprJun/0411

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-union-02.rq
PREFIX : <http://example.org/ns#> SELECT * { { ?s ?p ?o } UNION { ?a ?b ?c } UNION { ?r ?s ?t } }

keyword FILTER as a namespace prefix

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-keywords-01.rq
# use keyword FILTER as a namespace prefix PREFIX FILTER: <http://example.org/ns#> SELECT * WHERE { ?x FILTER:foo ?z FILTER (?z) }

keyword FILTER as a local name

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-keywords-02.rq
# use keyword FILTER as a local name PREFIX : <http://example.org/ns#> SELECT * WHERE { ?x :FILTER ?z FILTER (?z) }

keyword UNION as a namespace prefix

Data

data/SyntaxFull/empty.nt

Query

data/SyntaxFull/syntax-keywords-03.rq
# use keyword UNION as a namespace prefix PREFIX UNION: <http://example.org/ns#> SELECT * WHERE { ?x UNION:foo ?z }

syntax-001

Syntax: using ? for variables in triple patterns

Data

data/Syntax/syn-data-01.n3

@prefix : <http://example.org/ns#> . :a :a "AAAA" .

Query

data/Syntax/syntax-001.rq
# Test of syntax SELECT * WHERE { ?x ?y ?z }

Results

data/Syntax/result-syn-001.n3

xyz
<http://example.org/ns#a><http://example.org/ns#a>"AAAA"

syntax-002

Syntax: using $ for variables in triple patterns

Data

data/Syntax/syn-data-01.n3

@prefix : <http://example.org/ns#> . :a :a "AAAA" .

Query

data/Syntax/syntax-001.rq
# Test of syntax SELECT * WHERE { ?x ?y ?z }

Results

data/Syntax/result-syn-002.n3

xyz
<http://example.org/ns#a><http://example.org/ns#a>"AAAA"

syntax-003

Syntax: using $ and ? for variables in triple patterns

Data

data/Syntax/syn-data-01.n3

@prefix : <http://example.org/ns#> . :a :a "AAAA" .

Query

data/Syntax/syntax-003.rq
# Test of syntax SELECT * WHERE { ?x $x ?z }

Results

data/Syntax/result-syn-003.n3

xz
<http://example.org/ns#a>"AAAA"

syntax-004

Syntax: using . in qname of triple pattern

Data

data/Syntax/syn-data-02.n3

@prefix : <http://example.org/data/> . :x :p <http://example.org/data/v1.1> . :x :p <http://example.org/data/v2.1> .

Query

data/Syntax/syntax-004.rq
PREFIX : <http://example.org/data/> SELECT * WHERE { ?x :p :v1.1 . }

Results

data/Syntax/result-syn-004.n3

x
<http://example.org/data/x>

dawg-unsaid-001

Inference test from http://lists.w3.org/Archives/Public/public-rdf-dawg/2004OctDec/0538.html

Data

data/unsaid-inference/data-a.n3

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix : <http://example.com/#> . :C1 rdfs:subClassOf :C2 . :x rdf:type :C1 .

Query

data/unsaid-inference/query-01.rq
PREFIX : <http://example.com/#> SELECT ?c WHERE (:x rdf:type ?c)

Results

data/unsaid-inference/result-01.n3

c
<http://example.com/#C1>

dawg-unsaid-002

UNSAID test from http://lists.w3.org/Archives/Public/public-rdf-dawg/2004OctDec/0538.html

Data

data/unsaid-inference/data-a.n3

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix : <http://example.com/#> . :C1 rdfs:subClassOf :C2 . :x rdf:type :C1 .

Query

data/unsaid-inference/query-02.rq
PREFIX : <http://example.com/#> SELECT ?x WHERE UNSAID (?x rdf:type :C2)

Results

data/unsaid-inference/result-02.n3

x
<http://example.com/#x>

dawg-unsaid-003

UNSAID test from http://lists.w3.org/Archives/Public/public-rdf-dawg/2004OctDec/0538.html expressed as an ASK

Data

data/unsaid-inference/data-a.n3

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix : <http://example.com/#> . :C1 rdfs:subClassOf :C2 . :x rdf:type :C1 .

Query

data/unsaid-inference/query-03.rq
PREFIX : <http://example.com/#> ASK UNSAID (?x rdf:type :C2)

Results

data/unsaid-inference/result-03.n3

ask
<http://www.w3.org/2001/sw/DataAccess/tests/result-set#true>

extendedType-eq-pass

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0175

Only extended types with identical lexical and datatypes can be tested for = .

Data

data/ValueTesting/extendedType-0.n3

@prefix r: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> . @prefix air: <http://www.daml.org/2001/10/html/airport-ont#> . loc:a air:name "Austin Bergstrom International" ; loc:location [ r:type loc:geodetic ; loc:rotational "30.300000"^^loc:latitude ; loc:orthogonal "-97.700000"^^loc:longitude ] . loc:b air:name "Austin Bergstrom International" ; loc:location [ r:type loc:EarthCenteredEarthFixed ; loc:rotational "-7420507.1"^^loc:ECEF_X ; loc:orthogonal "-5462738.5"^^loc:ECEF_Y ] .

Query

data/ValueTesting/extendedType-eq-pass.rq
# Only extended types with identical lexical rep and datatypes can be = . # $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ PREFIX loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> PREFIX wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#> PREFIX air: <http://www.daml.org/2001/10/html/airport-ont#> #PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> #SELECT ?a1 (xsd:float(xsd:string(?rot1))-5.5) ?a2 SELECT ?a1 ?a2 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational ?rot1 . ?a2 air:name ?name2 ; loc:location ?l2 . ?l2 loc:rotational ?rot2 . FILTER (?rot1 = ?rot2)} # FILTER (str(?rot1) = "-7420507.1")}

Results

data/ValueTesting/extendedType-eq-pass-result.n3

a2a1
<http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#b><http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#b>
<http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#a><http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#a>

extendedType-ne-fail

Approved by http://lists.w3.org/Archives/Public/public-rdf-dawg/2005JulSep/0175

Opaque types can not be tested for != .

Data

data/ValueTesting/extendedType-0.n3

@prefix r: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> . @prefix air: <http://www.daml.org/2001/10/html/airport-ont#> . loc:a air:name "Austin Bergstrom International" ; loc:location [ r:type loc:geodetic ; loc:rotational "30.300000"^^loc:latitude ; loc:orthogonal "-97.700000"^^loc:longitude ] . loc:b air:name "Austin Bergstrom International" ; loc:location [ r:type loc:EarthCenteredEarthFixed ; loc:rotational "-7420507.1"^^loc:ECEF_X ; loc:orthogonal "-5462738.5"^^loc:ECEF_Y ] .

Query

data/ValueTesting/extendedType-ne-fail.rq
# Opaque types can not be tested for != . # $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ PREFIX loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> PREFIX wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#> PREFIX air: <http://www.daml.org/2001/10/html/airport-ont#> SELECT ?a1 ?a2 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational ?rot1 . ?a2 air:name ?name2 ; loc:location ?l2 . ?l2 loc:rotational ?rot2 . FILTER (?rot1 != ?rot2) }

Results

data/ValueTesting/extendedType-ne-fail-result.n3

a2a1

extendedType-literal-eq

NotApproved

Test FILTER match on extended type.

Data

data/ValueTesting/extendedType-0.n3

@prefix r: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> . @prefix air: <http://www.daml.org/2001/10/html/airport-ont#> . loc:a air:name "Austin Bergstrom International" ; loc:location [ r:type loc:geodetic ; loc:rotational "30.300000"^^loc:latitude ; loc:orthogonal "-97.700000"^^loc:longitude ] . loc:b air:name "Austin Bergstrom International" ; loc:location [ r:type loc:EarthCenteredEarthFixed ; loc:rotational "-7420507.1"^^loc:ECEF_X ; loc:orthogonal "-5462738.5"^^loc:ECEF_Y ] .

Query

data/ValueTesting/extendedType-literal-eq.rq
# Test FILTER match on extended type. # $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ PREFIX loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> PREFIX air: <http://www.daml.org/2001/10/html/airport-ont#> SELECT ?a1 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational ?r1 . FILTER (?r1 = "-7420507.1"^^loc:ECEF_X) }

Results

data/ValueTesting/extendedType-literal-eq-result.n3

a1
<http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#b>

extendedType-literal-ne

NotApproved

Test FILTER negative match on extended type.

Data

data/ValueTesting/extendedType-0.n3

@prefix r: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> . @prefix air: <http://www.daml.org/2001/10/html/airport-ont#> . loc:a air:name "Austin Bergstrom International" ; loc:location [ r:type loc:geodetic ; loc:rotational "30.300000"^^loc:latitude ; loc:orthogonal "-97.700000"^^loc:longitude ] . loc:b air:name "Austin Bergstrom International" ; loc:location [ r:type loc:EarthCenteredEarthFixed ; loc:rotational "-7420507.1"^^loc:ECEF_X ; loc:orthogonal "-5462738.5"^^loc:ECEF_Y ] .

Query

data/ValueTesting/extendedType-literal-ne.rq
# Test FILTER negative match on extended type. # $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ PREFIX loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> PREFIX air: <http://www.daml.org/2001/10/html/airport-ont#> SELECT ?a1 ?a2 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational ?r . FILTER (?r != "-7420507.1"^^loc:ECEF_X) }

Results

data/ValueTesting/extendedType-literal-ne-result.n3

a2a1

extendedType-graph

NotApproved

Test graph match on extended type.

Data

data/ValueTesting/extendedType-0.n3

@prefix r: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> . @prefix air: <http://www.daml.org/2001/10/html/airport-ont#> . loc:a air:name "Austin Bergstrom International" ; loc:location [ r:type loc:geodetic ; loc:rotational "30.300000"^^loc:latitude ; loc:orthogonal "-97.700000"^^loc:longitude ] . loc:b air:name "Austin Bergstrom International" ; loc:location [ r:type loc:EarthCenteredEarthFixed ; loc:rotational "-7420507.1"^^loc:ECEF_X ; loc:orthogonal "-5462738.5"^^loc:ECEF_Y ] .

Query

data/ValueTesting/extendedType-graph.rq
# Test graph match on extended type. # $Id: index.html,v 1.55 2005/10/06 14:16:54 sharris2 Exp $ PREFIX loc: <http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#> PREFIX air: <http://www.daml.org/2001/10/html/airport-ont#> SELECT ?a1 WHERE {?a1 air:name ?name1 ; loc:location ?l1 . ?l1 loc:rotational "-7420507.1"^^loc:ECEF_X }

Results

data/ValueTesting/extendedType-graph-result.n3

a1
<http://www.w3.org/2001/sw/DataAccess/tests/data/ValueTesting/extendedType-0#b>