I have a Community Edition 4.2.5 database that I'd like to be able to query via Scala code. When I pop the db open using the web interface and launch a query, it works great. However, when I launch the same query using Neo4j embedded, no results are returned. The code seems to be connecting to the database, as I don't see a "Database Not Found" error, but I have been unable to retrieve any data from it using this method. If it matters, I'm building the project with SBT version 1.5.0. Code snippet below:
val dir = new File("path_to_db_dir")
val managementService = new DatabaseManagementServiceBuilder(dir)
val graphDb = managementService.database("db_name")
val transaction = graphDb.beginTx()
val query: String =
"MATCH (n:Page) RETURN n LIMIT 25"
val result = transaction.execute(query)
Neo4j dependency in build.sbt:
libraryDependencies ++= Seq(
"org.neo4j" % "neo4j" % "4.2.5"