I am relatively new to Cypher and neo4j and and was playing with a simple scenario with 2 bus stops 1) BusStop1 1- [:Next]- BusStop 2 (i.e 2 Bus Stop node with a relation Next between them.
2) Number 35 node is related to BusStop1 and BusStop2 with a Relationship (STOPS_AT) . So if i query minimum path between BusStop1 and BusStop2 i get the busstops and the bus 35 that can be used to travel.
3) Number35 node is also related to Company XYz with a relationship OPERATED_BY, so i know the company XYZ is the one running Bus Number 35.
My Problem begins with once i get the node list in EXTRACT i have a WHEN case for the busstops and Number 35, but then how do i travel to Company XYZ inside the WHEN case
MATCH p = allShortestPaths((a)-[:STOPS_AT*]-(d)) (---works fine---)
RETURN EXTRACT(x IN NODES(p) | CASE WHEN x:Bus THEN 'Bus ' + x.id
(((----At this point when the node is a bus number i need to also traverse the relationship to its Operator ?????? how ))) ,
WHEN x:BusStop THEN 'BusStop ' + x.name