gremlin - Gremlin-Python:属性存在检查
问题描述
我似乎无法找到一种惯用的方法来过滤具有或不具有特定属性(无论其值如何)的节点。
属性存在:
> 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-server 3.3.4
解决方案
哦,原来这行得通:
g.V().has('weight')
在文档中很难找到:http: //tinkerpop.apache.org/docs/current/reference/#has-step
推荐阅读
- django - Django formset 显示在 1 个应用程序中,但不在另一个应用程序中
- oracle-apex - Oracle APEX 5.0:将项目值添加到动态 URL
- html - W3C 标记验证:此时元素“样式”上不允许属性“ng-transition”
- javascript - 如何使铯的可见颜色透明
- java - 替换Java中的html编码字符
- javascript - 折线图未显示单击单选按钮时的数据
- php - 如何调用类的函数从 angularjs 代码中获取 .php 文件中的数据?
- python - Ansible:如何更改 Python 版本
- c - 编译器如何处理数据类型?
- excel - 使用 VBA。如何限制 MS PowerPoint 中的对象相互重叠?