You're viewing a "classic" blog entry.

Navigation

2007‎ > ‎10‎ > ‎26‎ > ‎

The State of RDF Support in Ruby (2007)

My apologies (to both my readers) about the somewhat duplicate post. I'm going to reboot this series of posts. I kept putting it off because it was too ambitious to start with. I'm going to try to make this just two posts.

Originally I wanted to go in depth about each of the RDF options in Ruby, but--although I have done a good bit of research--I don't have the time or knowledge to actually do that. Instead I'm going going to give an overview of each RDF library, and in my second post I'll talk about where I think the Ruby community should go from here.

What is RDF?

The Resource Description Framework (RDF) is a framework for adding a layer of machine readable metadata to the Internet. The simplest example is declaring information about web pages such as the author, date of publication, etc. See the classic "semantic web" article in Scientific American for more information about the vision of the Semantic Web.

RDF differs from other methods for declaring metadata in that it is made to be generic, and it is really the foundation for much richer information. RDF is designed to be one of the lower levels in the Semantic Web Layer Cake, and as a standard it is designed to enable the free interchange of knowledge.

Scripting languages are well positioned--perhaps uniquely positioned--for handling RDF data, and Ruby is no exception. There are two presentations to view to get you excited about the prospects for a Ruby/RDF integration.

So, RDF is the future direction of the World Wide Web, and mature RDF support in Ruby is crucial to the future of Ruby as a language, if it is going to be used to process data from the Internet.

What is the state of RDF support in Ruby?

I'll provide a brief overview of the state of RDF support in Ruby. Based on my research there are six different libraries for processing RDF:

Not all of the projects are active, but most of the code is out there for use.

RubyRDF

Status: Dead
This was I believe the first Ruby related RDF project. During its time it subsumed a couple of other RDF projects (one called RDF4R and another an XSLT based RDF parser). Aside from being a dead project RubyRDF is also incomplete. A couple of the query forms were never implemented. However, that is not to say that we shouldn't appreciate the work that went into this project, and the code is available for use. Here is an example that uses the library.

Dan Brickley (author of RubyRDF) has also said that he would be happy to retire the name if someone else wanted to use it for an RDF based Ruby library, since it is a generic name.

Rena

Status Inactive last release on 2004-07-08
Modeled after Jena (surprise!), Rena seems to be a relatively complete implementation. It has an NTriples format parser as well as a (partial) implementation of the RDQL query language. This is a dead query language (not unusual considering this projects age), and if you're interested in RDF query languages you should really start with SPARQL.

Rena does not have any RDocs, nor does it have much external documentation. There is an samples folder in the download with several example uses. Plus picking through the code it seems pretty straightforward to understand. Additionally, there is an old tutorial online.

Semitar

Status Inactive never released last CVS changes ~2005-06-03
Semitar is an RDF library that also supports OWL, and has some built-in rules based reasoning. It has a C based parser that is very fast. It has a slick DSL based interfaces for querying and creating triples. Heres an example of the query DSL in action.

It is sparse on documentation, and you basically have to browse through the code to understand everything. It has a lot of potential, but unfortunately it is inactive.

RDF Redland

Status Orphaned
RDF Redland is a Ruby wrapper to the librdf library. This presumably makes it fast. Unfortunately, this library seems to have suffered from a lack of love. Originally created by Dominic Sisneros, as I understand it got handed off to Dave Beckett (author of librdf) and the code is included in the librdf distribution.

The code for this wrapper could use some cleanup. It could be rewritten to be more Rubyish, and there are some minor features of librdf that it doesn't support. It is basically a SWIG binding wrapped in some Ruby classes.

In May of 2007, Dave posted to the redland-dev mailing list that he was going to have to discontinue directly supporting most of the language bindings for librdf because he (understandably) doesn't have the time or the expertise in all of the languages. At this point the Ruby bindings seem to be orphaned. I believe Dave is accepting patches for, but he is not actively developing, the Ruby bindings.

Samizdat

Status Somewhat Active last release 2006-11-29
Samizdat is more of an application than an RDF library. However, its author Dmitry Borodaenko has made strides towards a standard RDF layer for Ruby that could talk to any number of implementations. He has also split the RDF layer from Samizdat into a separate package (libsamizdat-ruby on Debian). This has a lot of potential to be a great RDF library for Ruby. It supports multiple RDBMSes as a backend. It has query support with Squish.

However, (as of 0.6.0) it does not have support for data-typed literals nor does it honor language tags for literals.

ActiveRDF

Status Active
ActiveRDF is the most recent and active RDF library for Ruby. It is meant to be a layer on top of an RDF triple store. It is very resource centric in its view of the world, but also has a Ruby DSL for querying triple stores. It has federation support, so you can bring together data from several sources and view and query them as a single triple store. It has support for rewriting the Ruby DSL queries into SPARQL to send them to a SPARQL endpoint. There are several examples of ActiveRDF in action on the homepage and wiki.

It does not have support for blank nodes, in fact it converts them into URI nodes when they are processed. It does support attaching a datatype to a literal node, but I don't believe it does anything more than that (such as validating the structure of an XMLLiteral). So in this sense it is not a fully compliant RDF implementation.

Conclusion

If you want to work with RDF in Ruby you have three viable options: Samizdat, ActiveRDF, and RDF Redland. If you want to work with a fully compliant RDF implementation, you have one option RDF Redland. If you want to work with a fully compliant and actively developed implementation, then you are out-of-luck.

This is a problem, and I'd like to talk about were we should go from here in my next post.

Originally published on October 26, 2007 at 5:09 pm

Comments

  1. Dmitry Borodaenko Says:
    November 4, 2007 at 7:19 pm

    Thanks for an excellent summary, Paul! Your explanation of status of RDF support in Samizdat is correct, so I suspect your assessment of other alternatives which I’m less familiar with is also quite close.

    In the last couple of years I didn’t do much work on RDF side of Samizdat and focused on the application side. RDF storage library provided by Samizdat is even older than 2006-11-29 (except bugfixes and minor improvements here and there), while Samizdat application is being constantly developed, with snapshots uploaded to Debian/experimental every couple of months. This means that while Samizdat’s RDF library is stagnant and misses several important features, for some uses it is sufficient as it is.

  2. The State of RDF support in Ruby (2007): Conclusion « Paul Stadig Says:
    November 7, 2007 at 11:57 am

    [...] 7th, 2007 In my last article “The State of RDF Support in Ruby (2007),” I did a quick overview of the available implementations of RDF for Ruby, and talked about [...]

  3. danbri’s foaf stories » RDF in Ruby revisited Says:
    February 8, 2008 at 2:23 pm

    [...] could continue going through the list of libraries, but Paul Stadig has already done a great job of this recently. There has been a lot of creative work around RDF/RDFS and OWL in Ruby, and collectively [...]