Skip to content

Commit c8ec980

Browse files
mnd999Hunterness
andcommitted
Apply suggestions from code review
Co-authored-by: Therese Magnusson <[email protected]>
1 parent a293a11 commit c8ec980

File tree

13 files changed

+246
-166
lines changed

13 files changed

+246
-166
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@
165165
**** xref:errors/gql-errors/22NC7.adoc[]
166166
**** xref:errors/gql-errors/22NC8.adoc[]
167167
**** xref:errors/gql-errors/22NC9.adoc[]
168-
**** xref:errors/gql-errors/22NCA.adoc[]
169-
**** xref:errors/gql-errors/22NCB.adoc[]
170168
*** xref:errors/gql-errors/index.adoc#invalid-transaction-state[Invalid transaction state]
171169
**** xref:errors/gql-errors/25G02.adoc[]
172170
**** xref:errors/gql-errors/25N01.adoc[]

modules/ROOT/pages/errors/gql-errors/22NC1.adoc

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
= 22NC1
22

33
== Status description
4-
The graph type element includes a property key with name `{ <<propKey>> }` more than once.
4+
error: data exception - graph type element contains duplicated tokens. The graph type element includes a property key with name `{ <<propKey>> }` more than once.
55

66
== Explanation
7-
When defining a graph type, node element types, and relationship element types may only define a property once.
7+
When defining a graph type, node and relationship element types may only define a property once.
88

99
== Example scenario
10-
For example, try to set a graph type with :
10+
For example, try to set a graph type as follows:
1111

1212
[source,cypher]
1313
----
@@ -16,13 +16,22 @@ ALTER CURRENT GRAPH TYPE SET {
1616
}
1717
----
1818

19-
An error will be thrown with GQLSTATUS 22NC1 and the status description:
19+
The query returns an error with GQLSTATUS 22NC1 and the status description:
2020

2121
[source]
2222
----
2323
error: data exception - graph type element contains duplicated tokens. The graph type element includes a property key with name `prop` more than once.
2424
----
2525

26+
To fix this, remove the duplicate property key definition or uniquely name the property keys:
27+
28+
[source, cypher]
29+
----
30+
ALTER CURRENT GRAPH TYPE SET {
31+
(p:Node => {prop :: STRING, prop2 :: INTEGER})
32+
}
33+
----
34+
2635
ifndef::backend-pdf[]
2736
[discrete.glossary]
2837
== Glossary

modules/ROOT/pages/errors/gql-errors/22NC2.adoc

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
= 22NC2
22

33
== Status description
4-
The node element type `{ <<label>> }` must contain one or more implied labels, or define at least one property type.
4+
error: data exception - node element type has no effect. The node element type `{ <<label>> }` must contain one or more implied labels, or at least one property type.
55

66
== Explanation
7-
When defining a graph type, node element types have some effect.
8-
Ineffectual node element types are not permitted.
7+
When defining a graph type, node element types must have some effect; otherwise, they are not allowed.
98

109
== Example scenario
11-
For example, try to set a graph type with :
10+
For example, try to set a graph type as follows:
1211

1312
[source,cypher]
1413
----
@@ -17,11 +16,20 @@ ALTER CURRENT GRAPH TYPE SET {
1716
}
1817
----
1918

20-
An error will be thrown with GQLSTATUS 22NC2 and the status description:
19+
The query returns an error with GQLSTATUS 22NC2 and the status description:
2120

2221
[source]
2322
----
24-
error: data exception - node element type is empty. The node element type `Node` must contain one or more implied labels, or define at least one property type.
23+
error: data exception - node element type is has no effect. The node element type `Node` must contain one or more implied labels, or at least one property type.
24+
----
25+
26+
To fix this, define at least one property type or add an implied label, for example:
27+
28+
[source,cypher]
29+
----
30+
ALTER CURRENT GRAPH TYPE SET {
31+
(n:Node => { prop :: ANY NOT NULL })
32+
}
2533
----
2634

2735
ifndef::backend-pdf[]

modules/ROOT/pages/errors/gql-errors/22NC3.adoc

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,40 @@
11
= 22NC3
22

33
== Status description
4-
The relationship element type `{ <<relType>> }` must define a node element type for source or destination, or define at least one property type.
4+
error: data exception - relationship element type has no effect. The relationship element type `{ <<relType>> }` must define a source, destination, or at least one property type.
55

