index.html 34 KB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="EN" xml:lang="EN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>SPARQL 1.1 Overview</title><style type="text/css">
@import url("shared-local.css");
@import url("local.css");

code           { font-family: monospace; }

div.constraint,
div.issue,
div.note,
div.notice     { margin-left: 2em; }

ol.enumar      { list-style-type: decimal; }
ol.enumla      { list-style-type: lower-alpha; }
ol.enumlr      { list-style-type: lower-roman; }
ol.enumua      { list-style-type: upper-alpha; }
ol.enumur      { list-style-type: upper-roman; }


div.exampleInner pre { margin-left: 1em;
                       margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray;
                  margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
                   border-top-width: 4px;
                   border-top-style: double;
                   border-top-color: #d3d3d3;
                   border-bottom-width: 4px;
                   border-bottom-style: double;
                   border-bottom-color: #d3d3d3;
                   padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold;
                    margin: 4px}

em.rfc2119 { text-transform: lowercase;
             font-variant: small-caps;
             font-style: normal; }
</style><link rel="stylesheet" type="text/css" href="http://www.w3.org/StyleSheets/TR/W3C-WD.css" /></head><body><div class="head"><p><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72" /></a></p>
<h1><a name="title" id="title"></a>SPARQL 1.1 Overview</h1>
<h2><a name="w3c-doctype" id="w3c-doctype"></a>W3C Working Draft 17 November 2011</h2><dl><dt>This version:</dt><dd>
      <a href="http://www.w3.org/TR/2011/WD-sparql11-overview-20111117/">http://www.w3.org/TR/2011/WD-sparql11-overview-20111117/</a>
		</dd><dt>Latest version:</dt><dd>
			<a href="http://www.w3.org/TR/sparql11-overview/">http://www.w3.org/TR/sparql11-overview/</a>
		</dd><dt>Editor:</dt><dd>The W3C SPARQL Working Group, see <a href="#Acknowledgements">Acknowledgements</a> <a href="mailto:public-rdf-dawg-comments@w3.org">&lt;public-rdf-dawg-comments@w3.org&gt;</a></dd></dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2011 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p></div><hr /><div>
<h2><a name="abstract" id="abstract"></a>Abstract</h2><p>This document is an overview of SPARQL 1.1. It provides an introduction to a set of W3C specifications that facilitate querying and manipulating RDF graph content on the Web or in an RDF store.</p></div><div>
<h2><a name="status" id="status"></a>Status of this Document</h2><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 First Public Working Draft.</p><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></div><div class="toc">
<h2><a name="contents" id="contents"></a>Table of Contents</h2><p class="toc">1 <a href="#sec-intro">Introduction</a><br />
    1.1 <a href="#Example">Example</a><br />
