DAWG Testcases

Document Editor
Steve Harris – IAM, University of Southampton
Version:
$Revision: 1.3 500/code>

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-09-28


Source files

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

Schema and documentation
Manifests
Source archives

Contents

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


source-query-001

trivial test

Data

data/source/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:knowns     _:bob ;
    .

_:bob
    rdf:type        foaf:Person ;
    foaf:name       "Bob" ;
    foaf:knowns     _:alice ;
    foaf:mbox       <mailto:bob@work> ;
    foaf:mbox       <mailto:bob@home> ;
    .


_:eve
    rdf:type      foaf:Person ;
    foaf:name     "Eve" ;
    foaf:knows    _:fred ;
    .

Query

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

# (Appologies for using USING, my parser can't handle PREFIX yet)

SELECT ?name, ?source
WHERE SOURCE ?snode (?person <foaf:name> ?name),
      (?snode <dc:source> ?source)
USING foaf FOR <http://xmlns.com/foaf/0.1/>,
      dc   FOR <http://purl.org/dc/elements/1.1/>

Results

data/source/source-result-001.n3

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

source-query-002

2 file test

Data

data/source/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> ;
    .
data/source/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:knowns     _:bob ;
    .

_:bob
    rdf:type        foaf:Person ;
    foaf:name       "Bob" ;
    foaf:knowns     _:alice ;
    foaf:mbox       <mailto:bob@work> ;
    foaf:mbox       <mailto:bob@home> ;
    .


_:eve
    rdf:type      foaf:Person ;
    foaf:name     "Eve" ;
    foaf:knows    _:fred ;
    .

Query

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

# (Appologies for using USING, my parser can't handle PREFIX yet)

SELECT ?name, ?source
WHERE SOURCE ?snode (?person <foaf:name> ?name),
      (?snode <dc:source> ?source)
USING foaf FOR <http://xmlns.com/foaf/0.1/>,
      dc   FOR <http://purl.org/dc/elements/1.1/>

Results

data/source/source-result-002.n3

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

source-query-003

selecting 1 file from 2 test

Data

data/source/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> ;
    .
data/source/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:knowns     _:bob ;
    .

_:bob
    rdf:type        foaf:Person ;
    foaf:name       "Bob" ;
    foaf:knowns     _:alice ;
    foaf:mbox       <mailto:bob@work> ;
    foaf:mbox       <mailto:bob@home> ;
    .


_:eve
    rdf:type      foaf:Person ;
    foaf:name     "Eve" ;
    foaf:knows    _:fred ;
    .

Query

# Finds person-name restioans from same source as alice's email address

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>)
USING foaf FOR <http://xmlns.com/foaf/0.1/>,
      dc   FOR <http://purl.org/dc/elements/1.1/>

Results

data/source/source-result-003.n3

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

source-query-005

check files cant assert things against models

Data

data/source/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:knowns     _:bob ;
    .

_:bob
    rdf:type        foaf:Person ;
    foaf:name       "Bob" ;
    foaf:knowns     _:alice ;
    foaf:mbox       <mailto:bob@work> ;
    foaf:mbox       <mailto:bob@home> ;
    .


_:eve
    rdf:type      foaf:Person ;
    foaf:name     "Eve" ;
    foaf:knows    _:fred ;
    .

Query

# Get dc:sources of the SOURCE of this file, check users can't make assertions
# about it

SELECT DISTINCT ?source
WHERE SOURCE ?snode (?person <foaf:name> ?name),
      (?snode <dc:source> ?source)
USING foaf FOR <http://xmlns.com/foaf/0.1/>,
      dc   FOR <http://purl.org/dc/elements/1.1/>

Results

data/source/source-result-005.n3

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