You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/movies.workspace.adoc
+3-16
Original file line number
Diff line number
Diff line change
@@ -35,6 +35,9 @@ image::movie-model.png[]
35
35
36
36
[source,cypher]
37
37
----
38
+
CREATE CONSTRAINT movie_title IF NOT EXISTS FOR (m:Movie) REQUIRE m.title IS UNIQUE;
39
+
CREATE CONSTRAINT person_name IF NOT EXISTS FOR (p:Person) REQUIRE p.name IS UNIQUE;
40
+
38
41
MERGE (TheMatrix:Movie {title:'The Matrix'}) ON CREATE SET TheMatrix.released=1999, TheMatrix.tagline='Welcome to the Real World'
39
42
40
43
MERGE (Keanu:Person {name:'Keanu Reeves'}) ON CREATE SET Keanu.born=1964
@@ -699,22 +702,6 @@ MATCH path = (person)-[:ACTED_IN]->(m)<-[:DIRECTED]-(d)
699
702
RETURN path;
700
703
----
701
704
702
-
To aid query performance, you can add indexes to your data.
703
-
(The dataset you create in this guide is very small, but it is good practice to use indexes as they can greatly improve query performance when the datasets are larger.)
704
-
705
-
In this small dataset, you are mainly interested in names of people and titles of movies.
706
-
Run the following to add indexes on these properties
707
-
708
-
[source,cypher]
709
-
----
710
-
CREATE INDEX person_name FOR (p:Person) ON (p.name);
711
-
CREATE INDEX movie_title FOR (m:Movie) ON (m.title)
712
-
----
713
-
714
-
Note that you can also add constraints to your data to ensure uniqueness for example.
715
-
Adding constraints automatically adds a correpsonding index.
716
-
See link:https://neo4j.com/docs/cypher-manual/current/constraints/[Cypher Manual -> Constraints^] for more information.
717
-
718
705
In the next step, you will look for nodes and their properties.
0 commit comments