# SPARQL Graph Store Protocol

Copyright © 2010 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, and document use rules apply.

## Abstract

This page describes W3C SPARQL Working Group's SPARQL 1.0 test suite.

$HOST$ is the host where the Graph Store Protocol implementation is listening

$GRAPHSTORE$ is the path of the URL of the graph store

$NEWPATH$ is the URL returned in the Location HTTP header

HTTP response messages are in the format:

    HTTP Status code
    Headers
    <space>
    Body

### Contributing Tests

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.

### Distribution

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.

### Disclaimer

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.

## Test Descriptions

put__initial_state: PUT - Initial state

  #### Request

      PUT $GRAPHSTORE$/person/1.ttl HTTP/1.1
      Host: $HOST$
      Content-Type: text/turtle; charset=utf-8

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      <http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
          foaf:businessCard [
              a v:VCard;
              v:fn "John Doe"
          ].

  #### Response

  `201 Created`

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
get_of_put__initial_state: GET of PUT - Initial state

  #### Request

      GET $GRAPHSTORE$?graph=$GRAPHSTORE$/person/1.ttl HTTP/1.1
      Host: $HOST$
      Accept: text/turtle

  #### Response

      200 OK
      Content-Type: text/turtle; charset=utf-8
      Content-Length: ...

      <http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
         foaf:businessCard [
              a v:VCard;
              v:fn "John Doe"
         ].

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
put__graph_already_in_store: PUT - graph already in store

  #### Request

      PUT $GRAPHSTORE$/person/1.ttl HTTP/1.1
      Host: $HOST$
      Content-Type: text/turtle; charset=utf-8

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      <http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
          foaf:businessCard [
              a v:VCard;
              v:fn "Jane Doe"
          ].

  #### Response

      204 No Content

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
get_of_put__graph_already_in_store: GET of PUT - graph already in store

  #### Request

      GET $GRAPHSTORE$/person/1.ttl HTTP/1.1
      Host: $HOST$
      Accept: text/turtle

  #### Response

      200 OK
      Content-Type: text/turtle; charset=utf-8
      Content-Length: ...

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      <http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
         foaf:businessCard [
              a v:VCard;
              v:fn "Jane Doe"
         ] .

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
put__default_graph: PUT - default graph

  #### Request

      PUT $GRAPHSTORE$?default HTTP/1.1
      Host: $HOST$
      Content-Type: text/turtle; charset=utf-8

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      []  a foaf:Person;
          foaf:businessCard [
              a v:VCard;
              v:given-name "Alice"
          ] .

  #### Response

      201 Created

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
get_of_put__default_graph: GET of PUT - default graph

  #### Request

      GET $GRAPHSTORE$?default HTTP/1.1
      Host: $HOST$
      Accept: text/turtle

  #### Response

      200 OK
      Content-Type: text/turtle; charset=utf-8
      Content-Length: ...

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      []  a foaf:Person;
          foaf:businessCard [
              a v:VCard;
              v:given-name "Alice"
          ] .

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
put__mismatched_payload: PUT - mismatched payload

  #### Request

      PUT $GRAPHSTORE$/person/1.ttl HTTP/1.1
      Host: $HOST$
      Content-Type: text/turtle; charset=utf-8

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      <http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
          foaf:businessCard [
              a v:VCard;
              v:fn "Jane Doe"
          ].

  #### Response

      400 Bad Request

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
delete__existing_graph: DELETE - existing graph

  #### Request

      DELETE $GRAPHSTORE$/person/2.ttl HTTP/1.1
      Host: $HOST$

  #### Response

      200 OK

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
get_of_delete__existing_graph: GET of DELETE - existing graph

  #### Request

      GET $GRAPHSTORE$/person/2.ttl HTTP/1.1
      Host: $HOST$

  #### Response

      404 Not Found

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
delete__nonexistent_graph: DELETE - non-existent graph

  #### Request

      DELETE $GRAPHSTORE$/person/2.ttl HTTP/1.1
      Host: $HOST$

  #### Response

      404 Not Found

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
post__existing_graph: POST - existing graph
  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
