SPARQL (pronounced "sparkle", a recursive acronym for SPARQL Protocol and RDF Query Language) is an RDF query language, that is, a query language for databases, able to retrieve and manipulate data stored in Resource Description Framework format.[1][2] It was made a standard by the RDF Data Access Working Group (DAWG) of the World Wide Web Consortium, and considered as one of the key technologies of semantic web. On 15 January 2008, SPARQL 1.0 became an official W3C Recommendation [3][4].
SPARQL allows for a query to consist of triple patterns, conjunctions, disjunctions, and optional patterns.[5]
Implementations for multiple programming languages exist.[6] "SPARQL will make a huge difference" according to Sir Tim Berners-Lee in a May 2006 interview.[7]
There exist tools that allow one to connect and semi-automatically construct a SPARQL query for a SPARQL endpoint, for example ViziQuer.[8] In addition, there exist tools that translate SPARQL queries to other query languages, for example to SQL[9] and to XQuery[10].
|
Contents
|
SPARQL allows users to write unambiguous queries. For example, the following query returns names and emails of every person in the dataset:
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?email WHERE { ?person a foaf:Person. ?person foaf:name ?name. ?person foaf:mbox ?email. }
This query can be distributed to multiple SPARQL endpoints (services that accept SPARQL queries and return results), computed, and results gathered, a procedure known as federated query.
The SPARQL language specifies four different query variations for different purposes.
Each of these query forms takes a WHERE block to restrict the query although in the case of the DESCRIBE query the WHERE is optional.
Another SPARQL query example that models the question "What are all the 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 or 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#”.
SPARUL, or SPARQL/Update, is an extension to the SPARQL query language that provides the ability to add, update, and delete RDF data held within a triple store.
This list shows triplestore, APIs, and other storages that have implemented the SPARQL query language.
|
||||||||||||||||||||||||||||
|
|
|||||
This entry is from Wikipedia, the leading user-contributed encyclopedia. It may not have been reviewed by professional editors (see full disclaimer)