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:40 UTC

[1/7] tinkerpop git commit: starting to move Computer out of the Bytecode picture.

Repository: tinkerpop
Updated Branches:
  refs/heads/master c6b49f2e9 -> 9b1338344


starting to move Computer out of the Bytecode picture.


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

Branch: refs/heads/master
Commit: af97a5c9e7157996b3cf7f516ee34ee5c81895af
Parents: a33dfc0
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Oct 6 15:38:19 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Oct 6 16:16:38 2016 -0600

----------------------------------------------------------------------
 .../tinkerpop/gremlin/process/traversal/Bytecode.java     | 10 ++++++++--
 .../tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java |  3 +++
 .../tinkerpop/gremlin/python/jsr223/PythonTranslator.java |  3 +++
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af97a5c9/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 83c802d..a19ab83 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
@@ -20,9 +20,7 @@
 package org.apache.tinkerpop.gremlin.process.traversal;
 
 import org.apache.commons.configuration.ConfigurationConverter;
-import org.apache.commons.configuration.MapConfiguration;
 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;
 
@@ -31,8 +29,10 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 /**
  * When a {@link TraversalSource} is manipulated and then a {@link Traversal} is spawned and mutated, a language
@@ -287,6 +287,12 @@ public final class Bytecode implements Cloneable, Serializable {
                 list.add(convertArgument(item, true));
             }
             return list;
+        } else if (argument instanceof Set) {
+            final Set<Object> set = new LinkedHashSet<>(((Set) argument).size());
+            for (final Object item : (Set) argument) {
+                set.add(convertArgument(item, true));
+            }
+            return set;
         } else
             return argument;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af97a5c9/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 9a09595..c08aebe 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
@@ -20,6 +20,7 @@
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
 import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
@@ -157,6 +158,8 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             return lambdaString.startsWith("{") ? lambdaString : "{" + lambdaString + "}";
         } else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
+        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())

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af97a5c9/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 41dbe4b..b591f00 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
@@ -20,6 +20,7 @@
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
 import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
@@ -182,6 +183,8 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return convertStatic(((Enum) object).getDeclaringClass().getSimpleName() + ".") + SymbolHelper.toPython(object.toString());
         else if (object instanceof P)
             return convertPToString((P) object, new StringBuilder()).toString();
+        else if (object instanceof Computer)
+            return convertToString(ConfigurationConverter.getMap(((Computer) object).getConf()));
         else if (object instanceof Element)
             return convertToString(((Element) object).id()); // hack
         else if (object instanceof Bytecode)


[6/7] tinkerpop git commit: okay, this is the gold. withComputer() is now smart about just redirecting to withStrategies(VertexProgramStrategy). This way Computer doesn't need to be a first class citizen and supported with a serializer by the various lan

Posted by ok...@apache.org.
okay, this is the gold. withComputer() is now smart about just redirecting to withStrategies(VertexProgramStrategy). This way Computer doesn't need to be a first class citizen and supported with a serializer by the various language variants. Also, this is much much more consistent --- its all just strategies. Got Gremlin-Python strategies all implemented and working nicely. This is a really cool thing. Updated docs and CHANGELOG.


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

Branch: refs/heads/master
Commit: 6fdc59d20e6e7a2aad54b55db343e74907e0c652
Parents: f84b196
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Oct 7 12:44:31 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Oct 7 12:44:31 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 docs/preprocessor/awk/init-code-blocks.awk      |   1 +
 docs/src/reference/gremlin-variants.asciidoc    |   7 +-
 .../gremlin/process/computer/Computer.java      |  51 ------
 .../decoration/VertexProgramStrategy.java       | 161 ++++++++++++++++++-
 .../computer/util/GraphComputerHelper.java      |   8 +-
 .../gremlin/process/traversal/Bytecode.java     |   4 -
 .../process/traversal/TraversalSource.java      |  44 ++---
 .../dsl/graph/GraphTraversalSource.java         |   7 +-
 .../gremlin/process/traversal/BytecodeTest.java |   6 +-
 .../gremlin/groovy/jsr223/GroovyTranslator.java |   5 +-
 .../python/GraphTraversalSourceGenerator.groovy |   6 +-
 .../gremlin/python/jsr223/PythonTranslator.java |   3 -
 .../gremlin_python/process/graph_traversal.py   |   7 +-
 .../jython/gremlin_python/process/strategies.py |  57 +++++--
 .../driver/test_driver_remote_connection.py     |   2 +-
 .../jython/tests/structure/io/test_graphson.py  |   2 +-
 .../process/TinkerGraphComputerProvider.java    |  10 +-
 18 files changed, 252 insertions(+), 130 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 2fbc9a0..9475555 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* `TraversalSource.withComputer()` is simplified to add a `VertexProgramStrategy`. Easier for language variants.
 * Fixed a `Set`, `List`, `Map` bug in the various `Translators` where such collections were not being internally translated.
 * Fixed a `Bytecode` bug where nested structures (map, list, set) were not being analyzed for bindings and bytecode conversions.
 * Fixed a `String` bug in `GroovyTranslator` and `PythonTranslator` where if the string has double-quotes it now uses """ """.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/docs/preprocessor/awk/init-code-blocks.awk
----------------------------------------------------------------------
diff --git a/docs/preprocessor/awk/init-code-blocks.awk b/docs/preprocessor/awk/init-code-blocks.awk
index 2b66eaf..f9b020a 100644
--- a/docs/preprocessor/awk/init-code-blocks.awk
+++ b/docs/preprocessor/awk/init-code-blocks.awk
@@ -60,6 +60,7 @@ BEGIN {
     print "jython.eval('sys.path.append(\"" TP_HOME "/gremlin-python/target/test-classes/Lib\")')"
     print "jython.eval('from gremlin_python import statics')"
     print "jython.eval('from gremlin_python.process.traversal import *')"
+    print "jython.eval('from gremlin_python.process.strategies import *')"
     print "jython.eval('from gremlin_python.structure.graph import Graph')"
     print "jython.eval('from gremlin_python.structure.io.graphson import GraphSONWriter')"
     print "jython.eval('from gremlin_python.structure.io.graphson import GraphSONReader')"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 51e2d2b..0716ff1 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -62,7 +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.process.strategies import *
 >>> 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.
@@ -239,11 +239,14 @@ g.V().outE().valueMap(True).toList()
 g = g.withoutStrategies(SubgraphStrategy)
 g.V().name.toList()
 g.V().outE().valueMap(True).toList()
+g = g.withComputer(workers=2,vertices=has('name','marko'))
+g.V().name.toList()
+g.V().outE().valueMap(True).toList()
 ----
 
 NOTE: Many of the `TraversalStrategy` classes in Gremlin-Python are proxies to the respective strategy on the
 Apache TinkerPop's JVM-based Gremlin traversal machine. As such, their `apply(Traversal)` method does nothing. However,
-the strategy is encoded in the Gremlin-Python bytecode and transmittable to the Gremlin traversal machine for
+the strategy is encoded in the Gremlin-Python bytecode and transmitted to the Gremlin traversal machine for
 re-construction machine-side.
 
 The Lambda Solution

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
index 86e1a12..a82b4e6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
@@ -46,13 +46,6 @@ public final class Computer implements Function<Graph, GraphComputer>, Serializa
     private Traversal<Vertex, Vertex> vertices = null;
     private Traversal<Vertex, Edge> edges = null;
 
-    public static final String GRAPH_COMPUTER = "graphComputer";
-    public static final String WORKERS = "workers";
-    public static final String PERSIST = "persist";
-    public static final String RESULT = "result";
-    public static final String VERTICES = "vertices";
-    public static final String EDGES = "edges";
-
     private Computer(final Class<? extends GraphComputer> graphComputerClass) {
         this.graphComputerClass = graphComputerClass;
     }
@@ -60,32 +53,6 @@ public final class Computer implements Function<Graph, GraphComputer>, Serializa
     private Computer() {
 
     }
-
-    public static Computer compute(final Configuration configuration) {
-        try {
-            final Computer computer = new Computer();
-            for (final String key : (List<String>) IteratorUtils.asList(configuration.getKeys())) {
-                if (key.equals(GRAPH_COMPUTER))
-                    computer.graphComputerClass = (Class) Class.forName(configuration.getString(key));
-                else if (key.equals(WORKERS))
-                    computer.workers = configuration.getInt(key);
-                else if (key.equals(PERSIST))
-                    computer.persist = GraphComputer.Persist.valueOf(configuration.getString(key));
-                else if (key.equals(RESULT))
-                    computer.resultGraph = GraphComputer.ResultGraph.valueOf(configuration.getString(key));
-                else if (key.equals(VERTICES))
-                    computer.vertices = (Traversal) configuration.getProperty(key);
-                else if (key.equals(EDGES))
-                    computer.edges = (Traversal) configuration.getProperty(key);
-                else
-                    computer.configuration.put(key, configuration.getProperty(key));
-            }
-            return computer;
-        } catch (final ClassNotFoundException e) {
-            throw new IllegalArgumentException(e.getMessage(), e);
-        }
-    }
-
     public static Computer compute() {
         return new Computer(GraphComputer.class);
     }
@@ -200,22 +167,4 @@ public final class Computer implements Function<Graph, GraphComputer>, Serializa
         return this.workers;
     }
 
-    public Configuration getConf() {
-        final Map<String, Object> map = new HashMap<>();
-        if (-1 != this.workers)
-            map.put(WORKERS, this.workers);
-        if (null != this.persist)
-            map.put(PERSIST, this.persist.name());
-        if (null != this.resultGraph)
-            map.put(RESULT, this.resultGraph.name());
-        if (null != this.vertices)
-            map.put(RESULT, this.vertices);
-        if (null != this.edges)
-            map.put(EDGES, this.edges);
-        map.put(GRAPH_COMPUTER, this.graphComputerClass.getCanonicalName());
-        for (final Map.Entry<String, Object> entry : this.configuration.entrySet()) {
-            map.put(entry.getKey(), entry.getValue());
-        }
-        return new MapConfiguration(map);
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
index 0496ae3..42f9bef 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
@@ -19,7 +19,10 @@
 
 package org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration;
 
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
+import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.step.VertexComputing;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.ComputerResultStep;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.ProgramVertexProgramStep;
@@ -35,8 +38,14 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 
@@ -45,14 +54,44 @@ import java.util.Set;
  */
 public final class VertexProgramStrategy extends AbstractTraversalStrategy<TraversalStrategy.DecorationStrategy> implements TraversalStrategy.DecorationStrategy {
 
+    private final Class<? extends GraphComputer> graphComputerClass;
+    private final Map<String, Object> configuration;
+    private final int workers;
+    private final GraphComputer.Persist persist;
+    private final GraphComputer.ResultGraph resultGraph;
+    private final Traversal<Vertex, Vertex> vertices;
+    private final Traversal<Vertex, Edge> edges;
     private Computer computer;
 
+
     private VertexProgramStrategy() {
+        this(null, -1, null, null, null, null, null);
 
     }
 
     public VertexProgramStrategy(final Computer computer) {
-        this.computer = computer;
+        this(computer.getGraphComputerClass(), computer.getWorkers(), computer.getResultGraph(), computer.getPersist(), computer.getVertices(), computer.getEdges(), computer.getConfiguration());
+    }
+
+    public VertexProgramStrategy(final Class<? extends GraphComputer> graphComputerClass, final int workers,
+                                 final GraphComputer.ResultGraph result, final GraphComputer.Persist persist,
+                                 final Traversal<Vertex, Vertex> vertices, final Traversal<Vertex, Edge> edges,
+                                 final Map<String, Object> configuration) {
+        this.graphComputerClass = graphComputerClass;
+        this.workers = workers;
+        this.resultGraph = result;
+        this.persist = persist;
+        this.vertices = vertices;
+        this.edges = edges;
+        this.configuration = configuration;
+        this.computer = Computer.compute(this.graphComputerClass).workers(this.workers).result(this.resultGraph).persist(this.persist).vertices(this.vertices).edges(this.edges);
+        for (final Map.Entry<String, Object> entry : this.configuration.entrySet()) {
+            this.computer = this.computer.configure(entry.getKey(), entry.getValue());
+        }
+    }
+
+    public Computer getComputer() {
+        return this.computer;
     }
 
     @Override
@@ -148,4 +187,124 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
         final Optional<TraversalStrategy<?>> optional = strategies.toList().stream().filter(strategy -> strategy instanceof VertexProgramStrategy).findAny();
         return optional.isPresent() ? Optional.of(((VertexProgramStrategy) optional.get()).computer) : Optional.empty();
     }
