Can't check the edge

Hi, I am new to DGraph.

I perform the operation reference document.

first, added some vertices.

{
  set {
    _:alice <name> "Alice" .
    _:alice <mobile> "040123456" .

    _:bob <name> "Bob" .
    _:bob <mobile> "040234567" .

    _:charlie <name> "Charlie" .
    _:charlie <mobile> "040345678" .
  }
}

then, added some edges.

{
  set {
_:alice <friend> _:bob .
_:alice <friend> _:charlie .
_:bob <friend> _:charlie .
  }
}

When I query the vertex, I can display it. but can’t check the edge.

When I create vertices and edges together,It works.

This is because when you run then separately dgraph creates new uids for _:alice etc., The second time around. You will find that after your to separate runs, there will be two nodes for Alice, one has the properties and another the edge.

Running them together ensures that the same id is used for _:alice (as dgraph will only fetch an id once per transaction - I think).

Manish just added a mechanism to retrieve uIDs and use them instead of :_ … You might want to check that out… I think it’s part of 1.0.8.

Hope that helps.

S

2 Likes

You are performing two operations separately. Dgraph will always understand that you are adding new information when you use _: BlankNode. The correct is, perform the first operation and then the second you use the UID generated by the first.

e.g:

#_:alice = 0x1fb34
#_:bob = 0x22
#_:charlie = 0xf32
{
  set {
   <0x1fb34> <friend> <0x22> .
   <0x1fb34> <friend> <0xf32> .
   <0x22> <friend> <0xf32> .
  }
}

I strongly recommend you take our Tour. https://tour.dgraph.io

Cheers

hi ,When using dgraph bulk to import data,Can you support self-generated UIDs?
like this:

<0xf423a> <name> "02086079543" .
<0xf423b> <name> "02086079635" .
<0xf423c> <name> "02086079647" .
<0xf423d> <name> "02086079698" .
<0xf423e> <name> "02086079699" .

When dgraph bulk imports data, I find that it is a reassigned UID and does not import according to the uid I specified.

thanks!

Sorry, you can’t.

But can you try to use /assignIds?num=100 if so.