Can the predicate of dgraph be replaced?

such as:

<uid> <friend> “jack”


<uid> <classmate> “jack”

value in dgraph doesn‘t change.

Check this topic Migrating (renaming predicates, etc) - #3 by MichelDiz

This is not a good solution, if I have 50million nodes with this predicate, I need to do upsert for all of those 50million nodes. I noticed that your graphql API can easily rename a field, but in dql is it possible to rename the predicate without doing this heavy upsert?

There’s no free energy. Everything in any context needs work to be changed. We could have an “alias” for a predicate, but you still would have the predicate there.

I don’t know what GraphQL does, but I feel it is not doing what you think it is.

The GraphQL endpoint uses the dgraph directive to map a field to a predicate. It is not actually renaming the predicate. It would be the similar thing to aliasing the predicate every time you read it and mapping any input mutations to the correct predicate. You could do this in your own backend where you use DQL, assuming you are using DQL in a backend and not directly to app/service endpoint.