Search code examples
arangodbaql

AQL Graph queries examples


I have trouble doing what i want with AQL and Graph queries. I'd like to get some basics examples of AQL on a simple dataset.

For example: Given a collection of actors and a collection of movies. And a actIn edges collection (with a year property) to connect the vertex.

[Actor] <- act in -> [Movie]

How could i get:

  • All actors who acted in "movie1" OR "movie2"
  • All actors who acted in both "movie1" AND "movie2" ?
  • All actors who acted in 3 or more movies wit
  • All common movies between "actor1" and "actor2" ?
  • All actors who acted in 3 or more movies ?
  • All movies where exactly 6 actors acted in ?
  • The number of actors by movie ?
  • The number of movies by actor ?
  • The number of movies acted in between 2005 and 2010 by actor ?

This is simple queries but i don't get how to describe them using AQL.

Any help is welcome and if you have tuts or links to better understand how to get the job done, i'll be glad !

Thanks


Solution

  • you are right examples for AQL are sparse right now. I have taken your questions here and created a recipe for the ArangoDB cookbook which should answer al of them. Please have a look here: https://www.arangodb.com/docs/stable/aql/examples-actors-and-movies.html

    PS: One of your queries is not complete: All actors who acted in 3 or more movies wit I did not know what to query for.