Skip to content

Commit e625176

Browse files
syntax, fixes, and additions
1 parent f598cc9 commit e625176

File tree

11 files changed

+577
-134
lines changed

11 files changed

+577
-134
lines changed

modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,127 @@ Cypher 25 was introduced in Neo4j 2025.06 and can only be used on Neo4j 2025.06+
2222
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.
2323
For more information, see xref:queries/select-version.adoc[].
2424

25+
[[cypher-deprecations-additions-removals-2025.xx]]
26+
== Neo4j 2025.xx
27+
28+
=== Updated in Cypher 25
29+
30+
[cols="2", options="header"]
31+
|===
32+
| Feature
33+
| Details
34+
35+
a|
36+
label:functionality[]
37+
label:updated[]
38+
[source, cypher, role="noheader"]
39+
----
40+
SHOW CONSTRAINTS YIELD name, enforcedLabel, classification
41+
----
42+
43+
a|
44+
Introduced two new columns returned by `SHOW CONSTRAINTS`:
45+
46+
* `enforcedLabel`: shows the implied labels belonging to a node element type, and the source and target node labels belonging to a relationship element type.
47+
* `classification`: shows the status of a constraint in a graph type.
48+
49+
For more information, see xref:schema/constraints/list-constraints.adoc#list-constraints-result-columns[Constraints -> Result columns for listing constraints] and xref:schema/graph-types/list-graph-types.adoc#graph-type-elements-in-show-constraints[Graph types -> Graph type elements in `SHOW CONSTRAINTS`].
50+
51+
a|
52+
label:functionality[]
53+
label:updated[]
54+
[source, syntax, role="noheader"]
55+
----
56+
SHOW NODE EXIST[ENCE] \| EXIST[ENCE] CONSTRAINTS
57+
----
58+
59+
| The `NODE EXIST[ENCE]` and `EXIST[ENCE]` type filtering options allowed by the `SHOW CONSTRAINTS` command now also return node label existence constraints (crated as part of node element types in a xref:schema/graph-types/index.adoc[graph type]).
60+
For more information, see xref:schema/syntax.adoc#constraints-syntax-list-type-filter[Syntax -> Type filters].
61+
62+
|===
63+
64+
=== New in Cypher 25
65+
66+
[cols="2", options="header"]
67+
|===
68+
| Feature
69+
| Details
70+
71+
a|
72+
label:functionality[]
73+
label:new[]
74+
[source, cypher, role="noheader"]
75+
----
76+
ALTER CURRENT GRAPH TYPE SET {
77+
(:Person => :Resident {name :: STRING NOT NULL}),
78+
(:Pet => :Resident&Animal {healthCertificate :: STRING, name :: STRING}),
79+
(:City => {name :: STRING NOT NULL, population :: INTEGER}),
80+
(:Resident)-[:LIVES_IN => {since :: DATE NOT NULL}]->(:City)
81+
}
82+
----
83+
84+
| Introduced the ability to set a xref:schema/graph-types/index.adoc[graph type] for a database using the `ALTER CURRENT GRAPH TYPE SET` command.
85+
A graph type enforces holistically an open schema, providing a defined structure for an entire graph, and includes constraint types (node label existence, relationship source node, and relationship target node constraints) not possible to create using the older `CREATE CONSTRAINT` syntax.
86+
For more information, see xref:schema/graph-types/set-graph-types.adoc[].
87+
88+
a|
89+
label:functionality[]
90+
label:new[]
91+
[source, cypher, role="noheader"]
92+
----
93+
ALTER CURRENT GRAPH TYPE ADD {
94+
(p:Person => :Resident {name :: STRING, ssn :: INTEGER, nationality :: STRING})
95+
REQUIRE (p.name, p.ssn) IS KEY,
96+
CONSTRAINT pet_address FOR (pet:Pet) REQUIRE pet.address IS NOT NULL,
97+
(:Animal => {type :: STRING NOT NULL})
98+
}
99+
----
100+
101+
| Introduced the ability to extend graph types using the `ALTER CURRENT GRAPH TYPE ADD` command.
102+
For more information, see xref:schema/graph-types/extend-graph-types.adoc[].
103+
104+
a|
105+
label:functionality[]
106+
label:new[]
107+
[source, cypher, role="noheader"]
108+
----
109+
ALTER CURRENT GRAPH TYPE ALTER {
110+
(:Robot => :Resident&Machine {application :: STRING NOT NULL, id :: INTEGER NOT NULL}),
111+
(:Resident)-[:LIVES_IN => {since :: ANY NOT NULL}]->(:City)
112+
}
113+
----
114+
115+
| Introduced the ability to alter graph types using the `ALTER CURRENT GRAPH TYPE ALTER` command.
116+
For more information, see xref:schema/graph-types/alter-graph-types.adoc[].
117+
118+
a|
119+
label:functionality[]
120+
label:new[]
121+
[source, cypher, role="noheader"]
122+
----
123+
SHOW CURRENT GRAPH TYPE
124+
----
125+
126+
| Introduced the ability to show graph types using the `SHOW CURRENT GRAPH TYPE` command.
127+
For more information, see xref:schema/graph-types/list-graph-types.adoc[].
128+
129+
a|
130+
label:functionality[]
131+
label:new[]
132+
[source, cypher, role="noheader"]
133+
----
134+
ALTER CURRENT GRAPH DROP {
135+
(:Pet =>)
136+
}
137+
----
138+
139+
| Introduced the ability to drop elements from graph types using the `ALTER CURRENT GRAPH TYPE DROP` command.
140+
For more information, see xref:schema/graph-types/drop-graph-type-elements.adoc[].
141+
|===
142+
143+
144+
145+
25146
[[cypher-deprecations-additions-removals-2025.09]]
26147
== Neo4j 2025.09
27148

