From 93a7be921c42d75f7c14ca5b0f71dff0651845d6 Mon Sep 17 00:00:00 2001 From: Jessica Wright <49636617+AlexicaWright@users.noreply.github.com> Date: Fri, 24 Nov 2023 14:33:02 +0100 Subject: [PATCH] 5.x cherry pick to 5.14 (#797) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Gem Lamont <106068376+gem-neo4j@users.noreply.github.com> Co-authored-by: Jens Pryce-Ã…klundh <112686610+JPryce-Aklundh@users.noreply.github.com> --- antora.yml | 4 +- modules/ROOT/pages/clauses/delete.adoc | 19 +++++ ...ions-additions-removals-compatibility.adoc | 53 ++++++++++++ modules/ROOT/pages/functions/index.adoc | 4 + modules/ROOT/pages/functions/scalar.adoc | 81 +++++++++++++++++++ .../property-structural-constructed.adoc | 1 + 6 files changed, 160 insertions(+), 2 deletions(-) diff --git a/antora.yml b/antora.yml index 497091fec..cf8e5e7df 100644 --- a/antora.yml +++ b/antora.yml @@ -7,5 +7,5 @@ nav: asciidoc: attributes: neo4j-version: '5' - neo4j-version-minor: '5.13' - neo4j-version-exact: '5.13.0' + neo4j-version-minor: '5.14' + neo4j-version-exact: '5.14.0' diff --git a/modules/ROOT/pages/clauses/delete.adoc b/modules/ROOT/pages/clauses/delete.adoc index ff0efc735..4de50eb56 100644 --- a/modules/ROOT/pages/clauses/delete.adoc +++ b/modules/ROOT/pages/clauses/delete.adoc @@ -53,6 +53,25 @@ This query is only possible to run on nodes without any relationships connected Deleted 1 node ---- +[[delete-nodetach]] +=== NODETACH keyword + +_This feature was introduced in Neo4j 5.14._ + +It is also possible to delete the single node using the `NODETACH DELETE` clause. +Using the `NODETACH` keyword explicitly defines that relationships will not be detached and deleted from a node. +The `NODETACH` keyword is a mirror of the already existing keyword xref:clauses/delete.adoc#delete-a-node-with-all-its-relationships[DETACH]. +Including it is functionally the same as using simple `DELETE`. + +.Query +[source, cypher] +---- +MATCH (n:Person {name: 'Tom Hanks'}) +NODETACH DELETE n +---- + +This also deletes the `Person` node `Tom Hanks`. + [[delete-relationships-only]] == Delete relationships only diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index 22e00ca75..192356dfc 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -16,6 +16,59 @@ New features are added to the language continuously, and occasionally, some feat This section lists all of the features that have been removed, deprecated, added, or extended in different Cypher versions. Replacement syntax for deprecated and removed features are also indicated. +[[cypher-deprecations-additions-removals-5.14]] +== Neo4j 5.14 + +=== Updated features + +[cols="2", options="header"] +|=== +| Feature +| Details +a| +label:functionality[] +label:updated[] + +[source, cypher, role="noheader"] +---- +IS :: INTEGER! +---- + +| Extended xref::values-and-types/property-structural-constructed.adoc#types-synonyms[type] syntax to allow an exclamation mark `!` as a synonym for `NOT NULL`. + +|=== + +=== New features + +[cols="2", options="header"] +|=== +| Feature +| Details + +a| +label:functionality[] +label:new[] + +[source, cypher, role=noheader] +---- +RETURN nullIf(v1, v2) +---- + +| Introduction of a xref::functions/scalar.adoc#functions-nullIf[nullIf()] function. +This function returns null if the two given parameters are equivalent, otherwise returns the value of the first parameter. + +a| +label:functionality[] +label:new[] +[source, cypher, role="noheader"] +---- +MATCH (n) NODETACH DELETE n +---- +a| +Added a new keyword xref:clauses/delete.adoc#delete-nodetach[NODETACH], explicitly defining that relationships will not be detached and deleted. +This is a mirror of the already existing keyword `DETACH`. +|=== + [[cypher-deprecations-additions-removals-5.13]] == Neo4j 5.13 diff --git a/modules/ROOT/pages/functions/index.adoc b/modules/ROOT/pages/functions/index.adoc index 5558a3510..2a6880c41 100644 --- a/modules/ROOT/pages/functions/index.adoc +++ b/modules/ROOT/pages/functions/index.adoc @@ -126,6 +126,10 @@ label:new[Introduced in 5.13] | `length(input :: PATH) :: INTEGER` | Returns the length of a `PATH`. +1.1+| xref::functions/scalar.adoc#functions-nullIf[`nullIf()`] +| `nullIf(v1 :: ANY, v2 :: ANY) :: ANY` +| Returns null if the two given parameters are equivalent, otherwise returns the value of the first parameter. + 1.3+| xref::functions/scalar.adoc#functions-properties[`properties()`] | `properties(input :: MAP) :: MAP` | Returns a `MAP` containing all the properties of a `MAP`. diff --git a/modules/ROOT/pages/functions/scalar.adoc b/modules/ROOT/pages/functions/scalar.adoc index f00158120..bc06249f0 100644 --- a/modules/ROOT/pages/functions/scalar.adoc +++ b/modules/ROOT/pages/functions/scalar.adoc @@ -688,6 +688,87 @@ The length of the path `p` is returned. ====== +[[functions-nullIf]] +== nullIf() + +The function `nullIf()` returns null if the two given parameters are equivalent, otherwise returns the value of the first parameter. + +*Syntax:* + +[source, syntax, role="noheader"] +---- +nullIf(v1, v2) +---- + +*Returns:* + +|=== + +| `ANY` + +|=== + +*Arguments:* + +[options="header"] +|=== +| Name | Description + +| `v1` +| An expression that returns `ANY`. + +| `v2` +| An expression that returns `ANY`. + +|=== + +.+nullIf()+ +====== + +.Query +[source, cypher, indent=0] +---- +RETURN nullIf(4, 4) +---- + +The null value is returned as the two parameters are equivalent. + +.Result +[role="queryresult",options="header,footer",cols="1*`). +A shorthand syntax equivalent, introduced in Neo4j 5.14, for `NOT NULL` is to use an exclamation mark `!` (e.g. `INTEGER!`, `LIST`). Note that closed dynamic types (`INNER_TYPE_1 | INNER_TYPE_2...`) cannot be appended with `NOT NULL`: all inner types must be nullable, or all appended with `NOT NULL`. [[type-normalization]]