orientdborientdb-2.1orientdb2.2

How to include current record in the resulting recordset when select uses graph projections


What is the elegant way to include a record in the set of records, when query uses a graph projection in the select?

For instance,

select expand(both('friends')) from #123:456 limit -1

The query above returns only adjacent vertices. How can I include #123:456 into the resultset?


Solution

  • Try this:

    select expand($c) from #123:456 let $a = (select expand(both('friends')) from #123:456 limit -1) , $b = (select expand(@rid) from #123:456), $c = unionAll( $a, $b )