get_of_post__existing_graph: GET of POST - existing graph

  #### Request

      POST $GRAPHSTORE$/person/1.ttl HTTP/1.1
      Host: $HOST$
      Content-Type: text/turtle; charset=utf-8

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .

      <http://$HOST$/$GRAPHSTORE$/person/1> foaf:name "Jane Doe"

  #### Response

      200 OK

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
post__multipart_formdata: POST - multipart/form-data

  #### Request

      POST $GRAPHSTORE$/person/1.ttl HTTP/1.1
      Host: $HOST$
      Content-Type: multipart/form-data; boundary=a6fe4cd636164618814be9f8d3d1a0de

      --a6fe4cd636164618814be9f8d3d1a0de
      Content-Disposition: form-data; name="lastName.ttl"; filename="lastName.ttl"
      Content-Type: text/turtle; charset=utf-8

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      <http://$HOST$/$GRAPHSTORE$/person/1> foaf:familyName "Doe"

      --a6fe4cd636164618814be9f8d3d1a0de
      Content-Disposition: form-data; name="firstName.ttl"; filename="firstName.ttl"
      Content-Type: text/turtle; charset=utf-8

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      <http://$HOST$/$GRAPHSTORE$/person/1> foaf:givenName "Jane"

      --a6fe4cd636164618814be9f8d3d1a0de--

  #### Response

      200 OK

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
get_of_post__multipart_formdata: GET of POST - multipart/form-data

  #### Request

      GET $GRAPHSTORE$/person/1.ttl HTTP/1.1
      Host: $HOST$

  #### Response

      200 OK
      Content-Type: text/turtle; charset=utf-8
      Content-Length: ...

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      <http://$HOST$/$GRAPHSTORE$/person/1> a foaf:Person;
          foaf:name           "Jane Doe";
          foaf:givenName      "Jane";
          foaf:familyName     "Doe";
          foaf:businessCard [
              a               v:VCard;
              v:fn            "Jane Doe"
          ] .

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
post__create__new_graph: POST - create new graph

  #### Request

      POST $GRAPHSTORE$ HTTP/1.1
      Host: $HOST$
      Content-Type: text/turtle; charset=utf-8

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      []  a foaf:Person;
          foaf:businessCard [
              a v:VCard;
              v:given-name "Alice"
          ] .

  #### Response

      201 Created
      Location: $NEWPATH$

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
get_of_post__create__new_graph: GET of POST - create new graph

  #### Request

      GET $NEWPATH$ HTTP/1.1
      Host: $HOST$
      Accept: text/turtle

  #### Response

      200 OK
      Content-Type: text/turtle; charset=utf-8
      Content-Length: ...

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      []  a foaf:Person;
          foaf:businessCard [
              a v:VCard;
              v:given-name "Alice"
          ] .

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
get_of_post__after_noop: GET of POST - after noop

  #### Request

      GET $NEWPATH$ HTTP/1.1
      Host: $HOST$
      Accept: text/turtle

  #### Response

      200 OK
      Content-Type: text/turtle; charset=utf-8
      Content-Length: ...

      @prefix foaf: <http://xmlns.com/foaf/0.1/> .
      @prefix v: <http://www.w3.org/2006/vcard/ns#> .

      []  a foaf:Person;
          foaf:businessCard [
              a v:VCard;
              v:given-name "Alice"
          ] .

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
head_on_an_existing_graph: HEAD on an existing graph

  #### Request

      HEAD $GRAPHSTORE$/person/1.ttl HTTP/1.1
      Host: $HOST$

  #### Response

      200 OK
      Content-Type: text/turtle; charset=utf-8
      Content-Length: ...

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3
head_on_a_nonexisting_graph: HEAD on a non-existing graph

  #### Request

      HEAD $GRAPHSTORE$/person/4.ttl HTTP/1.1
      Host: $HOST$

  #### Response

      404 Not Found

  type
    mf:GraphStoreProtocolTest
  approval
    dawgt:Approved
  approvedBy
    http://www.w3.org/2009/sparql/meeting/2012-11-27#resolution_3