Search code examples
graphorientdb

Exclude parent vertex from results


I have a simple graph with one parent and three children:

enter image description here

Querying for the children, I also get back the parent:

select name
from (
  traverse in()
  from (
    select
    from group
    where name = 'Parent'
  )
)

Results:

name
Parent
Child 1
Child 2
Child 3

How can I exclude the parent from the results in the query? I'd rather not process the results in my application code.

Thanks.


Solution

  • Excluding where depth is zero seems to do the trick:

    select name
    from (
      traverse in()
      from (
        select
        from group
        where name = 'Parent'
      )
    )
    where $depth > 0
    

    Results in:

    name
    Child 1
    Child 2
    Child 3