- 
                Notifications
    You must be signed in to change notification settings 
- Fork 35
Errors for Graph Type #341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            mnd999
  wants to merge
  10
  commits into
  neo4j:dev
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
mnd999:graph-type-errors
  
      
      
   
  
    
  
  
  
 
  
      
    base: dev
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            10 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      7aeee74
              
                Error status codes for GRAPH TYPE
              
              
                mnd999 b4eb6e8
              
                Apply suggestions from code review
              
              
                mnd999 fa3694a
              
                Rough sketch of the remaining error codes
              
              
                mnd999 6940e0d
              
                Apply suggestions from code review
              
              
                mnd999 6f23a4d
              
                Review fixes
              
              
                mnd999 f2ada6a
              
                Add explanations
              
              
                mnd999 e4cc199
              
                Apply suggestions from code review
              
              
                mnd999 06f4503
              
                Add one more example
              
              
                mnd999 f191b1f
              
                Apply suggestions from code review
              
              
                mnd999 5d08671
              
                Update modules/ROOT/pages/errors/gql-errors/22NCF.adoc
              
              
                renetapopova File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
          Some comments aren't visible on the classic Files Changed page.
        
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| :page-role: new-2025.x cypher-25 | ||
| = 22NC1 | ||
|  | ||
| == Status description | ||
| error: data exception - graph type element contains duplicated tokens. The graph type element includes a property key with name `{ <<propKey>> }` more than once. | ||
|  | ||
| == Explanation | ||
| When defining a graph type, node and relationship element types may only define a property once. | ||
|  | ||
| == Example scenario | ||
| For example, try to set a graph type as follows: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (n:Node => {prop::STRING, prop::INTEGER}) | ||
| } | ||
| ---- | ||
|  | ||
| The query returns an error with GQLSTATUS 22NC1 and the status description: | ||
|  | ||
| [source] | ||
| ---- | ||
| error: data exception - graph type element contains duplicated tokens. The graph type element includes a property key with name `prop` more than once. | ||
| ---- | ||
|  | ||
| To fix this, remove the duplicate property key definition or uniquely name the property keys: | ||
|  | ||
| [source, cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (p:Node => {prop :: STRING, prop2 :: INTEGER}) | ||
| } | ||
| ---- | ||
|  | ||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|  | ||
| include::partial$glossary.adoc[] | ||
| endif::[] | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| :page-role: new-2025.x cypher-25 | ||
| = 22NC2 | ||
|         
                  mnd999 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| == Status description | ||
| 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. | ||
|  | ||
| == Explanation | ||
| When defining a graph type, node element types must have some effect; otherwise, they are not allowed. | ||
|  | ||
| == Example scenario | ||
| For example, try to set a graph type as follows: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (n:Node => ) | ||
| } | ||
| ---- | ||
|  | ||
| The query returns an error with GQLSTATUS 22NC2 and the status description: | ||
|  | ||
| [source] | ||
| ---- | ||
| 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. | ||
| ---- | ||
|  | ||
| To fix this, define at least one property type or add an implied label, for example: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (n:Node => { prop :: ANY NOT NULL }) | ||
| } | ||
| ---- | ||
|  | ||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|  | ||
| include::partial$glossary.adoc[] | ||
| endif::[] | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| :page-role: new-2025.x cypher-25 | ||
| = 22NC3 | ||
|         
                  mnd999 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| == Status description | ||
| 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. | ||
|  | ||
| == Explanation | ||
| When defining a graph type, relationship element types must have some effect. | ||
| To be effective, a relationship element type must define at least one of the following: | ||
|  | ||
| * a source node element type or label | ||
| * a destination node element type or label | ||
| * at least one property type | ||
|  | ||
| == Example scenario | ||
| For example, try to set a graph type as follows: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| ()-[:REL =>]->() | ||
| } | ||
| ---- | ||
|  | ||
| The query returns an error with GQLSTATUS 22NC3 and the status description: | ||
|  | ||
| [source] | ||
| ---- | ||
| 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. | ||
| ---- | ||
|  | ||
| To fix this, define at least one property type or add a node element type, for example: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| ()-[:REL => {prop: ANY NOT NULL }]->() | ||
| } | ||
| ---- | ||
|  | ||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|  | ||
| include::partial$glossary.adoc[] | ||
| endif::[] | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| :page-role: new-2025.x cypher-25 | ||
| = 22NC4 | ||
|         
                  mnd999 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| == Status description | ||
| error: data exception - a label cannot be both identifying and implied. The label(s) `{ <<labelList>> }` are defined as both identifying and implied. | ||
|  | ||
| == Explanation | ||
| When defining a graph type, labels and relationships must be assigned clear roles. | ||
| A label cannot be both "identifying" (to uniquely identify nodes) and "implied" (automatically assigned based on other schema rules) at the same time. | ||
|         
                  renetapopova marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| Attempting to define a label as both will result in this error, as it creates ambiguity in the schema definition and node identification process. | ||
|  | ||
| == Example scenario | ||
| 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: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (p:Person => {name :: STRING}), | ||
| (s:Student => :Person ) | ||
| } | ||
| ---- | ||
|  | ||
| The query returns an error with GQLSTATUS 22NC4 and the status description: | ||
|  | ||
| [source] | ||
| ---- | ||
| error: data exception - a label cannot be both identifying and implied. The label(s) `Person` are defined as both identifying and implied. | ||
| ---- | ||
|  | ||
| One way to fix this is to add another label to both nodes and capture the property type on `name` there: | ||
|         
                  renetapopova marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (p:Person => :Named), | ||
