Gremlin-Python:属性存在检查

时间:2018-11-16 17:53:12

标签: gremlin tinkerpop3

我似乎无法找到一种惯用的方法来过滤具有或不具有某种属性(无论其值如何)的节点。

属性存在:

> g.V().hasNot('weight', None).toList()
*** gremlin_python.driver.protocol.GremlinServerError: 599: Could not locate method: DefaultGraphTraversal.hasNot([weight, null])

该属性不存在:

> g.V().has('weight', None).toList()
*** gremlin_python.driver.protocol.GremlinServerError: 599: null:has([weight, null])

hasKey()不返回结果:

> g.V().hasKey('weight')

使用gremlin服务器3.3.4

1 个答案:

答案 0 :(得分:1)

哦,事实证明这可行:

g.V().has('weight')

在文档中很难找到:http://tinkerpop.apache.org/docs/current/reference/#has-step

相关问题