Movies Schema

Dgraph queries and the visualization will help us understand the schema of the movies dataset.

As you’ll see in the following pages, we can view the data from a number of perspectives; considering for example directors, movies, genres or even locations as the primary starting point.

Let’s have a look from the perspective of directors. Kathryn Bigelow directed the early 90’s classic Point Break. We’ll begin with her and learn about the schema.

Run the query. _predicate_ tells us that directors have a name and are connected to the movies they directed via director.film.

Extend the query a level deeper by also including

director.film (first: 1) { _predicate_ }

We can see a movie has a name and also genre and starring edges leading to the genres the movie is classified in and the people in the movie.

Investigate the starring edge too and you’ll learn that nodes reached via that edge represent the performance of an actor as a particular character in the movie.

Try the same queries starting with Tom Hanks. He’s both an actor and a director, so you’ll see the links to a performance from both movie and actor.

Remember there’s also the schema query that can be used to investigate the types and indexes in the schema. Just

schema {}

queries for everything about the schema

If you like, investigate more. With the lessons so far, you can find all the movies by particular directors, the movies by an actor or the cast of a movie.

Endpoint: /query
Response