Skip to content

Commit f077713

Browse files
authored
Merge branch 'cypher-5' into cypher-25-notes
2 parents 7dd3eef + 8b7d3d1 commit f077713

File tree

12 files changed

+435
-32
lines changed

12 files changed

+435
-32
lines changed

.github/workflows/docs-pr-checks.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@ on:
55
pull_request:
66
branches:
77
- "dev"
8-
- "5.x"
9-
- "4.[0-9]"
10-
- "3.5"
11-
8+
- "cypher-25"
9+
- "cypher-5"
1210

1311
jobs:
1412

.github/workflows/docs-teardown.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ on:
55
pull_request_target:
66
branches:
77
- "dev"
8-
- "5.x"
9-
- "4.[0-9]"
10-
- "3.5"
8+
- "cypher-25"
9+
- "cypher-5"
10+
1111
types:
1212
- closed
1313

antora.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ nav:
66
- modules/ROOT/content-nav.adoc
77
asciidoc:
88
attributes:
9-
neo4j-version: '2025.05'
9+
neo4j-version: '2025.06'

modules/ROOT/content-nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* xref:queries/index.adoc[]
77
** xref:queries/concepts.adoc[]
88
** xref:queries/basic.adoc[]
9+
** xref:queries/select-version.adoc[]
910
** xref:queries/combined-queries.adoc[]
1011
1112
* xref:clauses/index.adoc[]

modules/ROOT/pages/clauses/clause-composition.adoc

Lines changed: 117 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,31 @@ The most important aspect of read-write queries is that the state of the graph a
130130

131131
[IMPORTANT]
132132
====
133-
A clause can never observe writes made by a later clause.
133+
A clause can never observe writes made by a later clause, and will observe all writes done by the previous clauses.
134134
====
135135

136+
As of Cypher 25, read and write clauses can be combined in any order.
137+
That is, a write clause followed by a read clause no longer requires a separating xref:clauses/with.adoc[`WITH`] clause in order for the read clause to observe the changes made by a preceding write clause.
138+
For example, the following query, in which the changes made by a write clause (xref:clauses/set.adoc[`SET`]) are observed by a subsequent `MATCH` clause without an intermediate `WITH` clause, is valid using Cypher 25 but not link:https://neo4j.com/docs/cypher-manual/current/clauses/with/#combine-write-and-read-clauses[Cypher 5].
139+
140+
141+
.Combine write and read clauses without a separating `WITH` clause
142+
[source, cypher]
143+
----
144+
MATCH (j:Person {name: 'John'})-[:FRIEND]->(f)
145+
SET f.degreesFromJohn = 1
146+
MATCH (f)-[:FRIEND]->(f2)
147+
SET f2.degreesFromJohn = f.degreesFromJohn + 1
148+
RETURN f.name AS friendName,
149+
f.degreesFromJohn AS friendDegree,
150+
f2.name AS friendOfFriendName,
151+
f2.degreesFromJohn AS friendOfFriendDegree
152+
----
153+
136154
.Table of intermediate results and state of the graph between read and write clauses
137155
======
138156
139-
Using the same example graph as above, this example shows the table of intermediate results and the state of the graph after each clause for the following query:
157+
Using the same example graph as above, this example shows the table of intermediate results and the state of the graph after each clause for a query with a read clause before a write clause:
140158
141159
[source,cypher, indent=0]
142160
----
@@ -147,7 +165,7 @@ The query finds all nodes where the `name` property starts with "J"
147165
and for each such node it creates another node with the `name` property set to "Jay-jay".
148166
149167
150-
.+The table of intermediate results and the state of the graph after each clause+
168+
.Read-write: The table of intermediate results and the state of the graph after each clause+
151169
[options="header", width="100%", cols="3a, 4a, 4a"]
152170
|===
153171
@@ -294,6 +312,102 @@ the graph made by the `CREATE`.
294312
295313
======
296314