66
== Explanation
77
When defining a graph type, relationship element types must have some effect.
8-
Ineffectual relationship element types are not permitted.
8+
To be effective, a relationship element type must define at least one of the following:
9+
10+
* a source node element type or label
11+
* a destination node element type or label
12+
* at least one property type
913

1014
== Example scenario
11-
For example, try to set a graph type with :
15+
For example, try to set a graph type as follows:
1216

1317
[source,cypher]
1418
----
1519
ALTER CURRENT GRAPH TYPE SET {
16-
()-[:REL =>]-()
20+
()-[:REL =>]->()
1721
}
1822
----
1923

20-
An error will be thrown with GQLSTATUS 22NC3 and the status description:
24+
The query returns an error with GQLSTATUS 22NC3 and the status description:
2125

2226
[source]
2327
----
24-
error: data exception - relationship element type is empty. The relationship element type `REL` must define a node element type for source or destination, or define at least one property type.
28+
error: data exception - relationship element type has no effect. The relationship element type `REL` must define a source or destination, or at least one property type.
29+
----
30+
31+
To fix this, define at least one property type or add a node element type, for example:
32+
33+
[source,cypher]
34+
----
35+
ALTER CURRENT GRAPH TYPE SET {
36+
()-[:REL => {prop: ANY NOT NULL }]->()
37+
}
2538
----
2639

2740
ifndef::backend-pdf[]

modules/ROOT/pages/errors/gql-errors/22NC4.adoc

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
= 22NC4
22

33
== Status description
4-
The label(s) `{ <<labelList>> }` are defined as both identifying and implied.
4+
error: data exception - a label cannot be both identifying and implied. The label(s) `{ <<labelList>> }` are defined as both identifying and implied.
55

66
== Explanation
77
When defining a graph type, labels and relationships must be assigned clear roles.
8-
A label cannot be both "identifying" (used to uniquely identify nodes) and "implied" (automatically assigned based on other schema rules) at the same time.
8+
A label cannot be both "identifying" (to uniquely identify nodes) and "implied" (automatically assigned based on other schema rules) at the same time.
99
Attempting to define a label as both will result in this error, as it creates ambiguity in the schema definition and node identification process.
1010

1111
== Example scenario
12-
For example, try to set a graph type which defines the node element types 'Person and 'Student' with the label 'Person' also declared as an implied label on the 'Student' node element type:
12+
For example, try to set a graph type which defines the node element types `Person` and `Student` with the label `Person` also declared as an implied label on the `Student` node element type as follows:
1313

1414
[source,cypher]
1515
----
@@ -19,11 +19,22 @@ ALTER CURRENT GRAPH TYPE SET {
1919
}
2020
----
2121

22-
An error will be thrown with GQLSTATUS 22NC4 and the status description:
22+
The query returns an error with GQLSTATUS 22NC4 and the status description:
2323

2424
[source]
2525
----
26-
error: data exception - a label cannot both identifying and implied. The label(s) `Person` are defined as both identifying and implied.
26+
error: data exception - a label cannot be both identifying and implied. The label(s) `Person` are defined as both identifying and implied.
27+
----
28+
29+
One way to fix this is to add another label to both nodes and capture the property type on `name` there:
30+
31+
[source,cypher]
32+
----
33+
ALTER CURRENT GRAPH TYPE SET {
34+
(p:Person => :Named),
35+
(s:Student => :Named),
36+
CONSTRAINT FOR (:Named) REQUIRE name IS :: STRING
37+
}
2738
----
2839

2940
ifndef::backend-pdf[]

modules/ROOT/pages/errors/gql-errors/22NC5.adoc

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
= 22NC5
22

33
== Status description
4-
The `{ <<entityType>> }` element type referenced by `{ <<graphTypeReference>> }` was not found.
4+
error: data exception - graph type element not found. The `{ <<entityType>> }` element type referenced by `{ <<graphTypeReference>> }` does not exist.
55

66
== Explanation
77
This error occurs when a graph type definition references an element type (such as a node or relationship) using an alias that has not been defined, or by an identifying reference where there is no graph type element identified by that reference.
8-
If the referenced node or relationship type does not exist, the operation cannot proceed and this error is returned to indicate the missing element.
8+
If the referenced node or relationship type does not exist, the operation cannot proceed and will return an error to indicate the missing element.
99

