MATCH (s:Bus{bus_no:14}), (l:Bus{bus_no:12})
CALL algo.shortestPath.stream(s, l, "length")
YIELD nodeId,cost
with collect(nodeId) as q
MATCH p= (a)-[r:TRANSMISSION_LINE]-(b)
where id(a)in q and id(b) in q
with distinct(r) as rls
return collect(rls) as e
This query returns a list of relationships.
Every relationship has a property called available_cap. l is a node having a property called load
i want to do
for every rls in e
if rls.availale_cap > l.load then print( 'ok you can connect')
else print ('you should not connect')
You want a case statement. So the if statement turns into something like this:
MATCH (s:Bus{bus_no:14}), (l:Bus{bus_no:12})
CALL algo.shortestPath.stream(s, l, "length")
YIELD nodeId,cost
with collect(nodeId) as q
MATCH p= (a)-[r:TRANSMISSION_LINE]-(b)
where id(a)in q and id(b) in q
with distinct(r) as rls
RETURN
CASE
WHEN rls.availale_cap > l.load THEN 'okay you can connect'
ELSE 'you should not connect' END AS status
I'm not sure exactly how you want to use this or how you want the results formatted, but the above should return one row per rls with a single 'status' column which has one of the two print statements.
For more information on case statements, you can check out the Expressions section of the Cypher manual and go to 2.3.3 CASE expressions.