github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/systest/21million/queries/query-038 (about) 1 { 2 num_roles(func: eq(name@en, "Warwick Davis")) @cascade @normalize { 3 4 paths as math(1) # records number of paths to each character 5 6 actor : name@en 7 8 actor.film { 9 performance.film @filter(allofterms(name@en, "Harry Potter")) { 10 film_name : name@en 11 characters : math(paths) # how many paths (i.e. characters) reach this film 12 } 13 } 14 } 15 } 16 --- 17 { 18 "num_roles": [ 19 { 20 "actor": "Warwick Davis", 21 "characters": 1, 22 "film_name": "Harry Potter and the Half-Blood Prince" 23 }, 24 { 25 "actor": "Warwick Davis", 26 "characters": 1, 27 "film_name": "Harry Potter and the Prisoner of Azkaban" 28 }, 29 { 30 "actor": "Warwick Davis", 31 "characters": 1, 32 "film_name": "Harry Potter and the Goblet of Fire" 33 }, 34 { 35 "actor": "Warwick Davis", 36 "characters": 1, 37 "film_name": "Harry Potter and the Deathly Hallows - Part I" 38 }, 39 { 40 "actor": "Warwick Davis", 41 "characters": 2, 42 "film_name": "Harry Potter and the Deathly Hallows – Part 2" 43 }, 44 { 45 "actor": "Warwick Davis", 46 "characters": 2, 47 "film_name": "Harry Potter and the Deathly Hallows – Part 2" 48 }, 49 { 50 "actor": "Warwick Davis", 51 "characters": 1, 52 "film_name": "Harry Potter and the Order of the Phoenix" 53 }, 54 { 55 "actor": "Warwick Davis", 56 "characters": 2, 57 "film_name": "Harry Potter and the Philosopher's Stone" 58 }, 59 { 60 "actor": "Warwick Davis", 61 "characters": 2, 62 "film_name": "Harry Potter and the Philosopher's Stone" 63 }, 64 { 65 "actor": "Warwick Davis", 66 "characters": 1, 67 "film_name": "Harry Potter and the Chamber of Secrets" 68 } 69 ] 70 }