OrientDB:查找没有给定类的直接邻居顶点的所有顶点

Thi*_*ilo 6 graph-databases orientdb

使用OrientDB的查询语言,如何找到集群a中没有出口边缘在类的顶点结束的所有顶点b(即没有类的直接邻居顶点b)?它们是否有其他外围边缘并不重要.

Lvc*_*vca 3

如果您将 A 类映射到集群 a,您可以执行以下操作:

select from A where not( out.in.@class in ['b'] )
Run Code Online (Sandbox Code Playgroud)

这意味着交叉 A 记录的“out”属性(作为边),然后交叉“in”属性(顶点),然后获取类名(@class)。我使用 IN 运算符而不是 =(等于),因为“out.in.@class”返回类名的集合。

如果您不想使用 A 类,并且必须遍历集群 A,请使用 cluster: 语法:

 select from cluster:A where not( out.in.@class in ['b'] )
Run Code Online (Sandbox Code Playgroud)

我已经针对最新的 1.0rc8-SNAPSHOT 进行了测试并且有效。