From 23832f8348c4506e331e726caeba155541be1c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Wed, 25 Jun 2025 16:04:49 +0200 Subject: [PATCH 1/7] initial --- .../constraints/managing-constraints.adoc | 44 +++++++++++++++++++ modules/ROOT/pages/constraints/syntax.adoc | 7 +++ ...ions-additions-removals-compatibility.adoc | 30 +++++++++++++ 3 files changed, 81 insertions(+) diff --git a/modules/ROOT/pages/constraints/managing-constraints.adoc b/modules/ROOT/pages/constraints/managing-constraints.adoc index 2975482a9..0e5618c65 100644 --- a/modules/ROOT/pages/constraints/managing-constraints.adoc +++ b/modules/ROOT/pages/constraints/managing-constraints.adoc @@ -344,6 +344,41 @@ Added 1 constraint. ====== +.Create `VECTOR` property type constraints +====== + +It is necessary to specify both the dimension and the coordinate type of any constrained `VECTOR` properties. +The dimension must be greater than `0` and less or equal to `4096`. +For more information, see xref:values-and-types/vectors.adoc[Values and types -> Vectors]. + +.Create a constraint requiring `embedding` properties on `Movie` nodes to be of type `VECTOR(42)` +[source, cypher] +---- +CREATE CONSTRAINT node_vector_constraint +FOR (n:Movie) REQUIRE n.embedding IS :: VECTOR(42) +---- + +.Result +[source, queryresult] +---- +Added 1 constraint. +---- + +.Create a constraint requiring `embedding` properties on `CONTAINS` relationships to be of type `VECTOR(1536)` +[source, cypher] +---- +CREATE CONSTRAINT rel_vector_constraint +FOR ()-[r:CONTAINS]->() REQUIRE r.embedding IS :: VECTOR(1536) +---- + +.Result +[source, queryresult] +---- +Added 1 constraint. +---- + +====== + [[create-property-type-constraint-union-type]] ==== Create property type constraints with a union type @@ -401,6 +436,7 @@ The allowed property types for property type constraints are: * `ZONED DATETIME` * `DURATION` * `POINT` +* `VECTOR(DIMENSION)` label:new[Introduced in Neo4j 2025.xx] * `LIST` * `LIST` * `LIST` @@ -414,6 +450,10 @@ The allowed property types for property type constraints are: * `LIST` * Any closed dynamic union of the above types, e.g. `INTEGER | FLOAT | STRING`. +[NOTE] +A property type constraint cannot be created for `LIST`. +This is because it is not possible to store lists of xref:values-and-types/vectors.adoc[`VECTOR`] values. + For a complete reference describing all types available in Cypher, see the section on xref::values-and-types/property-structural-constructed.adoc#types-synonyms[types and their synonyms]. [[fail-to-create-property-type-constraint-invalid-type]] @@ -697,6 +737,7 @@ Additionally, some constraints cannot coexist and attempting to create them toge This includes: * Property type constraints on the same label/relationship type and property but with different property types. +This includes `VECTOR` types with differing dimensions or coordinate types. * Property uniqueness and key constraints on the same label/relationship type and property combination. However, some constraint types are allowed on the same label/relationship type and property combination. @@ -1653,6 +1694,9 @@ label:default-output[] == DROP CONSTRAINT Constraints are dropped using the `DROP CONSTRAINT` command. +It is possible to drop a constraint that was created in a later Cypher version than the one currently in use. +For example, although `VECTOR` property type constraints were added in Cypher 25, such constraints can still be dropped using Cypher 5. + For the full command syntax to drop constraints, see xref:constraints/syntax.adoc#drop-constraint[Syntax -> DROP CONSTRAINT]. [NOTE] diff --git a/modules/ROOT/pages/constraints/syntax.adoc b/modules/ROOT/pages/constraints/syntax.adoc index e85ed9854..9f35f92b5 100644 --- a/modules/ROOT/pages/constraints/syntax.adoc +++ b/modules/ROOT/pages/constraints/syntax.adoc @@ -122,6 +122,7 @@ Where `` is one of the following property types: * `ZONED DATETIME` * `DURATION` * `POINT` +* `VECTOR(DIMENSION)` label:new[Introduced in Neo4j 2025.xx] * `LIST` * `LIST` * `LIST` @@ -135,6 +136,12 @@ Where `` is one of the following property types: * `LIST` * Any closed dynamic union of the above types, e.g. `INTEGER | FLOAT | STRING`. +[NOTE] +A property type constraint cannot be created for `LIST`. +This is because it is not possible to store lists of `VECTOR` values. +Additionally, `VECTOR` property type constraints must be created with a specific dimension and coordinate value, where the dimension must be greater than `0` and less or equal to `4096`. +For more information, see xref:values-and-types/vectors.adoc[Values and types -> Vectors]. + Allowed syntax variations of these types are listed in xref::values-and-types/property-structural-constructed.adoc#types-synonyms[Types and their synonyms]. For examples on how to create property type constraints, see xref:constraints/managing-constraints.adoc#create-property-type-constraints[Create, show, and drop constraints -> Create property type constraints]. diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index ba704be56..70c1a0197 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -22,6 +22,36 @@ Cypher 25 was introduced in Neo4j 2025.06 and can only be used on Neo4j 2025.06+ Features removed in Cypher 25 are still available on Neo4j 2025.06+ databases either by prepending a query with `CYPHER 5` or by having Cypher 5 as the default language for the database. For more information, see xref:queries/select-version.adoc[]. +[[cypher-deprecations-additions-removals-2025.xx]] +== Neo4j 2025.xx + +=== New in Cypher 25 + +[cols="2", options="header"] +|=== +| Feature +| Details + +a| +label:functionality[] +label:new[] + +[source, cypher, role="noheader"] +---- +CREATE CONSTRAINT node_vector_constraint +FOR (n:Movie) REQUIRE n.embedding IS :: VECTOR(42) +---- + +[source, cypher, role="noheader"] +---- +CREATE CONSTRAINT rel_vector_constraint +FOR ()-[r:CONTAINS]->() REQUIRE r.embedding IS :: VECTOR(1536) +---- + +a| Introduced `VECTOR` property type constraints. +For more information, see xref:constraints/managing-constraints.adoc#create-property-type-constraints[Create property type constraints]. +|=== + [[cypher-deprecations-additions-removals-2025.06]] == Neo4j 2025.06 From a72b1bfc4d438db010bf90ebb122455ebc217a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Wed, 25 Jun 2025 16:10:43 +0200 Subject: [PATCH 2/7] label --- modules/ROOT/pages/constraints/managing-constraints.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/constraints/managing-constraints.adoc b/modules/ROOT/pages/constraints/managing-constraints.adoc index 0e5618c65..c5114ee34 100644 --- a/modules/ROOT/pages/constraints/managing-constraints.adoc +++ b/modules/ROOT/pages/constraints/managing-constraints.adoc @@ -344,7 +344,7 @@ Added 1 constraint. ====== -.Create `VECTOR` property type constraints +.Create `VECTOR` property type constraints label:new[Introduced in Neo4j 2025.xx] ====== It is necessary to specify both the dimension and the coordinate type of any constrained `VECTOR` properties. From 0345301b3c4adf5e5d5a6f6efdbac8cd6f6ac054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Wed, 25 Jun 2025 16:36:35 +0200 Subject: [PATCH 3/7] correct xref --- modules/ROOT/pages/constraints/managing-constraints.adoc | 4 ++-- modules/ROOT/pages/constraints/syntax.adoc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/ROOT/pages/constraints/managing-constraints.adoc b/modules/ROOT/pages/constraints/managing-constraints.adoc index c5114ee34..b74b0cb7b 100644 --- a/modules/ROOT/pages/constraints/managing-constraints.adoc +++ b/modules/ROOT/pages/constraints/managing-constraints.adoc @@ -349,7 +349,7 @@ Added 1 constraint. It is necessary to specify both the dimension and the coordinate type of any constrained `VECTOR` properties. The dimension must be greater than `0` and less or equal to `4096`. -For more information, see xref:values-and-types/vectors.adoc[Values and types -> Vectors]. +For more information, see xref:values-and-types/vector.adoc[Values and types -> Vectors]. .Create a constraint requiring `embedding` properties on `Movie` nodes to be of type `VECTOR(42)` [source, cypher] @@ -452,7 +452,7 @@ The allowed property types for property type constraints are: [NOTE] A property type constraint cannot be created for `LIST`. -This is because it is not possible to store lists of xref:values-and-types/vectors.adoc[`VECTOR`] values. +This is because it is not possible to store lists of xref:values-and-types/vector.adoc[`VECTOR`] values. For a complete reference describing all types available in Cypher, see the section on xref::values-and-types/property-structural-constructed.adoc#types-synonyms[types and their synonyms]. diff --git a/modules/ROOT/pages/constraints/syntax.adoc b/modules/ROOT/pages/constraints/syntax.adoc index 9f35f92b5..44999de30 100644 --- a/modules/ROOT/pages/constraints/syntax.adoc +++ b/modules/ROOT/pages/constraints/syntax.adoc @@ -140,7 +140,7 @@ Where `` is one of the following property types: A property type constraint cannot be created for `LIST`. This is because it is not possible to store lists of `VECTOR` values. Additionally, `VECTOR` property type constraints must be created with a specific dimension and coordinate value, where the dimension must be greater than `0` and less or equal to `4096`. -For more information, see xref:values-and-types/vectors.adoc[Values and types -> Vectors]. +For more information, see xref:values-and-types/vector.adoc[Values and types -> Vectors]. Allowed syntax variations of these types are listed in xref::values-and-types/property-structural-constructed.adoc#types-synonyms[Types and their synonyms]. From b17bcde1ea5298cb178a60ddce3f77ef6f09fa9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Tue, 16 Sep 2025 15:38:12 +0200 Subject: [PATCH 4/7] cypher 25 info --- modules/ROOT/pages/constraints/managing-constraints.adoc | 6 +++--- modules/ROOT/pages/constraints/syntax.adoc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/ROOT/pages/constraints/managing-constraints.adoc b/modules/ROOT/pages/constraints/managing-constraints.adoc index b74b0cb7b..83a104635 100644 --- a/modules/ROOT/pages/constraints/managing-constraints.adoc +++ b/modules/ROOT/pages/constraints/managing-constraints.adoc @@ -344,7 +344,7 @@ Added 1 constraint. ====== -.Create `VECTOR` property type constraints label:new[Introduced in Neo4j 2025.xx] +.Create `VECTOR` property type constraints label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.xx] ====== It is necessary to specify both the dimension and the coordinate type of any constrained `VECTOR` properties. @@ -436,7 +436,7 @@ The allowed property types for property type constraints are: * `ZONED DATETIME` * `DURATION` * `POINT` -* `VECTOR(DIMENSION)` label:new[Introduced in Neo4j 2025.xx] +* `VECTOR(DIMENSION)` label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.xx] * `LIST` * `LIST` * `LIST` @@ -451,7 +451,7 @@ The allowed property types for property type constraints are: * Any closed dynamic union of the above types, e.g. `INTEGER | FLOAT | STRING`. [NOTE] -A property type constraint cannot be created for `LIST`. +A property type constraint cannot be created for `LIST(DIMENSION) NOT NULL>`. This is because it is not possible to store lists of xref:values-and-types/vector.adoc[`VECTOR`] values. For a complete reference describing all types available in Cypher, see the section on xref::values-and-types/property-structural-constructed.adoc#types-synonyms[types and their synonyms]. diff --git a/modules/ROOT/pages/constraints/syntax.adoc b/modules/ROOT/pages/constraints/syntax.adoc index 44999de30..70c4fcc74 100644 --- a/modules/ROOT/pages/constraints/syntax.adoc +++ b/modules/ROOT/pages/constraints/syntax.adoc @@ -122,7 +122,7 @@ Where `` is one of the following property types: * `ZONED DATETIME` * `DURATION` * `POINT` -* `VECTOR(DIMENSION)` label:new[Introduced in Neo4j 2025.xx] +* `VECTOR(DIMENSION)` label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.xx] * `LIST` * `LIST` * `LIST` @@ -137,7 +137,7 @@ Where `` is one of the following property types: * Any closed dynamic union of the above types, e.g. `INTEGER | FLOAT | STRING`. [NOTE] -A property type constraint cannot be created for `LIST`. +A property type constraint cannot be created for `LIST(DIMENSION) NOT NULL>`. This is because it is not possible to store lists of `VECTOR` values. Additionally, `VECTOR` property type constraints must be created with a specific dimension and coordinate value, where the dimension must be greater than `0` and less or equal to `4096`. For more information, see xref:values-and-types/vector.adoc[Values and types -> Vectors]. From 55c5df615cf45aa9370248fbadeb47b55b452002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Tue, 30 Sep 2025 14:18:09 +0200 Subject: [PATCH 5/7] show results --- .../constraints/managing-constraints.adoc | 151 +++++++++--------- 1 file changed, 79 insertions(+), 72 deletions(-) diff --git a/modules/ROOT/pages/constraints/managing-constraints.adoc b/modules/ROOT/pages/constraints/managing-constraints.adoc index 83a104635..9a4e5027d 100644 --- a/modules/ROOT/pages/constraints/managing-constraints.adoc +++ b/modules/ROOT/pages/constraints/managing-constraints.adoc @@ -1473,26 +1473,28 @@ SHOW CONSTRAINTS .Result [source, queryresult] ---- -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| id | name | type | entityType | labelsOrTypes | properties | ownedIndex | propertyType | -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| 21 | "actor_fullname" | "NODE_KEY" | "NODE" | ["Actor"] | ["firstname", "surname"] | "actor_fullname" | NULL | -| 10 | "author_name" | "NODE_PROPERTY_EXISTENCE" | "NODE" | ["Author"] | ["name"] | NULL | NULL | -| 3 | "book_isbn" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["isbn"] | "book_isbn" | NULL | -| 7 | "book_title_year" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["title", "publicationYear"] | "book_title_year" | NULL | -| 17 | "director_imdbId" | "NODE_KEY" | "NODE" | ["Director"] | ["imdbId"] | "director_imdbId" | NULL | -| 23 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | "knows_since_how" | NULL | -| 14 | "movie_tagline" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["tagline"] | NULL | "STRING | LIST" | -| 12 | "movie_title" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["title"] | NULL | "STRING" | -| 25 | "node_uniqueness_param" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["prop1"] | "node_uniqueness_param" | NULL | -| 19 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | "ownershipId" | NULL | -| 13 | "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["order"] | NULL | "INTEGER" | -| 15 | "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["tags"] | NULL | "STRING | LIST" | -| 9 | "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | "prequels" | NULL | -| 26 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["published"] | NULL | NULL | -| 5 | "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["SEQUEL_OF"] | ["order"] | "sequels" | NULL | -| 11 | "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["year"] | NULL | NULL | -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| id | name | type | entityType | labelsOrTypes | properties | ownedIndex | propertyType | ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| 23 | "actor_fullname" | "NODE_KEY" | "NODE" | ["Actor"] | ["firstname", "surname"] | "actor_fullname" | NULL | +| 12 | "author_name" | "NODE_PROPERTY_EXISTENCE" | "NODE" | ["Author"] | ["name"] | NULL | NULL | +| 5 | "book_isbn" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["isbn"] | "book_isbn" | NULL | +| 9 | "book_title_year" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["title", "publicationYear"] | "book_title_year" | NULL | +| 19 | "director_imdbId" | "NODE_KEY" | "NODE" | ["Director"] | ["imdbId"] | "director_imdbId" | NULL | +| 25 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | "knows_since_how" | NULL | +| 16 | "movie_tagline" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["tagline"] | NULL | "STRING | LIST" | +| 14 | "movie_title" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["title"] | NULL | "STRING" | +| 27 | "node_uniqueness_param" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["prop1"] | "node_uniqueness_param" | NULL | +| 2 | "node_vector_constraint" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["embedding"] | NULL | "VECTOR(42)" | +| 21 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | "ownershipId" | NULL | +| 15 | "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["order"] | NULL | "INTEGER" | +| 17 | "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["tags"] | NULL | "STRING | LIST" | +| 11 | "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | "prequels" | NULL | +| 28 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["published"] | NULL | NULL | +| 3 | "rel_vector_constraint" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["CONTAINS"] | ["embedding"] | NULL | "VECTOR(1536)" | +| 7 | "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["SEQUEL_OF"] | ["order"] | "sequels" | NULL | +| 13 | "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["year"] | NULL | NULL | ++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ---- ====== @@ -1511,26 +1513,28 @@ SHOW CONSTRAINTS YIELD * .Result [source, queryresult] ---- -+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| id | name | type | entityType | labelsOrTypes | properties | ownedIndex | propertyType | options | createStatement | -+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| 21 | "actor_fullname" | "NODE_KEY" | "NODE" | ["Actor"] | ["firstname", "surname"] | "actor_fullname" | NULL | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `actor_fullname` FOR (n:`Actor`) REQUIRE (n.`firstname`, n.`surname`) IS KEY" | -| 10 | "author_name" | "NODE_PROPERTY_EXISTENCE" | "NODE" | ["Author"] | ["name"] | NULL | NULL | NULL | "CREATE CONSTRAINT `author_name` FOR (n:`Author`) REQUIRE (n.`name`) IS NOT NULL" | -| 3 | "book_isbn" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["isbn"] | "book_isbn" | NULL | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `book_isbn` FOR (n:`Book`) REQUIRE (n.`isbn`) IS UNIQUE" | -| 7 | "book_title_year" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["title", "publicationYear"] | "book_title_year" | NULL | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `book_title_year` FOR (n:`Book`) REQUIRE (n.`title`, n.`publicationYear`) IS UNIQUE" | -| 17 | "director_imdbId" | "NODE_KEY" | "NODE" | ["Director"] | ["imdbId"] | "director_imdbId" | NULL | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `director_imdbId` FOR (n:`Director`) REQUIRE (n.`imdbId`) IS KEY" | -| 23 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | "knows_since_how" | NULL | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `knows_since_how` FOR ()-[r:`KNOWS`]-() REQUIRE (r.`since`, r.`how`) IS KEY" | -| 14 | "movie_tagline" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["tagline"] | NULL | "STRING | LIST" | NULL | "CREATE CONSTRAINT `movie_tagline` FOR (n:`Movie`) REQUIRE (n.`tagline`) IS :: STRING | LIST" | -| 12 | "movie_title" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["title"] | NULL | "STRING" | NULL | "CREATE CONSTRAINT `movie_title` FOR (n:`Movie`) REQUIRE (n.`title`) IS :: STRING" | -| 25 | "node_uniqueness_param" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["prop1"] | "node_uniqueness_param" | NULL | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `node_uniqueness_param` FOR (n:`Book`) REQUIRE (n.`prop1`) IS UNIQUE" | -| 19 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | "ownershipId" | NULL | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `ownershipId` FOR ()-[r:`OWNS`]-() REQUIRE (r.`ownershipId`) IS KEY" | -| 13 | "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["order"] | NULL | "INTEGER" | NULL | "CREATE CONSTRAINT `part_of` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`order`) IS :: INTEGER" | -| 15 | "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["tags"] | NULL | "STRING | LIST" | NULL | "CREATE CONSTRAINT `part_of_tags` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`tags`) IS :: STRING | LIST" | -| 9 | "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | "prequels" | NULL | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `prequels` FOR ()-[r:`PREQUEL_OF`]-() REQUIRE (r.`order`, r.`author`) IS UNIQUE" | -| 26 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["published"] | NULL | NULL | NULL | "CREATE CONSTRAINT `rel_exist_param` FOR ()-[r:`WROTE`]-() REQUIRE (r.`published`) IS NOT NULL" | -| 5 | "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["SEQUEL_OF"] | ["order"] | "sequels" | NULL | {indexConfig: {}, indexProvider: "range-1.0"} | "CREATE CONSTRAINT `sequels` FOR ()-[r:`SEQUEL_OF`]-() REQUIRE (r.`order`) IS UNIQUE" | -| 11 | "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["year"] | NULL | NULL | NULL | "CREATE CONSTRAINT `wrote_year` FOR ()-[r:`WROTE`]-() REQUIRE (r.`year`) IS NOT NULL" | -+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| id | name | type | entityType | labelsOrTypes | properties | ownedIndex | propertyType | options | createStatement | ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| 23 | "actor_fullname" | "NODE_KEY" | "NODE" | ["Actor"] | ["firstname", "surname"] | "actor_fullname" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `actor_fullname` FOR (n:`Actor`) REQUIRE (n.`firstname`, n.`surname`) IS KEY" | +| 12 | "author_name" | "NODE_PROPERTY_EXISTENCE" | "NODE" | ["Author"] | ["name"] | NULL | NULL | NULL | "CREATE CONSTRAINT `author_name` FOR (n:`Author`) REQUIRE (n.`name`) IS NOT NULL" | +| 5 | "book_isbn" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["isbn"] | "book_isbn" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `book_isbn` FOR (n:`Book`) REQUIRE (n.`isbn`) IS UNIQUE" | +| 9 | "book_title_year" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["title", "publicationYear"] | "book_title_year" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `book_title_year` FOR (n:`Book`) REQUIRE (n.`title`, n.`publicationYear`) IS UNIQUE" | +| 19 | "director_imdbId" | "NODE_KEY" | "NODE" | ["Director"] | ["imdbId"] | "director_imdbId" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `director_imdbId` FOR (n:`Director`) REQUIRE (n.`imdbId`) IS KEY" | +| 25 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | "knows_since_how" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `knows_since_how` FOR ()-[r:`KNOWS`]-() REQUIRE (r.`since`, r.`how`) IS KEY" | +| 16 | "movie_tagline" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["tagline"] | NULL | "STRING | LIST" | NULL | "CREATE CONSTRAINT `movie_tagline` FOR (n:`Movie`) REQUIRE (n.`tagline`) IS :: STRING | LIST" | +| 14 | "movie_title" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["title"] | NULL | "STRING" | NULL | "CREATE CONSTRAINT `movie_title` FOR (n:`Movie`) REQUIRE (n.`title`) IS :: STRING" | +| 27 | "node_uniqueness_param" | "NODE_PROPERTY_UNIQUENESS" | "NODE" | ["Book"] | ["prop1"] | "node_uniqueness_param" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `node_uniqueness_param` FOR (n:`Book`) REQUIRE (n.`prop1`) IS UNIQUE" | +| 2 | "node_vector_constraint" | "NODE_PROPERTY_TYPE" | "NODE" | ["Movie"] | ["embedding"] | NULL | "VECTOR(42)" | NULL | "CREATE CONSTRAINT `node_vector_constraint` FOR (n:`Movie`) REQUIRE (n.`embedding`) IS :: VECTOR(42)" | +| 21 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | "ownershipId" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `ownershipId` FOR ()-[r:`OWNS`]-() REQUIRE (r.`ownershipId`) IS KEY" | +| 15 | "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["order"] | NULL | "INTEGER" | NULL | "CREATE CONSTRAINT `part_of` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`order`) IS :: INTEGER" | +| 17 | "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["tags"] | NULL | "STRING | LIST" | NULL | "CREATE CONSTRAINT `part_of_tags` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`tags`) IS :: STRING | LIST" | +| 11 | "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | "prequels" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `prequels` FOR ()-[r:`PREQUEL_OF`]-() REQUIRE (r.`order`, r.`author`) IS UNIQUE" | +| 28 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["published"] | NULL | NULL | NULL | "CREATE CONSTRAINT `rel_exist_param` FOR ()-[r:`WROTE`]-() REQUIRE (r.`published`) IS NOT NULL" | +| 3 | "rel_vector_constraint" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["CONTAINS"] | ["embedding"] | NULL | "VECTOR(1536)" | NULL | "CREATE CONSTRAINT `rel_vector_constraint` FOR ()-[r:`CONTAINS`]-() REQUIRE (r.`embedding`) IS :: VECTOR(1536)" | +| 7 | "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["SEQUEL_OF"] | ["order"] | "sequels" | NULL | {indexConfig: {}} | "CREATE CONSTRAINT `sequels` FOR ()-[r:`SEQUEL_OF`]-() REQUIRE (r.`order`) IS UNIQUE" | +| 13 | "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["year"] | NULL | NULL | NULL | "CREATE CONSTRAINT `wrote_year` FOR ()-[r:`WROTE`]-() REQUIRE (r.`year`) IS NOT NULL" | ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ---- ====== @@ -1580,18 +1584,19 @@ WHERE entityType = 'RELATIONSHIP' .Result [source, queryresult] ---- -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| id | name | type | entityType | labelsOrTypes | properties | ownedIndex | propertyType | -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| 23 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | "knows_since_how" | NULL | -| 19 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | "ownershipId" | NULL | -| 13 | "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["order"] | NULL | "INTEGER" | -| 15 | "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["tags"] | NULL | "STRING | LIST" | -| 9 | "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | "prequels" | NULL | -| 26 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["published"] | NULL | NULL | -| 5 | "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["SEQUEL_OF"] | ["order"] | "sequels" | NULL | -| 11 | "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["year"] | NULL | NULL | -+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| id | name | type | entityType | labelsOrTypes | properties | ownedIndex | propertyType | ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| 25 | "knows_since_how" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["KNOWS"] | ["since", "how"] | "knows_since_how" | NULL | +| 21 | "ownershipId" | "RELATIONSHIP_KEY" | "RELATIONSHIP" | ["OWNS"] | ["ownershipId"] | "ownershipId" | NULL | +| 15 | "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["order"] | NULL | "INTEGER" | +| 17 | "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["PART_OF"] | ["tags"] | NULL | "STRING | LIST" | +| 11 | "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["PREQUEL_OF"] | ["order", "author"] | "prequels" | NULL | +| 28 | "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["published"] | NULL | NULL | +| 3 | "rel_vector_constraint" | "RELATIONSHIP_PROPERTY_TYPE" | "RELATIONSHIP" | ["CONTAINS"] | ["embedding"] | NULL | "VECTOR(1536)" | +| 7 | "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "RELATIONSHIP" | ["SEQUEL_OF"] | ["order"] | "sequels" | NULL | +| 13 | "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "RELATIONSHIP" | ["WROTE"] | ["year"] | NULL | NULL | ++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ---- ====== @@ -1612,26 +1617,28 @@ YIELD name, type, createStatement .Result [source, queryresult] ---- -+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| name | type | createStatement | -+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ -| "actor_fullname" | "NODE_KEY" | "CREATE CONSTRAINT `actor_fullname` FOR (n:`Actor`) REQUIRE (n.`firstname`, n.`surname`) IS KEY" | -| "author_name" | "NODE_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `author_name` FOR (n:`Author`) REQUIRE (n.`name`) IS NOT NULL" | -| "book_isbn" | "NODE_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `book_isbn` FOR (n:`Book`) REQUIRE (n.`isbn`) IS UNIQUE" | -| "book_title_year" | "NODE_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `book_title_year` FOR (n:`Book`) REQUIRE (n.`title`, n.`publicationYear`) IS UNIQUE" | -| "director_imdbId" | "NODE_KEY" | "CREATE CONSTRAINT `director_imdbId` FOR (n:`Director`) REQUIRE (n.`imdbId`) IS KEY" | -| "knows_since_how" | "RELATIONSHIP_KEY" | "CREATE CONSTRAINT `knows_since_how` FOR ()-[r:`KNOWS`]-() REQUIRE (r.`since`, r.`how`) IS KEY" | -| "movie_tagline" | "NODE_PROPERTY_TYPE" | "CREATE CONSTRAINT `movie_tagline` FOR (n:`Movie`) REQUIRE (n.`tagline`) IS :: STRING | LIST" | -| "movie_title" | "NODE_PROPERTY_TYPE" | "CREATE CONSTRAINT `movie_title` FOR (n:`Movie`) REQUIRE (n.`title`) IS :: STRING" | -| "node_uniqueness_param" | "NODE_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `node_uniqueness_param` FOR (n:`Book`) REQUIRE (n.`prop1`) IS UNIQUE" | -| "ownershipId" | "RELATIONSHIP_KEY" | "CREATE CONSTRAINT `ownershipId` FOR ()-[r:`OWNS`]-() REQUIRE (r.`ownershipId`) IS KEY" | -| "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "CREATE CONSTRAINT `part_of` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`order`) IS :: INTEGER" | -| "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "CREATE CONSTRAINT `part_of_tags` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`tags`) IS :: STRING | LIST" | -| "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `prequels` FOR ()-[r:`PREQUEL_OF`]-() REQUIRE (r.`order`, r.`author`) IS UNIQUE" | -| "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `rel_exist_param` FOR ()-[r:`WROTE`]-() REQUIRE (r.`published`) IS NOT NULL" | -| "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `sequels` FOR ()-[r:`SEQUEL_OF`]-() REQUIRE (r.`order`) IS UNIQUE" | -| "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `wrote_year` FOR ()-[r:`WROTE`]-() REQUIRE (r.`year`) IS NOT NULL" | -+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| name | type | createStatement | ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ +| "actor_fullname" | "NODE_KEY" | "CREATE CONSTRAINT `actor_fullname` FOR (n:`Actor`) REQUIRE (n.`firstname`, n.`surname`) IS KEY" | +| "author_name" | "NODE_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `author_name` FOR (n:`Author`) REQUIRE (n.`name`) IS NOT NULL" | +| "book_isbn" | "NODE_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `book_isbn` FOR (n:`Book`) REQUIRE (n.`isbn`) IS UNIQUE" | +| "book_title_year" | "NODE_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `book_title_year` FOR (n:`Book`) REQUIRE (n.`title`, n.`publicationYear`) IS UNIQUE" | +| "director_imdbId" | "NODE_KEY" | "CREATE CONSTRAINT `director_imdbId` FOR (n:`Director`) REQUIRE (n.`imdbId`) IS KEY" | +| "knows_since_how" | "RELATIONSHIP_KEY" | "CREATE CONSTRAINT `knows_since_how` FOR ()-[r:`KNOWS`]-() REQUIRE (r.`since`, r.`how`) IS KEY" | +| "movie_tagline" | "NODE_PROPERTY_TYPE" | "CREATE CONSTRAINT `movie_tagline` FOR (n:`Movie`) REQUIRE (n.`tagline`) IS :: STRING | LIST" | +| "movie_title" | "NODE_PROPERTY_TYPE" | "CREATE CONSTRAINT `movie_title` FOR (n:`Movie`) REQUIRE (n.`title`) IS :: STRING" | +| "node_uniqueness_param" | "NODE_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `node_uniqueness_param` FOR (n:`Book`) REQUIRE (n.`prop1`) IS UNIQUE" | +| "node_vector_constraint" | "NODE_PROPERTY_TYPE" | "CREATE CONSTRAINT `node_vector_constraint` FOR (n:`Movie`) REQUIRE (n.`embedding`) IS :: VECTOR(42)" | +| "ownershipId" | "RELATIONSHIP_KEY" | "CREATE CONSTRAINT `ownershipId` FOR ()-[r:`OWNS`]-() REQUIRE (r.`ownershipId`) IS KEY" | +| "part_of" | "RELATIONSHIP_PROPERTY_TYPE" | "CREATE CONSTRAINT `part_of` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`order`) IS :: INTEGER" | +| "part_of_tags" | "RELATIONSHIP_PROPERTY_TYPE" | "CREATE CONSTRAINT `part_of_tags` FOR ()-[r:`PART_OF`]-() REQUIRE (r.`tags`) IS :: STRING | LIST" | +| "prequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `prequels` FOR ()-[r:`PREQUEL_OF`]-() REQUIRE (r.`order`, r.`author`) IS UNIQUE" | +| "rel_exist_param" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `rel_exist_param` FOR ()-[r:`WROTE`]-() REQUIRE (r.`published`) IS NOT NULL" | +| "rel_vector_constraint" | "RELATIONSHIP_PROPERTY_TYPE" | "CREATE CONSTRAINT `rel_vector_constraint` FOR ()-[r:`CONTAINS`]-() REQUIRE (r.`embedding`) IS :: VECTOR(1536)" | +| "sequels" | "RELATIONSHIP_PROPERTY_UNIQUENESS" | "CREATE CONSTRAINT `sequels` FOR ()-[r:`SEQUEL_OF`]-() REQUIRE (r.`order`) IS UNIQUE" | +| "wrote_year" | "RELATIONSHIP_PROPERTY_EXISTENCE" | "CREATE CONSTRAINT `wrote_year` FOR ()-[r:`WROTE`]-() REQUIRE (r.`year`) IS NOT NULL" | ++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ ---- ====== From 5a3398d7a6d99cc5935038c6a5fc0b8034543b2c Mon Sep 17 00:00:00 2001 From: Stefano Ottolenghi Date: Sat, 4 Oct 2025 10:11:47 +0200 Subject: [PATCH 6/7] polish --- .../constraints/managing-constraints.adoc | 33 +++++++++---------- modules/ROOT/pages/constraints/syntax.adoc | 9 +++-- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/modules/ROOT/pages/constraints/managing-constraints.adoc b/modules/ROOT/pages/constraints/managing-constraints.adoc index 9a4e5027d..ad8cd28b7 100644 --- a/modules/ROOT/pages/constraints/managing-constraints.adoc +++ b/modules/ROOT/pages/constraints/managing-constraints.adoc @@ -344,7 +344,7 @@ Added 1 constraint. ====== -.Create `VECTOR` property type constraints label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.xx] +.Create `VECTOR` property type constraints label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.10] ====== It is necessary to specify both the dimension and the coordinate type of any constrained `VECTOR` properties. @@ -436,7 +436,7 @@ The allowed property types for property type constraints are: * `ZONED DATETIME` * `DURATION` * `POINT` -* `VECTOR(DIMENSION)` label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.xx] +* `VECTOR(DIMENSION)` label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.10] * `LIST` * `LIST` * `LIST` @@ -451,8 +451,7 @@ The allowed property types for property type constraints are: * Any closed dynamic union of the above types, e.g. `INTEGER | FLOAT | STRING`. [NOTE] -A property type constraint cannot be created for `LIST(DIMENSION) NOT NULL>`. -This is because it is not possible to store lists of xref:values-and-types/vector.adoc[`VECTOR`] values. +Because storing lists of xref:values-and-types/vector.adoc[`VECTOR`] values is not supported, property type constraints cannot be created for `LIST(DIMENSION) NOT NULL>`. For a complete reference describing all types available in Cypher, see the section on xref::values-and-types/property-structural-constructed.adoc#types-synonyms[types and their synonyms]. @@ -737,7 +736,7 @@ Additionally, some constraints cannot coexist and attempting to create them toge This includes: * Property type constraints on the same label/relationship type and property but with different property types. -This includes `VECTOR` types with differing dimensions or coordinate types. +This includes `VECTOR` types with different dimensions or coordinate types. * Property uniqueness and key constraints on the same label/relationship type and property combination. However, some constraint types are allowed on the same label/relationship type and property combination. @@ -1096,7 +1095,7 @@ A constraint cannot be created until the index has been dropped. | *Property uniqueness constraint* | ^| ❌ -| +| | *Property existence constraint* ^| ❌ @@ -1263,7 +1262,7 @@ Node(9) with label `Movie` required the property `title` to be of type `STRING`, | *Property uniqueness constraint* | ^| ❌ -| +| | *Property existence constraint* ^| ❌ @@ -1365,7 +1364,7 @@ RETURN wrote | Query | Node property uniqueness constraint -a| +a| [source] ---- MATCH (n1:Label), (n2:Label) @@ -1374,7 +1373,7 @@ RETURN n1, n2 ---- | Relationship property uniqueness constraint -a| +a| [source] ---- MATCH ()-[r1:REL_TYPE]->(), ()-[r2:REL_TYPE]->() @@ -1383,7 +1382,7 @@ RETURN r1, r2 ---- | Node property existence constraint -a| +a| [source] ---- MATCH (n:Label) @@ -1392,7 +1391,7 @@ RETURN n ---- | Relationship property existence constraint -a| +a| [source] ---- MATCH ()-[r:REL_TYPE]->() @@ -1401,7 +1400,7 @@ RETURN r ---- | Node property type constraint -a| +a| [source] ---- MATCH (n:Label) @@ -1410,7 +1409,7 @@ RETURN n ---- | Relationship property type constraint -a| +a| [source] ---- MATCH ()-[r:REL_TYPE]->() @@ -1419,7 +1418,7 @@ RETURN r ---- | Node key constraint -a| +a| [source] ---- MATCH (n1:Label), (n2:Label) @@ -1433,7 +1432,7 @@ RETURN n AS node, 'non-existing' AS reason ---- | Relationship key constraint -a| +a| [source] ---- MATCH ()-[r1:REL_TYPE]->(), ()-[r2:REL_TYPE]->() @@ -1701,7 +1700,7 @@ label:default-output[] == DROP CONSTRAINT Constraints are dropped using the `DROP CONSTRAINT` command. -It is possible to drop a constraint that was created in a later Cypher version than the one currently in use. +It is possible to drop constraints created in a different Cypher version than the one in use. For example, although `VECTOR` property type constraints were added in Cypher 25, such constraints can still be dropped using Cypher 5. For the full command syntax to drop constraints, see xref:constraints/syntax.adoc#drop-constraint[Syntax -> DROP CONSTRAINT]. @@ -1791,4 +1790,4 @@ DROP CONSTRAINT missing_constraint_name IF EXISTS `DROP CONSTRAINT missing_constraint_name IF EXISTS` has no effect. `missing_constraint_name` does not exist. ---- -====== \ No newline at end of file +====== diff --git a/modules/ROOT/pages/constraints/syntax.adoc b/modules/ROOT/pages/constraints/syntax.adoc index 70c4fcc74..a9edcaa92 100644 --- a/modules/ROOT/pages/constraints/syntax.adoc +++ b/modules/ROOT/pages/constraints/syntax.adoc @@ -19,7 +19,7 @@ If a name is not explicitly given, a unique name will be auto-generated. [NOTE] Creating a constraint requires the link:{neo4j-docs-base-uri}/operations-manual/current/authentication-authorization/database-administration/#access-control-database-administration-constraints[`CREATE CONSTRAINT` privilege]. -The `CREATE CONSTRAINT` command is optionally idempotent. +The `CREATE CONSTRAINT` command is optionally idempotent. This means its default behavior is to throw an error if an attempt is made to create the same constraint twice. With the `IF NOT EXISTS` flag, no error is thrown and nothing happens should a constraint with the same name or same schema and constraint type already exist. It may still throw an error if conflicting data, indexes, or constraints exist. @@ -122,7 +122,7 @@ Where `` is one of the following property types: * `ZONED DATETIME` * `DURATION` * `POINT` -* `VECTOR(DIMENSION)` label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.xx] +* `VECTOR(DIMENSION)` label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.10] * `LIST` * `LIST` * `LIST` @@ -137,8 +137,7 @@ Where `` is one of the following property types: * Any closed dynamic union of the above types, e.g. `INTEGER | FLOAT | STRING`. [NOTE] -A property type constraint cannot be created for `LIST(DIMENSION) NOT NULL>`. -This is because it is not possible to store lists of `VECTOR` values. +Because storing lists of xref:values-and-types/vector.adoc[`VECTOR`] values is not supported, property type constraints cannot be created for `LIST(DIMENSION) NOT NULL>`. Additionally, `VECTOR` property type constraints must be created with a specific dimension and coordinate value, where the dimension must be greater than `0` and less or equal to `4096`. For more information, see xref:values-and-types/vector.adoc[Values and types -> Vectors]. @@ -317,4 +316,4 @@ This means its default behavior is to throw an error if an attempt is made to dr With the `IF EXISTS` flag, no error is thrown and nothing happens should the constraint not exist. Instead, an informational notification is returned detailing that the constraint does not exist. -For examples on how to drop constraints, see xref:constraints/managing-constraints.adoc#drop-constraint[Create, show, and drop constraints -> DROP CONSTRAINT]. \ No newline at end of file +For examples on how to drop constraints, see xref:constraints/managing-constraints.adoc#drop-constraint[Create, show, and drop constraints -> DROP CONSTRAINT]. From 1b6869d590cf0bf94ef97abe21d81c88bcca265f Mon Sep 17 00:00:00 2001 From: Stefano Ottolenghi Date: Sat, 4 Oct 2025 10:19:37 +0200 Subject: [PATCH 7/7] note on `null` createStatement --- modules/ROOT/pages/constraints/managing-constraints.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/constraints/managing-constraints.adoc b/modules/ROOT/pages/constraints/managing-constraints.adoc index ad8cd28b7..3b63b8eb7 100644 --- a/modules/ROOT/pages/constraints/managing-constraints.adoc +++ b/modules/ROOT/pages/constraints/managing-constraints.adoc @@ -1691,7 +1691,7 @@ label:default-output[] | MAP | createStatement -| Statement used to create the constraint. +| Statement used to create the constraint, or `null` if the constraint cannot be created through `CREATE CONSTRAINT` (for example in case of version incompatibilities). | STRING |===