简体   繁体   English

在OrientDb中是否存在来自顶点的传出边缘

[英]Presence / absence of an outgoing edge from a vertex in OrientDb

I have seen some similar questions on SO but none of the answers have worked for me yet, so I am hoping to get a new answer with the new features that have been added to recent versions of OrientDb since the other questions were asked. 我已经看到了一些关于SO的类似问题,但是没有一个答案对我有用,所以我希望得到一个新的答案,新的功能已被添加到最新版本的OrientDb,因为其他问题被提出。

I am trying to query all vertices which have an outgoing edge of a particular type but no outgoing edge of another type. 我试图查询具有特定类型的传出边但没有另一种类型的传出边的所有顶点。

As an example in a simple relationship of 以简单的关系为例

Person ---- Friend ---> Person 人----朋友--->人

Person ---- Owns ---> Car 人----拥有--->汽车

I am trying to find all the persons who have friends but do not own a car. 我试图找到所有有朋友但没有车的人。

I have already tried the following query with no luck (It returns all the persons irrespective of whether or not those vertices have an outgoing edge of a particular kind) 我已经尝试了以下查询而没有运气(无论这些顶点是否具有特定类型的传出边缘,它都返回所有人)

select from Person where (out('Friend') not null and out('Owns').size() = 0)
select from Person where (out('Friend') is not null and out('Owns') is null)

In my efforts I realized that the NOT query is not supported yet by OrientDb in the WHERE clause as per this page: https://github.com/orientechnologies/orientdb/wiki/SQL-Where Can someone please verify if this is indeed true. 在我的努力中,我意识到OrientDb在WHERE子句中不支持NOT查询,如下所示: https//github.com/orientechnologies/orientdb/wiki/SQL-Where有人可以验证这是否确实如此。

Anyways, I moved on and tried to simplify my query and tried to find only vertices that do not have the outgoing edge of 'Owns'. 无论如何,我继续前进,并试图简化我的查询,并试图找到没有'Owns'的传出边缘的顶点。 Even that did not work in that it seemed to return all the Person vertices in my graph: 即使这不起作用,它似乎返回我的图中的所有Person顶点:

select from Person where (out('Owns').size() = 0)
select from Person where (out('Owns') is null)

Not sure what I am missing, but any help is as always greatly appreciated. 不确定我缺少什么,但任何帮助总是非常感激。

尝试始终使用大小,如下所示:

select from Person where outE('Friend').size() > 0 and outE('Owns').size() = 0

however, my queries return differently select from customer where outE('email').size() > 0; 但是,我的查询以不同的方式从客户中选择outE('email')。size()> 0; 0 items 0项

select from customer where outE('email') is not NULL; 从客户中选择outE('email')不为NULL; many items returned 返回了很多物品

looks to me "size() > 0" is not the same as "is not NULL" 看着我“size()> 0”与“is not NULL”不一样

sorry if I am wrong 对不起,如果我错了

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

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