Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions modules/ROOT/pages/clauses/clause-composition.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,6 @@ The most important aspect of read-write queries is that the state of the graph a
A clause can never observe writes made by a later clause, and will observe all writes done by the previous clauses.
====

As of Cypher 25, read and write clauses can be combined in any order.
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.
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].


.Combine write and read clauses without a separating `WITH` clause
[source, cypher]
----
MATCH (j:Person {name: 'John'})-[:FRIEND]->(f)
SET f.degreesFromJohn = 1
MATCH (f)-[:FRIEND]->(f2)
SET f2.degreesFromJohn = f.degreesFromJohn + 1
RETURN f.name AS friendName,
f.degreesFromJohn AS friendDegree,
f2.name AS friendOfFriendName,
f2.degreesFromJohn AS friendOfFriendDegree
----

.Table of intermediate results and state of the graph between read and write clauses
======

Expand Down