OrientDB - 通过连接到它们的其他顶点过滤选定的顶点

OrientDB - filter selected vertices by other vertices connected to them

我不是 OrientDB 专业人士,所以我的问题可能听起来很愚蠢;但我没有在文档或网上找到任何答案。

This is a sample of a data structure that I have: 我想找到所有的海狸,它们有蓝眼睛,它们很快乐,它们知道这一点。

我确实设法 select 使用 out() 函数的眼睛颜色和幸福状态 - 类似于

SELECT out('has').eyeColors, out('is').happinessState FROM beavers

但是我该如何过滤那些连接的顶点呢?我试过了

SELECT * FROM beavers WHERE out('has').eyeColors = 'blue' AND out('is').happinessState = 'happy and knows it'

SELECT * FROM beavers WHERE (SELECT out('has').eyeColors FROM beavers) = 'blue' AND (SELECT out('is').happinessState FROM beavers) = 'happy and knows it'

但是两种查询类型都倾向于 return 空结果。

那么 - 我怎样才能实现这样的 select离子?

*我 运行 Community Edition,v. 2.1.11,并在服务器端 JS 函数中执行所有这些操作。

谢谢, 格雷戈里

在 WHERE 条件中您需要使用 CONTAINS 词,因为 out() - 所以对于 in()both() - returns 一个列表。

例如

select from Beaver where out('has').eyeColors contains "Blue" and out("iss").happinessState contains "happy and knows it"

您可以通过选择它来验证它是否 returns 列表:

select out('has').eyeColors from Beaver

PS

我看到您正在使用一个名为 is 的边缘 class,我认为这是不允许的,因为它是一个私有词。


希望对您有所帮助。伊万


更新

select name from Children
let $a=(select from Beaver where in('has').@rid contains $parent.$current.@rid and out('has').eyeColor contains "Blue" and out("iss").happinessState contains "happy and knows it")
where $a.size() > 0