我正在使用 gremlin-java 访问 AWS Neptune。我想使用值列表设置顶点属性的值。我尝试执行以下操作:
g.V(<id of vertex>).property(Cardinality.set, "countries", new HashSet<>()).next();
当我执行它时,出现以下异常:
Caused by: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: {"requestId":"39207d15-75df-4e04-9c25-574070c94687","code":"UnsupportedOperationException","detailedMessage":"Unsupported property value type: java.util.LinkedHashSet"}
at org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler.channelRead0(Handler.java:259)
at org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler.channelRead0(Handler.java:198)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
我在网上发现,要使用值列表设置属性的值,我可以使用相同的属性键多次调用 property() 函数。但我想知道是否有一种更优雅的方法来做到这一点,而不是必须循环遍历集合中的所有值。
谢谢。
慕标琳琳
相关分类