Amazon Neptune - 使用 bothE() 时,不等于谓词不适用于边缘标签

Amazon Neptune - Not equals predicate does not work on edge labels while using bothE()

我正在使用 Amazon Neptune 和 Gremlin 查询语言。我试图找出除了具有特定标签的边之外,给定的顶点是否有任何边连接到它。

例如,如果有一个带有标签 Person 的顶点,我想知道该顶点是否有任何边的标签不等于 knows

我尝试了以下查询来获得结果:

g.V(<id of person>).bothE().hasLabel(neq('knows')).count();
g.V(<id of person>).bothE().has(label, neq('knows')).count();

g.V(<id of person>).bothE().hasLabel(not(eq('knows'))).count();
g.V(<id of person>).bothE().hasLabel(eq('knows').negate()).count();
g.V(<id of person>).bothE().has(label, not(eq('knows'))).count();

g.V(<id of person>).bothE().hasLabel(without('knows')).count();
g.V(<id of person>).bothE().hasLabel(not(within('knows'))).count();

上面的所有查询都返回了以下异常:

org.apache.tinkerpop.gremlin.driver.exception.ResponseException: {"requestId":"<id>","code":"UnsupportedOperationException",
"detailedMessage":"com.amazon.neptune.storage.volcano.ast.UnionNode cannot be cast to com.amazon.neptune.storage.volcano.ast.PatternNode"}

问题似乎仅在我尝试使用 "not equals" 子句时出现。如果我将这些条件更改为 "equals",它就可以正常工作。此外,只有当我在标签 属性 上尝试进行此比较时,才会发生这种情况,而使用 bothE() 函数找到边缘。

例如,所有这些查询都工作正常:

g.E().hasLabel(neq('knows')).count();
g.V(<id of person>).bothE().hasLabel(eq('knows')).count();
g.V(<id of person>).bothE().hasLabel(within('knows')).count();

如果有人知道为什么会发生这种情况,或者如果有人知道解决这种情况的方法,请告诉我。

请注意:有几条边可以连接到 Person 节点。因此可能很难检查具有任何可能剩余标签的边是否连接到顶点。

谢谢。

怎么样:

g.V(<id of person>).bothE().not(hasLabel('knows')).count()

此外,此问题已在最新 Neptune Release 中得到修复。升级说明在发布页面底部。