|
1 |
| -= 22NC8 |
| 1 | += 22NC9 |
2 | 2 |
|
3 | 3 | == 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 |
5 | 5 |
|
6 | 6 | == 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. |
10 | 10 |
|
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. |
13 | 16 |
|
14 | 17 | [source,cypher]
|
15 | 18 | ----
|
16 | 19 | ALTER CURRENT GRAPH TYPE SET {
|
17 |
| - CONSTRAINT FOR () REQUIRE n.badger IS UNIQUE |
| 20 | + ( p: Person => { prop :: STRING } ), |
| 21 | + ( p: Property => { prop :: STRING } ) |
18 | 22 | }
|
19 | 23 | ----
|
20 | 24 |
|
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: |
22 | 26 |
|
23 | 27 | [source]
|
24 | 28 | ----
|
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 | +} |
26 | 68 | ----
|
27 | 69 |
|
28 | 70 | ifndef::backend-pdf[]
|
|
0 commit comments