Load or mutation to set automatic edges with previously existing nodes

Let’s assume i have already a graph stored with a node

<0x1> “Test” .
<0x1> “http://example.com” .

My idea will be to be able to load something like:

_:xxx http://example.com

instead of

_:xxx <0x1>

How can I load or mutate data so I add a node with an edge to <0x1>?

Hi @llonchj,

What is are the predicates in your exaple above? Are they something like this?:

<0x1> <name> “Test” .
<0x1> <externalId> “http://example.com” .

Are you trying to look up <0x1> based on its and then add an edge from new node _:xxx to <0x1>?

If so, you’ll need to call the database first to find the UID (0x1) based on the externalId, then use that query result to build and run a mutation. It used to be possible to query + mutate in one call using “mutation variables”, but as part of a design decision, those went away when transactions were introduced (Move mutations out by manishrjain · Pull Request #1631 · dgraph-io/dgraph · GitHub).

I initiated the topic wondering to know if there was a way to do it automatically. Writing a tool, which i wanted to avoid, is another option :wink: Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.