language-icon Old Web
English
Sign In

SPARQL

SPARQL (pronounced 'sparkle', a recursive acronym for SPARQL Protocol and RDF Query Language) is an RDF query language—that is, a semantic query language for databases—able to retrieve and manipulate data stored in Resource Description Framework (RDF) format. It was made a standard by the RDF Data Access Working Group (DAWG) of the World Wide Web Consortium, and is recognized as one of the key technologies of the semantic web. On 15 January 2008, SPARQL 1.0 became an official W3C Recommendation, and SPARQL 1.1 in March, 2013. SPARQL allows for a query to consist of triple patterns, conjunctions, disjunctions, and optional patterns. Implementations for multiple programming languages exist. There exist tools that allow one to connect and semi-automatically construct a SPARQL query for a SPARQL endpoint, for example ViziQuer.In addition, there exist tools that translate SPARQL queries to other query languages, for example to SQL and to XQuery. SPARQL allows users to write queries against what can loosely be called 'key-value' data or, more specifically, data that follow the RDF specification of the W3C. Thus, the entire database is a set of 'subject-predicate-object' triples. This is analogous to some NoSQL databases' usage of the term 'document-key-value', such as MongoDB. In SQL relational database terms, RDF data can also be considered a table with three columns – the subject column, the predicate column, and the object column. The subject in RDF is analogous to an entity in a SQL database, where the data elements (or fields) for a given business object are placed in multiple columns, sometimes spread across more than one table, and identified by a unique key. In RDF, those fields are instead represented as separate predicate/object rows sharing the same subject, often the same unique key, with the predicate being analogous to the column name and the object the actual data. Unlike relational databases, the object column is heterogeneous: the per-cell data type is usually implied (or specified in the ontology) by the predicate value. Also unlike SQL, RDF can have multiple entries per predicate; for instance, one could have multiple 'child' entries for a single 'person', and can return collections of such objects, like 'children'. Thus, SPARQL provides a full set of analytic query operations such as JOIN, SORT, AGGREGATE for data whose schema is intrinsically part of the data rather than requiring a separate schema definition. However, schema information (the ontology) is often provided externally, to allow joining of different datasets unambiguously. In addition, SPARQL provides specific graph traversal syntax for data that can be thought of as a graph. The example below demonstrates a simple query that leverages the ontology definition foaf ('friend of a friend').

[ "Semantic Web", "RDF", "Swoogle", "RDF Schema", "Blank node", "rdf graph", "GRDDL" ]
Parent Topic
Child Topic
    No Parent Topic