Komputer & Telekomunikasi    
   
Daftar Isi
(Sebelumnya) SPARK (programming language)Sparse array (Berikutnya)

SPARQL

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 is considered as one of the key technologies of the 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

Advantages

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 ?emailWHERE {  ?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.

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.

Example

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

PREFIX abc: <http://example.com/exampleOntology#>SELECT ?capital ?countryWHERE {  ?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 #”.

Extensions

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.

GeoSPARQL is intended to provide a standardized interchange basis for geospatially linked data based on well-understood OGC standards (GML, WKT, Simple Features, etc.) which can support both quantitative and qualitative spatial reasoning and querying through SPARQL.[11]

SPARQL implementations

This list shows triplestore, APIs, and other storages that have implemented the SPARQL query language.

References

  1. ^ Jim Rapoza (2 May 2006). "SPARQL Will Make the Web Shine". eWeek. http://www.eweek.com/article2/0,1759, 1965980,00.asp. Retrieved 2007-01-17.
  2. ^ Segaran, Toby; Evans, Colin; Taylor, Jamie (2009). Programming the Semantic Web. O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. p. 84. ISBN 978-0-596-15381-6. 
  3. ^ "W3C Semantic Web Activity News - SPARQL is a Recommendation". W3.org. 2008-01-15. http://www.w3.org/blog/SW/2008/01/15/ sparql_is_a_recommendation. Retrieved 2009-10-01.
  4. ^ "XML and Semantic Web W3C Standards Timeline". 2012-02-04. http://www.dblab.ntua.gr/~bikakis/XML %20and%20Semantic%20Web%20W3C%20Stand ards%20Timeline-History.pdf.
  5. ^ "XML and Web Services In The News". xml.org. 6 October 2006. http://www.xml.org/xml/news/archives/ archive.10062006.shtml#5. Retrieved 2007-01-17.
  6. ^ "SparqlImplementations - ESW Wiki". Esw.w3.org. http://esw.w3.org/topic/SparqlImpleme ntations. Retrieved 2009-10-01.
  7. ^ Reuters (22 May 2006). "Berners-Lee looks for Web's big leap". zdnet.co.uk. Archived from the original on 2007-09-30. Retrieved 2007-01-17. 
  8. ^ "ViziQuer a tool to construct SPARQL queries automaticly". lumii.lv. http://viziquer.lumii.lv/. Retrieved 2011-02-25.
  9. ^ "D2R Server". http://www4.wiwiss.fu-berlin.de/bizer /d2r-server/. Retrieved 2012- 02-4.
  10. ^ "SPARQL2XQuery Framework". http://www.dblab.ntua.gr/~bikakis/SPA RQL2XQuery.html. Retrieved 2012- 02-4.
  11. ^ Battle, Robert; Kolas, Dave (2012). "Enabling the geospatial Semantic Web with Parliament and GeoSPARQL". Semantic Web (IOS Press) 3 (4): 355–370. doi:10.3233/SW-2012-0065. Retrieved 21 November 2012. 
  12. ^ Github - LuposDate
  13. ^ LuposDate Demo-Applet
  14. ^ "Profium Sense". 2012-06-18. http://www.profium.com/technologies/p rofium-sense.
  15. ^ "NoSQL Graph Store". 2012-04-27. http://www.ibm.com/software/data/db2/ linux-unix-windows/graph-store.html.

External links

(Sebelumnya) SPARK (programming language)Sparse array (Berikutnya)