Skip to content

Commit 647edfb

Browse files
committed
Add correction examples, scrap 22NC8
1 parent bffbadc commit 647edfb

File tree

7 files changed

+102
-78
lines changed

7 files changed

+102
-78
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ An error will be thrown with GQLSTATUS 22NC1 and the status description:
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+
This can be corrected by removing the duplicate property key definition or naming the property keys uniquely:
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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ An error will be thrown with GQLSTATUS 22NC2 and the status description:
2424
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.
2525
----
2626

27+
This can be corrected by defining at least one property type or by adding an implied label e.g.:
28+
29+
[source,cypher]
30+
----
31+
ALTER CURRENT GRAPH TYPE SET {
32+
(n:Node => { prop :: ANY NOT NULL })
33+
}
34+
----
35+
2736
ifndef::backend-pdf[]
2837
[discrete.glossary]
2938
== Glossary

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ An error will be thrown with GQLSTATUS 22NC3 and the status description:
2424
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.
2525
----
2626

27+
This can be corrected by defining at least one property type or by adding a node element type e.g.:
28+
29+
[source,cypher]
30+
----
31+
ALTER CURRENT GRAPH TYPE SET {
32+
()-[:REL => {prop: ANY NOT NULL }]->()
33+
}
34+
----
35+
2736
ifndef::backend-pdf[]
2837
[discrete.glossary]
2938
== Glossary

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ An error will be thrown with GQLSTATUS 22NC4 and the status description:
2626
error: data exception - a label cannot both identifying and implied. The label(s) `Person` are defined as both identifying and implied.
2727
----
2828

29+
There are several ways to correct this, but one approch may be 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+
}
38+
----
39+
2940
ifndef::backend-pdf[]
3041
[discrete.glossary]
3142
== Glossary

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

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,70 @@
1-
= 22NC8
1+
= 22NC9
22

33
== Status description
4-
error: data exception - constraint does not have a label or relationship type. The empty node type `()` is not a valid target for a constraint
4+
error: data exception - graph type contains duplicated tokens. The graph type includes a label, relationship type or alias with name `{ <<token>> }` more than once
55

66
== Explanation
7-
This error occurs when you attempt to define a constraint on an empty node type.
8-
Constraints must target specific node types using a label.
9-
Using an empty node type means there is no label or type specified, which is not valid for constraint definitions.
7+
This error occurs when a graph type definition attempts to use the same name for more than one label, relationship type, or alias within the same scope.
8+
Each label, relationship type, or alias must have a unique name to avoid ambiguity in the graph schema.
9+
To resolve this error, ensure that all labels, relationship types, and aliases are uniquely named within the graph type definition.
1010

11-
== Example scenario
12-
Attempt to define a constraint on an empty node reference as follows:
11+
== Example scenarios
12+
13+
=== Aliases
14+
15+
Attempt to define two node element types using the same alias.
1316

1417
[source,cypher]
1518
----
1619
ALTER CURRENT GRAPH TYPE SET {
17-
CONSTRAINT FOR () REQUIRE n.badger IS UNIQUE
20+
( p: Person => { prop :: STRING } ),
21+
( p: Property => { prop :: STRING } )
1822
}
1923
----
2024

21-
An error will be thrown with GQLSTATUS 22NC8 and the status description:
25+
An error will be thrown with GQLSTATUS 22NC9 and the status description:
2226

2327
[source]
2428
----
25-
error: data exception - constraint does not have a label or relationship type. The empty node type `()` is not a valid target for a constraint.
29+
error: data exception - graph type contains duplicated tokens. The graph type includes a label, relationship type or alias with name 'p' more than once.
30+
----
31+
32+
This can be corrected by renaming one of the aliases, for example:
33+
34+
[source,cypher]
35+
----
36+
ALTER CURRENT GRAPH TYPE SET {
37+
( pers: Person => { prop :: STRING } ),
38+
( prop: Property => { prop :: STRING } )
39+
}
40+
----
41+
42+
=== Identifiers
43+
44+
Attempt to define two relationship element types using the same relationship type.
45+
46+
[source,cypher]
47+
----
48+
ALTER CURRENT GRAPH TYPE SET {
49+
()-[n:REL => { prop :: STRING }]->(),
50+
()-[m:REL => { prop :: STRING }]->()
51+
}
52+
----
53+
54+
An error will be thrown with GQLSTATUS 22NC9 and the status description:
55+
56+
[source]
57+
----
58+
error: data exception - graph type contains duplicated tokens. The graph type includes a label, relationship type or alias with name ':REL' more than once.
59+
----
60+
61+
In this case, the correction is to delete the duplicate relationship type definition, since they are both equivalent:
62+
63+
[source,cypher]
64+
----
65+
ALTER CURRENT GRAPH TYPE SET {
66+
()-[n:REL => { prop :: STRING }]->()
67+
}
2668
----
2769

2870
ifndef::backend-pdf[]

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

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,38 @@
1-
= 22NC9
1+
= 22NCA
22

33
== Status description
4-
error: data exception - graph type contains duplicated tokens. The graph type includes a label, relationship type or alias with name `{ <<token>> }` more than once
4+
error: data exception - invalid element type constraints in graph type. A `{ <<entityType>> }` element type property `{ <<context>> }` constraint cannot be specified inline of a `{ <<entityType2>> }` element type
55

66
== Explanation
7-
This error occurs when a graph type definition attempts to use the same name for more than one label, relationship type, or alias within the same scope.
8-
Each label, relationship type, or alias must have a unique name to avoid ambiguity in the graph schema.
9-
To resolve this error, ensure that all labels, relationship types, and aliases are uniquely named within the graph type definition.
7+
Property type and existance constrains cannot be defined as inline constraints on graph type elements.
8+
They should be defined as part of the property description instead.
109

11-
== Example scenarios
12-
13-
=== Aliases
14-
15-
Attempt to define two node element types using the same alias.
10+
== Example scenario
11+
Attempt to define an existance constraint inline of a node element type as follows:
1612

1713
[source,cypher]
1814
----
1915
ALTER CURRENT GRAPH TYPE SET {
20-
( p: Person => { prop :: STRING } ),
21-
( p: Property => { prop :: STRING } )
16+
(p:Person => {name :: STRING, age :: INT}) REQUIRE p.studId IS NOT NULL
2217
}
2318
----
2419

25-
An error will be thrown with GQLSTATUS 22NC9 and the status description:
20+
An error will be thrown with GQLSTATUS 22NCA and the status description:
2621

2722
[source]
2823
----
29-
error: data exception - graph type contains duplicated tokens. The graph type includes a label, relationship type or alias with name 'p' more than once.
24+
error: data exception - invalid element type constraints in graph type. A node element type property existence constraint cannot be specified inline of a node element type.
3025
----
3126

32-
=== Identifiers
27+
A correct definition is as follows:
3328

34-
Attempt to define two relationship element types using the same relationship type.
35-
36-
[source,cypher]
29+
[source, cypher]
3730
----
3831
ALTER CURRENT GRAPH TYPE SET {
39-
()-[n:REL => { prop :: STRING }]->(),
40-
()-[m:REL => { prop :: STRING }]->()
32+
(p :Person => {name :: STRING, age :: INT, studId :: ANY NOT NULL })
4133
}
4234
----
4335

44-
An error will be thrown with GQLSTATUS 22NC9 and the status description:
45-
46-
[source]
47-
----
48-
error: data exception - graph type contains duplicated tokens. The graph type includes a label, relationship type or alias with name ':REL' more than once.
49-
----
5036

5137
ifndef::backend-pdf[]
5238
[discrete.glossary]

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

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)