315+
.Table of intermediate results and state of the graph between write and read clauses
316+
======
317+
On an empty graph, this example shows the table of intermediate results and the state of the graph after each clause for a query with a write clause before a read clause:
318+
319+
[source,cypher, indent=0]
320+
----
321+
UNWIND ["Max", "Lune"] AS dogName
322+
CREATE (n:Dog {name: dogName})
323+
WITH n
324+
MATCH (d:Dog)
325+
RETURN COUNT(*)
326+
----
327+
This query creates two `Dog` nodes and returns the value `4`.
328+
329+
.+Write-read: The table of intermediate results and the state of the graph after each clause+
330+
[options="header", width="100%", cols="3a, 4a, 4a"]
331+
|===
332+
333+
| Clause
334+
| Table of intermediate results after the clause
335+
| State of the graph after the clause, changes in red
336+
337+
| ----
338+
UNWIND ["Max", "Luna"] AS dogName
339+
----
340+
|
341+
[options="header",cols="1m"]
342+
!===
343+
! dogName
344+
! "Max"
345+
! "Luna"
346+
!===
347+
|
348+
349+
| ----
350+
CREATE (n:Dog {name: dogName})
351+
----
352+
|
353+
[options="header",cols="1m, 1m"]
354+
!===
355+
! dogName ! n
356+
! "Max" ! (:Dog {name: 'Max'})
357+
! "Luna" ! (:Dog {name: 'Luna'})
358+
!===
359+
|
360+
361+
[graphviz]
362+
----
363+
digraph L { node [shape=record style=rounded];
364+
N5 [
365+
color = "red"
366+
fontcolor = "red"
367+
label = "{Dog\|name = \'Max\'\l}"
368+
]
369+
N6 [
370+
color = "red"
371+
fontcolor = "red"
372+
label = "{Dog\|name = \'Luna\'\l}"
373+
]
374+
}
375+
----
376+
377+
| ----
378+
MATCH (d:Dog)
379+
----
380+
|
381+
[options="header",cols="1m, 1m, 1m"]
382+
!===
383+
! dogName ! n ! d
384+
! "Max" ! (:Dog {name: 'Max'}) ! (:Dog {name: 'Max'})
385+
! "Max" ! (:Dog {name: 'Max'}) ! (:Dog {name: 'Luna'})
386+
! "Luna" ! (:Dog {name: 'Luna'}) ! (:Dog {name: 'Max'})
387+
! "Luna" ! (:Dog {name: 'Luna'}) ! (:Dog {name: 'Luna'})
388+
!===
389+
|
390+
391+
[graphviz]
392+
----
393+
digraph L { node [shape=record style=rounded];
394+
N5 [
395+
label = "{Dog\|name = \'Max\'\l}"
396+
]
397+
N6 [
398+
label = "{Dog\|name = \'Luna\'\l}"
399+
]
400+
}
401+
----
402+
|===
403+
404+
It is important to note that the `MATCH` clause reads all the `Dog` nodes that are created by the `CREATE` clause.
405+
This is because the `CREATE` clause comes before the `MATCH` clause and thus the `MATCH` observes all changes to
406+
the graph made by the `CREATE`.
407+
The `MATCH` clause is performed for every intermediate result, this leads to finding two nodes for both intermediate results.
408+
409+
======
410+
297411
[[cypher-clause-composition-union-queries]]
298412
== Queries with `UNION`
299413

modules/ROOT/pages/constraints/index.adoc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ include::https://raw.githubusercontent.com/neo4j-graphacademy/courses/main/ascii
55
Neo4j offers several constraints to ensure the quality and integrity of data in a graph.
66
The following constraints are available in Neo4j:
77

8-
* *Property uniqueness constraints* ensure that the combined property values are unique for all nodes with a specific label or all relationships with a specific type.
9-
* *Property existence constraints* ensure that a property exists either for all nodes with a specific label or for all relationships with a specific type. label:enterprise-edition[]
10-
* *Property type constraints* ensure that a property has the required property type for all nodes with a specific label or for all relationships with a specific type. label:new[Introduced in 5.9] label:enterprise-edition[]
11-
* *Key constraints* ensure that all properties exist and that the combined property values are unique for all nodes with a specific label or all relationships with a specific type.label:enterprise-edition[]
8+
* xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[Property uniqueness constraints]: ensure that the combined property values are unique for all nodes with a specific label or all relationships with a specific type.
9+
* xref:constraints/managing-constraints.adoc#create-property-existence-constraints[Property existence constraints]: ensure that a property exists either for all nodes with a specific label or for all relationships with a specific type. label:enterprise-edition[]
10+
* xref:constraints/managing-constraints.adoc#create-property-type-constraints[Property type constraints]: ensure that a property has the required property type for all nodes with a specific label or for all relationships with a specific type. label:new[Introduced in 5.9] label:enterprise-edition[]
11+
* xref:constraints/managing-constraints.adoc#create-key-constraints[Key constraints]: ensure that all properties exist and that the combined property values are unique for all nodes with a specific label or all relationships with a specific type.label:enterprise-edition[]
1212
1313
To learn more about creating, listing, and dropping these constraints, as well as information about index-backed constraints, constraint creation failures and data violation scenarios, and more, see xref:constraints/managing-constraints.adoc[].
1414

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

