You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.adoc
+156Lines changed: 156 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,3 +39,159 @@ Your branch should be prefixed with the version number, for example `4.3-new-exa
39
39
When you are finished with your changes push the branch to your fork and create a Pull Request.
40
40
Please add at least one approver.
41
41
42
+
== Guidelines for writing Neo4j notifications
43
+
44
+
When you want to add a new Notification code, you update the `neo4j` repo and this repo `docs-status-codes` by adding the notification details and examples.
45
+
Each notification comprises the following components, some of which are documented only here in this repo.
| Title|This query builds a cartesian product between disconnected patterns.
50
+
| SeverityLevel| INFORMATION
51
+
| Category| PERFORMANCE
52
+
(For all categories and severity levels, see https://github.com/neo4j/docs-status-codes/blob/dev/modules/ROOT/pages/notifications/index.adoc)
53
+
| Description |(Causes, consequences, a simple solution, or a reference to the Status Codes documentation)
54
+
| Example| (Status Codes documentation only)
55
+
| Suggestions for improvement| (Status Codes documentation only)
56
+
|===
57
+
58
+
The following are guidelines on how to write each of the notification components.
59
+
60
+
=== General guidelines
61
+
62
+
* Regardless of the notification category, each notification should include all the components.
63
+
* Always use Present Simple tense (it refers to an action or event that happens regularly or to facts, general realities, and unchanging situations) and active voice (when the subject of the sentence is the one doing the action, see https://www.merriam-webster.com/words-at-play/active-vs-passive-voice-difference) if possible.
64
+
* Be specific and try to use only words that count.
65
+
* Avoid repeating content from other notification parts, such as title, description, code, etc.
66
+
* Avoid using verbs or verb derivatives, for example, “Using”, “Running”, “The use of”, “Adding”..
67
+
* Avoid blaming the user.
68
+
Focus the notification on the problem that could be fixed.
69
+
+
70
+
For example, “Did not supply query with enough parameters.“ could be rewritten to “The query does not have enough parameters”.
71
+
+
72
+
“You are using an experimental feature.” is another example of focusing on the user instead of what the notification is about.
73
+
It could be omitted as the title already says that it is an experimental feature.
74
+
* Avoid using “please”.
75
+
* Avoid the phrase “It is recommended to” when proposing a solution.
76
+
* Capitalize all Cypher keywords, i.e., `MATCH` rather than `match` or `Match`.
77
+
78
+
=== Code
79
+
80
+
All Neo4j codes follow the syntax `Neo.[Classification].[Type].[Name]`.
81
+
The notification codes’ [Classification] is `ClientNotification`.
82
+
Therefore, they all start with `Neo.ClientNotification`.
83
+
The [Type] is one of `Statement`, `Procedure`, `Schema`, `Database`, `SECURITY`, or `Request`.
84
+
Code’s [Name] should be specific and explain what this code refers to.
The title should be brief (one short sentence), scannable, and inform on the current situation and what code of the query triggered the notification (add it within backticks to show that it’s a code snippet).
95
+
96
+
* Do not use exclamation marks.
97
+
* Use sentence case (you capitalize the first letter, proper nouns, and names, just like you would in a normal sentence) and punctuation.
98
+
* Avoid explaining:
99
+
** the consequences of the returned code.
100
+
** what causes the code to be returned.
101
+
** possible solutions.
102
+
103
+
⛔Example (contains a possible solution):
104
+
The provided pattern is unbounded, consider adding an upper limit to the number of node hops.
105
+
106
+
✅Example:
107
+
The pattern `<pattern>` is unbounded.
108
+
109
+
⛔Example:
110
+
This feature is deprecated and will be removed in future versions.
111
+
112
+
✅Example:
113
+
(Deprecated) The repeated variable length relationship r is bound more than once.
114
+
115
+
⛔Example (contains a possible solution):
116
+
The provided label is not in the database.
117
+
118
+
✅Example:
119
+
The label `Perso` does not exist.
120
+
121
+
122
+
123
+
=== Description
124
+
125
+
This is the description of the returned code.
126
+
127
+
The description should contain the following:
128
+
129
+
* What caused the notification to be returned
130
+
* Why it might be a problem - what the consequences are
131
+
* If possible, a simple solution, otherwise, a reference to the docs using the sentence:
132
+
_See Status Codes documentation for suggestions for improvement._
133
+
134
+
135
+
⛔Example:
136
+
Using shortest path with an unbounded pattern will likely result in long execution times.
137
+
It is recommended to use an upper limit to the number of node hops in your pattern.
138
+
139
+
✅Rewrite:
140
+
Shortest path with an unbounded pattern may result in long execution times.
141
+
Use an upper limit to the number of node hops in your pattern.
142
+
143
+
⛔Example:
144
+
Using an already bound variable for a variable length relationship is deprecated and will be removed in a future version. (the repeated variable is: r)
145
+
146
+
✅Rewrite:
147
+
A variable length relationship that is bound more than once does not return any result. See Status Codes documentation for suggestions for improvement.
148
+
149
+
⛔Example:
150
+
One of the labels in your query is not available in the database, make sure you didn’t misspell it or that the label is available when you run this statement in your application (the missing label name is: Perso)
151
+
152
+
✅Rewrite:
153
+
Non-existing labels yield no result. Verify that the label is spelled correctly.
154
+
155
+
=== Example
156
+
157
+
The examples and suggestions for improvement are written only in the Status Codes doc.
158
+
159
+
Add one or more example queries to illustrate the possible scenarios when this notification code would be returned.
160
+
They should look similar to the following:
161
+
162
+
.<Add a caption that explains the example>
163
+
====
164
+
Query::
165
+
+
166
+
[source, cypher, role="noplay"]
167
+
----
168
+
Here write the query.
169
+
----
170
+
171
+
Description of the returned code::
172
+
Same as in the `ne4j` repo.
173
+
174
+
Suggestions for improvement::
175
+
176
+
Give a possible solution for the provided example query.
177
+
178
+
⛔Example:
179
+
180
+
In case a cartesian product is needed, nothing can be done to improve this query.
181
+
In many cases, however, you might not need a combination of all children and parents, and that is when this query could be improved.
182
+
If for example, you need the children and the children's parents, you can improve this query by rewriting it to the following:
183
+
184
+
[source, cypher, role="noplay"]
185
+
----
186
+
MATCH (c:Child)-[:ChildOf]->(p:Parent) RETURN c, p
187
+
----
188
+
189
+
190
+
✅Rewrite:
191
+
192
+
If you only need the children and the children's parents, and not all combinations between them, add `[:ChildOf]` between the `Child` and the `Parent` nodes:
193
+
194
+
[source, cypher, role="noplay"]
195
+
----
196
+
MATCH (c:Child)-[:ChildOf]->(p:Parent) RETURN c, p
0 commit comments