<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE spec SYSTEM "../shared/xmlspec.dtd" [
	<!ENTITY base.uri "http://www.w3.org/TR/2012/">
	<!ENTITY maturity.level "WD">
	<!ENTITY doc.shortname "sparql11-protocol">
	<!ENTITY draft.year "2012">
	<!ENTITY draft.month.name "January">
	<!ENTITY draft.month "01">
	<!ENTITY draft.day "05">
	<!ENTITY iso6.doc.date "&draft.year;&draft.month;&draft.day;">
	<!ENTITY doc.ident "&maturity.level;-&doc.shortname;-&iso6.doc.date;">
	<!ENTITY this.version "&base.uri;&doc.ident;">
<!--
	<!ENTITY xml.version "&doc.ident;.xml">
	<!ENTITY review.version "&doc.ident;-review.html">
	<!ENTITY pdf.version "&doc.ident;.pdf">
	<!ENTITY errataloc "http://www.w3.org/XML/xml-V10-5e-errata">
	<!ENTITY preverrataloc "http://www.w3.org/XML/xml-V10-4e-errata">
	<!ENTITY translationloc "http://www.w3.org/2003/03/Translations/byTechnology?technology=&doc.shortname;">
	<!ENTITY impreploc "http://www.w3.org/XML/2008/01/xml10-5e-implementation.html">
-->
	<!ENTITY versionOfSPARQL "1.1">
	<!ENTITY WebSGML "WebSGML Adaptations Annex to ISO 8879">
	<!ENTITY nbsp "&#160;">
	<!ENTITY mdash "&#x2014;">
	<!ENTITY magicents "<code>amp</code>,
<code>lt</code>,
<code>gt</code>,
<code>apos</code>,
<code>quot</code>">
	<!ENTITY may "may">
	<!ENTITY MAY "<rfc2119>MAY</rfc2119>">
	<!ENTITY % local.common.att "xml:lang    CDATA  #IMPLIED">
]>
<?xml-stylesheet type="text/xsl" href="../shared/REC-xml.xsl"?>
<spec w3c-doctype="ed" xml:lang="en">
	<!--
Notes on preparation of SPARQL 1.1
	
-->
	<header>
		<title>SPARQL 1.1 Protocol</title>
		<w3c-designation>&doc.ident;</w3c-designation>
		<w3c-doctype>W3C Editor's Draft</w3c-doctype>
		<pubdate>
			<day>&draft.day;</day>
			<month>&draft.month.name;</month>
			<year>&draft.year;</year>
		</pubdate>
		<publoc>
			<loc href="&this.version;/">&this.version;/</loc>
		</publoc>
        <!--
		<altlocs>
			<loc href="&amp;xml.version;">XML</loc>
			<loc href="&pdf.version;">PDF</loc>
			<loc href="&amp;review.version;">XHTML with color-coded revision indicators</loc>
		</altlocs>
        -->
		<latestloc>
			<loc href="http://www.w3.org/TR/&doc.shortname;/">http://www.w3.org/TR/&doc.shortname;/</loc>
		</latestloc>
		<prevlocs>
			<!--
				@@FPWD loc
				href="http://www.w3.org/TR/2009/WD-rdf-sparql-protocol-20090915/">http://www.w3.org/TR/2009/WD-rdf-sparql-protocol-20090915/</loc>
			
			<loc href="http://www.w3.org/TR/2008/REC-rdf-sparql-protocol-20080115/">http://www.w3.org/TR/2008/REC-rdf-sparql-protocol-20080115/</loc> -->
                         <!--	loc href="http://www.w3.org/TR/2009/WD-sparql11-protocol-20091022/">http://www.w3.org/TR/2009/WD-sparql11-protocol-20091022/</loc -->
                         <loc href="http://www.w3.org/TR/2010/WD-sparql11-protocol-20100126/">http://www.w3.org/TR/2010/WD-sparql11-protocol-20100126/</loc>
		</prevlocs>
		<authlist>
            <!-- @@ check on David C and Greg W -->
            <!--
			<author role="Editor">
				<name>David Charboneau</name>
				<affiliation>IBM Corporation</affiliation>
				<email href="mailto:dcharbon@us.ibm.com">dcharbon@us.ibm.com</email>
			</author>
            -->
			<author role="Editor">
				<name>Lee Feigenbaum</name>
				<affiliation>Cambridge Semantics</affiliation>
				<email href="mailto:lee@thefigtrees.net">lee@thefigtrees.net</email>
			</author>
			<author role="Editor">
				<name>Gregory Todd Williams</name>
				<affiliation>Rensselaer Polytechnic Institute</affiliation>
				<email href="mailto:greg@evilfunhouse.com">greg@evilfunhouse.com</email>
			</author>
			<author role="Editor">
				<name>Kendall Grant Clark, 1st Edition</name>
				<affiliation>Clark &amp; Parsia LLC</affiliation>
				<email href="mailto:kendall@clarkparsia.com">kendall@clarkparsia.com</email>
			</author>
			<author role="Editor">
				<name>Elias Torres, 1st Edition</name>
				<affiliation>IBM Corporation</affiliation>
				<email href="mailto:eliast@us.ibm.com">eliast@us.ibm.com</email>
			</author>

		</authlist>
        <!--
		<errataloc href="&amp;errataloc;"/>
		<preverrataloc href="&amp;preverrataloc;"/>
		<translationloc href="&amp;translationloc;"/>
        -->
		<abstract>
