【问题标题】:Why doesn't my gremlin query give an output?为什么我的 gremlin 查询没有给出输出?
【发布时间】:2019-05-14 11:39:57
【问题描述】:
我的 gremlin 控制台遇到了一些错误。
我有以下几行代码:
graph = TinkerGraph.open()
graph.io(graphml()).readGraph('air-routes.graphml')
然后我执行以下操作:
g.V(2)
这没有输出。事实上,每当我在 V() 中输入一个数字时,什么都不会弹出。到底是怎么回事?
【问题讨论】:
标签:
graph
gremlin
tinkerpop
tinkerpop3
【解决方案1】:
您应该将 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。