From BC$ MobileTV Wiki
Revision as of 22:39, 7 May 2010 by (Talk)

Jump to: navigation, search
SPARQL Semantic Pattern-based Aspect-oriented Relational Query Language

SPARQL (pronounced "sparkle" [1]) is an RDF query language; its name is a recursive acronym [2] that stands for SPARQL Protocol and RDF Query Language. It is standardized by the RDF Data Access Working Group (DAWG) of the W3C. Initially released as a Candidate Recommendation in April 2006, but returned to Working Draft status in October 2006, due to two open issues. [3] In June 2007, SPARQL advanced to Candidate Recommendation once again. [4] On 12th November 2007 the status of SPARQL changed into Proposed Recommendation. [5] On 15th January 2008, SPARQL became an official W3C Recommendation. [6]

The RDF Data Access Working Group has published three SPARQL recommendations (Query Language, Protocol, and Results Format) in January 2008. SPARQL has become very widely implemented and used since then (and, in fact, even before the specification achieved a W3C Recommendation status). Usage and implementation of SPARQL have revealed requirements for extensions to the query langauge that are needed by applications. Most of these were already known and recorded when developing the current Recommendation, but there was not enough implementation and and usage experience at the time for standardization. Current implementation experience and feedback from the user community makes it now feasible to handle some of those issues in a satisfactory manner. [7]


SPARQL Query in AllegroGraph







The following simple SPARQL query returns all country capitals in Africa:

PREFIX abc: <> 
SELECT ?capital ?country
  ?x abc:cityname ?capital ;
     abc:isCapitalOf ?y .
  ?y abc:countryname ?country ;
     abc:isInContinent abc:Africa .

Variables are indicated by a "?" or "$" prefix. Bindings for ?capital and the ?country will be returned.

The SPARQL query processor will search for sets of triples that match these four triple patterns, binding the variables in the query to the corresponding parts of each triple. Important to note here is the "property orientation" (class matches can be conducted solely through class-attributes / properties) [8]

To make queries concise, SPARQL allows the definition of prefixes and base URIs in a fashion similar to Turtle. In this query, the prefix "abc" stands for “”.





External Links


  1. SPARQL Will Make the Web Shine
  2. wikipedia:recursive acronym
  3. SPARQL Query Language for RDF - W3C Working Draft:
  4. W3C Semantic Web Activity News - SPARQL is a Candidate Recommendation:
  5. Archive of W3C News in 2007:
  6. W3C Semantic Web Activity News - SPARQL is a Recommendation:
  7. SPARQL Charter:
  8. See: wikipedia:Duck typing

See Also

Semantic Web | Linked Data | OWL | RDF | N3 | XML | XSL | XSLT | JSON