4.12. 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.

4.12.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

Table 4.175. Result
members

1 row

"John,Paul,George,Ringo"

Try this query live.  UNWIND ["John", "Paul", "George", "Ringo"] as name CREATE (:Member {name: name}) MATCH (n:Member) RETURN org.neo4j.function.example.join(collect(n.name)) AS members

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

4.12.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.