How can I use a subquery to translate airport code DAL into icao airport code KDAL, w air-routes?
I've loaded the air-routes data set, and I've added an aircraft like so:
g.addV("aircraft").property("aircraftLocation", "DAL")
I want to write a query that reports the location of all my aircrafts like so: [tailNumber:N12345,aircraftLocationIcao:KDAL]
To accomplish this, I need to translate the IATA aircraft location "DAL" into the ICAO aircraft location "KDAL". So the .project() step is not straightforward.
How can I accomplish this? Details of what I've already tried in thread: 🧵2 Replies
I intend to use the station properties named
code
and icao
to do this translation:
So I need to do a cross join on the aircrafts and the airports, and then pick a property from the right "table"
SELECT ac.tailNumber, ap.icao
FROM aircrafts ac
CROSS JOIN airports ap
WHERE ac.tailLocation = ap.code
^ this is a SQL pseudocode for what I'm trying to do
I have this query, which uses double .V()
, is this best practices?
I'm using Neptune, will this query be efficient on Neptune?
For background, I need this to be fast with around 850 aircraft and multiple thousands of airportsHi @danielcraig23, I might try to search for the the specific airports with the necessary iata->icao mapping instead of the "cross join then filter" approach. This is the traversal I came up with:
In my very small scale testing I'm seeing this run about an order of magnitude faster than the "cross join then filter" approach.