<p>
The SPARQL Protocol and RDF Query Language (<acronym title="SPARQL Protocol And RDF Query Language">SPARQL</acronym>) is a
query language and protocol for <a href="http://www.w3.org/RDF/">RDF</a>. This document specifies the SPARQL Protocol; it
describes a means for conveying SPARQL queries and updates to a SPARQL
processing service and returning the results via HTTP to the entity that requested them. This protocol was developed by
the <a href="http://www.w3.org/2009/sparql/wiki/Main_Page">W3C SPARQL Working Group</a>, part of
the <a href="http://www.w3.org/2001/sw/">Semantic Web Activity</a> as described in
the <a href="http://www.w3.org/2001/sw/Activity">activity statement</a> .
</p>
		</abstract>
		<status>
		<p>
		<em>This section describes the status of this document at the time of its publication. Other documents may supersede this
		document. A list of current W3C publications and the latest revision of this technical report can be found in
		the <a href="http://www.w3.org/TR/">W3C technical reports index</a> at http://www.w3.org/TR/.</em>
		</p>
		
		<p>This document is a <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#last-call">Last Call Working Draft</a>. Publication as a Last Call Working Draft indicates that the <a href="http://www.w3.org/2001/sw/DataAccess/">SPARQL Working Group</a> believes it has addressed all substantive issues and that the document is stable. The Working Group expects to advance this specification to <a href="http://www.w3.org/2004/02/Process-20040205/tr.html#RecsW3C">Recommendation Status</a>.</p>
		
		<p>The end date of the Last Call review period is <strong>02 February 2012</strong>, i.e., comments on this working draft are due on or before this date.</p>

		<div class="wgNote">
			Given that sufficient implementation experience has already been reported by the time of the next publication round, the SPARQL Working Group is considering to skip <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#RecsCR">Candidate Recommendation</a> phase and advance this specification directly to <a href="http://www.w3.org/2005/10/Process-20051014/tr.html#RecsPR">Proposed Recommendation</a> with its next version.
		</div>

		<p>The set of SPARQL documents comprises:</p>
		<ul>
		<li><a href="http://www.w3.org/TR/sparql11-query/">SPARQL 1.1 Query</a></li>
		<li><a href="http://www.w3.org/TR/sparql11-update/">SPARQL 1.1 Update</a></li>
		<li>SPARQL 1.1 Protocol for RDF (this document)</li>
		<li><a href="http://www.w3.org/TR/sparql11-http-rdf-update/">SPARQL 1.1 Graph Store HTTP Protocol</a></li>
		<li><a href="http://www.w3.org/TR/sparql11-entailment/">SPARQL 1.1 Entailment Regimes</a></li>
		<li><a href="http://www.w3.org/TR/sparql11-service-description/">SPARQL 1.1 Service Description</a></li>
		<li><a href="http://www.w3.org/TR/sparql11-federated-query/">SPARQL 1.1 Federation Extensions</a></li>
		<li><a href="http://www.w3.org/2009/sparql/docs/tests/">SPARQL 1.1 Conformance Tests</a></li>
		<li><!-- <a href="http://www.w3.org/TR//sparql11-results-json/"> -->SPARQL 1.1 Query Results JSON Format (to be published)<!-- </a> --></li>
		<li><a href= "http://www.w3.org/TR/rdf-sparql-XMLres/">SPARQL Query Results XML Format</a></li>
		</ul>
		
		<p>Comments on this document should be sent to <a href="mailto:public-rdf-dawg-comments@w3.org">public-rdf-dawg-comments@w3.org</a>, a mailing list with a <a href="http://lists.w3.org/Archives/Public/public-rdf-dawg-comments/">public archive</a>. Questions and comments about SPARQL that are not related to this specification, including extensions and features, can be discussed on the mailing list <a href="mailto:public-sparql-dev@w3.org">public-sparql-dev@w3.org</a>, (<a href="http://lists.w3.org/Archives/Public/public-sparql-dev">public archive</a>).</p>

		<p>This document was produced by the <a href="http://www.w3.org/2001/sw/DataAccess/">SPARQL Working Group</a>, which is part of the <a href="http://www.w3.org/2001/sw/Activity">W3C Semantic Web Activity</a>.</p>
		
		<p>Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.</p>

		<p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>. W3C maintains a <a rel="disclosure" href="http://www.w3.org/2004/01/pp-impl/35463/status">public list of any patent disclosures</a> made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>.</p>

		<p>Significant changes since the previously published Working Draft are:</p>
		<ul>
		<li>Defined the SPARQL Protocol as an HTTP-only protocol, without reference to WSDL</li>
		<li>Added definitions for the Update operation.</li>
		<li>Added faults for the Update operation.</li>
		</ul>
		
		</status>
		<pubstmt>
			<p>@@@ World-Wide Web Consortium, SPARQL Working Group, 2009.</p>
		</pubstmt>
		<sourcedesc>
			<p>Created in electronic form.</p>
		</sourcedesc>
		<langusage>
			<language id="EN">English</language>
			<language id="ebnf">Extended Backus-Naur Form (formal grammar)</language>
		</langusage>
		<revisiondesc>
			<p role="cvsid">$Id: Overview.xml,v 1.46 2013-03-20 18:07:45 sandro Exp $</p>
		</revisiondesc>

	</header>


	<body>
    		<div1 id="intro">
			<head>Introduction</head>
				<p>
                    This document describes the SPARQL 1.1 Protocol, a means of
                    conveying SPARQL queries and updates from clients to SPARQL processors.
                    The SPARQL Protocol has been designed for compatibility with the <a
                    href="http://www.w3.org/TR/sparql11-query/">SPARQL 1.1 Query
                    Language</a> [<a href="#sparql">SPARQL</a>] and with the <a
                    href="http://www.w3.org/TR/sparql11-update/">SPARQL 1.1
                    Update Language for RDF</a>. This document is
                    primarily intended for software developers interested in implementing
                    SPARQL query and update services and clients.
                 </p>
                 <p>
                    The SPARQL Protocol consists of two HTTP
                    operations: a <a href="#query-operation">query operation</a> for performing SPARQL Query
                    Language queries and an <a href="#update-operation">update operation</a> for performing
                    SPARQL Update Language requests.  SPARQL Protocol clients send HTTP
                    requests to SPARQL Protocol services that handle the request and send
                    HTTP responses back to the originating client. 
				</p>
				<p>
				A separate document describes the <a href="http://www.w3.org/TR/sparql11-http-rdf-update/">SPARQL 1.1 Graph Store HTTP Protocol</a> 
                which describes the use of HTTP operations for the purpose of managing a collection of graphs in the REST architectural style.
				</p>
                <div2 id="conventions">
                <head>Document Conventions</head>
				<p>
					When this document uses the words <strong>must</strong>,
					<strong>must not</strong>, <strong>should</strong>, <strong>should not</strong>,
					<strong>may</strong> and <strong>recommended</strong>, and the words appear as
					emphasized text, they must be interpreted as described in
					<a href="http://www.faqs.org/rfcs/rfc2119.html">RFC 2119</a> [<a href="#rfc2119">RFC2119</a>].
				</p>
                </div2>
                <div2 id="terminology">
                <head>Terminology</head>
                <dl>
                <dt>SPARQL Protocol client</dt>
                    <dd>An HTTP client (as defined by <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec1.html#sec1.3">RFC 2616</a> [<a href="#rfc2616">RFC2616</a>]) that sends HTTP requests for SPARQL
                    Protocol operations. (Also known as: <em>client</em>)</dd>
                <dt>SPARQL Protocol service</dt>
                    <dd>An HTTP server that services HTTP requests and sends back HTTP
                    responses for SPARQL Protocol operations. The URI at which a SPARQL Protocol 
                    service listens for requests is generally known as a SPARQL endpoint.
                    (Also known as: <em>service</em>)</dd>
                <dt>SPARQL endpoint</dt>
                    <dd>The URI at which a SPARQL Protocol service listens for requests
                    from SPARQL Protocol clients.</dd>
                <dt>SPARQL Protocol operation</dt>
                    <dd>An HTTP request and response that conform to the protocol defined
                    in this document.</dd>
                <dt>RDF Dataset</dt>
                    <dd>A collection of a default graph and zero or more named graphs, as
                    defined by the <a href="http://www.w3.org/TR/sparql11-query/#rdfDataset">SPARQL 1.1 Query Language</a>.</dd>
                </dl>
                </div2>
			</div1>
			<div1 id="protocol">
				<head>SPARQL Protocol Operations</head>
                <p>
                    The SPARQL Protocol consists of two operations: query and update. 
                    A protocol operation defines combinations of:
                </p>
                <ul>
                  <li>The HTTP method by which the request is sent.</li>
                  <li>The HTTP query string parameters included in the HTTP request URI.</li>
                  <li>The message content included in the HTTP request body.</li>
                  <li>The message content included in the HTTP response body.</li>
                </ul>
				
				<p> The SPARQL 1.1 Protocol is built on top of HTTP. All HTTP requirements 
				for requests and responses <strong>must</strong> be followed.</p>
                    
    			<div2 id="query-operation">
					<head><code>query</code> operation</head>
                    <p>
                        The <code>query</code> operation is used to send a SPARQL query
                        to a service and receive the results of the query. The query
                        operation <strong>MUST</strong> be invoked with either the HTTP
                        GET or HTTP POST method. Client requests for this operation <strong>must</strong> include
                        exactly one SPARQL query string (parameter name:
                        <code>query</code>) and <strong>may</strong> include
                        zero or more default graph URIs (parameter name:
                        <code>default-graph-uri</code>) and named graph URIs (parameter
                        name: <code>named-graph-uri</code>). The
                        response to a query request is either the <a href="http://www.w3.org/TR/rdf-sparql-XMLres/">SPARQL XML Results
                        Format</a>, the <a href="http://www.w3.org/TR/sparql11-results-json/">SPARQL JSON Results Format</a>, the <a href="http://www.w3.org/TR/sparql11-results-csv-tsv/">SPARQL CSV/TSV Results Format</a>, or an RDF
                        serialization, depending on the <a href="http://www.w3.org/TR/sparql11-query/#QueryForms">query form</a> [<a href="#sparql">SPARQL</a>] and <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html">content
                        negotiation</a> [<a href="#rfc2616">RFC2616</a>].
                    </p>
                    <table id="query-summary" style="margin-left: auto; margin-right:
                    auto; border-color: rgb(0, 0, 0); border-collapse: collapse;" border="1" cellpadding="5">
                    <tr>
                        <th>&nbsp;</th>
                        <th>HTTP Method</th>
                        <th>Query String Parameters</th>
                        <th>Request Content Type</th>
                        <th>Request Message Body</th>
                    </tr>
                    <tr>
                        <th>query via GET</th>
                        <td>GET</td>
                        <td><code>query</code> (exactly 1)<br/>
                            <code>default-graph-uri</code> (0 or more)<br/>
                            <code>named-graph-uri</code> (0 or more)</td>
                        <td>None</td>
                        <td>None</td>
                    </tr>
                    <tr>
                        <th>query via URL-encoded POST</th>
                        <td>POST</td>
                        <td>None</td>
                        <td><code>application/x-www-form-urlencoded</code></td>
                        <td>URL-encoded, ampersand-separated query parameters.<br/>
                            <code>query</code> (exactly 1)<br/>
                            <code>default-graph-uri</code> (0 or more)<br/>
                            <code>named-graph-uri</code> (0 or more)</td>
                    </tr>
                    <tr>
                        <th>query via POST directly</th>
                        <td>POST</td>
                        <td><code>default-graph-uri</code> (0 or more)<br/>
                            <code>named-graph-uri</code> (0 or more)</td>
                        <td><code>application/sparql-query</code></td>
                        <td>Unencoded SPARQL query string</td>
                    </tr>
                    </table>
                                
                    <p>
                        The <code>query</code> request's parameters <strong>must</strong> be sent
                        according to one of these three options:
                    </p>
                  <div3 id="query-via-get">
                    <head><code>query</code> via GET</head>

                    <p>Protocol clients <strong>may</strong> send protocol requests via
                    the HTTP GET method. When using the GET method, clients <strong>must</strong> URL <a href="http://www.ietf.org/rfc/rfc3986.txt">percent encode</a> all parameters and include them as <a href="http://www.ietf.org/rfc/rfc3986.txt">query parameter</a> strings with the names given above [<a href="#rfc3986">RFC3986</a>].</p>
                    <p>
                        HTTP query string parameters <strong>must</strong> be separated with
                        the ampersand (<code>&amp;</code>) character. Clients may include
                        the query string parameters in any order.
                    </p>
                    <p>The HTTP request <strong>MUST NOT</strong> include a message body.</p>
                  </div3>
                    
                  <div3 id="query-via-post-urlencoded">
                    <head><code>query</code> via POST with URL-encoded parameters</head>

                    <p>
                        Protocol clients <strong>may</strong> send protocol requests via
                        the HTTP POST method by URL encoding the parameters. When using
                        this method, clients <strong>must</strong> URL <a href="http://www.ietf.org/rfc/rfc3986.txt">percent encode</a> [<a href="#rfc3986">RFC3986</a>] all
                        parameters and include them as parameters within the request body
                        via the <code>application/x-www-form-urlencoded</code> media type
                        with the name given above.
                        Parameters <strong>must</strong> be separated with
                        the ampersand (<code>&amp;</code>) character. Clients may include
                        the parameters in any order. The content type header of the HTTP
                        request <strong>must</strong> be set to
                        <code>application/x-www-form-urlencoded</code>.
                    </p>
                  </div3>

                  <div3 id="query-via-post-direct">
                    <head><code>query</code> via POST directly</head>

                    <p>
                        Protocol clients <strong>may</strong> send protocol requests via
                        the HTTP POST method by including the query directly and unencoded
                        as the HTTP request message body. When using this approach, clients
                        <strong>must</strong> include the SPARQL query string, unencoded,
                        and nothing else as the message body of the request. Clients
                        <strong>must</strong> set the content type header of the HTTP
                        request to <code>application/sparql-query</code>. Clients
                        <strong>may</strong> include the optional
                        <code>default-graph-uri</code> and <code>named-graph-uri</code>
                        parameters as HTTP query string parameters in the request URI. Note that UTF-8 is the only valid charset here.
                    </p>
                   </div3>
					
				<div3 id="dataset">
					<head>Specifying an RDF Dataset</head>
					
					<p>A SPARQL query is executed against an <a
                    href="http://www.w3.org/TR/sparql11-query/#rdfDataset">RDF
                    Dataset</a>. The RDF Dataset for a query may be specified either via the
                    <code>default-graph-uri</code> and <code>named-graph-uri</code>
                    parameters in the SPARQL Protocol or in the SPARQL query string using 
					the <code>FROM</code> and <code>FROM NAMED</code>
					keywords.
                    If different RDF Datasets are specified in both the protocol request and the
                    SPARQL query string, then the SPARQL service <strong>must</strong>
                    execute the query using the RDF Dataset given in the protocol request.</p>
                    
                    <p>Note that a service <strong>may</strong> reject a query with HTTP response code 
					400 if the service does not allow protocol clients to specify the RDF Dataset.</p>
                    
                    <p>If an RDF Dataset is not specified in either the protocol request
                    or the SPARQL query string, then implementations <strong>may</strong>
                    execute the query against an implementation-defined default RDF
                    dataset.</p>
				</div3>

                <div3 id="conneg">
                    <head>Accepted Response Formats</head>

                    <p>Protocol clients <strong>should</strong> use HTTP <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec12.html">content
                        negotiation</a> [<a href="#rfc2616">RFC2616</a>] to request response formats that the client can
                    consume. See below for more on potential response formats.</p>
                </div3>
				
					<div3 id="query-success">
						<head>Success Responses</head>
						<p>
                           The SPARQL Protocol uses the response status codes defined in HTTP to
                           indicate the success or failure of an operation.  Consult the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">HTTP
                           specification</a> [<a href="#rfc2616">RFC2616</a>] for detailed definitions of each status code.
                        While a protocol service <strong>should</strong> use a 2XX HTTP
                        response code for a successful query, it <strong>may</strong>
                        choose instead to use a 3XX response code as per HTTP.
                        </p>

						<p>The response body of a successful query operation with a 2XX response is either:</p>
						<ul>
							<li>a SPARQL Results Document in <a href="http://www.w3.org/TR/rdf-sparql-XMLres/">XML</a>, <a href="http://www.w3.org/TR/sparql11-results-json/">JSON</a>, or <a href="http://www.w3.org/TR/sparql11-results-csv-tsv/">CSV/TSV</a> format (for SPARQL 
							Query forms <a href="http://www.w3.org/2001/sw/DataAccess/rq23/#select">SELECT</a>
							and <a href="http://www.w3.org/2001/sw/DataAccess/rq23/#ask">ASK</a>); or,</li>
							<li>an RDF graph [<a href="#rdf-concepts">RDF-CONCEPTS</a>] serialized, for example, in the <a href="http://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML syntax</a> [<a href="#rdf-xml">RDF-XML</a>], or an equivalent RDF graph serialization, for SPARQL Query forms <a href="http://www.w3.org/2001/sw/DataAccess/rq23/#describe">DESCRIBE</a> and <a href="http://www.w3.org/2001/sw/DataAccess/rq23/#construct">CONSTRUCT</a>).</li>
						</ul>
						<p>The content type of the response to a successful query operation must be the media type defined for the format of the response body.</p>
					</div3>
					<div3 id="query-failure">
						<head>Failure Responses</head>
						<p>The HTTP response codes applicable to an unsuccessful query operation include:</p>
						<ul>
							<li>400 if the SPARQL query supplied in the request is not a legal sequence of characters in the language defined by the SPARQL grammar; or,</li>
							<li>500 if the service fails to execute the query. SPARQL
                            Protocol services may also return a 500 response code if they
                            refuse to execute a query. This
                            response does not indicate whether the server may or may not
                            process a subsequent, identical request or requests. </li>

						</ul>

						<p>The response body of a failed query request is
                        implementation defined. Implementations <strong>may</strong> use
                        HTTP content negotiation to provide human-readable or
                        machine-processable (or both) information about the failed query
                        request.</p>
                        <p>A protocol service <strong>may</strong> use other 4XX or 5XX HTTP response codes for other failure conditions, as per HTTP.</p>
					</div3>

				</div2>
				
				
				
				<div2 id="update-operation">
					<head><code>update</code> operation</head>
					<p>
                        The <code>update</code> operation is used to send a SPARQL update
                        request to a service. The
                        update operation <strong>must</strong> be invoked using the HTTP POST
                        method.
                        Client requests for this operation <strong>must</strong> include
                        exactly one SPARQL update request string (parameter name:
                        <code>update</code>) and <strong>may</strong> include
                        zero or more default graph URIs (parameter name:
                        <code>using-graph-uri</code>) and named graph URIs (parameter
                        name: <code>using-named-graph-uri</code>). The
                        response to an update request indicates success or failure of the
                        request via HTTP response status code. 
                    </p>
                    <table id="update-summary" style="margin-left: auto; margin-right:
                    auto; border-color: rgb(0, 0, 0); border-collapse: collapse;" border="1" cellpadding="5">
                    <tr>
                        <th>&nbsp;</th>
                        <th>HTTP Method</th>
                        <th>Query String Parameters</th>
                        <th>Request Content Type</th>
                        <th>Request Message Body</th>
                    </tr>
                    <tr>
                        <th>update via URL-encoded POST</th>
                        <td>POST</td>
                        <td>None</td>
                        <td><code>application/x-www-form-urlencoded</code></td>
                        <td>URL-encoded, ampersand-separated query parameters.<br/>
                            <code>update</code> (exactly 1)<br/>
                            <code>using-graph-uri</code> (0 or more)<br/>
                            <code>using-named-graph-uri</code> (0 or more)</td>
                    </tr>
                    <tr>
                        <th>update via POST directly</th>
                        <td>POST</td>
                        <td><code>using-graph-uri</code> (0 or more)<br/>
                            <code>using-named-graph-uri</code> (0 or more)</td>
                        <td><code>application/sparql-update</code></td>
                        <td>Unencoded SPARQL update request string</td>
                    </tr>
                    </table>
                                
                    <p>
                        The <code>update</code> request's parameters <strong>must</strong> be sent
                        according to one of these two options:
                    </p>
                    
                  <div3 id="update-via-post-urlencoded">
                    <head><code>update</code> via POST with URL-encoded parameters</head>

                    <p>
                        Protocol clients <strong>may</strong> send update protocol requests via
                        the HTTP POST method by URL encoding the parameters. When using
                        this approach, clients <strong>must</strong> URL <a href="http://www.ietf.org/rfc/rfc3986.txt">percent encode</a> [<a href="#rfc3986">RFC3986</a>] all
                        parameters and include them as parameters within the request body
                        via the <code>application/x-www-form-urlencoded</code> media type
                        with the name given above.
                        Parameters <strong>must</strong> be separated with
                        the ampersand (<code>&amp;</code>) character. Clients may include
                        the parameters in any order. The content type header of the HTTP
                        request <strong>must</strong> be set to
                        <code>application/x-www-form-urlencoded</code>.
                    </p>
                  </div3>

                  <div3 id="update-via-post-direct">
                    <head><code>update</code> via POST directly</head>

                    <p>
                        Protocol clients <strong>may</strong> send update protocol requests via
                        the HTTP POST method by including the update request directly and unencoded
                        as the HTTP request message body. When using this approach, clients
                        <strong>must</strong> include the SPARQL update request string, unencoded,
                        and nothing else as the message body of the request. Clients
                        <strong>must</strong> set the content type header of the HTTP
                        request to <code>application/sparql-update</code>. Clients
                        <strong>may</strong> include the optional
                        <code>using-graph-uri</code> and <code>using-named-graph-uri</code>
                        parameters as HTTP query string parameters in the request URI.
                    </p>
                   </div3>
					
				<div3 id="update-dataset">
					<head>Specifying an RDF Dataset</head>
					
                    <p>SPARQL Update requests are executed against a Graph Store, a mutable container of RDF graphs managed by a SPARQL service. The <code>WHERE</code> clause of a SPARQL update <a href="http://www.w3.org/TR/sparql11-update/#deleteInsert">DELETE/INSERT operation</a> [<a href="#update">UPDATE</a>]  
                    matches against data in an <a
                    href="http://www.w3.org/TR/sparql11-query/#rdfDataset">RDF
                    Dataset</a>, which is a subset of the Graph Store. The RDF Dataset for an update operation may be specified
                    either in the operation string itself
                    using the <code>USING</code>, <code>USING NAMED</code>, and/or <code>WITH</code>
					keywords, or it may be specified via the
                    <code>using-graph-uri</code> and <code>using-named-graph-uri</code>
                    parameters.</p>

                    <p>It is an error to supply the <code>using-graph-uri</code> or <code>using-named-graph-uri</code> parameters
                    when using this protocol to convey a SPARQL 1.1 Update request that contains an operation that uses the
                    <code>USING</code>, <code>USING NAMED</code>, or <code>WITH</code> clause.</p>

                    <p>A SPARQL Update processor should treat each occurrence of the <code>using-graph-uri=g</code> parameter in an 
                    update protocol operation as if a <code>USING &lt;g></code> clause were included for every operation in the SPARQL 1.1
                    Update request. Similarly, a SPARQL Update processor should treat each occurrence of the <code>using-named-graph-uri=g</code>
                    parameter in an update protocol operation as if a <code>USING NAMED &lt;g></code> clause were included for every operation in
                    the SPARQL 1.1 Update request.</p>
				</div3>

					<div3 id="update-success">
						<head>Success Responses</head>
						<p>
                           The SPARQL Protocol uses the response status codes defined in HTTP to
                           indicate the success or failure of an operation.  Consult the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">HTTP
                           specification</a> [<a href="#rfc2616">RFC2616</a>] for detailed definitions of each status code.
                        While a protocol service <strong>should</strong> use a 2XX HTTP
                        response code for an update request that is successfully processed, 
                        it <strong>may</strong>
                        choose instead to use a 3XX response code as per HTTP.
                        </p>

						<p>The response body of a successful update request is
                        implementation defined. Implementations <strong>may</strong> use
                        HTTP content negotiation to provide both human-readable and
                        machine-processable information about the completed update
                        request.</p>
					</div3>
					<div3 id="update-failure">
						<head>Failure Responses</head>
						<p>The HTTP response code for an unsuccessful update request should be:</p>
						<ul>
							<li>400 if the SPARQL update request string is not a legal sequence of
                            characters in the language defined by the SPARQL Update grammar; or,</li>
							<li>500 if the service fails to execute the update request. SPARQL
                            Protocol services may also return a 500 response code if they
                            refuse to execute an update request. This
                            response does not indicate whether the server may or may not
                            process a subsequent, identical request or requests.</li>

						</ul>
						<p>The response body of a failed update request is
                        implementation defined. Implementations <strong>may</strong> use
                        HTTP content negotiation to provide human-readable or
                        machine-processable (or both) information about the failed update
                        request.</p>
                        <p>A protocol service <strong>may</strong> use other 4XX or 5XX HTTP response codes for other failure conditions, as per HTTP.</p>
					</div3>
              </div2>
				<div2 id="base-iri">
					<head>Determining the Base IRI</head>

					<p>The <code>BASE</code> keyword in a SPARQL query or a SPARQL
                    update request string defines the Base IRI used to resolve relative
                    IRIs per <a href="http://www.ietf.org/rfc/rfc3986.txt">Uniform
                    Resource Identifier (URI): Generic Syntax</a> [<a
                    href="#rfc3986">RFC3986</a>] section 5.1.1, "Base URI Embedded in
                    Content". 
                    The SPARQL Protocol
                    does not dereference query URIs so section 5.1.3 does not apply.
                    Finally, per section 5.1.4, SPARQL Protocol services <strong>must</strong> define their
                    own base URI, which <strong>may</strong> be the service endpoint.</p>
				</div2>
		</div1>
		
        <div1 id="examples">
            <head>Example SPARQL Protocol Requests (informative)</head>

            <p>The following HTTP trace examples illustrate invocation of the
            <code>query</code> and <code>update</code> operations under several different scenarios. Some example traces are abstracted from complete HTTP traces in these ways:</p>
            <ol>
				<li>In some examples the string "<i>EncodedQuery</i>" represents the URL-encoded string equivalent of the SPARQL query string given in the example; the string "<i>UnencodedQuery</i>" represents the exact SPARQL query string given in the example without any encoding.</li>
            	<li>For <code>query</code> operation examples, only partial response bodies, containing the query results, are displayed.</li>
            </ol>

		<div2 id="query-bindings-http-examples">
			<head>Examples of SPARQL Query</head>


					<div3 id="select-svcsupplied">
						<head>SELECT with service-supplied RDF Dataset</head>

<p>This SPARQL query</p>
<div id="div-select-svcsupplied">
<pre class="query">PREFIX dc: &lt;http://purl.org/dc/elements/1.1/> 
SELECT ?book ?who 
WHERE { ?book dc:creator ?who }</pre>

<p>is conveyed via HTTP GET to the SPARQL query
service, <tt>http://www.example/sparql/</tt>, as illustrated in this
HTTP trace:</p>

<pre class="req">GET /sparql/?<b>query</b>=PREFIX%20dc%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%20%0ASELECT%20%3Fbook%20%3Fwho%20%0AWHERE%20%7B%20%3Fbook%20dc%3Acreator%20%3Fwho%20%7D%0A HTTP/1.1
Host: www.example
User-agent: my-sparql-client/0.1</pre>

<p>That query against the service-supplied RDF Dataset, executed by
that SPARQL query service, returns the following query result:</p>

<pre class="resp">HTTP/1.1 200 OK
Date: Fri, 06 May 2005 20:55:12 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: application/sparql-results+xml

&lt;?xml version="1.0"?>
&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#">

 &lt;head>
   &lt;variable name="book"/>
   &lt;variable name="who"/>
 &lt;/head>
 &lt;results>
   &lt;result>
     &lt;binding name="book">&lt;uri>http://www.example/book/book5&lt;/uri>&lt;/binding>
     &lt;binding name="who">&lt;bnode>r29392923r2922&lt;/bnode>&lt;/binding>
   &lt;/result>
...<span class="hide">
   &lt;result>
     &lt;binding name="book">&lt;uri>http://www.example/book/book6&lt;/uri>&lt;/binding>
     &lt;binding name="who">&lt;bnode>r8484882r49593&lt;/bnode>&lt;/binding>
   &lt;/result>
 &lt;/results></span>
&lt;/sparql> </pre>
</div>

					</div3>
					<div3 id="select-simple">
						<head>SELECT with simple RDF Dataset</head>

<p>This SPARQL query</p>
<div id="div-select-simple">
<pre class="query">PREFIX dc: &lt;http://purl.org/dc/elements/1.1/> 
SELECT ?book ?who 
WHERE { ?book dc:creator ?who }</pre>

<p>is conveyed to the SPARQL query
service, <tt>http://www.other.example/sparql/</tt>, as illustrated in
this HTTP trace:</p>

<pre class="req">GET /sparql/?<b>query</b>=PREFIX%20dc%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E%20%0ASELECT%20%3Fbook%20%3Fwho%20%0AWHERE%20%7B%20%3Fbook%20dc%3Acreator%20%3Fwho%20%7D%0A&amp;<b>default-graph-uri</b>=http%3A%2F%2Fwww.other.example%2Fbooks HTTP/1.1
Host: www.other.example
User-agent: my-sparql-client/0.1
</pre>

<p>That query &#8212; against the RDF Dataset identified by the value
  of the <code>default-graph-uri</code>
  parameter, <tt>http://www.other.example/books</tt> &#8212; executed
  by that SPARQL query service, returns the following query
  result:</p>

<pre class="resp">HTTP/1.1 200 OK
Date: Fri, 06 May 2005 20:55:12 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: application/sparql-results+xml

&lt;?xml version="1.0"?>
&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#">
 &lt;head>
   &lt;variable name="book"/>
   &lt;variable name="who"/>
 &lt;/head>
...<span class="hide">
 &lt;results>
   &lt;result>
     &lt;binding name="book">&lt;uri>http://www.example/book/book2&lt;/uri>&lt;/binding>
     &lt;binding name="who">&lt;bnode>r1115396427r1133&lt;/bnode>&lt;/binding>
   &lt;/result>
   &lt;result>
     &lt;binding name="book">&lt;uri>http://www.example/book/book3&lt;/uri>&lt;/binding>
     &lt;binding name="who">&lt;bnode>r1115396427r1133&lt;/bnode>&lt;/binding>
   &lt;/result>
   &lt;result>
     &lt;binding name="book">&lt;uri>http://www.example/book/book1&lt;/uri>&lt;/binding>
     &lt;binding name="who">&lt;literal>J.K. Rowling&lt;/literal>&lt;/binding>
   &lt;/result>
 &lt;/results></span>
&lt;/sparql> </pre>
</div>

					</div3>
					<div3 id="construct-simple">
						<head>CONSTRUCT with simple RDF
    dataset and HTTP content negotiation</head>

<p>This SPARQL query</p>
<div id="div-construct-simple">
<pre class="query">PREFIX rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/>
PREFIX myfoaf: &lt;http://www.example/jose/foaf.rdf#>

CONSTRUCT { myfoaf:jose foaf:depiction &lt;http://www.example/jose/jose.jpg>.
            myfoaf:jose foaf:schoolHomepage &lt;http://www.edu.example/>.
            ?s ?p ?o.}
WHERE { ?s ?p ?o. myfoaf:jose foaf:nick "Jo".
       FILTER ( ! (?s = myfoaf:kendall &amp;&amp; ?p = foaf:knows &amp;&amp; ?o = myfoaf:edd ) 
              &amp;&amp; ! ( ?s = myfoaf:julia &amp;&amp; ?p = foaf:mbox &amp;&amp; ?o = &lt;mailto:julia@mail.example> )
	      &amp;&amp; ! ( ?s = myfoaf:julia &amp;&amp; ?p = rdf:type &amp;&amp; ?o = foaf:Person))
}</pre>

<p>is conveyed to the SPARQL query
service, <tt>http://www.example/sparql/</tt>, as illustrated in this
HTTP trace:</p>

<pre class="req">GET /sparql/?<b>query</b>=<i>EncodedQuery</i>&amp;<b>default-graph-uri</b>=http%3A%2F%2Fwww.example%2Fjose-foaf.rdf HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Accept: text/turtle, application/rdf+xml</pre>

<p>With the response illustrated here:</p>

<pre class="resp">HTTP/1.1 200 OK
Date: Fri, 06 May 2005 20:55:11 GMT
Server: Apache/1.3.29 (Unix)
Connection: close
Content-Type: text/turtle

@prefix rdf: &lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix foaf: &lt;http://xmlns.com/foaf/0.1/>.
@prefix myfoaf: &lt;http://www.example/jose/foaf.rdf#>.

myfoaf:jose foaf:name "Jose Jime&#241;ez";
	    foaf:depiction &lt;http://www.example/jose/jose.jpg>;
            foaf:nick "Jo";
...<span class="hide">
	    foaf:schoolHomepage &lt;http://www.edu.example/>;
            foaf:workplaceHomepage &lt;http://www.corp.example/>;
            foaf:homepage &lt;http://www.example/jose/>;
            foaf:knows myfoaf:juan;
	    rdf:type foaf:Person.

myfoaf:juan foaf:mbox &lt;mailto:juan@mail.example>;
	   rdf:type foaf:Person.</span></pre>

<p><em>Note:</em> registration for the media type <tt>text/turtle</tt> was started but not completed at the time of this
publication. Please see <a href="http://www.w3.org/TR/turtle">http://www.w3.org/TR/turtle</a> for the final
registered media type for the Turtle language.</p>
</div>

					</div3>
					<div3 id="ask-simple">
						<head>ASK with simple RDF Dataset</head>

<p>This SPARQL query</p>
<div id="div-ask-simple">
<pre class="query">PREFIX dc: &lt;http://purl.org/dc/elements/1.1/> 
ASK WHERE { ?book dc:creator "J.K. Rowling"}</pre>

<p>is conveyed to the SPARQL query
service, <tt>http://www.example/sparql/</tt>, as illustrated in this
HTTP trace:</p>

<pre class="req">GET /sparql/?<b>query</b>=<i>EncodedQuery</i>&amp;<b>default-graph-uri</b>=http%3A%2F%2Fwww.example%2Fbooks HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
</pre>

<p>With the response illustrated here:</p>

<pre class="resp">HTTP/1.1 200 OK
Date: Fri, 06 May 2005 20:48:25 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: application/sparql-results+xml

&lt;?xml version="1.0"?>
&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#">
 &lt;head>&lt;/head>
 &lt;boolean>true&lt;/boolean>
&lt;/sparql></pre>
</div>

					</div3>
					<div3 id="describe-simple">
						<head>DESCRIBE with simple RDF Dataset</head>

<p>This SPARQL query</p>
<div id="div-describe-simple">
<pre class="query">PREFIX books: &lt;http://www.example/book/>
DESCRIBE books:book6</pre>

<p>is conveyed to the SPARQL query
service, <tt>http://www.example/sparql/</tt>, as illustrated here:</p>

<pre class="req">GET /sparql/?<b>query</b>=<i>EncodedQuery</i>&amp;<b>default-graph-uri</b>=http%3A%2F%2Fwww.example%2Fbooks HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1</pre>

<p>With the response illustrated here:</p>

<pre class="resp">HTTP/1.1 200 OK
Date: Wed, 03 Aug 2005 12:48:25 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type:  application/rdf+xml

&lt;?xml version="1.0"?>
&lt;rdf:RDF 
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:books="http://www.example/book/"
    xmlns:dc="http://purl.org/dc/elements/1.1/" >
  &lt;rdf:Description rdf:about="http://www.example/book/book6">
    &lt;dc:title>Example Book #6 &lt;/dc:title>
  &lt;/rdf:Description>
&lt;/rdf:RDF></pre>
</div>

					</div3>
					<div3 id="select-complex">
						<head>SELECT with complex RDF Dataset</head>

<p>This SPARQL query</p>
<div id="div-select-complex">
<pre class="query">PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/>
PREFIX dc: &lt;http://purl.org/dc/elements/1.1/>

SELECT ?who ?g ?mbox
WHERE {  ?g dc:publisher ?who .
   GRAPH ?g { ?x foaf:mbox ?mbox }
}</pre>

<p>is conveyed to the SPARQL query service, http://www.example/sparql/,
  as illustrated here (with line breaks for legibility):</p>

<pre class="req">GET /sparql/?<b>query</b>=<i>EncodedQuery</i>&amp;<b>default-graph-uri</b>=http%3A%2F%2Fwww.example%2Fpublishers
&amp;<b>default-graph-uri</b>=http%3A%2F%2Fwww.example%2Fmorepublishers&amp;<b>named-graph-uri</b>=http%3A%2F%2Fyour.example%2Ffoaf-alice
&amp;<b>named-graph-uri</b>=http%3A%2F%2Fwww.example%2Ffoaf-bob&amp;<b>named-graph-uri</b>=http%3A%2F%2Fwww.example%2Ffoaf-susan
&amp;<b>named-graph-uri</b>=http%3A%2F%2Fthis.example%2Fjohn%2Ffoaf
Host: www.example
User-agent: sparql-client/0.1</pre>

<p>With the response illustrated here:</p>

<pre class="resp">HTTP/1.1 200 OK
Date: Wed, 03 Aug 2005 12:48:25 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type:  application/sparql-results+xml

&lt;?xml version="1.0"?>
&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#">
  &lt;head>
    &lt;variable name="who"/>
    &lt;variable name="g"/>
    &lt;variable name="mbox"/>
  &lt;/head>
...<span class="hide">
  &lt;results>
    &lt;result>
      &lt;binding name="who">
        &lt;literal>Alice&lt;/literal>
      &lt;/binding>
      &lt;binding name="g">
        &lt;uri>http://your.example/foaf-alice&lt;/uri>
      &lt;/binding>
      &lt;binding name="mbox">
        &lt;uri>mailto:alice@example.org&lt;/uri>
      &lt;/binding>
    &lt;/result>
    &lt;result>
      &lt;binding name="who">
        &lt;literal>Bob&lt;/literal>
      &lt;/binding>
      &lt;binding name="g">
        &lt;uri>http://www.example/foaf-bob&lt;/uri>
      &lt;/binding>
      &lt;binding name="mbox">
        &lt;uri>mailto:bob@work.example&lt;/uri>
      &lt;/binding>
    &lt;/result>
    &lt;result>
      &lt;binding name="who">
        &lt;literal>Susan&lt;/literal>
      &lt;/binding>
      &lt;binding name="g">
        &lt;uri>http://www.example/foaf-susan&lt;/uri>
      &lt;/binding>
      &lt;binding name="mbox">
        &lt;uri>mailto:susan@work.example&lt;/uri>
      &lt;/binding>
    &lt;/result>
    &lt;result>
      &lt;binding name="who">
        &lt;literal>John&lt;/literal>
      &lt;/binding>
      &lt;binding name="g">
        &lt;uri>http://this.example/john/foaf&lt;/uri>
      &lt;/binding>
      &lt;binding name="mbox">
        &lt;uri>mailto:john@home.example&lt;/uri>
      &lt;/binding>
    &lt;/result>
  &lt;/results></span>
&lt;/sparql></pre></div>

					</div3>
					<div3 id="select-queryonly">
						<head> SELECT with query-only RDF Dataset</head>

<p>This SPARQL query</p>

<div id="div-select-queryonly">
<pre class="query">PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/>
PREFIX dc: &lt;http://purl.org/dc/elements/1.1/>

SELECT ?who ?g ?mbox
FROM &lt;http://www.example/publishers>
FROM NAMED &lt;http://www.example/alice>
FROM NAMED &lt;http://www.example/bob>
WHERE { ?g dc:publisher ?who .
        GRAPH ?g { ?x foaf:mbox ?mbox }
}</pre>

<p>is conveyed to the SPARQL query service, <tt>http://www.example/sparql/</tt>, as illustrated in this
HTTP trace:</p>

<pre class="req">GET /sparql/?<b>query</b>=<i>EncodedQuery</i> HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1</pre>

<p>With the response illustrated here:</p>

<pre class="resp">HTTP/1.1 200 OK
Date: Wed, 03 Aug 2005 12:48:25 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: application/sparql-results+xml

&lt;?xml version="1.0"?>
&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#">
...<span class="hide">
  &lt;head>
    &lt;variable name="who"/>
    &lt;variable name="g"/>
    &lt;variable name="mbox"/>
  &lt;/head>
  &lt;results>
    &lt;result>
      &lt;binding name="who">
      	&lt;literal>Bob Hacker&lt;/literal>
      &lt;/binding>
      &lt;binding name="g">
	&lt;uri>http://www.example/bob&lt;/uri>
      &lt;/binding>
      &lt;binding name="mbox">
        &lt;uri>mailto:bob@oldcorp.example&lt;/uri>
      &lt;/binding>
    &lt;/result>
    &lt;result>
      &lt;binding name="who">
	&lt;literal>Alice Hacker&lt;/literal>
      &lt;/binding>
      &lt;binding name="g">
	&lt;uri>http://www.example/alice&lt;/uri>
      &lt;/binding>
      &lt;binding name="mbox">
	&lt;uri>mailto:alice@work.example&lt;/uri>
      &lt;/binding>
    &lt;/result>
  &lt;/results></span>
&lt;/sparql></pre>
</div>

					</div3>
					<div3 id="select-ambiguous">
						<head>SELECT with ambiguous RDF Dataset</head>
<div id="div-select-ambiguous">

<p>This SPARQL query</p>

<pre class="query">PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/>
PREFIX dc: &lt;http://purl.org/dc/elements/1.1/>

SELECT ?who ?g ?mbox
FROM &lt;http://www.example/publishers>
FROM NAMED &lt;http://www.example/john>
FROM NAMED &lt;http://www.example/susan>
WHERE { ?g dc:publisher ?who .
        GRAPH ?g { ?x foaf:mbox ?mbox }
}</pre>

<p>is conveyed to the SPARQL query
service, <tt>http://www.example/sparql/</tt>, as illustrated in this
HTTP trace:</p>

<pre class="req">GET /sparql/?<b>query</b>=<i>EncodedQuery</i>&amp;<b>default-graph-uri</b>=http%3A%2F%2Fwww.example%2Fmorepublishers
&amp;<b>named-graph-uri</b>=http%3A%2F%2Fwww.example%2Fbob&amp;<b>named-graph-uri</b>=http%3A%2F%2Fwww.example%2Falice HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1</pre>

<p>This protocol operation contains an ambiguous RDF Dataset: the dataset specified in the query is different than the one
specified in the protocol (by way of <code>default-graph-uri</code> and <code>named-graph-uri</code> parameters). A
conformant SPARQL Protocol service must resolve this ambiguity by executing the query against the RDF Dataset specified in
the protocol:</p>

<pre class="resp">HTTP/1.1 200 OK
Date: Wed, 03 Aug 2005 12:48:25 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: application/sparql-results+xml

&lt;?xml version="1.0"?>
&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#">
  &lt;head>
    &lt;variable name="who"/>
    &lt;variable name="g"/>
    &lt;variable name="mbox"/>
  &lt;/head>
  &lt;results>
    &lt;result>
      &lt;binding name="who">
      	&lt;literal>Bob Hacker&lt;/literal>
      &lt;/binding>
      &lt;binding name="g">
	&lt;uri>http://www.example/bob&lt;/uri>
      &lt;/binding>
      &lt;binding name="mbox">
        &lt;uri>mailto:bob@oldcorp.example&lt;/uri>
      &lt;/binding>
    &lt;/result>
    &lt;result>
      &lt;binding name="who">
	&lt;literal>Alice Hacker&lt;/literal>
      &lt;/binding>
      &lt;binding name="g">
	&lt;uri>http://www.example/alice&lt;/uri>
      &lt;/binding>
      &lt;binding name="mbox">
	&lt;uri>mailto:alice@work.example&lt;/uri>
      &lt;/binding>
    &lt;/result>
  &lt;/results>
&lt;/sparql></pre>
</div>

					</div3>
					<div3 id="select-malformed">
						<head> SELECT with malformed query fault</head>

<p>This syntactically invalid SPARQL query</p>
<div id="div-select-malformed">

<pre class="query">PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/>
SELECT ?name
WHERE { ?x foaf:name ?name
ORDER BY ?name }</pre>

<p>is conveyed to the SPARQL query
service, <tt>http://www.example/sparql/</tt>, as illustrated in this
HTTP trace:</p>

<pre class="req">GET /sparql/?<b>query</b>=<i>EncodedQuery</i>&amp;<b>default-graph-uri</b>=http%3A%2F%2Fwww.example%2Fmorepublishers HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1</pre>

<p>With the error response illustrated here:</p>

<pre class="resp">HTTP/1.1 400 Bad Request
Date: Wed, 03 Aug 2005 12:48:25 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: text/plain; charset=UTF-8

4:syntax error, unexpected ORDER, expecting '}'</pre>
</div>

					</div3>
					<div3 id="select-refused">
						<head> SELECT with query request refused fault</head>

<p>This SPARQL query</p>

<div id="div-select-refused">
<pre class="query">PREFIX bio: &lt;http://bio.example/schema/#>
SELECT ?valence
FROM &lt;http://another.example/protein-db.rdf&gt;
WHERE { ?x bio:protein ?valence }
ORDER BY ?valence</pre>

<p>is conveyed to the SPARQL query
service, <tt>http://www.example/sparql/</tt>, as illustrated in this
HTTP trace:</p>

<pre class="req">GET /sparql/?<b>query</b>=<i>EncodedQuery</i>&amp;<b>default-graph-uri</b>=http%3A%2F%2Fanother.example%2Fprotein-db.rdf HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1</pre>

<p>With the error response illustrated here:</p>

<pre class="resp">HTTP/1.1 500 Internal Server Error
Date: Wed, 03 Aug 2005 12:48:25 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: text/plain

SPARQL Processing Service: Query Request Refused

Your request could not be processed because http://another.example/protein-db.rdf
could not be retrieved within the time alloted.
</pre>
</div>

					</div3>
					<div3 id="select-longpost">
						<head>Long SELECT query using POST with URL encoding</head>

<p>Some SPARQL queries, perhaps machine generated, may be longer than
  can be reliably conveyed by way of the HTTP GET binding described in
  <a href="#query-via-get">2.1.1 query via GET</a>. In those cases
  the POST binding described in <a href="#query-via-post-urlencoded">2.1.2 query via POST with URL-encoded parameters</a> may be used. 
  This SPARQL query</p>

<div id="div-select-longpost">

<pre class="query">PREFIX : &lt;http://www.w3.org/2002/12/cal/icaltzd#>
PREFIX Chi: &lt;http://www.w3.org/2002/12/cal/test/Chiefs.ics#>
PREFIX New: &lt;http://www.w3.org/2002/12/cal/tzd/America/New_York#>
PREFIX xsd: &lt;http://www.w3.org/2001/XMLSchema#>

SELECT ?summary
WHERE {
    {
	Chi:D603E2AC-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-09-08T16:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:09:27Z"^^xsd:dateTime;
         :dtstart "2002-09-08T13:00:00"^^New:tz;
         :summary ?summary;
         :uid "D603E2AC-C1C9-11D6-9446-003065F198AC" .
   	}
	UNION
    {
	Chi:D603E90B-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-09-15T16:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:10:19Z"^^xsd:dateTime;
         :dtstart "2002-09-15T13:00:00"^^New:tz;
         :summary ?summary;
         :uid "D603E90B-C1C9-11D6-9446-003065F198AC" .
   	}
	UNION
    {
	Chi:D603ED6E-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-09-22T16:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:11:05Z"^^xsd:dateTime;
         :dtstart "2002-09-22T13:00:00"^^New:tz;
         :summary ?summary;
         :uid "D603ED6E-C1C9-11D6-9446-003065F198AC" .
   	}
	UNION
    {
	Chi:D603F18C-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-09-29T16:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:15:46Z"^^xsd:dateTime;
         :dtstart "2002-09-29T13:00:00"^^New:tz;
         :summary ?summary;
         :uid "D603F18C-C1C9-11D6-9446-003065F198AC" .
   	}
	UNION
    {
	Chi:D603F5B7-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-11-04"^^xsd:date;
         :dtstamp "2002-09-06T03:12:53Z"^^xsd:dateTime;
         :dtstart "2002-11-03"^^xsd:date;
         :summary ?summary;
         :uid "D603F5B7-C1C9-11D6-9446-003065F198AC" .
   	}
	UNION
    {
	Chi:D603F9D7-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-11-10T20:15:00"^^New:tz;
         :dtstamp "2002-09-06T03:14:12Z"^^xsd:dateTime;
         :dtstart "2002-11-10T17:15:00"^^New:tz;
         :summary ?summary;
         :uid "D603F9D7-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D604022C-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-11-17T17:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:14:51Z"^^xsd:dateTime;
         :dtstart "2002-11-17T14:00:00"^^New:tz;
         :summary ?summary;
         :uid "D604022C-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D604065C-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-10-06T19:05:00"^^New:tz;
         :dtstamp "2002-09-06T03:16:54Z"^^xsd:dateTime;
         :dtstart "2002-10-06T16:05:00"^^New:tz;
         :summary ?summary;
         :uid "D604065C-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D6040A7E-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-10-13T19:15:00"^^New:tz;
         :dtstamp "2002-09-06T03:17:51Z"^^xsd:dateTime;
         :dtstart "2002-10-13T16:15:00"^^New:tz;
         :summary ?summary;
         :uid "D6040A7E-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D6040E96-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-10-20T16:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:18:32Z"^^xsd:dateTime;
         :dtstart "2002-10-20T13:00:00"^^New:tz;
         :summary ?summary;
         :uid "D6040E96-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D6041270-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-10-27T17:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:19:15Z"^^xsd:dateTime;
         :dtstart "2002-10-27T14:00:00"^^New:tz;
         :summary ?summary;
         :uid "D6041270-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D6041673-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-11-24T20:05:00"^^New:tz;
         :dtstamp "2002-09-06T03:22:09Z"^^xsd:dateTime;
         :dtstart "2002-11-24T17:05:00"^^New:tz;
         :summary ?summary;
         :uid "D6041673-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D6041A73-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-12-01T17:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:22:52Z"^^xsd:dateTime;
         :dtstart "2002-12-01T14:00:00"^^New:tz;
         :summary ?summary;
         :uid "D6041A73-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D60421EF-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-12-08T17:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:24:04Z"^^xsd:dateTime;
         :dtstart "2002-12-08T14:00:00"^^New:tz;
         :summary ?summary;
         :uid "D60421EF-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D6042660-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-12-15T20:05:00"^^New:tz;
         :dtstamp "2002-09-06T03:25:03Z"^^xsd:dateTime;
         :dtstart "2002-12-15T17:05:00"^^New:tz;
         :summary ?summary;
         :uid "D6042660-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D6042A93-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-12-22T17:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:25:47Z"^^xsd:dateTime;
         :dtstart "2002-12-22T14:00:00"^^New:tz;
         :summary ?summary;
         :uid "D6042A93-C1C9-11D6-9446-003065F198AC" .
    }
	UNION
    {
	Chi:D6042EDF-C1C9-11D6-9446-003065F198AC     a :Vevent;
         :dtend "2002-12-28T21:00:00"^^New:tz;
         :dtstamp "2002-09-06T03:26:51Z"^^xsd:dateTime;
         :dtstart "2002-12-28T18:00:00"^^New:tz;
         :summary ?summary;
         :uid "D6042EDF-C1C9-11D6-9446-003065F198AC" .
    }
}</pre>

<p>is conveyed to the SPARQL query
service, <tt>http://www.example/sparql/</tt>, as illustrated in this
HTTP trace:</p>

<pre class="req">POST /sparql/ HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 9461

<b>query</b>=<i>EncodedQuery</i>&amp;<b>default-graph-uri</b>=http%3A%2F%2Fanother.example%2Fcalendar.rdf</pre>

<p>With the response illustrated here:</p>

<pre class="resp">HTTP/1.1 200 OK
Date: Wed, 03 Aug 2005 12:48:25 GMT
Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3
Connection: close
Content-Type: application/sparql-results+xml

&lt;?xml version="1.0"?>
&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#">
    &lt;head>
        &lt;variable name="summary"/>
    &lt;/head>
    &lt;results>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Cleveland @ Cleveland Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Jacksonville @ Arrowhead Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. New England @ Gillette Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        ...<span class="hide">
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Miami @ Arrowhead Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>BYE&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. San Francisco @ 49ers Stadium at Candlestick Point&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Buffalo @ Arrowhead Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. NY Jets @ Giants Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. San Diego @ Qualcomm Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Denver @ Arrowhead Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Oakland @ Arrowhead Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Seattle @ Seahawks Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Arizona @ Arrowhead Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. St. Louis @ Arrowhead Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Denver @ INVESCO Field at Mile High&lt;/literal>
            &lt;/binding>
        &lt;/result>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. San Diego @ Arrowhead Stadium&lt;/literal>
            &lt;/binding>
        &lt;/result></span>
        &lt;result>
            &lt;binding name="summary">
                &lt;literal>Chiefs vs. Oakland @ Network Associates Coliseum&lt;/literal>
            &lt;/binding>
        &lt;/result>
    &lt;/results>
&lt;/sparql></pre>
</div>

					</div3>
					<div3 id="select-longpost-direct">
						<head>Long SELECT query using direct POST</head>

<p>SPARQL queries may also be POSTed directly without URL encoding,
  as described in <a href="#query-via-post-direct">2.1.3 query via POST directly</a>. 
  The same query used in the <a href="#select-longpost">previous example</a> is conveyed
to the SPARQL query service, <tt>http://www.example/sparql/</tt>, as illustrated in this
HTTP trace:</p>

<pre class="req">POST /sparql/?default-graph-uri=http%3A%2F%2Fanother.example%2Fcalendar.rdf HTTP/1.1
Host: www.example
User-agent: sparql-client/0.1
Content-Type: application/sparql-query

<i>UnencodedQuery</i></pre>

<p>With the same response as in the previous example.</p>


					</div3>
					<div3 id="select-kanji">
						<head>SELECT with internationalization</head>

<p>SPARQL queries may include internationalized characters or character sets. This SPARQL query</p>

<div id="div-select-kanji">
	<pre class="query">PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/>
PREFIX 食: &lt;http://www.w3.org/2001/sw/DataAccess/tests/data/i18n/kanji.ttl#>
SELECT ?name ?food 
WHERE { [ foaf:name ?name ; 食:食べる ?food ] . }</pre>
	
	<p>is conveyed to the SPARQL query service, <tt>http://www.example/sparql/</tt>, as illustrated in this HTTP trace:</p>
	
	<pre class="req">GET /sparql/?<b>query=PREFIX%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0APREFIX%20%E9%A3%9F%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2Fsw%2FDataAccess%2Ftests%2Fdata%2Fi18n%2Fkanji.ttl%23%3E%0ASELECT%20%3Fname%20%3Ffood%20%0AWHERE%20%7B%20%5B%20foaf%3Aname%20%3Fname%20%3B%20%E9%A3%9F%3A%E9%A3%9F%E3%81%B9%E3%82%8B%20%3Ffood%20%5D%20.%20%7D</b>
Host: www.example
User-agent: sparql-client/0.1</pre>
	
	<pre class="resp">HTTP/1.1 200 OK
Date: Wed, 03 Aug 2005 12:48:25 GMT
Server: Apache/1.3.29 (Unix)
Connection: close
Content-Type: application/sparql-results+xml

&lt;?xml version="1.0"?>
&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#">
...
&lt;/sparql></pre>
</div>
					</div3>
				  </div2>
				<div2 id="update-bindings-http-examples">
					<head>Examples of SPARQL Update</head>
					<div3 id="update-urlencoded-simple">
						<head>UPDATE using URL-encoded parameters</head>
			<p>An example request, which is a serialisation of a request sent to <code>http://localhost:8888/test</code> for the query <code>INSERT DATA { &lt;a&gt; &lt;p&gt; &lt;b&gt; }</code> is shown below using the URL-encoded parameter form.</p>
                        <pre class="req">POST /test HTTP/1.1
Host: localhost:8888
Accept: text/plain
Content-Length: 62
Content-Type: application/x-www-form-urlencoded

update=INSERT%20DATA%20%7B%20%3Ca%3E%20%3Cp%3E%20%3Cb%3E%20%7D
</pre>
					</div3>

					<div3 id="update-direct-simple">
						<head>UPDATE using POST directly</head>
						<p>Update requests may be sent as a POST request with a
						Content-Type of <code>application/sparql-update</code>:</p>
						<pre class="req">POST /test HTTP/1.1
Host: localhost:8888
Accept: */*
Content-Type: application/sparql-update
Content-Length: 27

INSERT DATA { &lt;a&gt; &lt;p&gt; &lt;b&gt; }</pre>
					</div3>

					<div3 id="update-direct-simple-dataset">
						<head>UPDATE specifying dataset and using POST directly</head>
						<p>
							A dataset for an update request may be specified using the <code>using-graph-uri</code> and <code>using-named-graph-uri</code> parameters.
							The serialisation of an example request sent to <code>http://localhost:8888/test</code>
							and specifying a dataset with default graph <code>http://localhost:8888/people</code> is shown below.
						</p>
						<pre class="req">POST /test?using-graph-uri=http%3A%2F%2Flocalhost%3A8888%2Fpeople HTTP/1.1
Host: localhost:8888
Accept: */*
Content-Type: application/sparql-update
Content-Length: 136

PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
DELETE { ?person ?property ?value }
WHERE { ?person ?property ?value ; foaf:givenName 'Fred' }</pre>
					</div3>

					<div3 id="update-urlencoded-multi">
						<head>Multi-operation UPDATE using URL-encoded parameters</head>
						<p>
							A sequence of multiple operations may be included in a single request, separated by a ';' (semicolon).
							The serialisation of an example request sent to <code>http://localhost:8888/test</code> for the query
						</p>
						<pre class="query">DELETE DATA { &lt;a&gt; &lt;p&gt; &lt;old&gt; } ;
INSERT DATA { &lt;a&gt; &lt;p&gt; &lt;new&gt; }</pre>
						<p>is shown below using the URL-encoded parameter form.</p>
						<pre class="req">POST /test HTTP/1.1
Host: localhost:8888
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 130

update=DELETE%20DATA%20%7B%20%3Ca%3E%20%3Cp%3E%20%3Cold%3E%20%7D%20%3B%0AINSERT%20DATA%20%7B%20%3Ca%3E%20%3Cp%3E%20%3Cnew%3E%20%7D</pre>
					</div3>

					<div3 id="update-urlencoded-multi-dataset">
						<head>Multi-operation UPDATE specifying dataset and using URL-encoded parameters</head>
						<p>
							When POSTing an update request with URL-encoded parameters, the dataset parameters
							<code>using-graph-uri</code> and <code>using-named-graph-uri</code> are specified
							in the POST body with the serialized request.
							The serialisation of an example request sent to <code>http://localhost:8888/test</code>
							for the query
						</p>
						<pre class="query">PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
INSERT { GRAPH &lt;http://localhost:8888/people&gt; { ?person ?property ?value } }
WHERE { GRAPH ?g { ?person ?property ?value ; foaf:givenName 'Fred' } }</pre>
						<p>
							and specifying a dataset with the named graphs <code>http://localhost:8888/alice/foaf.rdf</code>
							and <code>http://localhost:8888/eve/foaf.rdf</code> is shown below.
						</p>
						<pre class="req">POST /test HTTP/1.1
Host: localhost:8888
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: 130

using-named-graph-uri=http%3A%2F%2Flocalhost%3A8888%2Falice%2Ffoaf.rdf&amp;using-named-graph-uri=http%3A%2F%2Flocalhost%3A8888%2Feve%2Ffoaf.rdf&amp;update=PREFIX%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0AINSERT%20%7B%20GRAPH%20%3Chttp%3A%2F%2Flocalhost%3A8888%2Fpeople%3E%20%7B%20%3Fperson%20%3Fproperty%20%3Fvalue%20%7D%20%7D%0AWHERE%20%7B%20GRAPH%20%3Fg%20%7B%20%3Fperson%20%3Fproperty%20%3Fvalue%20%3B%20foaf%3AgivenName%20%27Fred%27%20%7D%20%7D
</pre>
					</div3>

					<div3 id="update-direct-multi-dataset">
						<head>Multi-operation UPDATE specifying dataset and using POST directly</head>
						<p>
							The serialisation of an example request sent to <code>http://localhost:8888/test</code>
							and specifying a dataset with the named graphs <code>http://localhost:8888/alice/foaf.rdf</code>
							and <code>http://localhost:8888/eve/foaf.rdf</code> is shown below.
						</p>
						<pre class="req">POST /test?using-named-graph-uri=http%3A%2F%2Flocalhost%3A8888%2Falice%2Ffoaf.rdf&amp;using-named-graph-uri=http%3A%2F%2Flocalhost%3A8888%2Feve%2Ffoaf.rdf HTTP/1.1
Host: localhost:8888
Accept: */*
Content-Type: application/sparql-update
Content-Length: 190

PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
INSERT { GRAPH &lt;http://localhost:8888/people&gt; { ?person ?property ?value } }
WHERE { GRAPH ?g { ?person ?property ?value ; foaf:givenName 'Fred' } }</pre>
					</div3>
				</div2>
			</div1>

			
		<div1 id="policy">
			<head>Policy Considerations</head>

			<div2 id="policy-security">
				<head>Security</head>

<p>There are at least two possible sources of denial-of-service attacks against SPARQL protocol services. First, under-constrained
queries can result in very large numbers of results, which may require large expenditures of computing resources to process,
assemble, or return. Another possible source are queries containing very complex &#8212; either because of resource size, the number
of resources to be retrieved, or a combination of size and number &#8212; RDF Dataset descriptions, which the service may be unable
to assemble without significant expenditure of resources, including bandwidth, CPU, or secondary storage. In some cases such
expenditures may effectively constitute a denial-of-service attack. A SPARQL protocol service <strong>may</strong> place
restrictions on the resources that it retrieves or on the rate at which external resources are retrieved. There may be other sources
of denial-of-service attacks against SPARQL query processing services.
</p>

<p>Since a SPARQL protocol service may make HTTP requests of other origin servers on behalf of its clients, it may be used as a
vector of attacks against other sites or services. Thus, SPARQL protocol services may effectively act as proxies for third-party
clients. Such services <strong>may</strong> place restrictions on the resources that they retrieve or on the rate at which external
resources can be retrieved. SPARQL protocol services <strong>may</strong> log client requests in such a way as to facilitate tracing
them with regard to third-party origin servers or services.</p>

<p>SPARQL protocol services <strong>may</strong> choose to detect these and other costly, or otherwise unsafe, queries, impose time
or memory limits on queries, or impose other restrictions to reduce the service's (and other service's) vulnerability to
denial-of-service attacks. They also <strong>may</strong> <a href="#query-failure">refuse to process such query requests</a>. </p>

<p>SPARQL protocol services may remove, insert, and change underlying data via the update operation. To protect against malicious or destructive
updates, implementations may choose not to implement the update operation. Alternatively, implementations may choose to use HTTP authentication mechanisms 
or other implementation-defined mechanisms to prevent unauthorized invocations of the update operation.</p>

<p>Different IRIs may have the same appearance. Characters in different scripts may look similar (a Cyrillic "о" may appear similar
to a Latin "o"). A character followed by combining characters may have the same visual representation as another character (LATIN
SMALL LETTER E followed by COMBINING ACUTE ACCENT has the same visual representation as LATIN SMALL LETTER E WITH ACUTE). Users of
SPARQL must take care to construct queries with IRIs that match the IRIs in the data. Further information about matching of similar
characters can be found in <a href="http://www.unicode.org/reports/tr36/">Unicode Security Considerations</a> [<a href="#unisec">UNISEC</a>]
and <a href="http://www.ietf.org/rfc/rfc3987.txt">Internationalized Resource Identifiers (IRIs)</a> [<a href="#rfc3987">RFC3987</a>] Section 8.</p>

			</div2>
		</div1>
		<div1 id="conformance">
			<head>Conformance</head>
<p>The status of the parts of SPARQL 1.1 Protocol (this document) is as follows:</p>

<ul>
	<li>Section 1 Introduction: <strong>normative</strong></li>
	<li>Section 2 SPARQL Protocol Operations: <strong>normative</strong></li>
    <li>Section 3: Example SPARQL Protocol Requests: <strong>informative</strong></li>
	<li>Section 4: Policy Considerations: <strong>normative</strong></li>
	<li>Section 5: Conformance: <strong>normative</strong></li>
	<li>Section 6: Changes Since Previous Recommendation: <strong>informative</strong></li>
    <li>Section A.1: Normative References: <strong>normative</strong></li>
	<li>Section A.2: Other References: <strong>informative</strong></li>
</ul>

<p>A <a name="conformant-sparql-protocol-service">conformant SPARQL Protocol service</a>:</p>

<ol>
	<li><strong>must</strong> implement either the <code>query</code> operation or the <code>update</code> operation in the way described in this document ("SPARQL 1.1 Protocol");</li>
	<li><strong>may</strong> implement both the <code>query</code> and <code>update</code> operations;</li>
	<li><strong>must</strong> be consistent with the normative constraints (indicated by [<a href="#rfc2119">RFC2119</a>] keywords) described in <a href="#policy">4. Policy Considerations</a>.</li>
</ol>

		</div1>
        <div1 id="changes">
            <head>Changes Since Previous Recommendation (Informative)</head>
            <p>This specification extends and updates the <a href="http://www.w3.org/TR/2008/REC-rdf-sparql-protocol-20080115/">SPARQL Protocol for RDF of January, 2008</a>. The significant changes are:</p>
            <ul>
              <li>Remove the WSDL definition of the protocol in favor of an HTTP-based protocol</li>
              <li>Define an Update operation for issuing SPARQL Update requests</li>
              <li>Updated conformance criteria to accommodate the update operation</li>
              <li>Relaxed the requirements on specific HTTP response codes to allow for other codes as long as they align with HTTP semantics</li>
              <li>Added a variant of the query operation that directly posts a query string in the body of a POST request</li>
            </ul>
        </div1>
	</body>
	<back>
		<!-- &SGML; -->
		<!-- &Biblio; -->
		<div1 id="sec-bibliography">
			<head>References</head>
			<div2 id="sec-existing-stds">
				<head>Normative References</head>
				<dl class="bib">
					<dt><a name="sparql" id="sparql">[SPARQL]</a></dt>
					<dd>@@ref-query</dd>
					
					<dt><a name="update" id="update">[UPDATE]</a></dt>
					<dd>@@ref-update</dd>
					
					<dt><a name="rdf-concepts" id="rdf-concepts">[RDF-CONCEPTS]</a></dt>
					<dd>
						<a href="http://www.w3.org/TR/rdf-concepts/">Resource Description Framework (RDF): Concepts and Abstract Syntax</a>,
						Graham Klyne, Jeremy J. Carroll, Editors,
						W3C (World Wide Web Consortium),
						2004,
						http://www.w3.org/TR/rdf-concepts/ .
					</dd>
					
					<dt><a name="rdf-xml" id="rdf-xml">[RDF-XML]</a></dt>
					<dd>
						<a href="http://www.w3.org/TR/rdf-syntax-grammar/">RDF/XML Syntax Specification (Revised)</a>,
						Dave Beckett, Editor,
						W3C (World Wide Web Consortium),
						2004,
						http://www.w3.org/TR/rdf-syntax-grammar/ .
					</dd>
					
					<dt><a name="rfc2119" id="rfc2119">[RFC2119]</a></dt>
					<dd>
						<a href="http://www.ietf.org/rfc/rfc2119.txt">RFC 2119: Key words for use in RFCs to Indicate Requirement Levels</a>,
						Scott Bradner, Editor,
						IETF (Internet Engineering Task Force),
						1997,
						http://www.ietf.org/rfc/rfc2119.txt .
					</dd>
					
					<dt><a name="rfc2616" id="rfc2616">[RFC2616]</a></dt>
					<dd>
						<a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1</a>,
						R. Fielding, et al., Editors,
						IETF (Internet Engineering Task Force),
						1999,
						http://www.ietf.org/rfc/rfc2616.txt .
					</dd>

					<dt><a name="rfc3986" id="rfc3986">[RFC3986]</a></dt>
					<dd>
						<a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986: Uniform Resource Identifier (URI): Generic Syntax</a>,
						T. Berners-Lee, R. Fielding, L. Masinter, Editors,
						IETF (Internet Engineering Task Force),
						2005,
						http://www.ietf.org/rfc/rfc3986.txt .
					</dd>
				</dl>
			</div2>
			<div2 id="sec-other-references">
				<head>Other References</head>
				<dl>
					<dt><a name="rfc3987" id="rfc3987">[RFC3987]</a></dt>
					<dd>
						<a href="http://www.ietf.org/rfc/rfc3987.txt">RFC 3987: Internationalized Resource Identifiers (IRIs)</a>,
						M. Duerst, M. Suignard, Editors,
						IETF (Internet Engineering Task Force),
						2005,
						http://www.ietf.org/rfc/rfc3987.txt .
					</dd>
					
					<dt><a name="unisec" id="unisec">[UNISEC]</a></dt>
					<dd>
						<a href="http://www.unicode.org/reports/tr36/">Unicode Security Considerations</a>,
						Mark Davis, Michel Suignard, Editors,
						2010,
						http://www.unicode.org/reports/tr36/
					</dd>
				</dl>
			</div2>
		</div1>
<!-- begin cvs history --> 
		<div1 id="sec-cvsLog">
			<head>CVS History</head>
			  <pre>
$Log: Overview.xml,v $
Revision 1.46  2013-03-20 18:07:45  sandro
added None changelog for PR

Revision 1.45  2013-01-27 17:37:45  sandro
add changelog entry

Revision 1.44  2012-12-07 18:52:45  gwilliam
Fixed typo when referencing the application/x-www-form-urlencoded media type.

Revision 1.43  2012/11/07 05:46:43  gwilliam
Removed Accept header from error example in section 3.1.10 (SELECT with query request refused fault).

Revision 1.42  2012/11/07 02:20:45  sandro
various little fixes to references and links for publication

Revision 1.41  2012/11/06 04:03:21  sandro
mark cvs log for auto deletion

Revision 1.40  2012/10/02 14:11:39  gwilliam
Changed error example to use text/plain instead of text/html.

Revision 1.39  2012/09/25 16:10:23  gwilliam
Reverted use of custom http status messages in error examples.

Revision 1.38  2012/09/04 15:43:08  gwilliam
Added missing text about response to failed query operations being implementation-defined.

Revision 1.37  2012/06/19 14:40:02  gwilliam
Use better http status messages in error traces.
Updated link to 1.1 Update to point at /TR/.

Revision 1.36  2012/01/03 17:57:14  gwilliam
Updated status section boilerplate.
Removed tbody markup in table to make W3C validator happy.
Fixed broken link fragment id.

Revision 1.35  2011/12/19 16:58:50  gwilliam
Cleaned up references.

Revision 1.34  2011/11/22 15:25:56  lfeigenb
remove editorial note in security section

Revision 1.33  2011/11/21 21:06:52  lfeigenb
fixed small editorial issues; fixed treatment of RDF datasets for protocol update operations

Revision 1.32  2011/11/17 14:56:24  lfeigenb
updates as per AndyS pre-last call review

Revision 1.31  2011/11/15 17:12:25  gwilliam
Fixed section number in link text to "Policy Considerations".

Revision 1.30  2011/11/15 17:07:31  gwilliam
Replaced "EncodedQuery" with actual encoded query string in two examples.

Revision 1.29  2011/11/15 17:04:33  gwilliam
Properly escape default-graph-uri and named-graph-uri arguments in examples.

Revision 1.28  2011/11/15 16:48:30  gwilliam
Typo and formatting fixes.
Added text restricting response body conditions to 2xx responses.
Added text to discuss the *response* to a successful query operation.
Added normative rfc2119 language to requirement for setting a base URI.

Revision 1.27  2011/11/15 16:14:06  gwilliam
"response code 400" -> "HTTP response code 400".

Revision 1.26  2011/11/15 16:08:37  gwilliam
Removed stray '>'.

Revision 1.25  2011/11/15 15:36:23  lfeigenb
near final changes pre-last call for protocol

Revision 1.24  2011/11/10 00:03:37  gwilliam
Added reference links and addressed many todo items.

Revision 1.23  2011/09/20 14:15:01  lfeigenb
moved overview2.xml to overview.xml

Revision 1.9  2011/09/13 16:51:43  gwilliam
Added update examples.
Fixed URL encoding of default-graph-uri parameter in section #select-longpost-direct.

Revision 1.8  2011/09/13 15:04:26  gwilliam
Added stubs for more UPDATE examples.

Revision 1.7  2011/09/13 14:42:46  gwilliam
Added links to other SPARQL 1.1 docs in TR space (not all in place yet).

Revision 1.6  2011/09/13 14:30:43  gwilliam
Added internal section links in introduction.

Revision 1.5  2011/08/06 20:48:31  lfeigenb
various improvements per AndyS initial review

Revision 1.4  2011/08/02 02:31:57  lfeigenb
added direct POST example for query

Revision 1.3  2011/04/13 15:58:30  lfeigenb
add update operation details

Revision 1.2  2011/03/15 20:37:06  lfeigenb
updated intro and query operation

Revision 1.1  2011/03/01 03:21:34  lfeigenb
initial changes from Greg W

Revision 1.22  2011/01/24 15:45:33  sharris2
Added examples of PSOT transmission of SPARQL Update requests

Revision 1.21  2010/05/13 18:26:19  dcharbon2
remove "graph-does-not-exist" and "graph-already-exists" errors.

Revision 1.20  2010/02/12 08:11:16  lfeigenb
Updated Kendall Clark's email address. Removed "previous version" editor designation.

Revision 1.19  2010/01/27 01:33:33  apollere2
removed cvs-log-meat div2, because it causes a strange TOC entry

Revision 1.18  2010/01/26 16:18:42  dcharbon2
Fixed broken fragment references.

Revision 1.17  2010/01/22 02:03:03  apollere2
changed the second occurrence of Excerpt-1.3 to Exceprt-1.4

Revision 1.16  2010/01/22 01:56:24  apollere2
Adapted previous versions, dates, etc.

Revision 1.15  2010/01/18 21:28:18  dcharbon2
* Fixed name references for protocol and query specifications
* Removed references to obsolete update syntax
* Updated formatting of MUST and MUST NOT where it was incorrect
* Simplified text surrounding reporting debugging data on service fault.
* Update section references
* Improved xml schema fragment descriptions
* Updated the "update" type removing references to dataset types in protocol-types.xsd

Revision 1.14  2010/01/10 16:02:56  lfeigenb
* Add Query faults back in
* Clean up the XX tokens
* Editor notes for Update's out and fault messages
* Note changes since previous WD in the SotD

Revision 1.13  2010/01/05 16:50:46  dcharbon2
Updated URI references for WSDL 2.0. Also updated the Update section for faults.

Revision 1.12  2009/10/21 02:25:37  lfeigenb
fix links
add .wsdl and .xsd

Revision 1.10  2009/10/20 20:21:47  lfeigenb
fixed placement of table

Revision 1.9  2009/10/20 19:10:19  lfeigenb
Fixed and added support for markup that was previously unsupported by our XSLTs.

Future SPARQL-specific customizations should go in shared/sparql.xsl

Revision 1.8  2009/10/20 18:13:47  lfeigenb
Factored out shared XML spec files into docs/shared

Revision 1.7  2009/10/20 16:24:01  lfeigenb
remove extra 1.1 ; DAWG -> SPARQL WG ; add note about security for update

Revision 1.6  2009/10/20 05:58:28  lfeigenb
Make all changes and updates suggested in

http://lists.w3.org/Archives/Public/public-rdf-dawg/2009OctDec/0204.html

Revision 1.5  2009/10/15 22:37:08  lfeigenb
Changes in preparation of FPWD as per http://www.w3.org/2009/sparql/meeting/2009-10-13

Revision 1.4  2009/10/03 00:15:20  lfeigenb
fixed xml tags

Revision 1.3  2009/10/03 00:13:19  lfeigenb
Initial updates by SimonKJ

Revision 1.2  2009/09/28 22:55:59  eric
- some leftover noise from the port

Revision 1.1  2009/09/28 22:30:46  eric
CREATED
			  </pre>
		</div1>
 <!-- end cvs history --> 


<div>
  <h2 id="changelog">Change Log</h2>
  
    <h3 id="changes-since-pr">Changes since Proposed Recommendation</h3>

    <ul>
      <li>None</li>
    </ul>

    <h3 id="changes-since-cr">Changes since Candidate Recommendation</h3>

    <ul>
      <li>Fixed typo when referencing the application/x-www-form-urlencoded media type.</li>
    </ul>

    <h3 id="changes-since-lc">Changes since Last Call</h3>

    <ul>
      <li>Changed error example to use text/plain instead of text/html.</li>
    </ul>

</div>

	</back>
</spec>
