At the moment, no. There is no concept of default in Dgraph.
As much as it would be nice to have a default directive, it is not the graph way. In a relational model, every row contains data for every column even if the data it contains for that column is nullish. In a graph, only predicates with values exist.
There are two ways to handle this:
-
Set the default value in the application layer. This saves much work from the database and can usually be done in a single line of code.
-
JS hooks (aka lambda functions) are expected in the 20.11 release. With a post query hook, you will be able to provide a default value if the value is null.