SPARQL
From LIS 460 Summer 2007
Contents |
About SPARQL
SPARQL, (pronounced “Sparkle”) is a recursive acronym standing for SPARQL Protocol and RDF Query Language. SPARQL is a RDF (Resource Description Framework) query language and a data access protocol for the Semantic Web. SPARQL is for querying RDF graphs (data model) via pattern matching and will work for any data source that can be mapped into RDF. The language's features include basic conjunctive patterns, value filters, optional patterns, and pattern disjunction. The SPARQL protocol is a method for remote invocation of SPARQL queries.
SPARQL is designed to make Web pages easier for machines to read, allowing all sorts of different data to be put to work on the Web. SPARQL can be used to express queries across diverse data sources, whether the data is stored natively as RDF or viewed as RDF via middleware. SPARQL contains capabilities for querying required and optional graph patterns along with their conjunctions and disjunctions. SPARQL also supports extensible value testing and constraining queries by source RDF graph. The results of SPARQL queries can be results sets or RDF graphs. In an interview in May 2006, Sir Tim Berners-Lee said that “SPARQL will make a huge difference”.
SPARQL is undergoing standardization by the RDF Data Access Working Group (DAWG) of the World Wide Web Consortium. SPARQL was a W3C Candidate Recommendation in June 2007.
SPARQL in Context
Work on RDF query languages has been progressing for a number of years. Several different approaches have been tried, such as familiar looking SQL-style syntaxes, like RDQL. The SQL approach has probably been the most popular and widely implemented. SPARQL follows the same path, offering a simple, reasonably familiar (to SQL users) SELECT query. SPARQL actually consists of three separate specifications. The query language, as said before, is the core specification, but the other specification is the query results XML format. It describes an XML format for serializing the results of a SPARQL SELECT (and ASK) query. This simple format is easily processable with common XML tools such as XSLT. The third specification is the data access protocol which uses WSDL 2.0 to define simple HTTP and SOAP protocols for remotely querying RDF databases. The XML results format is used to generate responses from services that implement this protocol.
SPARQL Query Tools
There are several tools and APIs that already provide SPARQL functionality, and most of them are up to date with the latest specifications.
• ARQ, a SPARQL processor for Jena http://jena.sourceforge.net/ARQ/
• Rasqal, the RDF query library included in Dave Beckett's comprehensive Redland framework http://librdf.org/rasqal/
• RDF::Query http://kasei.us/code/rdf-query/
• twinql, a SPARQL processor for Lisp written by Richard Newman http://www.holygoat.co.uk/projects/twinql/
• Pellet, an open source OWL DL reasoner in Java, that has partial SPARQL query support http://www.mindswap.org/2003/pellet/
• KAON2, another OWL DL reasoner that has partial SPARQL support. http://kaon2.semanticweb.org/
Useful Links
Specs, articles and tutorials
W3C RDF Data Access Working Group http://www.w3.org/2001/sw/DataAccess
XML.com: Introducing SPARQL: Querying the Semantic Web http://www.xml.com/pub/a/2005/11/16/introducing-sparql-querying-semantic-web-tutorial.html
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 Frequently Asked Questions http://thefigtrees.net/lee/sw/sparql-faq
Various SPARQL use-case demos
SPARQL Calendar Demo http://esw.w3.org/topic/SparqlCalendarDemo
SPARQL & Web Clipboard Demo http://www.sparqlets.org/clipboard/demo
Live SPARQL Demo - Virtuoso Universal Server http://demo.openlinksw.com/sparql_demo
