Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The below table is instead listed in order of their appearance in the link:https
| xref:values-and-types/property-structural-constructed.adoc#property-types[Property types], xref:values-and-types/property-structural-constructed.adoc#type-synonyms[Types and their synonyms].
| Includes: `BOOLEAN` (`BOOL`), `FLOAT`, `INTEGER` (`SIGNED INTEGER`, `INT`), and `STRING` (`VARCHAR`).

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

| 9.1
| <nested procedure specification>
Expand Down Expand Up @@ -138,7 +138,7 @@ This is currently not available in Cypher.

| 19.5
| <null predicate>
| xref:expressions/predicates/type-predicate-expressions.adoc#type-predicate-null[Type predicate expressions for `NULL`]
| xref:expressions/predicates/type-predicate-expressions.adoc#type-predicate-null[Type predicate expressions for `null`]
|

| 19.6
Expand Down Expand Up @@ -170,8 +170,8 @@ In Cypher, current user details can be seen using the link:{neo4j-docs-base-uri}
| 20.9
| <aggregate function>
| xref:functions/aggregating.adoc#functions-avg[`avg()`], xref:functions/aggregating.adoc#functions-count[`count()`], xref:functions/aggregating.adoc#functions-max[`max`], xref:functions/aggregating.adoc#functions-mind[`min()`], xref:functions/aggregating.adoc#functions-sum[`sum()`]
| Cypher and GQL handle `NULL` values differently for the `sum()` function when queries return 0 rows.
For example, `RETURN sum(<expr>)` on an empty table returns `NULL` in GQL, but in Cypher it returns `0`.
| Cypher and GQL handle `null` values differently for the `sum()` function when queries return 0 rows.
For example, `RETURN sum(<expr>)` on an empty table returns `null` in GQL, but in Cypher it returns `0`.