1010
== Example scenarios
1111

12-
=== Node element reference not found ===
13-
For example, try to set a graph type with an identiying node element reference that does not exist:
12+
=== Node element reference does not exist
13+
For example, try to set a graph type with an identifying node element reference that does not exist as follows:
1414

1515
[source,cypher]
1616
----
@@ -19,16 +19,23 @@ ALTER CURRENT GRAPH TYPE SET {
1919
}
2020
----
2121

22-
An error will be thrown with GQLSTATUS 22NC5 and the status description:
22+
The query returns an error with GQLSTATUS 22NC5 and the status description:
2323

2424
[source]
2525
----
26-
error: data exception - graph type element not found. The node type element referenced by '(:Node =>)' was not found.
26+
error: data exception - graph type element not found. The node type element referenced by '(:Node =>)' does not exist.
2727
----
28-
In this case, the reference could be corrected to be non-identifying, or the node type element could be defined before this operation.
28+
In this case, you can make the reference non-identifying, or you can define the node type element before this operation:
2929

30-
=== Relationship element reference not found ===
31-
For example, try to set a graph type with a relationship element reference that does not exist:
30+
[source,cypher]
31+
----
32+
ALTER CURRENT GRAPH TYPE SET {
33+
(:Node)-[e:REL => { prop :: STRING }]->()
34+
}
35+
----
36+
37+
=== Relationship element reference does not exist
38+
For example, try to set a graph type with a relationship element reference that does not exist as follows:
3239

