Search code examples
orientdb

Select all vertices connected via an edge and order by edge attribute


I have a 'View' vertex (#74:0) that has 2 (could be more) OUT edges (VertexIncludes) to two 'Item' vertices.

enter image description here

I want to get these two Item vertices but order them by the VertexIncludes.order attribute (which is an integer). The image shows these as currently having values of 2 and 3.

The following query will return the edges in the correct order, how do I revise it to get the in attributes that contain the vertex rid?

SELECT expand(outE('ViewIncludes')) FROM #74:0 ORDER BY order

Solution

  • First, switch to ArcadeDB.

    Then try

    select inV() from (SELECT expand(outE('ViewIncludes')) FROM #74:0 ORDER BY order)
    

    It returns the vertices with arcadedb (but should work with orientDB, too)