DAWG Testcases

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

Last updated 2004-07-23


Contents

dawg-query-001

Optional triples: single optional triple case.

dawg-query-002

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

dawg-query-003

Optional triples: multiple optional clauses.


dawg-query-001

Optional triples: single optional triple case.

Data

file:dawg-data-01.n3

Query

# Get name, and optionally the mbox, of each person

SELECT ?name ?mbox
WHERE
    (?person foaf:name ?name)
OPTIONAL
    (?person foaf:mbox	?mbox)
USING foaf FOR <http://xmlns.com/foaf/0.1/>

Results

data/dawg-result-001.n3

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

dawg-query-002

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

Data

file:dawg-data-01.n3

Query

# Get names of people, together with the names of people they know.

SELECT ?name, ?name2
WHERE
    (?person foaf:name ?name)
OPTIONAL
    (?person foaf:knowns ?p2)
    (?p2     foaf:name   ?name2)
USING foaf FOR <http://xmlns.com/foaf/0.1/>

Results

data/dawg-result-002.n3

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

dawg-query-003

Optional triples: multiple optional clauses.

Data

file:dawg-data-01.n3

Query

# Get names and mboxes, each of which may be optional.

SELECT ?name, ?mbox
WHERE
    (?person rdf:type foaf:Person)
OPTIONAL
    (?person foaf:name  ?name)
OPTIONAL
    (?person foaf:mbox  ?mbox)
USING foaf FOR <http://xmlns.com/foaf/0.1/>

Results

data/dawg-result-003.n3

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