Can't find vertex by ID in gremlin console 3.2.0-incubating

1,708 views
Skip to first unread message

Robert Dale

unread,
Jun 10, 2016, 4:35:58 PM6/10/16
to Gremlin-users

apache-gremlin-console-3.2.0-incubating]$ ./bin/gremlin.sh 

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.gephi
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> 
gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> graph.addVertex(T.label,'boom','bId',5)
==>v[0]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:1 edges:0], standard]
gremlin> g.V(0)
gremlin> g.V()
==>v[0]
gremlin> g.V().hasLabel('boom')
==>v[0]
gremlin> g.V().hasLabel('boom').valueMap()
==>[bId:[5]]
gremlin> 

It does work for vertices built by the java code examples:

apache-gremlin-console-3.2.0-incubating]$ ./bin/gremlin.sh 

         \,,,/
         (o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.gephi
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> graph = TinkerFactory.createModern()
==>tinkergraph[vertices:6 edges:6]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V()
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]
gremlin> g.V(1)
==>v[1]
gremlin> graph.addVertex(T.label, 'boom', 'bId', 5)
==>v[12]
gremlin> g.V(12)
gremlin> g.V()
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]
==>v[12]
gremlin> g.V().has('bId', 5)
==>v[12]
gremlin> 

Stephen Mallette

unread,
Jun 10, 2016, 4:40:17 PM6/10/16
to Gremlin-users
I think you're running afoul of the TinkerGraph's id manager:

gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:1 edges:0], standard]
gremlin> graph.addVertex(T.label,'boom','bId',5)
==>v[0]
gremlin> g.V(0)
gremlin> g.V(0L)
==>v[0]

You can read more about how to set that up better to suit your identifier needs here:




--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/e1f7eda0-3419-4997-a80a-64ce5a9480ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Dale

unread,
Jun 10, 2016, 5:23:53 PM6/10/16
to Gremlin-users
Yes, so it is. Thank you. While it's handy to know this, TinkerFactory.createClassic() still uses Integers which I think would be more intuitive for the casual user. Perhaps that would be a better default for all TinkerGraph in-memory graphs.  I would think that a user needing to load more than 2 billion elements would be considered more of an advanced user and at that point would need to dig into the docs to tweak the properties. But then again, since I'm the only one complaining, maybe I'm the minority.  Thanks again!

Dylan Millikin

unread,
Jun 10, 2016, 11:37:47 PM6/10/16
to gremli...@googlegroups.com
I've also been wondering if the default configuration should come with id managers already set. "0L" might not be recognizable by non-java users and is a little tricky with json serialization so this config documentation is kind of a mandatory stop for these use cases. 

Stephen Mallette

unread,
Jun 11, 2016, 6:29:37 AM6/11/16
to Gremlin-users
There's a reason why it's defaulted but I don't remember what it is :( There's also a ticket to improve consistency around identifiers in TinkerGraph but the solution doesn't seem to be possible without breaking change if I remember correctly. The JSON serialization and type lossiness should be less of a problem with GraphSON 2.0 which should come as part of 3.2.1.

Reply all
Reply to author
Forward
0 new messages