Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A simple, ready to go JRuby wrapper for the Neo4j graph database engine.
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time



A simple, ready to go JRuby wrapper for the Neo4j graph database engine which provides:

  • The Neo4j Core Java Library (required and ready to use)

  • Raw access to the Java API (using Neo4j::DB.instance )

  • Extensions to the Java API to make node manipulation and traversal more rubyesque

  • Working specs

  • Loaded Neo4j sample database with IMDB data

  • Nothing more then Neo4j goodness


  • Java

  • JRuby

Recommend way of installing JRuby

  1. Install RVM:

  2. Install Jruby using rvm: rvm install jruby

  3. Switch ruby to JRuby: rvm use jruby

Getting Started

Basic Node creation:

Neo4jr::DB.execute do |neo|
  node = neo.createNode
  node[:name] = 'Deiters, Matt'

Retrieve a Node:

Neo4jr::DB.execute do |neo|
  node = neo.getNodeById(1234)

Find a Node by some value you control:

Neo4jr::DB.execute do |neo|
  # If you add a property 'identifier' to a node, the value can be used to retrieve the node by
  # This can by an id or string but the value must be unique to this node
  # e.g. node[:identifier] =
  node = neo.find_node_by_identifier(

Traverse Database from a node:

Neo4jr::DB.execute do |neo|
  philip_seymour_hoffman = neo.getNodeById(1102)

  order         = Neo4jr::Order::BREADTH_FIRST
  stop_when     = Neo4jr::StopEvaluator::END_OF_GRAPH
  return_when   = Neo4jr::ReturnableEvaluator::ALL
  relationships = Neo4jr::RelationshipType.outgoing(:acted_in)

  traverser = philip_seymour_hoffman.traverse(order, stop_when, return_when, relationships)
  traverser.each do |node|

Use command line shell to query and modify the graph:

neosh -path <path_to_neo_db>


Copyright © 2009 Matthew Deiters. See LICENSE for details.

Something went wrong with that request. Please try again.