Scala

Neo4j Wiki から

Martin Kleppman has contributed a Scala implementation of RESTful JSON HTTP resources on top of the Neo4j graph database and Jersey. In addition to this, there's a project template that will get your application up and running with a clean JSON REST API quickly. Read the initial announcement on the mailing list for some thoughts from the author. 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"
val foo = start("foo");


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)

Another project, Neo4j-scala (also found on GitHub), is a subset of Neo4j resources that only includes Scala wrappers around Neo4j APIs without the REST stuff.

A new attempt on using Neo4j with Scala have been started on Github by Niels Hoogeveen. Scala version 2.8 is required. Make sure to take a look at the wiki as well, for instance this page.

Neo4j のサイト
ツールボックス