2 <a href="#sparql11-query">SPARQL 1.1 Query Language</a><br />
3 <a href="#sparql11-results">Different query results formats supported by SPARQL 1.1 (XML, JSON, CSV, TSV)</a><br />
4 <a href="#sparql11-federated-query">SPARQL 1.1 Federated Query</a><br />
5 <a href="#sparql11-entailment">SPARQL 1.1 Entailment Regimes</a><br />
6 <a href="#sparql11-update">SPARQL 1.1 Update Language</a><br />
7 <a href="#sparql11-protocol">SPARQL 1.1 Protocol for RDF</a><br />
8 <a href="#sparql11-service-description">SPARQL 1.1 Service Description</a><br />
9 <a href="#sparql11-graphstore-http-protocol">SPARQL 1.1 Graph Store HTTP Protocol</a><br />
10 <a href="#Acknowledgements">Acknowledgements</a><br />
11 <a href="#sec-bibliography">References</a><br />
</p></div><hr /><div class="body"><div class="div1">
<h2><a name="sec-intro" id="sec-intro"></a>1 Introduction</h2><p>SPARQL 1.1 is a set of specifications that provide languages and protocols to query and manipulate RDF graph content on the Web or in an RDF store. The standard comprises the following specifications:</p><ul><li><a href="http://www.w3.org/TR/sparql11-query/" class="external text" title="http://www.w3.org/TR/sparql11-query/" rel="nofollow">SPARQL 1.1 Query Language</a> - A query language for RDF.</li><li><a href="http://www.w3.org/TR/sparql11-results-json/" class="external text" title="http://www.w3.org/TR/sparql11-results-json/" rel="nofollow">SPARQL 1.1 Query Results JSON Format</a> and <a href="http://www.w3.org/TR/sparql11-results-csv-tsv/" class="external text" title="http://www.w3.org/TR/sparql11-results-csv-tsv/" rel="nofollow">SPARQL 1.1 Query Results CSV and TSV Formats</a> - Apart from the standard SPARQL Query Results XML Format [<a href="#SPARQL-XML-Result">SPARQL-XML-Result</a>], SPARQL1.1 now allows three alternative popular formats to exchange answers to SPARQL queries, namely JSON, CSV (comma separated values) and TSV (tab separated values) which are described in  these two documents.</li><li><a href="http://www.w3.org/TR/sparql11-federated-query/" class="external text" title="http://www.w3.org/TR/sparql11-federated-query/" rel="nofollow">SPARQL 1.1 Federated Query</a> -  A specification defining an extension of the SPARQL 1.1 Query Language for executing queries distributed over different SPARQL endpoints.</li><li><a href="http://www.w3.org/TR/sparql11-entailment/" class="external text" title="http://www.w3.org/TR/sparql11-entailment/" rel="nofollow">SPARQL 1.1 Entailment Regimes</a> - A specification defining the semantics of SPARQL queries under entailment regimes such as RDF Schema, OWL, or RIF.</li><li><a href="http://www.w3.org/TR/sparql11-update/" class="external text" title="http://www.w3.org/TR/sparql11-update/" rel="nofollow">SPARQL 1.1 Update Language</a> - An an update language for RDF graphs</li><li><a href="http://www.w3.org/TR/sparql11-protocol/" class="external text" title="http://www.w3.org/TR/sparql11-protocol/" rel="nofollow">SPARQL 1.1 Protocol for RDF</a> - A protocol defining means for conveying arbitrary SPARQL queries and update requests to a SPARQL service.</li><li><a href="http://www.w3.org/TR/sparql11-service-description/" class="external text" title="http://www.w3.org/TR/sparql11-service-description/" rel="nofollow">SPARQL 1.1 Service Description</a> - A specification defining a method for discovering and a vocabulary for describing SPARQL services.</li><li><a href="http://www.w3.org/TR/sparql11-http-rdf-update/" class="external text" title="http://www.w3.org/TR/sparql11-http-rdf-update/" rel="nofollow">SPARQL 1.1 Graph Store HTTP Protocol</a> - As opposed to the full SPARQL protocol, this specification defines minimal means for managing RDF graph content directly via common HTTP operations.</li><li><a href="http://www.w3.org/2009/sparql/wiki/SPARQL11_and_RDF11" class="external text" title="http://www.w3.org/2009/sparql/wiki/SPARQL11_and_RDF11" rel="nofollow">Using SPARQL1.1 with RDF1.1</a> - SPARQL1.1 is based on the Resource Description Framework (RDF) specifications in their 2004 version. This document describes how SPARQL1.1 is to be used with RDF1.1, which is currently under development.  (Note: this is a placeholder at the moment.)</li>
</ul><div class="div2">
<h3><a name="Example" id="Example"></a>1.1 Example</h3><p>In the following, we will illustrate the use of SPARQL's languages, protocols, and related specifications with a small example.</p><p>Some RDF graph published on the Web at the URL '<a href="http://example.org/alice'" class="external free" title="http://example.org/alice'" rel="nofollow">http://example.org/alice'</a> contains  personal information about Alice and her social contacts. We use Turtle [<a href="#Turtle">Turtle</a>] syntax here for illustration.
</p><p>Graph: <tt><a href="http://example.org/alice" class="external free" title="http://example.org/alice" rel="nofollow">http://example.org/alice</a></tt>
</p><pre> 
 @prefix foaf: &lt;<a href="http://xmlns.com/foaf/0.1/" class="external free" title="http://xmlns.com/foaf/0.1/" rel="nofollow">http://xmlns.com/foaf/0.1/</a>&gt; .
 @prefix rdfs: &lt;<a href="http://www.w3.org/2000/01/rdf-schema#" class="external free" title="http://www.w3.org/2000/01/rdf-schema#" rel="nofollow">http://www.w3.org/2000/01/rdf-schema#</a>&gt; .

 &lt;<a href="http://example.org/alice#" class="external free" title="http://example.org/alice#" rel="nofollow">http://example.org/alice#me</a>&gt; a foaf:Person .
 &lt;<a href="http://example.org/alice#" class="external free" title="http://example.org/alice#" rel="nofollow">http://example.org/alice#me</a>&gt; foaf:name "Alice" .
 &lt;<a href="http://example.org/alice#" class="external free" title="http://example.org/alice#" rel="nofollow">http://example.org/alice#me</a>&gt; foaf:mbox &lt;<a href="mailto:alice@example.org" class="external free" title="mailto:alice@example.org" rel="nofollow">mailto:alice@example.org</a>&gt; .
 &lt;<a href="http://example.org/alice#" class="external free" title="http://example.org/alice#" rel="nofollow">http://example.org/alice#me</a>&gt; foaf:knows &lt;<a href="http://example.org/bob#me" class="external free" title="http://example.org/bob#me" rel="nofollow">http://example.org/bob#me</a>&gt; .
 &lt;<a href="http://example.org/bob#" class="external free" title="http://example.org/bob#" rel="nofollow">http://example.org/bob#me</a>&gt; foaf:knows &lt;<a href="http://example.org/alice#me" class="external free" title="http://example.org/alice#me" rel="nofollow">http://example.org/alice#me</a>&gt; .
 &lt;<a href="http://example.org/bob#me" class="external free" title="http://example.org/bob#me" rel="nofollow">http://example.org/bob#me</a>&gt; foaf:name "Bob" .
 &lt;<a href="http://example.org/alice#" class="external free" title="http://example.org/alice#" rel="nofollow">http://example.org/alice#me</a>&gt; foaf:knows &lt;<a href="http://example.org/charlie#me" class="external free" title="http://example.org/charlie#me" rel="nofollow">http://example.org/charlie#me</a>&gt; .
 &lt;<a href="http://example.org/charlie#" class="external free" title="http://example.org/charlie#" rel="nofollow">http://example.org/charlie#me</a>&gt; foaf:knows &lt;<a href="http://example.org/alice#me" class="external free" title="http://example.org/alice#me" rel="nofollow">http://example.org/alice#me</a>&gt; .
 &lt;<a href="http://example.org/charlie#me" class="external free" title="http://example.org/charlie#me" rel="nofollow">http://example.org/charlie#me</a>&gt; foaf:name "Charlie" .
 &lt;<a href="http://example.org/alice#" class="external free" title="http://example.org/alice#" rel="nofollow">http://example.org/alice#me</a>&gt; foaf:knows &lt;<a href="http://example.org/snoopy" class="external free" title="http://example.org/snoopy" rel="nofollow">http://example.org/snoopy</a>&gt; .
 &lt;<a href="http://example.org/snoopy" class="external free" title="http://example.org/snoopy" rel="nofollow">http://example.org/snoopy</a>&gt; foaf:name "Snoopy"@en .
