There are some problems when merging duplicate nodes

Continuing the discussion from How to delete duplicate node:
There is only one type of edge in the example. When the type of edge is 2 or more, the non-existent edges will be connected by empty UID.
How to avoid connection with empty,Or how to delete edge between empty?

Hi @zzl221000,
Could you please provide an example of the non-existent edge? It will help answer the question properly.

<name>: string @index(hash) .
<Company.name>: string @index(hash) .
<shareholder>: [uid] .
<manager>: [uid] .
type <Person> {
	name
	manager
	shareholder
}
type<Company> {
        Company.name
}

mutation:

{
  set{
    _:google <Company.name> "Google" .
    _:jack1 <name> "jack" .
    _:jack1 <manager>_:google (position = "CEO") .
    _:jack <name> “jack” .
    _:jack <shareholder>_:google (shares ="10%") .
  }
}

upsert block:

jack1 uid is 0x1
jack uid is 0x2

upsert{
    query{
        jack1 as var(func:uid("0x1"))){
            m as manager
            s as shareholder
        }
    }
    mutation{
        set{
            <0x2> <manager> uid(m) .
            <0x2> <shareholder> uid(s) .
        }
    }
}

The “0x2” node will add a edge with empty node.
I solved this problem by using conditional upsert.
Now there is a new problem, there is no way to insert the facets variable.

1 Like