Skip to content
Scala wrapper for Neo4j Graph Database
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Neo4j Scala wrapper library


It's been a while since I worked on this project, so you might want to check FaKod's fork which is much more active and up to date.


The Neo4j Scala wrapper library allows you the Neo4j open source graph database through a domain-specific simplified language. It is written in Scala and is intended to be used in other Scala projects.

This wrapper is mostly based on the work done by Martin Kleppmann in his Scala implementation of RESTful JSON HTTP resources on top of the Neo4j graph database and Jersey project. I thought it'd be usefull to extract the Neo4j DSL into a seperate project, and Marting agreed to this.


You need a Java 5 (or newer) environment and Maven 2.0.9 (or newer) installed:

$ mvn --version
Apache Maven 3.0-alpha-5 (r883378; 2009-11-23 16:53:41+0100)
Java version: 1.6.0_15
Java home: /usr/lib/jvm/java-6-sun-
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.31-12-generic" arch: "i386" Family: "unix"

You should now be able to do a full build of neo4j-resources:

$ git clone git://
$ cd neo4j-scala
$ mvn clean install

To use this library in your projects, add the following to the dependencies section of your pom.xml:


If you don't use Maven, take target/neo4j-scala-0.9.9-SNAPSHOT.jar and all of its dependencies, and add them to your classpath.


Please consider using Github issues tracker to submit bug reports or feature requests.

Using this library

Using this wrapper, this is how creating two relationships can look in Scala:

start --> "KNOWS" --> intermediary --> "KNOWS" --> end

And this is how getting and setting properties on a node or relationship looks like :

start("foo") = "bar"
start("foo") match {
  case Some(x) => println(x)
  case None => println("aww")

Besides, the neo4j scala binding makes it possible to write stop and returnable evaluators in a functional style :

//StopEvaluator.END_OF_GRAPH, written in a Scala idiomatic way :
start.traverse(Traverser.Order.BREADTH_FIRST, (tp : TraversalPosition) => false, ReturnableEvaluator.ALL_BUT_START_NODE, DynamicRelationshipType.withName("foo"), Direction.OUTGOING)

//ReturnableEvaluator.ALL_BUT_START_NODE, written in a Scala idiomatic way :
start.traverse(Traverser.Order.BREADTH_FIRST, StopEvaluator.END_OF_GRAPH, (tp : TraversalPosition) => tp.notStartNode(), DynamicRelationshipType.withName("foo"), Direction.OUTGOING)


See LICENSE for details.

You can’t perform that action at this time.