</pre><p>With SPARQL1.1 one can query such graphs, load them into RDF stores and manipulate them in various ways.
</p></div></div><div class="div1">
<h2><a name="sparql11-query" id="sparql11-query"></a>2 SPARQL 1.1 Query Language</h2><p>Assuming the graph data from above is loaded into a SPARQL service, the <a href="http://www.w3.org/TR/sparql11-query/" class="external text" title="http://www.w3.org/TR/sparql11-query/" rel="nofollow">SPARQL 1.1 Query Language</a> can be used to formulate queries ranging from simple graph pattern matching to complex queries. For instance, one can ask using a SPARQL SELECT query for names of persons and the number of their friends
</p><pre>PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
SELECT ?name (COUNT(?friend) AS ?count)
WHERE { 
    ?person foaf:name ?name . 
    ?person foaf:knows ?friend . 
} GROUP BY ?person ?name
</pre><p>Just like in the earlier SPARQL1.0 specification  [<a href="#SPARQL10-Query">SPARQL-Query</a>] from 2008, complex queries may include union, optional query parts, and filters; new features like value aggregation, path expressions, nested queries, etc. have been added in SPARQL1.1. Apart from SELECT queries - which return variable bindings - SPARQL supports ASK queries  - i.e. boolean "yes/no" queries - and CONSTRUCT queries - which allow to construct new RDF graphs from a query result; all the new query language features of SPARQL1.1 are likewise usable in ASK and CONSTRUCT queries.
</p><p>Compared to SPARQL1.0,  SPARQL1.1 adds a number of new features to the query language, including subqueries, value assignment, path expressions, or aggregates - such as COUNT, as used in the above example query - etc.
</p><p>The <a href="http://www.w3.org/TR/sparql11-query/" class="external text" title="http://www.w3.org/TR/sparql11-query/" rel="nofollow">SPARQL 1.1 Query Language</a> document defines the syntax and semantics of SPARQL1.1 queries and provides various examples for their usage.
</p></div><div class="div1">
<h2><a name="sparql11-results" id="sparql11-results"></a>3 Different query results formats supported by SPARQL 1.1 (XML, JSON, CSV, TSV)</h2><p>Results of SELECT queries in SPARQL comprise bags of mappings from variables to RDF terms, often conveniently represented in tabular form. For instance, the query from Section 2 has the following results:
</p><p><br /> 
</p><table border="1" align="center" style="text-align:center;"><tr><td>?name
</td><td>?count
</td></tr><tr><td>"Alice"
</td><td>3
</td></tr><tr><td>"Bob"
</td><td>1
</td></tr><tr><td>"Charlie"
</td><td>1
</td></tr></table><p><br />
In order to exchange these results in machine-readable form, SPARQL supports four common exchange formats, namely the Extensible Markup Language (<a href="http://www.w3.org/XML/" class="external text" title="http://www.w3.org/XML/" rel="nofollow">XML</a>), the JavaScript Object Notation (<a href="https://www.ietf.org/rfc/rfc4627.txt" class="external text" title="https://www.ietf.org/rfc/rfc4627.txt" rel="nofollow">JSON</a>), Comma Separated Values (<a href="https://www.ietf.org/rfc/rfc4180.txt" class="external text" title="https://www.ietf.org/rfc/rfc4180.txt" rel="nofollow">CSV</a>), and Tab Separated Values (<a href="http://www.iana.org/assignments/media-types/text/tab-separated-values" class="external text" title="http://www.iana.org/assignments/media-types/text/tab-separated-values" rel="nofollow">TSV</a>). These results formats are described in three different documents:
</p><ul><li> the <a href="http://www.w3.org/TR/rdf-sparql-XMLres/" class="external text" title="http://www.w3.org/TR/rdf-sparql-XMLres/" rel="nofollow">SPARQL Query Results XML Format</a> (<i>please, particularly note that the SPARQL1.1 WG has made some minor <a href="http://www.w3.org/2001/sw/DataAccess/XMLres-errata" class="external text" title="http://www.w3.org/2001/sw/DataAccess/XMLres-errata" rel="nofollow">Errata</a> to this specification</i>),
</li><li> the <a href="http://www.w3.org/TR/sparql11-results-json/" class="external text" title="http://www.w3.org/TR/sparql11-results-json/" rel="nofollow">SPARQL 1.1 Query Results JSON Format</a>, and
</li><li> the <a href="http://www.w3.org/TR/sparql11-results-csv-tsv/" class="external text" title="http://www.w3.org/TR/sparql11-results-csv-tsv/" rel="nofollow">SPARQL 1.1 Query Results CSV and TSV Formats</a> 
</li></ul><p>These documents specify details of how particular solutions and RDF terms occurring in solutions are encoded in the respective target formats.  
</p><p>The results of our example query, in these three formats look as follows.
</p><p><b>XML:</b> 
</p><pre>&lt;?xml version="1.0"?&gt;
&lt;sparql xmlns="http://www.w3.org/2005/sparql-results#"&gt;
 &lt;head&gt;
   &lt;variable name="name"/&gt;
   &lt;variable name="count"/&gt;
 &lt;/head&gt;
 &lt;results&gt;
   &lt;result&gt;
     &lt;binding name="name"&gt;
       &lt;literal&gt;Alice&lt;/literal&gt;
     &lt;/binding&gt;
     &lt;binding name="count"&gt;
       &lt;literal datatype="http://www.w3.org/2001/XMLSchema#integer"&gt;3&lt;/literal&gt;
     &lt;/binding&gt;
   &lt;/result&gt;
   &lt;result&gt;
     &lt;binding name="name"&gt;
       &lt;literal&gt;Bob&lt;/literal&gt;
     &lt;/binding&gt;
     &lt;binding name="count"&gt;
       &lt;literal datatype="http://www.w3.org/2001/XMLSchema#integer"&gt;1&lt;/literal&gt;
     &lt;/binding&gt;
   &lt;/result&gt;
   &lt;result&gt;
     &lt;binding name="name"&gt;
       &lt;literal&gt;Charlie&lt;/literal&gt;
     &lt;/binding&gt;
     &lt;binding name="count"&gt;
       &lt;literal datatype="http://www.w3.org/2001/XMLSchema#integer"&gt;1&lt;/literal&gt;
     &lt;/binding&gt;
   &lt;/result&gt;
 &lt;/results&gt;
