Create edge judging if two vertexes match particial patterns

Hi all,

I need to create edge judging if two vertexes match particial patterns, I tried the following query, but it didn’t work… So how can I do this?

Query:
create edge same_company from $SA.a to $SA.c
LET $SA=(select a,c from (match {as:a,class:patient}.out(){class:company}.in(){as:c,class:patient} return a,c) where a<c order by a,c)

Hi @Tracy

In v 3.0.x you can do it with a batch script and a loop:

LET $SA=(select a,c from (match {as:a,class:patient}.out(){class:company}.in(){as:c,class:patient} return a,c) where a<c order by a,c);
FOREACH ($x IN $SA) {
    create edge same_company from $x.a to $x.c
}

I hope it helps

Thanks

Luigi

(edited the answer, there was a typo)