modules/ROOT/pages/schema/constraints/drop-constraints.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ CREATE CONSTRAINT node_uniqueness_param
5353
FOR (book:Book) REQUIRE book.prop1 IS UNIQUE;
5454
CREATE CONSTRAINT rel_exist_param
5555
FOR ()-[wrote:WROTE]-() REQUIRE wrote.published IS NOT NULL
56+
----
5657
////
5758

5859
.Drop a constraint by name

modules/ROOT/pages/schema/constraints/index.adoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,14 @@ For information about listing and dropping constraints, see:
1616
* xref:schema/constraints/list-constraints.adoc[]
1717
* xref:schema/constraints/drop-constraints.adoc[]
1818
19-
For reference material about the Cypher commands used to manage constraints, see xref:schema/syntax.adoc[].
19+
For reference material about the Cypher commands used to manage constraints, see xref:schema/syntax.adoc#constraints[Syntax -> Constraints].
20+
21+
[NOTE]
22+
====
23+
All constraints created using the older xref:schema/constraints/create-constraints.adoc#create-constraint[`CREATE CONSTRAINT`] syntax will automatically be added to the graph type of a database.
24+
Not all constraint types can be created using this syntax, however, and maintaining individual constraints can become complicated over time as their number increases.
25+
26+
*It is, therefore, recommended to define a schema using a graph type, which offers both additional, more sophisticated constraint types and a more holistic and simplified approach for constraining and maintaining the shape of the data in a graph.*
27+
28+
For more information, see xref:schema/graph-types/index.adoc[]
29+
====

modules/ROOT/pages/schema/constraints/list-constraints.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ The list returned will only include a single value (the name of the constrained
274274
| LIST<STRING>
275275

276276
| enforcedLabel
277-
| The implied labels required by a node element type. label:default-output[] label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.xx]
277+
| The implied labels required by a node element type or the source node and target node labels required by a relationship element type. label:default-output[] label:cypher[Cypher 25 only] label:new[Introduced in Neo4j 2025.xx]
278278
| STRING
279279

280280
| ownedIndex

