@MichelDiz correct me if needed as you are the DQL expert.
According to DQL docs,
xid edges are not added automatically in mutations. In general it is a user’s responsibility to check for existing
xid 's and add nodes and
xid edges if necessary. Dgraph leaves all checking of uniqueness of such
xid 's to external processes.
xid then becomes more of an algorithm to achieve a solution than an actual database implementation.
It works just like any normal predicate in Dgraph. There are no special functions to use xid.
Your external processes need to use upserts to correctly use xids.
On a sidenote, Dgraph’s generated GraphQL API has put a lot of emphasis on these external ids and treat them more like first class citizens even though they are still just normal predicates. This is achieved because the GraphQL queries and mutations are rewritten into DQL. The GraphQL API becomes these external processes described in the DQL documentation.