Copyright © 2010 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, and document use rules apply.
This page describes W3C SPARQL Working Group's SPARQL1.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/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/x-www-url-form-urlencoded
Content-Length: XXX
query=ASK%20%7B%7D
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
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
Host: www.example
User-agent: sparql-client/0.1
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
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
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Content-Length: XXX
ASK { <http://kasei.us/2009/09/sparql/data/data1.rdf> ?p ?o . <http://kasei.us/2009/09/sparql/data/data2.rdf> ?p ?o }
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
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
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Content-Length: XXX
ASK { GRAPH ?g { ?s ?p ?o } }
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
true
GET /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&query=ASK%20%7B%20GRAPH%20%3Fg%20%7B%20%3Fs%20%3Fp%20%3Fo%20%7D%20%7D HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
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
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Content-Length: XXX
SELECT ?g ?x ?s { ?x ?y ?o GRAPH ?g { ?s ?p ?o } }
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
true
POST /sparql/?default-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata2.rdf HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Content-Length: XXX
ASK FROM <http://kasei.us/2009/09/sparql/data/data1.rdf> { <data1.rdf> ?p ?o }
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
true
GET /sparql?query=ASK%20%7B%7D
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
true
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Content-Length: XXX
SELECT (1 AS ?value) {}
2xx or 3xx response
Content-Type: application/sparql-results+xml, application/sparql-results+json, text/tab-separated-values, or text/csv
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Content-Length: XXX
ASK {}
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Content-Length: XXX
DESCRIBE <http://example.org/>
2xx or 3xx response
Content-Type: application/rdf+xml, application/rdf+json or text/turtle
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Content-Length: XXX
CONSTRUCT { <s> <p> 1 } WHERE {}
2xx or 3xx response
Content-Type: application/rdf+xml, application/rdf+json or text/turtle
POST /sparql?using-graph-uri=http%3A%2F%2Fkasei.us%2F2009%2F09%2Fsparql%2Fdata%2Fdata1.rdf HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-update
Content-Length: XXX
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
User-agent: sparql-client/0.1
Accept: application/sparql-results+xml
Content-Type: application/sparql-query
Content-Length: XXX
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
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
User-agent: sparql-client/0.1
Content-Type: application/sparql-update
Content-Length: XXX
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 }
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
User-agent: sparql-client/0.1
Accept: application/sparql-results+xml
Content-Type: application/sparql-query
Content-Length: XXX
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
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
User-agent: sparql-client/0.1
Content-Type: application/sparql-update
Content-Length: XXX
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 }
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
User-agent: sparql-client/0.1
Accept: application/sparql-results+xml
Content-Type: application/sparql-query
Content-Length: XXX
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
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
User-agent: sparql-client/0.1
Content-Type: application/sparql-update
Content-Length: XXX
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 }
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
User-agent: sparql-client/0.1
Accept: application/sparql-results+xml
Content-Type: application/sparql-query
Content-Length: XXX
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
true
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/x-www-url-form-urlencoded
Content-Length: XXX
update=CLEAR%20ALL
2xx or 3xx response
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-update
Content-Length: XXX
CLEAR ALL
2xx or 3xx response
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-update
Content-Length: XXX
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
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Accept: application/sparql-results+xml
Content-Length: XXX
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
one result with `?o` bound to an IRI that is _not_ `<test>`
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-query
Content-Length: XXX
ASK {}
2xx or 3xx response
Content-Type: application/sparql-results+xml or application/sparql-results+json
true
PUT /sparql?query=ASK%20%7B%7D
4xx
GET /sparql?query=ASK%20%7B%7D&query=SELECT%20%2A%20%7B%7D
4xx
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: text/plain
Content-Length: XXX
ASK {}
4xx
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Length: XXX
query=ASK%20%7B%7D
4xx
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Length: XXX
ASK {}
4xx
(content body encoded in utf-16)
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-query; charset=UTF-16
Content-Length: XXX
ASK {}
4xx
GET /sparql?query=ASK%20%7B
4xx
GET /sparql?update=CLEAR%20ALL
4xx
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/x-www-url-form-urlencoded
Content-Length: XXX
update=CLEAR%20NAMED&update=CLEAR%20DEFAULT
4xx
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: text/plain
Content-Length: XXX
CLEAR NAMED
4xx
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Length: XXX
update=CLEAR%20NAMED
4xx
(content body encoded in utf-16)
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-update; charset=UTF-16
Content-Length: XXX
CLEAR NAMED
4xx
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/x-www-url-form-urlencoded
Content-Length: XXX
update=CLEAR%20XYZ
4xx
POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/x-www-url-form-urlencoded
Content-Length: XXX
using-named-graph-uri=http%3A%2F%2Fexample%2Fpeople&update=%09%09PREFIX%20foaf%3A%20%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0A%09%09WITH%20%3Chttp%3A%2F%2Fexample%2Faddresses%3E%0A%09%09DELETE%20%7B%20%3Fperson%20foaf%3AgivenName%20%27Bill%27%20%7D%0A%09%09INSERT%20%7B%20%3Fperson%20foaf%3AgivenName%20%27William%27%20%7D%0A%09%09WHERE%20%7B%0A%09%09%09%3Fperson%20foaf%3AgivenName%20%27Bill%27%0A%09%09%7D%0A
4xx