This protocol enables creation of local RDF documents that are deposited to remote servers, over the HTTP protocol. It is important to note that the payload can take any of the following forms:
Here are the steps for creating RDF documents on a remote server, using this protocol, via curl and the /sparql-graph-crud endpoint's HTML form:
Assume the following Raw Data Representation in Turtle that we are going to use in the examples from below:
@prefix: <http://example.org/book/> . @prefix ns: <http://example.org/ns#> . :book1 <http://purl.org/dc/elements/1.1/title> "SPARQL Tutorial" . :book1 ns:price 42 . :book1 ns:discount 0.2 . :book2 <http://purl.org/dc/elements/1.1/title> "The Semantic Web" . :book2 ns:price 23 . :book2 ns:discount 0.25 .
curl --digest --user dba:dba --verbose --url "http://example.com/sparql-graph-crud-auth?graph=urn:graph:update:test:put" -T books.ttl > PUT /sparql-graph-crud-auth?graph=urn:example:put HTTP/1.1 > Authorization: Digest username="dba", realm="SPARQL", nonce="6e1df3edb51389debbe9648a9edd9baa", uri="/sparql-graph-crud-auth?graph=urn:example:i nsert", cnonce="ICAgICAgICAgICAgICAgICAgICAgICAgICA5OTcyOTc=", nc=00000001, qop=auth, response="83de54bda064de2d59bdd5845eac4f8c", opaque="5ebe2294ecd 0e0f08eab7690d2a6ee69", algorithm="MD5" > User-Agent: curl/7.29.0 > Host: example.com > Accept: */* > Content-Length: 337 > Expect: 100-continue > HTTP/1.1 100 Continue > We are completely uploaded and fine > HTTP/1.1 201 Created > Server: Virtuoso/07.00.3203 (Win64) x86_64-generic-win-64 VDB > Connection: Keep-Alive > Content-Type: text/html; charset=UTF-8 > Date: Tue, 30 Jul 2013 08:19:52 GMT > Accept-Ranges: bytes > Content-Length: 0
SELECT * FROM <urn:graph:update:test:put> WHERE { ?s ?p ?o }
curl --digest --user dba:dba --verbose --url "http://example.com/sparql-graph-crud-auth?graph=urn:graph:update:test:get" -T books.ttl
curl --verbose --url "http://example.com/sparql-graph-crud?graph=urn:graph:update:test:get" > GET /sparql-graph-crud?graph=urn:graph:update:test:get HTTP/1.1 > User-Agent: curl/7.29.0 > Host: example.com > Accept: */* > < HTTP/1.1 200 OK < Server: Virtuoso/07.00.3203 (Win64) x86_64-generic-win-64 VDB < Connection: Keep-Alive < Date: Tue, 30 Jul 2013 09:09:18 GMT < Accept-Ranges: bytes < Content-Type: text/turtle; charset=UTF-8 < Content-Length: 291 < @prefix ns0: <http://example.org/ns#> . @prefix ns1: <http://example.org/book/> . ns1:book1 ns0:price 42 ; ns0:discount 0.2 . @prefix dc: <http://purl.org/dc/elements/1.1/> . ns1:book1 dc:title "SPARQL Tutorial" . ns1:book2 ns0:price 23 ; ns0:discount 0.25 ; dc:title "The Semantic Web" .
curl --digest --user dba:dba --verbose --url "http://example.com/sparql-graph-crud-auth?graph=urn:graph:update:test:delete" -T books.ttl
curl --digest --user dba:dba --verbose --url "http://example.com/sparql-graph-crud-auth?graph=urn:graph:update:test:delete" -X DELETE * Server auth using Digest with user 'dba' > DELETE /sparql-graph-crud-auth?graph=urn:graph:update:test:delete HTTP/1.1 > User-Agent: curl/7.29.0 > Host: example.com > Accept: */* < HTTP/1.1 200 OK < Server: Virtuoso/07.00.3203 (Win64) x86_64-generic-win-64 VDB < Connection: Keep-Alive < Content-Type: text/html; charset=UTF-8 < Date: Tue, 30 Jul 2013 09:13:52 GMT < Accept-Ranges: bytes < Content-Length: 0
curl --verbose --url "http://example.com/sparql-graph-crud?graph=urn:graph:update:test:delete" > GET /sparql-graph-crud?graph=urn:graph:update:test:delete HTTP/1.1 > User-Agent: curl/7.29.0 > Host: example.com > Accept: */* > < HTTP/1.1 404 Not Found < Server: Virtuoso/07.00.3203 (Win64) x86_64-generic-win-64 VDB < Connection: Keep-Alive < Content-Type: text/html; charset=UTF-8 < Date: Tue, 30 Jul 2013 09:17:38 GMT < Accept-Ranges: bytes < Content-Length: 0
SELECT * FROM <urn:graph:update:test:delete> WHERE { ?s ?p ?o }
curl --digest --user dba:dba --verbose --url "http://example.com/sparql-graph-crud-auth?graph=urn:graph:update:test:post" -X POST -T books.ttl > POST /sparql-graph-crud-auth?graph=urn:graph:update:test:post HTTP/1.1 > Authorization: Digest username="dba", realm="SPARQL", nonce="5ea29244cf548f6acd927573fc4bace0", uri="/sparql-graph-crud-auth?graph=urn:graph:update:test:post", cnonce="ICAgICAgICAgICAgICAgICAgICAgICAgICAxODgwNjY=", nc=00000001, qop=auth, response="cd5fcd139247a4023441598945ba024b", opaque="5ebe2294ecd0e0f08eab7690d2a6ee69", algorithm="MD5" > User-Agent: curl/7.29.0 > Host: example.com < HTTP/1.1 201 Created < Server: Virtuoso/07.00.3203 (Win64) x86_64-generic-win-64 VDB < Connection: Keep-Alive < Content-Type: text/html; charset=UTF-8 < Date: Tue, 30 Jul 2013 09:39:20 GMT < Accept-Ranges: bytes
curl --verbose --url "http://example.com/sparql-graph-crud?graph=urn:graph:update:test:post" > GET /sparql-graph-crud?graph=urn:graph:update:test:post HTTP/1.1 > User-Agent: curl/7.29.0 > Host: localhost:8890 > Accept: */* > < HTTP/1.1 200 OK < Server: Virtuoso/07.00.3203 (Win64) x86_64-generic-win-64 VDB < Connection: Keep-Alive < Date: Tue, 30 Jul 2013 09:46:12 GMT < Accept-Ranges: bytes < Content-Type: text/turtle; charset=UTF-8 < Content-Length: 291 < @prefix ns0: <http://example.org/ns#> . @prefix ns1: <http://example.org/book/> . ...
SELECT * FROM <urn:graph:update:test:post> WHERE { ?s ?p ?o }