Skip to content

Commit 06f4503

Browse files
committed
Add one more example
1 parent e4cc199 commit 06f4503

File tree

3 files changed

+41
-3
lines changed

3 files changed

+41
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
= 22NCC
22

33
== Status description
4-
error: data exception - node element type specified incorrectly. The node element type `{ <<graphTypeElement>> }` identified by the label `{ <<label>> }` is different to the one specified in the query `{ <<graphTypeElement>> }`.
4+
error: data exception - node element type specified incorrectly. The node element type `{ <<graphTypeElement>>1 }` identified by the label `{ <<label>> }` is different to the one specified in the query `{ <<graphTypeElement>>2 }`.
55

66
== Explanation
77
This error occurs when attempting to drop a node element type from the graph type, but the specified element type does not match the existing one for the given label.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
= 22NCD
22

33
== Status description
4-
error: data exception - relationship element type specified incorrectly. The relationship element type `{ <<graphTypeElement>> }` identified by the relationship type `{ <<relType>> }` is different to the one specified in the query `{ <<graphTypeElement>> }`.
4+
error: data exception - relationship element type specified incorrectly. The relationship element type `{ <<graphTypeElement>>1 }` identified by the relationship type `{ <<relType>> }` is different to the one specified in the query `{ <<graphTypeElement>>2 }`.
55

66
== Explanation
77
This error occurs when attempting to drop a relationship element type from the graph type, but the specified element type does not match the existing one for the given relationship type.

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

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This also applies to graph type constraints defined inline of the graph type ele
1010

1111
== Example scenario
1212

13-
=== ALTER
13+
=== ALTER existing constraint
1414

1515
Given the existing graph type:
1616

@@ -51,6 +51,44 @@ ALTER CURRENT GRAPH TYPE ADD {
5151
}
5252
----
5353

54+
=== Remove a KEY constraint using ALTER
55+
56+
Given the existing graph type:
57+
58+
[source,cypher]
59+
----
60+
ALTER CURRENT GRAPH TYPE SET {
61+
( :Person => {name :: STRING })
62+
}
63+
----
64+
65+
Execute the query:
66+
67+
[source,cypher]
68+
----
69+
ALTER CURRENT GRAPH TYPE ALTER {
70+
( :Person => {name :: STRING IS KEY } )
71+
}
72+
----
73+
74+
The query returns an error with GQLSTATUS 22NCF and the status description:
75+
76+
77+
[source]
78+
----
79+
error: data exception - graph type constraint not supported. Graph type constraint definitions are not supported in the `ALTER GRAPH TYPE ALTER` operation.
80+
----
81+
82+
To fix this, change the query as follows:
83+
84+
[source, cypher]
85+
----
86+
ALTER CURRENT GRAPH TYPE ADD {
87+
CONSTRAINT nameForKeyConstraint FOR (p:Person) REQUIRE p.name :: STRING IS KEY
88+
}
89+
90+
----
91+
5492
=== DROP
5593

5694
In this example we attempt to drop an undesignated constraint with an ALTER CURRENT GRAPH TYPE DROP query.

0 commit comments

Comments
 (0)