I just installed Neo4j ( I am new to that), and I was following the "Movie Graph" examples. However, it seems that either the examples are incorrect, the database is incorrect, or there is some other error, as I get an error. Here is a screenshot:
When I click on the example query on the left I get the error on the right!
I appreciate if that can be fixed.
Hi @alexander.dietz ,
Good catch! That guide could be improved to illustrate potential errors. In this case, the constraint failure indicates that it is not possible to assert the uniqueness of Movies based on the title of the movie, because more than one node has that title.
To check that this is the case, you could run this query:
RETURN m.title, count(m)
The result will be a table of movie titles along with a count of how many movies have that title. All movies should have a count of 1. If the counts are more than 1 then it is possible that the data set creation was run more than once in the previous step of the guide.
To "reset" the database to an empty state, you can use this query to find all nodes and delete the nodes plus any existing relationships:
MATCH (n) DETACH DELETE n
After running that, you could repeat the guide from the beginning.
The guide could be improved in a few different ways. Which of these do you think would be more helpful?
- create constraints before creating the data to avoid duplication
- add information about the potential duplication and what to do about it
- change the data creation to use a more advanced "upsert" style to avoid duplication
- other suggestions?
Hope this helps