Jena Ruby Setup

Jena is an Open Source Java framework for building Semantic Web applications. It provides access to ARQ, OWL, RDF, RDFS, SPARQL, and various triplestores. It also includes a rule-based inference engine and various forms of extensibility (eg, magic predicates, virtual triplestores).

Obviously, Jena is a worthwhile tool to have around. Unfortunately, there is that pesky word "Java", found in the description of so many Semantic Web tools. Might there be a way for Rubyists to take advantage of Jena, while staying in their "happy place"? Indeed, there are...

If all you need to do is process SPARQL queries, Joseki (and Jena) may be all you need. Your Ruby app can generate the queries, pass them to Joseki, then process the results. In this usage, Jena and Joseki act as an HTTP-based, non-relational (ie, NoSQL) data store.

However, although SPARQL is a convenient query language, it can only be used for a limited set of tasks. In order to perform procedural graph traversals, let alone extend the framework, you'll need to make calls to Jena methods. Fortunately, JRuby provides an easy way to do this.


If you don't already have Java, Jena, and (if desired) Joseki installed, you'll have to do this before continuing here. You can find installation notes for these tools in "Semantic Web Programming" - Setup notes.

As you'll see, the notes allow you to add several other tools (eg, Eclipse, Graphviz, Pellet, Protege). These tools aren't strictly needed in order to use Jena, but are probably worthwhile to install if you have the time and space.


Installation details tend to vary across operating systems, So I'm breaking that out onto separate pages. I've created Mac OS X; submissions for other systems would be most welcome!


Taylor Cowan, author of the JenaBean library, provided me with an excellent jump start on this topic. See his blog entry, "Jena Ruby bindings: accessing Jena’s feature-rich RDF API from Ruby" for more information.

This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r2 - 02 Jul 2011, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email