13

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.

mcmlxxxiii
  • 913
  • 1
  • 9
  • 21
  • Can you expand on what you mean by 'REST API is not transactional'? – Srdjan Pejic May 05 '11 at 13:47
  • 2
    Sure. Using REST API, you can not rollback a set of operations at once. For instance, you want to delete 3 nodes, you do first and second request, but third somehow fails and you cannot revert the storage to the state it was, before you started, with a word "rollback". But this can be achieved with native API. – mcmlxxxiii May 05 '11 at 13:55
  • 1
    That's a problem. Have you reported this bug to neo4j guys? I'm sure they'll want to correct that. – Srdjan Pejic May 05 '11 at 13:57
  • 2
    Hi there, yes - REST and Transactions are kinda hard to merge. There is right now a discussion going on on how to take a stab at that, see http://lists.neo4j.org/pipermail/user/2011-May/thread.html#8363 – Peter Neubauer May 05 '11 at 14:51
  • 2
    @SrdjanPejic That's not a bug, it is simply hardly possible. Any implementation will be a workaround, not a solution. Because there is no connection, REST API is just sending commands. – mcmlxxxiii May 05 '11 at 16:53
  • 2
    @Comptrol JRuby1.6 + Rails 3 + Neo4jrb (gem, providing native API) – mcmlxxxiii May 14 '11 at 21:36

1 Answers1

10

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.

Michael Hunger
  • 41,339
  • 3
  • 57
  • 80