Today I announced the release of Raptor 1.4.0 which actually adds a new major part of functionality to Raptor – serializing. Although this is a major change but didn’t break older APIs so the temptation to call it raptor2 was only slight.
This means Raptor can now do both parsing: syntax to RDF triples and serializing: RDF triples to syntax. All the icky syntax details now available in one library :) I’ve been able to delete code from Redland which is great.
Or in terms of the command line rapper utility:
rapper -i rdfxml -o ntriples file.rdf > file.nt rapper -i ntriples -o rdfxml file.nt > file2.rdf
which won’t give the exact same file out, but it will encode the same triples. (the first example above is actually the default with no options)
Ob Metacomment: in an email I sent to redland-dev answering a question earlier this week I said I’d get round to doing serializing sometime I had a free weekend. As it happens, it took only a couple of lunchtimes this week and a few evenings to get it going. The rest of the evenings and this weekend were needed just for testing that it worked with Redland and Redland Bindings and then more testing and release management of Raptor. So right now, the CVS Redland called via the python binding can do:
$ python
>>> import RDF
>>> model=RDF.Model(storage=RDF.MemoryStorage())
>>> model.load("http://planetrdf.com/index.rdf")
>>> print len(model.to_string(name="ntriples"))
174836
>>> print len(model.to_string())
206002
(and for the Pythoneers reading, yes I overload __str__ so
print len(str(model) works too)
Rasqal 0.9.3 now with SPARQL
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:
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; Console.WriteLine("Result:"); IDictionaryEnumerator enumerator = result.GetEnumerator (); while (enumerator.MoveNext ()) Console.WriteLine(" {0} = {1}", enumerator.Key, enumerator.Value); qr.MoveNext(); }(This can likely be made more C#-idiomatic)