| (s:Student => :Named), | ||
| CONSTRAINT FOR (:Named) REQUIRE name IS :: STRING | ||
| } | ||
| ---- | ||
|  | ||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|  | ||
| include::partial$glossary.adoc[] | ||
| endif::[] | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| :page-role: new-2025.x cypher-25 | ||
| = 22NC5 | ||
|         
                  mnd999 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| == Status description | ||
| error: data exception - graph type element not found. The `{ <<entityType>> }` element type referenced by `{ <<graphTypeReference>> }` does not exist. | ||
|  | ||
| == Explanation | ||
| 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. | ||
| If the referenced node or relationship type does not exist, the operation cannot proceed and will return an error to indicate the missing element. | ||
|  | ||
| == Example scenarios | ||
|  | ||
| === Node element reference does not exist | ||
| For example, try to set a graph type with an identifying node element reference that does not exist as follows: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (:Node =>)-[e:REL => { prop :: STRING }]->() | ||
| } | ||
| ---- | ||
|  | ||
| The query returns an error with GQLSTATUS 22NC5 and the status description: | ||
|  | ||
| [source] | ||
| ---- | ||
| error: data exception - graph type element not found. The node type element referenced by '(:Node =>)' does not exist. | ||
| ---- | ||
| In this case, you can make the reference non-identifying, or you can define the node type element before this operation: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (:Node)-[e:REL => { prop :: STRING }]->() | ||
| } | ||
| ---- | ||
|  | ||
| === Relationship element reference does not exist | ||
| For example, try to set a graph type with a relationship element reference that does not exist as follows: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| CONSTRAINT FOR ()-[b]->() REQUIRE (b.prop) IS KEY | ||
| } | ||
|  | ||
| ---- | ||
|  | ||
| The query returns an error with GQLSTATUS 22NC5 and the status description: | ||
|  | ||
| [source] | ||
| ---- | ||
| error: data exception - graph type element not found. The relationship type element referenced by 'b' does not exist. | ||
| ---- | ||
| In this case, the reference could be fixed by providing a relationship type: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| CONSTRAINT FOR ()-[b:REL]->() REQUIRE (b.prop) IS KEY | ||
| } | ||
| ---- | ||
|  | ||
| === Element reference omitted from constraint definition | ||
| For example, try to define a constraint with an empty node element type reference, which is not allowed as follows: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
|         
                  Hunterness marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| CONSTRAINT FOR () REQUIRE n.prop IS UNIQUE | ||
| } | ||
| ---- | ||
|  | ||
| The query returns an error with GQLSTATUS 22NC5 and the status description: | ||
|  | ||
| [source] | ||
| ---- | ||
| error: data exception - graph type element not found. The node type element referenced by 'n' was does not exist. | ||
| ---- | ||
| In this case, the reference can be fixed by providing a label for the constraint: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| CONSTRAINT FOR (n:Node) REQUIRE n.prop IS UNIQUE | ||
| } | ||
| ---- | ||
|  | ||
|  | ||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|  | ||
| include::partial$glossary.adoc[] | ||
| endif::[] | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| :page-role: new-2025.x cypher-25 | ||
| = 22NC6 | ||
|         
                  mnd999 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| == Status description | ||
| error: data exception - independent constraint and node element type have the same label. | ||
| The independent constraint `{ <<constrDescrOrName>> }` is using the same label `{ <<label>> }` as a node element type. | ||
|         
                  Hunterness marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| == Explanation | ||
| 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. | ||
| A label cannot simultaneously serve as an identifying label and be referenced in an independent constraint. | ||
|  | ||
| == Example scenario | ||
| 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: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (p:Person => {name :: STRING}), | ||
| CONSTRAINT FOR (p:Person =>) REQUIRE p.name IS NOT NULL | ||
| } | ||
| ---- | ||
|  | ||
| The query returns an error with GQLSTATUS 22NC6 and the status description: | ||
|  | ||
| [source] | ||
| ---- | ||
| 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. | ||
| ---- | ||
|  | ||
| To fix this, define the property existence constraint as part of the node element type: | ||
|  | ||
| [source, cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| (p:Person => {name :: STRING NOT NULL}) | ||
| } | ||
| ---- | ||
|  | ||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|  | ||
| include::partial$glossary.adoc[] | ||
| endif::[] | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| :page-role: new-2025.x cypher-25 | ||
| = 22NC7 | ||
|         
                  mnd999 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| == Status description | ||
| error: data exception - independent constraint and relationship element type have the same relationship type. | ||
| The independent constraint `{ <<constrDescrOrName>> }` is using the same relationship type `{ <<relType>> }` as a relationship element type. | ||
|  | ||
| == Explanation | ||
| 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. | ||
| A relationship type cannot simultaneously serve as an identifying relationship type and be referenced in an independent constraint. | ||
|  | ||
| == Example scenario | ||
| 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: | ||
|  | ||
| [source,cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| ()-[:REL => {name :: ANY NOT NULL}]->(), | ||
| CONSTRAINT FOR ()-[r:REL =>]->() REQUIRE r.name IS :: STRING | ||
| } | ||
| ---- | ||
|  | ||
| The query returns an error with GQLSTATUS 22NC7 and the status description: | ||
|  | ||
| [source] | ||
| ---- | ||
| 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. | ||
| ---- | ||
|  | ||
| To fix this, define the property type constraint as part of the relationship element type: | ||
|  | ||
| [source, cypher] | ||
| ---- | ||
| ALTER CURRENT GRAPH TYPE SET { | ||
| ()-[:REL => {name :: STRING NOT NULL}]->() | ||
| } | ||
| ---- | ||
|  | ||
| ifndef::backend-pdf[] | ||
| [discrete.glossary] | ||
| == Glossary | ||
|  | ||
| include::partial$glossary.adoc[] | ||
| endif::[] | ||
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.