How to get Relationship properties values in Neo4J

Access Relationship Property Value NEO4J using PY2NEO:

Hello Tech Lovers, I hope you are doing well. Do you want to access the values of the Relationship properties in the Neo4J?

I am going to show you how you can fetch relation values in GraphDB (Neo4J) using Py2Neo.

Must Read: How to use existing IAM.Role in AWS CDK?

Let’s say we have 2 Nodes “NodeOne” and “NodeTwo” and the relation between them is “Relation”. Now we have property “count” in the relationship.

And count has some value and we want to access this value and store it in the variable for use in the rest of the program.

Neo4J Query to access the Relationship property value in GraphDB using Py2Neo:

query = "MATCH (e:NodeOne {property: 'value'}) Match (s:NodeTwo {property: 'value'}) Match (e)-[r:Relation]->(s) return r.count"
response =
CountRelation = response[0]["r.count"]

Must Read: How to create Custom Exit Dialog in Android Studio?

Leave a Reply