This section introduces user-defined procedures and functions in Neo4j.

User-defined procedures and user-defined functions are mechanisms that enable you to extend Neo4j by writing custom code, which can be invoked directly from Cypher. This is the preferred means for extending Neo4j.

Examples of use cases for procedures and functions are:

  • To provide access to functionality that is not available in Cypher.

  • To provide access to third party systems.

  • To perform graph-global operations, such as counting connected components or finding dense nodes.

  • To express a procedural operation that is difficult to express declaratively with Cypher.

Procedures and functions are written in Java and compiled into jar files. They are deployed to the database by dropping that jar file into the plugins directory on each standalone or clustered server. For the location of the plugins directory, refer to Operations Manual → File locations. The database must be re-started on each server to pick up new procedures and functions.

Procedures and functions can take arguments and return results. In addition, procedures can perform write operations on the database.

Type Description Syntax Read/Write Cardinality


For each row the procedure takes parameters and returns multiple results

CALL abc(…​)

Update allowed

Changes cardinality similarly to a MATCH clause (0, 1 or many)

Scalar function

For each row the function takes parameters and returns a single result



Maintains cardinality, one for one

Aggregating function

Consumes many rows and produces an aggregated result

WITH abc(…​)


Reduces cardinality, many down to one

Neo4j also comes bundled with a number of built-in procedures and functions.

The available built-in procedures varies depending edition and mode, as described in Operations Manual → Procedures. Running CALL dbms.procedures() will display the full list of procedures available in a particular database instance, including user-defined procedures.

The built-in functions are described in Cypher Manual → Functions. Running CALL dbms.functions() will display the full list of all the funcitons available in a particular database instance, including user-defined functions.