&lt;/sparql&gt;
</pre><p><b>JSON:</b>
</p><pre>{
  "head": {
    "vars": [ "name" , "count" ]
  } ,
  "results": {
    "bindings": [
      {
        "name": { "type": "literal" , "value": "Alice" } ,
        "count": { "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "type": "typed-literal" , "value": "3" }
      } ,
      {
        "name": { "type": "literal" , "value": "Bob" } ,
        "count": { "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "type": "typed-literal" , "value": "1" }
      } ,
      {
        "name": { "type": "literal" , "value": "Charlie" } ,
        "count": { "datatype": "http://www.w3.org/2001/XMLSchema#integer" , "type": "typed-literal" , "value": "1" }
      }
    ]
  }
}
</pre><p><br />
<b>CSV:</b>
</p><pre>name,count
Alice,3
Bob,1
Charlie,1
</pre><p><br />
<b>TSV:</b>
</p><pre>?name&lt;TAB&gt;?count
"Alice"&lt;TAB&gt;3
"Bob"&lt;TAB&gt;1
"Charlie"&lt;TAB&gt;1
</pre><p>(<i><b>Note:</b> tab characters are visually marked with</i> '<tt>&lt;TAB&gt;</tt>' <i>here for illustration only.</i>)
</p></div><div class="div1">
<h2><a name="sparql11-federated-query" id="sparql11-federated-query"></a>4 SPARQL 1.1 Federated Query</h2><p>The <a href="http://www.w3.org/TR/sparql11-federated-query/" class="external text" title="http://www.w3.org/TR/sparql11-federated-query/" rel="nofollow">SPARQL 1.1 Federated Query</a> document describes an extension  of the basic <a href="http://www.w3.org/TR/sparql11-query/" class="external text" title="http://www.w3.org/TR/sparql11-query/" rel="nofollow">SPARQL 1.1 Query Language</a> to explicitly delegate certain subqueries to different SPARQL endpoints. 
</p><p>For instance, in our example, one may want to know whether there is anyone among Alice's friends with the same name as the resource identified by the IRI &lt;<a href="http://dbpedia.org/resource/Snoopy" class="external text" title="http://dbpedia.org/resource/Snoopy" rel="nofollow">http://dbpedia.org/resource/Snoopy</a>&gt; at DBPedia. This can be done by combining a query for the names of friends with a remote call to the SPARQL endpoint at <tt><a href="http://dbpedia.org/sparql" class="external free" title="http://dbpedia.org/sparql" rel="nofollow">http://dbpedia.org/sparql</a></tt> finding out the name of &lt;<a href="http://dbpedia.org/resource/Snoopy" class="external text" title="http://dbpedia.org/resource/Snoopy" rel="nofollow">http://dbpedia.org/resource/Snoopy</a>&gt; using the <tt>SERVICE</tt> keyword as follows:
</p><pre>PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt;
SELECT ?person
FROM &lt;http://example.org/alice&gt;
WHERE {
    &lt;http://example.org/alice#me&gt; foaf:knows [ foaf:name ?name ] .
    SERVICE &lt;http://dbpedia.org/sparql&gt; { &lt;http://dbpedia.org/resource/Snoopy&gt; foaf:name ?name }
}
</pre><p>with the following result:</p><table border="1" align="center" style="text-align:center;"><tr><td>?name
</td></tr><tr><td>"Snoopy"@en
</td></tr></table></div><div class="div1">
<h2><a name="sparql11-entailment" id="sparql11-entailment"></a>5 SPARQL 1.1 Entailment Regimes</h2><p>SPARQL could be used together with ontological information in the form of e.g. RDF Schema or OWL axioms.
For instance, let us assume that - apart from the data about Alice - some ontological information in the form 
of RDF Schema [<a href="#RDF-Schema">RDF-Schema</a>] and OWL [<a href="#OWL2-Overview">OWL2-Overview</a>]  
constructs defining the FOAF vocabulary is loaded into our example SPARQL service.</p><p>The <a href="http://xmlns.com/foaf/0.1/">FOAF</a> ontology: (only an excerpt given)
</p><pre> @prefix foaf: &lt;<a href="http://xmlns.com/foaf/0.1/" class="external free" title="http://xmlns.com/foaf/0.1/" rel="nofollow">http://xmlns.com/foaf/0.1/</a>&gt; .
 @prefix rdfs: &lt;<a href="http://www.w3.org/2000/01/rdf-schema#" class="external free" title="http://www.w3.org/2000/01/rdf-schema#" rel="nofollow">http://www.w3.org/2000/01/rdf-schema#</a>&gt; .
 ...
 foaf:name rdfs:subPropertyOf rdfs:label .
 ...
</pre><p>The following query asks for labels of persons:
</p><pre>SELECT ?label 
WHERE { ?person rdfs:label ?label }
</pre><p>A SPARQL engine that does not consider any special entailment regimes (on top of standard <a href="http://www.w3.org/TR/rdf-mt/#entail" class="external text" title="http://www.w3.org/TR/rdf-mt/#entail" rel="nofollow">simple entailment</a>) would not return any results for this query, whereas an RDF Schema aware query engine will return
</p><table border="1" align="center" style="text-align:center;"><tr><td>?label
</td></tr><tr><td>"Alice"
</td></tr><tr><td>"Bob"
</td></tr><tr><td>"Charlie"
</td></tr><tr><td>"Snoopy"@en
</td></tr></table><p>since <tt>foaf:name</tt> is a sub-property of <tt>rdfs:label</tt>.
</p><p>The <a href="http://www.w3.org/TR/sparql11-entailment/" class="external text" title="http://www.w3.org/TR/sparql11-entailment/" rel="nofollow">SPARQL 1.1 Entailent Regimes</a> specification defines which answers should be given under which entailment regime, specifying entailment regimes for RDF, RDF Schema, D-Entailment [<a href="#RDF-MT">RDF-MT</a>], OWL [<a href="#OWL2-Overview">OWL2-Overview</a>], and RIF [<a href="#RIF-Overview">RIF-Overview</a>].
</p></div><div class="div1">
<h2><a name="sparql11-update" id="sparql11-update"></a>6 SPARQL 1.1 Update Language</h2><p>The <a href="http://www.w3.org/TR/sparql11-update/" class="external text" title="http://www.w3.org/TR/sparql11-update/" rel="nofollow">SPARQL 1.1 Update</a> specification defines the syntax and semantics of SPARQL1.1 update requests and provides various examples for their usage. Update operations can consist of several sequential requests and are performed on a collection of graphs in a Graph Store. Operations are provided to update, create and remove RDF graphs in a Graph Store.
</p><p>For instance, the following request inserts a new friend of Alice named Dorothy into the default graph of our example SPARQL service and thereafter deletes all names of Alice's friends with an English language tag. 
</p><pre>
PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .

INSERT DATA { &lt;http://www.example.org/alice#me&gt; foaf:knows [ foaf:name "Dorothy" ]. } ;
DELETE { ?person foaf:name ?mbox } WHERE { &lt;http://www.example.org/alice#me&gt; foaf:knows ?person .
                                           ?person foaf:name ?name FILTER ( lang(?name) = "EN" ) .}

</pre><p>As the second operation shows, insertions and deletions can be dependent on the results of queries to the Graph Store; the respective syntax used in the WHERE part is derived from the <a href="http://www.w3.org/TR/sparql11-query/" class="external free" title="http://www.w3.org/TR/sparql11-query/" rel="nofollow">SPARQL1.1 Query Language</a>.
</p></div><div class="div1">
<h2><a name="sparql11-protocol" id="sparql11-protocol"></a>7 SPARQL 1.1 Protocol for RDF</h2><p>The <a href="http://www.w3.org/TR/sparql11-protocol/" class="external text" title="http://www.w3.org/TR/sparql11-protocol/" rel="nofollow">SPARQL 1.1 Protocol</a> for RDF defines how to transfer SPARQL 1.1 queries and update requests to a SPARQL service via HTTP, defines how to map requests to HTTP Get and Post operations and how respective HTTP responses to such requests should look like.
</p><p>For instance, the query from Section 3 above issued against a SPARQL query service hosted at <tt><a href="http://www.example.org/sparql/" class="external free" title="http://www.example.org/sparql/" rel="nofollow">http://www.example.org/sparql/</a></tt>, could according to this specification be wrapped into an HTTP Get request (where the query string is URI-encoded):
</p><pre>GET /sparql/?query=PREFIX%20foaf%3A%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0ASELECT%20%3Fname%20%28COUNT%28%3Ffriend%29%20AS%20%3Fcount%29%0AWHERE%20%7B%20%0A%20%20%20%20%3Fperson%20foaf%3Aname%20%3Fname%20.%20%0A%20%20%20%20%3Fperson%20foaf%3Aknows%20%3Ffriend%20.%20%0A%7D%20GROUP%20BY%20%3Fperson%20%3Fname HTTP/1.1
Host: www.example.org
User-agent: my-sparql-client/0.1
</pre><p>Details about response encoding and different operations for query and update requests, as well as  supported HTTP methods are described in the Protocol specification.
</p></div><div class="div1">
<h2><a name="sparql11-service-description" id="sparql11-service-description"></a>8 SPARQL 1.1 Service Description</h2><p>The <a href="http://www.w3.org/TR/sparql11-service-description/" class="external text" title="http://www.w3.org/TR/sparql11-service-description/" rel="nofollow">SPARQL 1.1 Service Description</a> document desribes a method for discovering, and an RDF vocabulary for describing SPARQL services made available via the <a href="http://www.w3.org/TR/sparql11-protocol/" class="external text" title="http://www.w3.org/TR/sparql11-protocol/" rel="nofollow">SPARQL 1.1 Protocol for RDF</a>. 
</p><p>According to this specification, a service endpoint, when accessed via an HTTP Get operation without further (query or update request) parameters should return an RDF description of the service provided. For instance, the following HTTP request:
</p><pre>GET /sparql/ HTTP/1.1
Host: www.example.org
</pre><p>issued against the SPARQL endpoint hosted at <tt><a href="http://www.example.org/sparql/" class="external free" title="http://www.example.org/sparql/" rel="nofollow">http://www.example.org/sparql/</a></tt> should return and RDF description, using the Service Description vocabulary, providing details about e.g. the default dataset of the respective endpoint, or SPARQL query language features, entailment regimes, etc. supported.
</p></div><div class="div1">
<h2><a name="sparql11-graphstore-http-protocol" id="sparql11-graphstore-http-protocol"></a>9 SPARQL 1.1 Graph Store HTTP Protocol</h2><p>For many applications and services that deal with RDF data, the full <a href="http://www.w3.org/TR/sparql11-update/" class="external text" title="http://www.w3.org/TR/sparql11-update/" rel="nofollow">SPARQL 1.1 Update</a> language might not be required. To this end, the <a href="http://www.w3.org/TR/sparql11-http-rdf-update/" class="external text" title="http://www.w3.org/TR/sparql11-http-rdf-update/" rel="nofollow">SPARQL 1.1 Graph Store HTTP Protocol</a> provides means to perform certain operations to manage collections of graphs more directly, via the direct use of HTTP operations following REST principles. 
</p><p>For instance, the first part of the update request in Section 4 above is a simple insertion of triples into an RDF graph. On a service supporting this protocol, such insertion can - instead of via a SPARQL1.1 update request - directly be performed via an HTTP  POST operation taking the RDF triples to be inserted as payload:
</p><pre>POST /rdf-graphs/service?graph=http%3A%2F%2Fwww.example.org%2Falice HTTP/1.1
Host: example.org
Content-Type: text/turtle
@prefix foaf: &lt;http://xmlns.com/foaf/0.1/&gt; .
&lt;http://www.example.org/alice#me&gt; foaf:knows [ foaf:name "Dorothy" ] .
</pre><p><br />
More such direct HTTP operations for modifying RDF graphs (e.g. to use HTTP PUT to replace an entire graph, or HTTP DELETE to drop an RDF graph, etc.) are described in the <a href="http://www.w3.org/TR/sparql11-http-rdf-update/" class="external text" title="http://www.w3.org/TR/sparql11-http-rdf-update/" rel="nofollow">SPARQL 1.1 Graph Store HTTP Protocol</a> specification, which can be viewed as a lightweight alternative to the SPARQL1.1 protocol in combination with the full <a href="http://www.w3.org/TR/sparql11-query/" class="external text" title="http://www.w3.org/TR/sparql11-query/" rel="nofollow">SPARQL1.1 Query</a> and <a href="http://www.w3.org/TR/sparql11-update/" class="external text" title="http://www.w3.org/TR/sparql11-update/" rel="nofollow">SPARQL1.1 Update</a> languages.
</p></div><div class="div1">
<h2><a name="Acknowledgements" id="Acknowledgements"></a>10 Acknowledgements</h2><p>The members of the W3C SPARQL Working group who actively contributed to the SPARQL1.1 specifications are:
</p><ul><li> Carlos Buil Aranda, Universidad Politécnica de Madrid
</li><li> Olivier Corby, Institut National de Recherche en Informatique et en Automatique (INRIA)
</li><li> Souripriya Das, Oracle Corporation
</li><li> Lee Feigenbaum, Cambridge Semantics
</li><li> Paul Gearon, Invited Expert
</li><li> Birte Glimm, Oxford University Computing Laboratory 
</li><li> Steve Harris, Garlik Ltd
</li><li> Sandro Hawke, W3C
</li><li> Ivan Herman, W3C
</li><li> Nicholas Humfrey, BBC
</li><li> Nico Michaelis, Dreamlab Technologies AG
</li><li> Chimezie Ogbuji, Invited Expert
</li><li> Matthew Perry, Oracle Corporation
</li><li> Alexandre Passant, DERI, National University of Ireland, Galway
</li><li> Axel Polleres, DERI, National University of Ireland, Galway
</li><li> Eric Prud'hommeaux, W3C
</li><li> Andy Seaborne, The Apache Software Foundation 
</li><li> Gregory Todd Williams, Rensselaer Polytechnic Institute
</li></ul></div><div class="div1">
<h2><a name="sec-bibliography" id="sec-bibliography"></a>11 References</h2>

				<dl><dt class="label"><a name="SPARQL-XML-Result" id="SPARQL-XML-Result"></a>SPARQL-XML-Result</dt><dd><a href="http://www.w3.org/TR/rdf-sparql-XMLres/"><cite>SPARQL Query Results XML Format</cite></a>,
ed. Dave Beckett and Jeen Broekstra, W3C Recommendation 15 January 2008  (See http://www.w3.org/TR/rdf-sparql-XMLres/.)</dd><dt class="label"><a name="RDF-Schema" id="RDF-Schema"></a>RDF-Schema</dt><dd><a href="http://www.w3.org/TR/rdf-schema/"><cite>RDF Vocabulary Description Language 1.0: RDF Schema
</cite></a>,
ed. Dan Brickley and R.V. Guha, W3C Recommendation 10 February 2004  (See http://www.w3.org/TR/rdf-schema/.)</dd><dt class="label"><a name="RDF-MT" id="RDF-MT"></a>RDF-MT</dt><dd><a href="http://www.w3.org/TR/rdf-mt/"><cite>RDF Semantics
</cite></a>,
ed. Pat Hayes, W3C Recommendation 10 February 2004  (See http://www.w3.org/TR/rdf-mt/.)</dd><dt class="label"><a name="OWL2-Overview" id="OWL2-Overview"></a>OWL2-Overview</dt><dd><a href="http://www.w3.org/TR/owl2-overview/"><cite>OWL 2 Web Ontology Language
Document Overview</cite></a>,
W3C OWL Working Group, W3C Recommendation 27 October 2009  (See http://www.w3.org/TR/owl2-overview/.)</dd><dt class="label"><a name="RIF-Overview" id="RIF-Overview"></a>RIF-Overview</dt><dd><a href="http://www.w3.org/TR/rif-overview/"><cite>RIF Overview</cite></a>,
ed. Michael Kifer and Harold Boley, W3C Working Group Note 22 June 2010  (See http://www.w3.org/TR/rif-overview/.)</dd><dt class="label"><a name="Turtle" id="Turtle"></a>Turtle</dt><dd><a href="http://www.w3.org/TeamSubmission/turtle/"><cite>Turtle - Terse RDF Triple Language</cite></a>, 
ed. Dave Beckett and Tim Berners-Lee, W3C Team Submission 28 March 2011. (See http://www.w3.org/TeamSubmission/turtle/.)</dd><dt class="label"><a name="SPARQL10-Query" id="SPARQL10-Query"></a>SPARQL10-Query</dt><dd><a href="http://www.w3.org/TR/rdf-sparql-query/"><cite>SPARQL Query Language for RDF</cite></a>,
ed. Eric Prud'hommeaux and Andy Seaborne, W3C Recommendation 15 January 2008  (See http://www.w3.org/TR/rdf-sparql-query/.)</dd></dl></div>
</div></body></html>