如果给定的顶点不有一个特定的属性,结果应该是什么
g.V.hasNot('non-existent-property', 'value')
查询?顶点是否应由此类查询发出?
我在使用 TinkerPop 和 Titan 的内存图时得到了相互矛盾的结果:
gremlin> g = TinkerGraphFactory.createTinkerGraph()
==>tinkergraph[vertices:6 edges:6]
gremlin> g.V.hasNot("abcd", true)
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]
以上对我来说没问题 - 顶点没有指定的属性(设置为 true
)所以全部返回。但是如果我在 Titan 的内存图中做类似的事情:
gremlin> g2 = TitanFactory.open(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.buildConfiguration().set(com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.STORAGE_BACKEND, "inmemory"))
==>titangraph[inmemory:[127.0.0.1]]
gremlin> g2.addVertex(null)
==>v[256]
gremlin> g2.V.hasNot("abcd", true)
它没有返回结果。哪个是对的?
最佳答案
只是为了在 SO 中结束这个循环 - 已经为这个问题创建了一个 GitHub 问题(TinkerGraph 确实显示了正确的行为):
https://github.com/thinkaurelius/titan/issues/868
请按照那里的决议。
关于graph - hasNot() 在 Gremlin 中应该如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27270155/