modules/ROOT/pages/schema/graph-types/alter-graph-types.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ ALTER CURRENT GRAPH TYPE SET {
2424
(:Pet => :Resident&Animal {insuranceNumber :: INTEGER IS KEY, healthCertificate :: STRING IS UNIQUE, name :: STRING}),
2525
(:Robot => :Resident {application :: STRING NOT NULL}),
2626
(:City => {name :: STRING NOT NULL, population :: INTEGER}),
27-
(:Resident)-[:LIVES_IN => {since:: DATE NOT NULL}]->(:City),
27+
(:Resident)-[:LIVES_IN => {since :: DATE NOT NULL}]->(:City),
2828
(:Company => {name :: STRING, address :: STRING IS UNIQUE}),
2929
(:Person)-[:WORKS_FOR => {role :: STRING}]->(:Company),
3030
CONSTRAINT company_name FOR (c:Company) REQUIRE c.name IS KEY,
31-
CONSTRAINT animal_id FOR (a:Animal) REQUIRE a.Id IS UNIQUE,
31+
CONSTRAINT animal_id FOR (a:Animal) REQUIRE a.id IS UNIQUE,
3232
CONSTRAINT resident_address FOR (resident:Resident) REQUIRE resident.address :: STRING
3333
}
3434
----
@@ -41,16 +41,16 @@ For details about all the elements included in the above graph type, see xref:sc
4141
----
4242
ALTER CURRENT GRAPH TYPE ALTER {
4343
(:Robot => :Resident&Machine {application :: STRING NOT NULL, id :: INTEGER NOT NULL}), // <1>
44-
(:Resident)-[:LIVES_IN => {since:: ANY NOT NULL}]->(:City) // <2>
44+
(:Resident)-[:LIVES_IN => {since :: ANY NOT NULL}]->(:City) // <2>
4545
}
4646
----
4747

4848
<1> Nodes with a `Robot` label must now also have a `Machine` label.
4949
`Robot` nodes are also required to have an `id` property of type `INTEGER`.
5050
<2> `since` properties on `LIVES_IN` relationships can now be of `ANY` type (they were previously constrained to be of type `DATE`).
5151

52-
.Updated graph type, showing altered node element type and relationship element type
53-
image::graph-types-alter-graph-type.svg[Graph type showing altered node element type and relationship element type, width=700, role=popup]
52+
.Updated data model, showing altered node element type and relationship element type in graph type
53+
image::graph-types-alter-graph-type.svg[Updated data model showing altered node element type and relationship element type in graph type, width=700, role=popup]
5454

5555
This alteration is implemented by the _creation_ of the following constraints:
5656

modules/ROOT/pages/schema/graph-types/drop-graph-type-elements.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ ALTER CURRENT GRAPH TYPE SET {
1616
(:Pet => :Resident&Animal {insuranceNumber :: INTEGER IS KEY, healthCertificate :: STRING IS UNIQUE, name :: STRING}),
1717
(:Robot => :Resident&Machine {application :: STRING NOT NULL, id :: INTEGER NOT NULL}),
1818
(:City => {name :: STRING NOT NULL, population :: INTEGER}),
19-
(:Resident)-[:LIVES_IN => {since:: ANY NOT NULL}]->(:City),
19+
(:Resident)-[:LIVES_IN => {since :: ANY NOT NULL}]->(:City),
2020
CONSTRAINT company_name FOR (c:Company) REQUIRE c.name IS KEY,
2121
CONSTRAINT resident_address FOR (resident:Resident) REQUIRE resident.address :: STRING,
2222
CONSTRAINT ownership_id FOR ()-[owner:OWNER_OF]->() REQUIRE owner.ownershipId IS UNIQUE,
2323
(:Company => {name :: STRING, address :: STRING IS UNIQUE}),
24-
(:Person)-[:WORKS_FOR => {role :: STRING})->(:Company)
24+
(:Person)-[:WORKS_FOR => {role :: STRING}]->(:Company)
2525
}
2626
----
2727

@@ -82,7 +82,7 @@ Dropping a node or relationship element type in this way can remove the followin
8282

8383
These constraints cannot be removed separately from the node or relationship element type they support.
8484

