I am starting to use py2neo and tried to work on some sample data sets. Here is (simplified) original set of queries:
CREATE (Ann:person{name:'Ann',gender:'female'})
CREATE (Target:store{name:'Target',location:'New York'})
CREATE (Ann)-[:PURCHASED {amount:'100',status:'denied'}]->(Target)
In py2neo I tried this:
ann,=graph_db.create(node({name:'Ann',gender:'female'}))
ann.add_labels("person")
target,=graph_db.create(node({name:'Target',location:'New York'}))
target.add_labels("merchant")
(ann,"PURCHASED",target,{'amount':'100', 'status':'denied'})
This query returns
(Node('http://localhost:7474/db/data/node/0'),
'PURCHASED',
Node('http://localhost:7474/db/data/node/3'),
{'amount': '100', 'status': 'denied'})
I have a lot of different users, so I wanted to find all of them whose transactions were denied
query_string="""
MATCH (customer:person)-[r:PURCHASED]->(merchant)
WHERE r.status = "denied"
RETURN customer.name as customer_name
"""
Then I try to execute it
result = neo4j.CypherQuery(graph_db, query_string).execute()
It returns an empty object. What am I doing wrong?