W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > July to September 2004

Some tests: optional triples // first pass

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Wed, 7 Jul 2004 15:03:03 +0100
Message-ID: <E864E95CB35C1C46B72FEA0626A2E808039843B3@0-mail-br1.hpl.hp.com>
To: public-rdf-dawg@w3.org

Snapshot of some tests of optional triples cases.

Browsable copy:
http://jena.hpl.hp.com/~afs/DAWG/Tests/

Manifest file:
http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-tests.n3

Zipped checkpoint including everything:
http://jena.hpl.hp.com/~afs/DAWG/dawg-tests-2004-07-07.zip

Everything =>
  manifest, data, queries, results
            The result sets are encoded into RDF serialized in N3
            Unset variables are absent from the particualr solution

Comments, suggestions for new tests, requests for things to make it
easier to get a quick overview etc., please.

	Andy


Explanation of each test:

---------------------------------------------------------
Test: dawg-test-001
Data:   http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-data-01.n3
Query:  http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-query-001
Result: http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-result-001.n3

Example of a single triple optional clause.
This is Simon's example, foaf'ified as the other tests use
this same data file.

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/>

Output:
---------------------------------
| name    | mbox                |
=================================
| "Bob"   | <mailto:bob@work>   |
| "Bob"   | <mailto:bob@home>   |
| "Eve"   | <<unset>>           |
| "Alice" | <mailto:alice@work> |
---------------------------------

---------------------------------------------------------
Test: dawg-test-002
Data:   http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-data-01.n3
Query:  http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-query-002
Result: http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-result-002.n3

Example of multi-triple graph pattern in optional part.

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/>

Output:
-----------------------
| name    | name2     |
=======================
| "Bob"   | "Alice"   |
| "Alice" | "Bob"     |
| "Eve"   | <<unset>> |
-----------------------

because Eve does not know anybody with a name (she knows Fred).

Note:
This leads to a need for nested optionals: get the name or mbox of 
any people known by people in the FOAF datafile.

---------------------------------------------------------
Test: dawg-test-003
Data:   http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-data-01.n3
Query:  http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-query-003
Result: http://jena.hpl.hp.com/~afs/DAWG/Tests/dawg-result-003.n3

Example of multiple, independent optional clauses.

# 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/>
# rdf: is built in because its easier that way

-----------------------------------
| name      | mbox                |
===================================
| "Bob"     | <mailto:bob@home>   |
| "Bob"     | <mailto:bob@work>   |
| <<unset>> | <fred@edu>          |
| "Eve"     | <<unset>>           |
| "Alice"   | <mailto:alice@work> |
-----------------------------------
Received on Wednesday, 7 July 2004 10:03:35 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:20 GMT