Created
December 2, 2019 16:34
-
-
Save vladbatushkov/b30c0397cf85af6def4d29cd95f4028c to your computer and use it in GitHub Desktop.
Iterative flights
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH { date: "20200101" } as params | |
UNWIND [[{code: 'BKK'}, { code: 'KIX'}], [ { code: 'KIX'}, {code: 'LAX'}]] as pair | |
CALL apoc.cypher.run("MATCH (ad:AirportDay { code: \"" + pair[0].code + "_" + params.date + "\" })-[:" + pair[0].code + "_FLIGHT]->(f:Flight)-[:" + pair[0].code + "_FLIGHT]->(bd:AirportDay { code: \"" + pair[1].code + "_" + params.date + "\" }) MATCH (f)-[:OPERATED_BY]->(a:Airline) RETURN f as flight, a as company, ($pair[0].code + $pair[1].code) as key", { pair: pair }) yield value | |
WITH pair, collect(distinct value) as flights | |
RETURN * |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment