Database Reference
In-Depth Information
Chapter 10
Neo4j + Ruby
This chapter focuses on using Ruby with Neo4j and reviewing the code for a working application that integrates the
five graph model types covered in Chapter 3. As with other languages that offer a driver for Neo4j, the integration takes
place using a Neo4j server instance with the Neo4j REST API. This chapter is divided into the following topics:
Ruby and Neo4j Development Environment
Neography
Developing a Ruby and Neo4j application
In each chapter that explores a particular language paired with Neo4j, I recommend that you start a free trial on
www.graphstory.com or have installed a local Neo4j server instance, as shown in Chapter 2.
To quickly set up a server instance with the sample data and plugins for this chapter, go to graphstory.com/
practicalneo4j . You will be provided with your own free trial instance, a knowledge base, and email support from Graph Story.
Tip
For this chapter, I expect that you have at least a beginning knowledge of Ruby and a basic understanding of how
to configure Ruby for your preferred operating system. While the examples should work with later versions of Ruby,
Ruby 1.9.2 is the version used in this chapter. In addition, the sample application uses the Apache HTTP server and
Passenger (also known as mod_rails).
If you do not have Apache HTTP installed, it is highly recommended that you follow the instructions at
http://httpd.apache.org/ based on your operating system. Configuring Ruby and Passenger with a local instance of
Apache HTTP is beyond the scope of this topic, but the basic steps can be found at http://recipes.sinatrarb.com/
p/deployment/apache_with_passenger .
Do This
I also assume that you have a basic understanding of the model-view-controller (MVC) pattern and some
knowledge of Ruby frameworks that provide an MVC pattern. There are, of course, a number of excellent Ruby
frameworks from which to choose, but I had to pick one for the illustrative purposes of the application in this chapter.
I chose the Sinatra framework because it is limited in its scope and allows the focus to remain on the application to
the greatest extent possible. This chapter is focused on integrating Neo4j into your Ruby skill set and projects and does
not dive deeply into the best practices of developing with Ruby or Ruby frameworks.
 
 
 
Search WWH ::




Custom Search