简体   繁体   中英

How to traverse multiple OrientDB vertex

I have the following graph:

在此处输入图片说明

Class A Vertex = [11, 21, 51, 31, 28]
Class B Vertex = [10, 14, 4, 0]
Class C Vertex = [33, 45, 35, 37]

I have a query(Q) that filter vertex of class A:

SELECT FROM A WHERE condition

Let's say the result is [31, 28]

Now I need to filter all the vertex of class B that are related (must be an outgoing edge and may or may not be a direct relation) to at least one vertex inside the query(Q) result.

The result query should return [4, 0], because if you traverse from those vertex you will get to at least one of the desired vertex (31 or 28)

I'm not sure how to create the correct query and what is the most efficient way to do it in OrientDB. Thank you.

select from (traverse in() from (select from A where num in [31,28])) where @class='B'

用查询替换select from A where num in [31,28]以获得那些结果

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