Skip to content

Commit

Permalink
5.x cherry pick to 5.14 (#797)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
3 people authored Nov 24, 2023
1 parent b6d47f1 commit 93a7be9
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 2 deletions.
4 changes: 2 additions & 2 deletions antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
19 changes: 19 additions & 0 deletions modules/ROOT/pages/clauses/delete.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions modules/ROOT/pages/functions/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
81 changes: 81 additions & 0 deletions modules/ROOT/pages/functions/scalar.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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*<m"]
|===
| +nullIf(4, 4)+
| +null+
1+d|Rows: 1
|===
======

.+nullIf()+
======
.Query
[source, cypher, indent=0]
----
RETURN nullIf("abc", "def")
----
The first parameter, "abc", is returned, as the two parameters are not equivalent.
.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| +nullIf("abc", "def")+
| +"abc"+
1+d|Rows: 1
|===
======


[[functions-properties]]
== properties()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ However, not all types can be used in all places.
|===

All Cypher types contain the `null` value. To make them not nullable, `NOT NULL` can be appended to the end of the type (e.g. `BOOLEAN NOT NULL`, `LIST<FLOAT NOT NULL>`).
A shorthand syntax equivalent, introduced in Neo4j 5.14, for `NOT NULL` is to use an exclamation mark `!` (e.g. `INTEGER!`, `LIST<STRING!>`).
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]]
Expand Down

0 comments on commit 93a7be9

Please sign in to comment.