Copyright © 2010 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, and document use rules apply.
This manifest encodes tests for the SPARQL Protocol. Each test record has one or more ht:Requests that must be run in order to produce the expected results. Expected results are encoded in the ht:Response using one of four new terms: * `mf:expectedStatus` - Expected HTTP status code (pointing to values like `ht:StatusCode2xx`); * `mf:expectedBoolean` - Expected results for ASK queries. * `mf:expectedFormat` - Expected serialization format of the results; the range here is one of the literals: `"boolean"`, `"tabular"`, or `"RDF"` * `mf:expectation` - A textual description of the expected results for the single test `update_base_uri` where modeling the expectation would have been prohibitive. Each request has a ht:absolutePath value that starts with `/sparql/`. A program using this manifest data to run the tests must replace this value with whatever path prefix is appropriate for the endpoint being tested. Every ht:absolutePath value in this manifest starts with `/sparql/`, but and endpoint being tested may require different endpoints to be used for Query and Update requests.
This page describes W3C SPARQL Working Group's SPARQL 1.0 test suite.
When accessed without any query parameters, the CGI provides an HTML form that may be used to validate a Protocol implementation. The parameters are:
The following parameters should also be accounted for (in a future version):
It is assumed that the Protocol implementation provides support for all of SPARQL (1.0) and also SPARQL 1.1 Query/Update support for:
The following RDF files are loaded as appropriate to properly setup the graphstore/dataset for some tests:
Finally, it is assumed that implementations can produce application/rdf+xml and application/sparql-results+xml when requested using conneg.
The test manifests and entries are built automatically from manifest.ttl using a Rake task. Tests may be contributed via pull request to https://github.com/w3c/rdf-tests with suitable changes to the manifest.ttl and referenced files.
Distributed under both the W3C Test Suite License and the W3C 3-clause BSD License. To contribute to a W3C Test Suite, see the policies and contribution forms.
UNDER BOTH MUTUALLY EXCLUSIVE LICENSES, THIS DOCUMENT AND ALL DOCUMENTS, TESTS AND SOFTWARE THAT LINK THIS STATEMENT ARE PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.
POST /sparql/?default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata0.rdf HTTP/1.1
Host: www.example
Content-Type: application/x-www-form-urlencoded
Content-Length: 18
query=ASK%20%7B%7D
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
GET /sparql/?query=ASK%20%7B%20%3Chttp%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf%3E%20a%20%3Ftype%20.%20%3Chttp%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf%3E%20a%20%3Ftype%20.%20%7D&default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf&default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
POST /sparql/?default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf&default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
Content-Length: 123
Content-Type: application/sparql-query
ASK { <http://kasei.us/2009/09/sparql/data/data1.rdf> a ?type . <http://kasei.us/2009/09/sparql/data/data2.rdf> a ?type . }
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
POST /sparql/?named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf&named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
Content-Length: 147
Content-Type: application/sparql-query
ASK { GRAPH ?g1 { <http://kasei.us/2009/09/sparql/data/data1.rdf> a ?type } GRAPH ?g2 { <http://kasei.us/2009/09/sparql/data/data2.rdf> a ?type } }
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
GET /sparql/?query=ASK%20%7B%20GRAPH%20%3Fg1%20%7B%20%3Chttp%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf%3E%20a%20%3Ftype%20%7D%20GRAPH%20%3Fg2%20%7B%20%3Chttp%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf%3E%20a%20%3Ftype%20%7D%20%7D&named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf&named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
POST /sparql/?default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata3.rdf&named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf&named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
Content-Length: 209
Content-Type: application/sparql-query
ASK {
<http://kasei.us/2009/09/sparql/data/data3.rdf> a ?type
GRAPH ?g1 { <http://kasei.us/2009/09/sparql/data/data1.rdf> a ?type }
GRAPH ?g2 { <http://kasei.us/2009/09/sparql/data/data2.rdf> a ?type }
}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
POST /sparql/?named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf%26named-graph-uri%3Dhttp%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
Content-Length: 200
Content-Type: application/sparql-query
ASK FROM <http://kasei.us/2009/09/sparql/data/data3.rdf> { GRAPH ?g1 { <http://kasei.us/2009/09/sparql/data/data1.rdf> a ?type } GRAPH ?g2 { <http://kasei.us/2009/09/sparql/data/data2.rdf> a ?type } }
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
GET /sparql/?query=ASK%20%7B%7D&default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata0.rdf HTTP/1.1
Host: www.example
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
POST /sparql/?default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata0.rdf HTTP/1.1
Host: www.example
Content-Length: 23
Content-Type: application/sparql-query
SELECT (1 AS ?value) {}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, text/tab-separated-values, text/csv, or any other valid media type for tabular SPARQL results
POST /sparql/?default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata0.rdf HTTP/1.1
Host: www.example
Content-Length: 5
Content-Type: application/sparql-query
ASK {}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
POST /sparql/?default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata0.rdf HTTP/1.1
Host: www.example
Content-Length: 30
Content-Type: application/sparql-query
DESCRIBE <http://example.org/>
2xx or 3xx response
Content-Type: application/rdf+xml, application/rdf+json, text/turtle, or any other valid media type for RDF results
POST /sparql/?default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata0.rdf HTTP/1.1
Host: www.example
Content-Length: 32
Content-Type: application/sparql-query
CONSTRUCT { <s> <p> 1 } WHERE {}
2xx or 3xx response
Content-Type: application/rdf+xml, application/rdf+json, text/turtle, or any other valid media type for RDF results
POST /sparql/?using-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf HTTP/1.1
Host: www.example
Content-Length: 399
Content-Type: application/sparql-update
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CLEAR ALL ;
INSERT DATA {
GRAPH <http://kasei.us/2009/09/sparql/data/data1.rdf> {
<http://kasei.us/2009/09/sparql/data/data1.rdf> a foaf:Document
}
} ;
INSERT {
GRAPH <http://example.org/protocol-update-dataset-test/> {
?s a dc:BibliographicResource
}
}
WHERE {
?s a foaf:Document
}
2xx or 3xx response
followed by
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 172
Content-Type: application/sparql-query
ASK {
GRAPH <http://example.org/protocol-update-dataset-test/> {
<http://kasei.us/2009/09/sparql/data/data1.rdf> a <http://purl.org/dc/terms/BibliographicResource>
}
}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
POST /sparql/?using-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf&using-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
Content-Length: 645
Content-Type: application/sparql-update
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
DROP ALL ;
INSERT DATA {
GRAPH <http://kasei.us/2009/09/sparql/data/data1.rdf> { <http://kasei.us/2009/09/sparql/data/data1.rdf> a foaf:Document }
GRAPH <http://kasei.us/2009/09/sparql/data/data2.rdf> { <http://kasei.us/2009/09/sparql/data/data2.rdf> a foaf:Document }
GRAPH <http://kasei.us/2009/09/sparql/data/data3.rdf> { <http://kasei.us/2009/09/sparql/data/data3.rdf> a foaf:Document }
} ;
INSERT {
GRAPH <http://example.org/protocol-update-dataset-graphs-test/> {
?s a dc:BibliographicResource
}
}
WHERE {
?s a foaf:Document
}
2xx or 3xx response
followed by
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 484
Content-Type: application/sparql-query
ASK {
GRAPH <http://example.org/protocol-update-dataset-graphs-test/> {
<http://kasei.us/2009/09/sparql/data/data1.rdf> a <http://purl.org/dc/terms/BibliographicResource> .
<http://kasei.us/2009/09/sparql/data/data2.rdf> a <http://purl.org/dc/terms/BibliographicResource> .
}
FILTER NOT EXISTS {
GRAPH <http://example.org/protocol-update-dataset-graphs-test/> {
<http://kasei.us/2009/09/sparql/data/data3.rdf> a <http://purl.org/dc/terms/BibliographicResource> .
}
}
}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
POST /sparql/?using-named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf&using-named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
Content-Length: 676
Content-Type: application/sparql-update
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
DROP ALL ;
INSERT DATA {
GRAPH <http://kasei.us/2009/09/sparql/data/data1.rdf> { <http://kasei.us/2009/09/sparql/data/data1.rdf> a foaf:Document }
GRAPH <http://kasei.us/2009/09/sparql/data/data2.rdf> { <http://kasei.us/2009/09/sparql/data/data2.rdf> a foaf:Document }
GRAPH <http://kasei.us/2009/09/sparql/data/data3.rdf> { <http://kasei.us/2009/09/sparql/data/data3.rdf> a foaf:Document }
} ;
INSERT {
GRAPH <http://example.org/protocol-update-dataset-named-graphs-test/> {
?s a dc:BibliographicResource
}
}
WHERE {
GRAPH ?g {
?s a foaf:Document
}
}
2xx or 3xx response
followed by
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 496
Content-Type: application/sparql-query
ASK {
GRAPH <http://example.org/protocol-update-dataset-named-graphs-test/> {
<http://kasei.us/2009/09/sparql/data/data1.rdf> a <http://purl.org/dc/terms/BibliographicResource> .
<http://kasei.us/2009/09/sparql/data/data2.rdf> a <http://purl.org/dc/terms/BibliographicResource> .
}
FILTER NOT EXISTS {
GRAPH <http://example.org/protocol-update-dataset-named-graphs-test/> {
<http://kasei.us/2009/09/sparql/data/data3.rdf> a <http://purl.org/dc/terms/BibliographicResource> .
}
}
}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
POST /sparql/?using-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf&using-named-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
Content-Length: 779
Content-Type: application/sparql-update
PREFIX dc: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
DROP ALL ;
INSERT DATA {
GRAPH <http://kasei.us/2009/09/sparql/data/data1.rdf> { <http://kasei.us/2009/09/sparql/data/data1.rdf> a foaf:Document }
GRAPH <http://kasei.us/2009/09/sparql/data/data2.rdf> { <http://kasei.us/2009/09/sparql/data/data2.rdf> a foaf:Document }
GRAPH <http://kasei.us/2009/09/sparql/data/data3.rdf> { <http://kasei.us/2009/09/sparql/data/data3.rdf> a foaf:Document }
} ;
INSERT {
GRAPH <http://example.org/protocol-update-dataset-full-test/> {
?s <http://example.org/in> ?in
}
}
WHERE {
{
GRAPH ?g { ?s a foaf:Document }
BIND(?g AS ?in)
}
UNION
{
?s a foaf:Document .
BIND("default" AS ?in)
}
}
2xx or 3xx response
followed by
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 437
Content-Type: application/sparql-query
ASK {
GRAPH <http://example.org/protocol-update-dataset-full-test/> {
<http://kasei.us/2009/09/sparql/data/data1.rdf> <http://example.org/in> "default" .
<http://kasei.us/2009/09/sparql/data/data2.rdf> <http://example.org/in> <http://kasei.us/2009/09/sparql/data/data2.rdf> .
}
FILTER NOT EXISTS {
GRAPH <http://example.org/protocol-update-dataset-full-test/> {
<http://kasei.us/2009/09/sparql/data/data3.rdf> ?p ?o
}
}
}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 16
Content-Type: application/x-www-form-urlencoded
update=CLEAR+ALL
2xx or 3xx response
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 9
Content-Type: application/sparql-update
CLEAR ALL
2xx or 3xx response
POST /sparql/ HTTP/1.1
Host: www.example
Content-Type: application/sparql-update
Content-Length: 174
CLEAR GRAPH <http://example.org/protocol-base-test/> ;
INSERT DATA { GRAPH <http://example.org/protocol-base-test/> { <http://example.org/s> <http://example.org/p> <test> } }
2xx or 3xx response
followed by
POST /sparql/ HTTP/1.1
Host: www.example
Content-Type: application/sparql-query
Content-Length: 123
SELECT ?o WHERE {
GRAPH <http://example.org/protocol-base-test/> {
<http://example.org/s> <http://example.org/p> ?o
}
}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for tabular SPARQL results
one result with `?o` bound to an IRI that is _not_ `<test>`
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 6
Content-Type: application/sparql-query
ASK {}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, or any other valid media type for boolean SPARQL results
true
PUT /sparql/?query=ASK%20%7B%7D&default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata0.rdf HTTP/1.1
Host: www.example
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
4xx
GET /sparql/?query=ASK%20%7B%7D&query=SELECT%20%2A%20%7B%7D HTTP/1.1
4xx
POST /sparql/ HTTP/1.1
Host: www.example
Content-Type: text/plain
Content-Length: 6
ASK {}
4xx
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 18
query=ASK%20%7B%7D
4xx
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 6
ASK {}
4xx
(Content body encoded in utf-16, with a preceding BOM.)
POST /sparql/ HTTP/1.1
Host: www.example
Content-Type: application/sparql-query; charset=UTF-16
Content-Length: 14
ASK {}
4xx
GET /sparql/?query=ASK%20%7B HTTP/1.1
4xx
GET /sparql/?update=CLEAR%20ALL HTTP/1.1
4xx
POST /sparql/ HTTP/1.1
Host: www.example
Content-Type: application/x-www-form-urlencoded
Content-Length: 43
update=CLEAR%20NAMED&update=CLEAR%20DEFAULT
4xx
POST /sparql/ HTTP/1.1
Host: www.example
Content-Type: text/plain
Content-Length: 11
CLEAR NAMED
4xx
POST /sparql/ HTTP/1.1
Host: www.example
Content-Length: 20
update=CLEAR%20NAMED
4xx
(Content body encoded in utf-16, with a preceding BOM.)
POST /sparql/ HTTP/1.1
Host: www.example
Content-Type: application/sparql-update; charset=UTF-16
Content-Length: 24
CLEAR NAMED
4xx
POST /sparql/ HTTP/1.1
Host: www.example
Content-Type: application/x-www-form-urlencoded
Content-Length: 18
update=CLEAR%20XYZ
4xx
POST /sparql/?using-named-graph-uri=http%3A%2F%2Fexample%2Fpeople HTTP/1.1
Host: www.example
Content-Type: application/sparql-update
Content-Length: 203
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
WITH <http://example/addresses>
DELETE { ?person foaf:givenName 'Bill' }
INSERT { ?person foaf:givenName 'William' }
WHERE {
?person foaf:givenName 'Bill'
}
4xx