Skip to content

Commit ab80e08

Browse files
Restructure Constraints section (#1041)
Cheat sheet PR: neo4j/docs-cheat-sheet#196 Ops Manual PR: neo4j/docs-operations#1874 --------- Co-authored-by: Therese Magnusson <[email protected]>
1 parent 42f1457 commit ab80e08

File tree

16 files changed

+1964
-3306
lines changed

16 files changed

+1964
-3306
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494
** xref:indexes/syntax.adoc[]
9595
9696
* xref:constraints/index.adoc[]
97+
** xref:constraints/managing-constraints.adoc[]
9798
** xref:constraints/syntax.adoc[]
98-
** xref:constraints/examples.adoc[]
9999
100100
* xref:planning-and-tuning/index.adoc[]
101101
** xref:planning-and-tuning/execution-plans.adoc[]

modules/ROOT/pages/appendix/gql-conformance/additional-cypher.adoc

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -509,29 +509,17 @@ GQL supports `GRAPH TYPES` as a way of constraining a graph schema, but does not
509509
| Cypher feature
510510
| Description
511511

512-
| xref:constraints/examples.adoc#constraints-examples-node-uniqueness[Node property uniqueness constraints]
513-
| Ensures that certain nodes have a set of specified properties whose combined value is unique when all properties exist on the node
512+
| xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[Property uniqueness constraints]
513+
| Ensures that the combined property values are unique for all nodes with a specific label or all relationships with a specific type.
514514

515-
| xref:constraints/examples.adoc#constraints-examples-relationship-uniqueness[Relationship property uniqueness constraints]
516-
| Ensures that certain relationships have a set of specified properties whose combined value is unique when all properties exist on the relationship.
515+
| xref:constraints/managing-constraints.adoc#create-property-existence-constraints[Property existence constraints]
516+
| Ensures that a property exists either for all nodes with a specific label or for all relationships with a specific type.
517517

518-
| xref:constraints/examples.adoc#constraints-examples-node-property-existence[Node property existence constraints]
519-
| Ensures that certain nodes have a specified property.
518+
| xref:constraints/managing-constraints.adoc#create-property-type-constraints[Property type constraints]
519+
| Ensures that a property has the required property type for all nodes with a specific label or for all relationships with a specific type.
520520

521-
| xref:constraints/examples.adoc#constraints-examples-relationship-property-existence[Relationship property existence constraints]
522-
| Ensures that certain relationships have a specified property.
523-
524-
| xref:constraints/examples.adoc#constraints-examples-node-property-type[Node property type constraints]
525-
| Ensures that certain nodes have a property of the required property type when the property exists on the node.
526-
527-
| xref:constraints/examples.adoc#constraints-examples-relationship-property-type[Relationship property type constraints]
528-
| Ensures that certain relationships have a property of the required property type when the property exists on the relationship.
529-
530-
| xref:constraints/examples.adoc#constraints-examples-node-key[Node key constraints]
531-
| Ensures that certain nodes have a set of specified properties whose combined value is unique and all properties in the set are present.
532-
533-
| xref:constraints/examples.adoc#constraints-examples-relationship-key[Relationship key constraints]
534-
| Ensures that certain relationships have a set of defined properties whose combined value is unique. It also ensures that all properties in the set are present.
521+
| xref:constraints/managing-constraints.adoc#create-key-constraints[Key constraints]
522+
| 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.
535523

536524
|===
537525

modules/ROOT/pages/clauses/load-csv.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,12 +601,12 @@ For more `STRING` manipulation functions, see xref:functions/string.adoc[String
601601

602602
== Recommendations
603603

604-
=== Create uniqueness constraints
604+
=== Create property uniqueness constraints
605605

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

609-
.Create xref:constraints/examples.adoc#constraints-examples-node-uniqueness[node property uniqueness constraints] on person ID
609+
.Create a node property uniqueness constraints on person ID
610610
====
611611
612612
.persons.csv

modules/ROOT/pages/clauses/merge.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ If partial matches are needed, this can be accomplished by splitting a pattern i
2525
[NOTE]
2626
====
2727
Under concurrent updates, `MERGE` only guarantees the existence of the `MERGE` pattern, but not uniqueness.
28-
To guarantee uniqueness of nodes with certain properties, a xref::constraints/index.adoc[property uniqueness constraint] should be used.
28+
To guarantee uniqueness of nodes with certain properties, a xref:constraints/managing-constraints.adoc#create-property-uniqueness-constraints[property uniqueness constraint] should be used.
2929
See xref::clauses/merge.adoc#query-merge-using-unique-constraints[Using property uniqueness constraints with `MERGE`].
3030
====
3131

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

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

517517
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.

modules/ROOT/pages/clauses/optional-match.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ For example, the matching variables from one `MATCH` clause will provide the con
5454
However, there are two important differences between Neo4j and SQL which helps to explain `OPTIONAL MATCH` further.
5555

5656
. 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.
57-
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 existence constraint created on the specific property).
57+
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).
5858

5959
. Queries in Cypher are run as pipelines.
6060
If a clause returns no results, it will effectively end the query as subsequent clauses will have no data to execute upon.

0 commit comments

Comments
 (0)