3340
[source,cypher]
3441
----
@@ -38,12 +45,44 @@ ALTER CURRENT GRAPH TYPE SET {
3845
3946
----
4047

41-
An error will be thrown with GQLSTATUS 22NC5 and the status description:
48+
The query returns an error with GQLSTATUS 22NC5 and the status description:
4249

4350
[source]
4451
----
45-
error: data exception - graph type element not found. The relationship type element referenced by 'b' was not found.
52+
error: data exception - graph type element not found. The relationship type element referenced by 'b' does not exist.
4653
----
54+
In this case, the reference could be fixed by providing a relationship type:
55+
56+
[source,cypher]
57+
----
58+
ALTER CURRENT GRAPH TYPE SET {
59+
CONSTRAINT FOR ()-[b:REL]->() REQUIRE (b.prop) IS KEY
60+
}
61+
----
62+
63+
=== Element reference omitted from constraint definition
64+
For example, try to define a constraint with an empty node element type reference, which is not allowed as follows:
65+
66+
[source,cypher]
67+
----
68+
ALTER CURRENT GRAPH TYPE SET {
69+
CONSTRAINT FOR () REQUIRE n.prop IS UNIQUE
70+
----
71+
72+
The query returns an error with GQLSTATUS 22NC5 and the status description:
73+
74+
[source]
75+
----
76+
error: data exception - graph type element not found. The node type element referenced by 'n' was does not exist.
77+
----
78+
In this case, the reference can be fixed by providing a label for the constraint:
79+
80+
[source,cypher]
81+
----
82+
ALTER CURRENT GRAPH TYPE SET {
83+
CONSTRAINT FOR (n:Node) REQUIRE n.prop IS UNIQUE
84+
----
85+
4786

4887
ifndef::backend-pdf[]
4988
[discrete.glossary]

modules/ROOT/pages/errors/gql-errors/22NC6.adoc

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
11
= 22NC6
22

33
== Status description
4-
The independent constraint `{ <<constrDescrOrName>> }`` was defined using the same label `{ <<label>> }` as a node type element.
4+
error: data exception - independent constraint and node element type have the same label.
5+
The independent constraint `{ <<constrDescrOrName>> }` is using the same label `{ <<label>> }` as a node element type.
56

67
== Explanation
7-
This error occurs when a label is used both as an identifying label (defining a node type element) and as part of an independent constraint.
8-
A label cannot serve as both an identifying label and be referenced in an independent constraint at the same time.
8+
This error occurs when a label is used both as an identifying label (defining a node element type) and as part of an independent constraint.
9+
A label cannot simultaneously serve as an identifying label and be referenced in an independent constraint.
910

1011
== Example scenario
11-
For example, try to set an existance constraint on a property for the label `:Person`` where `:Person` is also defined as an identifying label in the graph type:
12+
For example, try to set a property existence constraint on a property for the label `:Person`, where `:Person` is also defined as an identifying label in the graph type as follows:
1213

1314
[source,cypher]
1415
----
1516
ALTER CURRENT GRAPH TYPE SET {
1617
(p:Person => {name :: STRING}),
17-
CONSTRAINT FOR (p:Person =>) REQUIRE p.name IS NOT NULL,
18+
CONSTRAINT FOR (p:Person =>) REQUIRE p.name IS NOT NULL
1819
}
1920
----
2021

21-
An error will be thrown with GQLSTATUS 22NC6 and the status description:
22+
The query returns an error with GQLSTATUS 22NC6 and the status description:
2223

2324
[source]
2425
----
25-
error: data exception - independent constraint defined on node type element label. The independent constraint '(:`Person` {`name`})' was defined using the same label `Person` as a node type element.
26+
error: data exception - independent constraint and node element type have the same label. The independent constraint 'Constraint( type='NODE_PROPERTY_EXISTENCE', schema=(:`Person` {`name`}) )' is using the same label `Person` as a node element type.
27+
----
28+
29+
To fix this, define the property existence constraint as part of the node element type:
30+
31+
[source, cypher]
32+
----
33+
ALTER CURRENT GRAPH TYPE SET {
34+
(p:Person => {name :: STRING NOT NULL})
35+
}
2636
----
2737

2838
ifndef::backend-pdf[]

modules/ROOT/pages/errors/gql-errors/22NC7.adoc

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,38 @@
11
= 22NC7
22

33
== Status description
4-
The independent constraint `{ <<constrDescrOrName>> }` was defined using the same relationship type `{ <<relType>> }` as a relationship type element.
4+
error: data exception - independent constraint and relationship element type have the same relationship type.
5+
The independent constraint `{ <<constrDescrOrName>> }` is using the same relationship type `{ <<relType>> }` as a relationship element type.
56

67
== Explanation
7-
This error occurs when a relationship type is used both as an identifying relaionship type (defining a relationship type element) and as part of an independent constraint.
8-
A label cannot serve as both an identifying label and be referenced in an independent constraint at the same time.
8+
This error occurs when a relationship type is used both as an identifying relationship type (defining a relationship element type) and as part of an independent constraint.
9+
A relationship type cannot simultaneously serve as an identifying relationship type and be referenced in an independent constraint.
910

1011
== Example scenario
11-
For example, try to set an existance constraint on a property for the relationship type `:REL`` where `:REL` is also defined as an identifying relationship type in the graph type:
12+
For example, try to set a property type constraint on a property for the relationship type `:REL`, where `:REL` is also defined as an identifying relationship type in the graph type as follows:
1213

1314
[source,cypher]
1415
----
1516
ALTER CURRENT GRAPH TYPE SET {
16-
()-[:REL => {name :: STRING}]->(),
17-
CONSTRAINT FOR ()-[r:REL =>]->() REQUIRE r.name IS NOT NULL,
17+
()-[:REL => {name :: ANY NOT NULL}]->(),
18+
CONSTRAINT FOR ()-[r:REL =>]->() REQUIRE r.name IS :: STRING
1819
}
1920
----
2021

21-
An error will be thrown with GQLSTATUS 22NC7 and the status description:
22+
The query returns an error with GQLSTATUS 22NC7 and the status description:
2223

2324
[source]
2425
----
25-
error: data exception - independent constraint defined on node type element label. The independent constraint '(:`Person` {`name`})' was defined using the same label `Person` as a node type element.
26+
error: data exception - independent constraint and relationship element type have the same relationship type. The independent constraint 'Constraint( type='RELATIONSHIP_PROPERTY_TYPE', schema=()-[:`REL` {`name`}]-(), propertyType=STRING )' is using the same relationship type `REL` as a relationship element type.
27+
----
28+
29+
To fix this, define the property type constraint as part of the relationship element type:
30+
31+
[source, cypher]
32+
----
33+
ALTER CURRENT GRAPH TYPE SET {
34+
()-[:REL => {name :: STRING NOT NULL}]->()
35+
}
2636
----
2737

2838
ifndef::backend-pdf[]

0 commit comments

Comments
 (0)