[ 
https://issues.apache.org/jira/browse/TINKERPOP-1716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16080475#comment-16080475
 ] 

Simone Cattani commented on TINKERPOP-1716:
-------------------------------------------

The following query works well when executed within the console
{code}
:> g.withStrategies(SubgraphStrategy.build().vertices(__.has("age", 
lte(30))).create()).V().valueMap()
{code}

The following is my code, using TinkerPop 3.2.5
{code}
Cluster cluster = Cluster.open(configuration);
Graph graph = EmptyGraph.instance();

System.out.println(graph.traversal().withRemote(DriverRemoteConnection.using(cluster,
 "g")).V().valueMap().toList());
System.out.println(graph.traversal().withRemote(DriverRemoteConnection.using(cluster,
 "g")).V().valueMap().explain());
{code}

obtaining as result
{code}
[{name=[marko], age=[29]}, {name=[vadas], age=[27]}, {name=[lop], lang=[java]}, 
{name=[josh], age=[32]}, {name=[ripple], lang=[java]}, {name=[peter], age=[35]}]
Traversal Explanation
=================================================================================================
Original Traversal   [GraphStep(vertex,[]), PropertyMapStep(value)]

RemoteStrategy [D]   
[RemoteStep(DriverServerConnection-gremlin-server/127.0.0.1:8182 [graph=g])]

Final Traversal      
[RemoteStep(DriverServerConnection-gremlin-server/127.0.0.1:8182 [graph=g])]
{code}

when strategy is used
{code}
Cluster cluster = Cluster.open(configuration);
Graph graph = EmptyGraph.instance();

System.out.println(graph.traversal().withRemote(DriverRemoteConnection.using(cluster,
 "g"))
                .withStrategies(SubgraphStrategy.build().vertices(__.has("age", 
lte(30))).create())
                .V().valueMap().toList());
System.out.println(graph.traversal().withRemote(DriverRemoteConnection.using(cluster,
 "g"))
                .withStrategies(SubgraphStrategy.build().vertices(__.has("age", 
lte(30))).create())
                .V().valueMap().explain());
{code}

the same result is obtained
{code}
[{name=[marko], age=[29]}, {name=[vadas], age=[27]}, {name=[lop], lang=[java]}, 
{name=[josh], age=[32]}, {name=[ripple], lang=[java]}, {name=[peter], age=[35]}]
Traversal Explanation
====================================================================================================================
Original Traversal     [GraphStep(vertex,[]), PropertyMapStep(value)]

SubgraphStrategy [D]   [GraphStep(vertex,[]), 
TraversalFilterStep([HasStep([age.lte(30)])]), PropertyMapStep(value)]
RemoteStrategy   [D]   
[RemoteStep(DriverServerConnection-gremlin-server/127.0.0.1:8182 [graph=g])]

Final Traversal        
[RemoteStep(DriverServerConnection-gremlin-server/127.0.0.1:8182 [graph=g])]
{code}

> Traversal strategies are not applied with remote in Gremlin Console
> -------------------------------------------------------------------
>
>                 Key: TINKERPOP-1716
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1716
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.2.3, 3.2.5
>            Reporter: Jason Plurad
>
> Originally from a [StackOverflow 
> post|https://stackoverflow.com/questions/44907843/can-strategies-be-used-with-remote-traversal-in-gremlin]:
> This subgraph strategy works (only the `battled` edges are returned) with a 
> remote from Gremlin-Python:
> {noformat}
> from gremlin_python import statics
> from gremlin_python.structure.graph import Graph
> from gremlin_python.process.graph_traversal import __
> from gremlin_python.process.strategies import *
> from gremlin_python.driver.driver_remote_connection import 
> DriverRemoteConnection
> statics.load_statics(globals())
> graph = Graph()
> g = 
> graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g')).withStrategies(SubgraphStrategy(edges=__.hasLabel('battled')))
> g.E().label().groupCount().toList()
> {noformat}
> But the subgraph strategy does not work (all edges are returned) with a 
> remote from the Gremlin Console:
> {noformat}
> graph = EmptyGraph.instance()
> g = 
> graph.traversal().withRemote('conf/remote-graph.properties').withStrategies(SubgraphStrategy.build().edges(__.hasLabel("battled")).create())
> g.E().label().groupCount().toList()
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to