| 20.11
| <property reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ GQL also defines a parameterless version of the function not in Cypher: `CURRENT
|

| GV70
| Immaterial value types: null type support (`NULL`)
| xref:values-and-types/working-with-null.adoc[Working with `NULL`]
| Immaterial value types: null type support (`null`)
| xref:values-and-types/working-with-null.adoc[Working with `null`]
|

| GV71
Expand Down
24 changes: 12 additions & 12 deletions modules/ROOT/pages/clauses/with.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,11 @@ ORDER BY price
|===
| product | price | isAffordable | discountCategory

| "Chocolate" | 5 | TRUE | 'Budget'
| "Coffee" | 10 | TRUE | 'Budget'
| "Headphones" | 250 | TRUE | 'Budget'
| "Phone" | 500 | FALSE | 'High-end'
| "Laptop" | 1000 | FALSE | 'High-end'
| "Chocolate" | 5 | true | 'Budget'
| "Coffee" | 10 | true | 'Budget'
| "Headphones" | 250 | true | 'Budget'
| "Phone" | 500 | false | 'High-end'
| "Laptop" | 1000 | false | 'High-end'

4+d|Rows: 5
|===
Expand Down Expand Up @@ -395,9 +395,9 @@ RETURN c.firstName AS customer,
|===
| customer | totalSpent | topSpender

| "Mateo" | 1015 | TRUE
| "Amir" | 1005 | TRUE
| "Yusuf" | 1005 | TRUE
| "Mateo" | 1015 | true
| "Amir" | 1005 | true
| "Yusuf" | 1005 | true

3+d|Rows: 3
|===
Expand All @@ -423,10 +423,10 @@ RETURN c.firstName AS customer,
|===
| customer | totalSpent | topSpender

| "Leila" | 1000 | FALSE
| "Niko" | 760 | FALSE
| "Hannah" | 260 | FALSE
| "Keisha" | 250 | FALSE
| "Leila" | 1000 | false
| "Niko" | 760 | false
| "Hannah" | 260 | false
| "Keisha" | 250 | false

3+d|Rows: 4
|===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2141,7 +2141,7 @@ Changes to the visibility of databases hosted on offline servers.

For such databases:

* The `address` column will return `NULL`.
* The `address` column will return `null`.
* The `currentStatus` column will return `unknown`.
* The `statusMessage` will return `Server is unavailable`.

Expand Down
16 changes: 8 additions & 8 deletions modules/ROOT/pages/expressions/list-expressions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ RETURN 3 IN nestedList[0] AS elementPresent
|===


Attempting to reference an element outside the bounds of the `LIST` will return `NULL`, as will attempting to access elements from an empty `LIST`.
Attempting to reference an element outside the bounds of the `LIST` will return `null`, as will attempting to access elements from an empty `LIST`.

.Out-of-bounds and empty `LIST` access
[source, cypher]
Expand All @@ -181,7 +181,7 @@ RETURN list[5] AS outOfBound, emptyList[0] AS emptyAccess
|===
| outOfBound | emptyAccess

| NULL | NULL
| null | null

2+d|Rows: 1
|===
Expand Down Expand Up @@ -340,9 +340,9 @@ RETURN cecil.skills || cecilia.skills AS combinedSkills
1+d|Rows: 1
|===

If `NULL` is part of a concatenated `LIST`, `NULL` will be a part of the new `LIST`.
If `null` is part of a concatenated `LIST`, `null` will be a part of the new `LIST`.

.Concatenate `LIST` including `NULL`
.Concatenate `LIST` including `null`
[source, cypher]
----
RETURN [1, 2] || [3, null] AS listWithNull
Expand All @@ -353,12 +353,12 @@ RETURN [1, 2] || [3, null] AS listWithNull
|===
| listWithNull

| [1, 2, 3, NULL]
| [1, 2, 3, null]

1+d|Rows: 1
|===

For removing `NULL` values when concatenating `LIST` values, see xref:expressions/list-expressions.adoc#null-list-concatenation-list-comprehension[`NULL`, list concatenation, and list comprehension].
For removing `null` values when concatenating `LIST` values, see xref:expressions/list-expressions.adoc#null-list-concatenation-list-comprehension[`null`, list concatenation, and list comprehension].

[[add-elements]]
== Add elements to a list
Expand Down Expand Up @@ -562,9 +562,9 @@ RETURN [person IN collect(p) WHERE 'Python' IN person.skills | person.name] AS p
1+d|Rows: 1
|===

List comprehension can be used to remove any unknown `NULL` values when concatenating `LIST` values.
List comprehension can be used to remove any unknown `null` values when concatenating `LIST` values.

.List comprehension to remove `NULL` values during list concatenation
.List comprehension to remove `null` values during list concatenation
// tag::expressions_list_comprehension_concatenation_remove_null[]
[source, cypher]
----
Expand Down
6 changes: 3 additions & 3 deletions modules/ROOT/pages/expressions/map-expressions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ RETURN p[dynamicValue] AS names
1+d|Rows: 2
|===

Referencing a non-existent key in the `MAP` with the `[]` operator will return `NULL`.
Referencing a non-existent key in the `MAP` with the `[]` operator will return `null`.

.Dynamically referencing a non-existent `MAP` key
[source, cypher]
Expand All @@ -243,7 +243,7 @@ RETURN map[dynamicKey] AS dynamicValue
|===
| dynamicValue

| NULL
| null

1+d|Rows: 1
|===
Expand Down Expand Up @@ -271,7 +271,7 @@ mapVariable {mapElement [, ...n]}

[NOTE]
The key names in a map must be of type `STRING`. +
If `mapVariable` is `NULL`, the projection evaluates to `NULL`.
If `mapVariable` is `null`, the projection evaluates to `null`.

.Map projection with a key selector
=====
Expand Down
16 changes: 8 additions & 8 deletions modules/ROOT/pages/expressions/node-relationship-operators.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,16 @@ RETURN p[$propertyName] AS middleName

| "Catherine"
| "David"
| NULL
| null

1+d|Rows: 3
|===

== Handling `NULL` values
== Handling `null` values

If a property (or property value) is missing in an expression that uses tries to access a property statically or dynamically, the whole expression will evaluate to `NULL`.
If a property (or property value) is missing in an expression that uses tries to access a property statically or dynamically, the whole expression will evaluate to `null`.
The query below performs a xref:expressions/string-operators.adoc[string concatentation] on the `firstName`, `middleName`, and `lastName` properties on `Person` nodes.
Note that `NULL` is returned for `Cecilia`, who lacks a `middleName` property.
Note that `null` is returned for `Cecilia`, who lacks a `middleName` property.

.String concatenation using node properties
[source, cypher]
Expand All @@ -158,15 +158,15 @@ RETURN p.firstName || ' ' || p.middleName || ' ' || p.lastName AS fullName

| "Alice Catherine Baxter"
| "Cecil David Ericson"
| NULL
| null

1+d|Rows: 3
|===

The xref:functions/scalar.adoc#functions-coalesce[`coalesce()`] function can be used to skip the first `NULL` values in an expression.
In the below example, it replaces the first `NULL` value found with an empty `STRING`.
The xref:functions/scalar.adoc#functions-coalesce[`coalesce()`] function can be used to skip the first `null` values in an expression.
In the below example, it replaces the first `null` value found with an empty `STRING`.

.Use the `coalesce()` function to skip `NULL` values
.Use the `coalesce()` function to skip `null` values
// tag::expressions_node_relationship_operators_null[]
[source, cypher]
----
Expand Down
18 changes: 9 additions & 9 deletions modules/ROOT/pages/expressions/predicates/boolean-operators.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ Cypher contains the following boolean operators:
[options="header", cols="^,^,^,^,^,^", width="85%"]
|===
|a | b | a `AND` b | a `OR` b | a `XOR` b | `NOT` a
|`FALSE` | `FALSE` | `FALSE` | `FALSE` | `FALSE` | `TRUE`
|`FALSE` | `NULL` | `FALSE` | `NULL` | `NULL` | `TRUE`
|`FALSE` | `TRUE` | `FALSE` | `TRUE` | `TRUE` | `TRUE`
|`TRUE` | `FALSE` | `FALSE` | `TRUE` | `TRUE` | `FALSE`
|`TRUE` | `NULL` | `NULL` | `TRUE` | `NULL` | `FALSE`
|`TRUE` | `TRUE` | `TRUE` | `TRUE` | `FALSE` | `FALSE`
|`NULL` | `FALSE` | `FALSE` | `NULL` | `NULL` | `NULL`
|`NULL` | `NULL` | `NULL` | `NULL` | `NULL` | `NULL`
|`NULL` | `TRUE` | `NULL` | `TRUE` | `NULL` | `NULL`
|`false` | `false` | `false` | `false` | `false` | `true`
|`false` | `null` | `false` | `null` | `null` | `true`
|`false` | `true` | `false` | `true` | `true` | `true`
|`true` | `false` | `false` | `true` | `true` | `false`
|`true` | `null` | `null` | `true` | `null` | `false`
|`true` | `true` | `true` | `true` | `false` | `false`
|`null` | `false` | `false` | `null` | `null` | `null`
|`null` | `null` | `null` | `null` | `null` | `null`
|`null` | `true` | `null` | `true` | `null` | `null`
|===

[[example-graph]]
Expand Down
2 changes: 1 addition & 1 deletion modules/ROOT/pages/expressions/predicates/index.adoc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
= Predicates
:Description: Overview of the predicate expressions in Cypher.

Predicates evaluate to a `BOOLEAN` value (`TRUE`, `FALSE`, or `NULL`), and are frequently used for filtering in xref:clauses/where.adoc[`WHERE`] subclauses.
Predicates evaluate to a `BOOLEAN` value (`true`, `false`, or `null`), and are frequently used for filtering in xref:clauses/where.adoc[`WHERE`] subclauses.

This chapter is divided into the following sections:

Expand Down
38 changes: 19 additions & 19 deletions modules/ROOT/pages/expressions/predicates/list-operators.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Only `Cecilia` is returned because she shares a `role` with `Cecil` (no `Person`
=====

The presence of duplicate values in a `LIST` does not affect the result of the `IN` operator, which checks whether an element appears at least once.
For example, the below query returns `TRUE` (two `Person` nodes are `39` years old).
For example, the below query returns `true` (two `Person` nodes are `39` years old).

.Membership check in a `LIST` with duplicate values
[source, cypher]
Expand All @@ -127,7 +127,7 @@ RETURN 39 IN allAges AS listWithDuplicates
|===
| listWithDuplicates

| TRUE
| true

1+d|Rows: 1
|===
Expand All @@ -136,33 +136,33 @@ RETURN 39 IN allAges AS listWithDuplicates


[[null-behavior]]
== `NULL` behavior
== `null` behavior

When `NULL` is involved in a membership check, the result is will be `NULL`.
When `null` is involved in a membership check, the result is will be `null`.

.Using the `IN` operator with `NULL`
.Using the `IN` operator with `null`
[source, cypher]
----
RETURN NULL IN [1, 2, NULL] AS nullInList, 123 IN NULL AS valueInNull
RETURN null IN [1, 2, null] AS nullInList, 123 IN null AS valueInNull
----

.Result
[role="queryresult",options="header,footer",cols="2*<m"]
|===
| nullInList | valueInNull

| NULL | NULL
| null | null

2+d|Rows: 1
|===

To check if `NULL` is a member of a `LIST`, use the xref:functions/predicate.adoc#functions-any[`any()`] function:
To check if `null` is a member of a `LIST`, use the xref:functions/predicate.adoc#functions-any[`any()`] function:

.Checking if `NULL` is a member of a `LIST`
.Checking if `null` is a member of a `LIST`
// tag::expressions_predicates_list_operators_check_null[]
[source, cypher]
----
RETURN any(x IN [1, 2, NULL] WHERE x IS NULL) AS containsNull
RETURN any(x IN [1, 2, null] WHERE x IS NULL) AS containsNull
----
// end::expressions_predicates_list_operators_check_null[]

Expand All @@ -171,7 +171,7 @@ RETURN any(x IN [1, 2, NULL] WHERE x IS NULL) AS containsNull
|===
| containsNull

| TRUE
| true

1+d|Rows: 1
|===
Expand All @@ -180,7 +180,7 @@ RETURN any(x IN [1, 2, NULL] WHERE x IS NULL) AS containsNull
== Nested lists

When used with nested `LIST` values, the `IN` operator evaluates whether a `LIST` is an exact match to any of the nested `LIST` values that are part of an outer `LIST`.
Partial matches of individual elements within a nested `LIST` will return `FALSE`.
Partial matches of individual elements within a nested `LIST` will return `false`.

.Checking for membership in nested `LIST` values
[source, cypher]
Expand All @@ -193,7 +193,7 @@ RETURN [0, 2] IN [[1, 2], [3, 4]] AS listInNestedList
|===
| listInNestedList

| FALSE
| false

1+d|Rows: 1
|===
Expand All @@ -212,7 +212,7 @@ RETURN [3, 4] IN [[1, 2], [3, 4]] AS listInNestedList
|===
| listInNestedList

| TRUE
| true

1+d|Rows: 1
|===
Expand All @@ -229,7 +229,7 @@ RETURN [1] IN [[1, 2], [3, 4]] AS listInNestedTest
|===
| listInNestedList

| FALSE
| false

1+d|Rows: 1
|===
Expand All @@ -249,14 +249,14 @@ RETURN all(x IN sub WHERE x IN list) AS subInList
----
// end::expressions_predicates_list_operators_list_subset[]

This returns `TRUE` because all elements in `sub` are part of `list`.
This returns `true` because all elements in `sub` are part of `list`.

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| subInList

| TRUE
| true

1+d|Rows: 1
|===
Expand All @@ -268,14 +268,14 @@ WITH [1,3,9] AS sub, [3,5,1,7,6,2,8,4] AS list
RETURN all(x IN sub WHERE x IN list) AS subInList
----

This returns `FALSE` because all elements in `sub` are not part of `list`.
This returns `false` because all elements in `sub` are not part of `list`.

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| subInList

| FALSE
| false

1+d|Rows: 1
|===
Loading