Version: 0.0.1

Design Overview

This is an overview of the design of Redleaf, where it differs from the Redland library’s API, along with links into the appropriate Guided Tour page that provides examples and covers the topic in greater detail.

Redland Library Classes

The Redleaf classes follow the basic design of the Redland library, from which it derives most of its underlying functionality, with a few changes. Here’s the class layout borrowed from The Design and Implementation of the Redland RDF Application Framework:

Redland Classes

The classes that make up the Redland library.

Redleaf Library Classes

Redleaf simplifies the view of the library somewhat, hiding Stream and the collection classes behind more-familiar Ruby interfaces, removing the need to construct intermediate instances of Query and Serializer, and mapping Node and URI objects to and from native Ruby objects:

Redleaf vs. Redland

How Redland classes map to Redleaf ones.

A simplified view of the classes you’ll use in Redleaf looks something like this:

Redleaf Design Overview

Redleaf classes.

Nodes

The biggest change is that Redleaf is written with the idea that you will want to use regular Ruby values for statement values in the Graph, not instances of a specialized “node” type that you have to wrap and unwrap yourself.

To facilitate this, Redleaf provides a mapping of some of the more common Ruby classes to types in the XML Schema namespace, and a way to extend the conversion system with your own datatypes. It also uses the standard-library URI class instead of a Redland-specific one, and translates Strings containing URIs in most places where a URI is expected.

Type-conversion and blank nodes are covered in the Node Type System section.

Other Changes

Beyond that, the changes are pretty minor.

Higher-Level Abstractions

I’ve tried to make the basic library easy to use for people who just want to start playing with triples, and also expose as much of Redland’s power as possible for people who are more familiar with it. There’s still a ways to go in both regards, but Redleaf is also intended to be a way that you can integrate RDF into your code without having to necessarily know or care about the particulars of Graphs and Stores, and several experimental higher-level utilities are planned to help with this.

Archetypes

Archetypes are a way to build up functionality in Ruby classes by allowing you to mix in RDF Vocabularies. It’s still experimental, and the implementation is subject to change, but there’s a page on the project site that will eventually be merged with this manual that you can read if you’re interested.

Reasoners

One of the most useful and unique things about data stored in RDF format is the ability to fill in new information via inference, and to do that, most RDF systems come with one or more reasoners you can use to augment the explicit statements in your graph. We plan to eventually include a reasoning engine with Redleaf; our notes on the subject can be found