Neo4jRestSharp is a .Net client for the Neo4j Rest Server. Neo4j is an open sourced java based transactional graph database that stores data structured in graphs rather than in tables.
Latest News: (6/25/2010)
After suffering a server meltdown, and rebuild, I'm back on the project. Node management and Relationship APIs are working, and I'm getting to work on the Node Traversal API now.
(For the full status, see the Status section below
is a very powerful graph database that can handle a huge amount of data. I have been about to write queries using Neo4j that execute sub-second, where the query's (optimized) SQL Server analog would take several minutes
The problem for us .Net developers is that Neo4j is an in-process Java library, so it can't be easily used by .Net applications. So the purpose of this project is to create a way for .Net applications to nativly interact with a Neo4j database via its REST
Props and Dependencies
The code in this library was loosly based on a
proof of concept project written by Magnus Martenson
project is used in this project to handle json data formatting
library is used when running unit tests to extract the Neo4J REST server binaries
Neo4jRestSharp has a fairly simple architecture; at its heart is pretty much a simple wrapper around the Neo4j REST calls.
There are three service layers:
- Neo4jRestServices: all API calls take and return json text. This layer does the actual http calls to the Neo4j REST server.
- Neo4jJsonServices: all API calls take and return
Json objects. This layer propagates all calls to the Neo4jRestServices layer, and manages the transformation of json text to and from Json objects.
- Neo4jObjectServices: all API calls take and return Node and Relationship graph objects. This layer propagates all calls to the Neo4jJsonServices layer, and manages the transformation of json objects to and from Node and Relationship objects.
As should be obvious, each layer uses the next layer in the stack to handle REST calls. IE: the Neo4jObjectServices methods propagate calls to Neo4jJsonServices methods, which in turn propagates calls to Neo4jRestServices methods.
This allows for flexibility and options when interacting with the Neo4j REST Server. If you need better performance and don't mind manually generating and parsing Json text, use the Neo4jRestServices. If you want to use Json.Net objects, use the Neo4jJsonServices.
And if you want to use the Node and Relationship objects, or create domain objects that encapsulate them, then use the Neo4jObjectServices.
The library is still being developed.
Currently I've got the REST calls working for creating, editing, and deleting graph nodes, node properties, node relationships, and relationship properties. I am currently working on the API for
traversing graph nodes, and managing the lucene indexe. This will be coming shortly. Also, some of the class interfaces will probably change as new features get fleshed out.
to see the full list of REST calls for the Neo4j REST Server:
The following are the calls I have checked in:
- SetNodeProperty (API call is written, but the Neo4j REST server always returns an error. Working with the Neo4j folks to figure this out)
The following are the calls I still need to write:
- SetRelationshipProperty (gona do this last)
- GetRelationshipProperty (gona do this last)
- RemoveRelationshipProperty (gona do this last)
The Set, Get, and Remove Relationship Property (singular) calls I haven't written yet, as I want to get the traversal and and indexing REST calls working as soon as possible. As of now, you can update relationship properties by using the plural API calls.
Setting up Neo4j REST server
To get a Neo4j Rest Server up and running follow the instructions on the Getting Started page
Unit Test Notes
The unit test project contains a zip file with the full binaries for the Neo4j REST service. Each test fixture will unpack the zip file, install and start the REST service, run the fixture tests, then stop and remove the REST service, then remove all the directories
that was created by extracting the zip file, including the lucene index directory.
So because of having to start and stop a windows service, you'll need to run your unit tests under admin privileges