This document summarises work carried out in February-May 2003 to gather together tests that could be used to check if different implementations of simple conjunctive RDF query languages produced the same results.
The result is a collection of tests using
The testcases  are available from a RDF Query (and Rule) Testcase Workspace .
The aim was to get something that could be implemented quickly by four developers with four implementations of two simple RDF query languages. The work was driven by the pragmatic need to find out if the RDF query implementations were producing the same results for the same query. This was a first step towards interoperability between the different systems, and a way to tease out the assumptions behind the implementations.
The query language syntax is just N-Triples; the query model is an RDF graph with a question mark after it - an RDF graph reinterpreted as a question . BNodes are treated as variables.
N-Triples was chosen as a syntax because it was already specified for other purposes, was simple, and was verbose enough to avoid confusion with an end-user query language proposal.
There are various disadvantages to using this syntax (some are documented here ), the most obvious being that N-Triples does not have 'bArcs' - blank arcs, restricting the types of queries that could be written down in N-Triples as strictly interpretted. Pragmatically however, the N-Triples parsers were very easy to alter, and so for our limited purpose the N-Triples syntax was sufficient.
Get the variables per, img and mb,
where per is something with a
of img and a per also has a
_:per <http://xmlns.com/foaf/0.1/depiction> _:img . _:per <http://xmlns.com/foaf/0.1/mbox> _:mb .
As a graph:
The manifest format is documented in more detail in a document by Alberto Reggiori .
The manifest is a list of tests with a number, a human-readable description, and links to input and output documents.
The documents have a syntax specified in the manifest: N-Triples, N3 or RDF/XML. Any document can be in any format. Multiple input documents (source files) are allowed, but only one query and one result file.
In practice all these links were to local files, anticipating that the tests would be downloaded as a bundle rather than retrieved from online sources as required.
In later versions, variable names and number of rows in the result set were added. The former is very important, and specifies which of the bNode values used are for returning and which are not. This is important because it can substantially improve processing time and reduce the number of rows returned. The number of rows in the result set can be used as a preliminary check to see that the results are in the right area, without doing a full graph comparison of the results.
A manifest showing a single test with one input (source) document, one query and one output (result) document. The test is number 1; 4 rows are expected in the result set.
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:mf='http://www.w3.org/2003/03/rdfqr-tests/manifest.rdfs#' xmlns:tq='http://www.w3.org/2003/03/rdfqr-tests/query.rdfs#' > <rdf:Description> <mf:tests rdf:parseType='Collection'> <mf:Test mf:num='1'> <mf:name>test1</mf:name> <mf:description>simple test</mf:description> <mf:status>true</mf:status> <mf:input rdf:parseType='Resource'> <tq:queryDocument rdf:resource='file:queries/nt/q1.nt' rdf:type='http://www.w3.org/2003/03/rdfqr-tests/query.rdfs#NT-Document'/> <tq:inputDocument rdf:resource='file:inputs/000068.rdf' rdf:type='http://www.w3.org/2003/03/rdfqr-tests/query.rdfs#RDF-XML-Document'/> </mf:input> <mf:output rdf:parseType='Resource'> <tq:outputDocument rdf:resource='file:results/rs1.rdf' rdf:type='http://www.w3.org/2003/03/rdfqr-tests/query.rdfs#RDF-XML-Document' tq:numberRows='4'/> </mf:output> </mf:Test> </mf:tests> </rdf:Description> </rdf:RDF>
This is described in more detail in a document by Andy Seaborne .
The result set format is basically a table described in RDF. The aim was that a JDBC result set (for example) could be quickly transformed into the RDF format, so that the results could be checked against an exemplar result set also expressed in RDF, using a graph comparison tool, such as Jena's rdfcompare , or Cwm .
Datatypes, resources and literals are described as you would expect; bNode representations can be tricky for graph comparisons.
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:rs='http://jena.hpl.hp.com/2003/03/result-set#'> <rs:ResultSet rdf:about=''> <rs:resultVariable>img</rs:resultVariable> <rs:resultVariable>mb</rs:resultVariable> <rs:size rdf:datatype='http://www.w3.org/2000/10/XMLSchema#integer'>2</rs:size> <rs:solution> <rs:ResultSolution> <rs:binding rdf:parseType='Resource'> <rs:variable>img</rs:variable> <rs:value rdf:resource='http://swordfish.rdfweb.org/photos/2001/04/23/000068.JPG'/> </rs:binding> <rs:binding rdf:parseType='Resource'> <rs:variable>mb</rs:variable> <rs:value rdf:resource='mailto:firstname.lastname@example.org' /> </rs:binding> </rs:ResultSolution> </rs:solution> <rs:solution> <rs:ResultSolution> <rs:binding rdf:parseType='Resource'> <rs:variable>img</rs:variable> <rs:value rdf:resource='http://swordfish.rdfweb.org/photos/2001/04/23/000068.JPG'/> </rs:binding> <rs:binding rdf:parseType='Resource'> <rs:variable>mb</rs:variable> <rs:value rdf:resource='mailto:email@example.com' /> </rs:binding> </rs:ResultSolution> </rs:solution> </rs:ResultSet> </rdf:RDF>
These are available here on this site@@ under the W3C license .
They are in three sections: RDFStore donated by Alberto Reggiori of @Semantics, RDQL donated by Andy Seaborne from HP Labs, and Squish donated by Libby Miller, University of Bristol. Jena and RDFStore both use the RDQL RDF query language; Squish is similiar to RDQL but not identical (both are based on the earlier rdfDB QL by R.V. Guha). All have conversions to N-Triples format.
This was a simple, pragmatic solution to the practical problem of testing RDF query with several implementations and query languages. Many issues were never addressed, or were briefly discussed and postponed. Examples are
This work was a collaborative effort amongst members of the RDF (now 'Semantic Web') Interest Group, conducted largely through IRC chat sessions in #rdfig. Details of the meetings are available at RDF Query (and Rule) Testcase Repository. Many people contributed, with tests and documents or with their own implementation and process experience. Here is a non-exhaustive list of people who contributed on IRC or by mailing list.
Andy Seaborne Alberto Reggiori Dan Brickley Jeen Brokestra Jos De Roo Tim Berners-Lee Jan Grant Eric Miller Matt Biddulph Lars Marius Garshol Eric Prud'hommeaux Arjohn Kampman Daniel Krech Dan Connolly Libby Miller
Libby Miller and Dan Brickley's contribution to this work was funded through the SWAD-Europe project .
Libby Miller : firstname.lastname@example.org,
Dan Brickley : email@example.com
$Id: summary.html,v 1.5 2004/03/17 15:56:04 lmiller Exp $