Skip to content

Commit 106ab77

Browse files
Clarified naming rules for user defined callables and added list for reserved and deprecated namespaces
1 parent cbae1f3 commit 106ab77

File tree

3 files changed

+149
-1
lines changed

3 files changed

+149
-1
lines changed

modules/ROOT/pages/extending-neo4j/aggregation-functions.adoc

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ An aggregator class contains one method annotated with `@UserAggregationUpdate`
3232
The method annotated with `@UserAggregationUpdate` will be called multiple times and enables the class to aggregate data.
3333
When the aggregation is done, the method annotated with `@UserAggregationResult` will be called once and the result of the aggregation will be returned.
3434

35+
Particular things to note:
36+
37+
* All functions are annotated with `@UserAggregationFunction`.
38+
* The aggregation function name is required to be namespaced and is not allowed in one of the reserved namespaces.
39+
* 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 will be shadowed.
40+
41+
3542
See xref:extending-neo4j/values-and-types.adoc[] for details on values and types.
3643

3744
For more details, see the Neo4j Javadocs for link:{org-neo4j-procedure-UserAggregationFunction}[`org.neo4j.procedure.UserAggregationFunction`^].
@@ -132,3 +139,54 @@ public class LongestStringTest
132139
}
133140
----
134141

142+
[[reserved-and-deprecated-namespaces]]
143+
== Reserved and deprecated function namespaces
144+
145+
[[reserved-and-deprecated-function-namespaces]]
146+
.Overview of reserved and deprecated function namespaces and names
147+
[options="header", cols="m,m"]
148+
|===
149+
| Reserved | Deprecated
150+
| date |abac.*
151+
| date.realtime |aura.*
152+
| date.statement |builtin.*
153+
| date.transaction |cdc.*
154+
| date.truncate |coll.*
155+
| datetime |date.*
156+
| datetime.fromepoch |datetime.*
157+
| datetime.fromepochmillis |db.*
158+
| datetime.realtime |dbms.*
159+
| datetime.statement |duration.*
160+
| datetime.transaction |graph.*
161+
| datetime.truncate |internal.*
162+
| db.nameFromElementId |localdatetime.*
163+
| duration |localtime.*
164+
| duration.between |math.*
165+
| duration.inDays |plugin.*
166+
| duration.inMonths |point.*
167+
| duration.inSeconds |stored.*
168+
| graph.byElementId |string.*
169+
| graph.byName |time.*
170+
| graph.names |tx.*
171+
| graph.propertiesByName |unsupported.*
172+
| localdatetime |vector.*
173+
| localdatetime.realtime |
174+
| localdatetime.statement |
175+
| localdatetime.transaction |
176+
| localdatetime.truncate |
177+
| localtime |
178+
| localtime.realtime |
179+
| localtime.statement |
180+
| localtime.transaction |
181+
| localtime.truncate |
182+
| point.distance |
183+
| point.withinBBox |
184+
| time |
185+
| time.realtime |
186+
| time.statement |
187+
| time.transaction |
188+
| time.truncate |
189+
| vector.similarity.cosine |
190+
| vector.similarity.euclidean |
191+
|===
192+

modules/ROOT/pages/extending-neo4j/functions.adoc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ RETURN org.neo4j.examples.join(collect(p.names))
3030
User-defined functions are created similarly to how procedures are created.
3131
But unlike procedures, they are annotated with `@UserFunction` and return a single value instead of a stream of values.
3232

33+
Particular things to note:
34+
35+
* All functions are annotated with `@UserFunction`.
36+
* The function name is required to be namespaced and is not allowed in one of the reserved namespaces.
37+
* If a function is registered with the same name as a built-in function in a deprecated namespace the built-in function will be shadowed.
38+
3339
See xref:extending-neo4j/values-and-types.adoc[] for details on values and types.
3440

3541
For more details, see the link:{org-neo4j-procedure-UserFunction}[Neo4j Javadocs for `org.neo4j.procedure.UserFunction`^].
@@ -120,3 +126,35 @@ public class JoinTest {
120126
}
121127
----
122128

