Search code examples
graphgremlintinkerpoptinkerpop3

Why doesn't my gremlin query give an output?


I have run into some errors with my gremlin console.

I have the following lines of code:

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

i then do the following:

g.V(2) 

And this gives no output. in fact whenever i put in a number into V() nothing pops out when it should. What is going on?


Solution

  • You should set the id manager to use LONG identifiers:

    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")
    

    See Loading the air-routes graph using the Gremlin console.