Search code examples
gremlindatastax-enterprise-graph

Have Gremlin-console show all the methods available for a specific object?


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?


Solution

  • 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.