From 60b99028189522a1a6fc51c744722a8f2aa6505d Mon Sep 17 00:00:00 2001 From: Natalia Ivakina Date: Tue, 16 Dec 2025 14:24:32 +0100 Subject: [PATCH] Add reserved procedures/functions namespaces and naming rules --- .../aggregation-functions.adoc | 56 +++++++++++++++++++ .../ROOT/pages/extending-neo4j/functions.adoc | 55 ++++++++++++++++++ .../pages/extending-neo4j/procedures.adoc | 25 ++++++++- 3 files changed, 135 insertions(+), 1 deletion(-) diff --git a/modules/ROOT/pages/extending-neo4j/aggregation-functions.adoc b/modules/ROOT/pages/extending-neo4j/aggregation-functions.adoc index c431189..26d03af 100644 --- a/modules/ROOT/pages/extending-neo4j/aggregation-functions.adoc +++ b/modules/ROOT/pages/extending-neo4j/aggregation-functions.adoc @@ -32,6 +32,12 @@ An aggregator class contains one method annotated with `@UserAggregationUpdate` The method annotated with `@UserAggregationUpdate` will be called multiple times and enables the class to aggregate data. When the aggregation is done, the method annotated with `@UserAggregationResult` will be called once and the result of the aggregation will be returned. +Particular things to note: + +* All functions are annotated with `@UserAggregationFunction`. +* The aggregation function name must be namespaced and is not allowed in reserved namespaces. +* If a user-defined aggregation function is registered with the same name as a built-in function in a deprecated namespace, the built-in function is shadowed. + See xref:extending-neo4j/values-and-types.adoc[] for details on values and types. For more details, see the Neo4j Javadocs for link:{org-neo4j-procedure-UserAggregationFunction}[`org.neo4j.procedure.UserAggregationFunction`^]. @@ -132,3 +138,53 @@ public class LongestStringTest } ---- + +[[reserved-function-namespaces]] +== Reserved function namespaces + + +List of reserved function namespaces and names:: + +* * +* date +* date.realtime +* date.statement +* date.transaction +* date.truncate +* datetime +* datetime.fromepoch +* datetime.fromepochmillis +* datetime.realtime +* datetime.statement +* datetime.transaction +* datetime.truncate +* db.nameFromElementId +* duration +* duration.between +* duration.inDays +* duration.inMonths +* duration.inSeconds +* graph.byElementId +* graph.byName +* graph.names +* graph.propertiesByName +* localdatetime +* localdatetime.realtime +* localdatetime.statement +* localdatetime.transaction +* localdatetime.truncate +* localtime +* localtime.realtime +* localtime.statement +* localtime.transaction +* localtime.truncate +* point.distance +* point.withinBBox +* time +* time.realtime +* time.statement +* time.transaction +* time.truncate +* vector.similarity.cosine +* vector.similarity.euclidean + diff --git a/modules/ROOT/pages/extending-neo4j/functions.adoc b/modules/ROOT/pages/extending-neo4j/functions.adoc index 147957f..8a0f003 100644 --- a/modules/ROOT/pages/extending-neo4j/functions.adoc +++ b/modules/ROOT/pages/extending-neo4j/functions.adoc @@ -30,6 +30,12 @@ RETURN org.neo4j.examples.join(collect(p.names)) User-defined functions are created similarly to how procedures are created. But unlike procedures, they are annotated with `@UserFunction` and return a single value instead of a stream of values. +Particular things to note: + +* All functions are annotated with `@UserFunction`. +* The function name must be namespaced and is not allowed in reserved namespaces. +* If a function is registered with the same name as a built-in function in a deprecated namespace, the built-in function is shadowed. + See xref:extending-neo4j/values-and-types.adoc[] for details on values and types. For more details, see the link:{org-neo4j-procedure-UserFunction}[Neo4j Javadocs for `org.neo4j.procedure.UserFunction`^]. @@ -120,3 +126,52 @@ public class JoinTest { } ---- + +[[reserved-function-namespaces]] +== Reserved function namespaces + +List of reserved function namespaces:: + +* * +* date +* date.realtime +* date.statement +* date.transaction +* date.truncate +* datetime +* datetime.fromepoch +* datetime.fromepochmillis +* datetime.realtime +* datetime.statement +* datetime.transaction +* datetime.truncate +* db.nameFromElementId +* duration +* duration.between +* duration.inDays +* duration.inMonths +* duration.inSeconds +* graph.byElementId +* graph.byName +* graph.names +* graph.propertiesByName +* localdatetime +* localdatetime.realtime +* localdatetime.statement +* localdatetime.transaction +* localdatetime.truncate +* localtime +* localtime.realtime +* localtime.statement +* localtime.transaction +* localtime.truncate +* point.distance +* point.withinBBox +* time +* time.realtime +* time.statement +* time.transaction +* time.truncate +* vector.similarity.cosine +* vector.similarity.euclidean + diff --git a/modules/ROOT/pages/extending-neo4j/procedures.adoc b/modules/ROOT/pages/extending-neo4j/procedures.adoc index 22b8a62..2fd12c3 100644 --- a/modules/ROOT/pages/extending-neo4j/procedures.adoc +++ b/modules/ROOT/pages/extending-neo4j/procedures.adoc @@ -143,6 +143,8 @@ Particular things to note: * The procedure annotation can take three optional arguments: `name`, `mode`, and `eager`. ** `name` is used to specify a different name for the procedure than the default generated, which is `class.path.nameOfMethod`. If `mode` is specified, `name` must be specified as well. +** `name` is not allowed in a reserved namespace, and having a `name` without a namespace is deprecated behavior. +** If a procedure is registered with the same name as a built-in procedure in a deprecated namespace, the built-in procedure is shadowed. ** `mode` is used to declare the types of interactions that the procedure performs. A procedure fails if it attempts to execute database operations that violate its mode. The default `mode` is `READ`. @@ -163,7 +165,7 @@ Particular things to note: MATCH (n) WHERE n.key = 'value' WITH n -CALL deleteNeighbours(n, 'FOLLOWS') +CALL example.deleteNeighbours(n, 'FOLLOWS') ---- This query can delete some of the nodes that are matched by the Cypher query, and the `n.key` lookup will fail. Marking this procedure as `eager` prevents this from causing an error in Cypher code. @@ -273,3 +275,24 @@ public class MyProcedures { } ---- + + +[[reserved-procedure-namespaces]] +== Reserved procedure namespaces + +List of reserved procedure namespaces:: + +* cdc.* +* date.* +* datetime.* +* db.* +* dbms.* +* duration.* +* graph.* +* internal.* +* localdatetime.* +* localtime.* +* time.* +* tx.* +* unsupported.* +