为什么我的 gremlin 查询没有给出输出?

Why doesn't my gremlin query give an output?

我的 gremlin 控制台出现了一些错误 运行。

我有以下几行代码:

graph = TinkerGraph.open()
graph.io(graphml()).readGraph('air-routes.graphml')

然后我执行以下操作:

g.V(2) 

这没有输出。事实上,每当我在 V() 中输入一个数字时,什么都不会弹出。到底是怎么回事?

您应该将 ID 管理器设置为使用 LONG 标识符:

conf = new BaseConfiguration()
conf.setProperty("gremlin.tinkergraph.vertexIdManager", "LONG")
conf.setProperty("gremlin.tinkergraph.edgeIdManager", "LONG")
conf.setProperty("gremlin.tinkergraph.vertexPropertyIdManager", "LONG")
graph = TinkerGraph.open(conf)
graph.io(graphml()).readGraph("air-routes.graphml")

参见Loading the air-routes graph using the Gremlin console