Skip to content
Draft
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
54cab09
up to set graph type on a populated database
JPryce-Aklundh Sep 18, 2025
b226603
constraints slice, graph type set, add and alter
JPryce-Aklundh Sep 22, 2025
3315534
show and drop
JPryce-Aklundh Sep 22, 2025
f598cc9
add show constraints details
JPryce-Aklundh Sep 22, 2025
e625176
syntax, fixes, and additions
JPryce-Aklundh Sep 23, 2025
5f55cae
post-review corrections (non-graph types pages)
JPryce-Aklundh Sep 23, 2025
462834c
post-review corrections 2 (syntax page)
JPryce-Aklundh Sep 24, 2025
e0ae07f
rename alter and fix prefered wording
JPryce-Aklundh Sep 24, 2025
6f44951
preferred variants
JPryce-Aklundh Sep 24, 2025
024aaa2
post review corrections 3 (more syntax)
JPryce-Aklundh Sep 24, 2025
51142ac
post review corrections 4 (main graph types pages)
JPryce-Aklundh Sep 25, 2025
bf58dc3
forgotten DROP improvements
JPryce-Aklundh Sep 25, 2025
463f2f8
fix formatting
JPryce-Aklundh Sep 25, 2025
85613b8
table formatting
JPryce-Aklundh Sep 25, 2025
a8da38e
additional entry on additions page
JPryce-Aklundh Sep 25, 2025
b70d620
post review corrections 5 (misc)
JPryce-Aklundh Sep 25, 2025
beac214
add page aliases (given similar restructure in 5 manual)
JPryce-Aklundh Sep 26, 2025
450b90b
cheat sheet tags
JPryce-Aklundh Sep 30, 2025
7c975eb
fix incorrect tags
JPryce-Aklundh Sep 30, 2025
631cb3f
Update modules/ROOT/pages/schema/graph-types/alter-element-types.adoc
rsill-neo4j Oct 2, 2025
ba55ab6
Merge branch 'dev' into graph-types
rsill-neo4j Oct 2, 2025
7ebebbb
Apply suggestions from code review
rsill-neo4j Oct 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions modules/ROOT/content-nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,18 @@
*** xref:indexes/semantic-indexes/vector-indexes.adoc[]
** xref:indexes/syntax.adoc[]

* xref:constraints/index.adoc[]
** xref:constraints/managing-constraints.adoc[]
** xref:constraints/syntax.adoc[]
* xref:schema/index.adoc[]
** xref:schema/graph-types/index.adoc[]
*** xref:schema/graph-types/set-graph-types.adoc[]
*** xref:schema/graph-types/extend-graph-types.adoc[]
*** xref:schema/graph-types/alter-element-types.adoc[]
*** xref:schema/graph-types/list-graph-types.adoc[]
*** xref:schema/graph-types/drop-graph-type-elements.adoc[]
** xref:schema/constraints/index.adoc[]
*** xref:schema/constraints/create-constraints.adoc[]
*** xref:schema/constraints/list-constraints.adoc[]
*** xref:schema/constraints/drop-constraints.adoc[]
** xref:schema/syntax.adoc[]

* xref:planning-and-tuning/index.adoc[]
** xref:planning-and-tuning/execution-plans.adoc[]
Expand Down
32 changes: 32 additions & 0 deletions modules/ROOT/images/graph-types-alter-graph-type.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions modules/ROOT/images/graph-types-data-in-database.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions modules/ROOT/images/graph-types-data-model.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions modules/ROOT/images/graph-types-element-type-constraints.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions modules/ROOT/images/graph-types-extend-graph-type.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions modules/ROOT/images/graph-types-node-element-type.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions modules/ROOT/images/graph-types-relationship-element-type.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -616,16 +616,16 @@ GQL supports `GRAPH TYPES` as a way of constraining a graph schema, but does not
| Cypher feature
| Description

| xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[Property uniqueness constraints]
| xref:schema/constraints/create-constraints.adoc#create-property-uniqueness-constraints[Property uniqueness constraints]
| Ensures 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]
| xref:schema/constraints/create-constraints.adoc#create-property-existence-constraints[Property existence constraints]
| Ensures that a property exists either for all nodes with a specific label or for all relationships with a specific type.

| xref:constraints/managing-constraints.adoc#create-property-type-constraints[Property type constraints]
| xref:schema/constraints/create-constraints.adoc#create-property-type-constraints[Property type constraints]
| Ensures that a property has the required property type for all nodes with a specific label or for all relationships with a specific type.

| xref:constraints/managing-constraints.adoc#create-key-constraints[Key constraints]
| xref:schema/constraints/create-constraints.adoc#create-key-constraints[Key constraints]
| Ensures 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.

|===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ Predicates that will not work:

[NOTE]
====
If there is a xref:constraints/managing-constraints.adoc#create-property-existence-constraints[property existence constraint] on the property, no predicate is required to trigger the optimization.
If there is a xref:schema/constraints/create-constraints.adoc#create-property-existence-constraints[property existence constraint] on the property, no predicate is required to trigger the optimization.
For example, `CREATE CONSTRAINT constraint_name FOR (p:Person) REQUIRE p.name IS NOT NULL`

Predicates with parameters, such as `WHERE n.prop > $param`, can trigger _index-backed ORDER BY_.
Expand Down
4 changes: 2 additions & 2 deletions modules/ROOT/pages/clauses/delete.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ DETACH DELETE n
Deleted 3 nodes, deleted 1 relationship
----

