我已经用模式定义了一个顶点,并且顶点的几个属性都是布尔型的。我现在正在尝试查询顶点,并根据这些属性的布尔值过滤结果。
我试过了:
g.V().hasLabel('Patient').has('alcohol_abuse', eq(true))
g.V().hasLabel('Patient').has('alcohol_abuse', true)
g.V().hasLabel('Patient').has('alcohol_abuse', constant(true))
g.V().hasLabel('Patient').has('alcohol_abuse', eq(1))再加上更多的变体,没有一个返回正确的结果
我希望获得Patient顶点中具有alcohol_abuse属性的顶点。
谢谢
发布于 2019-04-23 04:48:52
这很奇怪--这是:
g.V().hasLabel('Patient').has('alcohol_abuse', true)或者更简洁地说,这是:
g.V().has('Patient', 'alcohol_abuse', true)应该行得通。我用TinkerGraph做了一个快速测试:
gremlin> g = TinkerGraph.open().traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.addV('Patient').property('alcohol_abuse',true).
......1> addV('Patient').property('alcohol_abuse',false).iterate()
gremlin> g.V().has('Patient','alcohol_abuse',true).count()
==>1
gremlin> g.V().has('Patient','alcohol_abuse',false).count()
==>1因此,这绝对是包括JanusGraph在内的所有TinkerPop实现的预期结果。如果您没有看到问题的解决方案,您可能需要发布Gremlin控制台会话的文本以进行演示。
https://stackoverflow.com/questions/55800717
复制相似问题