Tasks

  1. Create Cosmos DB database with Graph API
  2. Open CosmosDB-Graph-Generator and add data to your database according to instruction.
  3. Your database contains information about 46 airports. Please:
    1. list all airports in database
    2. select your favourite one and show:
      1. all details about this airport
      2. information about on which continent this airport is located
      3. how many outbound connections are available from that airport
      4. please list airport to which we can fly from this airport
      5. provide information on how many runways has this airport
      6. and also the length of the longest runway
    3. choose the second airport and check:
      1. how you can fly from your favourite airport to second one – only direct fly
      2. what is the distance between those two airports
      3. please provide five alternative routes between those two airports

Presented queries

Present all data
g.V()
Present only continents
g.V().hasLabel("continent")
Count all continents in database
g.V().hasLabel("continent").Count()
The list of sorted continents
g.V().hasLabel('continent').order().by('Name')

g.V().hasLabel('continent').order().by('Name', decr)
Return all the properties and values the Wroclaw airport has
g.V().has('City','Wroclaw').valueMap()
Return selected fields from a value map
g.V().has('City','Wroclaw').valueMap().select('Code', 'ICAO', 'Description')
List of airports in the USA
g.V().has('Name', 'United States').out('contains')
List of airports in the USA – projection
g.V().has('Name', 'United States').out('contains').values('City')
List of airports in the USA that have more than five runways
g.V().has('Name', 'United States').out('contains').has('NumberOfRunways',gt(5))
Total number runways of all airports
g.V().hasLabel('airport').values('NumberOfRunways').sum()
List of outbound flights from Atlanta
g.V().has('City', 'Atlanta').outE('route')

g.V().has('airport', 'City', 'Atlanta').out('route').values('Code').fold()
Number of routes available from Wrocław
g.V().has('airport','Code','WRO').out().count()
Is there direct flight between Warsaw and London
g.V().has('City','Warsaw').out('route').has('City', 'London')
Distance between Warsaw and London
g.V().has('Code','WAW').outE().as('e').inV()
  .has('Code','LHR').select('e').values('Distance')
Flights from London Heathrow (LHR) to airports in the USA
g.V().has('Code','HR').out('route').has('Country','US').values('Code')
Routes between BNA (Nashville) and IAH (Houston)
g.V('BNA').repeat(out().simplePath()).until(hasId('IAH')).path().limit(4)
Flights from Wrocław to countries outside (without) the Poland and UK
g.V().has('Code','WRO').out().has('Country',without('PL','UK')).values('City')