SPARQL protocol

The SPARQL 1.0 Protocol is defined in WSDL.  A query can be sent as 
?query= using GET or the POST equivalent using content type 
application/x-www-form-urlencoded, where the query= can end up in the 
body of the request.

We need to define how to send SPARQL 1.1 Update requests over HTTP.  Use 
of application/x-www-form-urlencoded is problematic because the body is 
the bytes for a form-encoded HTTP request.  This makes it harder to 
process at scale by making streaming harder; some systems will consume 
and parse the entire form body before letting the service access the 
HTTP form, resulting in a in-memory copy.

SPARQL Update requests have the potential to be very large e.g.

INSERT DATA {
   ... lots and lots of triples ...
}

is the way to do inline upload of data.

Directly using HTTP< not via HTML forms, would be better: POST (and 
PATCH) with content-type application/sparql-update, and the request 
directly in the body (POST can still have a query string so it does not 
preclude additional arguments).

But we still may want to define use from an HTML form as well for
It needs the parameter name defined - suggestion "request=" so (1) can 
tell query from update simply and (2) it's a request, not a query.


Proposal:

1/ SPARQL 1.1 Update requests are transmitted by POST (or PATCH) with 
content type "application/sparql-update".  Responses are 200, 400 and 
others as appropriate.

2/ We also describe (non-normative) use with HTML forms with parameter 
"request="

3/ For consistency:
    We also register a MIME type for SPARQL queries 
"application/sparql-query". This is not absolutely necessary but
    it has the useful effect of registering ".rq" for the file extension.
    it can be used when serving SPARQL queries in response to a GET.


 Andy

Received on Thursday, 4 November 2010 12:55:25 UTC