Rails 3 and graph databases

2020-05-23 08:44发布

问题:

A Rails 3 application running on Postgresql needs to switch to a graph database to be able to grow up. There are many of them and they all offer different kind of API, REST mostly.

I am highly inspired by talks of Emil Eifrem, CEO of NeoTechnologies, about what can be accomplished with Neo4j. I must confess, I've played with it and this thing is absolutely what we need, but there are several obstacles.

  1. REST API is not transactional.
  2. Rails 3 apps are running on ruby 1.9.2, but not jRuby 1.5.3 or 1.6 to achieve native API.

Some databases are also driven by Java and offer REST API, so taking them changes nothing. Someother are not an option for us because of a license or a cost or a lack of team behind them.

I assume I'm missing something, so would appreciate any tip, insight or advice about what are our options and and what can play well for us. Thanks.

回答1:

You can run Neo4jrb with Rails 3 on jruby 1.6, so that should not be a problem.

To run a transactional (REST) API on top of that you can easily write your own Neo4j-Server plugin/extension that could also use Neo4jrb internally but exposes an API that fits your domain and is less verbose/chatty than the fine grained Neo4j-Server REST API. This should also be easier to consume for your clients as it talks in your terms, vocabulary and use-cases.

We're currently working on creating a generic (j)ruby server extension that is able to consume posted code and make it available as new REST endpoints.