Search code examples
orientdb

OrientDB SQL-Traverse for single-direct chain nodes


Suppose the following diagram: I want to traverse from c, walk to all nodes that in the same 'one-direct' chain with C (the blue ones).

But

traverse in(), out() from C

will also include F and I(the green ones) that i don't want.

How can i do this with sql-traverse?

enter image description here


Solution

  • You can use two TRAVERSE statements and a unionAll(), eg.

     SELECT expand(unionAll($a, $b))
     LET 
       $a = (traverse out() from C)
       $b = (traverse in() from C)