In Neo4j I have the following database:
node1-[:link {prop: a}]->node2-[:link {prop: a}]->node3-[:link {prop: a}]->node4
node1-[:link {prop: b}]->node2-[:link {prop: b}]->node3
node1-[:link {prop: c}]->node2-[:link {prop: c}]->node3
I would like to return node1, node2, node3, node4 with only the relationships that have the property {prop: a}. the cypher I have tried as as follows:
MATCH (n1)-[r:link {prop: 'a'}]-(n2)
RETURN n1, r, n2
The problem is that it also returns me all the relationships in between the nodes that are not {prop: a}. How do I return only the relationships with said property?