hasNot()应该如何在Gremlin中运行?

时间:2014-12-03 11:07:44

标签: graph gremlin titan tinkerpop

如果给定顶点具有特定属性,那么结果应该是什么 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)

它没有返回任何结果。哪一个是对的?

1 个答案:

答案 0 :(得分:4)

只是为了在SO中关闭这个循环 - 已经为这个问题创建了一个GitHub问题(TinkerGraph确实显示了正确的行为):

https://github.com/thinkaurelius/titan/issues/868

请遵循那里的决议。