Query in tour of dgraph

Right. This block is doing a kind of “pre-filter” and Capturing uids to apply to the next block.

yep

In general, Type Schema can help. You go to the Schema panel, then select “Types” and you will be able to see the Types. Look for “Performance” and you will have listed all types of that entity there.

Another way you can find out is by using the function expan (all) Expand Predicate | Schema | Dgraph Tour

e.g:

  1. remove @normalize @cascade for a moment
{
  PJ as var(func:allofterms(name@en, "Peter Jackson")) @normalize @cascade {
   director.film { uid }
  }

  peterJ(func: uid(PJ)) {
    actor.film {
      expand(_all_) {
        uid
      }
    }
  }
}

Using

      expand(_all_) {
        uid
      }

Or

      expand(_all_) {
        expand(_all_)
      }

you are able to “dig” and find out in an indirect way which edges are there.

In fact, whoever designed (I think this come from freebase or something) this dataset had created a set of intermediate objects/nodes. Sometimes the Actor did different performances, participation and etc. Who designed this dataset was thinking about simplifying the Actor_node.

Intermediate nodes are basically “list of things that belongs to a single ou multiple entities”. In this case, the list belongs to that person/actor. It holds information of all nodes with type performance.

This is a common way to decrease the burden of predicates and edges that an entity has. Instead of you having the Actor type with

performance.actor
performance.character
performance.character_note
performance.film
performance.special_performance_type
++All the other edges from Actor type

You create an intermediate type that is between the Actor and the movie. So you don’t have crowded information in a single type.

It’s good to subdivide them from time to time, cuz make the information more reliable and ready to apply functions between edges which makes the query faster. Also, Intermediate nodes are also good for creating input and output facets (but that is not the case here) or “queues”.

If you designed your dataset, at some point you documented it. Other than that, you have the ways mentioned above like expand functions.