You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/constraints/syntax.adoc
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ If a name is not explicitly given, a unique name will be auto-generated.
19
19
[NOTE]
20
20
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].
21
21
22
-
The `CREATE CONSTRAINT` command is optionally idempotent.
22
+
The `CREATE CONSTRAINT` command is optionally idempotent.
23
23
This means its default behavior is to throw an error if an attempt is made to create the same constraint twice.
24
24
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.
25
25
It may still throw an error if conflicting data, indexes, or constraints exist.
@@ -122,6 +122,7 @@ Where `<TYPE>` is one of the following property types:
122
122
* `ZONED DATETIME`
123
123
* `DURATION`
124
124
* `POINT`
125
+
* `VECTOR<TYPE>(DIMENSION)` label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.10]
125
126
* `LIST<BOOLEAN NOT NULL>`
126
127
* `LIST<STRING NOT NULL>`
127
128
* `LIST<INTEGER NOT NULL>`
@@ -135,6 +136,11 @@ Where `<TYPE>` is one of the following property types:
135
136
* `LIST<POINT NOT NULL>`
136
137
* Any closed dynamic union of the above types, e.g. `INTEGER | FLOAT | STRING`.
137
138
139
+
[NOTE]
140
+
Because storing lists of xref:values-and-types/vector.adoc[`VECTOR`] values is not supported, property type constraints cannot be created for `LIST<VECTOR<TYPE>(DIMENSION) NOT NULL>`.
141
+
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 than or equal to `4096`.
142
+
For more information, see xref:values-and-types/vector.adoc[Values and types -> Vectors].
143
+
138
144
Allowed syntax variations of these types are listed in xref::values-and-types/property-structural-constructed.adoc#types-synonyms[Types and their synonyms].
139
145
140
146
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].
@@ -310,4 +316,4 @@ This means its default behavior is to throw an error if an attempt is made to dr
310
316
With the `IF EXISTS` flag, no error is thrown and nothing happens should the constraint not exist.
311
317
Instead, an informational notification is returned detailing that the constraint does not exist.
312
318
313
-
For examples on how to drop constraints, see xref:constraints/managing-constraints.adoc#drop-constraint[Create, show, and drop constraints -> DROP CONSTRAINT].
319
+
For examples on how to drop constraints, see xref:constraints/managing-constraints.adoc#drop-constraint[Create, show, and drop constraints -> DROP CONSTRAINT].
@@ -22,6 +22,123 @@ Cypher 25 was introduced in Neo4j 2025.06 and can only be used on Neo4j 2025.06+
22
22
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.
23
23
For more information, see xref:queries/select-version.adoc[].
a| Introduced a `VECTOR` value type that can be stored as xref:indexes/semantic-indexes/vector-indexes.adoc#embeddings[embedding] properties on nodes and relationships and utilized for efficient semantic retrieval using Neo4j's xref:indexes/semantic-indexes/vector-indexes.adoc[vector indexes] and xref:genai-integrations.adoc[GenAI plugin].
45
+
For more information, see xref:values-and-types/vector.adoc[Values and types -> Vectors].
46
+
47
+
a|
48
+
label:functionality[]
49
+
label:new[]
50
+
[source, cypher]
51
+
----
52
+
WITH vector([1, 2, 3], 3, INTEGER) AS vector
53
+
RETURN vector, valueType(vector) AS vectorType
54
+
----
55
+
56
+
a| New xref:functions/vector.adoc#functions-vector[`vector()`] function for the construction of xref:values-and-types/vector.adoc[`VECTOR`] values.
57
+
58
+
a|
59
+
label:functionality[]
60
+
label:new[]
61
+
[source, cypher]
62
+
----
63
+
RETURN vector_dimension_count(vector([1, 2, 3], 3, INTEGER)) AS size
64
+
----
65
+
66
+
a| New xref:functions/vector.adoc#functions-vector_dimension_count[`vector_dimension_count()`] function, which returns the dimension of a xref:values-and-types/vector.adoc[`VECTOR`] value.
a| New xref:functions/vector.adoc#functions-vector_distance[`vector_distance()`] function, which returns the distance between two xref:values-and-types/vector.adoc[`VECTOR`] values based on the selected `vectorDistanceMetric` algorithm.
77
+
78
+
a|
79
+
label:functionality[]
80
+
label:new[]
81
+
[source, cypher]
82
+
----
83
+
RETURN vector_norm(vector([1.0, 5.0, 3.0, 6.7], 4, FLOAT), EUCLIDEAN) AS norm
84
+
----
85
+
86
+
a| New xref:functions/vector.adoc#functions-vector_norm[`vector_norm()`] function, which returns the distance between the given vector and an origin vector, which is a vector with the same dimension with all coordinates set to zero, calculated using the specified `vectorDistanceMetric`.
87
+
88
+
a|
89
+
label:functionality[]
90
+
label:new[]
91
+
[source, cypher, role="noheader"]
92
+
----
93
+
CREATE CONSTRAINT node_vector_constraint
94
+
FOR (n:Movie) REQUIRE n.embedding IS :: VECTOR<INT32>(42)
95
+
----
96
+
97
+
[source, cypher, role="noheader"]
98
+
----
99
+
CREATE CONSTRAINT rel_vector_constraint
100
+
FOR ()-[r:CONTAINS]->() REQUIRE r.embedding IS :: VECTOR<FLOAT32>(1536)
101
+
----
102
+
103
+
a| Introduced `VECTOR` property type constraints.
104
+
For more information, see xref:constraints/managing-constraints.adoc#create-property-type-constraints[Create property type constraints].
a| The xref:functions/list.adoc#functions-tofloatlist[`toFloatList()`], xref:functions/list.adoc#functions-tointegerlist[`toIntegerList()`], xref:functions/vector.adoc#functions-similarity-cosine[`vector.similarity.cosine()`], and xref:functions/vector.adoc#functions-similarity-euclidean[`vector.similarity.euclidean()`] functions now accept `VECTOR` values as input arguments.
127
+
128
+
a|
129
+
label:functionality[]
130
+
label:updated[]
131
+
[source, cypher]
132
+
----
133
+
RETURN datetime('11/18/1986', "MM/dd/yyyy") AS dt
134
+
----
135
+
136
+
| The following constructors of temporal types have been extended with the optional argument `pattern`:
137
+
xref:functions/temporal/index.adoc#functions-date[date()], xref:functions/temporal/index.adoc#functions-datetime[datetime()], xref:functions/temporal/index.adoc#functions-localdatetime[localdatetime()], xref:functions/temporal/index.adoc#functions-localtime[localtime()], xref:functions/temporal/index.adoc#functions-time[time()] and xref:functions/temporal/duration.adoc#functions-durations[duration()].
138
+
These patterns are the same as those used to create temporal strings with the xref:functions/temporal/format.adoc[`format()`] function introduced in 2025.09 and thus allow for the parsing of temporal strings into temporal values.
@@ -43,7 +160,7 @@ RETURN format(dt, "MM/dd/yyyy") AS US, format(dt, "dd/MM/yyyy") AS EU
43
160
44
161
| Cypher's new xref:functions/temporal/format.adoc[`format()`] function can create dynamically formatted string representations of temporal instance and duration types.
45
162
46
-
a|
163
+
a|
47
164
label:functionality[]
48
165
label:new[]
49
166
@@ -94,7 +211,7 @@ label:functionality[]
94
211
label:updated[]
95
212
[source, cypher]
96
213
----
97
-
PROFILE
214
+
PROFILE
98
215
WITH "Person" AS label
99
216
MATCH (people:$(label))
100
217
RETURN people.name
@@ -118,7 +235,7 @@ label:new[]
118
235
----
119
236
MATCH (()-->(n))+
120
237
WHERE allReduce(acc = 0, node IN n \| acc + node.x, 6 < acc < 30)
121
-
RETURN [i IN n \| i.x] AS sequence
238
+
RETURN [i IN n \| i.x] AS sequence
122
239
ORDER BY head(n).x, size(n)
123
240
----
124
241
@@ -151,7 +268,6 @@ RETURN n:$(<expr3>)
151
268
| Added the ability to dynamically reference node labels and relationship types in places where xref:patterns/reference.adoc#label-expressions[label expressions] are allowed.
a| Set the default Cypher version for a remote database alias when creating it.
@@ -917,7 +1033,7 @@ CASE x ... WHEN contains - 1 THEN ... END
917
1033
a| Using a variable named `contains` (or any casing variant, like `CONTAINS`) in addition or subtraction operations within a `WHEN` operand of a xref:expressions/conditional-expressions.adoc#case-simple[simple `CASE`] expression is deprecated.
918
1034
To continue using variables with this name, use backticks to quote the variable name:
919
1035
920
-
* Additions: `CASE x ... WHEN ++`contains`++ + 1 THEN ... END`
1036
+
* Additions: `CASE x ... WHEN ++`contains`++ + 1 THEN ... END`
921
1037
* Subtractions: `CASE x ... WHEN ++`contains`++ - 1 THEN ... END`
922
1038
923
1039
a|
@@ -932,8 +1048,8 @@ CASE x ... WHEN in["abc"] THEN ... END
932
1048
----
933
1049
a| Using the `[]` operator on a variable named `in` (or any casing variant, like `IN`) within a `WHEN` operand of a xref:expressions/conditional-expressions.adoc#case-simple[simple `CASE`] expression is deprecated.
934
1050
To continue using variables with this name, use backticks to quote the variable name:
935
-
936
-
* `CASE x ... WHEN ++`in`++[1] THEN ... END`
1051
+
1052
+
* `CASE x ... WHEN ++`in`++[1] THEN ... END`
937
1053
* `CASE x ... WHEN ++`in`++["abc"] THEN ... END`
938
1054
939
1055
@@ -1132,7 +1248,7 @@ label:functionality[]
1132
1248
label:updated[]
1133
1249
[source, cypher, role="noheader"]
1134
1250
----
1135
-
CREATE (n:Label {property: 'name'}),
1251
+
CREATE (n:Label {property: 'name'}),
1136
1252
()-[r:REL_TYPE]->()
1137
1253
----
1138
1254
| Neo4j's link:{neo4j-docs-base-uri}/operations-manual/current/database-internals/store-formats/#store-format-overview[block format] now implements xref:appendix/gql-conformance/index.adoc[GQL's] limit on the maximum length of identifiers.
@@ -1183,7 +1299,7 @@ RETURN t AS team, players
1183
1299
1184
1300
[source, cypher, role="noheader"]
1185
1301
----
1186
-
OPTIONAL CALL db.labels() YIELD label
1302
+
OPTIONAL CALL db.labels() YIELD label
1187
1303
RETURN label
1188
1304
----
1189
1305
@@ -1534,7 +1650,7 @@ MATCH SHORTEST 2 GROUPS (:A)-[:R]->{0,10}(:B)
1534
1650
1535
1651
a| Introduced new graph pattern matching keywords to find variations of the xref:patterns/shortest-paths.adoc[shortest paths] between nodes.
1536
1652
1537
-
a|
1653
+
a|
1538
1654
label:functionality[]
1539
1655
label:new[]
1540
1656
@@ -4732,4 +4848,4 @@ MATCH (n:N {prop1: 42} WHERE n.prop2 > 42)
4732
4848
a|
4733
4849
New syntax that enables inlining of `WHERE` clauses inside node patterns.
0 commit comments