I've been meaning to have a play with Ruby for a while now, and I have a project in mind that a dynamic language would be perfectly suited for. The trouble is, it's an ontology processing project. I don't really want to go to the trouble of building the supporting infrastructure myself (been there, done that). So I've been looking for ontology handling, or at least RDF handling libraries for Ruby. It's not exactly a large field. There are some largely moribund projects, and two active projects I could find: ActiveRDF and Redland. Redland is Dave Beckett's C API for RDF, which comes with bindings to several other languages, including Perl, Python and Ruby. It is, by design, just an RDF API: OWL processing will have to be built on top. ActiveRDF is a meta-wrapper: it provides a common Ruby API to other stores, including Redland, Sesame and Jena (in jRuby only). I probably should spend some more time with ActiveRDF, but some of the "Why do you and why don’t you …" answers on the FAQ mean that my application isn't going to fill all that well with their assumptions. So it looks like my choices are to use the Redland API from generic Ruby, or stick with jRuby and call the Jena API.
I decided to have a go with Redland, since I know Dave and it will be interesting to see up-close how another RDF API works. First hurdle, then, was sorting out the install. I'm working on Fedora 7 at home. This does ship with a version of Redland (though neither of the RPM versions available on Dave's web site), but not the Ruby bindings. Trying to install
http://download.librdf.org/binaries/redhat/fc6/redland-ruby-126.96.36.199-1.i386.rpm results in version incompatibility with the Fedora versions of Redland. Trying to install
redland-1.0.6-1.i386.rpm results in unmet dependencies with
libpq.so.4 (Fedora 7 has .4 and .5, respectively). However, installing the source RPM's from http://download.librdf.org/source/ and rebuilding the binary RPM files solved that problem. Next issue:
redland-bindings would not, however, build correctly from source (reporting this problem:
error: Installed (but unpackaged) file(s) found:However, once I'd got the updated RPM's built for redland, rasqal and raptor I could simply install Dave's pre-built
redland-ruby-188.8.131.52-1.i386.rpm. Phew. OK, so this is side-stepping rather than solving the underlying problem, but hey, life is short.
The good news is that the demo program
example.rb worked first time, and seemed quite nippy without the overhead of starting up a JVM. Right, now time to get on with some coding!