`DETACH DELETE` is useful when experimenting with small example datasets, but it is not suitable for deleting large amounts of data, nor does it delete xref:indexes/search-performance-indexes/index.adoc[indexes] and xref:constraints/index.adoc[constraints].
`DETACH DELETE` is useful when experimenting with small example datasets, but it is not suitable for deleting large amounts of data, nor does it delete xref:indexes/search-performance-indexes/index.adoc[indexes] or any xref:schema/index.adoc[schema].

To delete large amounts of data without deleting indexes and constraints, use xref::subqueries/subqueries-in-transactions.adoc#delete-with-call-in-transactions[CALL subqueries in transactions] instead.
To delete large amounts of data without deleting indexes and any schema, use xref::subqueries/subqueries-in-transactions.adoc#delete-with-call-in-transactions[CALL subqueries in transactions] instead.

.Delete all nodes and relationships using `CALL` subqueries
[source, cypher]
Expand Down
15 changes: 11 additions & 4 deletions modules/ROOT/pages/clauses/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -266,10 +266,10 @@ m| xref::indexes/search-performance-indexes/index-hints.adoc#query-using-join-hi

|===

[[index-and-constraint-clauses]]
== Index and constraint clauses
[[index-and-schema-clauses]]
== Index and schema clauses

These comprise clauses to create, show, and drop indexes and constraints.
These comprise clauses to manage indexes, constraints, and graph types.

[options="header"]
|===
Expand All @@ -278,8 +278,15 @@ These comprise clauses to create, show, and drop indexes and constraints.
m| xref:indexes/syntax.adoc[CREATE \| SHOW \| DROP INDEX]
| Create, show or drop an index.

m| xref::constraints/syntax.adoc[CREATE \| SHOW \| DROP CONSTRAINT]
m| xref::schema/syntax.adoc#constraints[CREATE \| SHOW \| DROP CONSTRAINT]
| Create, show or drop a constraint.

m| xref::schema/syntax.adoc#graph-types[ALTER CURRENT GRAPH TYPE SET \| ADD \| ALTER \|DROP]
| Set, extend, alter or drop elements in a graph type.

m| xref::schema/syntax.adoc#list-graph-types[SHOW CURRENT GRAPH TYPE]
| Show the full graph type.

|===

[[administration-clauses]]
Expand Down
2 changes: 1 addition & 1 deletion modules/ROOT/pages/clauses/load-csv.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ For more `STRING` manipulation functions, see xref:functions/string.adoc[String

=== Create property uniqueness constraints

Always create xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[property uniqueness constraints] prior to importing data, to avoid duplicates or colliding entities.
Always create xref:schema/constraints/create-constraints.adoc#create-property-uniqueness-constraints[property uniqueness constraints] prior to importing data, to avoid duplicates or colliding entities.
If the source file contains duplicated data and the right constraints are in place, Cypher raises an error.

.Create a node property uniqueness constraints on person ID
Expand Down
4 changes: 2 additions & 2 deletions modules/ROOT/pages/clauses/merge.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ If partial matches are needed, this can be accomplished by splitting a pattern i
[NOTE]
====
Under concurrent updates, `MERGE` only guarantees the existence of the `MERGE` pattern, but not uniqueness.
To guarantee uniqueness of nodes with certain properties, a xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[property uniqueness constraint] should be used.
To guarantee uniqueness of nodes with certain properties, a xref:schema/constraints/create-constraints.adoc#create-property-uniqueness-constraints[property uniqueness constraint] should be used.
See xref::clauses/merge.adoc#query-merge-using-unique-constraints[Using property uniqueness constraints with `MERGE`].
====

Expand Down Expand Up @@ -512,7 +512,7 @@ This is in contrast to the example shown above in xref::clauses/merge.adoc#merge
[[query-merge-using-unique-constraints]]
== Using node property uniqueness constraints with `MERGE`

Cypher prevents getting conflicting results from `MERGE` when using patterns that involve xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[property uniqueness constraints].
Cypher prevents getting conflicting results from `MERGE` when using patterns that involve xref:schema/constraints/create-constraints.adoc#create-property-uniqueness-constraints[property uniqueness constraints].
In this case, there must be at most one node that matches that pattern.

For example, given two property node uniqueness constraints on `:Person(id)` and `:Person(ssn)`, a query such as `MERGE (n:Person {id: 12, ssn: 437})` will fail, if there are two different nodes (one with `id` 12 and one with `ssn` 437), or if there is only one node with only one of the properties.
Expand Down
2 changes: 1 addition & 1 deletion modules/ROOT/pages/clauses/optional-match.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ For example, the matching variables from one `MATCH` clause will provide the con
However, there are two important differences between Neo4j and SQL which helps to explain `OPTIONAL MATCH` further.

. While it is both possible and advised to enforce partial schemas using indexes and constraints, Neo4j offers a greater degree of schema flexibility than a relational database.
Nodes and relationships in a Neo4j database do not have to have a specific property set to them because other nodes or relationships in the same graph have that property (unless there is a xref:constraints/managing-constraints.adoc#create-property-existence-constraints[property existence constraint] created on the specific property).
Nodes and relationships in a Neo4j database do not have to have a specific property set to them because other nodes or relationships in the same graph have that property (unless there is a xref:schema/constraints/create-constraints.adoc#create-property-existence-constraints[property existence constraint] created on the specific property).

. Queries in Cypher are run as pipelines.
If a clause returns no results, it will effectively end the query as subsequent clauses will have no data to execute upon.
Expand Down
16 changes: 0 additions & 16 deletions modules/ROOT/pages/constraints/index.adoc

This file was deleted.

Loading