You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/10/07 20:58:42 UTC

[3/7] tinkerpop git commit: okay, so no more withStrategies(Map...) and withoutStrategies(String...). Ha. All that for nothing. Not really, so much behind the scenes work on TraversalStrategy bytecode representation and its use with Gremlin variants. Gre

okay, so no more withStrategies(Map...) and withoutStrategies(String...). Ha. All that for nothing. Not really, so much behind the scenes work on TraversalStrategy bytecode representation and its use with Gremlin variants. Gremlin-Python looks slick with withStrategies(). And we have finally exposed the strategy process tests to variant testing.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/018a4817
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/018a4817
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/018a4817

Branch: refs/heads/master
Commit: 018a4817f504d858e68faa963c6fbfd0585c9a04
Parents: af97a5c
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Oct 6 17:12:06 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Oct 6 17:12:06 2016 -0600

----------------------------------------------------------------------
 docs/src/reference/gremlin-variants.asciidoc    | 13 ++++++------
 .../gremlin/process/traversal/Bytecode.java     | 14 +++++++++++--
 .../process/traversal/TraversalSource.java      | 22 --------------------
 .../dsl/graph/GraphTraversalSource.java         |  5 -----
 .../strategy/TraversalStrategyProxy.java        |  4 ++++
 .../structure/io/graphson/GraphSONModule.java   |  2 +-
 .../dsl/graph/GraphTraversalSourceTest.java     |  4 ++--
 .../groovy/jsr223/GroovyTranslatorTest.java     |  8 +++----
 .../gremlin/groovy/jsr223/GroovyTranslator.java | 19 ++++++++++-------
 .../gremlin/python/jsr223/PythonTranslator.java | 17 ++++++++-------
 .../driver/test_driver_remote_connection.py     |  2 +-
 11 files changed, 51 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index d74fb95..0001ba4 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -62,6 +62,7 @@ Gremlin-Python users will typically make use of the following classes.
 >>> from gremlin_python import statics
 >>> from gremlin_python.structure.graph import Graph
 >>> from gremlin_python.process.graph_traversal import __
+>>> from gremlin_python.process.traversal import TraversalStrategy
 >>> from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
 
 In Gremlin-Python there exists `GraphTraversalSource`, `GraphTraversal`, and `__` which mirror the respective classes in Gremlin-Java.
@@ -227,21 +228,21 @@ it is possible to use the `withBindings()`-model as Gremlin-Python's `Bindings.o
 Traversal Strategies
 ~~~~~~~~~~~~~~~~~~~~
 
-In order to add and remove <<traversalstrategy,traversal strategies>> from a traversal source, the `withStrategies(Map<String,Object>...)` and
-`withoutStrategies(String...)` steps should be used.
+In order to add and remove <<traversalstrategy,traversal strategies>> from a traversal source, Gremlin-Python has a
+`TraversalStrategy` class that can be used.
 
 [gremlin-python,modern]
 ----
-g = g.withStrategies({'strategy':'org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy','vertices': hasLabel('person'),'edges': has('weight',gt(0.5))})
+g = g.withStrategies(TraversalStrategy('SubgraphStrategy',{'vertices': hasLabel('person'),'edges': has('weight',gt(0.5))}))
 g.V().name.toList()
 g.V().outE().valueMap(True).toList()
-g = g.withoutStrategies('org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy')
+g = g.withoutStrategies(TraversalStrategy('SubgraphStrategy'))
 g.V().name.toList()
 g.V().outE().valueMap(True).toList()
 ----
 
