Dave Beckett's blog

Rasqal 0.9.3 now with SPARQL

2004-10-25 22:41

Today I announced the release of Rasqal 0.9.3 which follows a day after Raptor 1.4.0 was

announced for good reason, it needs it.

The main reasons for this release are firstly continuing the license change to LGPL 2.1/Apache 2.0 for the Redland libraries but more importantly, to add initial support for the draft SPARQL Query Language for RDF which was published as a first working draft 2004-10-12 by the RDF Data Access Working Group (DAWG). This is by no means a complete implementation of the entire language, it parses all the syntax and has an engine that also executes the core language, approximating to the RDQL support already in Rasqal. The Rasqal SPARQL To Do list covers all the parts not implemented.

So, in the same style as I announced Raptor 1.4.0, here's what you can do on the command line:

$ roqet -i sparql 
  -s http://www.w3.org/2001/sw/DataAccess/tests/data/simple/data-01.n3 
result: [p=uri<http://example.org/data/p>, q=uri<http://example.org/data/v1>]
result: [p=uri<http://example.org/data/p>, q=uri<http://example.org/data/v2>]

The command line is a bit verbose (newlines added for clarity) but it really does execute the SPARQL query and take the data from the web. The DAWG is working on an XML output format.

And of course, the language APIs have not been forgotten. Redland already provides Perl, Python and C# interfaces to querying so for variety, here's the C#:

QueryResults qr = model.Execute (new Query (query_string) );
while (!qr.End) {
  Hashtable result = (Hashtable) qr.Current;
  IDictionaryEnumerator enumerator = result.GetEnumerator ();
  while (enumerator.MoveNext ())
    Console.WriteLine("  {0} = {1}", enumerator.Key, enumerator.Value);

(This can likely be made more C#-idiomatic)