[英]OrientDB: Query tree
I have a directory-like tree structure in OrientDB: 我在OrientDB中有一个类似目录的树结构:
Node(name='a')->Connection->Node(name='b')->Connection->Node(name='c') 节点(名称='a')->连接->节点(名称='b')->连接->节点(名称='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'? 如果我知道路径'a'->'b'->'c',如何选择Node(name ='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. 请记住,所有名称在层次结构的不同级别上可能是相同的:代替“ a”,“ b”,“ c”,它可以是“ a”,“ a”,“ a”,但所有节点都不同。
try 尝试
SELECT expand(o) from
(MATCH
{
class: Node,
where: (name='a')
}
.out('Connection')
.out('Connection')
{
as: o
}
RETURN o)
or without MATCH
或没有
MATCH
select expand(out('Connection').out('Connection')) from Node where name='a'
is this what are you looking for? 这是你在找什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.