From 83c777deb9bcf52b8e488fc928f93df03dc0f4cd Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Mon, 21 Nov 2022 18:07:39 +0000 Subject: [PATCH 01/32] Update antora.yml --- antora.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/antora.yml b/antora.yml index 120627a40..4d35395cc 100644 --- a/antora.yml +++ b/antora.yml @@ -1,10 +1,11 @@ name: cypher-manual title: Cypher Manual -version: '5.0' +version: '5' start_page: ROOT:index.adoc nav: - modules/ROOT/content-nav.adoc asciidoc: attributes: - neo4j-version: '5.0' - neo4j-version-exact: '5.0.0' + neo4j-version-short: '5' + neo4j-version: '5.3' + neo4j-version-exact: '5.3.0' From 38b90f08f55a5d866c3cd201d7668912988192b2 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Mon, 21 Nov 2022 18:08:25 +0000 Subject: [PATCH 02/32] Update publish.yml --- publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/publish.yml b/publish.yml index c4ada0857..01aafd1d5 100644 --- a/publish.yml +++ b/publish.yml @@ -24,7 +24,7 @@ urls: antora: extensions: - require: "@neo4j-antora/antora-modify-sitemaps" - sitemap_version: '5.0' + sitemap_version: '5' sitemap_loc_version: 'current' move_sitemaps_to_components: true @@ -55,4 +55,4 @@ asciidoc: check-mark: icon:check[] cross-mark: icon:times[] neo4j-base-uri: '' - neo4j-docs-base-uri: /docs \ No newline at end of file + neo4j-docs-base-uri: /docs From a14584a74cf93d019bf7af0bc736df43ecdc229c Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Tue, 22 Nov 2022 09:35:40 +0000 Subject: [PATCH 03/32] Update publish branches --- publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish.yml b/publish.yml index 01aafd1d5..da7a6def3 100644 --- a/publish.yml +++ b/publish.yml @@ -6,7 +6,7 @@ site: content: sources: - url: ./ - branches: ['4.4','dev'] + branches: ['3.5', '4.0', '4.1', '4.2', '4.3', '4.4','dev'] exclude: - '!**/_includes/*' - '!**/readme.adoc' From 4dcae65ac4e5566e94d015dd85be3acc14b36195 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Tue, 22 Nov 2022 09:56:16 +0000 Subject: [PATCH 04/32] Update link to browser manual (#219) --- modules/ROOT/pages/introduction/transactions.adoc | 2 +- preview.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/ROOT/pages/introduction/transactions.adoc b/modules/ROOT/pages/introduction/transactions.adoc index 0f4fb971f..cfd319b47 100644 --- a/modules/ROOT/pages/introduction/transactions.adoc +++ b/modules/ROOT/pages/introduction/transactions.adoc @@ -40,7 +40,7 @@ For examples of the API, or the commands used to start and commit transactions, * For information on using transactions with a Neo4j driver, see _The session API_ in the link:{docs-base-uri}[Neo4j Driver manuals]. * For information on using transactions over the HTTP API, see the link:{neo4j-docs-base-uri}/http-api/{page-version}/actions#http-api-actions[HTTP API documentation -> Using the HTTP API]. * For information on using transactions within the embedded Core API, see the link:{neo4j-docs-base-uri}/java-reference/{page-version}/java-embedded/cypher-java#cypher-java[Java Reference -> Executing Cypher queries from Java]. -* For information on using transactions within the Neo4j Browser or Cypher-shell, see the link:{neo4j-docs-base-uri}/browser-manual/{current-version}/reference-commands/[Neo4j Browser documentation] or the link:{neo4j-docs-base-uri}/operations-manual/{page-version}/tools/cypher-shell/#cypher-shell-commands[Cypher-shell documentation]. +* For information on using transactions within the Neo4j Browser or Cypher-shell, see the link:{neo4j-docs-base-uri}/browser-manual/current/reference-commands/[Neo4j Browser documentation] or the link:{neo4j-docs-base-uri}/operations-manual/{page-version}/tools/cypher-shell/#cypher-shell-commands[Cypher-shell documentation]. When writing procedures or using Neo4j embedded, remember that all iterators returned from an execution result should be either fully exhausted or closed. This ensures that the resources bound to them are properly released. diff --git a/preview.yml b/preview.yml index 36da307be..41c1f9d44 100644 --- a/preview.yml +++ b/preview.yml @@ -24,7 +24,7 @@ urls: antora: extensions: - require: "@neo4j-antora/antora-modify-sitemaps" - sitemap_version: '5.0' + sitemap_version: '5' sitemap_loc_version: 'current' move_sitemaps_to_components: true From 97d220d3d720726808479797b0d6ed9fe19d084a Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Tue, 22 Nov 2022 10:13:47 +0000 Subject: [PATCH 05/32] Fail verification if log contains warnings (#220) --- .github/workflows/docs-pr.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docs-pr.yml b/.github/workflows/docs-pr.yml index 0c44b0159..64cfb0c90 100644 --- a/.github/workflows/docs-pr.yml +++ b/.github/workflows/docs-pr.yml @@ -7,7 +7,8 @@ name: "Verify PR" on: pull_request: branches: - - "4.4" + - "3.5" + - "4.[0-9]" - "5.0" - "5.x" - "dev" @@ -26,3 +27,5 @@ jobs: docs-verify-for-pr: needs: docs-build-for-pr uses: recrwplay/actions-demo/.github/workflows/reusable-docs-verify.yml@main + with: + failOnWarnings: true \ No newline at end of file From 6c12943027c24a2edd5cd386c323065092ab163e Mon Sep 17 00:00:00 2001 From: AlexicaWright <49636617+AlexicaWright@users.noreply.github.com> Date: Tue, 22 Nov 2022 14:12:02 +0100 Subject: [PATCH 06/32] added dryrun to list of additions and a note about 5.2 --- .../ROOT/pages/access-control/manage-servers.adoc | 5 +++++ ...eprecations-additions-removals-compatibility.adoc | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/ROOT/pages/access-control/manage-servers.adoc b/modules/ROOT/pages/access-control/manage-servers.adoc index 1692ba52a..8e8011769 100644 --- a/modules/ROOT/pages/access-control/manage-servers.adoc +++ b/modules/ROOT/pages/access-control/manage-servers.adoc @@ -352,6 +352,11 @@ Using `DRYRUN REALLOCATE DATABASE` returns a view of how the databases would hav | "db3" | "server-1" | "00000000-94ff-4ede-87be-3d741b795480" | "server-5" | "00000003-0df7-4057-81fd-1cf43c9ef5f7" | "primary" |=== +[NOTE] +==== +`DRYRUN` is introduced in Neo4j 5.2 and thus does not work in previous versions. +==== + [[server-management-deallocate]] == Deallocate databases diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index cbfe9834f..9e3460e10 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -1,5 +1,5 @@ [[cypher-deprecations-additions-removals-compatibility]] -= Deprecations, additions and compatibility += Deprecations, additions, and compatibility :description: all of the features that have been removed, deprecated, added, or extended in different Cypher versions. @@ -32,6 +32,16 @@ a| Creating composite databases now allows for an empty options clause. There are no applicable option values for composite databases. +a| +label:functionality[] +label:updated[] +[source, cypher, role="noheader"] +---- +DRYRUN +---- + +a| To preview of the result of a command without executing it, prepend the command with `DRYRUN`. + |=== [[cypher-deprecations-additions-removals-5.1]] From d9e1ff3668014492769d38d13f8fcea05be4898c Mon Sep 17 00:00:00 2001 From: AlexicaWright <49636617+AlexicaWright@users.noreply.github.com> Date: Tue, 22 Nov 2022 14:56:27 +0100 Subject: [PATCH 07/32] Update modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jens Pryce-Ã…klundh <112686610+JPryce-Aklundh@users.noreply.github.com> --- .../pages/deprecations-additions-removals-compatibility.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index 9e3460e10..c8b3897b7 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -40,7 +40,7 @@ label:updated[] DRYRUN ---- -a| To preview of the result of a command without executing it, prepend the command with `DRYRUN`. +a| To preview the result of a command without executing it, prepend the command with `DRYRUN`. |=== From 348cab703cba34c7930b2ad994a4677c8dd4c811 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Tue, 22 Nov 2022 14:26:27 +0000 Subject: [PATCH 08/32] Use short form of version attribute for index page (#221) --- antora.yml | 4 ++-- modules/ROOT/pages/index.adoc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/antora.yml b/antora.yml index 4d35395cc..ac8acc752 100644 --- a/antora.yml +++ b/antora.yml @@ -6,6 +6,6 @@ nav: - modules/ROOT/content-nav.adoc asciidoc: attributes: - neo4j-version-short: '5' - neo4j-version: '5.3' + neo4j-version: '5' + neo4j-version-minor: '5.3' neo4j-version-exact: '5.3.0' diff --git a/modules/ROOT/pages/index.adoc b/modules/ROOT/pages/index.adoc index 0735a5dc9..4db5dac8b 100644 --- a/modules/ROOT/pages/index.adoc +++ b/modules/ROOT/pages/index.adoc @@ -2,7 +2,7 @@ [[cypher-manual]] = The Neo4j Cypher Manual v{neo4j-version} -:neo4j-buildnumber: {neo4j-version} +:neo4j-buildnumber: {neo4j-version-minor} Cypher is Neo4j's graph query language that allows users to store and retrieve data from the graph database. It is a declarative, SQL-inspired language for describing visual patterns in graphs. @@ -11,12 +11,12 @@ The syntax provides a visual and logical way to match patterns of nodes and rela == Documentation updates for Neo4j 5 -Neo4j v5 includes a number of new features and updates. +Neo4j {neo4j-version} includes a number of new features and updates. A highlight of these include: * Cypher syntax improvements with Graph Pattern Matching (relationships and labels): + -** In `MATCH` clauses, `WHERE` can be placed inside a relationship pattern to filter relationships. +** In `MATCH` clauses, `WHERE` can be placed inside a relationship pattern to filter relationships. ** In `MATCH` clauses, nodes and relationships can be filtered using more sophisticated label (type) expressions. ** Simpler alternative syntax to navigate and traverse graphs using the following operators: *** `&`: logical `AND` @@ -30,7 +30,7 @@ For more information, see the xref:syntax/expressions.adoc#label-expressions[sec * New `elementID` for graph objects: + New IDs are introduced to uniquely identify graph elements in Neo4j databases. -Node ID will exist with each release of Neo4j v5. +Node ID will exist with each release of Neo4j {neo4j-version}. + For more information, see xref:functions/scalar.adoc#functions-elementid[`elementId()`]. From 5a6d6bdc92613185b86846dfcf322e45967e7559 Mon Sep 17 00:00:00 2001 From: AlexicaWright <49636617+AlexicaWright@users.noreply.github.com> Date: Tue, 22 Nov 2022 15:42:56 +0100 Subject: [PATCH 09/32] addressed PR comments --- modules/ROOT/pages/access-control/manage-servers.adoc | 3 +-- .../pages/deprecations-additions-removals-compatibility.adoc | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/ROOT/pages/access-control/manage-servers.adoc b/modules/ROOT/pages/access-control/manage-servers.adoc index 8e8011769..8ab5044ef 100644 --- a/modules/ROOT/pages/access-control/manage-servers.adoc +++ b/modules/ROOT/pages/access-control/manage-servers.adoc @@ -354,7 +354,7 @@ Using `DRYRUN REALLOCATE DATABASE` returns a view of how the databases would hav [NOTE] ==== -`DRYRUN` is introduced in Neo4j 5.2 and thus does not work in previous versions. +`DRYRUN` is introduced in Neo4j 5.2, and thus is not available in earlier minor releases ov v5. ==== [[server-management-deallocate]] @@ -375,7 +375,6 @@ Using `DRYRUN DEALLOCATE DATABASES FROM 'server-1', 'server-2'` returns a view o [options="header,footer", width="100%", cols="m,m,m,m,m,m"] |=== |database|fromServerName|fromServerId|toServerName|toServerId|mode - | "db1" | "server-1" | "00000001-8c04-4731-a2fd-7b0289c511ce" | "server-4" | "00000002-5b91-43c1-8b25-5289f674563e" | "primary" | "db1" | "server-2" | "00000000-7e53-427c-a987-24634c4745f3" | "server-5" | "00000003-0e98-44c8-9844-f0a4eb95b0d8" | "primary" |=== diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index 9e3460e10..856b81844 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -37,10 +37,10 @@ label:functionality[] label:updated[] [source, cypher, role="noheader"] ---- -DRYRUN +DRYRUN REALLOCATE\|DEALLOCATE DATABASES FROM ---- -a| To preview of the result of a command without executing it, prepend the command with `DRYRUN`. +a| To preview of the result of either `REALLOCATE` or `DEALLOCATE` without executing, prepend the command with `DRYRUN`. |=== From 881652fd2c3b931dd3c33e3f59cdecf0713a0062 Mon Sep 17 00:00:00 2001 From: David Oliver Date: Tue, 22 Nov 2022 15:44:17 +0000 Subject: [PATCH 10/32] Add deprecation for duplicated variable length relationships in 5.2 (#212) Adds the deprecation from https://github.com/neo4j/neo4j-documentation/pull/1625 --- ...ions-additions-removals-compatibility.adoc | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index 32ecdbde2..91223d161 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -13,6 +13,33 @@ Replacement syntax for deprecated and removed features are also indicated. [[cypher-deprecations-additions-removals-5.2]] == Version 5.2 +=== Deprecated features + +[cols="2", options="header"] +|=== +| Feature +| Details + +a| +label:syntax[] +label:deprecated[] +[source, cypher, role="noheader"] +---- +MATCH ()-[r*]-()-[r*]-() +---- +---- +MATCH p = ()-[r*]-(), q = ()-[r*]-() +---- + +---- +MATCH ()-[r*]-() MATCH ()-[r*]-() +---- +a| + +The use of the same relationship variable for multiple variable length relationships is deprecated. + +|=== + === Updated features [cols="2", options="header"] @@ -73,7 +100,7 @@ CREATE TEXT INDEX ... OPTIONS {indexProvider: `text-2.0`} ---- a| -A new text index provider is available, `text-2.0`. +A new text index provider is available, `text-2.0`. This is also the default provider if none is given. |=== From deb718bfcc6020776e0e63ed014f73bf10ae67ed Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Tue, 22 Nov 2022 17:04:53 +0000 Subject: [PATCH 11/32] Add kroki extension to playbook (#224) --- publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/publish.yml b/publish.yml index da7a6def3..da9776f8f 100644 --- a/publish.yml +++ b/publish.yml @@ -35,6 +35,7 @@ asciidoc: - "@neo4j-antora/antora-add-notes" - "@neo4j-antora/antora-page-roles" - "@neo4j-antora/antora-table-footnotes" + - asciidoctor-kroki attributes: page-theme: docs page-type: Docs From 9c042c0fef9e0fed78d0f5a1cff42d7a6db03dff Mon Sep 17 00:00:00 2001 From: AlexicaWright <49636617+AlexicaWright@users.noreply.github.com> Date: Wed, 23 Nov 2022 08:57:58 +0100 Subject: [PATCH 12/32] changed label to new --- .../pages/deprecations-additions-removals-compatibility.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index 856b81844..b41bab7d5 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -34,7 +34,7 @@ There are no applicable option values for composite databases. a| label:functionality[] -label:updated[] +label:new[] [source, cypher, role="noheader"] ---- DRYRUN REALLOCATE\|DEALLOCATE DATABASES FROM From 4588dab3d3f59927cd56c965c67ed9b01ba2e295 Mon Sep 17 00:00:00 2001 From: Arne Fischereit Date: Thu, 10 Nov 2022 16:00:40 +0100 Subject: [PATCH 13/32] Mark legacy relationship types as deprecated. --- ...recations-additions-removals-compatibility.adoc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index 928eb7b7a..bb24b5b94 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -661,6 +661,20 @@ Creating a database with unescaped dots in the name has been deprecated, instead CREATE DATABASE `databaseName.withDot` ... ---- +a| +label:functionality[] +label:deprecated[] +[source, cypher, role="noheader"] +---- +()-[:A\|:B]->() +---- +a| +Replaced by: +[source, cypher, role="noheader"] +---- +()-[:A\|B]->() +---- + |=== === Updated features From f6d2fd2c70cae08f56984b5d3e03384f4eff8460 Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Wed, 2 Nov 2022 10:59:16 +0100 Subject: [PATCH 14/32] Add note about the behavior of the id function on composite databases --- modules/ROOT/pages/functions/scalar.adoc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/ROOT/pages/functions/scalar.adoc b/modules/ROOT/pages/functions/scalar.adoc index dd957ae9b..a9adec0f4 100644 --- a/modules/ROOT/pages/functions/scalar.adoc +++ b/modules/ROOT/pages/functions/scalar.adoc @@ -372,6 +372,18 @@ Every relationship in a database has an identifier. The identifier for a relationship is guaranteed to be unique among other relationships' identifiers in the same database, within the scope of a single transaction. ==== +[NOTE] +==== +On <> the `id()` function should be used with caution. +It is recommended to use <> instead. + +When called in database-specific subqueries, the resulting id value for a node or relationship is local to that database. +The local id for nodes or relationships from different databases may be the same. + +When called from the root context of a query, the resulting value is an extended id for the node or relationship. +The extended id is likely different from the local id for the same node or relationship. +==== + *Syntax:* [source, syntax, role="noheader"] From 121a5db7baf41ba3abe2ea6ad645e7b5f13cbbef Mon Sep 17 00:00:00 2001 From: Tobias Johansson Date: Wed, 23 Nov 2022 16:37:53 +0100 Subject: [PATCH 15/32] Address review comment --- modules/ROOT/pages/functions/scalar.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/functions/scalar.adoc b/modules/ROOT/pages/functions/scalar.adoc index a9adec0f4..1e26a0db2 100644 --- a/modules/ROOT/pages/functions/scalar.adoc +++ b/modules/ROOT/pages/functions/scalar.adoc @@ -374,7 +374,7 @@ The identifier for a relationship is guaranteed to be unique among other relatio [NOTE] ==== -On <> the `id()` function should be used with caution. +On a <>, the `id()` function should be used with caution. It is recommended to use <> instead. When called in database-specific subqueries, the resulting id value for a node or relationship is local to that database. From d168ac073d1b7a485bba53d6fa987099269ef9f5 Mon Sep 17 00:00:00 2001 From: Gemma Lamont Date: Thu, 17 Nov 2022 15:22:42 +0100 Subject: [PATCH 16/32] Update documentation for Exists and Count subqueries --- .../images/graph_expression_subqueries.svg | 119 ++++++ ...ions-additions-removals-compatibility.adoc | 38 ++ modules/ROOT/pages/syntax/expressions.adoc | 346 ++++++++++++++---- 3 files changed, 425 insertions(+), 78 deletions(-) create mode 100644 modules/ROOT/images/graph_expression_subqueries.svg diff --git a/modules/ROOT/images/graph_expression_subqueries.svg b/modules/ROOT/images/graph_expression_subqueries.svg new file mode 100644 index 000000000..b037298a9 --- /dev/null +++ b/modules/ROOT/images/graph_expression_subqueries.svg @@ -0,0 +1,119 @@ + + + + + + +L + + + +Andy + +Swedish, Person + +age = 36 +name = 'Andy' + + + +DogAndy + +Dog + +name = 'Andy' + + + +Andy->DogAndy + + +  HAS_DOG +since = 2016 + + + +Timothy + +Person + +age = 25 +name = 'Timothy' + + + +Mittens + +Cat + +name = 'Mittens' + + + +Timothy->Mittens + + +  HAS_CAT +since = 2019 + + + +Peter + +Person + +age = 35 +name = 'Peter' + + + +Ozzy + +Dog + +name = 'Ozzy' + + + +Peter->Ozzy + + +  HAS_DOG +since = 2018 + + + +Fido + +Dog + +name = 'Fido' + + + +Peter->Fido + + +  HAS_DOG +since = 2010 + + + +Banana + +Toy + +name = 'Banana' + + + +Fido->Banana + + +  HAS_TOY + + + diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index bb24b5b94..407f5c7fd 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -9,6 +9,44 @@ 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.3]] +== Version 5.3 + +=== Updated features + +[cols="2", options="header"] +|=== +| Feature +| Details + +a| +label:functionality[] +label:updated[] +[source, cypher, role="noheader"] +---- +EXISTS { + ... +} +---- +a| + +An `EXISTS` subquery now supports any non-writing query. For example, it now supports `UNION` and `CALL` clauses. + + +a| +label:functionality[] +label:updated[] +[source, cypher, role="noheader"] +---- +COUNT { + ... +} +---- +a| + +A `COUNT` subquery now supports any non-writing query. For example, it now supports `UNION` and `CALL` clauses. + +|=== [[cypher-deprecations-additions-removals-5.2]] == Version 5.2 diff --git a/modules/ROOT/pages/syntax/expressions.adoc b/modules/ROOT/pages/syntax/expressions.adoc index fbcc73274..56c09f9f0 100644 --- a/modules/ROOT/pages/syntax/expressions.adoc +++ b/modules/ROOT/pages/syntax/expressions.adoc @@ -437,73 +437,32 @@ Variables introduced inside the subquery are not part of the outside scope and t The following graph is used for the examples below: -.Graph -["dot", "Subquery expressions-1.svg", "neoviz", ""] ----- - N0 [ - label = "{Swedish, Person|age = 36\lname = \'Andy\'\l}" - ] - N0 -> N3 [ - color = "#2e3436" - fontcolor = "#2e3436" - label = "HAS_DOG\nsince = 2016\l" - ] - N1 [ - label = "{Person|age = 25\lname = \'Timothy\'\l}" - ] - N2 [ - label = "{Person|age = 35\lname = \'Peter\'\l}" - ] - N2 -> N5 [ - color = "#2e3436" - fontcolor = "#2e3436" - label = "HAS_DOG\nsince = 2018\l" - ] - N2 -> N4 [ - color = "#2e3436" - fontcolor = "#2e3436" - label = "HAS_DOG\nsince = 2010\l" - ] - N3 [ - label = "{Dog|name = \'Andy\'\l}" - ] - N4 [ - label = "{Dog|name = \'Fido\'\l}" - ] - N4 -> N6 [ - color = "#4e9a06" - fontcolor = "#4e9a06" - label = "HAS_TOY\n" - ] - N5 [ - label = "{Dog|name = \'Ozzy\'\l}" - ] - N6 [ - label = "{Toy|name = \'Banana\'\l}" - ] - ----- - +//// +CREATE +(andy:Swedish:Person {name: 'Andy', age: 36}), +(timothy:Person {name: 'Timothy', age: 25}), +(peter:Person {name: 'Peter', age: 35}), +(andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), +(fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), +(fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) +//// + +image:graph_expression_subqueries.svg[] [[existential-subqueries]] === `EXISTS` subqueries -An `EXISTS` subquery can be used to find out if a specified pattern exists at least once in the data. -It serves the same purpose as a <> but is more powerful because it allows you to use `MATCH` and `WHERE` clauses internally. -Moreover, it can appear in any expression position, unlike path patterns. +An `EXISTS` subquery can be used to find out if at least one row is returned by the given query. +It is more powerful than using a path pattern as it allows full queries to be executed. If the subquery evaluates to at least one row, the whole expression will become true. This also means that the system only needs to evaluate if there is at least one row and can skip the rest of the work. +Any non-updating query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted +as any variable defined within the subquery will not be available outside of the expression, even if a final `RETURN` clause is used. -*Syntax:* -[source, cypher, role=noplay] -EXISTS { - MATCH [Pattern] - WHERE [Expression] -} - - -It is worth noting that the `MATCH` keyword can be omitted in such subqueries and that the `WHERE` clause is optional. +It is worth noting that the `MATCH` keyword can be omitted in subqueries in the case where the `EXISTS` consists of only +a Pattern and an optional `WHERE` clause. [[existential-subquery-simple-case]] ==== Simple `EXISTS` subquery @@ -518,7 +477,7 @@ The following example shows this: ---- MATCH (person:Person) WHERE EXISTS { - MATCH (person)-[:HAS_DOG]->(:Dog) + (person)-[:HAS_DOG]->(:Dog) } RETURN person.name AS name ---- @@ -543,13 +502,14 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) ]]>(:Dog) + (person)-[:HAS_DOG]->(:Dog) } RETURN person.name AS name ]]> @@ -593,6 +553,7 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) @@ -648,6 +609,7 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) @@ -702,6 +664,7 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) @@ -714,21 +677,126 @@ RETURN person.name AS name, EXISTS { ++++ endif::nonhtmloutput[] +[[existential-subquery-with-union]] +==== `EXISTS` subquery with a `UNION` +`Exists` can be used with a `UNION` clause, and the `RETURN` clauses are not required. +Here is the result that shows if at least one row is returned from the union of 2 queries. + +.Query +[source, cypher] +---- +MATCH (person:Person) +RETURN + person.name AS name, + EXISTS { + MATCH (person)-[:HAS_DOG]->(:Dog) + UNION + MATCH (person)-[:HAS_CAT]->(:Cat) + } AS hasPet +---- + +.Result +[role="queryresult",options="header,footer",cols="2* +Try this query live +(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), +(fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), +(fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) + +]]>(:Dog) + UNION + MATCH (person)-[:HAS_CAT]->(:Cat) + } AS hasPet +]]> +++++ +endif::nonhtmloutput[] + +[[existential-subquery-with-with]] +==== `EXISTS` subquery with `WITH` +Variables from the outside scope will not go out of scope when using a `WITH`, they are visible for the entirety of the subquery, +this means that shadowing of these variables is also not allowed. +Here is an example where a `WITH` clause introduces a new variable, and the outer scope variable person being referenced is still available after: + +.Query +[source, cypher] +---- +MATCH (person:Person) +WHERE EXISTS { + WITH "Ozzy" AS dogName + MATCH (person)-[:HAS_DOG]->(d:Dog) + WHERE d.name = dogName +} +RETURN person.name AS name +---- + +.Result +[role="queryresult",options="header,footer",cols="1* +Try this query live +(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), +(fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), +(fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) + +]]>(d:Dog) + WHERE d.name = dogName +} +RETURN person.name AS name +]]> +++++ +endif::nonhtmloutput[] + [[count-subqueries]] === `COUNT` subqueries A `COUNT` subquery expression can be used to count the number of results of the subquery. -*Syntax:* -[source, cypher, role=noplay] -COUNT { - MATCH [Pattern] - WHERE [Expression] -} - +Any non-updating query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted +as any variable defined within the subquery will not be available outside of the expression, +even if a final `RETURN` clause is used. One exception to this is that for `DISTINCT UNIONS` the `RETURN` is still mandatory. -It is worth noting that the `MATCH` keyword can be omitted in such subqueries and that the `WHERE` clause is optional. +It is worth noting that the `MATCH` keyword can be omitted in subqueries in the case where the `COUNT` consists of only a Pattern and an optional `WHERE` clause. [[count-subquery-simple-case]] ==== Simple `COUNT` subquery @@ -765,6 +833,7 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) @@ -813,6 +882,7 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) @@ -827,6 +897,122 @@ RETURN person.name AS name ++++ endif::nonhtmloutput[] +[[count-subquery-with-union]] +==== `COUNT` subquery with a `UNION` + +`COUNT` can be used with a `UNION` clause, if the `UNION` clause is distinct, the `RETURN` clause is required. +Here is the result that shows the count of pets each person has by using a `UNION`: + +.Query +[source, cypher] +---- +MATCH (person:Person) +RETURN + person.name AS name, + COUNT { + MATCH (person)-[:HAS_DOG]->(dog:Dog) + RETURN dog.name AS petName + UNION + MATCH (person)-[:HAS_CAT]->(cat:Cat) + RETURN cat.name AS petName + } AS numPets +---- + +.Result +[role="queryresult",options="header,footer",cols="2* +Try this query live +(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), +(fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), +(fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) + +]]>(dog:Dog) + RETURN dog.name AS petName + UNION + MATCH (person)-[:HAS_CAT]->(cat:Cat) + RETURN cat.name AS petName + } AS numPets +]]> +++++ +endif::nonhtmloutput[] + +[[count-subquery-with-with]] +==== `COUNT` subquery with `WITH` + +Variables from the outside scope will not go out of scope when using a `WITH`, +they are visible for the entirety of the subquery, this means that shadowing of these variables is also not allowed. +Here is an example where a `WITH` clause introduces a new variable, +and the outer scope variable person being referenced is still available after: + +.Query +[source, cypher] +---- +MATCH (person:Person) +WHERE COUNT { + WITH "Ozzy" AS dogName + MATCH (person)-[:HAS_DOG]->(d:Dog) + WHERE d.name = dogName +} = 1 +RETURN person.name AS name +---- + +.Result +[role="queryresult",options="header,footer",cols="1* +Try this query live +(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), +(fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), +(fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) + +]]>(d:Dog) + WHERE d.name = dogName +} = 1 +RETURN person.name AS name +]]> +++++ +endif::nonhtmloutput[] + [[count-subqueries-other-clauses]] ==== Using `COUNT` subqueries inside other clauses @@ -842,7 +1028,7 @@ See a few examples below: ---- MATCH (person:Person) RETURN person.name, COUNT { (person)-[:HAS_DOG]->(:Dog) } as howManyDogs - + ---- .Result @@ -866,13 +1052,14 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) ]]>(:Dog) } as howManyDogs - + ]]> ++++ endif::nonhtmloutput[] @@ -887,7 +1074,7 @@ endif::nonhtmloutput[] MATCH (person:Person) WHERE person.name ="Andy" SET person.howManyDogs = COUNT { (person)-[:HAS_DOG]->(:Dog) } RETURN person.howManyDogs as howManyDogs - + ---- .Result @@ -910,6 +1097,7 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) @@ -917,7 +1105,7 @@ CREATE MATCH (person:Person) WHERE person.name ="Andy" SET person.howManyDogs = COUNT { (person)-[:HAS_DOG]->(:Dog) } RETURN person.howManyDogs as howManyDogs - + ]]> ++++ endif::nonhtmloutput[] @@ -935,7 +1123,7 @@ RETURN WHEN COUNT { (person)-[:HAS_DOG]->(:Dog) } > 1 THEN "Doglover " + person.name ELSE person.name END AS result - + ---- .Result @@ -959,6 +1147,7 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) @@ -969,7 +1158,7 @@ RETURN WHEN COUNT { (person)-[:HAS_DOG]->(:Dog) } > 1 THEN "Doglover " + person.name ELSE person.name END AS result - + ]]> ++++ endif::nonhtmloutput[] @@ -988,7 +1177,7 @@ MATCH (person:Person) RETURN COUNT { (person)-[:HAS_DOG]->(:Dog) } AS numDogs, avg(person.age) AS averageAge ORDER BY numDogs - + ---- .Result @@ -1012,6 +1201,7 @@ CREATE (timothy:Person {name: 'Timothy', age: 25}), (peter:Person {name: 'Peter', age: 35}), (andy)-[:HAS_DOG {since: 2016}]->(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), (fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), (fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) @@ -1020,7 +1210,7 @@ MATCH (person:Person) RETURN COUNT { (person)-[:HAS_DOG]->(:Dog) } AS numDogs, avg(person.age) AS averageAge ORDER BY numDogs - + ]]> ++++ endif::nonhtmloutput[] @@ -1685,7 +1875,7 @@ RETURN n:A&B == Relationship type expressions Relationship type expressions evaluate to `true` or `false` when applied to the type of a relationship. - + Assuming no other filters are applied, then a relationship type expression evaluating to `true` means the relationship is matched. [IMPORTANT] From c43af34c8df5756ab4fb998ec9c7590d608e80e0 Mon Sep 17 00:00:00 2001 From: Gemma Lamont Date: Fri, 18 Nov 2022 11:36:17 +0100 Subject: [PATCH 17/32] PR Review updates --- modules/ROOT/pages/syntax/expressions.adoc | 129 +++++++++++++++++++-- modules/ROOT/pages/syntax/index.adoc | 3 + 2 files changed, 122 insertions(+), 10 deletions(-) diff --git a/modules/ROOT/pages/syntax/expressions.adoc b/modules/ROOT/pages/syntax/expressions.adoc index 56c09f9f0..0eebfdd24 100644 --- a/modules/ROOT/pages/syntax/expressions.adoc +++ b/modules/ROOT/pages/syntax/expressions.adoc @@ -454,21 +454,21 @@ image:graph_expression_subqueries.svg[] === `EXISTS` subqueries An `EXISTS` subquery can be used to find out if at least one row is returned by the given query. -It is more powerful than using a path pattern as it allows full queries to be executed. +It is more powerful than using a xref::clauses/where.adoc#filter-on-patterns[path pattern] as it allows full queries to be executed. If the subquery evaluates to at least one row, the whole expression will become true. This also means that the system only needs to evaluate if there is at least one row and can skip the rest of the work. -Any non-updating query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted +Any non-writing query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted as any variable defined within the subquery will not be available outside of the expression, even if a final `RETURN` clause is used. It is worth noting that the `MATCH` keyword can be omitted in subqueries in the case where the `EXISTS` consists of only -a Pattern and an optional `WHERE` clause. +a pattern and an optional `WHERE` clause. [[existential-subquery-simple-case]] ==== Simple `EXISTS` subquery Variables introduced by the outside scope can be used in the `EXISTS` subquery without importing them, -unlike the case for `CALL` subqueries, <>. +unlike the case for `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[where they require importing]. The following example shows this: @@ -679,7 +679,9 @@ endif::nonhtmloutput[] [[existential-subquery-with-union]] ==== `EXISTS` subquery with a `UNION` + `Exists` can be used with a `UNION` clause, and the `RETURN` clauses are not required. +It is worth noting that if one branch has a `RETURN` clause, then all branches require one. Here is the result that shows if at least one row is returned from the union of 2 queries. .Query @@ -735,8 +737,10 @@ endif::nonhtmloutput[] [[existential-subquery-with-with]] ==== `EXISTS` subquery with `WITH` + Variables from the outside scope will not go out of scope when using a `WITH`, they are visible for the entirety of the subquery, this means that shadowing of these variables is also not allowed. +Shadowing of an outside scope variable is when a newly introduced variable inside the inner scope is defined with the same name as one from the outside scope. Here is an example where a `WITH` clause introduces a new variable, and the outer scope variable person being referenced is still available after: .Query @@ -786,23 +790,75 @@ RETURN person.name AS name ++++ endif::nonhtmloutput[] +[[existential-subquery-with-return]] +==== `EXISTS` subquery with `RETURN` + +`EXISTS` subqueries do not require a `RETURN` clause at the end of the subquery, but if one is present, it does not +need to be aliased, a difference from xref::clauses/call-subquery.adoc[`CALL` subqueries]. +Any variables returned in an `EXISTS` subquery will not be available after the subquery. + +.Query +[source, cypher] +---- +MATCH (person:Person) +WHERE EXISTS { + MATCH (person)-[:HAS_DOG]->(:Dog) + RETURN person.name +} +RETURN person.name AS name +---- + +.Result +[role="queryresult",options="header,footer",cols="1* +Try this query live +(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), +(fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), +(fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) + +]]>(:Dog) + RETURN person.name +} +RETURN person.name AS name +]]> +++++ +endif::nonhtmloutput[] + [[count-subqueries]] === `COUNT` subqueries -A `COUNT` subquery expression can be used to count the number of results of the subquery. - +A `COUNT` subquery expression can be used to count the number of rows returned by the subquery. -Any non-updating query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted +Any non-writing query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted as any variable defined within the subquery will not be available outside of the expression, -even if a final `RETURN` clause is used. One exception to this is that for `DISTINCT UNIONS` the `RETURN` is still mandatory. +even if a final `RETURN` clause is used. One exception to this is that for a `DISTINCT UNION` the `RETURN` is still mandatory. -It is worth noting that the `MATCH` keyword can be omitted in subqueries in the case where the `COUNT` consists of only a Pattern and an optional `WHERE` clause. +It is worth noting that the `MATCH` keyword can be omitted in subqueries in the case where the `COUNT` consists of only a pattern and an optional `WHERE` clause. [[count-subquery-simple-case]] ==== Simple `COUNT` subquery Variables introduced by the outside scope can be used in the `COUNT` subquery without importing them, -unlike the case for `CALL` subqueries, <>. +unlike the case for `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[where they require importing]. The following query exemplifies this and outputs the owners of more than one dog: @@ -901,6 +957,7 @@ endif::nonhtmloutput[] ==== `COUNT` subquery with a `UNION` `COUNT` can be used with a `UNION` clause, if the `UNION` clause is distinct, the `RETURN` clause is required. +`UNION ALL` clauses do not require the `RETURN` clause, however, it is worth noting that if one branch has a `RETURN` clause, then all require one. Here is the result that shows the count of pets each person has by using a `UNION`: .Query @@ -963,6 +1020,7 @@ endif::nonhtmloutput[] Variables from the outside scope will not go out of scope when using a `WITH`, they are visible for the entirety of the subquery, this means that shadowing of these variables is also not allowed. +Shadowing of an outside scope variable is when a newly introduced variable inside the inner scope is defined with the same name as one from the outside scope. Here is an example where a `WITH` clause introduces a new variable, and the outer scope variable person being referenced is still available after: @@ -1215,6 +1273,57 @@ RETURN COUNT { (person)-[:HAS_DOG]->(:Dog) } AS numDogs, ++++ endif::nonhtmloutput[] +[[count-subquery-with-return]] +==== `COUNT` subquery with `RETURN` + +`COUNT` subqueries do not require a `RETURN` clause at the end of the subquery, but if one is present, it does not +need to be aliased, a difference from xref::clauses/call-subquery.adoc[`CALL` subqueries]. +Any variables returned in a `COUNT` subquery will not be available after the subquery. + +.Query +[source, cypher] +---- +MATCH (person:Person) +WHERE COUNT { + MATCH (person)-[:HAS_DOG]->(:Dog) + RETURN person.name +} = 1 +RETURN person.name AS name +---- + +.Result +[role="queryresult",options="header,footer",cols="1* +Try this query live +(:Dog {name:'Andy'}), +(timothy)-[:HAS_CAT {since: 2019}]->(:Cat {name:'Mittens'}), +(fido:Dog {name:'Fido'})<-[:HAS_DOG {since: 2010}]-(peter)-[:HAS_DOG {since: 2018}]->(:Dog {name:'Ozzy'}), +(fido)-[:HAS_TOY]->(:Toy{name:'Banana'}) + +]]>(:Dog) + RETURN person.name +} = 1 +RETURN person.name AS name +]]> +++++ +endif::nonhtmloutput[] [[label-expressions]] == Label expressions diff --git a/modules/ROOT/pages/syntax/index.adoc b/modules/ROOT/pages/syntax/index.adoc index 4a6b2dc25..e0a0e5255 100644 --- a/modules/ROOT/pages/syntax/index.adoc +++ b/modules/ROOT/pages/syntax/index.adoc @@ -8,8 +8,11 @@ * xref::syntax/expressions.adoc[Expressions] ** xref::syntax/expressions.adoc#cypher-expressions-general[Expressions in general] ** xref::syntax/expressions.adoc#cypher-expressions-string-literals[Note on string literals] + ** xref::syntax/expressions.adoc#cypher-expressions-number-literals[Note on number literals] ** xref::syntax/expressions.adoc#query-syntax-case[`CASE` Expressions] + ** xref::syntax/expressions.adoc#cypher-subquery-expressions[Subquery expressions] ** xref::syntax/expressions.adoc#label-expressions[Label expressions] + ** xref::syntax/expressions.adoc#relationship-type-expressions[Relationship type expressions] * xref::syntax/variables.adoc[Variables] * xref::syntax/reserved.adoc[Reserved keywords] * xref::syntax/parameters.adoc[Parameters] From 66d5e40e6dd74bed0b50752ecd73aaf4671516ff Mon Sep 17 00:00:00 2001 From: Gemma Lamont Date: Mon, 21 Nov 2022 09:53:12 +0100 Subject: [PATCH 18/32] Add COUNT and EXISTS as submenus in menu --- modules/ROOT/pages/syntax/index.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/ROOT/pages/syntax/index.adoc b/modules/ROOT/pages/syntax/index.adoc index e0a0e5255..19e536fb7 100644 --- a/modules/ROOT/pages/syntax/index.adoc +++ b/modules/ROOT/pages/syntax/index.adoc @@ -11,6 +11,8 @@ ** xref::syntax/expressions.adoc#cypher-expressions-number-literals[Note on number literals] ** xref::syntax/expressions.adoc#query-syntax-case[`CASE` Expressions] ** xref::syntax/expressions.adoc#cypher-subquery-expressions[Subquery expressions] + *** xref::syntax/expressions.adoc#existential-subqueries[`EXISTS` subqueries] + *** xref::syntax/expressions.adoc#count-subqueries[`COUNT` subqueries] ** xref::syntax/expressions.adoc#label-expressions[Label expressions] ** xref::syntax/expressions.adoc#relationship-type-expressions[Relationship type expressions] * xref::syntax/variables.adoc[Variables] From 34fd359c6a29c6b6c92f36fecb94267cc0c01826 Mon Sep 17 00:00:00 2001 From: Gemma Lamont Date: Fri, 25 Nov 2022 10:32:14 +0100 Subject: [PATCH 19/32] PR review updates --- modules/ROOT/pages/syntax/expressions.adoc | 53 +++++++++++----------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/modules/ROOT/pages/syntax/expressions.adoc b/modules/ROOT/pages/syntax/expressions.adoc index 0eebfdd24..5ca7b3329 100644 --- a/modules/ROOT/pages/syntax/expressions.adoc +++ b/modules/ROOT/pages/syntax/expressions.adoc @@ -458,17 +458,17 @@ It is more powerful than using a xref::clauses/where.adoc#filter-on-patterns[pat If the subquery evaluates to at least one row, the whole expression will become true. This also means that the system only needs to evaluate if there is at least one row and can skip the rest of the work. -Any non-writing query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted +Any non-writing query is allowed. `EXISTS` subqueries differ from regular queries in that the final `RETURN` clause may be omitted, as any variable defined within the subquery will not be available outside of the expression, even if a final `RETURN` clause is used. -It is worth noting that the `MATCH` keyword can be omitted in subqueries in the case where the `EXISTS` consists of only +It is worth noting that the `MATCH` keyword can be omitted in subqueries in cases where the `EXISTS` consists of only a pattern and an optional `WHERE` clause. [[existential-subquery-simple-case]] ==== Simple `EXISTS` subquery -Variables introduced by the outside scope can be used in the `EXISTS` subquery without importing them, -unlike the case for `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[where they require importing]. +Variables introduced by the outside scope can be used in the `EXISTS` subquery without importing them. +In this regard, `EXISTS` subqueries are different from `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[which do require importing]. The following example shows this: @@ -682,7 +682,7 @@ endif::nonhtmloutput[] `Exists` can be used with a `UNION` clause, and the `RETURN` clauses are not required. It is worth noting that if one branch has a `RETURN` clause, then all branches require one. -Here is the result that shows if at least one row is returned from the union of 2 queries. +The below example demonstrates that if one of the `UNION` branches was to return at least one row, the entire `EXISTS` expression will evaluate to true. .Query [source, cypher] @@ -738,10 +738,11 @@ endif::nonhtmloutput[] [[existential-subquery-with-with]] ==== `EXISTS` subquery with `WITH` -Variables from the outside scope will not go out of scope when using a `WITH`, they are visible for the entirety of the subquery, -this means that shadowing of these variables is also not allowed. -Shadowing of an outside scope variable is when a newly introduced variable inside the inner scope is defined with the same name as one from the outside scope. -Here is an example where a `WITH` clause introduces a new variable, and the outer scope variable person being referenced is still available after: +Variables from the outside scope are visible for the entire subquery, even when using a `WITH` clause. +This means that shadowing of these variables is not allowed. +An outside scope variable is shadowed when a newly introduced variable within the inner scope is defined with the same variable. +In the below example, a `WITH` clause introduces a new variable. +Note that the outer scope variable `person` referenced in the main query is still available after the `WITH` clause. .Query [source, cypher] @@ -793,8 +794,8 @@ endif::nonhtmloutput[] [[existential-subquery-with-return]] ==== `EXISTS` subquery with `RETURN` -`EXISTS` subqueries do not require a `RETURN` clause at the end of the subquery, but if one is present, it does not -need to be aliased, a difference from xref::clauses/call-subquery.adoc[`CALL` subqueries]. +`EXISTS` subqueries do not require a `RETURN` clause at the end of the subquery. If one is present, it does not +need to be aliased, which is different compared to xref::clauses/call-subquery.adoc[`CALL` subqueries]. Any variables returned in an `EXISTS` subquery will not be available after the subquery. .Query @@ -848,17 +849,17 @@ endif::nonhtmloutput[] A `COUNT` subquery expression can be used to count the number of rows returned by the subquery. -Any non-writing query is allowed, how it differs from regular queries is that the final `RETURN` clause may be omitted +Any non-writing query is allowed. `COUNT` subqueries differ from regular queries in that the final `RETURN` clause may be omitted, as any variable defined within the subquery will not be available outside of the expression, -even if a final `RETURN` clause is used. One exception to this is that for a `DISTINCT UNION` the `RETURN` is still mandatory. +even if a final `RETURN` clause is used. One exception to this is that for a `DISTINCT UNION` clause, the `RETURN` clause is still mandatory. -It is worth noting that the `MATCH` keyword can be omitted in subqueries in the case where the `COUNT` consists of only a pattern and an optional `WHERE` clause. +It is worth noting that the `MATCH` keyword can be omitted in subqueries in cases where the `COUNT` consists of only a pattern and an optional `WHERE` clause. [[count-subquery-simple-case]] ==== Simple `COUNT` subquery -Variables introduced by the outside scope can be used in the `COUNT` subquery without importing them, -unlike the case for `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[where they require importing]. +Variables introduced by the outside scope can be used in the `COUNT` subquery without importing them. +In this regard, `COUNT` subqueries are different from `CALL` subqueries, xref::clauses/call-subquery.adoc#subquery-correlated-importing[which do require importing]. The following query exemplifies this and outputs the owners of more than one dog: @@ -956,9 +957,9 @@ endif::nonhtmloutput[] [[count-subquery-with-union]] ==== `COUNT` subquery with a `UNION` -`COUNT` can be used with a `UNION` clause, if the `UNION` clause is distinct, the `RETURN` clause is required. -`UNION ALL` clauses do not require the `RETURN` clause, however, it is worth noting that if one branch has a `RETURN` clause, then all require one. -Here is the result that shows the count of pets each person has by using a `UNION`: +`COUNT` can be used with a `UNION` clause. If the `UNION` clause is distinct, the `RETURN` clause is required. +`UNION ALL` clauses do not require the `RETURN` clause. However, it is worth noting that if one branch has a `RETURN` clause, then all require one. +The below example shows the count of pets each person has by using a `UNION` clause: .Query [source, cypher] @@ -1018,11 +1019,11 @@ endif::nonhtmloutput[] [[count-subquery-with-with]] ==== `COUNT` subquery with `WITH` -Variables from the outside scope will not go out of scope when using a `WITH`, -they are visible for the entirety of the subquery, this means that shadowing of these variables is also not allowed. -Shadowing of an outside scope variable is when a newly introduced variable inside the inner scope is defined with the same name as one from the outside scope. -Here is an example where a `WITH` clause introduces a new variable, -and the outer scope variable person being referenced is still available after: +Variables from the outside scope are visible for the entire subquery, even when using a `WITH` clause. +This means that shadowing of these variables is not allowed. +An outside scope variable is shadowed when a newly introduced variable within the inner scope is defined with the same variable. +In the below example, a `WITH` clause introduces a new variable. +Note that the outer scope variable `person` referenced in the main query is still available after the `WITH` clause. .Query [source, cypher] @@ -1276,8 +1277,8 @@ endif::nonhtmloutput[] [[count-subquery-with-return]] ==== `COUNT` subquery with `RETURN` -`COUNT` subqueries do not require a `RETURN` clause at the end of the subquery, but if one is present, it does not -need to be aliased, a difference from xref::clauses/call-subquery.adoc[`CALL` subqueries]. +`COUNT` subqueries do not require a `RETURN` clause at the end of the subquery. If one is present, it does not need to be aliased. +This is a difference compared to from xref::clauses/call-subquery.adoc[`CALL` subqueries]. Any variables returned in a `COUNT` subquery will not be available after the subquery. .Query From 2e77a19e7b11f205f12f6c7184280a9b05407dd6 Mon Sep 17 00:00:00 2001 From: David Oliver Date: Wed, 30 Nov 2022 09:46:07 +0000 Subject: [PATCH 20/32] Update explanation for predicate functions when used with null values (#226) Replaces https://github.com/neo4j/neo4j-documentation/pull/1633 @gem-neo4j please could you check that I moved these over into the right place. --- modules/ROOT/pages/functions/predicate.adoc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/ROOT/pages/functions/predicate.adoc b/modules/ROOT/pages/functions/predicate.adoc index 3254355c1..ff8f713d6 100644 --- a/modules/ROOT/pages/functions/predicate.adoc +++ b/modules/ROOT/pages/functions/predicate.adoc @@ -41,7 +41,8 @@ CREATE == all() The function `all()` returns `true` if the predicate holds for all elements in the given list. -`null` is returned if the list is `null` or all of its elements are `null`. + +`null` is returned if the list is `null` or if the predicate evaluates to `null` for at least one element and does not evaluate to `false` for any other element. *Syntax:* @@ -113,7 +114,8 @@ All nodes in the returned paths will have a property `age` with a value larger t == any() The function `any()` returns `true` if the predicate holds for at least one element in the given list. -`null` is returned if the list is `null` or all of its elements are `null`. + +`null` is returned if the list is `null`, or if the predicate evaluates to `null` for at least one element and does not evaluate to `true` for any other element. *Syntax:* @@ -429,7 +431,8 @@ Thus, `isEmpty()` is not suited to test for `null`-values. == none() The function `none()` returns `true` if the predicate does _not_ hold for any element in the given list. -`null` is returned if the list is `null` or all of its elements are `null`. + +`null` is returned if the list is `null`, or if the predicate evaluates to `null` for at least one element and does not evaluate to `true` for any other element. *Syntax:* @@ -499,7 +502,8 @@ No node in the returned paths has a property `age` with the value `25`. == single() The function `single()` returns `true` if the predicate holds for exactly _one_ of the elements in the given list. -`null` is returned if the list is `null` or all of its elements are `null`. + +`null` is returned if the list is `null`, or if the predicate evaluates to `null` for at least one element and `true` for max one element. *Syntax:* @@ -558,4 +562,3 @@ In every returned path there is exactly one node that has a property `eyes` with |=== ====== - From 503949f0db9091234fbd9c10919078d2506285f1 Mon Sep 17 00:00:00 2001 From: lidiazuin <102308961+lidiazuin@users.noreply.github.com> Date: Wed, 30 Nov 2022 14:39:24 +0100 Subject: [PATCH 21/32] Improving description of `access` on SHOW DATABASES (#231) (#236) Original PR: https://github.com/neo4j/docs-cypher/pull/231#pullrequestreview-1199287768 --- modules/ROOT/pages/databases.adoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/ROOT/pages/databases.adoc b/modules/ROOT/pages/databases.adoc index 02920499b..6ccea090b 100644 --- a/modules/ROOT/pages/databases.adoc +++ b/modules/ROOT/pages/databases.adoc @@ -134,6 +134,11 @@ These commands return the following columns: | access | The database access mode, either `read-write` or `read-only`. label:default-output[] +[NOTE] +==== +A database may be described as read-only when using `ALTER DATABASE ... SET ACCESS READ ONLY`. +==== + | databaseID | The database unique ID. From b28ccc7ea3fac2bc9c9cb4e7ff5ec7f6da5a7b3b Mon Sep 17 00:00:00 2001 From: lidiazuin <102308961+lidiazuin@users.noreply.github.com> Date: Wed, 30 Nov 2022 14:44:04 +0100 Subject: [PATCH 22/32] Edition of the Expressions section after review (#235) (#238) Original PR https://github.com/neo4j/docs-cypher/pull/235 --- modules/ROOT/pages/clauses/match.adoc | 1 + modules/ROOT/pages/clauses/where.adoc | 106 +++++++-------- modules/ROOT/pages/syntax/expressions.adoc | 151 +++++++++++---------- modules/ROOT/pages/syntax/patterns.adoc | 2 + 4 files changed, 135 insertions(+), 125 deletions(-) diff --git a/modules/ROOT/pages/clauses/match.adoc b/modules/ROOT/pages/clauses/match.adoc index 9235d9601..5df105c50 100644 --- a/modules/ROOT/pages/clauses/match.adoc +++ b/modules/ROOT/pages/clauses/match.adoc @@ -311,6 +311,7 @@ Returns all actors that `ACTED_IN` *'Wall Street'*. 1+d|Rows: 3 |=== +Read more about xref:/syntax/expressions.adoc#relationship-type-expressions[relationship type expressions]. [[match-on-multiple-rel-types]] === Match on multiple relationship types diff --git a/modules/ROOT/pages/clauses/where.adoc b/modules/ROOT/pages/clauses/where.adoc index 1a062b4d8..5174d8b58 100644 --- a/modules/ROOT/pages/clauses/where.adoc +++ b/modules/ROOT/pages/clauses/where.adoc @@ -10,6 +10,7 @@ * xref::clauses/where.adoc#where-introduction[Introduction] * xref::clauses/where.adoc#query-where-basic[Basic usage] + ** xref::clauses/where.adoc#node-pattern-predicates[Node pattern predicates] ** xref::clauses/where.adoc#boolean-operations[Boolean operations] ** xref::clauses/where.adoc#filter-on-node-label[Filter on node label] ** xref::clauses/where.adoc#filter-on-node-property[Filter on node property] @@ -40,7 +41,6 @@ ** xref::clauses/where.adoc#simple-range[Simple range] ** xref::clauses/where.adoc#composite-range[Composite range] * xref::clauses/where.adoc#pattern-element-predicates[Pattern element predicates] - ** xref::clauses/where.adoc#node-pattern-predicates[Node pattern predicates] ** xref::clauses/where.adoc#relationship-pattern-predicates[Relationship pattern predicates] @@ -84,6 +84,57 @@ CREATE (andy:Swedish:Person {name: 'Andy', age: 36, belt: 'white'}), [[query-where-basic]] == Basic usage +[[node-pattern-predicates]] +=== Node pattern predicates + +`WHERE` can appear inside a node pattern in a `MATCH` clause or a pattern comprehension: + + +.+WHERE+ +====== + +.Query +[source, cypher, indent=0] +---- +WITH 30 AS minAge +MATCH (a:Person WHERE a.name = 'Andy')-[:KNOWS]->(b:Person WHERE b.age > minAge) +RETURN b.name +---- + +.Result +[role="queryresult",options="header,footer",cols="1*(b WHERE b:Person) | b.name] AS friends +---- + +.Result +[role="queryresult",options="header,footer",cols="1*> in order to specify additional constraints. - -[[node-pattern-predicates]] -=== Node pattern predicates - -`WHERE` can appear inside a node pattern in a `MATCH` clause or a pattern comprehension: - - -.+WHERE+ -====== - -.Query -[source, cypher, indent=0] ----- -WITH 30 AS minAge -MATCH (a:Person WHERE a.name = 'Andy')-[:KNOWS]->(b:Person WHERE b.age > minAge) -RETURN b.name ----- - -.Result -[role="queryresult",options="header,footer",cols="1*(b WHERE b:Person) | b.name] AS friends ----- - -.Result -[role="queryresult",options="header,footer",cols="1* Date: Wed, 30 Nov 2022 09:32:08 +0100 Subject: [PATCH 23/32] =?UTF-8?q?Document=20=C2=B4Allow=20both=20plural=20?= =?UTF-8?q?and=20singular=20form=20in=20SHOW=20commands`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `DATABASE` or `DATABASES` in show database commands (excluding show home/default database) - `SERVER` or `SERVERS` in show sever command - `USER` or `USERS` in show users command (excluding show current user) - `ROLE` or `ROLES` in show role command - `WITH USER` or `WITH USERS` in show role command We still only allow singular form for: `SHOW HOME DATABASE` `SHOW DEFAULT DATABASE` `SHOW CURRENT USER` as those shouldn't be able to imply there could be more than one. --- modules/ROOT/pages/access-control/manage-roles.adoc | 5 ++--- modules/ROOT/pages/access-control/manage-servers.adoc | 2 +- modules/ROOT/pages/access-control/manage-users.adoc | 4 ++-- modules/ROOT/pages/databases.adoc | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/ROOT/pages/access-control/manage-roles.adoc b/modules/ROOT/pages/access-control/manage-roles.adoc index ffc006fb3..f303b1305 100644 --- a/modules/ROOT/pages/access-control/manage-roles.adoc +++ b/modules/ROOT/pages/access-control/manage-roles.adoc @@ -27,7 +27,7 @@ m| SHOW ROLES a| [source, syntax, role="noheader"] ---- -SHOW [ALL\|POPULATED] ROLES +SHOW [ALL\|POPULATED] ROLE[S] [YIELD { * \| field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n]] [WHERE expression] [RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]] @@ -63,7 +63,7 @@ m| SHOW ROLES WITH USERS a| [source, syntax, role="noheader"] ---- -SHOW [ALL\|POPULATED] ROLES WITH USERS +SHOW [ALL\|POPULATED] ROLE[S] WITH USER[S] [YIELD { * \| field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n]] [WHERE expression] [RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]] @@ -84,7 +84,6 @@ a| GRANT SHOW ROLE ---- -[source, privilege, role="noheader"] (see xref::access-control/dbms-administration.adoc#access-control-dbms-administration-role-management[DBMS ROLE MANAGEMENT privileges]) diff --git a/modules/ROOT/pages/access-control/manage-servers.adoc b/modules/ROOT/pages/access-control/manage-servers.adoc index fef8dbabc..2942260d5 100644 --- a/modules/ROOT/pages/access-control/manage-servers.adoc +++ b/modules/ROOT/pages/access-control/manage-servers.adoc @@ -153,7 +153,7 @@ m| SHOW SERVERS a| [source, cyper, role=noplay] ---- -SHOW SERVERS +SHOW SERVER[S] [YIELD { * \| field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n]] [WHERE expression] [RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]] diff --git a/modules/ROOT/pages/access-control/manage-users.adoc b/modules/ROOT/pages/access-control/manage-users.adoc index 12d2c9fbc..2005fa7cb 100644 --- a/modules/ROOT/pages/access-control/manage-users.adoc +++ b/modules/ROOT/pages/access-control/manage-users.adoc @@ -55,7 +55,7 @@ m| SHOW USERS a| [source, syntax, role="noheader"] ---- -SHOW USERS +SHOW USER[S] [YIELD { * \| field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n]] [WHERE expression] [RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]] @@ -477,7 +477,7 @@ This example shows how to: [source, cypher, role=noplay] ---- -SHOW USERS YIELD user, suspended, passwordChangeRequired, roles, home +SHOW USER YIELD user, suspended, passwordChangeRequired, roles, home WHERE user = 'jake' ---- ====== diff --git a/modules/ROOT/pages/databases.adoc b/modules/ROOT/pages/databases.adoc index 6ccea090b..4b8be5845 100644 --- a/modules/ROOT/pages/databases.adoc +++ b/modules/ROOT/pages/databases.adoc @@ -24,13 +24,13 @@ The syntax of the database management commands is as follows: | [source, syntax, role="noheader"] ---- -SHOW { DATABASE name \| DATABASES \| DEFAULT DATABASE \| HOME DATABASE } +SHOW { DATABASE[S] name \| DATABASE[S] \| DEFAULT DATABASE \| HOME DATABASE } [WHERE expression] ---- [source, syntax, role="noheader"] ---- -SHOW { DATABASE name \| DATABASES \| DEFAULT DATABASE \| HOME DATABASE } +SHOW { DATABASE[S] name \| DATABASE[S] \| DEFAULT DATABASE \| HOME DATABASE } YIELD { * \| field[, ...] } [ORDER BY field[, ...]] [SKIP n] [LIMIT n] [WHERE expression] [RETURN field[, ...] [ORDER BY field[, ...]] [SKIP n] [LIMIT n]] From 090ad303452c6c4fc49dd17c39552ea1e9ac7a75 Mon Sep 17 00:00:00 2001 From: JPryce-Aklundh Date: Thu, 1 Dec 2022 16:41:19 +0100 Subject: [PATCH 24/32] fix.execution-plan.xref --- modules/ROOT/pages/execution-plans/index.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/execution-plans/index.adoc b/modules/ROOT/pages/execution-plans/index.adoc index 3bd3ae73f..5002f82f9 100644 --- a/modules/ROOT/pages/execution-plans/index.adoc +++ b/modules/ROOT/pages/execution-plans/index.adoc @@ -10,7 +10,7 @@ This section describes the characteristics of query execution plans and provides [NOTE] ==== -For information on replanning, see xref::query-tuning/query-options.adoc#cypher-replanning[Cypher replanning]. +For information on replanning, see xref:query-tuning/query-options.adoc#cypher-replanning[Cypher replanning]. ==== [[execution-plan-introduction]] From 7070e1f5e420ae69571fdebdc948438617b56203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Tue, 6 Dec 2022 16:36:01 +0100 Subject: [PATCH 25/32] Update restrictions when using WITH clause in a CALL subquery (#245) --- modules/ROOT/pages/clauses/call-subquery.adoc | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/modules/ROOT/pages/clauses/call-subquery.adoc b/modules/ROOT/pages/clauses/call-subquery.adoc index 0d7bb5c77..8debd0706 100644 --- a/modules/ROOT/pages/clauses/call-subquery.adoc +++ b/modules/ROOT/pages/clauses/call-subquery.adoc @@ -675,3 +675,48 @@ These are the restrictions on queries that use `+CALL { ... } IN TRANSACTIONS+`: * A `+CALL { ... } IN TRANSACTIONS+` in a `UNION` is not supported. * A `+CALL { ... } IN TRANSACTIONS+` after a write clause is not supported, unless that write clause is inside a `+CALL { ... } IN TRANSACTIONS+`. +Additionally, there are some restrictions that apply when using an importing `WITH` clause in a `CALL` subquery: + +* Only variables imported with the importing `WITH` clause can be used. +* No expressions or aliasing are allowed within the importing `WITH` clause. +* It is not possible to follow an importing `WITH` clause with any of the following clauses: `DISTINCT`, `ORDER BY`, `WHERE`, `SKIP`, and `LIMIT`. + +Attempting any of the above, will throw an error. +For example, the following query using a `WHERE` clause after an importing `WITH` clause will throw an error: + +.Query +[source, cypher, indent=0] +---- +UNWIND [[1,2],[1,2,3,4],[1,2,3,4,5]] AS l +CALL { + WITH l + WHERE size(l) > 2 + RETURN l AS largeLists +} +RETURN largeLists +---- + +.Error message: +[source, output, role="noheader", indent=0] +---- +Importing WITH should consist only of simple references to outside variables. +WHERE is not allowed. +---- + +A solution to this restriction, necessary for any filtering or ordering of an importing `WITH` clause, is to declare a second `WITH` clause after the importing `WITH` clause. +This second `WITH` clause will act as a regular `WITH` clause. +For example, the following query will not throw an error: + +.Query +[source, cypher, indent=0] +---- +UNWIND [[1,2],[1,2,3,4],[1,2,3,4,5]] AS l +CALL { + WITH l + WITH size(l) AS size, l AS l + WHERE size > 2 + RETURN l AS largeLists +} +RETURN largeLists +---- + From ae345d0aa141b69477e01abe92e5d982eb18ffda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louise=20S=C3=B6derstr=C3=B6m?= Date: Thu, 8 Dec 2022 15:12:09 +0100 Subject: [PATCH 26/32] Update docs about round() function. (#230) We follow the behaviour of Java, i.e. rounding towards positive infinity for ties when we have no precision or mode or rounding according to https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/math/RoundingMode.html for rounding modes. The current description was wrong in some cases and missleading in others. Also added more examples. Fixes #https://github.com/neo4j/neo4j/issues/12972 and https://github.com/neo4j/neo4j/issues/12963 --- .../pages/functions/mathematical-numeric.adoc | 274 ++++++++++++++++-- 1 file changed, 251 insertions(+), 23 deletions(-) diff --git a/modules/ROOT/pages/functions/mathematical-numeric.adoc b/modules/ROOT/pages/functions/mathematical-numeric.adoc index adfee7017..728126905 100644 --- a/modules/ROOT/pages/functions/mathematical-numeric.adoc +++ b/modules/ROOT/pages/functions/mathematical-numeric.adoc @@ -342,7 +342,7 @@ A random number is returned. [[functions-round]] == round() -`round()` returns the value of the given number rounded to the nearest integer, with half-way values always rounded up. +`round()` returns the value of the given number rounded to the nearest integer, with ties always rounded towards positive infinity. *Syntax:* @@ -400,11 +400,31 @@ RETURN round(3.141592) ====== +.+round() of negative number with tie+ +====== + +.Query +[source, cypher, indent=0] +---- +RETURN round(-1.5) +---- + +Ties are rounded towards positive infinity, therfore `-1.0` is returned. + +.Result +[role="queryresult",options="header,footer",cols="1*> without precision. *Syntax:* @@ -438,12 +458,12 @@ round(expression, precision) |=== -| `round(null)` returns `null`. +| `round()` returns `null` if any of its input parameters are `null`. |=== -.+round()+ +.+round() with precision+ ====== .Query @@ -466,6 +486,52 @@ RETURN round(3.141592, 3) ====== +.+round() with precision 0 and tie+ +====== + +.Query +[source, cypher, indent=0] +---- +RETURN round(-1.5, 0) +---- + +To align with `round(-1.5)`, `-1.0` is returned. + +.Result +[role="queryresult",options="header,footer",cols="1* Date: Mon, 12 Dec 2022 10:25:56 +0100 Subject: [PATCH 27/32] Fix Runtime version in Query Plan examples (#249) --- .../ROOT/pages/execution-plans/operators.adoc | 448 +++++++++--------- .../shortestpath-planning.adoc | 12 +- modules/ROOT/pages/query-tuning/indexes.adoc | 90 ++-- modules/ROOT/pages/query-tuning/using.adoc | 52 +- 4 files changed, 301 insertions(+), 301 deletions(-) diff --git a/modules/ROOT/pages/execution-plans/operators.adoc b/modules/ROOT/pages/execution-plans/operators.adoc index 1dfcc6344..83b4cbf57 100644 --- a/modules/ROOT/pages/execution-plans/operators.adoc +++ b/modules/ROOT/pages/execution-plans/operators.adoc @@ -35,13 +35,13 @@ RETURN n ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -78,13 +78,13 @@ RETURN r ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -121,13 +121,13 @@ RETURN r ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -165,13 +165,13 @@ RETURN candidate ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -209,13 +209,13 @@ RETURN candidate ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -252,13 +252,13 @@ RETURN r, n1 ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -296,13 +296,13 @@ RETURN r, n1 ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -340,13 +340,13 @@ RETURN r ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -384,13 +384,13 @@ RETURN r ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -428,13 +428,13 @@ RETURN r ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -472,13 +472,13 @@ RETURN r ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -516,13 +516,13 @@ RETURN candidate ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -562,13 +562,13 @@ RETURN candidate ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -607,13 +607,13 @@ RETURN countryOrLocation ---- .Query Plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -640,13 +640,13 @@ MATCH ()-[r]->() RETURN r ---- .Query Plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -674,13 +674,13 @@ MATCH ()-[r]-() RETURN r ---- .Query Plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -715,13 +715,13 @@ RETURN r ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -755,13 +755,13 @@ RETURN r ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -797,13 +797,13 @@ RETURN friendOrFoe ---- .Query Plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -839,13 +839,13 @@ RETURN friendOrFoe ---- .Query Plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -882,13 +882,13 @@ RETURN n ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -924,13 +924,13 @@ RETURN person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -968,13 +968,13 @@ RETURN location ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1014,13 +1014,13 @@ RETURN t ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1064,13 +1064,13 @@ RETURN location, person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1108,13 +1108,13 @@ MERGE (t:Team {name: 'Engineering', id: 42}) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1157,13 +1157,13 @@ RETURN l ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1202,13 +1202,13 @@ RETURN t ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1246,13 +1246,13 @@ RETURN l ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1290,13 +1290,13 @@ RETURN l ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1333,13 +1333,13 @@ RETURN l ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1381,13 +1381,13 @@ RETURN p, q ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1431,13 +1431,13 @@ RETURN p.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-----------------+-------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -1488,13 +1488,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-------------------+--------------------------------------------------------+----------------+------+---------+----------------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Memory (Bytes) | Page Cache Hits/Misses | @@ -1548,13 +1548,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1613,13 +1613,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +--------------------+-----------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -1678,13 +1678,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +--------------------+-----------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -1742,13 +1742,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1801,13 +1801,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1862,13 +1862,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-----------------------+-----------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -1925,13 +1925,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +---------------------------+-----------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -1991,13 +1991,13 @@ ON CREATE SET p.existed = false ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2038,13 +2038,13 @@ MERGE (s)-[:FRIENDS_WITH]->(s) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2092,13 +2092,13 @@ RETURN p.name, [(p)-[:WORKS_IN]->(location) | location.name] AS cities ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-----------------+-----------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -2144,13 +2144,13 @@ MERGE (s)-[:FRIENDS_WITH]->(s) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2199,13 +2199,13 @@ RETURN fof ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2245,13 +2245,13 @@ RETURN fof ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2296,13 +2296,13 @@ RETURN p, l ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2346,13 +2346,13 @@ RETURN p ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2394,13 +2394,13 @@ RETURN p, q ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2442,13 +2442,13 @@ RETURN p ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2496,13 +2496,13 @@ RETURN DISTINCT p, q ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2553,13 +2553,13 @@ RETURN DISTINCT p, q ---- .Query Plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2603,13 +2603,13 @@ MERGE (t:Team {name: 'Engineering', id: 42}) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +---------------------------------+-------------------------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -2653,13 +2653,13 @@ CREATE (:Person) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2698,13 +2698,13 @@ RETURN n ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2741,13 +2741,13 @@ RETURN line ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2803,13 +2803,13 @@ RETURN loc.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2862,13 +2862,13 @@ RETURN p, q ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2919,13 +2919,13 @@ RETURN a.name, b.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -2977,13 +2977,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-------------------+----------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -3036,13 +3036,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3101,13 +3101,13 @@ RETURN other.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3164,13 +3164,13 @@ RETURN p, t ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3216,13 +3216,13 @@ FOREACH (value IN [1,2,3] | CREATE (:Person {age: value})) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-----------------+---------------------------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -3269,13 +3269,13 @@ MERGE () ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 1024 @@ -3337,13 +3337,13 @@ RETURN ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3391,13 +3391,13 @@ RETURN p.name, count(*) AS count ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3438,13 +3438,13 @@ RETURN count(p) AS people ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3483,13 +3483,13 @@ RETURN count(r) AS jobs ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3527,13 +3527,13 @@ RETURN DISTINCT l ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3579,13 +3579,13 @@ RETURN DISTINCT p.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3624,13 +3624,13 @@ RETURN p ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3669,13 +3669,13 @@ LIMIT 3 ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3717,13 +3717,13 @@ SKIP 1 ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3769,13 +3769,13 @@ ORDER BY p.name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3821,13 +3821,13 @@ ORDER BY p.name, p.age ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3870,13 +3870,13 @@ LIMIT 2 ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3923,13 +3923,13 @@ LIMIT 2 ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -3972,13 +3972,13 @@ MATCH (p:Country) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4030,13 +4030,13 @@ RETURN value ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4076,13 +4076,13 @@ LIMIT 3 ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4127,13 +4127,13 @@ RETURN p, q ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4177,13 +4177,13 @@ RETURN u, v ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4226,13 +4226,13 @@ RETURN 'hello' AS greeting ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4271,13 +4271,13 @@ RETURN p ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4316,13 +4316,13 @@ FOREACH (value IN [1,2,3] | MERGE (:Person {age: value})) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-----------------+--------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -4367,13 +4367,13 @@ ORDER BY label ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4415,13 +4415,13 @@ RETURN ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4469,13 +4469,13 @@ CREATE (max)-[:FRIENDS_WITH]->(chris) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4514,13 +4514,13 @@ DELETE w ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4566,13 +4566,13 @@ DETACH DELETE p ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4619,13 +4619,13 @@ SET n:Person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4665,13 +4665,13 @@ REMOVE n:Person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4711,13 +4711,13 @@ SET n = {weekday: 'Monday', meal: 'Lunch'} ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4757,13 +4757,13 @@ SET r = {weight: 5, unit: 'kg'} ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4803,13 +4803,13 @@ SET n.checked = true ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -4850,13 +4850,13 @@ FOR (c:Country) REQUIRE c.name is UNIQUE ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner ADMINISTRATION Runtime SCHEMA -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-------------------+------------------------------------------------------------------+ | Operator | Details | @@ -4891,13 +4891,13 @@ FOR (c:Country) REQUIRE c.name is UNIQUE ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner ADMINISTRATION Runtime SCHEMA -Runtime version 5.0 +Runtime version {neo4j-version-minor} +--------------------------------+------------------------------------------------------------------+ | Operator | Details | @@ -4932,13 +4932,13 @@ FOR (p:Person) REQUIRE p.name IS NOT NULL ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner ADMINISTRATION Runtime SCHEMA -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-------------------+------------------------------------------------------------------+ | Operator | Details | @@ -4972,13 +4972,13 @@ FOR (e:Employee) REQUIRE (e.firstname, e.surname) IS NODE KEY ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner ADMINISTRATION Runtime SCHEMA -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-------------------+-----------------------------------------------------------------------------------+ | Operator | Details | @@ -5011,13 +5011,13 @@ FOR ()-[l:LIKED]-() REQUIRE l.when IS NOT NULL ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner ADMINISTRATION Runtime SCHEMA -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-------------------+-----------------------------------------------------------------------+ | Operator | Details | @@ -5048,13 +5048,13 @@ DROP CONSTRAINT name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner ADMINISTRATION Runtime SCHEMA -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-----------------+-----------------+ | Operator | Details | @@ -5086,13 +5086,13 @@ SHOW CONSTRAINTS ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +------------------+-------------------------------------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -5129,13 +5129,13 @@ FOR (c:Country) ON (c.name) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner ADMINISTRATION Runtime SCHEMA -Runtime version 5.0 +Runtime version {neo4j-version-minor} +--------------+-----------------------------------------------+ | Operator | Details | @@ -5170,13 +5170,13 @@ FOR ()-[k:KNOWS]-() ON (k.since) ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner ADMINISTRATION Runtime SCHEMA -Runtime version 5.0 +Runtime version {neo4j-version-minor} +---------------------------+----------------------------------------------------+ | Operator | Details | @@ -5209,13 +5209,13 @@ DROP INDEX name ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner ADMINISTRATION Runtime SCHEMA -Runtime version 5.0 +Runtime version {neo4j-version-minor} +------------+------------+ | Operator | Details | @@ -5247,13 +5247,13 @@ SHOW INDEXES ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-----------------+-------------------------------------------------------------------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -5289,13 +5289,13 @@ SHOW FUNCTIONS ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-----------------+-----------------------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -5329,13 +5329,13 @@ SHOW PROCEDURES ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-----------------+----------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -5369,13 +5369,13 @@ SHOW TRANSACTIONS ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +-------------------+-----------------------------------------------------------------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | @@ -5409,13 +5409,13 @@ TERMINATE TRANSACTIONS 'database-transaction-123' ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime SLOTTED -Runtime version 5.0 +Runtime version {neo4j-version-minor} +------------------------+--------------------------------------------------------+----------------+------+---------+------------------------+ | Operator | Details | Estimated Rows | Rows | DB Hits | Page Cache Hits/Misses | diff --git a/modules/ROOT/pages/execution-plans/shortestpath-planning.adoc b/modules/ROOT/pages/execution-plans/shortestpath-planning.adoc index 06f075e2a..6ccee84fd 100644 --- a/modules/ROOT/pages/execution-plans/shortestpath-planning.adoc +++ b/modules/ROOT/pages/execution-plans/shortestpath-planning.adoc @@ -74,13 +74,13 @@ RETURN p ---- .Query plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -151,13 +151,13 @@ RETURN p This query, in contrast with the one above, needs to check that the whole path follows the predicate before we know if it is valid or not, and so the query plan will also include the fallback to the slower exhaustive search algorithm. .Query plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 1024 @@ -254,13 +254,13 @@ However, the inclusion of the `WITH` clause means that the query plan will not i Instead, any paths found by the fast algorithm will subsequently be filtered, which may result in no answers being returned. .Query plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 diff --git a/modules/ROOT/pages/query-tuning/indexes.adoc b/modules/ROOT/pages/query-tuning/indexes.adoc index d346ba864..85ad880be 100644 --- a/modules/ROOT/pages/query-tuning/indexes.adoc +++ b/modules/ROOT/pages/query-tuning/indexes.adoc @@ -309,13 +309,13 @@ RETURN person ---- .Query Plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -349,13 +349,13 @@ RETURN r ---- .Query Plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -389,13 +389,13 @@ RETURN person ---- .Query Plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -429,13 +429,13 @@ RETURN person, friend ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -464,13 +464,13 @@ RETURN person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -500,13 +500,13 @@ RETURN person, friend ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -537,13 +537,13 @@ RETURN person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -569,7 +569,7 @@ For example, if indexes exist on both `:Label(p1)` and `:Label(p2)`, `MATCH (n:L .Query -[source, cypher, indent=0] +[source, query plan, subs="attributes+", role="noheader"] ---- MATCH (person:Person) WHERE person.firstname = 'Andy' @@ -577,13 +577,13 @@ RETURN person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -654,13 +654,13 @@ RETURN friend, person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -693,13 +693,13 @@ RETURN r.since ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -735,13 +735,13 @@ RETURN person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -781,13 +781,13 @@ RETURN person .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -819,13 +819,13 @@ RETURN person, friend ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -856,13 +856,13 @@ RETURN person, friend ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -894,13 +894,13 @@ RETURN person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -934,13 +934,13 @@ RETURN person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1016,13 +1016,13 @@ RETURN person, friend ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1093,13 +1093,13 @@ RETURN person ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1133,13 +1133,13 @@ RETURN person, friend ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1171,13 +1171,13 @@ RETURN p ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1213,13 +1213,13 @@ RETURN r.lastMetPoint ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -1256,13 +1256,13 @@ RETURN person.firstname ---- .Query Plan -[source, query plan, role="noheader"] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 diff --git a/modules/ROOT/pages/query-tuning/using.adoc b/modules/ROOT/pages/query-tuning/using.adoc index ad72da885..579d28580 100644 --- a/modules/ROOT/pages/query-tuning/using.adoc +++ b/modules/ROOT/pages/query-tuning/using.adoc @@ -66,13 +66,13 @@ The query above will be used in some of the examples on this page. Without any hints, one index and no join is used. .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -186,13 +186,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -258,13 +258,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -318,13 +318,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -388,13 +388,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -451,13 +451,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -527,13 +527,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -604,13 +604,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -680,13 +680,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -752,13 +752,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -829,13 +829,13 @@ RETURN * ---- .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -907,13 +907,13 @@ RETURN * Without any hint, the planner did not use a join to solve the `OPTIONAL MATCH`. .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 @@ -963,13 +963,13 @@ RETURN * Now the planner uses a join to solve the `OPTIONAL MATCH`. .Query plan -[source] +[source, query plan, subs="attributes+", role="noheader"] ---- Planner COST Runtime PIPELINED -Runtime version 5.0 +Runtime version {neo4j-version-minor} Batch size 128 From fd715a24774a3e2e456903c9b4e2aace5e69c0a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20Pryce-=C3=85klundh?= <112686610+JPryce-Aklundh@users.noreply.github.com> Date: Tue, 13 Dec 2022 11:46:51 +0100 Subject: [PATCH 28/32] Remove old note about variable length pattern matching in versions 2.x (#255) Currently only removing note, pending restructuring of the page on patterns in collaboration with the Langstar team (set for q1 of 2023). --- modules/ROOT/pages/syntax/patterns.adoc | 9 --------- 1 file changed, 9 deletions(-) diff --git a/modules/ROOT/pages/syntax/patterns.adoc b/modules/ROOT/pages/syntax/patterns.adoc index 378d470fd..572759cf8 100644 --- a/modules/ROOT/pages/syntax/patterns.adoc +++ b/modules/ROOT/pages/syntax/patterns.adoc @@ -202,15 +202,6 @@ You can specify additional constraints by introducing a xref::clauses/where.adoc [[cypher-pattern-varlength]] == Variable-length pattern matching -[CAUTION] -==== -Variable length pattern matching in versions 2.1.x and earlier does not enforce relationship uniqueness for patterns described within a single `MATCH` clause. -This means that a query such as the following: `MATCH (a)-[r]\->(b), p = (a)-[\*]\->(c) RETURN *, relationships(p) AS rs` may include `r` as part of the `rs` set. -This behavior has changed in versions 2.2.0 and later, in such a way that `r` will be excluded from the result set, as this better adheres to the rules of relationship uniqueness as documented here xref::introduction/uniqueness.adoc[]. -If you have a query pattern that needs to retrace relationships rather than ignoring them as the relationship uniqueness rules normally dictate, you can accomplish this using multiple match clauses, as follows: `MATCH (a)-[r]\->(b) MATCH p = (a)-[*]\->(c) RETURN *, relationships(p)`. -This will work in all versions of Neo4j that support the `MATCH` clause, namely 2.0.0 and later. -==== - Rather than describing a long path using a sequence of many node and relationship descriptions in a pattern, many relationships (and the intermediate nodes) can be described by specifying a length in the relationship description of a pattern. For example: From d9ff885df3044b3d93734d49e4b329e3fbc7e008 Mon Sep 17 00:00:00 2001 From: Jack Waudby <33488812+jackwaudby@users.noreply.github.com> Date: Wed, 14 Dec 2022 13:11:56 +0000 Subject: [PATCH 29/32] Add documentation on updated `SHOW DATABASES` behaviour (#246) In 5.3 the behaviour `SHOW DATABASES` was changed to now additionally display databases hosted on offline servers. This PR updates the documentation to reflect this. --- modules/ROOT/pages/databases.adoc | 5 +++++ ...cations-additions-removals-compatibility.adoc | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/modules/ROOT/pages/databases.adoc b/modules/ROOT/pages/databases.adoc index 4b8be5845..f46d26bd6 100644 --- a/modules/ROOT/pages/databases.adoc +++ b/modules/ROOT/pages/databases.adoc @@ -258,6 +258,11 @@ However, some privileges enable users to see additional databases regardless of If a user has not been granted `ACCESS` privilege to any databases nor any of the above special cases, the command can still be executed but will only return the `system` database, which is always visible. ==== +[NOTE] +==== +Databases hosted on servers that are offline are also returned by the `SHOW DATABASES` command. +For such databases, the `address` column displays `NULL`, the `currentStatus` column displays `unknown`, and the `statusMessage` displays `Server is unavailable`. +==== ====== diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index 407f5c7fd..649634b25 100644 --- a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc +++ b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc @@ -19,6 +19,22 @@ Replacement syntax for deprecated and removed features are also indicated. | Feature | Details +a| +label:functionality[] +label:updated[] +[source, cypher, role="noheader"] +---- +SHOW DATABASES +---- +a| +Changes to the visibility of databases hosted on offline servers. + +For such databases: + +* The `address` column will return `NULL`. +* The `currentStatus` column will return `unknown`. +* The `statusMessage` will return `Server is unavailable`. + a| label:functionality[] label:updated[] From c1f64e5eb69e1788b1a32dfd6ba0f708b74f3799 Mon Sep 17 00:00:00 2001 From: Satia Herfert Date: Tue, 13 Dec 2022 09:42:41 +0100 Subject: [PATCH 30/32] Clarify that the order of UNION branches matter if there are updates. --- modules/ROOT/pages/clauses/union.adoc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/ROOT/pages/clauses/union.adoc b/modules/ROOT/pages/clauses/union.adoc index 7bb7fc475..44eb23a49 100644 --- a/modules/ROOT/pages/clauses/union.adoc +++ b/modules/ROOT/pages/clauses/union.adoc @@ -15,6 +15,16 @@ The number and the names of the columns must be identical in all queries combine To keep all the result rows, use `UNION ALL`. Using just `UNION` will combine and remove duplicates from the result set. +[NOTE] +==== +If any of the queries in a UNION contain updates, the order if queries in the UNION is relevant. + +Any clause before the UNION cannot observe writes made by a clause after the UNION. +Any clause after UNION can observe all writes made by a clause before the UNION. + +For details see xref::introduction/clause_composition.adoc#cypher-clause-composition-union-queries[clause composition in queries with `UNION`] for details. +==== + image:graph_union_clause.svg[] //// From b85523e29b3f8bddfc62cb276256e4eab5a47921 Mon Sep 17 00:00:00 2001 From: Satia Herfert Date: Wed, 14 Dec 2022 13:48:06 +0100 Subject: [PATCH 31/32] typo Co-authored-by: Gustav Hedengran --- modules/ROOT/pages/clauses/union.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ROOT/pages/clauses/union.adoc b/modules/ROOT/pages/clauses/union.adoc index 44eb23a49..25221e6aa 100644 --- a/modules/ROOT/pages/clauses/union.adoc +++ b/modules/ROOT/pages/clauses/union.adoc @@ -17,7 +17,7 @@ Using just `UNION` will combine and remove duplicates from the result set. [NOTE] ==== -If any of the queries in a UNION contain updates, the order if queries in the UNION is relevant. +If any of the queries in a UNION contain updates, the order of queries in the UNION is relevant. Any clause before the UNION cannot observe writes made by a clause after the UNION. Any clause after UNION can observe all writes made by a clause before the UNION. From 3023b06048c88d0c1fd3c2afa0b7fb392e37049c Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Thu, 15 Dec 2022 15:58:55 +0000 Subject: [PATCH 32/32] publish branches --- publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publish.yml b/publish.yml index da9776f8f..5bdd9e60f 100644 --- a/publish.yml +++ b/publish.yml @@ -6,7 +6,7 @@ site: content: sources: - url: ./ - branches: ['3.5', '4.0', '4.1', '4.2', '4.3', '4.4','dev'] + branches: ['3.5', '4.0', '4.1', '4.2', '4.3', '4.4', '5.x'] exclude: - '!**/_includes/*' - '!**/readme.adoc'