campoy commented :
There’s a way to do this by first fetching the schema and then using all of the predicates available.
I wrote a small Go program demonstrating how to do so in this gist: https://gist.github.com/campoy/ca88c27a24656eb6afa202682fc83442
Note that limiting the depth of the search is very important, as otherwise the search space is huge.
In our case, since we know that the relationship should look like
director - movie - performance - actor we’re setting it to
2 (as in two hops).
The program does the following:
- fetches the UID for Steven Spielberg as a director (or whatever value
- fetches the UID for Jeff Goldblum as a director (or whatever value
- fetches the list of all predicates
- ignoring those starting with
dgraph. as they are internal
- ignoring those of type
password because … there’s a bug #3657
- sends a shortest path query with the UIDs and all the predicates
I hope the workaround is useful. That said, I’ll keep this issue open to consider implementing this functionality on the Dgraph server directly.