简体   繁体   English

如何遍历多个OrientDB顶点

[英]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: 我有一个查询(Q),它可以过滤A类的顶点:

SELECT FROM A WHERE condition

Let's say the result is [31, 28] 假设结果是[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. 现在,我需要过滤与query(Q)结果中至少一个顶点相关的所有B类顶点(必须是传出边,并且可能是直接关系,也可能不是直接关系)。

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) 结果查询应返回[4,0],因为如果您从这些顶点遍历,则将至少到达所需的顶点之一(31或28)

I'm not sure how to create the correct query and what is the most efficient way to do it in OrientDB. 我不确定如何创建正确的查询以及在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]以获得那些结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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