An ActiveRecord-inspired wrapper for the Neo4j REST API
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Runeo is a wrapper for Neo4j's REST API, providing an ActiveRecord-like interface for Neo4j's functionality.


Runeo requires Ruby 1.9, and ActiveSupport.


First, you need to tell Runeo where the Neo4j instance is running:

Runeo::Base.url = "http://localhost:7474"

Then, you can use Runeo simply by instantiating Runeo::Node:

bob = Runeo::Node.create name: "Bob", age: 25
jim = Runeo::Node.create name: "Jim", age: 26
bob.relationships.create jim, "friend"

However, it is often more convenient to subclass Runeo::Node:

class Person < Runeo::Node

friend = Person.create name: "Bob", age: 25

Subclasses of Runeo::Node have access to special macros that allow more convenient creation and querying of related nodes:

class Person < Runeo::Node
  has_many :friends, via: { friend: :out }, class: "Person"
  has_many :referrals, via: { referrer: in }, class: "Person"
  has_one  :referrer, via: { referrer: out }

bob = Person.create name: "Bob", age: 25
jim = bob.friends.create name: "Jim", age: 26
jim.referrer = bob

Lastly, you can do a traversal query via the Runeo::Node#query method:

influence = bob.query max_depth: 4, relationships: { friend: :out }

By omitting the relationships key, you can traverse all relationships from all connected nodes, to the given depth. If you omit max_depth, it defaults to 1.


This project is far from complete. I am unlikely to continue work on it, since Neo4j's REST API turned out to be insufficient for what I was attempting to use it for. If you find Runeo interesting and/or useful, feel free to fork it and build on it.


Runeo is hereby submitted into the Public Domain by its author, Jamis Buck ( You may use it for whatever purposes you wish.

Please prefer good over evil.