简体   繁体   中英

OrientDB: Query tree

I have a directory-like tree structure in OrientDB:

Node(name='a')->Connection->Node(name='b')->Connection->Node(name='c')

create class Node extends V
create class Connection extends E

let a = create vertex Node set name = 'a'
let b = create vertex Node set name = 'b'
create edge Connection from $a to $b
let c = create vertex Node set name = 'c'
create edge Connection from $b to $c

How can I select Node(name='c') if I know the path 'a'->'b'->'c'?

Keep in mind that all names may be equal on different levels of hierarchy: like instead of 'a', 'b', 'c' it can be 'a', 'a', 'a' but all nodes are different.

try

SELECT expand(o) from

(MATCH
{
 class: Node,
 where: (name='a')
}

.out('Connection')

.out('Connection')
{
 as: o
}

RETURN o)

or without MATCH

select expand(out('Connection').out('Connection')) from Node where name='a'

is this what are you looking for?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM