Neo4j extension to execute various languages with Cypher.
Setup steps (basic GraalVM and Neo4j install):
-
Download Neo4j community server from neo4j.com.
-
Follow download instructions to set up the database and start it.
-
Download and install GraalVM SDK. GraalVM docs shows one way, but I used SDKMAN! to install it and set GraalVM’s Java (currently
20.3.0.r11-grl
) as my default SDK. -
Install any GraalVM languages you intend to use with the GraalVM Updater (gu). Use command syntax
gu install <language>
. Note: there may be a couple of other steps for dependencies to run a language, see the docs for each language. -
Create and start an instance of Neo4j (
bin/neo4j start
).
Steps to run the examples:
-
Open the file folder where you installed the database (we’ll use this in a minute).
-
Clone this repository, open in your preferred IDE.
-
Build the project, then run
mvn clean package
(either at command line or through your IDE). This will create a .jar file in thetarget
folder. -
In your IDE or project folder, copy the .jar file (neo4j-graalvm-polyglot-1.0-SNAPSHOT.jar) and paste it in the
/plugins
folder where Neo4j is installed. -
If already started, restart Neo4j.
-
Open a Neo4j Browser window (web browser and go to localhost:7474).
-
Run some test commands to see how it works!
-
Example 1:
CALL polyglot.run('js', '"hello"')
-
Example 2:
CALL polyglot.run('js','print("hello")')
(print messages go to neo4j.log output) -
Example 3:
CALL polyglot.run('python','CALL polyglot.run('python', 'import math; totalEntities = 3000; callsNeeded = int(math.ceil(totalEntities / 100)); callsNeeded');')
-
Languages accepted as first parameter: llvm, R, js, python, ruby
-