Misleading Dgraph tour example

In this tour example Query Variables in another query block I | Blocksvars | Dgraph Tour

the first query consists of

  PJ as var(func:allofterms(name@en, "Peter Jackson")) @normalize @cascade {
    F as director.film
  }

However, removing both @cascade and @normalize return the same response. In fact from the tests I’ve been making @cascade does not really work for defining variables.

Am I missing something here?

There are differences, but sure, the example doesn’t make it clear.

without cascade

"num_uids": {
        "": 14,
        "_total": 88,
        "actor.film": 5,
        "director.film": 5,
        "name": 30,
        "performance.character": 17,
        "performance.film": 17
      }

With cascade

"num_uids": {
        "": 13,
        "_total": 76,
        "actor.film": 1,
        "director.film": 5,
        "name": 25,
        "performance.character": 16,
        "performance.film": 16
      }

The objective of cascade is to remove nodes that don’t have the predicates specified on the query body.

e.g:

{
  PJ as var(func:allofterms(name@en, "Peter Jackson")) @normalize @cascade {
    F as director.film
  }

  peterJ(func: uid(PJ)) @normalize @cascade {
    name : name@en
    predicate.test
    actor.film {
      performance.film @filter(uid(F)) {
        film_name: name@en
        predicate.test
      }
      performance.character {
        character: name@en
      }
    }
  }
}

This query above will return empty. Cuz none of the nodes has the predicate predicate.test.

The normalize directive just “flats” the response.

This looks like something the docs could use to fix.