Gremlin-Python: 属性 存在检查

Gremlin-Python: Property existence check

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

属性 存在:

> 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() returns 没有结果:

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

使用 gremlin-server 3.3.4

哦,原来这个有效:

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

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