Lines changed: 82 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[[cypher-deprecations-additions-removals-compatibility]]
2-
= Deprecations, additions, and compatibility
2+
= Additions, deprecations, removals, and compatibility
33
:description: all of the features that have been removed, deprecated, added, or extended in different Cypher versions.
44
:test-skip: true // all deprecations would fail.
55

@@ -10,11 +10,57 @@
1010
// 4. Updated features
1111
// 5. New features
1212

13-
Cypher is a language that is constantly evolving.
13+
14+
Cypher® is a language that is constantly evolving.
1415
New features are added to the language continuously, and occasionally, some features become deprecated and are subsequently removed.
16+
All changes to Cypher are introduced in Neo4j versions.
17+
18+
This section lists all of the features that have been removed, deprecated, added, or extended in different versions of Neo4j. Replacement syntax for deprecated and removed features are also indicated.
19+
20+
[IMPORTANT]
21+
====
22+
Cypher 25 was introduced in Neo4j 2025.06 and can only be used on Neo4j 2025.06+ databases.
23+
From this release onward, no new features will be added to Cypher 5.
24+
Users of Cypher 5 must migrate their queries to Cypher 25 in order to access new features.
25+
For more information, see:
26+
27+
* xref:queries/select-version.adoc[]
28+
* link:https://neo4j.com/docs/cypher-manual/25/introduction/[Cypher 25 Manual]
29+
====
30+
31+
[[cypher-deprecations-additions-removals-2025.06]]
32+
== Neo4j 2025.06
33+
34+
=== Deprecated features
35+
36+
[cols="2", options="header"]
37+
|===
38+
| Feature
39+
| Details
40+
41+
a|
42+
[#_graph_reference_removed_name_parts_quoting]
43+
label:functionality[]
44+
label:deprecated[]
45+
[source,cypher]
46+
----
47+
CYPHER 5 CREATE ALIAS `foo`.`bar` FOR DATABASE ...
48+
----
49+
| Graph references with separately backticked name parts (`++`foo`.`bar`++`) are deprecated.
50+
In future Cypher versions, use parameters or backtick the entire name (`++`foo.bar`++`).
51+
52+
a|
53+
[#_graph_reference_updated_graph_by_name_quotes]
54+
label:functionality[]
55+
label:deprecated[]
56+
[source,cypher]
57+
----
58+
CYPHER 5 USE graph.byName("`a.b`.c") ...
59+
----
60+
| Graph references with separately backticked name parts (`++`a.b`.`c`++`) are deprecated.
61+
In future Cypher versions, remove the backticks (`a.b.c`).
1562

16-
This section lists all of the features that have been removed, deprecated, added, or extended in different Cypher versions.
17-
Replacement syntax for deprecated and removed features are also indicated.
63+
|===
1864

1965
[[cypher-deprecations-additions-removals-2025.04]]
2066
== Neo4j 2025.04
@@ -246,9 +292,16 @@ label:deprecated[]
246292
USE my.db ...
247293
248294
----
249-
| In xref:clauses/use.adoc[`USE`] clauses, databases and aliases with unquoted `.` are deprecated unless the `.` is used to indicate that the database or alias belongs to a composite database.
250-
Names containing `.` should be quoted using backticks.
251-
For example, `USE `my.db`` is valid.
295+
a| The use of unquoted `.` characters in xref:clauses/use.adoc[`USE`] clauses when specifying databases and aliases was deprecated in 5.26, except when `.` indicated that the database or alias belonged to a composite database.
296+
However, this deprecation has been withdrawn in 2025.06, and replaced by two new deprecations in Cypher 5:
297+
298+
* xref::deprecations-additions-removals-compatibility.adoc#_graph_reference_removed_name_parts_quoting[Deprecated support for quoted name parts in graph references]
299+
300+
* xref::deprecations-additions-removals-compatibility.adoc#_graph_reference_updated_graph_by_name_quotes[Deprecation to graph functions]
301+
302+
This is because the previous quoting rules were inconsistent and ambiguous.
303+
The rules have been clarified and improved in Cypher 25.
304+
For more information, see the link:https://neo4j.com/docs/cypher-manual/25/deprecations-additions-removals-compatibility/[Cypher 25 Manual -> Additions, deprecations, removals, and compatibility].
252305
|===
253306

254307

@@ -800,6 +853,19 @@ New operators:
800853
* xref:planning-and-tuning/operators/operators-detail.adoc#query-plan-stateful-shortest-path-into[`StatefulShortestPath(Into)`]
801854

802855
a| Introduced new operators to solve xref:patterns/shortest-paths.adoc[`SHORTEST`] queries.
856+
857+
a|
858+
label:functionality[]
859+
label:new[]
860+
[source, cypher, role="noheader"]
861+
----
862+
CYPHER 5
863+
RETURN 1
864+
----
865+
866+
a|
867+
Introduced the ability to prepend queries with `CYPHER 5`.
868+
This ensures that a query is run using version 5 of Cypher.
803869
|===
804870

805871
[[cypher-deprecations-additions-removals-5.20]]
@@ -2854,12 +2920,16 @@ label:deprecated[]
28542920
CREATE DATABASE databaseName.withDot ...
28552921
----
28562922
a|
2857-
Creating a database with dots in the name has been deprecated, instead quote the database name using backticks:
2923+
Creating a database with dots in the name was deprecated in 5.0.
2924+
However, this deprecation was withdrawn in 2025.06, and replaced by two new deprecations in Cypher 5:
28582925

2859-
[source, cypher, role="noheader"]
2860-
----
2861-
CREATE DATABASE `databaseName.withDot` ...
2862-
----
2926+
* xref::deprecations-additions-removals-compatibility.adoc#_graph_reference_removed_name_parts_quoting[Deprecated support for quoted name parts in graph references]
2927+
2928+
* xref::deprecations-additions-removals-compatibility.adoc#_graph_reference_updated_graph_by_name_quotes[Deprecation to graph functions]
2929+
2930+
This because the previous quoting rules were inconsistent and ambiguous.
2931+
The rules have been clarified and improved in Cypher 25.
2932+
For more information, see the link:https://neo4j.com/docs/cypher-manual/25/deprecations-additions-removals-compatibility/[Cypher 25 Manual -> Additions, deprecations, removals, and compatibility].
28632933

28642934
a|
28652935
[[cypher-5_0-d_4]]

modules/ROOT/pages/indexes/semantic-indexes/vector-indexes.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
:description: Information about creating, querying, and deleting vector indexes with Cypher.
22
:page-role: new-5.13
3-
:test-setup-dump: https://github.com/neo4j-graph-examples/recommendations/raw/main/data/recommendations-embeddings-50.dump
3+
:test-setup-dump: https://github.com/neo4j-graph-examples/recommendations/raw/main/data/recommendations-embeddings-aligned-5.26.dump
44
:l2-norm: image:l2.svg["l2"]-norm
55
include::https://raw.githubusercontent.com/neo4j-graphacademy/courses/main/asciidoc/courses/llm-vectors-unstructured/ad.adoc[]
66

modules/ROOT/pages/queries/index.adoc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
:description: This page is an overview of the queries section in the Cypher Manual.
33

44
This section provides a brief overview of the core concepts of a Cypher query (nodes, relationships, and paths), and examples of how to query a Neo4j graph database.
5-
It also discusses how to compose combined queries using `UNION`.
5+
It also explains how to select the version of Cypher in which queries are run, and how to compose combined queries using `UNION`.
66

77
* xref:queries/concepts.adoc[]
88
* xref:queries/basic.adoc[]
9+
* xref:queries/select-version.adoc[]
910
* xref:queries/combined-queries.adoc[]
1011
1112
[TIP]

0 commit comments

Comments
 (0)