-IMPORTANT: While Gremlin is language agnostic, the executing traversal machine typically is not. Thus, strategies are
-traversal machine dependent and identified by the class name in the traversal machine's implementation language.
+IMPORTANT: Future work will include extending the Gremlin-Python `TraversalStrategy` class with mirrors of the Java-based
+Gremlin traversal machine strategies so the two variants have the same look-and-feel.
 
 The Lambda Solution
 ~~~~~~~~~~~~~~~~~~~

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
index a19ab83..d2ca5cb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
@@ -21,12 +21,14 @@ package org.apache.tinkerpop.gremlin.process.traversal;
 
 import org.apache.commons.configuration.ConfigurationConverter;
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
@@ -64,6 +66,14 @@ public final class Bytecode implements Cloneable, Serializable {
         if (sourceName.equals(TraversalSource.Symbols.withBindings)) {
             this.bindings = (Bindings) arguments[0];
             this.bindings.clear();
+        } else if (sourceName.equals(TraversalSource.Symbols.withoutStrategies)) {
+            final Class<TraversalStrategy>[] classes = new Class[arguments.length];
+            for (int i = 0; i < arguments.length; i++) {
+                classes[i] = arguments[i] instanceof TraversalStrategyProxy ?
+                        ((TraversalStrategyProxy) arguments[i]).getStrategyClass() :
+                        (Class) arguments[i];
+            }
+            this.sourceInstructions.add(new Instruction(sourceName, classes));
         } else {
             this.sourceInstructions.add(new Instruction(sourceName, flattenArguments(arguments)));
             if (null != this.bindings) this.bindings.clear();
@@ -137,8 +147,8 @@ public final class Bytecode implements Cloneable, Serializable {
                 addArgumentBinding(bindingsMap, entry.getKey());
                 addArgumentBinding(bindingsMap, entry.getValue());
             }
-        } else if (argument instanceof List) {
-            for (final Object item : (List) argument) {
+        } else if (argument instanceof Collection) {
+            for (final Object item : (Collection) argument) {
                 addArgumentBinding(bindingsMap, item);
             }
         } else if (argument instanceof Bytecode)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
index db4a50a..de77ea5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalSource.java
@@ -117,28 +117,6 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
     /**
      * Remove an arbitrary collection of {@link TraversalStrategy} classes from the traversal source.
      *
-     * @param traversalStrategyNames a collection of traversal strategy class names to remove
-     * @return a new traversal source with updated strategies
-     */
-    @SuppressWarnings({"unchecked"})
-    public default TraversalSource withoutStrategies(final String... traversalStrategyNames) {
-        final TraversalSource clone = this.clone();
-        final List<Class<TraversalStrategy>> strategies = new ArrayList<>();
-        for (final String name : traversalStrategyNames) {
-            try {
-                strategies.add((Class) Class.forName(name));
-            } catch (final ClassNotFoundException e) {
-                throw new IllegalArgumentException(e.getMessage(), e);
-            }
-        }
-        clone.getStrategies().removeStrategies(strategies.toArray(new Class[strategies.size()]));
-        clone.getBytecode().addSource(Symbols.withoutStrategies, traversalStrategyNames);
-        return clone;
-    }
-
-    /**
-     * Remove an arbitrary collection of {@link TraversalStrategy} classes from the traversal source.
-     *
      * @param traversalStrategyClasses a collection of traversal strategy classes to remove
      * @return a new traversal source with updated strategies
      */

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index ca3c3f6..4cf20ce 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
@@ -123,11 +123,6 @@ public class GraphTraversalSource implements TraversalSource {
     //// CONFIGURATIONS
 
     @Override
-    public GraphTraversalSource withoutStrategies(final String... traversalStrategyNames) {
-        return (GraphTraversalSource) TraversalSource.super.withoutStrategies(traversalStrategyNames);
-    }
-
-    @Override
     public GraphTraversalSource withStrategies(final TraversalStrategy... traversalStrategies) {
         return (GraphTraversalSource) TraversalSource.super.withStrategies(traversalStrategies);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/TraversalStrategyProxy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/TraversalStrategyProxy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/TraversalStrategyProxy.java
index 2e9e7bb..f248dc6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/TraversalStrategyProxy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/TraversalStrategyProxy.java
@@ -32,6 +32,10 @@ public final class TraversalStrategyProxy<T extends TraversalStrategy> implement
     private final Configuration configuration;
     private final Class<T> strategyClass;
 
+    public TraversalStrategyProxy(final T traversalStrategy) {
+        this((Class<T>) traversalStrategy.getClass(), traversalStrategy.getConfiguration());
+    }
+
     public TraversalStrategyProxy(final Class<T> strategyClass, final Configuration configuration) {
         this.configuration = configuration;
         this.strategyClass = strategyClass;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index d0c9a43..c1ac19d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -38,13 +38,13 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventS
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.LazyBarrierStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.MatchAlgorithmStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.AdjacentToIncidentStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.FilterRankingStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IdentityRemovalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IncidentToAdjacentStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.InlineFilterStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.LazyBarrierStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.MatchPredicateStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.OrderLimitStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.PathProcessorStrategy;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
index 1817349..7e7d777 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
@@ -69,13 +69,13 @@ public class GraphTraversalSourceTest {
             put("edges", __.hasLabel("knows"));
         }})));
         assertTrue(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
-        g = g.withoutStrategies(SubgraphStrategy.class.getCanonicalName());
+        g = g.withoutStrategies(SubgraphStrategy.class);
         assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
         //
         assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
         g = g.withStrategies(ReadOnlyStrategy.instance());
         assertTrue(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
-        g = g.withoutStrategies(ReadOnlyStrategy.class.getCanonicalName());
+        g = g.withoutStrategies(ReadOnlyStrategy.class);
         assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
index cb6620e..59903ac 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
@@ -63,15 +63,13 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
         assertEquals("marko", traversal.next());
         assertFalse(traversal.hasNext());
         //
-        g = g.withoutStrategies(SubgraphStrategy.class.getCanonicalName());
-        traversal = new GremlinGroovyScriptEngine().eval(g.V().count().asAdmin().getBytecode(), bindings);
+        traversal = new GremlinGroovyScriptEngine().eval(g.withoutStrategies(SubgraphStrategy.class).V().count().asAdmin().getBytecode(), bindings);
         assertEquals(new Long(6), traversal.next());
         assertFalse(traversal.hasNext());
         //
-        g = graph.traversal().withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
+        traversal = new GremlinGroovyScriptEngine().eval(g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
-        }})), ReadOnlyStrategy.instance());
-        traversal = new GremlinGroovyScriptEngine().eval(g.V().values("name").asAdmin().getBytecode(), bindings);
+        }})), ReadOnlyStrategy.instance()).V().values("name").asAdmin().getBytecode(), bindings);
         assertEquals("marko", traversal.next());
         assertFalse(traversal.hasNext());
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index c08aebe..3d2aece 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
 import org.apache.tinkerpop.gremlin.structure.Element;
