|
| 1 | += 22NC5 |
| 2 | + |
| 3 | +== Status description |
| 4 | +error: data exception - graph type element not found. The `{ <<entityType>> }` element type referenced by `{ <<graphTypeReference>> }` does not exist. |
| 5 | + |
| 6 | +== Explanation |
| 7 | +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 will return an error to indicate the missing element. |
| 9 | + |
| 10 | +== Example scenarios |
| 11 | + |
| 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: |
| 14 | + |
| 15 | +[source,cypher] |
| 16 | +---- |
| 17 | +ALTER CURRENT GRAPH TYPE SET { |
| 18 | + (:Node =>)-[e:REL => { prop :: STRING }]->() |
| 19 | +} |
| 20 | +---- |
| 21 | + |
| 22 | +The query returns an error with GQLSTATUS 22NC5 and the status description: |
| 23 | + |
| 24 | +[source] |
| 25 | +---- |
| 26 | +error: data exception - graph type element not found. The node type element referenced by '(:Node =>)' does not exist. |
| 27 | +---- |
| 28 | +In this case, you can make the reference non-identifying, or you can define the node type element before this operation: |
| 29 | + |
| 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: |
| 39 | + |
| 40 | +[source,cypher] |
| 41 | +---- |
| 42 | +ALTER CURRENT GRAPH TYPE SET { |
| 43 | + CONSTRAINT FOR ()-[b]->() REQUIRE (b.prop) IS KEY |
| 44 | +} |
| 45 | +
|
| 46 | +---- |
| 47 | + |
| 48 | +The query returns an error with GQLSTATUS 22NC5 and the status description: |
| 49 | + |
| 50 | +[source] |
| 51 | +---- |
| 52 | +error: data exception - graph type element not found. The relationship type element referenced by 'b' does not exist. |
| 53 | +---- |
| 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 | + |
| 73 | +The query returns an error with GQLSTATUS 22NC5 and the status description: |
| 74 | + |
| 75 | +[source] |
| 76 | +---- |
| 77 | +error: data exception - graph type element not found. The node type element referenced by 'n' was does not exist. |
| 78 | +---- |
| 79 | +In this case, the reference can be fixed by providing a label for the constraint: |
| 80 | + |
| 81 | +[source,cypher] |
| 82 | +---- |
| 83 | +ALTER CURRENT GRAPH TYPE SET { |
| 84 | + CONSTRAINT FOR (n:Node) REQUIRE n.prop IS UNIQUE |
| 85 | +} |
| 86 | +---- |
| 87 | + |
| 88 | + |
| 89 | +ifndef::backend-pdf[] |
| 90 | +[discrete.glossary] |
| 91 | +== Glossary |
| 92 | + |
| 93 | +include::partial$glossary.adoc[] |
| 94 | +endif::[] |
0 commit comments