XML News from Wednesday, February 23, 2005

The W3C RDF Data Access Working Group has published the second public working draft of SPARQL Query Language for RDF. According to the introduction,

An RDF graph is a set of triples, each triple consisting of a subject, a predicate and an object, as defined in RDF Concepts and Abstract syntax. These triples can come from a variety of sources. For instance, they may come directly from an RDF document. They may be inferred from other RDF triples. They may be the RDF expression of data stored in other formats, such as XML or relational databases.

SPARQL  (SPARQL Protocol And RDF Query Language) is a query language for getting information from such RDF graphs. It provides facilities to:

As a data access language, it is suitable for both local and remote use. When used across networks, the companion SPARQL Protocol for RDF document describes a remote access protocol.

Here's a simple example SPARQL query adapted from the draft:

PREFIX  dc: <http://purl.org/dc/elements/1.1/>
PREFIX  : <http://example.org/book/>
SELECT  $var
WHERE   ( :book1  dc:title  $var )

The $ indicates a variable name. (The previous draft used a question mark instead.) This query stores the title of a book in a variable named var. There are boolean and numeric operators as well.