cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Need help in cypher query for this required layout

I am new to Neo4j,

I am using this query to get the below layout in traversing the path

MATCH p = (r:Reports)<--(s:Schedules)<--(m:MDRMs)<--(br:Business_Requirements)-->(rp: Report_Logic)-->(ra: Reporting_layer_attributes)
where r.Report_Name ='FFIEC 031' and s.Schedule = 'RC-B - Securities' RETURN p

1.png

Blue coloured nodes are referred as Business_Requirements which have additional linked Silver coloured (Business_Attributes) nodes with relationship as MAPPED_TO . 

Please help me in bringing out the below layout through cypher query. Since the silver color nodes are not in the path, i was not able to pull the below required layout

2.png

1 ACCEPTED SOLUTION

ameyasoft
Graph Maven
Try this:

match (a:Schedules) where a.schedule = "RC-B - Securities"
CALL apoc.path.spanningTree(a, {maxLevel:5}) yield path
return path

View solution in original post

2 REPLIES 2

One approach to determine the silver nodes could be: extract the blue nodes from the path by label and then match those to the silver ones. Return these with your path. 

another approach is to use one of the apoc path procedures to get all the nodes. 

https://neo4j.com/labs/apoc/4.1/overview/apoc.path/

ameyasoft
Graph Maven
Try this:

match (a:Schedules) where a.schedule = "RC-B - Securities"
CALL apoc.path.spanningTree(a, {maxLevel:5}) yield path
return path