@@ -107,6 +108,8 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
     private String convertToString(final Object object) {
         if (object instanceof Bytecode.Binding)
             return ((Bytecode.Binding) object).variable();
+        else if (object instanceof Bytecode)
+            return this.internalTranslate("__", (Bytecode) object);
         else if (object instanceof Traversal)
             return convertToString(((Traversal) object).asAdmin().getBytecode());
         else if (object instanceof String) {
@@ -156,16 +159,16 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
         else if (object instanceof Lambda) {
             final String lambdaString = ((Lambda) object).getLambdaScript().trim();
             return lambdaString.startsWith("{") ? lambdaString : "{" + lambdaString + "}";
-        } else if (object instanceof Bytecode)
-            return this.internalTranslate("__", (Bytecode) object);
-        else if (object instanceof Computer)
+        } else if (object instanceof Computer)
             return convertToString(ConfigurationConverter.getMap(((Computer) object).getConf()));
-        else if (object instanceof TraversalStrategy) {
-            final TraversalStrategy strategy = (TraversalStrategy) object;
-            if (strategy.getConfiguration().isEmpty())
-                return strategy.getClass().getCanonicalName() + ".instance()";
+        else if (object instanceof TraversalStrategyProxy) {
+            final TraversalStrategyProxy proxy = (TraversalStrategyProxy) object;
+            if (proxy.getConfiguration().isEmpty())
+                return proxy.getStrategyClass().getCanonicalName() + ".instance()";
             else
-                return strategy.getClass().getCanonicalName() + ".create(new org.apache.commons.configuration.MapConfiguration(" + convertToString(ConfigurationConverter.getMap(strategy.getConfiguration())) + "))";
+                return proxy.getStrategyClass().getCanonicalName() + ".create(new org.apache.commons.configuration.MapConfiguration(" + convertToString(ConfigurationConverter.getMap(proxy.getConfiguration())) + "))";
+        } else if (object instanceof TraversalStrategy) {
+            return convertToString(new TraversalStrategyProxy(((TraversalStrategy) object)));
         } else
             return null == object ? "null" : object.toString();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index b591f00..9219717 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -30,6 +30,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
 import org.apache.tinkerpop.gremlin.structure.Element;
@@ -138,6 +139,8 @@ public class PythonTranslator implements Translator.ScriptTranslator {
     private String convertToString(final Object object) {
         if (object instanceof Bytecode.Binding)
             return ((Bytecode.Binding) object).variable();
+        else if (object instanceof Bytecode)
+            return this.internalTranslate("__", (Bytecode) object);
         else if (object instanceof Traversal)
             return convertToString(((Traversal) object).asAdmin().getBytecode());
         else if (object instanceof String)
@@ -165,12 +168,14 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return map.length() > 1 ? map.substring(0, map.length() - 1) + "}" : map.append("}").toString();
         } else if (object instanceof Long)
             return object + "L";
-        else if (object instanceof TraversalStrategy) {
-            final TraversalStrategy strategy = (TraversalStrategy) object;
-            if (strategy.getConfiguration().isEmpty())
-                return "TraversalStrategy(\"" + strategy.getClass().getSimpleName() + "\")";
+        else if (object instanceof TraversalStrategyProxy) {
+            final TraversalStrategyProxy proxy = (TraversalStrategyProxy) object;
+            if (proxy.getConfiguration().isEmpty())
+                return "TraversalStrategy(\"" + proxy.getStrategyClass().getSimpleName() + "\")";
             else
-                return "TraversalStrategy(\"" + strategy.getClass().getSimpleName() + "\"," + convertToString(ConfigurationConverter.getMap(strategy.getConfiguration())) + ")";
+                return "TraversalStrategy(\"" + proxy.getStrategyClass().getSimpleName() + "\"," + convertToString(ConfigurationConverter.getMap(proxy.getConfiguration())) + ")";
+        } else if (object instanceof TraversalStrategy) {
+            return convertToString(new TraversalStrategyProxy((TraversalStrategy) object));
         } else if (object instanceof Boolean)
             return object.equals(Boolean.TRUE) ? "True" : "False";
         else if (object instanceof Class)
@@ -187,8 +192,6 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return convertToString(ConfigurationConverter.getMap(((Computer) object).getConf()));
         else if (object instanceof Element)
             return convertToString(((Element) object).id()); // hack
-        else if (object instanceof Bytecode)
-            return this.internalTranslate("__", (Bytecode) object);
         else if (object instanceof Lambda)
             return convertLambdaToString((Lambda) object);
         else

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/018a4817/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
index 7e9f88b..847d14d 100644
--- a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
+++ b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection.py
@@ -75,7 +75,7 @@ class TestDriverRemoteConnection(TestCase):
         assert 1 == g.V().label().dedup().count().next()
         assert "person" == g.V().label().dedup().next()
         #
-        g = g.withoutStrategies("org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy"). \
+        g = g.withoutStrategies(TraversalStrategy("SubgraphStrategy")). \
             withComputer({"workers": 4, "vertices": __.has("name", "marko"), "edges": __.limit(0)})
         assert 1 == g.V().count().next()
         assert 0 == g.E().count().next()