0
votes

I started learning Neo4j Cypher. I am using Neo4j Sample Movie Graph Database.

Below is the Cypher I written and expecting Cypher to return result 1964 but its retruning NULL value.

Will you please let me know.

MATCH (tom:Person) where tom.Name ="Tom Hanks" return tom.born; Going through Neo4j Tutorial I found that Relationship is having property.When i run below query it also result in NULL. Where as i am expecting Relationship "ACTED_IN" is having proprty role. So it should return value "role".

match (:Person {name:'Keanu Reeves'})-[rel]->(M) RETURN M.title,rel.property;

Thanks in advance.

Regards Faizan

1
MATCH (per:Person {Name:"Tom Hanks"}) return per.born; also written cypher to get born year for Tom Hanks but query return null. But when I am writing Reverse cypher i.e. Giving born year and able to fetch name. here is cypher MATCH (per:Person {born:1964}) return per.name;. So Why I am Getting NULL when I am writing Name try to find out year of born.Faiz

1 Answers

2
votes

Properties are case sensitive. You are using Name when the property is name. Try:

MATCH (tom:Person) WHERE tom.name = "Tom Hanks" RETURN tom.born;

For the other query, property is not a property on the :ACTED_IN relationship. It is called roles. Try:

MATCH (:Person {name:'Keanu Reeves'})-[rel]->(M) 
RETURN M.title, rel.roles;

If you want the keys of the properties on that relationship:

MATCH (:Person {name:'Keanu Reeves'})-[rel]->(M) 
RETURN M.title, KEYS(rel);