Stored procedures

Procedures are the preferred means for extending Neo4j. It allows Neo4j to be extended by writing custom code which can be invoked directly from Cypher.

To know more about how to write and call procedures, please visit the Neo4j procedures documentation.

📘

Note

Stored procedures are available in 3.0.0 or higher versions of Neo4j. You can check your Neo4j version if you navigate to the Overview page of your database.

Adding stored procedures

Follow these instructions to add a stored procedure to your database:

  1. Navigate to the Extensions tab of your database dashboard, and select New stored procedure from the New extension drop-down menu.
  2. Name your stored procedure in order to be able to identify it afterward.
  3. Select the .jar file from your local path and click on Add stored procedure. There is a size limit of 100MB for Hobby and Standard databases and 500MB for Performance and higher.
  4. Do not close the browser window! The upload will stop if you close your browser. If the upload fails, you can click on the Retry button to start it again.
  5. When the upload completes successfully, you will see a new row in your Extensions list with the status ENABLED - PENDING.
959
  1. Before the stored procedure can be available for use, it is necessary to restart the database. To perform this operation, click on the Apply changes button.
  2. A new window will show you a list of the changes you are going to perform. Please review them and click on Apply changes.

You can enable/disable your stored procedures in your extensions list by clicking on the appropriate button next to each stored procedure. Remember that you should click on Apply changes button to confirm all of these changes.

Once the changes are applied, you will see the final status (ENABLED or DISABLED) in the list.

📘

Note

You can enable/disable more than one extension at once. Click on the Enable/Disable button of the different extensions.

Adding APOC

APOC is a generally usable library of procedures by Michael Hunger that covers different aspects that are currently not available on Cypher. It contains more than 200 procedures of different areas. You can read more about it here.

To add APOC to your database, just download the APOC jar file from the latest release on GitHub and select the file while adding a new stored procedure.

If you want to check that APOC is available in your database, you can use the following built-in procedure and get a list:

CALL dbms.procedures() YIELD name
RETURN head(split(name,".")) as package, count(*), collect(name) as procedures;

Removing stored procedures

To remove a stored procedure

  • Navigate to the Extensions tab of your database dashboard
  • Click on the Disable button next to the stored procedure you wish to remove.
  • Once the stored procedure is disabled, you can click on Remove to fully remove the stored procedure.
941

Only disabled stored procedures can be removed. Make sure you disable the procedure before attempting to remove it. You can disable the procedure by clicking on the Disable button.

❗️

Danger

This action cannot be undone and will delete your stored procedure permanently.