【发布时间】:2018-03-07 22:28:21
【问题描述】:
在 gremlin-console 中,有没有办法显示可用于特定对象的所有方法?
例如,在 gremlin-console 中,如果我键入 g.V().hasLabel("person") 并且我想查看我可以为 g.V().hasLabel("person") 返回的对象链接/调用哪些方法。你是怎么做到的?
【问题讨论】:
标签: gremlin datastax-enterprise-graph
在 gremlin-console 中,有没有办法显示可用于特定对象的所有方法?
例如,在 gremlin-console 中,如果我键入 g.V().hasLabel("person") 并且我想查看我可以为 g.V().hasLabel("person") 返回的对象链接/调用哪些方法。你是怎么做到的?
【问题讨论】:
标签: gremlin datastax-enterprise-graph
答案是使用<Tab> 键。
gremlin> "test".c
capitalize() center( charAt( chars() codePointAt( codePointBefore( codePointCount( codePoints() collectReplacements( compareTo(
compareToIgnoreCase( concat( contains( contentEquals( count(
但是,我发现它不适用于像 g.V().o 这样的东西,我希望它会显示 out()。显然,groovy shell(这是 Gremlin 控制台所基于的)似乎不想在流畅的 API 上进行自动完成。它似乎只适用于您调用该方法的第一个对象:
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
这太臭了……这并不是真正的 TinkerPop 问题——我们依靠 groovysh 来实现该功能。我不认为我们可以在那里做很多事情......
当然,您使用的是 DSE Graph,这意味着您可以访问 DataStax Studio,它不仅具有您正在寻找的自动完成功能,而且还支持架构(等等!)。我建议你切换到那个。
【讨论】:
dse gremlin-console 对我不起作用。但它适用于apache-tinkerpop-gremlin-console。这是预期的吗?
<tab> 时,它实际上最终没有任何效果,因为它没有在本地评估代码 - 就像 groovy shell 更少参与确定在这种情况下要做什么。如果您需要这种功能,我肯定会切换到 DataStax Studio。
g.V() 时遇到以下错误:io.netty.handler.codec.DecoderException: org.apache.tinkerpop.gremlin.driver.ser.SerializationException: java.lang.IndexOutOfBoundsException: Index: 121, Size : 0 在 io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98)