After running the cypher code for the exercise "Transform Strings to Lists"
the validation failed. I assumed it was a mistake of mine, so after a couple more tries I re-did the exercise running the cypher code from the solution instead of typing my own, and it still failed to validate the results. No idea why it fails, as all I have is "No rows returned by verification Cypher".
Hello @nsousa ,
Welcome to the Neo4j Community.
Did you successfully import the data using the Data Importer app? Did it verify?
The validate code for this Challenge does a check of a particular node:
MATCH (m:Movie {movieId: 10}) RETURN size(m.languages) + size(m.countries) + size(m.genres) = 8 AS outcome
outcome should return true
Ah! movieId! My import had a different key name. Odd it validated the import, though. Maybe the import validation only counted nodes and checked some properties, but not others. Reimported with the id name change and it all went fine now.
Thanks!
But now I have another failed test, in the last exercise. And this time... I ran the solution. Dropped every node, every relationship, every constraint. Then ran the solution code. And it still fails. One thing I noticed, though: the number of Person properties created is 152376, but the text says it should be 119195. Given that we have 19047 nodes the result I see is exactly 8 properties set per node, whereas the expected in the text is lower . Does the validation count properties of some nodes? Do you know what query checks the validity of the results?
Since the LOAD statements use MERGE, I suggest you rerun all LOAD CSV code to make sure that all nodes/properties/relationships are loaded. Using MERGE for the load will not duplicate data in the graph.
Here is the code we use to check if the graph is valid after the load:
MATCH (p:Person {tmdbId: 31})-[r:ACTED_IN]->(m:Movie {movieId: 1})
WHERE
p.imdbId = 158
AND p.poster = 'https://image.tmdb.org/t/p/w440_and_h660_face/mKr8PN8sn80LzVaZMg8L52kmakm.jpg'
AND p.url = 'https://themoviedb.org/person/31'
AND m.tmdbId = 862
AND m.imdbId = 114709
AND m.poster = 'https://image.tmdb.org/t/p/w440_and_h660_face/uXDfjJbdP4ijW5hWSBrPrlKpxab.jpg'
AND m.url ='https://themoviedb.org/movie/862'
AND r.role = 'Woody (voice)'
WITH m.budget + m.imdbRating + m.imdbVotes + m.revenue + m.runtime + m.year = 404147953.3 AS actedCheck
MATCH (p:Person {tmdbId: 1032})-[:DIRECTED]->(m:Movie {movieId: 16})
WITH actedCheck, count(*) = 1 AS directedCheck
MATCH (p:User {userId: 294})-[r:RATED]->(m:Movie {movieId: 1})
WITH actedCheck, directedCheck, r.rating + r.timestamp = 1047071653 as ratedCheck
MATCH (m:Movie {movieId: 10})-[:IN_GENRE]->(g:Genre)
WITH size(m.languages) + size(m.countries) = 5 AS listCheck, actedCheck, directedCheck, ratedCheck, count(g) = 3 as genreCheck
RETURN actedCheck AND directedCheck AND ratedCheck AND genreCheck as outcome
Thanks for your help. I had two things wrong in my import: didn't cast Person's imdbId to integer, didn't cast ratings to integer. Which is why I failed the exercise (it serves me well for typing code instead of clicking the "run in sandbox" button).
But I did run the code of the solution that you get once you try, fail, get the hint and fail again, and the solution isn't casting some properties either: movie.tmdbId, movie.imdbId and person.imdbId are imported as strings. Which is why I wasn't succeeding even after deleting it all from the database and just running the solution.
The problem is that the MERGE only updates the graph when the node is created. If the node is matched, it will not update the property.
I recommend that you start from scratch again with the graph.