85-
Not allowed -- drop a dependent constraint from a node or relationship element type
85+
.Not allowed -- drop a dependent constraint from a node or relationship element type
8686
[source, cypher, role=test-fail]
8787
----
8888
ALTER CURRENT GRAPH TYPE DROP {

modules/ROOT/pages/schema/graph-types/extend-graph-types.adoc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ ALTER CURRENT GRAPH TYPE SET {
2222
(:Pet => :Resident&Animal {insuranceNumber :: INTEGER IS KEY, healthCertificate :: STRING IS UNIQUE, name :: STRING}),
2323
(:Robot => :Resident {application :: STRING NOT NULL}),
2424
(:City => {name :: STRING NOT NULL, population :: INTEGER}),
25-
(:Resident)-[:LIVES_IN => {since:: DATE NOT NULL}]->(:City),
25+
(:Resident)-[:LIVES_IN => {since :: DATE NOT NULL}]->(:City),
2626
CONSTRAINT company_name FOR (c:Company) REQUIRE c.name IS KEY,
27-
CONSTRAINT animal_id FOR (a:Animal) REQUIRE a.Id IS UNIQUE,
27+
CONSTRAINT animal_id FOR (a:Animal) REQUIRE a.id IS UNIQUE,
2828
CONSTRAINT resident_address FOR (resident:Resident) REQUIRE resident.address :: STRING
2929
}
3030
----
@@ -90,25 +90,25 @@ The graph type now includes the added node and relationship element type:
9090
(:Pet => :Resident&Animal {insuranceNumber :: INTEGER IS KEY, healthCertificate :: STRING IS UNIQUE, name :: STRING}),
9191
(:Robot => Resident {application :: STRING NOT NULL}),
9292
(:City => {name :: STRING NOT NULL, population :: INTEGER}),
93-
(:Resident)-[:LIVES_IN => {since:: DATE NOT NULL}]->(:City),
93+
(:Resident)-[:LIVES_IN => {since :: DATE NOT NULL}]->(:City),
9494
CONSTRAINT company_name FOR (c:Company) REQUIRE c.name IS KEY,
95-
CONSTRAINT animal_id FOR (a:Animal) REQUIRE a.Id IS UNIQUE,
95+
CONSTRAINT animal_id FOR (a:Animal) REQUIRE a.id IS UNIQUE,
9696
CONSTRAINT resident_address FOR (resident:Resident) REQUIRE resident.address :: STRING,
9797
(:Company => {name :: STRING, address :: STRING IS UNIQUE}),
9898
(:Person)-[:WORKS_FOR => {role :: STRING}]->(:Company)
9999
----
100100

101-
.Updated graph type, showing added node element type and relationship element type
102-
image::graph-types-extend-graph-type.svg[Graph type showing added node element type and relationship element type, width=700, role=popup]
101+
.Updated data model, showing added node element type and relationship element type in graph type
102+
image::graph-types-extend-graph-type.svg[Updated data model showing added node element type and relationship element type, width=700, role=popup]
103103

104104
.Invalid graph type extensions
105105
[source, cypher, role=test-fail]
106106
----
107107
ALTER CURRENT GRAPH TYPE ADD {
108-
(p:Person => :Resident {name :: STRING, ssn :: INTEGER, nationality :: STRING})
109-
REQUIRE (p.name, p.ssn) IS KEY, // <1>
110-
CONSTRAINT pet_address FOR (pet:Pet) REQUIRE pet.address IS NOT NULL, // <2>
111-
(:Animal => {type :: STRING NOT NULL}) // <3>
108+
(p:Person => :Resident {name :: STRING, ssn :: INTEGER, nationality :: STRING})
109+
REQUIRE (p.name, p.ssn) IS KEY, // <1>
110+
CONSTRAINT pet_address FOR (pet:Pet) REQUIRE pet.address IS NOT NULL, // <2>
111+
(:Animal => {type :: STRING NOT NULL}) // <3>
112112
}
113113
----
114114

modules/ROOT/pages/schema/graph-types/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ For more information about working with graph types, see:
1818
* xref:schema/graph-types/list-graph-types.adoc[]
1919
* xref:schema/graph-types/drop-graph-type-elements.adoc[]
2020
21-
For reference material about the Cypher commands used to manage graph types, see xref:schema/syntax.adoc[].
21+
For reference material about the Cypher commands used to manage graph types, see xref:schema/syntax.adoc#graph-types[Syntax -> Graph types].

0 commit comments

Comments
 (0)