129+
[[reserved-and-deprecated-namespaces]]
130+
== Reserved and deprecated function namespaces
131+
132+
[[reserved-and-deprecated-function-namespaces]]
133+
.Overview of reserved and deprecated function namespaces and names
134+
[options="header", cols="m,m"]
135+
|===
136+
| Reserved | Deprecated
137+
| cdc.* | abac.*
138+
| date.* | aura.*
139+
| datetime.* | builtin.*
140+
| db.* | coll.*
141+
| dbms.* | math.*
142+
| duration.* | plugin.*
143+
| graph.* | point.*
144+
| internal.* | stored.*
145+
| localdatetime.* | string.*
146+
| localtime.* | vector.*
147+
| time.* |
148+
| tx.* |
149+
| unsupported.* |
150+
|===
151+
152+
153+
154+
155+
156+
157+
158+
159+
160+

modules/ROOT/pages/extending-neo4j/procedures.adoc

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ Particular things to note:
143143
* The procedure annotation can take three optional arguments: `name`, `mode`, and `eager`.
144144
** `name` is used to specify a different name for the procedure than the default generated, which is `class.path.nameOfMethod`.
145145
If `mode` is specified, `name` must be specified as well.
146+
** `name` is required to be namespaced and is not allowed in one of the reserved namespaces.
147+
** If a procedure is registered with the same name as a built-in procedure in a deprecated namespace the built-in procedure will be shadowed.
146148
** `mode` is used to declare the types of interactions that the procedure performs.
147149
A procedure fails if it attempts to execute database operations that violate its mode.
148150
The default `mode` is `READ`.
@@ -163,7 +165,7 @@ Particular things to note:
163165
MATCH (n)
164166
WHERE n.key = 'value'
165167
WITH n
166-
CALL deleteNeighbours(n, 'FOLLOWS')
168+
CALL example.deleteNeighbours(n, 'FOLLOWS')
167169
----
168170
This query can delete some of the nodes that are matched by the Cypher query, and the `n.key` lookup will fail.
169171
Marking this procedure as `eager` prevents this from causing an error in Cypher code.
@@ -273,3 +275,53 @@ public class MyProcedures {
273275
}
274276
275277
----
278+
[[reserved-and-deprecated-namespaces]]
279+
== Reserved and deprecated function namespaces
280+
281+
[[reserved-and-deprecated-function-namespaces]]
282+
.Overview of reserved and deprecated function namespaces and names
283+
[options="header", cols="m,m"]
284+
|===
285+
| Reserved | Deprecated
286+
| date |abac.*
287+
| date.realtime |aura.*
288+
| date.statement |builtin.*
289+
| date.transaction |cdc.*
290+
| date.truncate |coll.*
291+
| datetime |date.*
292+
| datetime.fromepoch |datetime.*
293+
| datetime.fromepochmillis |db.*
294+
| datetime.realtime |dbms.*
295+
| datetime.statement |duration.*
296+
| datetime.transaction |graph.*
297+
| datetime.truncate |internal.*
298+
| db.nameFromElementId |localdatetime.*
299+
| duration |localtime.*
300+
| duration.between |math.*
301+
| duration.inDays |plugin.*
302+
| duration.inMonths |point.*
303+
| duration.inSeconds |stored.*
304+
| graph.byElementId |string.*
305+
| graph.byName |time.*
306+
| graph.names |tx.*
307+
| graph.propertiesByName |unsupported.*
308+
| localdatetime |vector.*
309+
| localdatetime.realtime |
310+
| localdatetime.statement |
311+
| localdatetime.transaction |
312+
| localdatetime.truncate |
313+
| localtime |
314+
| localtime.realtime |
315+
| localtime.statement |
316+
| localtime.transaction |
317+
| localtime.truncate |
318+
| point.distance |
319+
| point.withinBBox |
320+
| time |
321+
| time.realtime |
322+
| time.statement |
323+
| time.transaction |
324+
| time.truncate |
325+
| vector.similarity.cosine |
326+
| vector.similarity.euclidean |
327+
|===

0 commit comments

Comments
 (0)