What Ruby library do you use for working with RDF?

There was some discussion of this question here: http://stackoverflow.com/questions/931548/the-state-of-rdf-in-ruby where Dave Beckett notes that the Ruby bindings for his Redland library have not been updated for a while (though probably still work). Can anyone comment on whether the Ruby Redland bindings work correctly in recent versions of Ruby?

I've also been experimenting with RdfContext from Gregg Kellogg http://github.com/gkellogg/rdf_context

What library do you use and what are its pros and cons?

I started RdfContext due to frustrations with the Redland Ruby Bindings. The primary issues for me were installation problems across different platforms, which is a real problem when you're developing a gem as a utility for non-programmers to use. A buggy Rdfa parser (which has since been updated and is now state-of-the-spec). And garbage collection issues, which didn't affect operation, but left complaints all over the place.

Redland's still the way to go for straight-out performance, but I felt that a pure-Ruby approach was necessary. The works not done; more stores could be added, and performance can be improved. I'm working on updating the N3 parser to take advantage of Quoted Graphs and be more compliant. I'd also like to add a SPARQL engine and work on better Rails integration.

The active pure-Ruby projects at this moment are RDF.rb, RdfContext and RDFObjects, and the most convenient Redland binding for Ruby is Redleaf.

I'm the lead developer for RDF.rb, so that's what I use. In brief, RDF.rb's pros are:

  • 100% pure Ruby with minimal dependencies and no bloat.
  • 100% free and unencumbered public domain software.
  • Extremely well-commented source code.
  • Compatible with Ruby 1.8.x, Ruby 1.9.x, and JRuby.
  • Provides a clean RDF object model and related APIs.
  • Fully modularized with a lean core, most non-core functionality available as add-on plugin gems.
  • Supports parsing and serializing N-Triples, Turtle, RDF/XML, RDF/JSON, and TriX data.
  • Supports accessing and storing RDF data in SQLite, PostgreSQL, MongoDB, Cassandra, Sesame, RedStore, and the Talis Platform.

The cons are primarily the lack of a SPARQL engine at present (a SPARQL client already exists, however).

If you wish to learn more, there are several in-depth tutorials available for RDF.rb:

The public-rdf-ruby@w3.org mailing list has also undergone something of a revival in the last month, so I'd highly recommend that anyone who cares about RDF in Ruby subscribe to the list and participate in the ongoing discussions.

As an alternative, you can explore ActiveRDF. A fork is being developed by enthusiasts on GitHub. I had used it a couple of years ago. Hope that helps.