Search code examples
neo4jcypherneo4j-java-api

How do I (cypher) query Neo4j embedded graph database from java program for Neo4j 3.x?


Neo4j has grown a lot since I last used it (milestone 2.0 to 3.0). I wanted to use cypher from java program with embedded graph database (GraphDatabaseService).

I used to create an ExecutionEngine and go from there for this earlier.

It appears that now the preferred way is to use org.neo4j.driver.* for this purpose.

This bundle does not seem to be there in the libs I get from Neo4j 3.0.7.

Is there anyway I can execute cypher query for embedded graph database using java?


Solution

  • GraphDatabaseService has execute(...) function to run cyphers. https://neo4j.com/docs/java-reference/current/javadocs/org/neo4j/graphdb/GraphDatabaseService.html#execute-java.lang.String-

    There are some examples on Neo4j's tutorial page. http://neo4j.com/docs/java-reference/current/#tutorials-java-embedded