diff --git a/.github/workflows/docs-pr-checks.yml b/.github/workflows/docs-pr-checks.yml index 0776f03d1..a3cd44cc8 100644 --- a/.github/workflows/docs-pr-checks.yml +++ b/.github/workflows/docs-pr-checks.yml @@ -6,10 +6,7 @@ on: branches: - "dev" - "cypher-25" - - "5.x" - - "4.[0-9]" - - "3.5" - + - "cypher-5" jobs: diff --git a/.github/workflows/docs-teardown.yml b/.github/workflows/docs-teardown.yml index 3434992ef..936c829a3 100644 --- a/.github/workflows/docs-teardown.yml +++ b/.github/workflows/docs-teardown.yml @@ -6,9 +6,8 @@ on: branches: - "dev" - "cypher-25" - - "5.x" - - "4.[0-9]" - - "3.5" + - "cypher-5" + types: - closed diff --git a/antora.yml b/antora.yml index c0f178920..63677c6f2 100644 --- a/antora.yml +++ b/antora.yml @@ -1,6 +1,7 @@ name: cypher-manual title: Cypher Manual version: '25' +prerelease: true start_page: ROOT:introduction/index.adoc nav: - modules/ROOT/content-nav.adoc diff --git a/modules/ROOT/content-nav.adoc b/modules/ROOT/content-nav.adoc index 61edc54f4..c58e92758 100644 --- a/modules/ROOT/content-nav.adoc +++ b/modules/ROOT/content-nav.adoc @@ -6,6 +6,7 @@ * xref:queries/index.adoc[] ** xref:queries/concepts.adoc[] ** xref:queries/basic.adoc[] +** xref:queries/select-version.adoc[] ** xref:queries/composed-queries/index.adoc[] *** xref:queries/composed-queries/combined-queries.adoc[] *** xref:queries/composed-queries/conditional-queries.adoc[] diff --git a/modules/ROOT/images/conditional-query-graph.svg b/modules/ROOT/images/conditional-query-graph.svg new file mode 100644 index 000000000..ad6012dc5 --- /dev/null +++ b/modules/ROOT/images/conditional-query-graph.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/ROOT/images/conditional_query_graph.svg b/modules/ROOT/images/conditional_query_graph.svg deleted file mode 100644 index 4e3d7b1a0..000000000 --- a/modules/ROOT/images/conditional_query_graph.svg +++ /dev/null @@ -1 +0,0 @@ -WORKS_FORWORKS_FORWORKS_FORLOVESLOVESPersonname:'Alice'age:65Personname:'Bob'age:25Personname:'Charlie'age:61Personname:'Daniel'age:39Personname:'Eskil'age:39 \ No newline at end of file diff --git a/modules/ROOT/images/repeatable-elements-graph.svg b/modules/ROOT/images/repeatable-elements-graph.svg index f85e06d7f..f3f02d4fb 100644 --- a/modules/ROOT/images/repeatable-elements-graph.svg +++ b/modules/ROOT/images/repeatable-elements-graph.svg @@ -1,48 +1,44 @@ - - + + + + - - - - + - - + + - - - - + + - - - - + + + + - - + @@ -50,16 +46,15 @@ - - - - - - - + + + + + + + - - + @@ -67,17 +62,16 @@ - - - + + + - - - - + + + + - - + @@ -85,14 +79,13 @@ - - - - + + + + - - - + + @@ -100,17 +93,15 @@ - - - + + - - - + + - + - + @@ -119,17 +110,15 @@ - - - - - + + + - + - + - + @@ -139,10 +128,10 @@ - + - + @@ -152,7 +141,16 @@ - + + + + + + + + + + @@ -172,10 +170,16 @@ - - + + + + + + + + diff --git a/modules/ROOT/pages/appendix/gql-conformance/index.adoc b/modules/ROOT/pages/appendix/gql-conformance/index.adoc index b269905ad..718d85745 100644 --- a/modules/ROOT/pages/appendix/gql-conformance/index.adoc +++ b/modules/ROOT/pages/appendix/gql-conformance/index.adoc @@ -1,7 +1,7 @@ :description: Overview of Cypher's conformance to GQL. = GQL conformance -*Last updated*: 2 June 2025 + +*Last updated*: 18 June 2025 + *Neo4j version*: 2025.06 GQL is the new link:https://www.iso.org/home.html[ISO] International Standard query language for graph databases. diff --git a/modules/ROOT/pages/appendix/gql-conformance/supported-mandatory.adoc b/modules/ROOT/pages/appendix/gql-conformance/supported-mandatory.adoc index 12bfb44a1..f76c5ca04 100644 --- a/modules/ROOT/pages/appendix/gql-conformance/supported-mandatory.adoc +++ b/modules/ROOT/pages/appendix/gql-conformance/supported-mandatory.adoc @@ -211,10 +211,8 @@ In Cypher, `trim()` removes any whitespace character. | 21.1 | Names and variables | xref:syntax/index.adoc[] -| Cypher supports GQL’s lexical elements, with the following caveats: +| Cypher supports GQL’s lexical elements, with the following caveat: -* GQL allows for extended parameter identifiers. -For example: `RETURN $0hello` is allowed in GQL but not Cypher. * GQL allows identifiers that are not variables to be delimited with both backticks and quotes. Cypher only allows backticks. For example: `MATCH (n) RETURN n."a prop"` is allowed in GQL but not Cypher. diff --git a/modules/ROOT/pages/appendix/gql-conformance/supported-optional.adoc b/modules/ROOT/pages/appendix/gql-conformance/supported-optional.adoc index 7d915ee08..df7568d2f 100644 --- a/modules/ROOT/pages/appendix/gql-conformance/supported-optional.adoc +++ b/modules/ROOT/pages/appendix/gql-conformance/supported-optional.adoc @@ -106,11 +106,11 @@ These codes order the features in the table below. | GD01 | Updatable graphs -| xref:clauses/clause-composition.adoc#writing-clauses[Cypher clauses -> Writing clauses] +| xref:clauses/index.adoc#writing-clauses[Cypher clauses -> Writing clauses] | * Feature GD01 implies compliance with GQL feature GT01, "Explicit transaction commands", which states that conforming languages shall contain the following transaction control commands: `START TRANSACTION`, `ROLLBACK`, and `COMMIT`. These are not present in Cypher. However, Neo4j offers transaction management through the link:{neo4j-docs-base-uri}/create-applications[driver] transaction API. -Cypher Shell also offers specific link:{neo4j-docs-base-uri}/operations-manual/current/tools/cypher-shell/#cypher-shell-commands[commands] to manage transactions. +Cypher Shell also offers specific link:{neo4j-docs-base-uri}/operations-manual/current/cypher-shell/#cypher-shell-commands[commands] to manage transactions. * Feature GD01 implies conformance to GQL's `` (subclause 13.3). GQL’s `SET` has no order dependencies because all right-hand side operations are completed before any assignments occur. However, In Cypher’s `SET`, the order of rows can affect the outcome because changes made during execution may depend on the sequence of assignments. diff --git a/modules/ROOT/pages/appendix/gql-conformance/unsupported-mandatory.adoc b/modules/ROOT/pages/appendix/gql-conformance/unsupported-mandatory.adoc index 55cc050bf..4cf67734b 100644 --- a/modules/ROOT/pages/appendix/gql-conformance/unsupported-mandatory.adoc +++ b/modules/ROOT/pages/appendix/gql-conformance/unsupported-mandatory.adoc @@ -24,7 +24,7 @@ Neo4j offers session management through the link:{neo4j-docs-base-uri}/create-ap | GQL defines the following transaction commands: `START TRANSACTION`, `COMMIT`, and `ROLLBACK`. Neo4j offers transaction management through the link:{neo4j-docs-base-uri}/create-applications[driver] transaction API. -Cypher Shell also offers specific link:{neo4j-docs-base-uri}/operations-manual/current/tools/cypher-shell/#cypher-shell-commands[commands] to manage transactions. +Cypher Shell also offers specific link:{neo4j-docs-base-uri}/operations-manual/current/cypher-shell/#cypher-shell-commands[commands] to manage transactions. | 11.1 | Graph expressions diff --git a/modules/ROOT/pages/clauses/clause-composition.adoc b/modules/ROOT/pages/clauses/clause-composition.adoc index 23769cc64..4ce2db52b 100644 --- a/modules/ROOT/pages/clauses/clause-composition.adoc +++ b/modules/ROOT/pages/clauses/clause-composition.adoc @@ -129,7 +129,9 @@ In a Cypher query, read and write clauses can take turns. The most important aspect of read-write queries is that the state of the graph also changes between clauses. [IMPORTANT] -A clause can never observe writes made by a later clause. +==== +A clause can never observe writes made by a later clause, and will observe all writes done by the previous clauses. +==== As of Cypher 25, read and write clauses can be combined in any order. That is, a write clause followed by a read clause no longer requires a separating xref:clauses/with.adoc[`WITH`] clause in order for the read clause to observe the changes made by a preceding write clause. @@ -152,7 +154,7 @@ RETURN f.name AS friendName, .Table of intermediate results and state of the graph between read and write clauses ====== -Using the same example graph as above, this example shows the table of intermediate results and the state of the graph after each clause for the following query: +Using the same example graph as above, this example shows the table of intermediate results and the state of the graph after each clause for a query with a read clause before a write clause: [source,cypher, indent=0] ---- @@ -163,7 +165,7 @@ The query finds all nodes where the `name` property starts with "J" and for each such node it creates another node with the `name` property set to "Jay-jay". -.+The table of intermediate results and the state of the graph after each clause+ +.Read-write: The table of intermediate results and the state of the graph after each clause+ [options="header", width="100%", cols="3a, 4a, 4a"] |=== @@ -310,6 +312,102 @@ the graph made by the `CREATE`. ====== +.Table of intermediate results and state of the graph between write and read clauses +====== +On an empty graph, this example shows the table of intermediate results and the state of the graph after each clause for a query with a write clause before a read clause: + +[source,cypher, indent=0] +---- +UNWIND ["Max", "Lune"] AS dogName +CREATE (n:Dog {name: dogName}) +WITH n +MATCH (d:Dog) +RETURN COUNT(*) +---- +This query creates two `Dog` nodes and returns the value `4`. + +.+Write-read: The table of intermediate results and the state of the graph after each clause+ +[options="header", width="100%", cols="3a, 4a, 4a"] +|=== + +| Clause +| Table of intermediate results after the clause +| State of the graph after the clause, changes in red + +| ---- +UNWIND ["Max", "Luna"] AS dogName +---- +| +[options="header",cols="1m"] +!=== +! dogName +! "Max" +! "Luna" +!=== +| + +| ---- +CREATE (n:Dog {name: dogName}) +---- +| +[options="header",cols="1m, 1m"] +!=== +! dogName ! n +! "Max" ! (:Dog {name: 'Max'}) +! "Luna" ! (:Dog {name: 'Luna'}) +!=== +| + +[graphviz] +---- +digraph L { node [shape=record style=rounded]; +N5 [ +color = "red" +fontcolor = "red" +label = "{Dog\|name = \'Max\'\l}" +] +N6 [ +color = "red" +fontcolor = "red" +label = "{Dog\|name = \'Luna\'\l}" +] +} +---- + +| ---- +MATCH (d:Dog) +---- +| +[options="header",cols="1m, 1m, 1m"] +!=== +! dogName ! n ! d +! "Max" ! (:Dog {name: 'Max'}) ! (:Dog {name: 'Max'}) +! "Max" ! (:Dog {name: 'Max'}) ! (:Dog {name: 'Luna'}) +! "Luna" ! (:Dog {name: 'Luna'}) ! (:Dog {name: 'Max'}) +! "Luna" ! (:Dog {name: 'Luna'}) ! (:Dog {name: 'Luna'}) +!=== +| + +[graphviz] +---- +digraph L { node [shape=record style=rounded]; +N5 [ +label = "{Dog\|name = \'Max\'\l}" +] +N6 [ +label = "{Dog\|name = \'Luna\'\l}" +] +} +---- +|=== + +It is important to note that the `MATCH` clause reads all the `Dog` nodes that are created by the `CREATE` clause. +This is because the `CREATE` clause comes before the `MATCH` clause and thus the `MATCH` observes all changes to +the graph made by the `CREATE`. +The `MATCH` clause is performed for every intermediate result, this leads to finding two nodes for both intermediate results. + +====== + [[cypher-clause-composition-union-queries]] == Queries with `UNION` diff --git a/modules/ROOT/pages/clauses/delete.adoc b/modules/ROOT/pages/clauses/delete.adoc index 948022d6c..11584513a 100644 --- a/modules/ROOT/pages/clauses/delete.adoc +++ b/modules/ROOT/pages/clauses/delete.adoc @@ -120,7 +120,7 @@ Deleted 1 node, deleted 1 relationship [NOTE] ==== The `DETACH DELETE` clause may not be permitted to users with restricted security privileges. -For more information, see link:{neo4j-docs-base-uri}/operations-manual/current/authentication-authorization/access-control#detach-delete-restricted-user[Operations Manual -> Fine-grained access control]. +For more information, see link:{neo4j-docs-base-uri}/operations-manual/current/tutorial/access-control/#detach-delete-restricted-user[Operations Manual -> Fine-grained access control]. ==== diff --git a/modules/ROOT/pages/clauses/load-csv.adoc b/modules/ROOT/pages/clauses/load-csv.adoc index fd2a0754a..0c48a2d2f 100644 --- a/modules/ROOT/pages/clauses/load-csv.adoc +++ b/modules/ROOT/pages/clauses/load-csv.adoc @@ -70,10 +70,10 @@ Added 4 nodes, Set 8 properties, Added 4 labels ==== [NOTE] -For ways of importing data into an Aura instance, see link:https://neo4j.com/docs/aura/auradb/importing/importing-data/[Aura -> Importing data]. +For ways of importing data into an Aura instance, see link:https://neo4j.com/docs/aura/classic/auradb/importing/importing-data/[Aura -> Importing data]. [TIP] -When using `+file:///+` URLs, spaces and other non-alphanumeric characters must be link:https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding[URL-encoded]. +When using `+file:///+` URLs, spaces and other non-alphanumeric characters must be link:https://developer.mozilla.org/en-US/docs/Glossary/Percent-encoding[URL-encoded]. ==== Configuration settings for file URLs @@ -368,7 +368,7 @@ You can't load zipped CSV files from remote URLs. === Import data from relational databases If the source data comes from a relational model, it's worth evaluating how to gain the most from moving to a graph data model. -Before running the import, think about how the data can be modeled as a graph, and adapt its structure accordingly when running the import (see link:https://neo4j.com/docs/getting-started/data-modeling/guide-data-modeling/[Graph data modeling]). +Before running the import, think about how the data can be modeled as a graph, and adapt its structure accordingly when running the import (see link:https://neo4j.com/docs/getting-started/data-modeling/tutorial-data-modeling/[Graph data modeling]). Data from relational databases may consist of one or multiple CSV files, depending on the source database structure. A performant approach is to run multiple passes of `LOAD CSV` to import nodes separately from relationships. @@ -1166,7 +1166,7 @@ With increasing amounts of data, it is more efficient to create _all_ nodes firs There are a few other tools to get CSV data into Neo4j. -1. *The link:{neo4j-docs-base-uri}/operations-manual/current/tools/neo4j-admin/neo4j-admin-import/[`neo4j-admin database import`] command* is the most efficient way of importing large CSV files. +1. *The link:{neo4j-docs-base-uri}/operations-manual/current/import/[`neo4j-admin database import`] command* is the most efficient way of importing large CSV files. 2. Use a link:https://neo4j.com/docs/create-applications/[*language library*] to parse CSV data and run creation Cypher queries against a Neo4j database. Created as an extension library to provide common procedures and functions to developers. This library is especially helpful for complex transformations and data manipulations. diff --git a/modules/ROOT/pages/clauses/use.adoc b/modules/ROOT/pages/clauses/use.adoc index 68799cdfd..69d43792d 100644 --- a/modules/ROOT/pages/clauses/use.adoc +++ b/modules/ROOT/pages/clauses/use.adoc @@ -73,8 +73,8 @@ In subqueries, a `USE` clause may appear directly following the xref:subqueries/ [source, cypher, role=test-setup] ---- CREATE DATABASE myDatabase; -CREATE COMPOSITE DATABASE `myComposite`; -CREATE ALIAS `myComposite`.`myConstituent` FOR DATABASE `myDatabase`; +CREATE COMPOSITE DATABASE myComposite; +CREATE ALIAS myComposite.myConstituent FOR DATABASE myDatabase; ---- //// diff --git a/modules/ROOT/pages/constraints/index.adoc b/modules/ROOT/pages/constraints/index.adoc index f906e317b..5ae7f1828 100644 --- a/modules/ROOT/pages/constraints/index.adoc +++ b/modules/ROOT/pages/constraints/index.adoc @@ -5,10 +5,10 @@ include::https://raw.githubusercontent.com/neo4j-graphacademy/courses/main/ascii Neo4j offers several constraints to ensure the quality and integrity of data in a graph. The following constraints are available in Neo4j: -* *Property uniqueness constraints* ensure that the combined property values are unique for all nodes with a specific label or all relationships with a specific type. -* *Property existence constraints* ensure that a property exists either for all nodes with a specific label or for all relationships with a specific type. label:enterprise-edition[] -* *Property type constraints* ensure that a property has the required property type for all nodes with a specific label or for all relationships with a specific type. label:enterprise-edition[] -* *Key constraints* ensure that all properties exist and that the combined property values are unique for all nodes with a specific label or all relationships with a specific type.label:enterprise-edition[] +* xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[Property uniqueness constraints]: ensure that the combined property values are unique for all nodes with a specific label or all relationships with a specific type. +* xref:constraints/managing-constraints.adoc#create-property-existence-constraints[Property existence constraints]: ensure that a property exists either for all nodes with a specific label or for all relationships with a specific type. label:enterprise-edition[] +* xref:constraints/managing-constraints.adoc#create-property-type-constraints[Property type constraints]: ensure that a property has the required property type for all nodes with a specific label or for all relationships with a specific type. label:enterprise-edition[] +* xref:constraints/managing-constraints.adoc#create-key-constraints[Key constraints]: ensure that all properties exist and that the combined property values are unique for all nodes with a specific label or all relationships with a specific type.label:enterprise-edition[] To learn more about creating, listing, and dropping these constraints, as well as information about index-backed constraints, constraint creation failures and data violation scenarios, and more, see xref:constraints/managing-constraints.adoc[]. diff --git a/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc b/modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc index 576efb774..675025fe5 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 += Additions, deprecations, removals, and compatibility :description: all of the features that have been removed, deprecated, added, or extended in different Cypher versions. :test-skip: true // all deprecations would fail. @@ -20,6 +20,7 @@ Replacement syntax for deprecated and removed features are also indicated. [IMPORTANT] Cypher 25 was introduced in Neo4j 2025.06 and can only be used on Neo4j 2025.06+ databases. Features removed in Cypher 25 are still available on Neo4j 2025.06+ databases either by prepending a query with `CYPHER 5` or by having Cypher 5 as the default language for the database. +For more information, see xref:queries/select-version.adoc[]. [[cypher-deprecations-additions-removals-2025.06]] == Neo4j 2025.06 @@ -30,6 +31,41 @@ Features removed in Cypher 25 are still available on Neo4j 2025.06+ databases ei | Feature | Details +a| +label:functionality[] +label:removed[] +[source, cypher, role="noheader"] +---- +CREATE DATABASE db OPTIONS { seedCredentials: ... } +---- +| The option `seedCredentials` is removed from the `CREATE DATABASE` `OPTIONS` map. +For more information, see link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/create-databases/#manage-databases-create-database-options[Operations Manual -> Database administration -> Create databases]. + +a| +label:functionality[] +label:removed[] +[source, cypher, role="noheader"] +---- +CREATE DATABASE db OPTIONS { existingDataSeedInstance: ... } +---- +| The option `existingDataSeedInstance` is removed from the `CREATE DATABASE` `OPTIONS` map and replaced by `existingDataSeedServer`. +For more information, see link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/create-databases/#manage-databases-create-database-options[Operations Manual -> Database administration -> Create databases]. + +a| +[#_graph_reference_removed_name_parts_quoting] +label:functionality[] +label:removed[] +[source, cypher, role=noheader] +---- +CREATE ALIAS composite.`1` FOR DATABASE neo4j +---- +[source, cypher, role=noheader] +---- +USE composite.`1` +---- +| Graph references with separately backticked name parts have been removed. Use parameters or backtick the entire name, e.g. `USE `composite.1`` + + a| label:functionality[] label:removed[] @@ -38,10 +74,10 @@ label:removed[] RETURN 1 as my\u0085identifier ---- a| -The Unicode character \`\u0085` has been removed for unescaped identifiers and is now considered a whitespace character. -To continue using it, escape the identifier by adding backticks around it. +The Unicode character `\u0085` (`Next Line`) has been removed for unescaped identifiers and is now considered a whitespace character. +To continue using it, escape the identifier by adding backticks (++``++) around it. This applies to all unescaped identifiers in Cypher, such as label expressions, properties, variable names, or parameters. -In the given example, the quoted identifier would be \`my�identifier`. +In the given example, the quoted identifier would be `my\u0085identifier`. a| label:functionality[] @@ -51,23 +87,24 @@ label:removed[] RETURN 1 as my$Identifier ---- a| -The character with the Unicode representation \`\u0024` has been removed for unescaped identifiers. To continue using it, escape the identifier by adding backticks around the identifier. -This applies to all unescaped identifiers in Cypher, such as label expressions, properties, variable names, or parameters. In the given example, the quoted identifier would be \`my$identifier`. +The character with the Unicode representation `\u0024` (`$`) has been removed for unescaped identifiers. +To continue using it, escape the identifier by adding backticks (++``++) around the identifier. +This applies to all unescaped identifiers in Cypher, such as label expressions, properties, variable names, or parameters. In the given example, the quoted identifier would be `my\u0024identifier`. The following Unicode Characters are removed in identifiers: -'\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', -'\u0008', '\u000E', '\u000F', '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', -'\u0015', '\u0016', '\u0017', '\u0018', '\u0019', '\u001A', '\u001B', '\u007F', -'\u0080', '\u0081', '\u0082', '\u0083', '\u0084', '\u0086', '\u0087', '\u0088', -'\u0089', '\u008A', '\u008B', '\u008C', '\u008D', '\u008E', '\u008F', '\u0090', -'\u0091', '\u0092', '\u0093', '\u0094', '\u0095', '\u0096', '\u0097', '\u0098', -'\u0099', '\u009A', '\u009B', '\u009C', '\u009D', '\u009E', '\u009F', '\u0024', -'\u00A2', '\u00A3', '\u00A4', '\u00A5', '\u00AD', '\u0600', '\u0601', '\u0602', -'\u0603', '\u0604', '\u0605', '\u061C', '\u06DD', '\u070F', '\u08E2', '\u180E', -'\u200B', '\u200C', '\u200D', '\u200E', '\u200F', '\u202A', '\u202B', '\u202C', -'\u202D', '\u202E', '\u2060', '\u2061', '\u2062', '\u2063', '\u2064', '\u2066', -'\u2067', '\u2068', '\u2069', '\u206A', '\u206B', '\u206C', '\u206D', '\u206E', -'\u206F', '\u2E2F', '\uFEFF', '\uFFF9', '\uFFFA', '\uFFFB' +`\u0000`, `\u0001`, `\u0002`, `\u0003`, `\u0004`, `\u0005`, `\u0006`, `\u0007`, +`\u0008`, `\u000E`, `\u000F`, `\u0010`, `\u0011`, `\u0012`, `\u0013`, `\u0014`, +`\u0015`, `\u0016`, `\u0017`, `\u0018`, `\u0019`, `\u001A`, `\u001B`, `\u007F`, +`\u0080`, `\u0081`, `\u0082`, `\u0083`, `\u0084`, `\u0086`, `\u0087`, `\u0088`, +`\u0089`, `\u008A`, `\u008B`, `\u008C`, `\u008D`, `\u008E`, `\u008F`, `\u0090`, +`\u0091`, `\u0092`, `\u0093`, `\u0094`, `\u0095`, `\u0096`, `\u0097`, `\u0098`, +`\u0099`, `\u009A`, `\u009B`, `\u009C`, `\u009D`, `\u009E`, `\u009F`, `\u0024`, +`\u00A2`, `\u00A3`, `\u00A4`, `\u00A5`, `\u00AD`, `\u0600`, `\u0601`, `\u0602`, +`\u0603`, `\u0604`, `\u0605`, `\u061C`, `\u06DD`, `\u070F`, `\u08E2`, `\u180E`, +`\u200B`, `\u200C`, `\u200D`, `\u200E`, `\u200F`, `\u202A`, `\u202B`, `\u202C`, +`\u202D`, `\u202E`, `\u2060`, `\u2061`, `\u2062`, `\u2063`, `\u2064`, `\u2066`, +`\u2067`, `\u2068`, `\u2069`, `\u206A`, `\u206B`, `\u206C`, `\u206D`, `\u206E`, +`\u206F`, `\u2E2F`, `\uFEFF`, `\uFFF9`, `\uFFFA`, `\uFFFB` a| label:functionality[] @@ -138,6 +175,25 @@ For more information, see the link:{neo4j-docs-base-uri}/operations-manual/curre |=== +=== Deprecated in Cypher 25 + +[cols="2", options="header"] +|=== +| Feature +| Details + +a| +label:functionality[] +label:deprecated[] +[source, cypher, role="noheader"] +---- +CREATE DATABASE db OPTIONS { existingData: ... } +---- +| The option `existingData` is deprecated. +For more information, see link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/create-databases/#manage-databases-create-database-options[Operations Manual -> Database administration -> Create databases]. + +|=== + === Updated in Cypher 25 @@ -146,6 +202,35 @@ For more information, see the link:{neo4j-docs-base-uri}/operations-manual/curre | Feature | Details +a| +label:functionality[] +label:updated[] +[source, cypher, role="noheader"] +---- +WITH 1 AS g +RETURN COLLECT { + UNWIND [1,2,3] AS x + WITH * WHERE x < 0 + WITH count(*) AS agg + RETURN agg + g +} AS x +---- + +a| Imported variables are now correctly handled as constants inside xref:subqueries/collect.adoc[`COLLECT`], xref:subqueries/count.adoc[`COUNT`], and xref:subqueries/existential.adoc[`EXISTS`] subquery expressions. +The example query previously returned no results (`[]`) because the imported variable was used incorrectly as an implicit grouping key. +It now returns `[1]`, since the variable is not used as a grouping key, allowing `count(*)` to return `0` and `0 + g` to evaluate to `1`. + +a| +label:functionality[] +label:updated[] +[source, cypher, role="noheader"] +---- +RETURN $0hello +---- + +a| Parameters can start with extended identifier characters (such as numbers), in line with the xref:appendix/gql-conformance/index.adoc[GQL] standard. +For more information, see xref:syntax/parameters.adoc[]. + a| label:functionality[] label:updated[] @@ -207,6 +292,7 @@ Several xref:clauses/transaction-clauses.adoc#query-listing-transactions[`SHOW * The current query-related columns — `currentQuery`, `currentQueryId`, `parameters`, `planner`, `runtime`, `indexes`, `currentQueryStartTime`, `currentQueryElapsedTime`, `currentQueryCpuTime`, `currentQueryIdleTime`, and `currentQueryStatus` — now return `null` when no query is executing. a| +[#_graph_reference_updated_graph_by_name_quotes] label:functionality[] label:updated[] [source, cypher, role="noheader"] @@ -255,6 +341,112 @@ a| label:functionality[] label:new[] +[source, cypher, role="noheader"] +---- +CREATE [COMPOSITE] DATABASE actors SET DEFAULT LANGUAGE CYPHER 25 +---- + +a| Set the default Cypher version for a standard or composite database when creating it. +The available versions are `CYPHER 25` and `CYPHER 5`. +If not specified, the default language for the database is set to the default language of the DBMS. +For more information, see the following sections in the Operations Manual: + +* link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/create-databases/#_set_a_default_cypher_version_for_a_standard_database[Set a default Cypher version for a standard database]. +* link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/create-composite-databases/#composite-databases-default-language[Set the default Cypher version for a composite database]. + +a| +label:functionality[] +label:new[] + +[source, cypher, role="noheader"] +---- +CREATE ALIAS `remote-with-default-language` +FOR DATABASE `northwind-graph-2020` + AT "neo4j+s://location:7687" + USER alice + PASSWORD 'example_secret' + DEFAULT LANGUAGE CYPHER 25 +---- + +a| Set the default Cypher version for a remote database alias when creating it. +The available versions are `CYPHER 5` and `CYPHER 25`. +Local database aliases and database aliases in composite databases cannot be assigned a default Cypher version. +Local database aliases always have the Cypher version of their target database and database aliases in composite databases always have the Cypher version of the composite database they belong to. +For more information, see the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/aliases/manage-aliases-standard-databases/#_set_a_default_cypher_version_for_remote_database_aliases[Operations Manual -> Set a default Cypher version for remote database aliases]. + +a| +label:functionality[] +label:new[] +[source, cypher, role="noheader"] +---- +ALTER DATABASE movies SET DEFAULT LANGUAGE CYPHER 25 +---- + +a| Alter the default Cypher version of an existing standard or composite database. +The available versions are `CYPHER 25` and `CYPHER 5`. +For more information, see the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/alter-databases/#alter-database-default-language[Operations Manual -> Alter the default Cypher version of an existing database]. + +a| +label:functionality[] +label:new[] + +[source, cypher, role="noheader"] +---- +ALTER ALIAS `remote-with-default-language` SET DATABASE DEFAULT LANGUAGE CYPHER 25 +---- + +a| Alter the default Cypher version of a remote database alias. +The available versions are `CYPHER 25` and `CYPHER 5`. +It is not possible to alter the default Cypher version of a local database alias or an alias belonging to a composite database. +Local database aliases always have the Cypher version of their target database and aliases belonging to composite databases always have the Cypher version of the composite database. +For more information, see the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/aliases/manage-aliases-standard-databases/#alter-default-language-remote-database-alias[Operations Manual -> Alter the default Cypher version of a remote database alias]. + +a| +label:functionality[] +label:new[] + +[source, cypher, role="noheader"] +---- +SHOW DATABASES YIELD name, defaultLanguage +---- + +a| The new return column `defaultLanguage` for the `SHOW DATABASE` command returns the default language of a database. +This column is not returned by default; it can only be returned using `YIELD`. +For more information, see the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/listing-databases/#_show_the_default_cypher_version_of_a_database[Operations Manual -> Show the default Cypher version of a database]. + +a| +label:functionality[] +label:new[] + +[source, cypher, role="noheader"] +---- +SHOW ALIAS `remote-with-default-language` FOR DATABASE YIELD name, defaultLanguage +---- + +a| The new return column `defaultLanguage` for the `SHOW ALIAS` command returns the default language of a database alias. +This column is not returned by default; it can only be returned using `YIELD`. +For more information, see the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/aliases/manage-aliases-standard-databases/#manage-aliases-list[Operations Manual -> List database aliases]. + +a| +label:functionality[] +label:new[] + +[source, cypher, role="noheader"] +---- +CYPHER 25 +MATCH (n:Person) +FILTER n.age < 35 +RETURN n.name AS name +---- + +a| New query option: `CYPHER 25`. +Prepending a query with `CYPHER 25` ensures that a query is run with Cypher 25, regardless of the default language of a database. +(The ability to select `CYPHER 5` was introduced in Neo4j 5.21). + +a| +label:functionality[] +label:new[] + [source, cypher, role="noheader"] ---- RETURN 1 AS a @@ -360,6 +552,16 @@ CREATE DATABASE db OPTIONS { seedRestoreUntil: ... } This allows a database to be seeded up to a specific date or transaction ID. For more information, see link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/seed-from-uri/[Operations Manual -> Database administration -> Create a database from a URI]. +a| +label:functionality[] +label:new[] +[source, cypher, role="noheader"] +---- +CREATE DATABASE db OPTIONS { seedSourceDatabase: ... } +---- +| You can specify the name of a source database if the `seedURI` points to a folder containing backups for multiple databases. +For more information, see link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/create-databases/#manage-databases-create-database-options[Operations Manual -> Database administration -> Create databases]. + a| label:functionality[] label:new[] @@ -651,9 +853,16 @@ label:deprecated[] USE my.db ... ---- -| In xref:clauses/use.adoc[`USE`] clauses, databases and aliases with unquoted `.` are deprecated unless the `.` is used to indicate that the database or alias belongs to a composite database. -Names containing `.` should be quoted using backticks. -For example, `USE `my.db`` is valid. +a| The use of unquoted `.` characters in xref:clauses/use.adoc[`USE`] clauses when specifying databases and aliases was deprecated in 5.26, except when `.` indicated that the database or alias belonged to a composite database. +However, this deprecation was withdrawn in Neo4j 2025.06, and replaced by the following updates in Cypher 25: + +* xref::deprecations-additions-removals-compatibility.adoc#_graph_reference_removed_name_parts_quoting[Removed support for quoted name parts in graph references] + +* xref::deprecations-additions-removals-compatibility.adoc#_graph_reference_updated_graph_by_name_quotes[Update to graph functions] + +This is because the previous quoting rules were inconsistent and ambiguous. +The rules are clarified and improved in Cypher 25. +For more information, see xref::values-and-types/graph-references.adoc#rules[Graph reference rules] |=== @@ -3272,12 +3481,16 @@ label:deprecated[] CREATE DATABASE databaseName.withDot ... ---- a| -Creating a database with dots in the name has been deprecated, instead quote the database name using backticks: +Creating a database with . characters was deprecated in 5.0. +However, this deprecation was withdrawn in 2025.06, and replaced by the following updates in Cypher 25: -[source, cypher, role="noheader"] ----- -CREATE DATABASE `databaseName.withDot` ... ----- +* xref::deprecations-additions-removals-compatibility.adoc#_graph_reference_removed_name_parts_quoting[Removed support for quoted name parts in graph references] + +* xref::deprecations-additions-removals-compatibility.adoc#_graph_reference_updated_graph_by_name_quotes[Update to graph functions] + +This is because the previous quoting rules were inconsistent and ambiguous. +The rules are clarified and improved in Cypher 25. +For more information, see xref::values-and-types/graph-references.adoc#rules[Graph reference rules] a| [[cypher-5_0-d_4]] diff --git a/modules/ROOT/pages/expressions/predicates/type-predicate-expressions.adoc b/modules/ROOT/pages/expressions/predicates/type-predicate-expressions.adoc index 90eaa9872..0e6691859 100644 --- a/modules/ROOT/pages/expressions/predicates/type-predicate-expressions.adoc +++ b/modules/ROOT/pages/expressions/predicates/type-predicate-expressions.adoc @@ -64,8 +64,8 @@ RETURN val, val IS NOT :: STRING AS notString |=== -[[type-predicate-NULL]] -== Type predicate expressions for NULL +[[type-predicate-null]] +== Type predicate expressions for null All Cypher types includes the `null` value. Type predicate expressions can be appended with `NOT NULL`. diff --git a/modules/ROOT/pages/functions/aggregating.adoc b/modules/ROOT/pages/functions/aggregating.adoc index 58be16e53..db87890b0 100644 --- a/modules/ROOT/pages/functions/aggregating.adoc +++ b/modules/ROOT/pages/functions/aggregating.adoc @@ -10,7 +10,7 @@ Aggregation can be computed over all the matching paths, or it can be further di [TIP] ==== -To learn more about how Cypher handles aggregations performed on zero rows, refer to link:https://neo4j.com/developer/kb/understanding-aggregations-on-zero-rows//[Neo4j Knowledge Base -> Understanding aggregations on zero rows]. +To learn more about how Cypher handles aggregations performed on zero rows, refer to link:https://neo4j.com/developer/kb/understanding-aggregations-on-zero-rows/[Neo4j Knowledge Base -> Understanding aggregations on zero rows]. ==== == Example graph diff --git a/modules/ROOT/pages/functions/graph.adoc b/modules/ROOT/pages/functions/graph.adoc index 2bec760c9..c62c6a785 100644 --- a/modules/ROOT/pages/functions/graph.adoc +++ b/modules/ROOT/pages/functions/graph.adoc @@ -16,7 +16,7 @@ .Considerations |=== -| `graph.names()` is only supported on link:{neo4j-docs-base-uri}/operations-manual/current/composite-databases[composite databases]. +| `graph.names()` is only supported on link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/concepts/[composite databases]. |=== .+graph.names()+ @@ -71,7 +71,7 @@ The names of all graphs on the current composite database are returned. .Considerations |=== -| `graph.propertiesByName()` is only supported on link:{neo4j-docs-base-uri}/operations-manual/current/composite-databases[composite databases]. +| `graph.propertiesByName()` is only supported on link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/concepts/[composite databases]. | The properties in the returned `MAP` are set on the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/aliases/manage-aliases-standard-databases/[alias]that adds the graph as a constituent of a composite database. |=== diff --git a/modules/ROOT/pages/genai-integrations.adoc b/modules/ROOT/pages/genai-integrations.adoc index 497931a3d..760954ba8 100644 --- a/modules/ROOT/pages/genai-integrations.adoc +++ b/modules/ROOT/pages/genai-integrations.adoc @@ -36,7 +36,7 @@ The graph contains 28863 nodes and 332522 relationships. There are 9083 `Movie` nodes with a `plot` and `title` property. To recreate the graph, download and import this link:https://github.com/neo4j-graph-examples/recommendations/raw/main/data/recommendations-embeddings-50.dump[dump file] to an empty Neo4j database. -Dump files can be imported for both link:{neo4j-docs-base-uri}/aura/auradb/importing/import-database/[Aura] and link:{neo4j-docs-base-uri}/operations-manual/current/backup-restore/restore-dump/[on-prem] instances. +Dump files can be imported for both link:{neo4j-docs-base-uri}/aura/classic/auradb/importing/import-database/[Aura] and link:{neo4j-docs-base-uri}/operations-manual/current/backup-restore/restore-dump/[on-prem] instances. [NOTE] The embeddings on this are generated using link:https://platform.openai.com/docs/guides/embeddings[OpenAI] (model `text-embedding-ada-002`), producing 1536-dimensional vectors. @@ -217,7 +217,7 @@ Each provider has its own configuration map that can be passed to `genai.vector. === Vertex AI * Identifier (`provider` argument): `"VertexAI"` -* https://cloud.google.com/vertex-ai/docs/generative-ai/embeddings/get-text-embeddings[Official Vertex AI documentation] +* https://cloud.google.com/vertex-ai/generative-ai/docs/embeddings/get-text-embeddings[Official Vertex AI documentation] .Vertex AI provider details [%collapsible] @@ -342,7 +342,7 @@ Supported values: + === Azure OpenAI * Identifier (`provider` argument): `"AzureOpenAI"` -* https://learn.microsoft.com/en-us/azure/ai-services/openai/[Official Azure OpenAI documentation] +* https://learn.microsoft.com/en-us/azure/ai-foundry/[Official Azure OpenAI documentation] [NOTE] Unlike the other providers, the model is configured when creating the deployment on Azure, and is thus not part of the configuration map. diff --git a/modules/ROOT/pages/indexes/search-performance-indexes/using-indexes.adoc b/modules/ROOT/pages/indexes/search-performance-indexes/using-indexes.adoc index 14608bcf8..347119a26 100644 --- a/modules/ROOT/pages/indexes/search-performance-indexes/using-indexes.adoc +++ b/modules/ROOT/pages/indexes/search-performance-indexes/using-indexes.adoc @@ -28,7 +28,7 @@ image::using-indexes-example-graph.svg[Graph showing two nodes being connected v In total, the graph contains 69165 nodes (of which 188 have the label `PointOfInterest`) and 152077 `ROUTE` relationships. To recreate the graph, download and import the link:https://github.com/neo4j-graph-examples/openstreetmap/raw/main/data/openstreetmap-50.dump[5.0 dump file] to an empty Neo4j database. -Dump files can be imported for both link:{neo4j-docs-base-uri}/aura/auradb/importing/import-database/[Aura] and link:{neo4j-docs-base-uri}/operations-manual/current/backup-restore/restore-dump/[on-prem] instances. +Dump files can be imported for both link:{neo4j-docs-base-uri}/aura/classic/auradb/importing/import-database/[Aura] and link:{neo4j-docs-base-uri}/operations-manual/current/backup-restore/restore-dump/[on-prem] instances. [[token-lookup-indexes]] == Token lookup indexes diff --git a/modules/ROOT/pages/indexes/semantic-indexes/full-text-indexes.adoc b/modules/ROOT/pages/indexes/semantic-indexes/full-text-indexes.adoc index 44bda16c4..06aba7874 100644 --- a/modules/ROOT/pages/indexes/semantic-indexes/full-text-indexes.adoc +++ b/modules/ROOT/pages/indexes/semantic-indexes/full-text-indexes.adoc @@ -390,7 +390,7 @@ The procedures for full-text indexes are listed in the table below: * Full-text indexes can be queried using the Lucene query language. * Full-text indexes are kept up to date automatically, as nodes and relationships are added, removed, and modified. * Full-text indexes will automatically populate newly created indexes with the existing data in a store. -* Full-text indexes can be checked by the link:{neo4j-docs-base-uri}/operations-manual/current/tools/neo4j-admin/consistency-checker[consistency checker], and they can be rebuilt if there is a problem with them. +* Full-text indexes can be checked by the link:{neo4j-docs-base-uri}/operations-manual/current/backup-restore/consistency-checker/[consistency checker], and they can be rebuilt if there is a problem with them. * Newly created full-text indexes get automatically populated with the existing data in the database. * Full-text indexes can support any number of properties in a single index. * Full-text indexes are created, dropped, and updated transactionally, and are automatically replicated throughout a cluster. diff --git a/modules/ROOT/pages/indexes/semantic-indexes/vector-indexes.adoc b/modules/ROOT/pages/indexes/semantic-indexes/vector-indexes.adoc index 06dd47696..82bc140d3 100644 --- a/modules/ROOT/pages/indexes/semantic-indexes/vector-indexes.adoc +++ b/modules/ROOT/pages/indexes/semantic-indexes/vector-indexes.adoc @@ -14,7 +14,7 @@ The following resources provide hands-on tutorials for working with LLMs and vec * link:https://neo4j.com/docs/genai/tutorials/embeddings-vector-indexes/[GenAI documentation -> Embeddings & Vector Indexes Tutorial] Neo4j vector indexes are powered by the link:https://lucene.apache.org/[Apache Lucene] indexing and search library.footnote:[Lucene implements a Hierarchical Navigable Small World (HNSW) Graph to perform a k approximate nearest neighbors (k-ANN) query over the vector fields. -For more information, see link:http://dx.doi.org/10.1109/TPAMI.2018.2889473[Efficient and Robust Approximate Nearest Neighbor Search Using Hierarchical Navigable Small World Graphs] -- Yury A. Malkov and Dmitry A. Yashunin] +For more information, see link:https://ieeexplore.ieee.org/document/8594636/[Efficient and Robust Approximate Nearest Neighbor Search Using Hierarchical Navigable Small World Graphs] -- Yury A. Malkov and Dmitry A. Yashunin] [[example-graph]] == Example graph @@ -27,7 +27,7 @@ image::vector-index-graph.svg[Graph example connecting movie to person nodes via The graph contains 28863 nodes and 332522 relationships. To recreate the graph, download and import this link:https://github.com/neo4j-graph-examples/recommendations/raw/main/data/recommendations-embeddings-50.dump[dump file] to an empty Neo4j database. -Dump files can be imported for both link:{neo4j-docs-base-uri}/aura/auradb/importing/import-database/[Aura] and link:{neo4j-docs-base-uri}/operations-manual/current/backup-restore/restore-dump/[on-prem] instances. +Dump files can be imported for both link:{neo4j-docs-base-uri}/aura/classic/auradb/importing/import-database/[Aura] and link:{neo4j-docs-base-uri}/operations-manual/current/backup-restore/restore-dump/[on-prem] instances. [NOTE] The dump file used to load the dataset contains embeddings generated by https://openai.com/[OpenAI], using the model `text-embedding-ada-002`. diff --git a/modules/ROOT/pages/introduction/cypher-aura.adoc b/modules/ROOT/pages/introduction/cypher-aura.adoc index 380ea527f..54e630c9c 100644 --- a/modules/ROOT/pages/introduction/cypher-aura.adoc +++ b/modules/ROOT/pages/introduction/cypher-aura.adoc @@ -17,7 +17,7 @@ AuraDB is available on the following tiers: * AuraDB Business Critical * AuraDB Virtual Dedicated Cloud -For more information, see link:{neo4j-docs-base-uri}/aura/auradb[Aura docs - Neo4j AuraDB overview]. +For more information, see link:{neo4j-docs-base-uri}/aura/classic/auradb/[Aura docs - Neo4j AuraDB overview]. AuraDS is available on the following tiers: @@ -26,7 +26,7 @@ AuraDS is available on the following tiers: * AuraDS Professional * AuraDS Enterprise -For more information, see link:{neo4j-docs-base-uri}/aura/aurads[Aura docs - Neo4j AuraDS overview]. +For more information, see link:{neo4j-docs-base-uri}/aura/classic/aurads/[Aura docs - Neo4j AuraDS overview]. == Using Cypher on Aura diff --git a/modules/ROOT/pages/introduction/cypher-neo4j.adoc b/modules/ROOT/pages/introduction/cypher-neo4j.adoc index cc87055ee..cbd2eea5f 100644 --- a/modules/ROOT/pages/introduction/cypher-neo4j.adoc +++ b/modules/ROOT/pages/introduction/cypher-neo4j.adoc @@ -55,7 +55,7 @@ Normally there is only one graph within each database, and many administrative c Cypher queries executed in a session may declare which graph they apply to, or use a default, given by the session. Composite databases can contain multiple graphs, by means of aliases to other databases. Queries submitted to composite databases may refer to multiple graphs within the same query. -For more information, see link:{neo4j-docs-base-uri}/operations-manual/current/composite-databases/[Operations manual -> Composite databases]. +For more information, see link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/concepts/[Operations manual -> Composite databases]. *Database*:: A database is a storage and retrieval mechanism for collecting data in a defined space on disk and in memory. @@ -121,7 +121,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/current/transactions[HTTP API documentation -> Run transactions]. * For information on using transactions within the embedded Core API, see the link:{neo4j-docs-base-uri}/java-reference/current/java-embedded/cypher-java/[Java Reference -> Cypher queries]. -* 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/current/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/current/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/modules/ROOT/pages/introduction/cypher-overview.adoc b/modules/ROOT/pages/introduction/cypher-overview.adoc index 6f4642b42..b4363f067 100644 --- a/modules/ROOT/pages/introduction/cypher-overview.adoc +++ b/modules/ROOT/pages/introduction/cypher-overview.adoc @@ -82,4 +82,4 @@ RETURN actor.name Neo4j supports the APOC (Awesome Procedures on Cypher) Core library. The APOC Core library provides access to user-defined procedures and functions which extend the use of the Cypher query language into areas such as data integration, graph algorithms, and data conversion. -For more details, visit the link:{neo4j-docs-base-uri}/apoc/current[APOC Core page]. \ No newline at end of file +For more details, visit the link:{neo4j-docs-base-uri}/apoc/current/[APOC Core page]. \ No newline at end of file diff --git a/modules/ROOT/pages/introduction/index.adoc b/modules/ROOT/pages/introduction/index.adoc index 01fef1f03..db46e6935 100644 --- a/modules/ROOT/pages/introduction/index.adoc +++ b/modules/ROOT/pages/introduction/index.adoc @@ -7,11 +7,17 @@ ifndef::backend-pdf[] :description: This section provides an introduction to the Cypher query language. endif::[] -Welcome to the Neo4j Cypher Manual. +Welcome to the Neo4j Cypher Manual. -Cypher is Neo4j’s declarative query language, allowing users to unlock the full potential of property graph databases. +Cypher is Neo4j’s declarative query language, allowing users to unlock the full potential of property graph databases. -The Cypher Manual aims to be as instructive as possible to readers from a variety of backgrounds and professions, such as developers, administrators, and academic researchers. +[NOTE] +This manual covers Cypher 25. +As of Neo4j 2025.06, all new Cypher features are exclusively added to Cypher 25, while Cypher 5 is frozen. +For information about how to how to use Cypher 25, see xref:queries/select-version.adoc[]. +For information about new features added to Cypher 25, see xref:deprecations-additions-removals-compatibility.adoc[]. + +The Cypher Manual aims to be as instructive as possible to readers from a variety of backgrounds and professions, such as developers, administrators, and academic researchers. If you are new to Cypher and Neo4j, you can visit the link:{neo4j-docs-base-uri}/getting-started/current/cypher-intro/[Getting Started Guide -> Introduction to Cypher] chapter. Additionally, https://graphacademy.neo4j.com/[Neo4j GraphAcademy] has a variety of free courses tailored for all levels of experience. diff --git a/modules/ROOT/pages/patterns/match-modes.adoc b/modules/ROOT/pages/patterns/match-modes.adoc index 0385bd384..c59a8a885 100644 --- a/modules/ROOT/pages/patterns/match-modes.adoc +++ b/modules/ROOT/pages/patterns/match-modes.adoc @@ -95,7 +95,7 @@ RETURN pathCount, [r IN relationships(samplePath) | r.id] AS samplePathBridges ---- -<1> The xref:functions/list.adoc#functions-collect[`collect()`] function collects all paths and `[0]` takes the first entry as the `samplePath`. +<1> The xref:functions/aggregating.adoc#functions-collect[`collect()`] function collects all paths and `[0]` takes the first entry as the `samplePath`. .Result [role="queryresult",options="header,footer",cols="3* WHERE all(bridge IN range(1,7) WHERE bridge IN [r IN relationships(p) | r.id]) // <2> -WITH p -ORDER BY length(p) -LIMIT 1 RETURN [n IN nodes(p) | n.name] AS visitedLocations, [r IN relationships(p) | r.id] AS crossedBridges +ORDER BY length(p), crossedBridges +LIMIT 1 ---- <1> Paths with a length of less than 9 relationships return no results because they do not allow enough moves to traverse all seven bridges at least once while forming a cycle back to Kneiphof. @@ -196,13 +199,13 @@ RETURN [n IN nodes(p) | n.name] AS visitedLocations, |=== | visitedLocations | crossedBridges -| ["Kneiphof", "South Bank", "Kneiphof", "South Bank", "Lomse", "Kneiphof", "North Bank", "Lomse", "North Bank", "Kneiphof"] -| [4, 6, 4, 3, 7, 5, 2, 2, 1] +| ["Kneiphof", "North Bank", "Kneiphof", "South Bank", "Lomse", "North Bank", "Kneiphof", "South Bank", "Lomse", "Kneiphof"] +| [1, 1, 4, 3, 2, 5, 6, 3, 7] 2+d|Rows: 1 |=== -The order of the bridges traversed in the path returned demonstrates that bridges `2` and `4` were crossed twice in order to return to `Kneiphof`. +The order of the bridges traversed in the path returned demonstrates that bridges `1` and `3` were crossed twice in order to return to `Kneiphof`. image::repeatable-elements-graph.svg[Several graphs showing order of traversals when using repeatable elements match mode, width=600, role=popup] _Sequence of bridge traversals when using `REPEATABLE ELEMENTS`._ diff --git a/modules/ROOT/pages/planning-and-tuning/execution-plans.adoc b/modules/ROOT/pages/planning-and-tuning/execution-plans.adoc index 49d9b6866..c884c9f59 100644 --- a/modules/ROOT/pages/planning-and-tuning/execution-plans.adoc +++ b/modules/ROOT/pages/planning-and-tuning/execution-plans.adoc @@ -91,8 +91,8 @@ MATCH (:Station { name: 'Denmark Hill' })<-[:CALLS_AT]-(d:Stop) RETURN count(*) ---- -This is the resulting execution planfootnote:[The format of the execution plans displayed in this section are those generated when using link:{neo4j-docs-base-uri}/operations-manual/current/tools/cypher-shell[Cypher Shell]. -The execution plans generated by link:{neo4j-docs-base-uri}/browser-manual/current[Neo4j Browser] use a different format.]: +This is the resulting execution planfootnote:[The format of the execution plans displayed in this section are those generated when using link:{neo4j-docs-base-uri}/operations-manual/current/cypher-shell/[Cypher Shell]. +The execution plans generated by link:{neo4j-docs-base-uri}/browser-manual/current/[Neo4j Browser] use a different format.]: [role="queryplan"] ---- diff --git a/modules/ROOT/pages/planning-and-tuning/runtimes/reference.adoc b/modules/ROOT/pages/planning-and-tuning/runtimes/reference.adoc index f87838ce1..1625330f1 100644 --- a/modules/ROOT/pages/planning-and-tuning/runtimes/reference.adoc +++ b/modules/ROOT/pages/planning-and-tuning/runtimes/reference.adoc @@ -27,7 +27,7 @@ For a full list of all available Cypher write clauses, see the xref:clauses/inde It is not possible to use the parallel runtime if a change has been made to the state of a transaction. -For example, the following transaction (initiated on link:{neo4j-docs-base-uri}/operations-manual/current/tools/cypher-shell[Cypher Shell]) will be rolled back, because executing a Cypher query will make changes to the state of a transaction. +For example, the following transaction (initiated on link:{neo4j-docs-base-uri}/operations-manual/current/cypher-shell/[Cypher Shell]) will be rolled back, because executing a Cypher query will make changes to the state of a transaction. .Step 1: Initiate a new transaction and change its state by creating a node [source, cypher, role=test-skip] diff --git a/modules/ROOT/pages/queries/composed-queries/conditional-queries.adoc b/modules/ROOT/pages/queries/composed-queries/conditional-queries.adoc index ad42adf29..02cada893 100644 --- a/modules/ROOT/pages/queries/composed-queries/conditional-queries.adoc +++ b/modules/ROOT/pages/queries/composed-queries/conditional-queries.adoc @@ -13,7 +13,7 @@ For information about using `WHEN` branches in expressions, see xref:expressions The following graph is used for the examples below: -image::conditional_query_graph.svg[width="700",role="middle"] +image::conditional-query-graph.svg[Example graph with persons connected by works for and loves relationships, width=600,role=popup] To recreate the graph, run the following query against an empty Neo4j database: diff --git a/modules/ROOT/pages/queries/composed-queries/sequential-queries.adoc b/modules/ROOT/pages/queries/composed-queries/sequential-queries.adoc index 6a0f33ca0..05104ba61 100644 --- a/modules/ROOT/pages/queries/composed-queries/sequential-queries.adoc +++ b/modules/ROOT/pages/queries/composed-queries/sequential-queries.adoc @@ -65,7 +65,7 @@ CREATE (techCorp:Supplier {name: 'TechCorp', email: 'contact@techcorp.com'}), == Syntax .`NEXT` syntax -[source, cypher] +[source, syntax] ---- @@ -109,6 +109,7 @@ RETURN customer.firstName AS chocolateCustomer .Passing multiple variables to another query via `NEXT` +// tag::sequential_queries_basic_example[] [source, cypher] ---- MATCH (c:Customer)-[:BUYS]->(p:Product {name: 'Chocolate'}) @@ -119,6 +120,7 @@ NEXT RETURN customer.firstName AS chocolateCustomer, product.price * (1 - customer.discount) AS chocolatePrice ---- +// end::sequential_queries_basic_example[] .Result [role="queryresult",options="header,footer",cols="2*(:Product)<-[:SUPPLIES]-(s:Supplier) @@ -227,6 +233,7 @@ WHEN size(personalities) > 1 THEN ELSE RETURN customer, personalities[0] AS personality ---- +// end::sequential_queries_chaining_conditional_queries[] .Result [role="queryresult",options="header,footer",cols="2*(p:Product) @@ -273,6 +281,7 @@ ELSE { RETURN customer.firstName AS customer, "club below 1000" AS customerType, finalSum AS sum } ---- +// end::sequential_queries_in_conditional_queries[] .Result [role="queryresult",options="header,footer",cols="3*` to the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/create-databases/[`CREATE DATABASE`] statement. + +.Select default Cypher version when creating a database +[.tabbed-example] +===== +[.include-with-Cypher-25] +====== + +.Cypher 25 +[source,cypher] +---- +CREATE DATABASE actors SET DEFAULT LANGUAGE CYPHER 25 +---- + +====== +[.include-with-Cypher-5] +====== + +.Cypher 5 +[source,cypher] +---- +CREATE DATABASE movies DEFAULT LANGUAGE CYPHER 5 +---- + +====== +===== + +To alter the default Cypher version on an existing database, add `SET DEFAULT LANGUAGE ` to the link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/alter-databases/[`ALTER DATABASE`] command. + +.Alter the default Cypher version on an existing database +[.tabbed-example] +===== +[.include-with-Cypher-25] +====== + +.Cypher 25 +[source,cypher] +---- +ALTER DATABASE movies SET DEFAULT LANGUAGE CYPHER 25 +---- + +====== +[.include-with-Cypher-5] +====== + +.Cypher 5 +[source,cypher] +---- +ALTER DATABASE actors SET DEFAULT LANGUAGE CYPHER 5 +---- + +====== +===== + +Selecting `CYPHER 25` ensures that all queries run on that database will be executed using Cypher 25 as it exists in the version of Neo4j that the database is currently running, provided it is on Neo4j 2025.06 or later (unless a query is prepended with xref:selection-query-cypher-version[`CYPHER 5`], which overrides this default). + +Selecting `CYPHER 5` as the default database language ensures that all queries run on that database uses Cypher 5 as it existed at the time of the Neo4j 2025.06 release (unless a query is prepended with xref:selection-query-cypher-version[`CYPHER 25`], which overrides this default). +Any changes introduced after the 2025.06 release will not affect the semantics of the query. + +For more information about how to change and view the default language of new and existing databases and remote database aliases, and the new privileges related to changing the default language, see the following links in the Operations Manual: + +* link:{neo4j-docs-base-uri}/operations-manual/current/configuration/cypher-version-configuration/[Configure the Cypher default version] +* link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/create-databases/#_set_a_default_cypher_version_for_a_standard_database[Set a default Cypher version for a standard database] +* link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/create-composite-databases/#composite-databases-default-language[Set a default Cypher version for a composite database] +* link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/aliases/manage-aliases-standard-databases/#set-default-language-for-remote-database-aliases[Set a default Cypher version for remote database aliases] +* link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/alter-databases/#alter-database-default-language[Alter the default Cypher version of an existing database] +* link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/alter-composite-databases/#alter-default-language-composite-database[Alter the default Cypher version of a composite database] +* link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/aliases/manage-aliases-standard-databases/#alter-default-language-remote-database-alias[Alter the default Cypher version of a remote database alias] +* link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/standard-databases/listing-databases/#_show_the_default_cypher_version_of_a_database[Show the default Cypher version of a database] +* link:{neo4j-docs-base-uri}/operations-manual/authentication-authorization/dbms-administration/#_grant_privilege_to_modify_the_default_language_of_standard_databases[Grant privilege to modify the default language of standard databases] +* link:{neo4j-docs-base-uri}/operations-manual/authentication-authorization/dbms-administration/#grant-privilege-alter-composite-database[Grant privilege to modify composite databases] (required in order to alter the default language of a composite database) + +For information about Cypher versions and DBMS upgrades, see the link:{neo4j-docs-base-uri}/upgrade-migration-guide/current/_cypher_versions[Upgrade and migration guide -> Cypher versions]. + +[[migrate-queries-from-5-to-25]] +== Migrating queries from Cypher 5 to Cypher 25 + +It is recommended to modify queries that depend on features deprecated in Cypher 5 and removed in Cypher 25 to align with the changes introduced in Cypher 25. + +For example, Cypher 25 disallowed using a `NODE` or `RELATIONSHIP` instead of a `MAP` on the RHS of a xref:clauses/set.adoc[`SET`] clause, and instead requires the xref:functions/scalar.adoc#functions-properties[`properties()`] function to get the map of properties from nodes or relationships before referencing them in a `SET` clause. +The following example demonstrates how a query that works in Cypher 5 can be rewritten to work in Cypher 25. + +.Original Cypher 5 query +[source, cypher, role=test-skip] +---- +MATCH (n:Order)-[r:SHIPPED_TO]->(:Address) +SET n = r +---- + +.Modified Cypher 25 query +[source, cypher] +---- +MATCH (n:Order)-[r:SHIPPED_TO]->(:Address) +SET n = properties(r) +---- + +Another option is to prepend individual queries with a specific language version. + +[[selection-query-cypher-version]] +== Select Cypher version for individual queries + +To select the Cypher version of a query, prepend it with `CYPHER `. +This selection will override the default language for the database the query is executed against, and allows you to either work with Cypher 25 features in a database that has Cypher 5 as the default language, or to continue running your Cypher 5 queries on a database that has Cypher 25 as the default language. + +Queries run with Cypher 5 will eventually need to be updated to Cypher 25 as support for Cypher 5 will be discontinued in the future (anticipated no earlier than two additional server LTS cycles). +It is, therefore, recommended to set the default language to Cypher 25 and migrate the necessary queries to its supported syntax rather than prepending individual queries with a Cypher version. + +.Select the Cypher version for a query +[.tabbed-example] +===== +[.include-with-Cypher-25] +====== + +.Cypher 25 query on a Neo4j 2025.06+ database with Cypher 5 as default language +// tag::queries_select_version_cypher_25[] +[source,cypher] +---- +CYPHER 25 +MATCH (n:Order)-[r:SHIPPED_TO]->(:Address) +SET n = properties(r) +---- +// end::queries_select_version_cypher_25[] + +====== + +[.include-with-Cypher-5] +====== + +.Cypher 5 query on a Neo4j 2025.06+ database with Cypher 25 as default language +// tag::queries_select_version_cypher_5[] +[source,cypher] +---- +CYPHER 5 +MATCH (n:Order)-[r:SHIPPED_TO]->(:Address) +SET n = r +---- +// end::queries_select_version_cypher_5[] + +====== +===== + +Selecting `CYPHER 25` ensures that the query will be executed using Cypher 25 as it exists in the version of Neo4j that the database is currently running, provided it is on Neo4j 2025.06 or later. + +Selecting `CYPHER 5` ensures that the query will be executed using Cypher 5 as it existed at the time of the Neo4j 2025.06 release. +Any changes introduced after the 2025.06 release will not affect the query. + +[[procedures-and-functions]] +=== Procedures and functions + +link:{neo4j-docs-base-uri}/operations-manual/current/procedures[Procedures] and xref:functions/index.adoc[functions] (including built-in and link:{neo4j-docs-base-uri}/apoc/current/[APOC]) are tied to a specific Cypher language version. +Therefore, procedures and functions in Neo4j 2025.06+ and APOC 2025.06+ (both of which have Cypher 5 as their default language) may behave differently depending on what version of Cypher is used. + +For example, APOC 2025.06 removed Cypher 25 support of the procedure `apoc.create.uuids()`, meaning it is not available to queries running Cypher 25. +However, it can still be used on APOC 2025.06 if queries are prepended with `CYPHER 5`, or if the database’s default version is set to `CYPHER 5`. +In this case, Neo4j will use APOC and Cypher 5 as they existed at the time of the 2025.06 release. + +.Using a procedure removed in Cypher 25 with APOC 2025.06+ +[source, cypher] +---- +CYPHER 5 +CALL apoc.create.uuids(10) +---- + +[[cypher-selection-with-other-query-options]] +=== Combine Cypher version selection with other query options + +It is possible to combine Cypher version selection with other xref:planning-and-tuning/query-tuning.adoc[query options]. +The below example selects both the version and the xref:planning-and-tuning/runtimes/concepts.adoc[runtime] of Cypher for the same query: + +.Combining Cypher version selection with other query options +[source, cypher] +---- +CYPHER 5 runtime=parallel +MATCH (n:Person) +RETURN n.name +---- + diff --git a/modules/ROOT/pages/subqueries/subqueries-in-transactions.adoc b/modules/ROOT/pages/subqueries/subqueries-in-transactions.adoc index 2062b2802..f621bac94 100644 --- a/modules/ROOT/pages/subqueries/subqueries-in-transactions.adoc +++ b/modules/ROOT/pages/subqueries/subqueries-in-transactions.adoc @@ -220,7 +220,7 @@ For larger data sets, you might want to use larger batch sizes, such as `10000 R [[composite-databases]] == Composite databases -`CALL { ... } IN TRANSACTIONS` can be used with link:{neo4j-docs-base-uri}/operations-manual/current/composite-databases[composite databases]. +`CALL { ... } IN TRANSACTIONS` can be used with link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/concepts/[composite databases]. Even though composite databases allow accessing multiple graphs in a single query, only one graph can be modified in a single transaction. `CALL { ... } IN TRANSACTIONS` offers a way of constructing queries which modify multiple graphs. diff --git a/modules/ROOT/pages/syntax/parameters.adoc b/modules/ROOT/pages/syntax/parameters.adoc index 2ffe9de69..d236cb668 100644 --- a/modules/ROOT/pages/syntax/parameters.adoc +++ b/modules/ROOT/pages/syntax/parameters.adoc @@ -26,13 +26,15 @@ Parameters cannot be used for the following constructs, as these form part of th * Relationship types; `MATCH (n)-[:$param]->(m)` is invalid. * Node labels; `MATCH (n:$param)` is invalid. -Parameters may consist of letters and numbers, and any combination of these, but cannot start with a number or a currency symbol. +Parameter names can start with and contain underscores, letters, numbers, and combining marks such as accents (e.g., `é`). +Currency symbols (e.g., `$` and `€`), non-printable Unicode control characters that only affect formatting (e.g., `\t` for Tab), punctuation (e.g., `!`), and whitespaces are not allowed in any position of a parameter name. +For example, `$héllo`, `$0param`, and `$_param` are valid, while `$€value`, `$hello!`, and `$bad param` are not. Setting parameters when running a query is dependent on the client environment. For example: * To set a parameter in Cypher Shell use `+:param name => 'Joe'+`. - For more information refer to link:{neo4j-docs-base-uri}/operations-manual/current/tools/cypher-shell#cypher-shell-parameters[Operations Manual -> Cypher Shell - Query Parameters]. + For more information refer to link:{neo4j-docs-base-uri}/operations-manual/current/cypher-shell/#cypher-shell-parameters[Operations Manual -> Cypher Shell - Query Parameters]. * For Neo4j Browser use the same syntax as Cypher Shell, `+:param name => 'Joe'+`. * When using drivers, the syntax is dependent on the language choice. See the examples in _Transactions_ in the link:{docs-base-uri}[Neo4j Driver manuals]. diff --git a/modules/ROOT/pages/values-and-types/maps.adoc b/modules/ROOT/pages/values-and-types/maps.adoc index 8f3057faf..17972af15 100644 --- a/modules/ROOT/pages/values-and-types/maps.adoc +++ b/modules/ROOT/pages/values-and-types/maps.adoc @@ -16,7 +16,7 @@ For information about how the `[]` operator behaves with respect to `null`, see == Literal maps The key names in a map must be literals. -If returned through an link:{neo4j-docs-base-uri}/http-api/current[HTTP API call], a JSON object will be returned. +If returned through an link:{neo4j-docs-base-uri}/http-api/current/[HTTP API call], a JSON object will be returned. If returned in Java, an object of type `java.util.Map` will be returned. diff --git a/package-lock.json b/package-lock.json index e2fe81617..9d9055cee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cypher-manual", - "version": "5.0.0", + "version": "25", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "cypher-manual", - "version": "5.0.0", + "version": "25", "license": "ISC", "dependencies": { "@antora/cli": "^3.1.9",