XML News from Sunday, March 5, 2006

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

An RDF graph is a set of triples; each triple consists of a subject, a predicate and an object. This is 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; or they may be the RDF expression of data stored in other formats, such as XML or relational databases. The RDF graph may be virtual, in that it is not fully materialized, only doing the work needed for each query to execute.

SPARQL is a query language for getting information from such RDF graphs. It provides facilities to:

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. This query stores the title of a book in a variable named var. There are boolean and numeric operators as well. Strangely you can also use a dollar sign to represent a variable name. As far as I can tell this is exaclty the same as using a question mark. Why two forms? I don't know but I can guess. This really smells of a massive and pointless argument within the working group that was resolved by agreeing to do both when only one was necessary.