1

In gremlin-console, is there a way to show all the methods available for a specific object?

For example, In gremlin-console if I type g.V().hasLabel("person") and I want to see what methods I can chain/call for the object returned by g.V().hasLabel("person"). How do you do that?

Glide
  • 20,235
  • 26
  • 86
  • 135

1 Answers1

3

The answer is to use the <Tab> key.

gremlin> "test".c
capitalize()           center(                charAt(                chars()                codePointAt(           codePointBefore(       codePointCount(        codePoints()           collectReplacements(   compareTo(             
compareToIgnoreCase(   concat(                contains(              contentEquals(         count(

However, I'm finding that it is not working for something like g.V().o which I'd hoped would have shown out(). Apparently, the groovy shell (which is what the Gremlin Console is based on) doesn't seem to want to do the auto-complete on a fluent API. It seems to only work on the first object on which you are calling the method:

gremlin> g.
E(                        V(                        addV(                     addV()                    close()                   inject(                   tx()                      withBindings(             withBulk(                 
withComputer(             withComputer()            withPath()                withRemote(               withSack(                 withSideEffect(           withStrategies(           withoutStrategies(        anonymousTraversalClass   
bytecode                  graph                     strategies                
gremlin> x = g.V();[]
gremlin> x.o
option(     optional(   or(         order(      order()     otherV()    out(        outE(       outV()      
gremlin> x.o

That stinks...that's not really a TinkerPop issue - we rely on the groovysh for that functionality. Not much we can do there I don't think....

Of course, you are using DSE Graph which means you have access to DataStax Studio which not only has the auto-complete that you're looking for but also schema support (and more!). I'd suggest that you switch to that.

stephen mallette
  • 45,298
  • 5
  • 67
  • 135
  • Strangely, it doesn't work for me using `dse gremlin-console`. But it works with `apache-tinkerpop-gremlin-console`. Is that expected? – Glide Mar 08 '18 at 23:16
  • yes - now that you say that, it is expected. the Gremlin Console is put into "remote" mode to talk to DSE Graph. In that mode, what you type in the console ends up being a string sent to the server for evaluation and the result returned. Therefore, when you do a `` it really ends up having no effect because it's not evaluating code locally - like the groovy shell is even less involved in determining what to do in this case. i'd definitely switch to DataStax Studio if you need this kind of functionality. – stephen mallette Mar 09 '18 at 00:06
  • I will definitely try DataStax studio. Is it possible then to use apache's Gremlin Console to talk to the remote DSE Graph so that I can have the "autocomplete" feature. When I tried it, I got the following error doing `g.V()`: io.netty.handler.codec.DecoderException: org.apache.tinkerpop.gremlin.driver.ser.SerializationException: java.lang.IndexOutOfBoundsException: Index: 121, Size: 0 at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98) – Glide Mar 13 '18 at 19:10
  • no - that won't work either. the console must be in "remote" mode to work with DSE Graph. so even if you use the tinkerpop console, you'll need to put it in "remote" mode to talk to DSE Graph. – stephen mallette Mar 13 '18 at 19:35