Skip to content

Commit fbd5696

Browse files
Conditional queries (WHEN) (#1175)
This PR also moves Queries/Expressions/*.adoc to a new "Expressions" section. This PR also subsumes #1109 (and therefore makes it redundant)
1 parent 8b902e5 commit fbd5696

27 files changed

+752
-44
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
* xref:queries/index.adoc[]
77
** xref:queries/concepts.adoc[]
88
** xref:queries/basic.adoc[]
9-
** xref:queries/expressions.adoc[]
10-
** xref:queries/case.adoc[]
9+
** xref:queries/composed-queries/index.adoc[]
10+
*** xref:queries/composed-queries/combined-queries.adoc[]
11+
*** xref:queries/composed-queries/conditional-queries.adoc[]
1112
1213
* xref:clauses/index.adoc[]
1314
** xref:clauses/clause-composition.adoc[]
@@ -31,12 +32,15 @@
3132
** xref:clauses/transaction-clauses.adoc#query-listing-transactions[SHOW TRANSACTIONS]
3233
** xref:clauses/skip.adoc[]
3334
** xref:clauses/transaction-clauses.adoc#query-terminate-transactions[TERMINATE TRANSACTIONS]
34-
** xref:clauses/union.adoc[]
3535
** xref:clauses/unwind.adoc[]
3636
** xref:clauses/use.adoc[]
3737
** xref:clauses/where.adoc[]
3838
** xref:clauses/with.adoc[]
3939
40+
* xref:expressions/index.adoc[]
41+
** xref:expressions/expressions-overview.adoc[]
42+
** xref:expressions/conditional-expressions.adoc[]
43+
4044
* xref:subqueries/index.adoc[]
4145
** xref:subqueries/call-subquery.adoc[]
4246
** xref:subqueries/subqueries-in-transactions.adoc[]
Lines changed: 1 addition & 0 deletions
Loading

modules/ROOT/pages/appendix/gql-conformance/index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
:description: Overview of Cypher's conformance to GQL.
22
= GQL conformance
33

4-
*Last updated*: 24 October 2024 +
5-
*Neo4j version*: 5.25
4+
*Last updated*: 21 February 2025 +
5+
*Neo4j version*: 2025.03
66

77
GQL is the new link:https://www.iso.org/home.html[ISO] International Standard query language for graph databases.
88

modules/ROOT/pages/appendix/gql-conformance/supported-mandatory.adoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ The below table is instead listed in order of their appearance in the link:https
2828

2929
Cypher supports the boolean type predicate for `TRUE`, `FALSE`, and `NULL` but does not support the GQL keyword `UNKNOWN`.
3030

31+
| 9.1
32+
| <nested procedure specification>
33+
| xref:queries/composed-queries/combined-queries.adoc#combining-union-and-union-all[Combining `UNION` and `UNION ALL`]
34+
|
35+
3136
| 13.2
3237
| <insert statement>
3338
| xref:clauses/create.adoc#insert-as-synonym-of-create[`INSERT`]
@@ -71,6 +76,11 @@ The only way to guarantee row order in Neo4j is to use xref:clauses/order-by.ado
7176
| GQL defines the option to specify `RETURN ALL` (functionally equivalent to using `RETURN` on its own).
7277
This is currently not available in Cypher.
7378

79+
| 15.4
80+
| <conditional statement>
81+
| xref:queries/composed-queries/conditional-queries.adoc[]
82+
|
83+
7484
| 16.2
7585
| <limit clause>
7686
| xref:clauses/limit.adoc[`LIMIT`]
@@ -148,7 +158,7 @@ This is currently not available in Cypher.
148158

149159
| 20.2
150160
| <value expression primary>
151-
| xref:queries/expressions.adoc[]
161+
| xref:expressions/expressions-overview.adoc[]
152162
|
153163

154164
| 20.3
@@ -159,7 +169,7 @@ In Cypher, current user details can be seen using the link:{neo4j-docs-base-uri}
159169

160170
| 20.7
161171
| <case expression>
162-
| xref:queries/case.adoc[`CASE`], xref:functions/scalar.adoc#functions-nullIf[`nullIf()`], xref:functions/scalar.adoc#functions-coalesce[`coalesce()`]
172+
| xref:expressions/conditional-expressions.adoc[`CASE`], xref:functions/scalar.adoc#functions-nullIf[`nullIf()`], xref:functions/scalar.adoc#functions-coalesce[`coalesce()`]
163173
|
164174

165175
| 20.9

modules/ROOT/pages/appendix/gql-conformance/supported-optional.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ For example, GQL’s graph reference values `CURRENT_GRAPH` and `CURRENT_PROPERT
170170

171171
| GQ03
172172
| Composite query: `UNION`
173-
| xref:clauses/union.adoc[`UNION`]
173+
| xref:queries/composed-queries/combined-queries.adoc[`UNION`]
174174
|
175175

176176
| GQ13

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ the graph made by the `CREATE`.
297297
[[cypher-clause-composition-union-queries]]
298298
== Queries with `UNION`
299299

300-
xref::clauses/union.adoc[`UNION`] queries are slightly different because the results of two or more queries are put together,
300+
xref::queries/composed-queries/combined-queries.adoc[`UNION`] queries are slightly different because the results of two or more queries are put together,
301301
but each query starts with an empty table of intermediate results.
302302

303303
In a query with a `UNION` clause, any clause _before_ the `UNION` cannot observe writes made by a clause _after_ the `UNION`.

modules/ROOT/pages/clauses/index.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,12 @@ Typically used when modifying or importing large amounts of data.
152152
|===
153153
|Clause |Description
154154

155-
m| xref::clauses/union.adoc[UNION]
155+
m| xref::queries/composed-queries/combined-queries.adoc[UNION]
156156
a|
157157
Combines the result of multiple queries into a single result set.
158158
Duplicates are removed.
159159

160-
m| xref::clauses/union.adoc[UNION ALL]
160+
m| xref::queries/composed-queries/combined-queries.adoc[UNION ALL]
161161
a|
162162
Combines the result of multiple queries into a single result set.
163163
Duplicates are retained.

modules/ROOT/pages/clauses/use.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ When connected to a composite database, a graph reference may additionally be pa
2525

2626
* The graph function xref:functions/graph.adoc#functions-graph-byname[`graph.byName()`], which allows the graph reference to be resolved dynamically: `USE graph.byName(<string-expression>)`.
2727

28-
A more detailed description of how and when a graph references needs to be quoted and/or escaped is defined xref::queries/expressions.adoc#graphreferences[here].
28+
A more detailed description of how and when a graph references needs to be quoted and/or escaped is defined xref::expressions/expressions-overview.adoc#graphreferences[here].
2929

3030
== USE clause when connected to a standard or system database
3131

modules/ROOT/pages/clauses/where.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ The `name`, `age`, and `email` values for `Peter` are returned because his email
461461
Note that the regular expression constructs in
462462
link:https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/regex/Pattern.html[Java regular expressions]
463463
are applied only after resolving the escaped character sequences in the given
464-
xref::queries/expressions#expressions-string-literals[string literal].
464+
xref::expressions/expressions-overview.adoc#expressions-string-literals[string literal].
465465
It is sometimes necessary to add additional backslashes to express regular expression
466466
constructs.
467467
This list clarifies the combination of these two definitions, containing the original escape sequence and the resulting character in the regular expression:
@@ -532,7 +532,7 @@ In other words, it must contain at least one xref::patterns/reference.adoc#relat
532532
* Path pattern expressions may not declare new variables.
533533
They can only reference existing variables.
534534

535-
* Path pattern expressions may only be used in positions where a xref:queries/expressions.adoc#boolean[boolean expression] is expected.
535+
* Path pattern expressions may only be used in positions where a xref:expressions/expressions-overview.adoc#boolean[boolean expression] is expected.
536536
The following sections will demonstrate how to use path pattern expressions in a `WHERE` clause.
537537

538538
[[filter-on-patterns]]

0 commit comments

Comments
 (0)