Hi, I want through the tutorial, I have no problem loading json data, however, I don’t know how to load json data from a single file while creating unique nodes and edges.
Using this dataset as example: SNAP: Network datasets: Wikipedia vote network
This file has 7115 nodes and 103689 edges. The data structure is:
FromNodeId | ToNodeId |
---|---|
30 | 1412 |
How we interpret is that Node 30 votes for Node 1412.
After doing data transformation, my json file data structure is:
[
{"FromNodeId": 30, "ToNodeId": 1412},
...
]
I import the file using ./dgraph live -f wiki-vote.json
. This will create 103689 nodes containing both FromNodeId
and ToNodeId
attributes and each has unique uid.
What I want is to create unique nodes from FromNodeId
and ToNodeId
. With edges votes_for
from FromNodeId
to ToNodeId
.
My attempt is to rename both FromNodeId
and ToNodeId
to uid
, the idea is to ensure that I only have 7115 uid from 7115 unique nodes from both columns, which don’t work. Also I have no idea how can I define the relationship of FromNodeId
and ToNodeId
inside the json file.
[
{"uid": 30, "uid": 1412},
...
]
Please advise how can I do that