在Gremlin中,策略可以用于远程遍历吗?

在Gremlin中,策略可以用于远程遍历吗?,gremlin,tinkerpop3,janusgraph,Gremlin,Tinkerpop3,Janusgraph,我正在使用Gremlin Java和远程模式与JanusGraph进行交互。我现在在边上定义一个新属性,以便在使用特定策略时过滤它们。 下面是我试图在应用程序中运行的代码,但该策略似乎完全被忽略了。在本地TP实例上执行的相同代码正在工作 graph.traversal() .withRemote(DriverRemoteConnection.using(cluster, "g")) .withStrategies(SubgraphStrategy.build().edges(__

我正在使用Gremlin Java和远程模式与JanusGraph进行交互。我现在在边上定义一个新属性,以便在使用特定策略时过滤它们。 下面是我试图在应用程序中运行的代码,但该策略似乎完全被忽略了。在本地TP实例上执行的相同代码正在工作

graph.traversal()
    .withRemote(DriverRemoteConnection.using(cluster, "g"))
    .withStrategies(SubgraphStrategy.build().edges(__.has("field", "condition")).create())

是否有人知道此功能是否仍不受支持?我正在使用Janus 0.1.0。

这似乎是Apache TinkerPop中的一个bug。我需要跟踪这个

一种解决方法是将远程驱动程序配置配置为使用GraphSON序列化程序而不是Gryo。这不需要对服务器配置进行任何更改。例如,在
conf/remote objects.yaml
中:

hosts: [localhost]
port: 8182
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0,
          config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] } }
另一种解决方法是在Gremlin服务器脚本中定义另一个遍历源。例如,如果使用默认的
conf/gremlin server/gremlin server.yaml
,请更新
scripts/empty sample.groovy
中的全局绑定:

// define the default TraversalSource to bind queries to - named "g".
// define a subgraph traversal source - named "sg"
globals << [g : graph.traversal(),
    sg: graph.traversal().withStrategies(SubgraphStrategy.build().edges(
        __.has("field", "condition")).create())]
cluster = Cluster.open('conf/remote-objects.yaml')
graph = EmptyGraph.instance()
sg = graph.traversal().withRemote(DriverRemoteConnection.using(cluster, "sg"))