SPARQL

From Wikipedia, the free encyclopedia

Jump to: navigation, search

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

SPARQL allows for a query to consist of triple patterns, conjunctions, disjunctions, and optional patterns.[6]

Several implementations for multiple programming languages exist [1]. "SPARQL will make a huge difference" according to Sir Tim Berners-Lee in a May 2006 interview. [7]

[edit] Example

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

PREFIX abc: <http://example.com/exampleOntology#> 
SELECT ?capital ?country
WHERE {
  ?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 - see Duck typing)

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 “http://example.com/exampleOntology#”.

[edit] References

[edit] External links

Personal tools