Reputation: 1218
I'm interacting with JanusGraph using Gremlin-Java with the remote mode. I'm now defining a new property on my edges in order to filter them when a specific strategy is used. The following is the code I'm trying to run in my application, but the strategy seems to be completely ignored. The same code executed on a local TP instance is working.
graph.traversal()
.withRemote(DriverRemoteConnection.using(cluster, "g"))
.withStrategies(SubgraphStrategy.build().edges(__.has("field", "condition")).create())
Someone know if this feature is still not supported? I'm using Janus 0.1.0.
Upvotes: 4
Views: 1099
Reputation: 6792
This appears to be a bug in Apache TinkerPop. I opened an issue to track this.
One workaround is to configure your remote driver configuration to use the GraphSON serializer instead of Gryo. This does not require any changes to the server config. 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] } }
A different workaround is to define another traversal source in a Gremlin Server script. 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 utilize that traversal source from your remote driver:
cluster = Cluster.open('conf/remote-objects.yaml')
graph = EmptyGraph.instance()
sg = graph.traversal().withRemote(DriverRemoteConnection.using(cluster, "sg"))
Upvotes: 4