+
+    ////////////////////////////////////////////////////////////
+
+    public static final String GRAPH_COMPUTER = "graphComputer";
+    public static final String WORKERS = "workers";
+    public static final String PERSIST = "persist";
+    public static final String RESULT = "result";
+    public static final String VERTICES = "vertices";
+    public static final String EDGES = "edges";
+
+    public static VertexProgramStrategy create(final Configuration configuration) {
+        try {
+            final VertexProgramStrategy.Builder builder = VertexProgramStrategy.build();
+            for (final String key : (List<String>) IteratorUtils.asList(configuration.getKeys())) {
+                if (key.equals(GRAPH_COMPUTER))
+                    builder.graphComputerClass = (Class) Class.forName(configuration.getString(key));
+                else if (key.equals(WORKERS))
+                    builder.workers = configuration.getInt(key);
+                else if (key.equals(PERSIST))
+                    builder.persist = GraphComputer.Persist.valueOf(configuration.getString(key));
+                else if (key.equals(RESULT))
+                    builder.resultGraph = GraphComputer.ResultGraph.valueOf(configuration.getString(key));
+                else if (key.equals(VERTICES))
+                    builder.vertices = (Traversal) configuration.getProperty(key);
+                else if (key.equals(EDGES))
+                    builder.edges = (Traversal) configuration.getProperty(key);
+                else
+                    builder.configuration.put(key, configuration.getProperty(key));
+            }
+            return builder.create();
+        } catch (final ClassNotFoundException e) {
+            throw new IllegalArgumentException(e.getMessage(), e);
+        }
+    }
+
+    @Override
+    public Configuration getConfiguration() {
+        final Map<String, Object> map = new HashMap<>();
+        map.put(GRAPH_COMPUTER, this.graphComputerClass.getCanonicalName());
+        if (-1 != this.workers)
+            map.put(WORKERS, this.workers);
+        if (null != this.persist)
+            map.put(PERSIST, this.persist.name());
+        if (null != this.resultGraph)
+            map.put(RESULT, this.resultGraph.name());
+        if (null != this.vertices)
+            map.put(VERTICES, this.vertices);
+        if (null != this.edges)
+            map.put(EDGES, this.edges);
+        for (final Map.Entry<String, Object> entry : this.configuration.entrySet()) {
+            map.put(entry.getKey(), entry.getValue());
+        }
+        return new MapConfiguration(map);
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    public final static class Builder {
+
+        private Class<? extends GraphComputer> graphComputerClass = GraphComputer.class;
+        private Map<String, Object> configuration = new HashMap<>();
+        private int workers = -1;
+        private GraphComputer.Persist persist = null;
+        private GraphComputer.ResultGraph resultGraph = null;
+        private Traversal<Vertex, Vertex> vertices = null;
+        private Traversal<Vertex, Edge> edges = null;
+
+        private Builder() {
+        }
+
+        public Builder graphComputer(final Class<? extends GraphComputer> graphComputerClass) {
+            this.graphComputerClass = graphComputerClass;
+            return this;
+        }
+
+        public Builder configure(final String key, final Object value) {
+            this.configuration.put(key, value);
+            return this;
+        }
+
+        public Builder configure(final Map<String, Object> configurations) {
+            for (final Map.Entry<String, Object> entry : configurations.entrySet()) {
+                this.configuration.put(entry.getKey(), entry.getValue());
+            }
+            return this;
+        }
+
+        public Builder workers(final int workers) {
+            this.workers = workers;
+            return this;
+        }
+
+        public Builder persist(final GraphComputer.Persist persist) {
+            this.persist = persist;
+            return this;
+        }
+
+
+        public Builder result(final GraphComputer.ResultGraph resultGraph) {
+            this.resultGraph = resultGraph;
+            return this;
+        }
+
+        public Builder vertices(final Traversal<Vertex, Vertex> vertices) {
+            this.vertices = vertices;
+            return this;
+        }
+
+        public Builder edges(final Traversal<Vertex, Edge> edges) {
+            this.edges = edges;
+            return this;
+        }
+
+        public VertexProgramStrategy create() {
+            return new VertexProgramStrategy(this.graphComputerClass, this.workers, this.resultGraph, this.persist, this.vertices, this.edges, this.configuration);
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
index 5787681..f624545 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
@@ -84,7 +84,8 @@ public final class GraphComputerHelper {
         return a.getClass().equals(b.getClass()) && a.getMemoryKey().equals(((MapReduce) b).getMemoryKey());
     }
 
-    public static TraversalStrategy[] getTraversalStrategies(final TraversalSource traversalSource, final Computer computer) {
+    public static TraversalStrategy[] getTraversalStrategies(final TraversalSource traversalSource, final VertexProgramStrategy vertexProgramStrategy) {
+        final Computer computer = vertexProgramStrategy.getComputer();
         Class<? extends GraphComputer> graphComputerClass;
         if (computer.getGraphComputerClass().equals(GraphComputer.class)) {
             try {
@@ -95,10 +96,9 @@ public final class GraphComputerHelper {
         } else
             graphComputerClass = computer.getGraphComputerClass();
         final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList();
-        final TraversalStrategy[] traversalStrategies = new TraversalStrategy[graphComputerStrategies.size() + 1];
-        traversalStrategies[0] = new VertexProgramStrategy(computer);
+        final TraversalStrategy[] traversalStrategies = new TraversalStrategy[graphComputerStrategies.size()];
         for (int i = 0; i < graphComputerStrategies.size(); i++) {
-            traversalStrategies[i + 1] = graphComputerStrategies.get(i);
+            traversalStrategies[i] = graphComputerStrategies.get(i);
         }
         return traversalStrategies;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/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 d2ca5cb..da09362 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
@@ -19,8 +19,6 @@
 
 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;
@@ -283,8 +281,6 @@ public final class Bytecode implements Cloneable, Serializable {
         //
         if (argument instanceof Traversal)
             return ((Traversal) argument).asAdmin().getBytecode();
-        else if (argument instanceof Computer)
-            return convertArgument(ConfigurationConverter.getMap(((Computer) argument).getConf()), true);
         else if (argument instanceof Map) {
             final Map<Object, Object> map = new LinkedHashMap<>(((Map) argument).size());
             for (final Map.Entry<?, ?> entry : ((Map<?, ?>) argument).entrySet()) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/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 fa697f6..0185a33 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
@@ -19,7 +19,6 @@
 package org.apache.tinkerpop.gremlin.process.traversal;
 
 import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.MapConfiguration;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
@@ -33,7 +32,6 @@ import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
 
 import java.io.Serializable;
 import java.lang.reflect.Constructor;
-import java.util.Map;
 import java.util.Optional;
 import java.util.function.BinaryOperator;
 import java.util.function.Supplier;
@@ -108,6 +106,12 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
         final TraversalSource clone = this.clone();
         clone.getStrategies().addStrategies(traversalStrategies);
         clone.getBytecode().addSource(TraversalSource.Symbols.withStrategies, traversalStrategies);
+        for (final TraversalStrategy traversalStrategy : traversalStrategies) {
+            if (traversalStrategy instanceof VertexProgramStrategy) {
+                clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, (VertexProgramStrategy) traversalStrategy));
+                break;
+            }
+        }
         return clone;
     }
 
@@ -139,20 +143,6 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
     }
 
     /**
-     * Configure a {@link GraphComputer} to be used for the execution of subsequently spawned traversal.
-     * This adds a {@link VertexProgramStrategy} to the strategies.
-     *
-     * @param computerConfiguration key/value pair map for configuring a {@link Computer}
-     * @return a new traversal source with updated strategies
-     */
-    public default TraversalSource withComputer(final Map<String, Object> computerConfiguration) {
-        final TraversalSource clone = this.clone();
-        clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, Computer.compute(new MapConfiguration(computerConfiguration))));
-        clone.getBytecode().addSource(TraversalSource.Symbols.withComputer, computerConfiguration);
-        return clone;
-    }
-
-    /**
      * Add a {@link Computer} that will generate a {@link GraphComputer} from the {@link Graph} that will be used to execute the traversal.
      * This adds a {@link VertexProgramStrategy} to the strategies.
      *
@@ -160,10 +150,14 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      * @return a new traversal source with updated strategies
      */
     public default TraversalSource withComputer(final Computer computer) {
-        final TraversalSource clone = this.clone();
-        clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, computer));
-        clone.getBytecode().addSource(TraversalSource.Symbols.withComputer, computer);
-        return clone;
+        return this.withStrategies(VertexProgramStrategy.build().
+                graphComputer(computer.getGraphComputerClass()).
+                workers(computer.getWorkers()).
+                result(computer.getResultGraph()).
+                persist(computer.getPersist()).
+                vertices(computer.getVertices()).
+                edges(computer.getEdges()).
+                configure(computer.getConfiguration()).create());
     }
 
     /**
@@ -174,10 +168,7 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      * @return a new traversal source with updated strategies
      */
     public default TraversalSource withComputer(final Class<? extends GraphComputer> graphComputerClass) {
-        final TraversalSource clone = this.clone();
-        clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, Computer.compute(graphComputerClass)));
-        clone.getBytecode().addSource(TraversalSource.Symbols.withComputer, graphComputerClass);
-        return clone;
+        return this.withStrategies(VertexProgramStrategy.build().graphComputer(graphComputerClass).create());
     }
 
     /**
@@ -187,10 +178,7 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      * @return a new traversal source with updated strategies
      */
     public default TraversalSource withComputer() {
-        final TraversalSource clone = this.clone();
-        clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, Computer.compute()));
-        clone.getBytecode().addSource(TraversalSource.Symbols.withComputer);
-        return clone;
+        return this.withStrategies(VertexProgramStrategy.build().create());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/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 4cf20ce..362c571 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
@@ -137,12 +137,7 @@ public class GraphTraversalSource implements TraversalSource {
     public GraphTraversalSource withBindings(final Bindings bindings) {
         return (GraphTraversalSource) TraversalSource.super.withBindings(bindings);
     }
-
-    @Override
-    public GraphTraversalSource withComputer(final Map<String,Object> computerConfiguration) {
-        return (GraphTraversalSource) TraversalSource.super.withComputer(computerConfiguration);
-    }
-
+    
     @Override
     public GraphTraversalSource withComputer(final Computer computer) {
         return (GraphTraversalSource) TraversalSource.super.withComputer(computer);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
index e6df371..1b655ca 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
@@ -19,8 +19,8 @@
 
 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.computer.traversal.strategy.decoration.VertexProgramStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
@@ -112,6 +112,8 @@ public class BytecodeTest {
     public void shouldConvertComputer() {
         final GraphTraversalSource g = EmptyGraph.instance().traversal();
         Bytecode bytecode = g.withComputer(Computer.compute().workers(10)).getBytecode();
-        assertEquals(ConfigurationConverter.getMap(Computer.compute().workers(10).getConf()), bytecode.getSourceInstructions().iterator().next().getArguments()[0]);
+        assertEquals(VertexProgramStrategy.build().create(), bytecode.getSourceInstructions().iterator().next().getArguments()[0]);
+        assertEquals(VertexProgramStrategy.build().workers(10).create().getConfiguration().getInt(VertexProgramStrategy.WORKERS),
+                ((VertexProgramStrategy) bytecode.getSourceInstructions().iterator().next().getArguments()[0]).getConfiguration().getInt(VertexProgramStrategy.WORKERS));
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/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 3d2aece..02e49b1 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
@@ -20,7 +20,6 @@
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
 import org.apache.commons.configuration.ConfigurationConverter;
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
@@ -159,9 +158,7 @@ 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 Computer)
-            return convertToString(ConfigurationConverter.getMap(((Computer) object).getConf()));
-        else if (object instanceof TraversalStrategyProxy) {
+        } else if (object instanceof TraversalStrategyProxy) {
             final TraversalStrategyProxy proxy = (TraversalStrategyProxy) object;
             if (proxy.getConfiguration().isEmpty())
                 return proxy.getStrategyClass().getCanonicalName() + ".instance()";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
index cdca686..ed377bd 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/GraphTraversalSourceGenerator.groovy
@@ -58,6 +58,7 @@ under the License.
         pythonClass.append("import sys\n")
         pythonClass.append("from .traversal import Traversal\n")
         pythonClass.append("from .traversal import TraversalStrategies\n")
+        pythonClass.append("from .strategies import VertexProgramStrategy\n")
         pythonClass.append("from .traversal import Bytecode\n")
         pythonClass.append("from ..driver.remote_connection import RemoteStrategy\n")
         pythonClass.append("from .. import statics\n")
@@ -82,7 +83,8 @@ under the License.
                 findAll {
                     !it.name.equals("clone") &&
                             !it.name.equals(TraversalSource.Symbols.withBindings) &&
-                            !it.name.equals(TraversalSource.Symbols.withRemote)
+                            !it.name.equals(TraversalSource.Symbols.withRemote) &&
+                            !it.name.equals(TraversalSource.Symbols.withComputer)
                 }.
                 collect { SymbolHelper.toPython(it.name) }.
                 unique().
@@ -102,6 +104,8 @@ under the License.
     return source
   def withBindings(self, bindings):
     return self
+  def withComputer(self,graph_computer=None, workers=None, result=None, persist=None, vertices=None, edges=None, configuration=None):
+    return self.withStrategies(VertexProgramStrategy(graph_computer,workers,result,persist,vertices,edges,configuration))
 """)
         GraphTraversalSource.getMethods(). // SPAWN STEPS
                 findAll { GraphTraversal.class.equals(it.returnType) }.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/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 9219717..bfabbb8 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
@@ -20,7 +20,6 @@
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
 import org.apache.commons.configuration.ConfigurationConverter;
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
@@ -188,8 +187,6 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             return convertStatic(((Enum) object).getDeclaringClass().getSimpleName() + ".") + SymbolHelper.toPython(object.toString());
         else if (object instanceof P)
             return convertPToString((P) object, new StringBuilder()).toString();
-        else if (object instanceof Computer)
-            return convertToString(ConfigurationConverter.getMap(((Computer) object).getConf()));
         else if (object instanceof Element)
             return convertToString(((Element) object).id()); // hack
         else if (object instanceof Lambda)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
index 35b9b71..6165ed3 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py
@@ -19,6 +19,7 @@ under the License.
 import sys
 from .traversal import Traversal
 from .traversal import TraversalStrategies
+from .strategies import VertexProgramStrategy
 from .traversal import Bytecode
 from ..driver.remote_connection import RemoteStrategy
 from .. import statics
@@ -37,10 +38,6 @@ class GraphTraversalSource(object):
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.bytecode.add_source("withBulk", *args)
     return source
-  def withComputer(self, *args):
-    source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
-    source.bytecode.add_source("withComputer", *args)
-    return source
   def withPath(self, *args):
     source = GraphTraversalSource(self.graph, TraversalStrategies(self.traversal_strategies), Bytecode(self.bytecode))
     source.bytecode.add_source("withPath", *args)
@@ -67,6 +64,8 @@ class GraphTraversalSource(object):
     return source
   def withBindings(self, bindings):
     return self
+  def withComputer(self,graph_computer=None, workers=None, result=None, persist=None, vertices=None, edges=None, configuration=None):
+    return self.withStrategies(VertexProgramStrategy(graph_computer,workers,result,persist,vertices,edges,configuration))
   def E(self, *args):
     traversal = GraphTraversal(self.graph, self.traversal_strategies, Bytecode(self.bytecode))
     traversal.bytecode.add_step("E", *args)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/strategies.py b/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
index db9e094..437b4c0 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
@@ -36,30 +36,52 @@ class ElementIdStrategy(TraversalStrategy):
         TraversalStrategy.__init__(self)
 
 
+# EventStrategy doesn't make sense outside JVM traversal machine
+
 class HaltedTraverserStrategy(TraversalStrategy):
-    def __init__(self, haltedTraverserFactory="detached"):
-        TraversalStrategy.__init__(self, configuration={"haltedTraverserFactory": haltedTraverserFactory})
+    def __init__(self, halted_traverser_factory):
+        TraversalStrategy.__init__(self, configuration={"haltedTraverserFactory": halted_traverser_factory})
 
 
 class PartitionStrategy(TraversalStrategy):
-    def __init__(self, partitionKey, writePartition=None, readPartitions=None, includeMetaProperties=False):
-        TraversalStrategy.__init__(self, configuration={"partitionKey": partitionKey,
-                                                        "includeMetaProperties": includeMetaProperties})
-        if writePartition is not None:
-            self.configuration["writePartition"] = writePartition
-        if writePartition is not None:
-            self.configuration["readPartitions"] = readPartitions
+    def __init__(self, partition_key, write_partition=None, read_partitions=None, include_meta_properties=False):
+        TraversalStrategy.__init__(self, configuration={"partitionKey": partition_key,
+                                                        "includeMetaProperties": include_meta_properties})
+        if write_partition is not None:
+            self.configuration["writePartition"] = write_partition
+        if write_partition is not None:
+            self.configuration["readPartitions"] = read_partitions
 
 
 class SubgraphStrategy(TraversalStrategy):
-    def __init__(self, vertices=None, edges=None, vertexProperties=None):
+    def __init__(self, vertices=None, edges=None, vertex_properties=None):
         TraversalStrategy.__init__(self)
         if vertices is not None:
             self.configuration["vertices"] = vertices
         if edges is not None:
             self.configuration["edges"] = edges
-        if vertexProperties is not None:
-            self.configuration["vertexProperties"] = vertexProperties
+        if vertex_properties is not None:
+            self.configuration["vertexProperties"] = vertex_properties
+
+
+class VertexProgramStrategy(TraversalStrategy):
+    def __init__(self, graph_computer=None, workers=None, persist=None, result=None, vertices=None, edges=None,
+                 configuration=None):
+        TraversalStrategy.__init__(self)
+        if graph_computer is not None:
+            self.configuration["graphComputer"] = graph_computer
+        if workers is not None:
+            self.configuration["workers"] = workers
+        if persist is not None:
+            self.configuration["persist"] = persist
+        if result is not None:
+            self.configuration["result"] = result
+        if vertices is not None:
+            self.configuration["vertices"] = vertices
+        if edges is not None:
+            self.configuration["edges"] = edges
+        if configuration is not None:
+            self.configuration.update(configuration)
 
 
 ###########################
@@ -67,8 +89,10 @@ class SubgraphStrategy(TraversalStrategy):
 ###########################
 
 class MatchAlgorithmStrategy(TraversalStrategy):
-    def __init__(self, matchAlgorithm="count"):
-        TraversalStrategy.__init__(self, configuration={"matchAlgorithm": matchAlgorithm})
+    def __init__(self, match_algorithm=None):
+        TraversalStrategy.__init__(self)
+        if match_algorithm is not None:
+            self.configuration["matchAlgorithm"] = match_algorithm
 
 
 ###########################
@@ -135,6 +159,11 @@ class RepeatUnrollStrategy(TraversalStrategy):
         TraversalStrategy.__init__(self)
 
 
+class GraphFilterStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
 ###########################
 # VERIFICATION STRATEGIES #
 ###########################

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/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 0de045a..a4561e9 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
@@ -85,7 +85,7 @@ class TestDriverRemoteConnection(TestCase):
         assert "person" == g.V().label().dedup().next()
         #
         g = g.withoutStrategies(SubgraphStrategy). \
-            withComputer({"workers": 4, "vertices": __.has("name", "marko"), "edges": __.limit(0)})
+            withComputer(workers=4, vertices=__.has("name", "marko"), edges=__.limit(0))
         assert 1 == g.V().count().next()
         assert 0 == g.E().count().next()
         assert "person" == g.V().label().next()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
index 615a0e2..313f406 100644
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
@@ -102,7 +102,7 @@ class TestGraphSONWriter(TestCase):
 
     def test_strategies(self):
         # we have a proxy model for now given that we don't want to have to have g:XXX all registered on the Gremlin traversal machine (yet)
-        assert {"@type": "g:SubgraphStrategy"} == json.loads(GraphSONWriter.writeObject(SubgraphStrategy))
+        assert {"@type": "g:SubgraphStrategy", "@value": {}} == json.loads(GraphSONWriter.writeObject(SubgraphStrategy))
         assert {"@type": "g:SubgraphStrategy", "@value": {
             "vertices": {"@type": "g:Bytecode", "@value": {"step": [["has", "name", "marko"]]}}}} == json.loads(
             GraphSONWriter.writeObject(SubgraphStrategy(vertices=__.has("name", "marko"))))

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6fdc59d2/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
index 131a9c3..8902b1f 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/TinkerGraphComputerProvider.java
@@ -18,9 +18,11 @@
  */
 package org.apache.tinkerpop.gremlin.tinkergraph.process;
 
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.GraphProvider;
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.tinkergraph.TinkerGraphProvider;
@@ -40,12 +42,12 @@ public class TinkerGraphComputerProvider extends TinkerGraphProvider {
     @Override
     public GraphTraversalSource traversal(final Graph graph) {
         return RANDOM.nextBoolean() ?
-                graph.traversal().withComputer(new HashMap<String, Object>() {{
-                    put(Computer.WORKERS, RANDOM.nextInt(Runtime.getRuntime().availableProcessors()) + 1);
-                    put(Computer.GRAPH_COMPUTER, RANDOM.nextBoolean() ?
+                graph.traversal().withStrategies(VertexProgramStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
+                    put(VertexProgramStrategy.WORKERS, RANDOM.nextInt(Runtime.getRuntime().availableProcessors()) + 1);
+                    put(VertexProgramStrategy.GRAPH_COMPUTER, RANDOM.nextBoolean() ?
                             GraphComputer.class.getCanonicalName() :
                             TinkerGraphComputer.class.getCanonicalName());
-                }}) :
+                }}))) :
                 graph.traversal(GraphTraversalSource.computer());
     }
 }


[2/7] tinkerpop git commit: Talked with @spmallette about making TraversalStrategies first class citizens -- g:ReadOnlyStrategy, etc. This allows us to get rid of the withStrategies(Map...) methods. Now both Gremlin-Python and Gremlin-Java talk in terms

Posted by ok...@apache.org.
Talked with @spmallette about making TraversalStrategies first class citizens -- g:ReadOnlyStrategy, etc. This allows us to get rid of the withStrategies(Map...) methods. Now both Gremlin-Python and Gremlin-Java talk in terms of TraversalStrategy instances which can be serialized across the wire via their Configurations. Note that this is the already merged branch name with appended 'redux'.


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

Branch: refs/heads/master
Commit: a33dfc012513cbd7da6f52437cafc9c6284b5c7d
Parents: 3caa2a9
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Oct 6 15:24:07 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Oct 6 16:16:38 2016 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  4 +-
 .../gremlin/jsr223/JavaTranslator.java          | 18 ++++-
 .../gremlin/process/traversal/Bytecode.java     |  4 +-
 .../process/traversal/TraversalSource.java      | 34 +-------
 .../process/traversal/TraversalStrategy.java    |  4 +-
 .../dsl/graph/GraphTraversalSource.java         |  6 --
 .../strategy/TraversalStrategyProxy.java        | 47 +++++++++++
 .../strategy/decoration/SubgraphStrategy.java   |  1 -
 .../finalization/MatchAlgorithmStrategy.java    | 10 +--
 .../structure/io/graphson/GraphSONModule.java   | 84 ++++++++++++++++++++
 .../GraphSONTraversalSerializersV2d0.java       | 36 +++++++++
 .../gremlin/jsr223/JavaTranslatorTest.java      | 68 ----------------
 .../gremlin/process/traversal/BytecodeTest.java | 26 +-----
 .../dsl/graph/GraphTraversalSourceTest.java     |  8 +-
 .../groovy/jsr223/GroovyTranslatorTest.java     | 12 +--
 .../gremlin/groovy/jsr223/GroovyTranslator.java | 21 +++--
 .../python/TraversalSourceGenerator.groovy      |  5 +-
 .../jsr223/GremlinJythonScriptEngine.java       |  5 --
 .../gremlin/python/jsr223/PythonTranslator.java | 13 ++-
 .../jython/gremlin_python/process/traversal.py  |  5 +-
 .../gremlin_python/structure/io/graphson.py     |  9 ++-
 .../driver/test_driver_remote_connection.py     |  9 ++-
 .../python/jsr223/JythonTranslatorTest.java     |  4 +-
 .../PartitionStrategyProcessTest.java           |  7 +-
 .../decoration/SubgraphStrategyProcessTest.java | 11 ++-
 .../TinkerGraphGroovyTranslatorProvider.java    |  1 +
 .../decoration/HaltedTraverserStrategyTest.java |  7 +-
 .../io/graphson/GraphSONTranslator.java         |  3 +-
 .../TinkerGraphGraphSONTranslatorProvider.java  |  1 -
 29 files changed, 270 insertions(+), 193 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index cda6d8c..2fbc9a0 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -30,11 +30,9 @@ TinkerPop 3.2.3 (Release Date: NOT OFFICIALLY RELEASED YET)
 * Fixed a `Bytecode` bug where nested structures (map, list, set) were not being analyzed for bindings and bytecode conversions.
 * Fixed a `String` bug in `GroovyTranslator` and `PythonTranslator` where if the string has double-quotes it now uses """ """.
 * Added a default `TraversalStrategy.getConfiguration()` which returns the configuration needed to construct the strategy.
-* Gremlin-Java `TraversalStrategy` and `Computer` instances are now converted to `Map`-representations in `Bytecode`.
 * `Computer` instances can be created with `Computer.create(Configuration)` and accessed via `Computer.getConf()`.
 * Every `TraversalStrategy` can be created via a `Configuration` and a static `MyStrategy.create(Configuration)`.
-* Added `TraversalSource.withComputer(Map<String,Object>)` for better language variant support.
-* Added `TraversalSource.withStrategies(Map<String,Object>...)`/`withoutStrategies(String...)` for better language variant support.
+* Added language-agnostic `TraversalStrategy` support in `Bytecode`.
 * Added `PartitionStrategy.Builder.readPartitions()` and deprecated `PartitionStrategy.Builder.addPartition()`.
 * A new version of `LazyBarrierStrategy` has been created and added to the default strategies.
 * `FilterRankStrategy` now propagates labels "right" over non-`Scoping` filters.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
index d1e974d..29c6c46 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslator.java
@@ -19,14 +19,17 @@
 
 package org.apache.tinkerpop.gremlin.jsr223;
 
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 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.structure.util.StringFactory;
 
 import java.lang.reflect.Array;
+import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Parameter;
 import java.util.ArrayList;
@@ -72,7 +75,7 @@ public final class JavaTranslator<S extends TraversalSource, T extends Traversal
         for (final Bytecode.Instruction instruction : bytecode.getSourceInstructions()) {
             if (IS_TESTING &&
                     instruction.getOperator().equals(TraversalSource.Symbols.withStrategies) &&
-                    ((Map) instruction.getArguments()[0]).get(TraversalStrategy.STRATEGY).toString().contains("TranslationStrategy"))
+                    instruction.getArguments()[0].toString().contains("TranslationStrategy"))
                 continue;
             dynamicSource = (TraversalSource) invokeMethod(dynamicSource, TraversalSource.class, instruction.getOperator(), instruction.getArguments());
         }
@@ -112,6 +115,17 @@ public final class JavaTranslator<S extends TraversalSource, T extends Traversal
             } catch (final Throwable e) {
                 throw new IllegalStateException(e.getMessage());
             }
+        } else if (object instanceof TraversalStrategyProxy) {
+            final Map<String, Object> map = new HashMap<>();
+            final Configuration configuration = ((TraversalStrategyProxy) object).getConfiguration();
+            configuration.getKeys().forEachRemaining(key -> map.put(key, translateObject(configuration.getProperty(key))));
+            try {
+                return map.isEmpty() ?
+                        ((TraversalStrategyProxy) object).getStrategyClass().getMethod("instance").invoke(null) :
+                        ((TraversalStrategyProxy) object).getStrategyClass().getMethod("create", Configuration.class).invoke(null, new MapConfiguration(map));
+            } catch (final NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
         } else if (object instanceof Map) {
             final Map<Object, Object> map = new LinkedHashMap<>(((Map) object).size());
             for (final Map.Entry<?, ?> entry : ((Map<?, ?>) object).entrySet()) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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 f331d50..83c802d 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
@@ -20,7 +20,9 @@
 package org.apache.tinkerpop.gremlin.process.traversal;
 
 import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.commons.configuration.MapConfiguration;
 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;
 
@@ -271,8 +273,6 @@ public final class Bytecode implements Cloneable, Serializable {
         //
         if (argument instanceof Traversal)
             return ((Traversal) argument).asAdmin().getBytecode();
-        else if (argument instanceof TraversalStrategy)
-            return convertArgument(ConfigurationConverter.getMap(((TraversalStrategy) argument).getConfiguration()), true);
         else if (argument instanceof Computer)
             return convertArgument(ConfigurationConverter.getMap(((Computer) argument).getConf()), true);
         else if (argument instanceof Map) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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 5b4e663..db4a50a 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
@@ -103,27 +103,14 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
 
     /**
      * Add an arbitrary collection of {@link TraversalStrategy} instances to the traversal source.
-     * The map configurations must have a <code>strategy</code> key that is the name of the strategy class.
      *
-     * @param traversalStrategyConfigurations a collection of traversal strategies to add by configuration
+     * @param traversalStrategies a colleciton of traversal strategies to add
      * @return a new traversal source with updated strategies
      */
-    @SuppressWarnings({"unchecked"})
-    public default TraversalSource withStrategies(final Map<String, Object>... traversalStrategyConfigurations) {
+    public default TraversalSource withStrategies(final TraversalStrategy... traversalStrategies) {
         final TraversalSource clone = this.clone();
-        final List<TraversalStrategy<?>> strategies = new ArrayList<>();
-        for (final Map<String, Object> map : traversalStrategyConfigurations) {
-            try {
-                final TraversalStrategy<?> traversalStrategy = (TraversalStrategy) ((1 == map.size()) ?
-                        Class.forName((String) map.get("strategy")).getMethod("instance").invoke(null) :
-                        Class.forName((String) map.get("strategy")).getMethod("create", Configuration.class).invoke(null, new MapConfiguration(map)));
-                strategies.add(traversalStrategy);
-            } catch (final ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
-                throw new IllegalArgumentException(e.getMessage(), e);
-            }
-        }
-        clone.getStrategies().addStrategies(strategies.toArray(new TraversalStrategy[strategies.size()]));
-        clone.getBytecode().addSource(TraversalSource.Symbols.withStrategies, traversalStrategyConfigurations);
+        clone.getStrategies().addStrategies(traversalStrategies);
+        clone.getBytecode().addSource(TraversalSource.Symbols.withStrategies, traversalStrategies);
         return clone;
     }
 
@@ -150,19 +137,6 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
     }
 
     /**
-     * Add an arbitrary collection of {@link TraversalStrategy} instances to the traversal source.
-     *
-     * @param traversalStrategies a colleciton of traversal strategies to add
-     * @return a new traversal source with updated strategies
-     */
-    public default TraversalSource withStrategies(final TraversalStrategy... traversalStrategies) {
-        final TraversalSource clone = this.clone();
-        clone.getStrategies().addStrategies(traversalStrategies);
-        clone.getBytecode().addSource(TraversalSource.Symbols.withStrategies, traversalStrategies);
-        return clone;
-    }
-
-    /**
      * Remove an arbitrary collection of {@link TraversalStrategy} classes from the traversal source.
      *
      * @param traversalStrategyClasses a collection of traversal strategy classes to remove

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
index 7943624..be9fc99 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategy.java
@@ -18,8 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal;
 
+import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.RangeByIsCountStrategy;
@@ -85,7 +85,7 @@ public interface TraversalStrategy<S extends TraversalStrategy> extends Serializ
      * @return the configuration used to create this strategy
      */
     public default Configuration getConfiguration() {
-        return new MapConfiguration(Collections.singletonMap(STRATEGY, this.getClass().getCanonicalName()));
+        return new BaseConfiguration();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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 8741894..ca3c3f6 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,12 +123,6 @@ public class GraphTraversalSource implements TraversalSource {
     //// CONFIGURATIONS
 
     @Override
-    @SuppressWarnings({"unchecked"})
-    public GraphTraversalSource withStrategies(final Map<String, Object>... traversalStrategyConfigurations) {
-        return (GraphTraversalSource) TraversalSource.super.withStrategies(traversalStrategyConfigurations);
-    }
-
-    @Override
     public GraphTraversalSource withoutStrategies(final String... traversalStrategyNames) {
         return (GraphTraversalSource) TraversalSource.super.withoutStrategies(traversalStrategyNames);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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
new file mode 100644
index 0000000..2e9e7bb
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/TraversalStrategyProxy.java
@@ -0,0 +1,47 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.process.traversal.strategy;
+
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+
+import java.io.Serializable;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class TraversalStrategyProxy<T extends TraversalStrategy> implements Serializable {
+
+    private final Configuration configuration;
+    private final Class<T> strategyClass;
+
+    public TraversalStrategyProxy(final Class<T> strategyClass, final Configuration configuration) {
+        this.configuration = configuration;
+        this.strategyClass = strategyClass;
+    }
+
+    public Configuration getConfiguration() {
+        return this.configuration;
+    }
+
+    public Class<T> getStrategyClass() {
+        return this.strategyClass;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
index e612bee..a115b1a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
@@ -279,7 +279,6 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
     @Override
     public Configuration getConfiguration() {
         final Map<String, Object> map = new HashMap<>();
-        map.put(STRATEGY, SubgraphStrategy.class.getCanonicalName());
         if (null != this.vertexCriterion)
             map.put(VERTICES, this.vertexCriterion);
         if (null != this.edgeCriterion)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java
index 7b78295..06edc7e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/MatchAlgorithmStrategy.java
@@ -27,8 +27,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
-import java.util.HashMap;
-import java.util.Map;
+import java.util.Collections;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -61,12 +60,9 @@ public final class MatchAlgorithmStrategy extends AbstractTraversalStrategy<Trav
 
     @Override
     public Configuration getConfiguration() {
-        final Map<String, Object> map = new HashMap<>();
-        map.put(STRATEGY, MatchAlgorithmStrategy.class.getCanonicalName());
-        map.put(MATCH_ALGORITHM, null != this.matchAlgorithmClass.getDeclaringClass() ?
+        return new MapConfiguration(Collections.singletonMap(MATCH_ALGORITHM, null != this.matchAlgorithmClass.getDeclaringClass() ?
                 this.matchAlgorithmClass.getCanonicalName().replace("." + this.matchAlgorithmClass.getSimpleName(), "$" + this.matchAlgorithmClass.getSimpleName()) :
-                this.matchAlgorithmClass.getCanonicalName());
-        return new MapConfiguration(map);
+                this.matchAlgorithmClass.getCanonicalName()));
     }
 
     public static Builder build() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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 787867f..d0c9a43 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
@@ -18,6 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.structure.io.graphson;
 
+import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.GraphFilterStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.Order;
@@ -27,8 +29,32 @@ import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ConnectiveStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategy;
+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.MatchPredicateStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.OrderLimitStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.PathProcessorStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.PathRetractionStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.RangeByIsCountStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.RepeatUnrollStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.LambdaRestrictionStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.StandardVerificationStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.AndP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.Metrics;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
@@ -59,6 +85,7 @@ import java.time.Year;
 import java.time.YearMonth;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -120,6 +147,34 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                             SackFunctions.Barrier.values(),
                             Scope.values(),
                             T.values()).flatMap(Stream::of).forEach(e -> put(e.getClass(), e.getDeclaringClass().getSimpleName()));
+                    Arrays.asList(
+                            ConnectiveStrategy.class,
+                            ElementIdStrategy.class,
+                            EventStrategy.class,
+                            HaltedTraverserStrategy.class,
+                            PartitionStrategy.class,
+                            SubgraphStrategy.class,
+                            LazyBarrierStrategy.class,
+                            MatchAlgorithmStrategy.class,
+                            AdjacentToIncidentStrategy.class,
+                            FilterRankingStrategy.class,
+                            IdentityRemovalStrategy.class,
+                            IncidentToAdjacentStrategy.class,
+                            InlineFilterStrategy.class,
+                            MatchPredicateStrategy.class,
+                            OrderLimitStrategy.class,
+                            PathProcessorStrategy.class,
+                            PathRetractionStrategy.class,
+                            RangeByIsCountStrategy.class,
+                            RepeatUnrollStrategy.class,
+                            ComputerVerificationStrategy.class,
+                            LambdaRestrictionStrategy.class,
+                            ReadOnlyStrategy.class,
+                            StandardVerificationStrategy.class,
+                            //
+                            GraphFilterStrategy.class,
+                            VertexProgramStrategy.class
+                    ).forEach(strategy -> put(strategy, strategy.getSimpleName()));
                 }});
 
         /**
@@ -165,6 +220,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
             addSerializer(Lambda.class, new GraphSONTraversalSerializersV2d0.LambdaJacksonSerializer());
             addSerializer(Bytecode.Binding.class, new GraphSONTraversalSerializersV2d0.BindingJacksonSerializer());
             addSerializer(Traverser.class, new GraphSONTraversalSerializersV2d0.TraverserJacksonSerializer());
+            addSerializer(TraversalStrategy.class, new GraphSONTraversalSerializersV2d0.TraversalStrategyJacksonSerializer());
 
             /////////////////////// DESERIALIZERS ////////////////////////////
 
@@ -193,6 +249,34 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
             addDeserializer(P.class, new GraphSONTraversalSerializersV2d0.PJacksonDeserializer());
             addDeserializer(Lambda.class, new GraphSONTraversalSerializersV2d0.LambdaJacksonDeserializer());
             addDeserializer(Traverser.class, new GraphSONTraversalSerializersV2d0.TraverserJacksonDeserializer());
+            Arrays.asList(
+                    ConnectiveStrategy.class,
+                    ElementIdStrategy.class,
+                    EventStrategy.class,
+                    HaltedTraverserStrategy.class,
+                    PartitionStrategy.class,
+                    SubgraphStrategy.class,
+                    LazyBarrierStrategy.class,
+                    MatchAlgorithmStrategy.class,
+                    AdjacentToIncidentStrategy.class,
+                    FilterRankingStrategy.class,
+                    IdentityRemovalStrategy.class,
+                    IncidentToAdjacentStrategy.class,
+                    InlineFilterStrategy.class,
+                    MatchPredicateStrategy.class,
+                    OrderLimitStrategy.class,
+                    PathProcessorStrategy.class,
+                    PathRetractionStrategy.class,
+                    RangeByIsCountStrategy.class,
+                    RepeatUnrollStrategy.class,
+                    ComputerVerificationStrategy.class,
+                    LambdaRestrictionStrategy.class,
+                    ReadOnlyStrategy.class,
+                    StandardVerificationStrategy.class,
+                    //
+                    GraphFilterStrategy.class,
+                    VertexProgramStrategy.class
+            ).forEach(strategy -> addDeserializer(strategy, new GraphSONTraversalSerializersV2d0.TraversalStrategyProxyJacksonDeserializer(strategy)));
         }
 
         public static Builder build() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTraversalSerializersV2d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTraversalSerializersV2d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTraversalSerializersV2d0.java
index ff3a69d..03e1b15 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTraversalSerializersV2d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTraversalSerializersV2d0.java
@@ -19,11 +19,15 @@
 
 package org.apache.tinkerpop.gremlin.structure.io.graphson;
 
+import org.apache.commons.configuration.ConfigurationConverter;
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.AndP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
@@ -217,6 +221,23 @@ final class GraphSONTraversalSerializersV2d0 {
         }
     }
 
+    final static class TraversalStrategyJacksonSerializer extends StdScalarSerializer<TraversalStrategy> {
+
+        public TraversalStrategyJacksonSerializer() {
+            super(TraversalStrategy.class);
+        }
+
+        @Override
+        public void serialize(final TraversalStrategy traversalStrategy, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
+                throws IOException {
+            jsonGenerator.writeStartObject();
+            for (final Map.Entry<Object, Object> entry : ConfigurationConverter.getMap(traversalStrategy.getConfiguration()).entrySet()) {
+                jsonGenerator.writeObjectField((String) entry.getKey(), entry.getValue());
+            }
+            jsonGenerator.writeEndObject();
+        }
+    }
+
     ///////////////////
     // DESERIALIZERS //
     //////////////////
@@ -346,4 +367,19 @@ final class GraphSONTraversalSerializersV2d0 {
             return new DefaultRemoteTraverser<>(data.get(GraphSONTokens.VALUE), (Long) data.get(GraphSONTokens.BULK));
         }
     }
+
+    final static class TraversalStrategyProxyJacksonDeserializer<T extends TraversalStrategy> extends AbstractObjectDeserializer<TraversalStrategyProxy> {
+
+        private final Class<T> clazz;
+
+        public TraversalStrategyProxyJacksonDeserializer(final Class<T> clazz) {
+            super(TraversalStrategyProxy.class);
+            this.clazz = clazz;
+        }
+
+        @Override
+        public TraversalStrategyProxy<T> createObject(final Map<String, Object> data) {
+            return new TraversalStrategyProxy<>(this.clazz, new MapConfiguration(data));
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslatorTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslatorTest.java
deleted file mode 100644
index ac8a645..0000000
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/jsr223/JavaTranslatorTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.tinkerpop.gremlin.jsr223;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Bindings;
-import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.process.traversal.step.filter.TraversalFilterStep;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
-import org.junit.Test;
-
-import java.util.HashMap;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public class JavaTranslatorTest {
-
-    @Test
-    public void shouldTranslateNestedBindings() {
-        final Bindings b = new Bindings();
-        final GraphTraversalSource g = EmptyGraph.instance().traversal().withBindings(b);
-
-        final Bytecode bytecode = g.withStrategies(new HashMap<String, Object>() {{
-            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
-            put(SubgraphStrategy.VERTICES, b.of("a", __.has("name", "marko")));
-        }}).V().out(b.of("b", "created")).asAdmin().getBytecode();
-
-        Traversal.Admin<?, ?> traversal = JavaTranslator.of(EmptyGraph.instance().traversal()).translate(bytecode);
-        assertFalse(traversal.isLocked());
-        assertEquals(2, traversal.getSteps().size());
-        // assertEquals(traversal.getBytecode(),bytecode); TODO: bindings are removed -- should translated bytecode be the same bytecode?!
-        traversal.applyStrategies();
-        assertEquals(5, TraversalHelper.getStepsOfAssignableClassRecursively(TraversalFilterStep.class, traversal).size());
-
-        // JavaTranslator should not mutate original bytecode
-        assertTrue(bytecode.getBindings().containsKey("a"));
-        assertTrue(bytecode.getBindings().containsKey("b"));
-        assertEquals(2, bytecode.getBindings().size());
-        assertEquals(__.has("name", "marko").asAdmin().getBytecode(), bytecode.getBindings().get("a"));
-        assertEquals("created", bytecode.getBindings().get("b"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
index 6093dae..e6df371 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/BytecodeTest.java
@@ -30,13 +30,8 @@ import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.junit.Test;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -104,30 +99,13 @@ public class BytecodeTest {
     }
 
     @Test
-    public void shouldSupportNestedBindings() {
-        final Bindings b = new Bindings();
-        final GraphTraversalSource g = EmptyGraph.instance().traversal().withBindings(b);
-
-        final Bytecode bytecode = g.withStrategies(new HashMap<String, Object>() {{
-            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
-            put(SubgraphStrategy.VERTICES, b.of("a", __.has("name", "marko")));
-        }}).V().out(b.of("b", "created")).asAdmin().getBytecode();
-
-        assertTrue(bytecode.getBindings().containsKey("a"));
-        assertTrue(bytecode.getBindings().containsKey("b"));
-        assertEquals(2, bytecode.getBindings().size());
-        assertEquals(__.has("name", "marko").asAdmin().getBytecode(), bytecode.getBindings().get("a"));
-        assertEquals("created", bytecode.getBindings().get("b"));
-    }
-
-    @Test
     public void shouldConvertStrategies() {
         final GraphTraversalSource g = EmptyGraph.instance().traversal();
         Bytecode bytecode = g.withStrategies(ReadOnlyStrategy.instance()).getBytecode();
-        assertEquals(Collections.singletonMap(ReadOnlyStrategy.STRATEGY, ReadOnlyStrategy.class.getCanonicalName()), bytecode.getSourceInstructions().iterator().next().getArguments()[0]);
+        assertEquals(ReadOnlyStrategy.instance(), bytecode.getSourceInstructions().iterator().next().getArguments()[0]);
         bytecode = g.withStrategies(SubgraphStrategy.build().edges(__.hasLabel("knows")).create()).getBytecode();
         assertEquals(SubgraphStrategy.build().edges(__.hasLabel("knows")).create().getEdgeCriterion().asAdmin().getBytecode(),
-                ((Map) bytecode.getSourceInstructions().iterator().next().getArguments()[0]).get(SubgraphStrategy.EDGES));
+                ((SubgraphStrategy) bytecode.getSourceInstructions().iterator().next().getArguments()[0]).getEdgeCriterion().asAdmin().getBytecode());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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 457747d..1817349 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
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.dsl.graph;
 
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
@@ -62,18 +63,17 @@ public class GraphTraversalSourceTest {
     public void shouldSupportMapBasedStrategies() throws Exception {
         GraphTraversalSource g = EmptyGraph.instance().traversal();
         assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
-        g = g.withStrategies(new HashMap<String, Object>() {{
-            put("strategy", SubgraphStrategy.class.getCanonicalName());
+        g = g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put("vertices", __.hasLabel("person"));
             put("vertexProperties", __.limit(0));
             put("edges", __.hasLabel("knows"));
-        }});
+        }})));
         assertTrue(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
         g = g.withoutStrategies(SubgraphStrategy.class.getCanonicalName());
         assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
         //
         assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
-        g = g.withStrategies(Collections.singletonMap("strategy", ReadOnlyStrategy.class.getCanonicalName()));
+        g = g.withStrategies(ReadOnlyStrategy.instance());
         assertTrue(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());
         g = g.withoutStrategies(ReadOnlyStrategy.class.getCanonicalName());
         assertFalse(g.getStrategies().getStrategy(ReadOnlyStrategy.class).isPresent());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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 df960c0..cb6620e 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
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
@@ -26,6 +27,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+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.decoration.TranslationStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
@@ -52,10 +54,9 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldHandleStrategies() throws Exception {
         GraphTraversalSource g = graph.traversal();
-        g = g.withStrategies(new HashMap<String, Object>() {{
-            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+        g = g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
-        }});
+        }})));
         final Bindings bindings = new SimpleBindings();
         bindings.put("g", g);
         Traversal.Admin<Vertex, Object> traversal = new GremlinGroovyScriptEngine().eval(g.V().values("name").asAdmin().getBytecode(), bindings);
@@ -67,10 +68,9 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
         assertEquals(new Long(6), traversal.next());
         assertFalse(traversal.hasNext());
         //
-        g = graph.traversal().withStrategies(new HashMap<String, Object>() {{
-            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+        g = graph.traversal().withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
-        }}, Collections.singletonMap(ReadOnlyStrategy.STRATEGY, ReadOnlyStrategy.class.getCanonicalName()));
+        }})), ReadOnlyStrategy.instance());
         traversal = new GremlinGroovyScriptEngine().eval(g.V().values("name").asAdmin().getBytecode(), bindings);
         assertEquals("marko", traversal.next());
         assertFalse(traversal.hasNext());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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 154c4a1..9a09595 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
@@ -19,11 +19,12 @@
 
 package org.apache.tinkerpop.gremlin.groovy.jsr223;
 
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
+import org.apache.commons.configuration.ConfigurationConverter;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 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.util.ConnectiveP;
@@ -86,7 +87,7 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             final String methodName = instruction.getOperator();
             if (IS_TESTING &&
                     instruction.getOperator().equals(TraversalSource.Symbols.withStrategies) &&
-                    ((Map) instruction.getArguments()[0]).get(TraversalStrategy.STRATEGY).toString().contains("TranslationStrategy"))
+                    instruction.getArguments()[0].toString().contains("TranslationStrategy"))
                 continue;
             if (0 == instruction.getArguments().length)
                 traversalScript.append(".").append(methodName).append("()");
@@ -105,9 +106,11 @@ 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 String)
-            return ((String) object).contains("\"") ? "\"\"\"" + object + "\"\"\"" : "\"" + object + "\"";
-        else if (object instanceof Set) {
+        else if (object instanceof Traversal)
+            return convertToString(((Traversal) object).asAdmin().getBytecode());
+        else if (object instanceof String) {
+            return (((String) object).contains("\"") ? "\"\"\"" + object + "\"\"\"" : "\"" + object + "\"").replace("$", "\\$");
+        } else if (object instanceof Set) {
             final Set<String> set = new HashSet<>(((Set) object).size());
             for (final Object item : (Set) object) {
                 set.add(convertToString(item));
@@ -154,7 +157,13 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             return lambdaString.startsWith("{") ? lambdaString : "{" + lambdaString + "}";
         } else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
-        else
+        else if (object instanceof TraversalStrategy) {
+            final TraversalStrategy strategy = (TraversalStrategy) object;
+            if (strategy.getConfiguration().isEmpty())
+                return strategy.getClass().getCanonicalName() + ".instance()";
+            else
+                return strategy.getClass().getCanonicalName() + ".create(new org.apache.commons.configuration.MapConfiguration(" + convertToString(ConfigurationConverter.getMap(strategy.getConfiguration())) + "))";
+        } else
             return null == object ? "null" : object.toString();
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
index fe62685..9534a0c 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
@@ -222,9 +222,10 @@ class TraversalStrategies(object):
             traversal_strategy.apply(traversal)
 
 
-@six.add_metaclass(abc.ABCMeta)
 class TraversalStrategy(object):
-    @abc.abstractmethod
+    def __init__(self, strategy_name, configuration=None):
+        self.strategy_name = strategy_name
+        self.configuration = {} if configuration is None else configuration
     def apply(self, traversal):
         return
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
index 66aecf8..554d80a 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/GremlinJythonScriptEngine.java
@@ -68,11 +68,6 @@ public class GremlinJythonScriptEngine implements GremlinScriptEngine {
                     "  else:\n    return TypeError('Index must be int or slice')");
             this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getitem__ = getitem_bypass");
             this.pyScriptEngine.eval(GraphTraversal.class.getSimpleName() + ".__getattr__ = lambda self, key: self.values(key)\n");
-            // necessary cause of var args bug in Jython (http://bugs.jython.org/issue1615)
-            this.pyScriptEngine.eval("def withStrategies_bypass(self, *args):\n" +
-                    "  self.getBytecode().addSource(\"withStrategies\", *args)\n" +
-                    "  return self\n");
-            this.pyScriptEngine.eval(GraphTraversalSource.class.getSimpleName() + ".withStrategies = withStrategies_bypass\n");
             this.pyScriptEngine.eval("\n" +
                     "from java.lang import Long\n" +
                     "import org.apache.tinkerpop.gremlin.util.function.Lambda\n" + // todo: remove or remove imported subclass names? (choose)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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 4bfdc45..41dbe4b 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
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.python.jsr223;
 
+import org.apache.commons.configuration.ConfigurationConverter;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
@@ -106,7 +107,7 @@ public class PythonTranslator implements Translator.ScriptTranslator {
             final Object[] arguments = instruction.getArguments();
             if (IS_TESTING &&
                     instruction.getOperator().equals(TraversalSource.Symbols.withStrategies) &&
-                    ((Map) instruction.getArguments()[0]).get(TraversalStrategy.STRATEGY).toString().contains("TranslationStrategy"))
+                    instruction.getArguments()[0].toString().contains("TranslationStrategy"))
                 continue;
             else if (0 == arguments.length)
                 traversalScript.append(".").append(SymbolHelper.toPython(methodName)).append("()");
@@ -136,6 +137,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 Traversal)
+            return convertToString(((Traversal) object).asAdmin().getBytecode());
         else if (object instanceof String)
             return ((String) object).contains("\"") ? "\"\"\"" + object + "\"\"\"" : "\"" + object + "\"";
         else if (object instanceof Set) {
@@ -161,7 +164,13 @@ 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 Boolean)
+        else if (object instanceof TraversalStrategy) {
+            final TraversalStrategy strategy = (TraversalStrategy) object;
+            if (strategy.getConfiguration().isEmpty())
+                return "TraversalStrategy(\"" + strategy.getClass().getSimpleName() + "\")";
+            else
+                return "TraversalStrategy(\"" + strategy.getClass().getSimpleName() + "\"," + convertToString(ConfigurationConverter.getMap(strategy.getConfiguration())) + ")";
+        } else if (object instanceof Boolean)
             return object.equals(Boolean.TRUE) ? "True" : "False";
         else if (object instanceof Class)
             return ((Class) object).getCanonicalName();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index aa36869..6ca763e 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -281,9 +281,10 @@ class TraversalStrategies(object):
             traversal_strategy.apply(traversal)
 
 
-@six.add_metaclass(abc.ABCMeta)
 class TraversalStrategy(object):
-    @abc.abstractmethod
+    def __init__(self, strategy_name, configuration=None):
+        self.strategy_name = strategy_name
+        self.configuration = {} if configuration is None else configuration
     def apply(self, traversal):
         return
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
index 7899925..63ea463 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
@@ -33,6 +33,7 @@ from gremlin_python.process.traversal import Bytecode
 from gremlin_python.process.traversal import P
 from gremlin_python.process.traversal import Traversal
 from gremlin_python.process.traversal import Traverser
+from gremlin_python.process.traversal import TraversalStrategy
 from gremlin_python.structure.graph import Edge
 from gremlin_python.structure.graph import Property
 from gremlin_python.structure.graph import Vertex
@@ -128,6 +129,11 @@ class BytecodeSerializer(GraphSONSerializer):
         return _SymbolHelper.objectify("Bytecode", dict)
 
 
+class TraversalStrategySerializer(GraphSONSerializer):
+    def _dictify(self, strategy):
+        return _SymbolHelper.objectify(strategy.strategy_name, GraphSONWriter._dictify(strategy.configuration))
+
+
 class TraverserSerializer(GraphSONSerializer):
     def _dictify(self, traverser):
         return _SymbolHelper.objectify("Traverser", {"value": GraphSONWriter._dictify(traverser.object),
@@ -288,7 +294,8 @@ serializers = {
     FunctionType: LambdaSerializer(),
     LongType: NumberSerializer(),
     IntType: NumberSerializer(),
-    FloatType: NumberSerializer()
+    FloatType: NumberSerializer(),
+    TraversalStrategy: TraversalStrategySerializer()
 }
 
 deserializers = {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/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 0524d74..7e9f88b 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
@@ -26,6 +26,7 @@ from gremlin_python import statics
 from gremlin_python.statics import long
 from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
 from gremlin_python.process.traversal import Traverser
+from gremlin_python.process.traversal import TraversalStrategy
 from gremlin_python.process.graph_traversal import __
 from gremlin_python.structure.graph import Graph
 from gremlin_python.structure.graph import Vertex
@@ -64,10 +65,10 @@ class TestDriverRemoteConnection(TestCase):
     def test_strategies(self):
         statics.load_statics(globals())
         connection = DriverRemoteConnection('ws://localhost:8182/gremlin', 'g')
-        g = Graph().traversal().withRemote(connection).withStrategies(
-            {"strategy": "org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy",
-             "vertices": __.hasLabel("person"),
-             "edges": __.hasLabel("created")})
+        g = Graph().traversal().withRemote(connection). \
+            withStrategies(TraversalStrategy("SubgraphStrategy",
+                                             {"vertices": __.hasLabel("person"),
+                                              "edges": __.hasLabel("created")}))
         print GraphSONWriter.writeObject(g.bytecode)
         assert 4 == g.V().count().next()
         assert 0 == g.E().count().next()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
index 40aac5c..8bd3265 100644
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/JythonTranslatorTest.java
@@ -49,7 +49,7 @@ import static org.junit.Assert.assertFalse;
  */
 public class JythonTranslatorTest {
 
-    @Test
+    /*@Test
     public void shouldHandleStrategies() throws Exception {
         GraphTraversalSource g = TinkerFactory.createModern().traversal();
         g = g.withStrategies(new HashMap<String, Object>() {{
@@ -71,7 +71,7 @@ public class JythonTranslatorTest {
         traversal = ((GremlinScriptEngine) ScriptEngineCache.get("gremlin-jython")).eval(g.V().values("name").asAdmin().getBytecode(), bindings);
         assertEquals("marko", traversal.next());
         assertFalse(traversal.hasNext());
-    }
+    }*/
 
     @Test
     public void shouldSupportStringSupplierLambdas() throws Exception {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
index 5d82e0e..af81542 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyProcessTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.FeatureRequirement;
 import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
@@ -420,12 +421,12 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
                 .partitionKey(partition).writePartition("C").readPartitions("A").create();
         final GraphTraversalSource sourceCA = g.withStrategies(partitionStrategyCA);
 
-        final GraphTraversalSource sourceCABC = g.withStrategies(new HashMap<String, Object>() {{
-            put(PartitionStrategy.STRATEGY, PartitionStrategy.class.getCanonicalName());
+        final GraphTraversalSource sourceCABC = g.withStrategies(PartitionStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
+
             put(PartitionStrategy.WRITE_PARTITION, "C");
             put(PartitionStrategy.PARTITION_KEY, partition);
             put(PartitionStrategy.READ_PARTITIONS, Arrays.asList("A", "B", "C"));
-        }});
+        }})));
         final PartitionStrategy partitionStrategyCC = PartitionStrategy.build()
                 .partitionKey(partition).writePartition("C").addReadPartition("C").create();
         final GraphTraversalSource sourceCC = g.withStrategies(partitionStrategyCC);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
index 4d95c96..ad2501d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration;
 
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
@@ -372,10 +373,9 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(CREW)
     public void shouldFilterVertexProperties() throws Exception {
-        GraphTraversalSource sg = g.withStrategies(new HashMap<String, Object>() {{
-            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+        GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put(SubgraphStrategy.VERTEX_PROPERTIES, __.has("startTime", P.gt(2005)));
-        }});
+        }})));
         checkResults(Arrays.asList("purcellville", "baltimore", "oakland", "seattle", "aachen"), sg.V().properties("location").value());
         checkResults(Arrays.asList("purcellville", "baltimore", "oakland", "seattle", "aachen"), sg.V().values("location"));
         if (sg.getStrategies().getStrategy(InlineFilterStrategy.class).isPresent())
@@ -401,11 +401,10 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
         sg = g.withStrategies(SubgraphStrategy.build().vertices(has("location")).vertexProperties(hasNot("endTime")).create());
         checkOrderedResults(Arrays.asList("aachen", "purcellville", "santa fe", "seattle"), sg.V().order().by("location", Order.incr).values("location"));
         //
-        sg = g.withStrategies(new HashMap<String, Object>() {{
-            put(SubgraphStrategy.STRATEGY, SubgraphStrategy.class.getCanonicalName());
+        sg = g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put(SubgraphStrategy.VERTICES, __.has("location"));
             put(SubgraphStrategy.VERTEX_PROPERTIES, __.hasNot("endTime"));
-        }});
+        }})));
         checkResults(Arrays.asList("aachen", "purcellville", "santa fe", "seattle"), sg.V().valueMap("location").select(Column.values).unfold().unfold());
         checkResults(Arrays.asList("aachen", "purcellville", "santa fe", "seattle"), sg.V().propertyMap("location").select(Column.values).unfold().unfold().value());
         //

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java
index c086c3a..dd118d7 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/groovy/jsr223/TinkerGraphGroovyTranslatorProvider.java
@@ -25,6 +25,7 @@ import org.apache.tinkerpop.gremlin.process.computer.GraphComputerTest;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionComputerTest;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionTest;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategy;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
index c70a31e..3999433 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/process/traversal/strategy/decoration/HaltedTraverserStrategyTest.java
@@ -19,8 +19,10 @@
 
 package org.apache.tinkerpop.gremlin.tinkergraph.process.traversal.strategy.decoration;
 
+import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.HaltedTraverserStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
@@ -61,10 +63,9 @@ public class HaltedTraverserStrategyTest {
     @Test
     public void shouldReturnDetachedElements() {
         final Graph graph = TinkerFactory.createModern();
-        final GraphTraversalSource g = graph.traversal().withComputer().withStrategies(new HashMap<String, Object>() {{
-            put(HaltedTraverserStrategy.STRATEGY, HaltedTraverserStrategy.class.getCanonicalName());
+        final GraphTraversalSource g = graph.traversal().withComputer().withStrategies(HaltedTraverserStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put(HaltedTraverserStrategy.HALTED_TRAVERSER_FACTORY, DetachedFactory.class.getCanonicalName());
-        }});
+        }})));
         g.V().out().forEachRemaining(vertex -> assertEquals(DetachedVertex.class, vertex.getClass()));
         g.V().out().properties("name").forEachRemaining(vertexProperty -> assertEquals(DetachedVertexProperty.class, vertexProperty.getClass()));
         g.V().out().values("name").forEachRemaining(value -> assertEquals(String.class, value.getClass()));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java
index 57d2560..4f50329 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java
@@ -59,7 +59,8 @@ final class GraphSONTranslator<S extends TraversalSource, T extends Traversal.Ad
         try {
             final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
             this.writer.writeObject(outputStream, BytecodeHelper.filterInstructions(bytecode,
-                    instruction -> !instruction.getOperator().equals(TraversalSource.Symbols.withStrategies)));
+                    instruction -> !(instruction.getOperator().equals(TraversalSource.Symbols.withStrategies) &&
+                            instruction.getArguments()[0].toString().contains("TranslationStrategy"))));
             // System.out.println(new String(outputStream.toByteArray()));
             return this.wrappedTranslator.translate(this.reader.readObject(new ByteArrayInputStream(outputStream.toByteArray()), Bytecode.class));
         } catch (final Exception e) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a33dfc01/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
index f5a229d..97fa7fa 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
@@ -61,7 +61,6 @@ public class TinkerGraphGraphSONTranslatorProvider extends TinkerGraphProvider {
             TraversalInterruptionComputerTest.class.getCanonicalName(),
             EventStrategyProcessTest.class.getCanonicalName(),
             CoreTraversalTest.class.getCanonicalName(),
-            PartitionStrategyProcessTest.class.getCanonicalName(),
             ElementIdStrategyProcessTest.class.getCanonicalName()));
 
 


[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

Posted by ok...@apache.org.
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()


[4/7] tinkerpop git commit: Merge branch 'master' into TINKERPOP-1455-redux

Posted by ok...@apache.org.
Merge branch 'master' into TINKERPOP-1455-redux


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

Branch: refs/heads/master
Commit: 027959811bcb186b86f389cd94fd76540877aa69
Parents: 018a481 c6b49f2
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Oct 7 07:38:52 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Oct 7 07:38:52 2016 -0600

----------------------------------------------------------------------
 bin/gremlin.sh                                  | 23 +---------------
 docs/src/dev/developer/release.asciidoc         |  4 +++
 docs/src/reference/the-traversal.asciidoc       | 24 +++++++++--------
 gremlin-console/bin/gremlin.sh                  | 25 +----------------
 gremlin-console/src/main/bin/gremlin.sh         | 28 +++++++++++---------
 .../server/GremlinResultSetIntegrateTest.java   | 12 ---------
 6 files changed, 34 insertions(+), 82 deletions(-)
----------------------------------------------------------------------



[5/7] tinkerpop git commit: added and removing strategies from a traversal source in Python is sooooooooo elegant. Mapped the strategies from Gremlin JVM, to Python. Add a good body of test cases.

Posted by ok...@apache.org.
added and removing strategies from a traversal source in Python is sooooooooo elegant. Mapped the strategies from Gremlin JVM, to Python. Add a good body of test cases.


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

Branch: refs/heads/master
Commit: f84b196372f89479472e9a39a0d885a866c9cdb4
Parents: 0279598
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Oct 7 10:11:52 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Oct 7 10:11:52 2016 -0600

----------------------------------------------------------------------
 docs/src/reference/gremlin-variants.asciidoc    |  12 +-
 .../process/traversal/TraversalSource.java      |   3 -
 .../python/TraversalSourceGenerator.groovy      |  22 ++-
 .../jython/gremlin_python/process/strategies.py | 149 +++++++++++++++++++
 .../jython/gremlin_python/process/traversal.py  |  22 ++-
 .../src/main/jython/gremlin_python/statics.py   |   3 +-
 .../gremlin_python/structure/io/graphson.py     |  17 ++-
 .../driver/test_driver_remote_connection.py     |  11 +-
 .../jython/tests/process/test_strategies.py     | 106 +++++++++++++
 .../jython/tests/structure/io/test_graphson.py  |  17 ++-
 10 files changed, 340 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 0001ba4..51e2d2b 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -229,20 +229,22 @@ Traversal Strategies
 ~~~~~~~~~~~~~~~~~~~~
 
 In order to add and remove <<traversalstrategy,traversal strategies>> from a traversal source, Gremlin-Python has a
-`TraversalStrategy` class that can be used.
+`TraversalStrategy` class along with numerous subclasses that mirror the standard, distributed strategies.
 
 [gremlin-python,modern]
 ----
-g = g.withStrategies(TraversalStrategy('SubgraphStrategy',{'vertices': hasLabel('person'),'edges': has('weight',gt(0.5))}))
+g = g.withStrategies(SubgraphStrategy(vertices=hasLabel('person'),edges=has('weight',gt(0.5))))
 g.V().name.toList()
 g.V().outE().valueMap(True).toList()
-g = g.withoutStrategies(TraversalStrategy('SubgraphStrategy'))
+g = g.withoutStrategies(SubgraphStrategy)
 g.V().name.toList()
 g.V().outE().valueMap(True).toList()
 ----
 
-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.
+NOTE: Many of the `TraversalStrategy` classes in Gremlin-Python are proxies to the respective strategy on the
+Apache TinkerPop's JVM-based Gremlin traversal machine. As such, their `apply(Traversal)` method does nothing. However,
+the strategy is encoded in the Gremlin-Python bytecode and transmittable to the Gremlin traversal machine for
+re-construction machine-side.
 
 The Lambda Solution
 ~~~~~~~~~~~~~~~~~~~

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/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 de77ea5..fa697f6 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
@@ -33,9 +33,6 @@ import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
 
 import java.io.Serializable;
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.function.BinaryOperator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
index 9534a0c..a12fe05 100644
--- a/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
+++ b/gremlin-python/src/main/groovy/org/apache/tinkerpop/gremlin/python/TraversalSourceGenerator.groovy
@@ -70,6 +70,11 @@ class Traversal(object):
         self.last_traverser = None
     def __repr__(self):
         return str(self.bytecode)
+    def __eq__(self, other):
+        if isinstance(other, self.__class__):
+            return self.bytecode == other.bytecode
+        else:
+            return False
     def __iter__(self):
         return self
     def __next__(self):
@@ -220,14 +225,22 @@ class TraversalStrategies(object):
     def apply_strategies(self, traversal):
         for traversal_strategy in self.traversal_strategies:
             traversal_strategy.apply(traversal)
+    def __repr__(self):
+        return str(self.traversal_strategies)
 
 
 class TraversalStrategy(object):
-    def __init__(self, strategy_name, configuration=None):
-        self.strategy_name = strategy_name
+    def __init__(self, strategy_name=None, configuration=None):
+        self.strategy_name = type(self).__name__ if strategy_name is None else strategy_name
         self.configuration = {} if configuration is None else configuration
     def apply(self, traversal):
         return
+    def __eq__(self, other):
+        return isinstance(other, self.__class__)
+    def __hash__(self):
+        return hash(self.strategy_name)
+    def __repr__(self):
+        return self.strategy_name
 
 '''
 BYTECODE
@@ -251,6 +264,11 @@ class Bytecode(object):
         for arg in args:
             instruction.append(self.__convertArgument(arg))
         self.step_instructions.append(instruction)
+    def __eq__(self, other):
+        if isinstance(other, self.__class__):
+            return self.source_instructions == other.source_instructions and self.step_instructions == other.step_instructions
+        else:
+            return False
     def __convertArgument(self,arg):
         if isinstance(arg, Traversal):
             self.bindings.update(arg.bytecode.bindings)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/strategies.py b/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
new file mode 100644
index 0000000..db9e094
--- /dev/null
+++ b/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
@@ -0,0 +1,149 @@
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+'''
+
+__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
+
+from gremlin_python.process.traversal import TraversalStrategy
+
+
+#########################
+# DECORATION STRATEGIES #
+#########################
+
+class ConnectiveStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class ElementIdStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class HaltedTraverserStrategy(TraversalStrategy):
+    def __init__(self, haltedTraverserFactory="detached"):
+        TraversalStrategy.__init__(self, configuration={"haltedTraverserFactory": haltedTraverserFactory})
+
+
+class PartitionStrategy(TraversalStrategy):
+    def __init__(self, partitionKey, writePartition=None, readPartitions=None, includeMetaProperties=False):
+        TraversalStrategy.__init__(self, configuration={"partitionKey": partitionKey,
+                                                        "includeMetaProperties": includeMetaProperties})
+        if writePartition is not None:
+            self.configuration["writePartition"] = writePartition
+        if writePartition is not None:
+            self.configuration["readPartitions"] = readPartitions
+
+
+class SubgraphStrategy(TraversalStrategy):
+    def __init__(self, vertices=None, edges=None, vertexProperties=None):
+        TraversalStrategy.__init__(self)
+        if vertices is not None:
+            self.configuration["vertices"] = vertices
+        if edges is not None:
+            self.configuration["edges"] = edges
+        if vertexProperties is not None:
+            self.configuration["vertexProperties"] = vertexProperties
+
+
+###########################
+# FINALIZATION STRATEGIES #
+###########################
+
+class MatchAlgorithmStrategy(TraversalStrategy):
+    def __init__(self, matchAlgorithm="count"):
+        TraversalStrategy.__init__(self, configuration={"matchAlgorithm": matchAlgorithm})
+
+
+###########################
+# OPTIMIZATION STRATEGIES #
+###########################
+
+class AdjacentToIncidentStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class FilterRankingStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class IdentityRemoveStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class IncidentToAdjacentStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class InlineFilterStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class LazyBarrierStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class MatchPredicateStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class OrderLimitStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class PathProcessorStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class PathRetractionStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class RangeByIsCountStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class RepeatUnrollStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+###########################
+# VERIFICATION STRATEGIES #
+###########################
+
+class LambdaRestrictionStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)
+
+
+class ReadOnlyStrategy(TraversalStrategy):
+    def __init__(self):
+        TraversalStrategy.__init__(self)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index 6ca763e..4611541 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -33,6 +33,11 @@ class Traversal(object):
         self.last_traverser = None
     def __repr__(self):
         return str(self.bytecode)
+    def __eq__(self, other):
+        if isinstance(other, self.__class__):
+            return self.bytecode == other.bytecode
+        else:
+            return False
     def __iter__(self):
         return self
     def __next__(self):
@@ -279,14 +284,22 @@ class TraversalStrategies(object):
     def apply_strategies(self, traversal):
         for traversal_strategy in self.traversal_strategies:
             traversal_strategy.apply(traversal)
+    def __repr__(self):
+        return str(self.traversal_strategies)
 
 
 class TraversalStrategy(object):
-    def __init__(self, strategy_name, configuration=None):
-        self.strategy_name = strategy_name
+    def __init__(self, strategy_name=None, configuration=None):
+        self.strategy_name = type(self).__name__ if strategy_name is None else strategy_name
         self.configuration = {} if configuration is None else configuration
     def apply(self, traversal):
         return
+    def __eq__(self, other):
+        return isinstance(other, self.__class__)
+    def __hash__(self):
+        return hash(self.strategy_name)
+    def __repr__(self):
+        return self.strategy_name
 
 '''
 BYTECODE
@@ -310,6 +323,11 @@ class Bytecode(object):
         for arg in args:
             instruction.append(self.__convertArgument(arg))
         self.step_instructions.append(instruction)
+    def __eq__(self, other):
+        if isinstance(other, self.__class__):
+            return self.source_instructions == other.source_instructions and self.step_instructions == other.step_instructions
+        else:
+            return False
     def __convertArgument(self,arg):
         if isinstance(arg, Traversal):
             self.bindings.update(arg.bytecode.bindings)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/gremlin-python/src/main/jython/gremlin_python/statics.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/statics.py b/gremlin-python/src/main/jython/gremlin_python/statics.py
index c827020..a1abf8e 100644
--- a/gremlin-python/src/main/jython/gremlin_python/statics.py
+++ b/gremlin-python/src/main/jython/gremlin_python/statics.py
@@ -28,12 +28,13 @@ if six.PY3:
     FloatType = float
     IntType = int
     LongType = long
+    TypeType = type
 else:
     long = long
     from types import FloatType
     from types import IntType
     from types import LongType
-
+    from types import TypeType
 
 staticMethods = {}
 staticEnums = {}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
index 63ea463..248d319 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
@@ -27,7 +27,7 @@ import six
 
 from gremlin_python import statics
 from gremlin_python.statics import (
-    FloatType, FunctionType, IntType, LongType, long)
+    FloatType, FunctionType, IntType, LongType, long, TypeType)
 from gremlin_python.process.traversal import Binding
 from gremlin_python.process.traversal import Bytecode
 from gremlin_python.process.traversal import P
@@ -183,6 +183,11 @@ class LambdaSerializer(GraphSONSerializer):
         return _SymbolHelper.objectify("Lambda", dict)
 
 
+class TypeSerializer(GraphSONSerializer):
+    def _dictify(self, clazz):
+        return GraphSONWriter._dictify(clazz())
+
+
 class NumberSerializer(GraphSONSerializer):
     def _dictify(self, number):
         if isinstance(number, bool):  # python thinks that 0/1 integers are booleans
@@ -280,8 +285,11 @@ class _SymbolHelper(object):
         return _SymbolHelper.symbolMap[symbol] if symbol in _SymbolHelper.symbolMap else symbol
 
     @staticmethod
-    def objectify(type, value, prefix="g"):
-        return {_SymbolHelper._TYPE: prefix + ":" + type, _SymbolHelper._VALUE: value}
+    def objectify(type, value=None, prefix="g"):
+        object = {_SymbolHelper._TYPE: prefix + ":" + type}
+        if value is not None:
+            object[_SymbolHelper._VALUE] = value
+        return object
 
 
 serializers = {
@@ -295,7 +303,8 @@ serializers = {
     LongType: NumberSerializer(),
     IntType: NumberSerializer(),
     FloatType: NumberSerializer(),
-    TraversalStrategy: TraversalStrategySerializer()
+    TypeType: TypeSerializer(),
+    TraversalStrategy: TraversalStrategySerializer(),
 }
 
 deserializers = {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/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 847d14d..0de045a 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
@@ -31,6 +31,7 @@ from gremlin_python.process.graph_traversal import __
 from gremlin_python.structure.graph import Graph
 from gremlin_python.structure.graph import Vertex
 from gremlin_python.structure.io.graphson import GraphSONWriter
+from gremlin_python.process.strategies import SubgraphStrategy
 
 
 class TestDriverRemoteConnection(TestCase):
@@ -75,7 +76,15 @@ class TestDriverRemoteConnection(TestCase):
         assert 1 == g.V().label().dedup().count().next()
         assert "person" == g.V().label().dedup().next()
         #
-        g = g.withoutStrategies(TraversalStrategy("SubgraphStrategy")). \
+        g = Graph().traversal().withRemote(connection). \
+            withStrategies(SubgraphStrategy(vertices=__.hasLabel("person"), edges=__.hasLabel("created")))
+        print GraphSONWriter.writeObject(g.bytecode)
+        assert 4 == g.V().count().next()
+        assert 0 == g.E().count().next()
+        assert 1 == g.V().label().dedup().count().next()
+        assert "person" == g.V().label().dedup().next()
+        #
+        g = g.withoutStrategies(SubgraphStrategy). \
             withComputer({"workers": 4, "vertices": __.has("name", "marko"), "edges": __.limit(0)})
         assert 1 == g.V().count().next()
         assert 0 == g.E().count().next()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/gremlin-python/src/main/jython/tests/process/test_strategies.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/process/test_strategies.py b/gremlin-python/src/main/jython/tests/process/test_strategies.py
new file mode 100644
index 0000000..6d1d2c3
--- /dev/null
+++ b/gremlin-python/src/main/jython/tests/process/test_strategies.py
@@ -0,0 +1,106 @@
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+'''
+
+__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
+
+import unittest
+from unittest import TestCase
+
+from gremlin_python.structure.graph import Graph
+from gremlin_python.process.strategies import *
+from gremlin_python.process.graph_traversal import __
+
+
+class TestTraversalStrategies(TestCase):
+    def test_singletons(self):
+        g = Graph().traversal()
+        bytecode = g.withStrategies(ReadOnlyStrategy()).bytecode
+        assert 1 == len(bytecode.source_instructions)
+        assert 2 == len(bytecode.source_instructions[0])
+        assert "withStrategies" == bytecode.source_instructions[0][0]
+        assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
+        assert "ReadOnlyStrategy" == str(bytecode.source_instructions[0][1])
+        assert hash(ReadOnlyStrategy()) == hash(bytecode.source_instructions[0][1])
+        assert 0 == len(g.traversal_strategies.traversal_strategies)  # these strategies are proxies
+        ##
+        g = g.withStrategies(ReadOnlyStrategy(), IncidentToAdjacentStrategy())
+        bytecode = g.bytecode
+        assert 1 == len(bytecode.source_instructions)
+        assert 3 == len(bytecode.source_instructions[0])
+        assert "withStrategies" == bytecode.source_instructions[0][0]
+        assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
+        assert IncidentToAdjacentStrategy() == bytecode.source_instructions[0][2]
+        ##
+        bytecode = g.V().bytecode
+        assert 1 == len(bytecode.source_instructions)
+        assert 3 == len(bytecode.source_instructions[0])
+        assert "withStrategies" == bytecode.source_instructions[0][0]
+        assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
+        assert IncidentToAdjacentStrategy() == bytecode.source_instructions[0][2]
+        assert 1 == len(bytecode.step_instructions)
+        assert "V" == bytecode.step_instructions[0][0]
+        ##
+        bytecode = g.withoutStrategies(ReadOnlyStrategy()).V().bytecode
+        assert 2 == len(bytecode.source_instructions)
+        assert 3 == len(bytecode.source_instructions[0])
+        assert 2 == len(bytecode.source_instructions[1])
+        assert "withStrategies" == bytecode.source_instructions[0][0]
+        assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
+        assert IncidentToAdjacentStrategy() == bytecode.source_instructions[0][2]
+        assert "withoutStrategies" == bytecode.source_instructions[1][0]
+        assert ReadOnlyStrategy() == bytecode.source_instructions[1][1]
+        assert 1 == len(bytecode.step_instructions)
+        assert "V" == bytecode.step_instructions[0][0]
+        ##
+        bytecode = g.withoutStrategies(ReadOnlyStrategy(), LazyBarrierStrategy()).V().bytecode
+        assert 2 == len(bytecode.source_instructions)
+        assert 3 == len(bytecode.source_instructions[0])
+        assert 3 == len(bytecode.source_instructions[1])
+        assert "withStrategies" == bytecode.source_instructions[0][0]
+        assert ReadOnlyStrategy() == bytecode.source_instructions[0][1]
+        assert IncidentToAdjacentStrategy() == bytecode.source_instructions[0][2]
+        assert "withoutStrategies" == bytecode.source_instructions[1][0]
+        assert ReadOnlyStrategy() == bytecode.source_instructions[1][1]
+        assert LazyBarrierStrategy() == bytecode.source_instructions[1][2]
+        assert 1 == len(bytecode.step_instructions)
+        assert "V" == bytecode.step_instructions[0][0]
+
+    def test_configurable(self):
+        g = Graph().traversal()
+        bytecode = g.withStrategies(MatchAlgorithmStrategy("greedy")).bytecode
+        assert 1 == len(bytecode.source_instructions)
+        assert 2 == len(bytecode.source_instructions[0])
+        assert "withStrategies" == bytecode.source_instructions[0][0]
+        assert MatchAlgorithmStrategy() == bytecode.source_instructions[0][1]
+        assert "MatchAlgorithmStrategy" == str(bytecode.source_instructions[0][1])
+        assert hash(MatchAlgorithmStrategy()) == hash(
+            bytecode.source_instructions[0][1])  # even though different confs, same strategy
+        assert 0 == len(g.traversal_strategies.traversal_strategies)  # these strategies are proxies
+        ###
+        bytecode = g.withStrategies(SubgraphStrategy(vertices=__.has("name","marko"))).bytecode
+        assert 1 == len(bytecode.source_instructions)
+        assert 2 == len(bytecode.source_instructions[0])
+        assert "withStrategies" == bytecode.source_instructions[0][0]
+        assert SubgraphStrategy() == bytecode.source_instructions[0][1]
+        strategy = bytecode.source_instructions[0][1]
+        assert 1 == len(strategy.configuration)
+        assert __.has("name","marko") == strategy.configuration["vertices"]
+
+if __name__ == '__main__':
+    unittest.main()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f84b1963/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
index 99c9a45..615a0e2 100644
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
@@ -25,12 +25,14 @@ from unittest import TestCase
 
 import six
 
-from gremlin_python.statics import long
+from gremlin_python.statics import *
 from gremlin_python.structure.graph import Vertex
 from gremlin_python.structure.graph import Path
 from gremlin_python.structure.io.graphson import GraphSONReader
 from gremlin_python.structure.io.graphson import GraphSONWriter
 from gremlin_python.process.traversal import P
+from gremlin_python.process.strategies import SubgraphStrategy
+from gremlin_python.process.graph_traversal import __
 
 
 class TestGraphSONReader(TestCase):
@@ -89,15 +91,22 @@ class TestGraphSONReader(TestCase):
 
 class TestGraphSONWriter(TestCase):
     def test_numbers(self):
-        assert {"@type":"g:Int64","@value":2} == json.loads(GraphSONWriter.writeObject(long(2)))
-        assert {"@type":"g:Int32","@value":1} == json.loads(GraphSONWriter.writeObject(1))
-        assert {"@type":"g:Float","@value":3.2} == json.loads(GraphSONWriter.writeObject(3.2))
+        assert {"@type": "g:Int64", "@value": 2} == json.loads(GraphSONWriter.writeObject(long(2)))
+        assert {"@type": "g:Int32", "@value": 1} == json.loads(GraphSONWriter.writeObject(1))
+        assert {"@type": "g:Float", "@value": 3.2} == json.loads(GraphSONWriter.writeObject(3.2))
         assert """true""" == GraphSONWriter.writeObject(True)
 
     def test_P(self):
         assert """{"@type":"g:P","@value":{"predicate":"and","value":[{"@type":"g:P","@value":{"predicate":"or","value":[{"@type":"g:P","@value":{"predicate":"lt","value":"b"}},{"@type":"g:P","@value":{"predicate":"gt","value":"c"}}]}},{"@type":"g:P","@value":{"predicate":"neq","value":"d"}}]}}""" == GraphSONWriter.writeObject(
             P.lt("b").or_(P.gt("c")).and_(P.neq("d")))
 
+    def test_strategies(self):
+        # we have a proxy model for now given that we don't want to have to have g:XXX all registered on the Gremlin traversal machine (yet)
+        assert {"@type": "g:SubgraphStrategy"} == json.loads(GraphSONWriter.writeObject(SubgraphStrategy))
+        assert {"@type": "g:SubgraphStrategy", "@value": {
+            "vertices": {"@type": "g:Bytecode", "@value": {"step": [["has", "name", "marko"]]}}}} == json.loads(
+            GraphSONWriter.writeObject(SubgraphStrategy(vertices=__.has("name", "marko"))))
+
 
 if __name__ == '__main__':
     unittest.main()


[7/7] tinkerpop git commit: finalized the Gremlin-Python TraversalStrategy and Computer work. Able to expose Translators to more tests. This is soooooooooooo much cleaner and intutive. Stoked.

Posted by ok...@apache.org.
finalized the Gremlin-Python TraversalStrategy and Computer work. Able to expose Translators to more tests. This is soooooooooooo much cleaner and intutive. Stoked.


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

Branch: refs/heads/master
Commit: 9b13383449e23dd3a8e13d3c60736823f6e03ae5
Parents: 6fdc59d
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Oct 7 14:57:06 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Oct 7 14:57:06 2016 -0600

----------------------------------------------------------------------
 .../gremlin/process/computer/Computer.java      |  17 ++-
 .../decoration/VertexProgramStrategy.java       | 132 ++++++++-----------
 .../computer/util/GraphComputerHelper.java      |  24 ----
 .../process/traversal/TraversalSource.java      |  17 +--
 .../gremlin/python/jsr223/PythonProvider.java   |   3 -
 .../TinkerGraphGraphSONTranslatorProvider.java  |   2 -
 6 files changed, 75 insertions(+), 120 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b133834/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
index a82b4e6..34b1fa4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/Computer.java
@@ -19,17 +19,13 @@
 
 package org.apache.tinkerpop.gremlin.process.computer;
 
-import org.apache.commons.configuration.Configuration;
-import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
 import java.io.Serializable;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
 
@@ -53,6 +49,7 @@ public final class Computer implements Function<Graph, GraphComputer>, Serializa
     private Computer() {
 
     }
+
     public static Computer compute() {
         return new Computer(GraphComputer.class);
     }
@@ -61,12 +58,24 @@ public final class Computer implements Function<Graph, GraphComputer>, Serializa
         return new Computer(graphComputerClass);
     }
 
+    public Computer graphComputer(final Class<? extends GraphComputer> graphComputerClass) {
+        final Computer clone = this.clone();
+        clone.graphComputerClass = graphComputerClass;
+        return clone;
+    }
+
     public Computer configure(final String key, final Object value) {
         final Computer clone = this.clone();
         clone.configuration.put(key, value);
         return clone;
     }
 
+    public Computer configure(final Map<String, Object> configurations) {
+        final Computer clone = this.clone();
+        clone.configuration.putAll(configurations);
+        return clone;
+    }
+
     public Computer workers(final int workers) {
         final Computer clone = this.clone();
         clone.workers = workers;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b133834/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
index 42f9bef..21c1ae6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
@@ -30,6 +30,7 @@ import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.Traversa
 import org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
@@ -54,40 +55,14 @@ import java.util.Set;
  */
 public final class VertexProgramStrategy extends AbstractTraversalStrategy<TraversalStrategy.DecorationStrategy> implements TraversalStrategy.DecorationStrategy {
 
-    private final Class<? extends GraphComputer> graphComputerClass;
-    private final Map<String, Object> configuration;
-    private final int workers;
-    private final GraphComputer.Persist persist;
-    private final GraphComputer.ResultGraph resultGraph;
-    private final Traversal<Vertex, Vertex> vertices;
-    private final Traversal<Vertex, Edge> edges;
-    private Computer computer;
-
+    private final Computer computer;
 
     private VertexProgramStrategy() {
-        this(null, -1, null, null, null, null, null);
-
+        this(null);
     }
 
     public VertexProgramStrategy(final Computer computer) {
-        this(computer.getGraphComputerClass(), computer.getWorkers(), computer.getResultGraph(), computer.getPersist(), computer.getVertices(), computer.getEdges(), computer.getConfiguration());
-    }
-
-    public VertexProgramStrategy(final Class<? extends GraphComputer> graphComputerClass, final int workers,
-                                 final GraphComputer.ResultGraph result, final GraphComputer.Persist persist,
-                                 final Traversal<Vertex, Vertex> vertices, final Traversal<Vertex, Edge> edges,
-                                 final Map<String, Object> configuration) {
-        this.graphComputerClass = graphComputerClass;
-        this.workers = workers;
-        this.resultGraph = result;
-        this.persist = persist;
-        this.vertices = vertices;
-        this.edges = edges;
-        this.configuration = configuration;
-        this.computer = Computer.compute(this.graphComputerClass).workers(this.workers).result(this.resultGraph).persist(this.persist).vertices(this.vertices).edges(this.edges);
-        for (final Map.Entry<String, Object> entry : this.configuration.entrySet()) {
-            this.computer = this.computer.configure(entry.getKey(), entry.getValue());
-        }
+        this.computer = computer;
     }
 
     public Computer getComputer() {
@@ -188,6 +163,20 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
         return optional.isPresent() ? Optional.of(((VertexProgramStrategy) optional.get()).computer) : Optional.empty();
     }
 
+    public void addGraphComputerStrategies(final TraversalSource traversalSource) {
+        Class<? extends GraphComputer> graphComputerClass;
+        if (this.computer.getGraphComputerClass().equals(GraphComputer.class)) {
+            try {
+                graphComputerClass = this.computer.apply(traversalSource.getGraph()).getClass();
+            } catch (final Exception e) {
+                graphComputerClass = GraphComputer.class;
+            }
+        } else
+            graphComputerClass = this.computer.getGraphComputerClass();
+        final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList();
+        traversalSource.getStrategies().addStrategies(graphComputerStrategies.toArray(new TraversalStrategy[graphComputerStrategies.size()]));
+    }
+
     ////////////////////////////////////////////////////////////
 
     public static final String GRAPH_COMPUTER = "graphComputer";
@@ -197,24 +186,42 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
     public static final String VERTICES = "vertices";
     public static final String EDGES = "edges";
 
+    @Override
+    public Configuration getConfiguration() {
+        final Map<String, Object> map = new HashMap<>();
+        map.put(GRAPH_COMPUTER, this.computer.getGraphComputerClass().getCanonicalName());
+        if (-1 != this.computer.getWorkers())
+            map.put(WORKERS, this.computer.getWorkers());
+        if (null != this.computer.getPersist())
+            map.put(PERSIST, this.computer.getPersist().name());
+        if (null != this.computer.getResultGraph())
+            map.put(RESULT, this.computer.getResultGraph().name());
+        if (null != this.computer.getVertices())
+            map.put(VERTICES, this.computer.getVertices());
+        if (null != this.computer.getEdges())
+            map.put(EDGES, this.computer.getEdges());
+        map.putAll(this.computer.getConfiguration());
+        return new MapConfiguration(map);
+    }
+
     public static VertexProgramStrategy create(final Configuration configuration) {
         try {
             final VertexProgramStrategy.Builder builder = VertexProgramStrategy.build();
             for (final String key : (List<String>) IteratorUtils.asList(configuration.getKeys())) {
                 if (key.equals(GRAPH_COMPUTER))
-                    builder.graphComputerClass = (Class) Class.forName(configuration.getString(key));
+                    builder.graphComputer((Class) Class.forName(configuration.getString(key)));
                 else if (key.equals(WORKERS))
-                    builder.workers = configuration.getInt(key);
+                    builder.workers(configuration.getInt(key));
                 else if (key.equals(PERSIST))
-                    builder.persist = GraphComputer.Persist.valueOf(configuration.getString(key));
+                    builder.persist(GraphComputer.Persist.valueOf(configuration.getString(key)));
                 else if (key.equals(RESULT))
-                    builder.resultGraph = GraphComputer.ResultGraph.valueOf(configuration.getString(key));
+                    builder.result(GraphComputer.ResultGraph.valueOf(configuration.getString(key)));
                 else if (key.equals(VERTICES))
-                    builder.vertices = (Traversal) configuration.getProperty(key);
+                    builder.vertices((Traversal) configuration.getProperty(key));
                 else if (key.equals(EDGES))
-                    builder.edges = (Traversal) configuration.getProperty(key);
+                    builder.edges((Traversal) configuration.getProperty(key));
                 else
-                    builder.configuration.put(key, configuration.getProperty(key));
+                    builder.configure(key, configuration.getProperty(key));
             }
             return builder.create();
         } catch (final ClassNotFoundException e) {
@@ -222,88 +229,65 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
         }
     }
 
-    @Override
-    public Configuration getConfiguration() {
-        final Map<String, Object> map = new HashMap<>();
-        map.put(GRAPH_COMPUTER, this.graphComputerClass.getCanonicalName());
-        if (-1 != this.workers)
-            map.put(WORKERS, this.workers);
-        if (null != this.persist)
-            map.put(PERSIST, this.persist.name());
-        if (null != this.resultGraph)
-            map.put(RESULT, this.resultGraph.name());
-        if (null != this.vertices)
-            map.put(VERTICES, this.vertices);
-        if (null != this.edges)
-            map.put(EDGES, this.edges);
-        for (final Map.Entry<String, Object> entry : this.configuration.entrySet()) {
-            map.put(entry.getKey(), entry.getValue());
-        }
-        return new MapConfiguration(map);
-    }
-
     public static Builder build() {
         return new Builder();
     }
 
     public final static class Builder {
 
-        private Class<? extends GraphComputer> graphComputerClass = GraphComputer.class;
-        private Map<String, Object> configuration = new HashMap<>();
-        private int workers = -1;
-        private GraphComputer.Persist persist = null;
-        private GraphComputer.ResultGraph resultGraph = null;
-        private Traversal<Vertex, Vertex> vertices = null;
-        private Traversal<Vertex, Edge> edges = null;
+        private Computer computer = Computer.compute();
 
         private Builder() {
         }
 
+        public Builder computer(final Computer computer) {
+            this.computer = computer;
+            return this;
+        }
+
         public Builder graphComputer(final Class<? extends GraphComputer> graphComputerClass) {
-            this.graphComputerClass = graphComputerClass;
+            this.computer = this.computer.graphComputer(graphComputerClass);
             return this;
         }
 
         public Builder configure(final String key, final Object value) {
-            this.configuration.put(key, value);
+            this.computer = this.computer.configure(key, value);
             return this;
         }
 
         public Builder configure(final Map<String, Object> configurations) {
-            for (final Map.Entry<String, Object> entry : configurations.entrySet()) {
-                this.configuration.put(entry.getKey(), entry.getValue());
-            }
+            this.computer = this.computer.configure(configurations);
             return this;
         }
 
         public Builder workers(final int workers) {
-            this.workers = workers;
+            this.computer = this.computer.workers(workers);
             return this;
         }
 
         public Builder persist(final GraphComputer.Persist persist) {
-            this.persist = persist;
+            this.computer = this.computer.persist(persist);
             return this;
         }
 
 
         public Builder result(final GraphComputer.ResultGraph resultGraph) {
-            this.resultGraph = resultGraph;
+            this.computer = this.computer.result(resultGraph);
             return this;
         }
 
         public Builder vertices(final Traversal<Vertex, Vertex> vertices) {
-            this.vertices = vertices;
+            this.computer = this.computer.vertices(vertices);
             return this;
         }
 
         public Builder edges(final Traversal<Vertex, Edge> edges) {
-            this.edges = edges;
+            this.computer = this.computer.edges(edges);
             return this;
         }
 
         public VertexProgramStrategy create() {
-            return new VertexProgramStrategy(this.graphComputerClass, this.workers, this.resultGraph, this.persist, this.vertices, this.edges, this.configuration);
+            return new VertexProgramStrategy(this.computer);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b133834/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
index f624545..dce1934 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/util/GraphComputerHelper.java
@@ -18,19 +18,13 @@
  */
 package org.apache.tinkerpop.gremlin.process.computer.util;
 
-import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
 import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 
 import java.lang.reflect.Method;
-import java.util.List;
 import java.util.Optional;
 
 /**
@@ -84,22 +78,4 @@ public final class GraphComputerHelper {
         return a.getClass().equals(b.getClass()) && a.getMemoryKey().equals(((MapReduce) b).getMemoryKey());
     }
 
-    public static TraversalStrategy[] getTraversalStrategies(final TraversalSource traversalSource, final VertexProgramStrategy vertexProgramStrategy) {
-        final Computer computer = vertexProgramStrategy.getComputer();
-        Class<? extends GraphComputer> graphComputerClass;
-        if (computer.getGraphComputerClass().equals(GraphComputer.class)) {
-            try {
-                graphComputerClass = computer.apply(traversalSource.getGraph()).getClass();
-            } catch (final Exception e) {
-                graphComputerClass = GraphComputer.class;
-            }
-        } else
-            graphComputerClass = computer.getGraphComputerClass();
-        final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList();
-        final TraversalStrategy[] traversalStrategies = new TraversalStrategy[graphComputerStrategies.size()];
-        for (int i = 0; i < graphComputerStrategies.size(); i++) {
-            traversalStrategies[i] = graphComputerStrategies.get(i);
-        }
-        return traversalStrategies;
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b133834/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 0185a33..7364b50 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
@@ -23,7 +23,6 @@ import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.decoration.VertexProgramStrategy;
-import org.apache.tinkerpop.gremlin.process.computer.util.GraphComputerHelper;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SackStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SideEffectStrategy;
@@ -108,8 +107,7 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
         clone.getBytecode().addSource(TraversalSource.Symbols.withStrategies, traversalStrategies);
         for (final TraversalStrategy traversalStrategy : traversalStrategies) {
             if (traversalStrategy instanceof VertexProgramStrategy) {
-                clone.getStrategies().addStrategies(GraphComputerHelper.getTraversalStrategies(this, (VertexProgramStrategy) traversalStrategy));
-                break;
+                ((VertexProgramStrategy) traversalStrategy).addGraphComputerStrategies(clone);
             }
         }
         return clone;
@@ -150,14 +148,7 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      * @return a new traversal source with updated strategies
      */
     public default TraversalSource withComputer(final Computer computer) {
-        return this.withStrategies(VertexProgramStrategy.build().
-                graphComputer(computer.getGraphComputerClass()).
-                workers(computer.getWorkers()).
-                result(computer.getResultGraph()).
-                persist(computer.getPersist()).
-                vertices(computer.getVertices()).
-                edges(computer.getEdges()).
-                configure(computer.getConfiguration()).create());
+        return this.withStrategies(new VertexProgramStrategy(computer));
     }
 
     /**
@@ -168,7 +159,7 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      * @return a new traversal source with updated strategies
      */
     public default TraversalSource withComputer(final Class<? extends GraphComputer> graphComputerClass) {
-        return this.withStrategies(VertexProgramStrategy.build().graphComputer(graphComputerClass).create());
+        return this.withStrategies(new VertexProgramStrategy(Computer.compute(graphComputerClass)));
     }
 
     /**
@@ -178,7 +169,7 @@ public interface TraversalSource extends Cloneable, AutoCloseable {
      * @return a new traversal source with updated strategies
      */
     public default TraversalSource withComputer() {
-        return this.withStrategies(VertexProgramStrategy.build().create());
+        return this.withStrategies(new VertexProgramStrategy(Computer.compute()));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b133834/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java
index 34f48ef..fe04156 100644
--- a/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java
+++ b/gremlin-python/src/test/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonProvider.java
@@ -73,9 +73,6 @@ public class PythonProvider extends AbstractGraphProvider {
             "shouldHidePartitionKeyForValues",
             "g_withSackXBigInteger_TEN_powX1000X_assignX_V_localXoutXknowsX_barrierXnormSackXX_inXknowsX_barrier_sack",
             //
-            PeerPressureTest.Traversals.class.getCanonicalName(),
-            ProfileTest.Traversals.class.getCanonicalName(), // only fails in OLAP
-            PageRankTest.Traversals.class.getCanonicalName(),
             ProgramTest.Traversals.class.getCanonicalName(),
             TraversalInterruptionTest.class.getCanonicalName(),
             TraversalInterruptionComputerTest.class.getCanonicalName(),

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b133834/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
index 97fa7fa..88a2327 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
@@ -54,8 +54,6 @@ public class TinkerGraphGraphSONTranslatorProvider extends TinkerGraphProvider {
             "g_V_hasLabelXpersonX_asXpX_VXsoftwareX_addInEXuses_pX",
             "g_VXv1X_hasXage_gt_30X",
             //
-
-            PageRankTest.Traversals.class.getCanonicalName(),
             ProgramTest.Traversals.class.getCanonicalName(),
             TraversalInterruptionTest.class.getCanonicalName(),
             TraversalInterruptionComputerTest.class.getCanonicalName(),