Examples to extend Neo4j with user-defined procedures and/or functions
Main steps:
- Follow Neo4j Java Developer Reference to set up a Neo4j plugin project.
- Create a jar. If you use
Maven
, editpom.xml
accordingly, and just runmvn package
. - If you use Neo4j API 4.0+, be sure to compile with Java 11+.
- Deploy the jar to the Neo4j database by just dropping the jar file into the Neo4j plugins directory (for the location of Neo4j plugins directory, refer to Operations Manual, File locations). Note that the database must be re-started (on each server) to pick up new procedures and functions.
- Call procedures/functions via Cypher, Neo4j’s graph query language (e.g., for densest sugraph, type
CALL org.neo4j.aidna.examples.densestSubgraph()
). - If you run into memory issues (e.g., Java heap space error), you can change memory settings in the 'neo4j.conf' file (e.g., 'dbms.memory.heap.max_size' entry).