3.4.10. User-defined functions

User-defined functions are written in Java, deployed into the database and are called in the same way as any other Cypher function.

This example shows how you invoke a user-defined function called join from Cypher.

3.4.10.1. Call a user-defined function

This calls the user-defined function org.neo4j.procedure.example.join().

Query. 

MATCH (n:Member)
RETURN org.neo4j.function.example.join(collect(n.name)) AS members

Result. 

+--------------------------+
| members                  |
+--------------------------+
| "John,Paul,George,Ringo" |
+--------------------------+
1 row

For developing and deploying user-defined functions in Neo4j, see Extending Neo4j → User-defined functions.

3.4.10.2. User-defined aggregation functions

User-defined aggregation functions are written in Java, deployed into the database and are called in the same way as any other Cypher function.

This example shows how you invoke a user-defined aggregation function called longestString from Cypher.

3.4.10.3. Call a user-defined aggregation function

This calls the user-defined function org.neo4j.procedure.example.longestString().

Query. 

MATCH (n:Member)
RETURN org.neo4j.function.example.longestString(n.name) AS member

Result. 

+----------+
| member   |
+----------+
| "George" |
+----------+
1 row

For developing and deploying user-defined aggregation functions in Neo4j, see Extending Neo4j → User-defined aggregation functions.