Get Started What is a GraphDB? GraphDB vs RDBMS GraphDB vs NOSQL Language Drivers Cypher Cypher Basics Build a Recommendation Engine Cypher Refcard Data Modeling Graph Data Modeling Guidelines Working with Data Neo4j Browser Visualization Importing Data into Neo4j Graph… Learn More »

Goals
If you are a Rubyist, this guide provides an overview of options for connecting to Neo4j. While this guide is not comprehensive it will introduce the different drivers and link to the relevant resources.
Prerequisites
You should be familiar with graph database concepts and the property graph model. You should have installed Neo4j and made yourself familiar with our Cypher Query language.
Intermediate

Neo4j for Rubyists

ruby

We’ve got a long association with Ruby bindings for Neo4j.

There’s a wide choice of ways to access Neo4j from Ruby: from low-level access to the core Java API with jRuby, to access via our HTTP API, to hooking into Rails ActiveModel. Members of the Ruby community has developed all these drivers because of their desire to use Neo4j.

Deployment Mode

There’s a choice to make here: the classic deployment option where your MRI based ruby process talks to a separate Neo4j Server process via our HTTP-API, or the embedded mode with jRuby.

jruby logo 2

The former is a very familiar choice to any developer used to a relational or other NoSQL database. Your Neo4j database can be on a backend server in a different network tier, or right next to your app on your Machine. We generally recommend this model because it prevents mixing of concerns. This also allows you to use any Ruby distribution that you’d like, on any OS.

The latter is less common, but offers blazing fast performance and access to our core API. The payoff is that you need to deploy a jRuby app; that’s less of a chore these days with RbEnv and friends.

The Example Project

You can find out more about our example projects for many different languages here, you can also access it via the GitHub repository for the Neo4j developer resources. Feel free to check them out.

It is a small one page webapp for our movies database. The front-end is the same for all drivers, just the backends show you how to connect to Neo4j from the different languages and drivers.

Neo4j.rb

Andreas Ronge is one of our Swedish friends from Malmö, who has been writing the canonical Neo4j driver since before we hit 1.0.

The Neo4j.rb team (Andreas Ronge, Brian Underwood, Chris Griggs) continued the effort and just released version 3.0 in September 2014.

It supports accessing Neo4j in embedded mode via jRuby and remotely also via MRI. The neo4j Gem implements ActiveModel for use in Ruby on Rails. And the neo4j-core Gem is a just thin layer on top of Neo4j with a neat Cypher DSL.

Thanks to the team we can provide example projects for both gems.

Neography

Written by our own Max Di Marzi, Neography feels very familiar if you’re already used to Neo4j – it’s designed as a thin wrapper above our database APIs. It supports the Neo4j transactional Cypher endpoint as well as the existing REST API and even supports Neo4j-Spatial.

Other Drivers

Pacer

Express yourself clearly and model your application in terms you understand with Pacer – a JRuby gem for building embedded Neo4j applications.