orientdborientdb-2.1

OrientDb - Get node and all of its relations


Can I do one query to achieve vertex and all of his edges (including the other vertexes)?

now I'm doing multiple queries to achieve it:

For getting the vertex:

select from V where entity_name = 'SomeEntity'

Then going over each edge and select it:

select from #EDGE@rid // Multiple in the number of edges for this node

And at the end going over the edges and getting all other vertexes (except the original)

select from #VERTEX@rid // Multiple in the number of vertexes in the edges

Solution

  • I used the following to get all Vertexes and Edges in the required depth from my Vertex:

    TRAVERSE inE(), outE(), inV(), outV() 
    FROM (select from V where entity_name = 'SomeEntity') 
    WHILE $depth <= 2