Skip to content

Commit 3e376a3

Browse files
cypher-constraints-indexes - Update to reflect changes in Neo4j (#428)
* update to reflect changes in Neo4j * post review change
1 parent 3c703be commit 3e376a3

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

asciidoc/courses/cypher-indexes-constraints/modules/2-constraints/lessons/01-constraint-overview/lesson.adoc

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
= Constraints in Neo4j
2-
:type: video
2+
:type: lesson
33
:order: 1
44
:sandbox: true
55

6-
[.video]
7-
video::N_m8Qb6vnfA[youtube,width=560,height=315]
6+
// [.video]
7+
// video::N_m8Qb6vnfA[youtube,width=560,height=315]
88

99
//https://youtu.be/N_m8Qb6vnfA
1010

@@ -13,15 +13,16 @@ video::N_m8Qb6vnfA[youtube,width=560,height=315]
1313

1414
A constraint is implemented internally as an index.
1515
It is used to constrain what is added to the graph.
16-
There are three types of constraints you can define:
1716

18-
* Uniqueness for a single node property value or a set of node property values.
19-
* Existence for a property of a node or relationship.
20-
* Existence and uniqueness for a node property value or a set of node property values (Node key).
17+
You can define link:https://neo4j.com/docs/cypher-manual/current/constraints/[different types of constraint^] that apply to nodes with a specific label or relationships of a type, including:
18+
19+
* Property uniqueness constraints - ensure that all values for a property are unique.
20+
* Property existence constraints - ensure that a property exists.
21+
* Key constraints - ensure that a combination of properties exists and is unique.
2122
2223
=== Uniqueness constraints
2324

24-
A uniqueness constraint can be defined for a property of a node with a given label.
25+
A uniqueness constraint can be defined for a property.
2526

2627
For example, in the Movie graph, we uniquely identify every Person node.
2728
To do this, we identify a property whose value will be unique for all nodes with the Person label.
@@ -128,11 +129,11 @@ RETURN p
128129

129130
You will learn how to create and test an existence constraint later in this module.
130131

131-
=== Node key constraint
132+
=== Key constraint
132133

133-
A node key is a specialized type of constraint in the graph that enables you to define a set of properties for a node label that must:
134+
A key is a specialized type of constraint in the graph that enables you to define a set of properties for a node label or relationship type that must:
134135

135-
. Exist for all nodes with that label.
136+
. Exist for all nodes or relationships with that label or type.
136137
. Be unique for all values.
137138

138139
For example, suppose you want to ensure that all Person nodes in the graph have unique values for Person.name and Person.tmdbId.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
[.question]
22
= 1. What type of constraint can you define to ensure a _set of property values_ is unique?
33

4-
* [ ] Uniqueness on a node property.
4+
* [ ] Uniqueness on a property.
55
* [ ] Uniqueness on a set of relationship type properties.
6-
* [x] Node key for a set of properties of a node label.
7-
* [ ] Uniqueness key for a set of properties of a node label.
6+
* [x] Key constraint for a set of properties.
7+
* [ ] Uniqueness key for a set of properties.
88
99
[TIP,role=hint]
1010
.Hint
1111
====
12-
There is one construct used to uniquely identify property values for a set of node labels.
12+
There is one construct used to uniquely identify property values.
1313
====
1414

1515
[TIP,role=solution]
1616
.Solution
1717
====
18-
A Node key is used to ensure that a set of property values for all nodes of that label type are unique in the graph.
18+
A key constraint is used to ensure that a set of property values for all nodes or relationships of that label or type are unique in the graph.
1919
====
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
[.question]
2-
= 2. What type of constraint can be created for node properties or relationship properties?
2+
= 2. What type of constraint can be created?
33

4-
* [ ] Node key
5-
* [ ] Uniqueness
4+
* [x] Key
5+
* [x] Uniqueness
66
* [x] Existence
77
* [ ] IS NULL
88
99
[TIP,role=hint]
1010
.Hint
1111
====
12-
There is only one type of constraint that you can define on node properties or relationship properties.
12+
You cannot create a constraint to ensure a property doesn't exist.
1313
====
1414

1515
[TIP,role=solution]
1616
.Solution
1717
====
18-
The correct answer is Existence constraint.
18+
The correct answer are Key, Uniqueness, and Existence.
1919
====

0 commit comments

Comments
 (0)