Can strategies be used with remote traversal in Gremlin?

I am interacting with JanusGraph using Gremlin-Java with remote mode. Now I define a new property at my edges to filter them out when a certain strategy is used. Below is the code I am trying to run in my application, but the strategy seems to be completely ignored. The same code running on a local TP instance works.

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

      

Does anyone know if this feature is not supported? I am using Janus 0.1.0.

+3


source to share


1 answer


This appears to be a bug in Apache TinkerPop. I opened a problem to track this.

One way to solve this problem is to configure the remote driver to use the GraphSON serializer instead of Gryo. This does not require any changes to the server configuration. For example, in conf/remote-objects.yaml

:

hosts: [localhost]
port: 8182
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0,
          config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] } }

      

Another workaround is to define another workaround source in the Gremlin script server. For example, if you are using the default conf/gremlin-server/gremlin-server.yaml

, update the global bindings in 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())]

      

Then you can use this workaround source from the remote driver:

cluster = Cluster.open('conf/remote-objects.yaml')
graph = EmptyGraph.instance()
sg = graph.traversal().withRemote(DriverRemoteConnection.using(cluster, "sg"))

      

+3


source







All Articles