SPARQL 1 SPARQL

SPARQL (pronounced "sparkle"[1] ) is an RDF ; its name is a recursive acronym that stands for SPARQL Protocol and RDF Query Language. It was standardized by the RDF Data Access Working Group (DAWG) of the Consortium, and is considered a key technology. On 15 January 2008, SPARQL became an official W3C Recommendation.[2] SPARQL allows for a query to consist of triple patterns, conjunctions, disjunctions, and optional patterns.[3] Implementations for multiple programming languages exist.[4] "SPARQL will make a huge difference" according to Sir Tim Berners-Lee in a May 2006 interview.[5] There exist tools that allow one to connect and semi-automatically construct a SPARQL query for a SPARQL endpoint, for example ViziQuer.[6]

Benefits SPARQL allows users to write globally unambiguous queries. For example, the following query returns names and emails of every person in the world:

PREFIX : SELECT ?name ?email WHERE { ?person a foaf:Person. ?person foaf:name ?name. ?person foaf:mbox ?email. }

..assuming the ontologies in use to describe a person are mapped to FOAF via rules from whatever ontology the original relations were in. This illustrates the Semantic Web's vision of treating the Web as a single enormous . Notice that this global unambiguity roots in the fact that every identifier in SPARQL, URI, is globally unambiguous, unlike "email" or "e-mail" normally used in SQL. This query can be distributed to multiple SPARQL endpoints, computed distributedly, and results gathered, a procedure known as federated query.

Query Forms The SPARQL language specifies four different query variations for different purposes. SELECT query Used to extract raw values from a SPARQL endpoint, the results are returned in a table format. CONSTRUCT query Used to extract information from the SPARQL endpoint and transform the results into valid RDF. ASK query Used to provide a simple True/False result for a query on a SPARQL endpoint. DESCRIBE query Used to extract an RDF graph from the SPARQL endpoint, the contents of which is left to the endpoint to decide based on what the maintainer deems as useful information. 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. SPARQL 2

Example Another SPARQL query example that models the question "What are all the country capitals in Africa?":

PREFIX abc: 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 . In this query, the prefix "abc" stands for “http://example.com/exampleOntology#”.

References

[1] Jim Rapoza (2 May 2006). "SPARQL Will Make the Web Shine" (http:/ / www. eweek. com/ article2/ 0,1759,1965980,00. asp). eWeek. . Retrieved 2007-01-17.

[2] "W3C Semantic Web Activity News - SPARQL is a Recommendation" (http:/ / www. w3. org/ blog/ SW/ 2008/ 01/ 15/ sparql_is_a_recommendation). W3.org. 2008-01-15. . Retrieved 2009-10-01.

[3] "XML and Web Services In The News" (http:/ / www. . org/ xml/ news/ archives/ archive. 10062006. shtml#5). xml.org. 6 October 2006. . Retrieved 2007-01-17.

[4] "SparqlImplementations - ESW Wiki" (http:/ / esw. w3. org/ topic/ SparqlImplementations). Esw.w3.org. . Retrieved 2009-10-01.

[5] Reuters (22 May 2006). "Berners-Lee looks for Web's big leap" (http:/ / web. archive. org/ web/ 20070930221904/ http:/ / news. zdnet. co.

uk/ / 0,1000000097,39270671,00. htm). zdnet.co.uk. Archived from the original (http:/ / news. zdnet. co. uk/ internet/

0,1000000097,39270671,00. htm) on 2007-09-30. . Retrieved 2007-01-17.

[6] "ViziQuer a tool to construct SPARQL queries automaticly" (http:/ / viziquer. lumii. lv/ ). lumii.lv. . Retrieved 2011-02-25.

External links

• W3C SPARQL Working Group (http:/ / www. w3. org/ 2001/ sw/ DataAccess/ ) (was RDF Data Access Working Group)

• SPARQL Query language (http:/ / www. w3. org/ TR/ rdf-sparql-query/ )

• SPARQL Protocol (http:/ / www. w3. org/ TR/ rdf-sparql-protocol/ )

• SPARQL Query XML Results Format (http:/ / www. w3. org/ TR/ rdf-sparql-XMLres/ )

• SPARQL Tutorial (http:/ / openjena. org/ ARQ/ Tutorial/ index. )

• SPARQL Examples (http:/ / en. sparql. pro) Article Sources and Contributors 3 Article Sources and Contributors

SPARQL Source: http://en.wikipedia.org/w/index.php?oldid=440661904 Contributors: A5b, Adrian.walker, Afreet, Akampman, AndersFeder, Andy Dingley, Beland, Brettz9, Cburnett, Chris the speller, Danja, Dmccreary, Doctus, EricP, Fingerz, Fleminra, Gthb, Holygoat, Jamelan, Jasy jatere, Jmrose, Jodi.a.schneider, John Vandenberg, JzG, Karima Rafes, Kcoy, Kennyluck, Khazar, KingsleyIdehen, KnightRider, Koavf, Lastorset, LeeFeigenbaum, Mdd, MeltBanana, Mortenf, Newty25, Proofreader77, Ricmitch, Risi, Rjwilmsi, Robertvan1, SarekOfVulcan, Shepard, Suruena, Tchetchenko, Theweirdguy, Thorwald, Thumperward, Tulcod, Ultimatewisdom, Universimmedia, Wesley, Woodart, Yaron K., Zviedris, 63 anonymous edits License

Creative Commons Attribution-Share Alike 3.0 Unported

http:/ / creativecommons. org/ licenses/ by-sa/ 3. 0/