Scala is a general purpose language, which is being increasingly used for high-performance applications, as it has been implemented over JVM, which makes interoperability easier with the existing Java libraries.
In this recipe, we will learn how to access the Neo4j graph database using Scala.
There are multiple solutions for this problem, although there is no standard module that can be considered as the de facto standard with Scala. The solution is listed in the following steps:
Java JAR files works with Scala due to interoperability, so the first way is to
import
Neo4j JAR files, which can be found under thelib
directory, under the Scala project.There are many REST clients available in Scala, such as Lift, Scalatra, and Akka with Spray, so it is easy to write your own code on the top of any of these libraries. One such example is being shown here:
import dispatch._ val http_client = new Http val json = http_client(:/("localhost:7474/data/db/) / ...