Sample Data:
CREATE (n:Node {node_id : 'node-1'});
CREATE (n:Node {node_id : 'node-2'});
CREATE (n:Node {node_id : 'node-3'});
MATCH (s:Node {node_id: 'node-1'}), (d:Node {node_id: 'node-2'}) CREATE (s)-[:HAS_RELATION {relation_id: 'r1'}]->(d);
MATCH (s:Node {node_id: 'node-1'}), (d:Node {node_id: 'node-2'}) CREATE (s)-[:HAS_RELATION {relation_id: 'r2'}]->(d);
MATCH (s:Node {node_id: 'node-2'}), (d:Node {node_id: 'node-3'}) CREATE (s)-[:HAS_RELATION {relation_id: 'r1'}]->(d);
MATCH (s:Node {node_id: 'node-2'}), (d:Node {node_id: 'node-3'}) CREATE (s)-[:HAS_RELATION {relation_id: 'r2'}]->(d);
Goal
Searching for all the paths with relation_id: r1
(we're not interested in any other relations in the returned path)
Query
MATCH p=(s:Node)-[r:HAS_RELATION*1..10]->(d:Node)
WHERE s.node_id = "node-1" AND ALL (r IN relationships(p) WHERE r.relation_id = 'r1')
RETURN DISTINCT p
Problem
Although the returned graph shows that it returns all paths, the result data only contains relations with relation_id: r1.
Is there any reason for this ? I mean since it might be misleading, is there any way to only show the returned paths in the result ?
Thanks