You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2018/07/12 15:00:05 UTC

[01/26] tinkerpop git commit: TINKERPOP-1986 Removed deprecated methods and updated docs accordingly [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1996 caa2d1d86 -> f78c87da3 (forced update)


TINKERPOP-1986 Removed deprecated methods and updated docs accordingly


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

Branch: refs/heads/TINKERPOP-1996
Commit: 310801695ab97b60f8032e2c0c15b6617e954234
Parents: b475d12
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 18 12:38:45 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 18 13:32:44 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  3 +-
 docs/src/reference/gremlin-variants.asciidoc    |  4 +--
 docs/src/upgrade/release-3.4.x.asciidoc         |  7 ++++-
 .../gremlin/jsr223/GremlinScriptEngine.java     | 25 ---------------
 .../gremlin/jsr223/ImportCustomizer.java        |  8 -----
 .../strategy/decoration/PartitionStrategy.java  | 12 --------
 .../strategy/decoration/SubgraphStrategy.java   | 16 ----------
 .../decoration/PartitionStrategyTest.java       |  8 ++---
 .../PartitionStrategyTraverseTest.java          |  2 +-
 .../SubgraphStrategyTraverseTest.java           |  2 +-
 .../Strategy/Decoration/SubgraphStrategy.cs     | 22 +++++++-------
 .../DriverRemoteConnection/StrategiesTests.cs   | 20 ++++++------
 .../PartitionStrategyProcessTest.java           | 32 ++++++++++----------
 .../decoration/SubgraphStrategyProcessTest.java |  8 ++---
 .../decoration/TranslationStrategy.java         |  2 +-
 15 files changed, 58 insertions(+), 113 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index f7429fe..428a279 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -36,10 +36,11 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>.
 * Allowed `GraphProvider` to expose a cached `Graph.Feature` object so that the test suite could re-use them to speed test runs.
 * Fixed a bug in `ReducingBarrierStep`, that returned the provided seed value despite no elements being available.
 * Changed the order of `select()` scopes. The order is now: maps, side-effects, paths.
-* Removed previously deprecated Credentials DSL infrastructure.
 * Moved `TraversalEngine` to `gremlin-test` as it has long been only used in testing infrastructure.
 * Events from `EventStrategy` raised from "new" mutations will now return a `KeyedVertexProperty` or `KeyedProperty` as is appropriate.
 * `MutationListener#vertexPropertyChanged(Vertex, VertexProperty, Object, Object...)` no longer has a default implementation.
+* Removed previously deprecated methods in `SubgraphStrategy` and `PartitionStrategy` builders.
+* Removed previously deprecated Credentials DSL infrastructure.
 * Removed previously deprecated `MutationListener#vertexPropertyChanged(Vertex, Property, Object, Object...)`.
 * Removed previously deprecated `OpSelectorHandler` constructor.
 * Removed previously deprecated `close()` from `GremlinGroovyScriptEngine` which no longer implements `AutoCloseable`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/docs/src/reference/gremlin-variants.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc
index 8aa2435..9f8a216 100644
--- a/docs/src/reference/gremlin-variants.asciidoc
+++ b/docs/src/reference/gremlin-variants.asciidoc
@@ -417,8 +417,8 @@ class along with a collection of subclasses that mirror the standard Gremlin-Jav
 
 [source,csharp]
 ----
-g = g.WithStrategies(new SubgraphStrategy(vertexCriterion: HasLabel("person"),
-    edgeCriterion: Has("weight", Gt(0.5))));
+g = g.WithStrategies(new SubgraphStrategy(vertices: HasLabel("person"),
+    edges: Has("weight", Gt(0.5))));
 var names = g.V().Values("name").ToList();  // names: [marko, vadas, josh, peter]
 
 g = g.WithoutStrategies(typeof(SubgraphStrategy));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/docs/src/upgrade/release-3.4.x.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.4.x.asciidoc b/docs/src/upgrade/release-3.4.x.asciidoc
index 8829569..06d5c4a 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -139,8 +139,12 @@ link:https://issues.apache.org/jira/browse/TINKERPOP-1831[TINKERPOP-1831]
 The following deprecated classes, methods or fields have been removed in this version:
 
 * `gremlin-core`
+** `org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer#GREMLIN_CORE`
 ** `org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine`
 ** `org.apache.tinkerpop.gremlin.process.traversal.engine.*`
+** `org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategy.Builder#addReadPartition(String)`
+** `org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy.Builder#edgeCriterion(Traversal)`
+** `org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy.Builder#vertexCriterion(Traversal)`
 ** `org.apache.tinkerpop.gremlin.process.traversal.step.map.LambdaCollectingBarrierStep.Consumers`
 ** `org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer#makeHasContainers(String, P)`
 ** `org.apache.tinkerpop.gremlin.process.traversal.step.util.event.MutationListener#vertexPropertyChanged(Vertex, Property, Object, Object...)`
@@ -171,7 +175,8 @@ See: link:https://issues.apache.org/jira/browse/TINKERPOP-1143[TINKERPOP-1143],
 link:https://issues.apache.org/jira/browse/TINKERPOP-1296[TINKERPOP-1296],
 link:https://issues.apache.org/jira/browse/TINKERPOP-1705[TINKERPOP-1705],
 link:https://issues.apache.org/jira/browse/TINKERPOP-1707[TINKERPOP-1707],
-link:https://issues.apache.org/jira/browse/TINKERPOP-1954[TINKERPOP-1954]
+link:https://issues.apache.org/jira/browse/TINKERPOP-1954[TINKERPOP-1954],
+link:https://issues.apache.org/jira/browse/TINKERPOP-1986[TINKERPOP-1986]
 
 ==== Modifications to reducing barrier steps
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngine.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngine.java
index addca82..2df511c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngine.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinScriptEngine.java
@@ -38,31 +38,6 @@ public interface GremlinScriptEngine extends ScriptEngine {
     public GremlinScriptEngineFactory getFactory();
 
     /**
-     * Evaluates {@link Traversal} {@link Bytecode}. This method assumes that the traversal source to execute the
-     * bytecode against is in the global bindings and is named "g".
-     *
-     * @deprecated As of release 3.2.7, replaced by {@link #eval(Bytecode, String)}.
-     */
-    @Deprecated
-    public default Traversal.Admin eval(final Bytecode bytecode) throws ScriptException {
-        final Bindings bindings = this.createBindings();
-        bindings.putAll(bytecode.getBindings());
-        return eval(bytecode, bindings);
-    }
-
-    /**
-     * Evaluates {@link Traversal} {@link Bytecode} with the specified {@code Bindings}. These {@code Bindings}
-     * supplied to this method will be merged with global engine bindings and override them where keys match. This
-     * method assumes that the traversal source to execute against is named "g".
-     *
-     * @deprecated As of release 3.2.7, replaced by {@link #eval(Bytecode, Bindings, String)}.
-     */
-    @Deprecated
-    public default Traversal.Admin eval(final Bytecode bytecode, final Bindings bindings) throws ScriptException {
-        return eval(bytecode, bindings, "g");
-    }
-
-    /**
      * Evaluates {@link Traversal} {@link Bytecode} against a traversal source in the global bindings of the
      * {@code ScriptEngine}.
      *

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
index b44072b..24cf70a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/ImportCustomizer.java
@@ -30,14 +30,6 @@ import java.util.stream.Collectors;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface ImportCustomizer extends Customizer {
-    /**
-     * @deprecated As of release 3.2.4, not replaced.
-     */
-    @Deprecated
-    public static final ImportCustomizer GREMLIN_CORE = DefaultImportCustomizer.build()
-            .addClassImports(CoreImports.getClassImports())
-            .addEnumImports(CoreImports.getEnumImports())
-            .addMethodImports(CoreImports.getMethodImports()).create();
 
     /**
      * Gets the set of classes to be imported to the {@link GremlinScriptEngine}.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
index 877c2df..15079cb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategy.java
@@ -418,18 +418,6 @@ public final class PartitionStrategy extends AbstractTraversalStrategy<Traversal
         }
 
         /**
-         * Specifies the partition of the graph to read from.  It is possible to assign multiple partition keys so
-         * as to read from multiple partitions at the same time.
-         *
-         * @deprecated As of release 3.2.3, replaced by {@link Builder#readPartitions(List)}.
-         */
-        @Deprecated
-        public Builder addReadPartition(final String readPartition) {
-            this.readPartitions.add(readPartition);
-            return this;
-        }
-
-        /**
          * Creates the {@code PartitionStrategy}.
          */
         public PartitionStrategy create() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/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 467689f..10619c2 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
@@ -378,22 +378,6 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
             return this;
         }
 
-        @Deprecated
-        /**
-         * @deprecated As of release 3.2.2, replaced by {@code Builder#vertices}.
-         */
-        public Builder vertexCriterion(final Traversal<Vertex, ?> predicate) {
-            return this.vertices(predicate);
-        }
-
-        /**
-         * @deprecated As of release 3.2.2, replaced by {@code Builder#edges}.
-         */
-        @Deprecated
-        public Builder edgeCriterion(final Traversal<Edge, ?> predicate) {
-            return this.edges(predicate);
-        }
-
         public SubgraphStrategy create() {
             if (null == this.vertexCriterion && null == this.edgeCriterion && null == this.vertexPropertyCriterion)
                 throw new IllegalStateException("A subgraph must be filtered by a vertex, edge, or vertex property criterion");

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTest.java
index 8ca8e3a..071706a 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTest.java
@@ -37,7 +37,7 @@ public class PartitionStrategyTest {
     @Test
     public void shouldConstructPartitionStrategy() {
         final PartitionStrategy strategy = PartitionStrategy.build()
-                .partitionKey("p").writePartition("a").addReadPartition("a").create();
+                .partitionKey("p").writePartition("a").readPartitions("a").create();
         assertEquals("a", strategy.getReadPartitions().iterator().next());
         assertEquals(1, strategy.getReadPartitions().size());
         assertEquals("p", strategy.getPartitionKey());
@@ -47,9 +47,9 @@ public class PartitionStrategyTest {
     public void shouldConstructPartitionStrategyWithMultipleReadPartitions() {
         final PartitionStrategy strategy = PartitionStrategy.build()
                 .partitionKey("p").writePartition("a")
-                .addReadPartition("a")
-                .addReadPartition("b")
-                .addReadPartition("c").create();
+                .readPartitions("a")
+                .readPartitions("b")
+                .readPartitions("c").create();
 
         assertTrue(IteratorUtils.asList(strategy.getReadPartitions().iterator()).contains("a"));
         assertTrue(IteratorUtils.asList(strategy.getReadPartitions().iterator()).contains("b"));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTraverseTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTraverseTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTraverseTest.java
index a8f809a..c137099 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTraverseTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/PartitionStrategyTraverseTest.java
@@ -96,7 +96,7 @@ public class PartitionStrategyTraverseTest {
     @Test
     public void shouldIncludeAdditionalHasStepsAndAppendPartitionOnMutatingSteps() {
         final PartitionStrategy strategy = PartitionStrategy.build()
-                .partitionKey("p").writePartition("a").addReadPartition("a").create();
+                .partitionKey("p").writePartition("a").readPartitions("a").create();
 
         if (hasMutatingStep) {
             if (TraversalHelper.hasStepOfAssignableClass(AddEdgeStep.class, traversal.asAdmin())) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyTraverseTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyTraverseTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyTraverseTest.java
index c0778e0..ad5686e 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyTraverseTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyTraverseTest.java
@@ -91,7 +91,7 @@ public class SubgraphStrategyTraverseTest {
 
     @Test
     public void shouldSubgraph() {
-        final SubgraphStrategy strategy = SubgraphStrategy.build().edgeCriterion(__.identity()).vertexCriterion(__.identity()).create();
+        final SubgraphStrategy strategy = SubgraphStrategy.build().edges(__.identity()).vertices(__.identity()).create();
         strategy.apply(traversal.asAdmin());
 
         final List<TraversalFilterStep> steps = TraversalHelper.getStepsOfClass(TraversalFilterStep.class, traversal.asAdmin());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/Decoration/SubgraphStrategy.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/Decoration/SubgraphStrategy.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/Decoration/SubgraphStrategy.cs
index 1ba87d0..ae6a46e 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/Decoration/SubgraphStrategy.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/Strategy/Decoration/SubgraphStrategy.cs
@@ -38,18 +38,18 @@ namespace Gremlin.Net.Process.Traversal.Strategy.Decoration
         /// <summary>
         ///     Initializes a new instance of the <see cref="SubgraphStrategy" /> class.
         /// </summary>
-        /// <param name="vertexCriterion">Constrains vertices for the <see cref="ITraversal" />.</param>
-        /// <param name="edgeCriterion">Constrains edges for the <see cref="ITraversal" />.</param>
-        /// <param name="vertexPropertyCriterion">Constrains vertex properties for the <see cref="ITraversal" />.</param>
-        public SubgraphStrategy(ITraversal vertexCriterion = null, ITraversal edgeCriterion = null,
-            ITraversal vertexPropertyCriterion = null)
+        /// <param name="vertices">Constrains vertices for the <see cref="ITraversal" />.</param>
+        /// <param name="edges">Constrains edges for the <see cref="ITraversal" />.</param>
+        /// <param name="vertexProperties">Constrains vertex properties for the <see cref="ITraversal" />.</param>
+        public SubgraphStrategy(ITraversal vertices = null, ITraversal edges = null,
+            ITraversal vertexProperties = null)
         {
-            if (vertexCriterion != null)
-                Configuration["vertices"] = vertexCriterion;
-            if (edgeCriterion != null)
-                Configuration["edges"] = edgeCriterion;
-            if (vertexPropertyCriterion != null)
-                Configuration["vertexProperties"] = vertexPropertyCriterion;
+            if (vertices != null)
+                Configuration["vertices"] = vertices;
+            if (edges != null)
+                Configuration["edges"] = edges;
+            if (vertexProperties != null)
+                Configuration["vertexProperties"] = vertexProperties;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/StrategiesTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/StrategiesTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/StrategiesTests.cs
index 2e99778..c05100c 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/StrategiesTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Process/Traversal/DriverRemoteConnection/StrategiesTests.cs
@@ -43,7 +43,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var g =
                 graph.Traversal()
                     .WithRemote(connection)
-                    .WithStrategies(new SubgraphStrategy(vertexCriterion: __.HasLabel("person")));
+                    .WithStrategies(new SubgraphStrategy(vertices: __.HasLabel("person")));
 
             var count = g.V().Count().Next();
 
@@ -58,8 +58,8 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var g =
                 graph.Traversal()
                     .WithRemote(connection)
-                    .WithStrategies(new SubgraphStrategy(vertexCriterion: __.HasLabel("person"),
-                        edgeCriterion: __.HasLabel("created")));
+                    .WithStrategies(new SubgraphStrategy(vertices: __.HasLabel("person"),
+                        edges: __.HasLabel("created")));
 
             var count = g.E().Count().Next();
 
@@ -74,7 +74,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var g =
                 graph.Traversal()
                     .WithRemote(connection)
-                    .WithStrategies(new SubgraphStrategy(vertexCriterion: __.HasLabel("person")));
+                    .WithStrategies(new SubgraphStrategy(vertices: __.HasLabel("person")));
 
             var count = g.V().Label().Dedup().Count().Next();
 
@@ -89,7 +89,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var g =
                 graph.Traversal()
                     .WithRemote(connection)
-                    .WithStrategies(new SubgraphStrategy(vertexCriterion: __.HasLabel("person")));
+                    .WithStrategies(new SubgraphStrategy(vertices: __.HasLabel("person")));
 
             var label = g.V().Label().Dedup().Next();
 
@@ -104,7 +104,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var g =
                 graph.Traversal()
                     .WithRemote(connection)
-                    .WithStrategies(new SubgraphStrategy(vertexCriterion: __.Has("name", "marko")));
+                    .WithStrategies(new SubgraphStrategy(vertices: __.Has("name", "marko")));
 
             var count = g.V().Count().Next();
 
@@ -119,7 +119,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var g =
                 graph.Traversal()
                     .WithRemote(connection)
-                    .WithStrategies(new SubgraphStrategy(edgeCriterion: __.Limit<object>(0)));
+                    .WithStrategies(new SubgraphStrategy(edges: __.Limit<object>(0)));
 
             var count = g.E().Count().Next();
 
@@ -134,7 +134,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var g =
                 graph.Traversal()
                     .WithRemote(connection)
-                    .WithStrategies(new SubgraphStrategy(vertexCriterion: __.Has("name", "marko")));
+                    .WithStrategies(new SubgraphStrategy(vertices: __.Has("name", "marko")));
 
             var label = g.V().Label().Dedup().Next();
 
@@ -149,7 +149,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var g =
                 graph.Traversal()
                     .WithRemote(connection)
-                    .WithStrategies(new SubgraphStrategy(vertexCriterion: __.Has("name", "marko")));
+                    .WithStrategies(new SubgraphStrategy(vertices: __.Has("name", "marko")));
 
             var name = g.V().Values<string>("name").Next();
 
@@ -196,7 +196,7 @@ namespace Gremlin.Net.IntegrationTest.Process.Traversal.DriverRemoteConnection
             var graph = new Graph();
             var connection = _connectionFactory.CreateRemoteConnection();
             var g = graph.Traversal().WithRemote(connection)
-                .WithStrategies(new SubgraphStrategy(vertexCriterion: __.HasLabel("person")))
+                .WithStrategies(new SubgraphStrategy(vertices: __.HasLabel("person")))
                 .WithoutStrategies(typeof(SubgraphStrategy));
 
             var count = g.V().Count().Next();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/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 917e2b1..a31e028 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
@@ -117,15 +117,15 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldAppendPartitionToAllVertexProperties() {
         final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("A").readPartitions("A").create());
 
         final GraphTraversalSource gOverB = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("B").addReadPartition("B").create());
+                .partitionKey(partition).writePartition("B").readPartitions("B").create());
 
         final GraphTraversalSource gOverAB = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("B").addReadPartition("B").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("B").readPartitions("B","A").create());
 
         final Vertex v = gOverA.addV().property("any", "thing").property("some", "thing").next();
 
@@ -179,7 +179,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldHidePartitionKeyForValues() {
         final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("A").readPartitions("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
 
         try {
@@ -210,7 +210,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldHidePartitionKeyForProperties() {
         final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("A").readPartitions("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
 
         try {
@@ -252,7 +252,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldHidePartitionKeyForPropertyMapWithEmptyKeys() {
         final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("A").readPartitions("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
 
         assertEquals(1L, (long) gOverA.V(v).propertyMap().count().next());
@@ -265,7 +265,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldHidePartitionKeyForValueMap() {
         final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("A").readPartitions("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
 
         try {
@@ -282,7 +282,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldHidePartitionKeyForValueMapWithEmptyKeys() {
         final GraphTraversalSource gOverA = g.withStrategies(PartitionStrategy.build()
                 .includeMetaProperties(true)
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create());
+                .partitionKey(partition).writePartition("A").readPartitions("A").create());
         final Vertex v = gOverA.addV().property("any", "thing").next();
 
         assertEquals(1L, (long) gOverA.V(v).valueMap().count().next());
@@ -293,7 +293,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
     public void shouldAppendPartitionToEdge() {
         final PartitionStrategy partitionStrategy = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create();
+                .partitionKey(partition).writePartition("A").readPartitions("A").create();
         final GraphTraversalSource source = g.withStrategies(partitionStrategy);
         final Vertex v1 = source.addV().property("any", "thing").next();
         final Vertex v2 = source.addV().property("some", "thing").next();
@@ -317,15 +317,15 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     public void shouldWriteVerticesToMultiplePartitions() {
         final PartitionStrategy partitionStrategyAA = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create();
+                .partitionKey(partition).writePartition("A").readPartitions("A").create();
         final GraphTraversalSource sourceAA = g.withStrategies(partitionStrategyAA);
 
         final PartitionStrategy partitionStrategyBA = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("B").addReadPartition("A").create();
+                .partitionKey(partition).writePartition("B").readPartitions("A").create();
         final GraphTraversalSource sourceBA = g.withStrategies(partitionStrategyBA);
 
         final PartitionStrategy partitionStrategyBB = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("B").addReadPartition("B").create();
+                .partitionKey(partition).writePartition("B").readPartitions("B").create();
         final GraphTraversalSource sourceBB = g.withStrategies(partitionStrategyBB);
 
         final PartitionStrategy partitionStrategyBAB = PartitionStrategy.build()
@@ -354,7 +354,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
     public void shouldThrowExceptionOnVInDifferentPartition() {
         final PartitionStrategy partitionStrategyAA = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create();
+                .partitionKey(partition).writePartition("A").readPartitions("A").create();
         final GraphTraversalSource sourceAA = g.withStrategies(partitionStrategyAA);
 
         final PartitionStrategy partitionStrategyA = PartitionStrategy.build()
@@ -376,7 +376,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
     @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
     public void shouldThrowExceptionOnEInDifferentPartition() {
         final PartitionStrategy partitionStrategyAA = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("A").addReadPartition("A").create();
+                .partitionKey(partition).writePartition("A").readPartitions("A").create();
         final GraphTraversalSource sourceAA = g.withStrategies(partitionStrategyAA);
 
         final PartitionStrategy partitionStrategyA = PartitionStrategy.build()
@@ -407,7 +407,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
         final GraphTraversalSource sourceBA = g.withStrategies(partitionStrategyBA);
 
         final PartitionStrategy partitionStrategyCAB = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("C").addReadPartition("A").addReadPartition("B").create();
+                .partitionKey(partition).writePartition("C").readPartitions("A","B").create();
         final GraphTraversalSource sourceCAB = g.withStrategies(partitionStrategyCAB);
 
         final PartitionStrategy partitionStrategyC = PartitionStrategy.build()
@@ -425,7 +425,7 @@ public class PartitionStrategyProcessTest extends AbstractGremlinProcessTest {
             put(PartitionStrategy.READ_PARTITIONS, Arrays.asList("A", "B", "C"));
         }})));
         final PartitionStrategy partitionStrategyCC = PartitionStrategy.build()
-                .partitionKey(partition).writePartition("C").addReadPartition("C").create();
+                .partitionKey(partition).writePartition("C").readPartitions("C").create();
         final GraphTraversalSource sourceCC = g.withStrategies(partitionStrategyCC);
 
         final PartitionStrategy partitionStrategyCBC = PartitionStrategy.build()

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/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 f06b0f7..9968842 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
@@ -68,7 +68,7 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldFilterVertexCriterion() throws Exception {
         final Traversal<Vertex, ?> vertexCriterion = has("name", P.within("josh", "lop", "ripple"));
 
-        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().vertexCriterion(vertexCriterion).create());
+        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().vertices(vertexCriterion).create());
 
         // three vertices are included in the subgraph
         assertEquals(6, g.V().count().next().longValue());
@@ -154,7 +154,7 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
                 has("weight", 1.0d).hasLabel("created") // 10
         );
 
-        final SubgraphStrategy strategy = SubgraphStrategy.build().edgeCriterion(edgeCriterion).create();
+        final SubgraphStrategy strategy = SubgraphStrategy.build().edges(edgeCriterion).create();
         final GraphTraversalSource sg = g.withStrategies(strategy);
 
         // all vertices are here
@@ -422,7 +422,7 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
         // this will exclude "peter"
         final Traversal<Vertex, ?> vertexCriterion = has("name", P.within("ripple", "josh", "marko"));
 
-        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().vertexCriterion(vertexCriterion).create());
+        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().vertices(vertexCriterion).create());
 
         assertEquals(9, g.V().as("a").out().in().as("b").dedup("a", "b").count().next().intValue());
         assertEquals(2, sg.V().as("a").out().in().as("b").dedup("a", "b").count().next().intValue());
@@ -436,7 +436,7 @@ public class SubgraphStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldGetExcludedVertex() throws Exception {
         final Traversal<Vertex, ?> vertexCriterion = has("name", P.within("josh", "lop", "ripple"));
 
-        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().vertexCriterion(vertexCriterion).create());
+        final GraphTraversalSource sg = g.withStrategies(SubgraphStrategy.build().vertices(vertexCriterion).create());
 
         sg.V(convertToVertexId("marko")).next();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/31080169/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/TranslationStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/TranslationStrategy.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/TranslationStrategy.java
index 0736c02..df4758d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/TranslationStrategy.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/TranslationStrategy.java
@@ -99,7 +99,7 @@ public final class TranslationStrategy extends AbstractTraversalStrategy<Travers
                 final Bindings bindings = scriptEngine.createBindings();
                 bindings.putAll(scriptEngine.getContext().getBindings(ScriptContext.ENGINE_SCOPE));
                 bindings.put(this.translator.getTraversalSource().toString(), this.traversalSource);
-                translatedTraversal = (Traversal.Admin<?, ?>) scriptEngine.eval(bytecode, bindings);
+                translatedTraversal = (Traversal.Admin<?, ?>) scriptEngine.eval(bytecode, bindings, this.translator.getTraversalSource().toString());
             } catch (final Exception e) {
                 throw new IllegalArgumentException(e.getMessage(), e);
             }


[11/26] tinkerpop git commit: Merge pull request #888 from elliotttf/fix-close-return-tp32

Posted by sp...@apache.org.
Merge pull request #888 from elliotttf/fix-close-return-tp32


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

Branch: refs/heads/TINKERPOP-1996
Commit: 59d2f1048f2041045dff6ff2b546fd3caa9937a2
Parents: 309957b f6e50ae
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Jul 12 11:48:43 2018 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Jul 12 11:48:43 2018 +0200

----------------------------------------------------------------------
 .../lib/driver/driver-remote-connection.js      | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



[14/26] tinkerpop git commit: Merge branch 'tp33'

Posted by sp...@apache.org.
Merge branch 'tp33'


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

Branch: refs/heads/TINKERPOP-1996
Commit: 3cd352eeb2503d6c5e3ff9b8d8256eb92f28692d
Parents: 2fd11a1 bf07f13
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Jul 12 11:53:19 2018 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Jul 12 11:53:19 2018 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../lib/driver/driver-remote-connection.js      | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3cd352ee/CHANGELOG.asciidoc
----------------------------------------------------------------------


[25/26] tinkerpop git commit: TINKERPOP-1996 Added with() options for io()

Posted by sp...@apache.org.
TINKERPOP-1996 Added with() options for io()

Included GraphReader and GraphWriter detection and added tests


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

Branch: refs/heads/TINKERPOP-1996
Commit: 28c7fad2ccf2af8e21644723b85bd4fdd41a587d
Parents: 1fd43c6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jul 11 15:40:39 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:59:39 2018 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/process/traversal/IO.java |  54 ++++++
 .../process/traversal/step/map/IoStep.java      | 132 ++++++++++++--
 .../traversal/dsl/graph/GraphTraversalTest.java |   5 +-
 .../decoration/VertexProgramStrategyTest.java   |   7 +-
 .../Process/Traversal/GraphTraversal.cs         |  18 ++
 .../Process/Traversal/GraphTraversalSource.cs   |  17 +-
 .../groovy/jsr223/GroovyTranslatorProvider.java |   6 +
 .../lib/process/graph-traversal.js              |  36 ++--
 .../gremlin_python/process/graph_traversal.py   |  17 +-
 .../gremlin/process/ProcessStandardSuite.java   |   2 +
 .../process/traversal/step/map/ReadTest.java    | 114 ++++++++++--
 .../process/traversal/step/map/WriteTest.java   | 175 +++++++++++++++++++
 .../ElementIdStrategyProcessTest.java           |   1 -
 .../gremlin/hadoop/structure/HadoopGraph.java   |  10 ++
 .../structure/TinkerGraphPlayTest.java          |  12 +-
 ...ctTinkerGraphGraphSONTranslatorProvider.java |   5 +
 .../gryo/TinkerGraphGryoTranslatorProvider.java |   7 +-
 17 files changed, 542 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/IO.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/IO.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/IO.java
new file mode 100644
index 0000000..f76c2bc
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/IO.java
@@ -0,0 +1,54 @@
+/*
+ * 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;
+
+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.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+
+/**
+ * Fields that can be provided to the {@link GraphTraversalSource#io(String)} using the
+ * {@link GraphTraversal#with(String,Object)} step modulator to provide additional configurations.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class IO {
+
+    private IO() {}
+
+    public static final String graphson = "graphson";
+    public static final String gryo = "gryo";
+    public static final String graphml = "graphml";
+
+    /**
+     * The specific {@link GraphReader} instance to use or the name of the fully qualified classname of such an
+     * instance. If this value is not specified then {@link GraphTraversalSource#io(String)} will attempt to construct
+     * a default {@link GraphReader} based on the file extension provided to it.
+     */
+    public static final String reader = Graph.Hidden.hide("tinkerpop.io.reader");
+
+    /**
+     * The specific {@link GraphWriter} instance to use or the name of the fully qualified classname of such an
+     * instance. If this value is not specified then {@link GraphTraversalSource#io(String)} will attempt to construct
+     * a default {@link GraphWriter} based on the file extension provided to it.
+     */
+    public static final String writer = Graph.Hidden.hide("tinkerpop.io.writer");
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
index b633360..668b3dc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
+import org.apache.tinkerpop.gremlin.process.traversal.IO;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.ReadWriting;
@@ -26,6 +27,12 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.GraphReader;
+import org.apache.tinkerpop.gremlin.structure.io.GraphWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLReader;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
@@ -36,6 +43,7 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.lang.reflect.Method;
 
 /**
  * Handles read and write operations into the {@link Graph}.
@@ -43,6 +51,13 @@ import java.io.OutputStream;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class IoStep<S> extends AbstractStep<S,S> implements ReadWriting {
+
+    private enum Format {
+        GRYO,
+        GRAPHSON,
+        GRAPHML
+    }
+
     private Parameters parameters = new Parameters();
     private boolean first = true;
     private String file;
@@ -92,29 +107,118 @@ public class IoStep<S> extends AbstractStep<S,S> implements ReadWriting {
 
         if (mode == Mode.READING) {
             if (!file.exists()) throw new IllegalStateException(this.file + " does not exist");
+            return read(file);
+        } else if (mode == Mode.WRITING) {
+            return write(file);
+        } else {
+            throw new IllegalStateException("Invalid ReadWriting.Mode configured in IoStep: " + mode.name());
+        }
+    }
+
+    private Traverser.Admin<S> write(final File file) {
+        try (final OutputStream stream = new FileOutputStream(file)) {
+            final Graph graph = (Graph) this.traversal.getGraph().get();
+            constructWriter().writeGraph(stream, graph);
+
+            return EmptyTraverser.instance();
+        } catch (IOException ioe) {
+            throw new IllegalStateException(String.format("Could not write file %s from graph", this.file), ioe);
+        }
+    }
 
-            try (final InputStream stream = new FileInputStream(file)) {
-                final Graph graph = (Graph) this.traversal.getGraph().get();
-                GryoReader.build().create().readGraph(stream, graph);
+    private Traverser.Admin<S> read(final File file) {
+        try (final InputStream stream = new FileInputStream(file)) {
+            final Graph graph = (Graph) this.traversal.getGraph().get();
+            constructReader().readGraph(stream, graph);
 
-                return EmptyTraverser.instance();
-            } catch (IOException ioe) {
-                throw new IllegalStateException(String.format("Could not read file %s into graph", this.file), ioe);
+            return EmptyTraverser.instance();
+        } catch (IOException ioe) {
+            throw new IllegalStateException(String.format("Could not read file %s into graph", this.file), ioe);
+        }
+    }
+
+    /**
+     * Builds a {@link GraphReader} instance to use. Attempts to detect the file format to be read using the file
+     * extension or simply uses configurations provided by the user on the parameters given to the step.
+     */
+    private GraphReader constructReader() {
+        final Object objectOrClass = parameters.get(IO.reader, this::detectReader).get(0);
+        if (objectOrClass instanceof GraphReader)
+            return (GraphReader) objectOrClass;
+        else if (objectOrClass instanceof String) {
+            if (objectOrClass.equals(IO.graphson))
+                return GraphSONReader.build().create();
+            else if (objectOrClass.equals(IO.gryo))
+                return GryoReader.build().create();
+            else if (objectOrClass.equals(IO.graphml))
+                return GraphMLReader.build().create();
+            else {
+                try {
+                    final Class<?> graphReaderClazz = Class.forName((String) objectOrClass);
+                    final Method build = graphReaderClazz.getMethod("build");
+                    final GraphReader.ReaderBuilder builder = (GraphReader.ReaderBuilder) build.invoke(null);
+                    return builder.create();
+                } catch (Exception ex) {
+                    throw new IllegalStateException(String.format("Could not construct the specified GraphReader of %s", objectOrClass), ex);
+                }
             }
-        } else if (mode == Mode.WRITING) {
-            try (final OutputStream stream = new FileOutputStream(file)) {
-                final Graph graph = (Graph) this.traversal.getGraph().get();
-                GryoWriter.build().create().writeGraph(stream, graph);
+        } else {
+            throw new IllegalStateException("GraphReader could not be determined");
+        }
+    }
+
+    private GraphReader detectReader() {
+        if (file.endsWith(".kryo"))
+            return GryoReader.build().create();
+        else if (file.endsWith(".json"))
+            return GraphSONReader.build().create();
+        else if (file.endsWith(".xml"))
+            return GraphMLReader.build().create();
+        else
+            throw new IllegalStateException("Could not detect the file format - specify the reader explicitly or rename file with a standard extension");
+    }
 
-                return EmptyTraverser.instance();
-            } catch (IOException ioe) {
-                throw new IllegalStateException(String.format("Could not write file %s from graph", this.file), ioe);
+    /**
+     * Builds a {@link GraphWriter} instance to use. Attempts to detect the file format to be write using the file
+     * extension or simply uses configurations provided by the user on the parameters given to the step.
+     */
+    private GraphWriter constructWriter() {
+        final Object objectOrClass = parameters.get(IO.writer, this::detectWriter).get(0);
+        if (objectOrClass instanceof GraphWriter)
+            return (GraphWriter) objectOrClass;
+        else if (objectOrClass instanceof String) {
+            if (objectOrClass.equals(IO.graphson))
+                return GraphSONWriter.build().create();
+            else if (objectOrClass.equals(IO.gryo))
+                return GryoWriter.build().create();
+            else if (objectOrClass.equals(IO.graphml))
+                return GraphMLWriter.build().create();
+            else {
+                try {
+                    final Class<?> graphWriterClazz = Class.forName((String) objectOrClass);
+                    final Method build = graphWriterClazz.getMethod("build");
+                    final GraphWriter.WriterBuilder builder = (GraphWriter.WriterBuilder) build.invoke(null);
+                    return builder.create();
+                } catch (Exception ex) {
+                    throw new IllegalStateException(String.format("Could not construct the specified GraphReader of %s", objectOrClass), ex);
+                }
             }
         } else {
-            throw new IllegalStateException("Invalid ReadWriting.Mode configured in IoStep: " + mode.name());
+            throw new IllegalStateException("GraphReader could not be determined");
         }
     }
 
+    private GraphWriter detectWriter() {
+        if (file.endsWith(".kryo"))
+            return GryoWriter.build().create();
+        else if (file.endsWith(".json"))
+            return GraphSONWriter.build().create();
+        else if (file.endsWith(".xml"))
+            return GraphMLWriter.build().create();
+        else
+            throw new IllegalStateException("Could not detect the file format - specify the writer explicitly or rename file with a standard extension");
+    }
+
     @Override
     public int hashCode() {
         final int hash = super.hashCode() ^ this.parameters.hashCode();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
index 9009d0b..3d9a549 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalTest.java
@@ -38,13 +38,14 @@ import static org.junit.Assert.assertEquals;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class GraphTraversalTest {
     private static final Logger logger = LoggerFactory.getLogger(GraphTraversalTest.class);
 
-    private static Set<String> NO_GRAPH = new HashSet<>(Arrays.asList("asAdmin", "by", "with", "option", "iterate", "to", "from", "profile", "pageRank", "peerPressure", "program", "none"));
+    private static Set<String> NO_GRAPH = new HashSet<>(Arrays.asList("asAdmin", "by", "read", "write", "with", "option", "iterate", "to", "from", "profile", "pageRank", "peerPressure", "program", "none"));
     private static Set<String> NO_ANONYMOUS = new HashSet<>(Arrays.asList("start", "__"));
-    private static Set<String> IGNORES_BYTECODE = new HashSet<>(Arrays.asList("asAdmin", "iterate", "mapValues", "mapKeys"));
+    private static Set<String> IGNORES_BYTECODE = new HashSet<>(Arrays.asList("asAdmin", "read", "write", "iterate", "mapValues", "mapKeys"));
 
     @Test
     public void shouldHaveMethodsOfGraphTraversalOnAnonymousGraphTraversal() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
index 972db9a..d3bb6ef 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
@@ -43,6 +43,7 @@ import static org.junit.Assert.assertEquals;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 @RunWith(Parameterized.class)
 public class VertexProgramStrategyTest {
@@ -68,9 +69,11 @@ public class VertexProgramStrategyTest {
 
         final ComputerResultStep computerResultStep = new ComputerResultStep(EmptyTraversal.instance());
 
+        // The tests for io() need to verify that there is no change i.e. we don't want the step getting wrapped up in
+        // traversalvertexprogramstep stuff or else it won't execute properly in OLAP
         return Arrays.asList(new Traversal[][]{
-                { EmptyGraph.instance().traversal().io("blah.json").read(), EmptyGraph.instance().traversal().io("blah.json").read()},
-                { EmptyGraph.instance().traversal().io("blah.json").write(), EmptyGraph.instance().traversal().io("blah.json").write()},
+                { EmptyGraph.instance().traversal().io("blah.json"), EmptyGraph.instance().traversal().io("blah.json")},
+                { EmptyGraph.instance().traversal().io("blah.json"), EmptyGraph.instance().traversal().io("blah.json")},
                 {__.V().out().count(), start().addStep(traversal(__.V().out().count())).addStep(computerResultStep)},
                 {__.V().pageRank().out().count(), start().pageRank().asAdmin().addStep(traversal(__.V().out().count())).addStep(computerResultStep)},
                 {__.V().out().pageRank(), start().addStep(traversal(__.V().out())).pageRank().asAdmin().addStep(traversal(__.identity())).addStep(computerResultStep)},

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index 537cdbe..2c1a906 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -1247,6 +1247,15 @@ namespace Gremlin.Net.Process.Traversal
         }
 
         /// <summary>
+        ///     Adds the read step to this <see cref="GraphTraversal{SType, EType}" />.
+        /// </summary>
+        public GraphTraversal<S, E> Read ()
+        {
+            Bytecode.AddStep("read");
+            return Wrap<S, E>(this);
+        }
+
+        /// <summary>
         ///     Adds the repeat step to this <see cref="GraphTraversal{SType, EType}" />.
         /// </summary>
         public GraphTraversal<S, E> Repeat (ITraversal repeatTraversal)
@@ -1685,5 +1694,14 @@ namespace Gremlin.Net.Process.Traversal
             return Wrap<S, E>(this);
         }
 
+        /// <summary>
+        ///     Adds the write step to this <see cref="GraphTraversal{SType, EType}" />.
+        /// </summary>
+        public GraphTraversal<S, E> Write ()
+        {
+            Bytecode.AddStep("write");
+            return Wrap<S, E>(this);
+        }
+
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
index 4292850..00a3623 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
@@ -334,24 +334,13 @@ namespace Gremlin.Net.Process.Traversal
         }
 
         /// <summary>
-        ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the read step to that
+        ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the io step to that
         ///     traversal.
         /// </summary>
-        public GraphTraversal<S, S> Read<S>(string file)
+        public GraphTraversal<S, S> Io<S>(string file)
         {
             var traversal = new GraphTraversal<S, S>(TraversalStrategies, new Bytecode(Bytecode));
-                traversal.Bytecode.AddStep("read", file);
-            return traversal;
-        }
-
-        /// <summary>
-        ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the write step to that
-        ///     traversal.
-        /// </summary>
-        public GraphTraversal<S, S> Write<S>(string file)
-        {
-            var traversal = new GraphTraversal<S, S>(TraversalStrategies, new Bytecode(Bytecode));
-                traversal.Bytecode.AddStep("write", file);
+                traversal.Bytecode.AddStep("io", file);
             return traversal;
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java
index c56e7069..d83b1f7 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorProvider.java
@@ -24,6 +24,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionCompu
 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.ProgramTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
@@ -43,6 +45,10 @@ public class GroovyTranslatorProvider extends TinkerGraphProvider {
     private static Set<String> SKIP_TESTS = new HashSet<>(Arrays.asList(
             "testProfileStrategyCallback",
             "testProfileStrategyCallbackSideEffect",
+            // TODO: read and write tests don't translate locally well because of calling iterate() inside read()/write() add a none() - fix????
+            ReadTest.Traversals.class.getCanonicalName(),
+            WriteTest.Traversals.class.getCanonicalName(),
+            //
             GraphComputerTest.class.getCanonicalName(),
             ProgramTest.Traversals.class.getCanonicalName(),
             TraversalInterruptionTest.class.getCanonicalName(),

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
index 8fa51de..4f39fa5 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
@@ -173,22 +173,12 @@ class GraphTraversalSource {
   }
   
   /**
-   * read GraphTraversalSource step method.
+   * io GraphTraversalSource step method.
    * @param {...Object} args
    * @returns {GraphTraversal}
    */
-  read(...args) {
-    const b = new Bytecode(this.bytecode).addStep('read', args);
-    return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
-  }
-  
-  /**
-   * write GraphTraversalSource step method.
-   * @param {...Object} args
-   * @returns {GraphTraversal}
-   */
-  write(...args) {
-    const b = new Bytecode(this.bytecode).addStep('write', args);
+  io(...args) {
+    const b = new Bytecode(this.bytecode).addStep('io', args);
     return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
   }
   
@@ -913,6 +903,16 @@ class GraphTraversal extends Traversal {
   }
   
   /**
+   * Graph traversal read method.
+   * @param {...Object} args
+   * @returns {GraphTraversal}
+   */
+  read(...args) {
+    this.bytecode.addStep('read', args);
+    return this;
+  }
+  
+  /**
    * Graph traversal repeat method.
    * @param {...Object} args
    * @returns {GraphTraversal}
@@ -1162,6 +1162,16 @@ class GraphTraversal extends Traversal {
     return this;
   }
   
+  /**
+   * Graph traversal write method.
+   * @param {...Object} args
+   * @returns {GraphTraversal}
+   */
+  write(...args) {
+    this.bytecode.addStep('write', args);
+    return this;
+  }
+  
 }
 
 function callOnEmptyTraversal(fnName, args) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/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 e559613..6d56c5c 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
@@ -106,14 +106,9 @@ class GraphTraversalSource(object):
         traversal.bytecode.add_step("inject", *args)
         return traversal
 
-    def read(self, *args):
-        traversal = self.get_graph_traversal()
-        traversal.bytecode.add_step("read", *args)
-        return traversal
-
-    def write(self, *args):
+    def io(self, *args):
         traversal = self.get_graph_traversal()
-        traversal.bytecode.add_step("write", *args)
+        traversal.bytecode.add_step("io", *args)
         return traversal
 
 
@@ -419,6 +414,10 @@ class GraphTraversal(Traversal):
         self.bytecode.add_step("range", *args)
         return self
 
+    def read(self, *args):
+        self.bytecode.add_step("read", *args)
+        return self
+
     def repeat(self, *args):
         self.bytecode.add_step("repeat", *args)
         return self
@@ -519,6 +518,10 @@ class GraphTraversal(Traversal):
         self.bytecode.add_step("with", *args)
         return self
 
+    def write(self, *args):
+        self.bytecode.add_step("write", *args)
+        return self
+
 
 class __(object):
     graph_traversal = GraphTraversal

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
index 43da8b7..f3eb669 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
@@ -69,6 +69,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.SumTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.UnfoldTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ValueMapTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ExplainTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroupCountTest;
@@ -159,6 +160,7 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
             VertexTest.Traversals.class,
             UnfoldTest.Traversals.class,
             ValueMapTest.Traversals.class,
+            WriteTest.Traversals.class,
 
             // sideEffect
             AggregateTest.Traversals.class,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
index 6b7b67e..9e53169 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
@@ -18,24 +18,22 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 
-import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
 import org.apache.tinkerpop.gremlin.TestHelper;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
-import org.apache.tinkerpop.gremlin.process.IgnoreEngine;
+import org.apache.tinkerpop.gremlin.process.traversal.IO;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
-import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.io.IoTest;
+import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLResourceAccess;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONResourceAccess;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoResourceAccess;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.io.File;
 import java.io.IOException;
-import java.util.Map;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -43,22 +41,112 @@ import static org.junit.Assert.assertTrue;
 @RunWith(GremlinProcessRunner.class)
 public abstract class ReadTest extends AbstractGremlinProcessTest {
 
-    public abstract Traversal<Object,Object> get_g_io_read()  throws IOException;
+    public abstract Traversal<Object,Object> get_g_io_readXkryoX(final String fileToRead)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_read_withXreader_gryoX(final String fileToRead)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_readXjsonX(final String fileToRead)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_read_withXreader_graphsonX(final String fileToRead)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_readXxmlX(final String fileToRead)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_read_withXreader_graphmlX(final String fileToRead)  throws IOException;
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+    public void g_readXkryoX() throws IOException {
+        final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
+        final Traversal<Object,Object> traversal = get_g_io_readXkryoX(fileToRead);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        IoTest.assertModernGraph(graph, false, true);
+    }
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+    public void g_io_read_withXreader_gryoX() throws IOException {
+        final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
+        final Traversal<Object,Object> traversal = get_g_io_read_withXreader_gryoX(fileToRead);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        IoTest.assertModernGraph(graph, false, true);
+    }
 
     @Test
-    public void g_read() throws IOException {
-        final Traversal<Object,Object> traversal = get_g_io_read();
+    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+    public void g_readXjsonX() throws IOException {
+        final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GraphSONResourceAccess.class, "tinkerpop-modern-v3d0.json", "").getAbsolutePath().replace('\\', '/');
+        final Traversal<Object,Object> traversal = get_g_io_readXjsonX(fileToRead);
         printTraversalForm(traversal);
-        assertTrue(traversal.hasNext());
+        assertFalse(traversal.hasNext());
+
+        IoTest.assertModernGraph(graph, false, true);
+    }
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+    public void g_io_read_withXreader_graphsonX() throws IOException {
+        final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GraphSONResourceAccess.class, "tinkerpop-modern-v3d0.json", "").getAbsolutePath().replace('\\', '/');
+        final Traversal<Object,Object> traversal = get_g_io_read_withXreader_graphsonX(fileToRead);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        IoTest.assertModernGraph(graph, false, true);
+    }
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+    public void g_readXxmlX() throws IOException {
+        final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GraphMLResourceAccess.class, "tinkerpop-modern.xml", "").getAbsolutePath().replace('\\', '/');
+        final Traversal<Object,Object> traversal = get_g_io_readXxmlX(fileToRead);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        IoTest.assertModernGraph(graph, false, true);
+    }
+
+    @Test
+    @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
+    public void g_io_read_withXreader_graphmlX() throws IOException {
+        final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GraphMLResourceAccess.class, "tinkerpop-modern.xml", "").getAbsolutePath().replace('\\', '/');
+        final Traversal<Object,Object> traversal = get_g_io_read_withXreader_graphmlX(fileToRead);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
 
         IoTest.assertModernGraph(graph, false, true);
     }
 
     public static class Traversals extends ReadTest {
         @Override
-        public Traversal<Object,Object> get_g_io_read() throws IOException {
-            final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
+        public Traversal<Object,Object> get_g_io_readXkryoX(final String fileToRead) throws IOException {
             return g.io(fileToRead).read();
         }
+
+        @Override
+        public Traversal<Object,Object> get_g_io_read_withXreader_gryoX(final String fileToRead) throws IOException {
+            return g.io(fileToRead).with(IO.reader, IO.gryo).read();
+        }
+
+        @Override
+        public Traversal<Object,Object> get_g_io_readXjsonX(final String fileToRead) throws IOException {
+            return g.io(fileToRead).read();
+        }
+
+        @Override
+        public Traversal<Object,Object> get_g_io_read_withXreader_graphsonX(final String fileToRead) throws IOException {
+            return g.io(fileToRead).with(IO.reader, IO.graphson).read();
+        }
+        @Override
+        public Traversal<Object,Object> get_g_io_readXxmlX(final String fileToRead) throws IOException {
+            return g.io(fileToRead).read();
+        }
+
+        @Override
+        public Traversal<Object,Object> get_g_io_read_withXreader_graphmlX(final String fileToRead) throws IOException {
+            return g.io(fileToRead).with(IO.reader, IO.graphml).read();
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteTest.java
new file mode 100644
index 0000000..e739c0a
--- /dev/null
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteTest.java
@@ -0,0 +1,175 @@
+/*
+ * 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.step.map;
+
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
+import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
+import org.apache.tinkerpop.gremlin.process.traversal.IO;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.io.IOException;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+@RunWith(GremlinProcessRunner.class)
+public abstract class WriteTest extends AbstractGremlinProcessTest {
+
+    public abstract Traversal<Object,Object> get_g_io_writeXkryoX(final String fileToWrite)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_write_withXwriter_gryoX(final String fileToWrite)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_writeXjsonX(final String fileToWrite)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_write_withXwriter_graphsonX(final String fileToWrite)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_writeXxmlX(final String fileToWrite)  throws IOException;
+
+    public abstract Traversal<Object,Object> get_g_io_write_withXwriter_graphmlX(final String fileToWrite)  throws IOException;
+
+    @Test
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+    public void g_writeXkryoX() throws IOException {
+        final String fileToWrite = TestHelper.generateTempFile(WriteTest.class, "tinkerpop-modern-v3d0", ".kryo").getAbsolutePath().replace('\\', '/');
+
+        final File f = new File(fileToWrite);
+        assertThat(f.length() == 0, is(true));
+
+        final Traversal<Object,Object> traversal = get_g_io_writeXkryoX(fileToWrite);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        assertThat(f.length() > 0, is(true));
+    }
+
+    @Test
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+    public void g_io_write_withXwrite_gryoX() throws IOException {
+        final String fileToWrite = TestHelper.generateTempFile(WriteTest.class, "tinkerpop-modern-v3d0", ".kryo").getAbsolutePath().replace('\\', '/');
+
+        final File f = new File(fileToWrite);
+        assertThat(f.length() == 0, is(true));
+
+        final Traversal<Object,Object> traversal = get_g_io_write_withXwriter_gryoX(fileToWrite);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        assertThat(f.length() > 0, is(true));
+    }
+
+    @Test
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+    public void g_writeXjsonX() throws IOException {
+        final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern-v3d0", ".json").getAbsolutePath().replace('\\', '/');
+
+        final File f = new File(fileToWrite);
+        assertThat(f.length() == 0, is(true));
+
+        final Traversal<Object,Object> traversal = get_g_io_writeXjsonX(fileToWrite);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        assertThat(f.length() > 0, is(true));
+    }
+
+    @Test
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+    public void g_io_write_withXwriter_graphsonX() throws IOException {
+        final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern-v3d0", ".json").getAbsolutePath().replace('\\', '/');
+
+        final File f = new File(fileToWrite);
+        assertThat(f.length() == 0, is(true));
+
+        final Traversal<Object,Object> traversal = get_g_io_write_withXwriter_graphsonX(fileToWrite);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        assertThat(f.length() > 0, is(true));
+    }
+
+    @Test
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+    public void g_writeXxmlX() throws IOException {
+        final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern", ".xml").getAbsolutePath().replace('\\', '/');
+
+        final File f = new File(fileToWrite);
+        assertThat(f.length() == 0, is(true));
+
+        final Traversal<Object,Object> traversal = get_g_io_writeXxmlX(fileToWrite);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        assertThat(f.length() > 0, is(true));
+    }
+
+    @Test
+    @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
+    public void g_io_write_withXwriter_graphmlX() throws IOException {
+        final String fileToWrite = TestHelper.generateTempFile(WriteTest.class,"tinkerpop-modern", ".xml").getAbsolutePath().replace('\\', '/');
+
+        final File f = new File(fileToWrite);
+        assertThat(f.length() == 0, is(true));
+
+        final Traversal<Object,Object> traversal = get_g_io_write_withXwriter_graphmlX(fileToWrite);
+        printTraversalForm(traversal);
+        assertFalse(traversal.hasNext());
+
+        assertThat(f.length() > 0, is(true));
+    }
+
+    public static class Traversals extends WriteTest {
+        @Override
+        public Traversal<Object,Object> get_g_io_writeXkryoX(final String fileToWrite) throws IOException {
+            return g.io(fileToWrite).write();
+        }
+
+        @Override
+        public Traversal<Object,Object> get_g_io_write_withXwriter_gryoX(final String fileToWrite) throws IOException {
+            return g.io(fileToWrite).with(IO.writer, IO.gryo).write();
+        }
+
+        @Override
+        public Traversal<Object,Object> get_g_io_writeXjsonX(final String fileToWrite) throws IOException {
+            return g.io(fileToWrite).write();
+        }
+
+        @Override
+        public Traversal<Object,Object> get_g_io_write_withXwriter_graphsonX(final String fileToWrite) throws IOException {
+            return g.io(fileToWrite).with(IO.writer, IO.graphson).write();
+        }
+        @Override
+        public Traversal<Object,Object> get_g_io_writeXxmlX(final String fileToWrite) throws IOException {
+            return g.io(fileToWrite).write();
+        }
+
+        @Override
+        public Traversal<Object,Object> get_g_io_write_withXwriter_graphmlX(final String fileToWrite) throws IOException {
+            return g.io(fileToWrite).with(IO.writer, IO.graphml).write();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java
index 9acaa3f..69fa5cf 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategyProcessTest.java
@@ -22,7 +22,6 @@ import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
index 14c5360..5935ebf 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
@@ -142,6 +142,16 @@ import java.util.stream.Stream;
         method = "g_V_matchXa_followedBy_count_isXgtX10XX_b__a_0followedBy_count_isXgtX10XX_bX_count",
         reason = "Hadoop-Gremlin is OLAP-oriented and for OLTP operations, linear-scan joins are required. This particular tests takes many minutes to execute.",
         computers = {"ALL"})
+@Graph.OptOut(
+        test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadTest$Traversals",
+        method = "*",
+        reason = "This body of tests is not configured to properly suit OLAP based testing and HadoopGraph is not designed to handle single-threaded OLTP reads/writes.",
+        computers = {"ALL"})
+@Graph.OptOut(
+        test = "org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest$Traversals",
+        method = "*",
+        reason = "This body of tests is not configured to properly suit OLAP based testing and HadoopGraph is not designed to handle single-threaded OLTP reads/writes.",
+        computers = {"ALL"})
 public final class HadoopGraph implements Graph {
 
     public static final Logger LOGGER = LoggerFactory.getLogger(HadoopGraph.class);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
index 598e434..a590835 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
@@ -19,6 +19,7 @@
 package org.apache.tinkerpop.gremlin.tinkergraph.structure;
 
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
+import org.apache.tinkerpop.gremlin.process.traversal.IO;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
@@ -28,6 +29,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.Path
 import org.apache.tinkerpop.gremlin.structure.*;
 import org.apache.tinkerpop.gremlin.structure.io.IoTest;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
 import org.apache.tinkerpop.gremlin.util.TimeUtil;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -333,13 +336,4 @@ public class TinkerGraphPlayTest {
         System.out.println(g.V().as("a").both().as("b").dedup("a", "b").by(T.label).select("a", "b").toList());
 
     }
-
-    @Test
-    public void testBlah() {
-        TinkerGraph graph = TinkerGraph.open();
-        GraphTraversalSource g = graph.traversal();
-        g.io("../data/tinkerpop-modern.kryo").read();
-
-        IoTest.assertModernGraph(graph, true, false);
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java
index c20ed11..8462781 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/AbstractTinkerGraphGraphSONTranslatorProvider.java
@@ -29,6 +29,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.PageRankTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProgramTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.PartitionStrategyProcessTest;
@@ -52,6 +54,9 @@ public abstract class AbstractTinkerGraphGraphSONTranslatorProvider extends Tink
     private static Set<String> SKIP_TESTS = new HashSet<>(Arrays.asList(
             "testProfileStrategyCallback",
             "testProfileStrategyCallbackSideEffect",
+            // TODO: read and write tests don't translate locally well because of calling iterate() inside read()/write() add a none() - fix????
+            ReadTest.Traversals.class.getCanonicalName(),
+            WriteTest.Traversals.class.getCanonicalName(),
             //
             ProgramTest.Traversals.class.getCanonicalName(),
             TraversalInterruptionTest.class.getCanonicalName(),

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28c7fad2/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java
index 91e0385..e09508f 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/gryo/TinkerGraphGryoTranslatorProvider.java
@@ -25,6 +25,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalInterruptionCompu
 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.ProgramTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ElementIdStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategyProcessTest;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
@@ -45,6 +47,10 @@ public class TinkerGraphGryoTranslatorProvider extends TinkerGraphProvider {
             "testProfileStrategyCallback",
             "testProfileStrategyCallbackSideEffect",
             //
+            // TODO: read and write tests don't translate locally well because of calling iterate() inside read()/write() add a none() - fix????
+            ReadTest.Traversals.class.getCanonicalName(),
+            WriteTest.Traversals.class.getCanonicalName(),
+            //
             ProgramTest.Traversals.class.getCanonicalName(),
             TraversalInterruptionTest.class.getCanonicalName(),
             EventStrategyProcessTest.class.getCanonicalName(),
@@ -65,7 +71,6 @@ public class TinkerGraphGryoTranslatorProvider extends TinkerGraphProvider {
     public GraphTraversalSource traversal(final Graph graph) {
         if ((Boolean) graph.configuration().getProperty("skipTest"))
             return graph.traversal();
-            //throw new VerificationException("This test current does not work with Gremlin-Python", EmptyTraversal.instance());
         else {
             final GraphTraversalSource g = graph.traversal();
             return g.withStrategies(new TranslationStrategy(g, new GryoTranslator<>(JavaTranslator.of(g))));


[09/26] tinkerpop git commit: Added spring-data-gremlin and kotlin-gremlin-ogm to home page listing CTR

Posted by sp...@apache.org.
Added spring-data-gremlin and kotlin-gremlin-ogm to home page listing CTR


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

Branch: refs/heads/TINKERPOP-1996
Commit: 2fd11a1458ea274b2308d1a5863406c303537732
Parents: 11895ce
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jul 2 09:00:43 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jul 2 09:00:43 2018 -0400

----------------------------------------------------------------------
 docs/site/home/index.html | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2fd11a14/docs/site/home/index.html
----------------------------------------------------------------------
diff --git a/docs/site/home/index.html b/docs/site/home/index.html
index e67306e..4ff692c 100644
--- a/docs/site/home/index.html
+++ b/docs/site/home/index.html
@@ -255,10 +255,12 @@ limitations under the License.
             <li><a href="https://github.com/karthicks/gremlin-ogm">gremlin-objects</a> (java/dsl) - An Object Graph Mapping Library For Gremlin.</li>
             <li><a href="https://github.com/jbmusso/gremlin-template-string">gremlin-template-string</a> (js/variant) - A Gremlin language builder.</li>
             <li><a href="https://github.com/davebshow/ipython-gremlin">ipython-gremlin</a> (python/variant) - Gremlin in IPython and Jupyter.</li>
+            <li><a href="https://github.com/pm-dev/kotlin-gremlin-ogm">kotlin-gremlin-ogm</a> (kotlin/dsl) - An Object Graph Mapping Library for Kotlin and Gremlin.</li>
             <li><a href="http://ogre.clojurewerkz.org/">ogre</a> (clojure/variant) - A Clojure language wrapper for TinkerPop3.</li>
             <li><a href="http://bayofmany.github.io/">Peapod</a> (java/dsl) - An object-graph-wrapper.</li>
-            <li><a href="https://github.com/LITMUS-Benchmark-Suite/sparql-to-gremlin">sparql-gremlin</a> (sparql/distinct) - A SPARQL to Gremlin traversal transpiler.</li>
-            <li><a href="https://github.com/twilmes/sql-gremlin">sql-gremlin</a> (sql/distinct) - An SQL to Gremlin traversal transpiler.</li>
+            <li><a href="https://github.com/LITMUS-Benchmark-Suite/sparql-to-gremlin">sparql-gremlin</a> (sparql/distinct) - A SPARQL to Gremlin traversal compiler.</li>
+            <li><a href="https://github.com/Microsoft/spring-data-gremlin">spring-data-gremlin</a> (java/dsl) - Spring Data support for TinkerPop-enabled graph systems.</li>
+            <li><a href="https://github.com/twilmes/sql-gremlin">sql-gremlin</a> (sql/distinct) - An SQL to Gremlin traversal compiler.</li>
          </ul>
          <a name="language-drivers"></a>
          <h4 id="language-drivers">Language Drivers</h4>


[02/26] tinkerpop git commit: Removed some unneeded semi-colons from groovy script CTR

Posted by sp...@apache.org.
Removed some unneeded semi-colons from groovy script CTR


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

Branch: refs/heads/TINKERPOP-1996
Commit: 34a648b1bb36475beddbad4d673f5bed9c77ed4a
Parents: 4160b04
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jun 29 15:21:21 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 29 15:21:21 2018 -0400

----------------------------------------------------------------------
 gremlin-dotnet/glv/generate.groovy | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34a648b1/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/generate.groovy b/gremlin-dotnet/glv/generate.groovy
index 8f5fa44..29f9ec7 100644
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@ -61,7 +61,7 @@ def toCSharpTypeMap = ["Long": "long",
                        "Comparator": "IComparator",
                        "VertexProgram": "object"]
 
-def useE2 = ["E2", "E2"];
+def useE2 = ["E2", "E2"]
 def methodsWithSpecificTypes = ["constant": useE2,
                                 "limit": useE2,
                                 "mean": useE2,
@@ -92,17 +92,17 @@ def getCSharpGenericTypeParam = { typeName ->
 }
 
 def toCSharpType = { name ->
-    String typeName = toCSharpTypeMap.getOrDefault(name, name);
+    String typeName = toCSharpTypeMap.getOrDefault(name, name)
     if (typeName.equals(name) && (typeName.contains("? extends") || typeName.equals("Tree"))) {
         typeName = "E2"
     }
-    return typeName;
+    return typeName
 }
 
 def toCSharpMethodName = { symbol -> (String) Character.toUpperCase(symbol.charAt(0)) + symbol.substring(1) }
 
 def getJavaGenericTypeParameterTypeNames = { method ->
-    def typeArguments = method.genericReturnType.actualTypeArguments;
+    def typeArguments = method.genericReturnType.actualTypeArguments
     return typeArguments.
             collect { (it instanceof Class) ? ((Class)it).simpleName : it.typeName }.
             collect { name ->
@@ -110,7 +110,7 @@ def getJavaGenericTypeParameterTypeNames = { method ->
                     name = "object"
                 }
                 else if (name.equals("B")) {
-                    name = "E2";
+                    name = "E2"
                 }
                 name
             }
@@ -124,18 +124,18 @@ def getJavaParameterTypeNames = { method ->
 }
 
 def toCSharpParamString = { param, genTypeName ->
-    String csharpParamTypeName = genTypeName;
+    String csharpParamTypeName = genTypeName
     if (csharpParamTypeName == null){
         csharpParamTypeName = toCSharpType(param.type.simpleName)
     }
     else if (csharpParamTypeName == "M") {
-        csharpParamTypeName = "object";
+        csharpParamTypeName = "object"
     }
     else if (csharpParamTypeName == "A[]") {
-        csharpParamTypeName = "object[]";
+        csharpParamTypeName = "object[]"
     }
     else if (csharpParamTypeName == "A" || csharpParamTypeName == "B") {
-        csharpParamTypeName = "E2";
+        csharpParamTypeName = "E2"
     }
     "${csharpParamTypeName} ${param.name}"
     }
@@ -152,11 +152,11 @@ def getCSharpParamTypeString = { method ->
 }
 
 def getCSharpParamString = { method, useGenericParams ->
-    def parameters = method.parameters;
+    def parameters = method.parameters
     if (parameters.length == 0)
         return ""
 
-    def genericTypes = method.getGenericParameterTypes();
+    def genericTypes = method.getGenericParameterTypes()
     def csharpParameters = parameters.
             toList().indexed().
             collect { index, param ->
@@ -174,11 +174,11 @@ def getCSharpParamString = { method, useGenericParams ->
                 }
                 toCSharpParamString(param, genTypeName)
             }.
-            toArray();
+            toArray()
 
     if (method.isVarArgs()) {
-        def lastIndex = csharpParameters.length-1;
-        csharpParameters[lastIndex] = "params " + csharpParameters[lastIndex];
+        def lastIndex = csharpParameters.length-1
+        csharpParameters[lastIndex] = "params " + csharpParameters[lastIndex]
     }
 
     csharpParameters.join(", ")


[05/26] tinkerpop git commit: The GraphTraversal in .NET got out of sync somehow. CTR

Posted by sp...@apache.org.
The GraphTraversal in .NET got out of sync somehow. CTR


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

Branch: refs/heads/TINKERPOP-1996
Commit: 1f240fe2593524211553c222deadc4f95628f33a
Parents: 734b01f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jun 29 16:04:26 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 29 16:04:26 2018 -0400

----------------------------------------------------------------------
 .../src/Gremlin.Net/Process/Traversal/GraphTraversal.cs     | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f240fe2/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index 9952455..537cdbe 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -1676,5 +1676,14 @@ namespace Gremlin.Net.Process.Traversal
             return Wrap<S, E>(this);
         }
 
+        /// <summary>
+        ///     Adds the with step to this <see cref="GraphTraversal{SType, EType}" />.
+        /// </summary>
+        public GraphTraversal<S, E> With (string key, object value)
+        {
+            Bytecode.AddStep("with", key, value);
+            return Wrap<S, E>(this);
+        }
+
     }
 }
\ No newline at end of file


[16/26] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by sp...@apache.org.
Merge branch 'tp32' into tp33


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

Branch: refs/heads/TINKERPOP-1996
Commit: a6ba2d5b225de0cba79370774bc211d572516bfc
Parents: bf07f13 3dcabd4
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jul 12 10:51:23 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:51:23 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                           | 1 +
 .../java/org/apache/tinkerpop/gremlin/driver/Handler.java    | 8 ++++++++
 .../gremlin/driver/handler/WebSocketClientHandler.java       | 5 -----
 3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a6ba2d5b/CHANGELOG.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a6ba2d5b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
----------------------------------------------------------------------


[07/26] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by sp...@apache.org.
Merge branch 'tp32' into tp33

Conflicts:
	gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java


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

Branch: refs/heads/TINKERPOP-1996
Commit: 1f15781ac049008e50b63e3632c86158e570ef15
Parents: 65ba04f 309957b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sat Jun 30 06:28:22 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Sat Jun 30 06:28:22 2018 -0400

----------------------------------------------------------------------
 .../dsl/graph/GraphTraversalSource.java         | 94 +++++++++++++++++++-
 1 file changed, 93 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f15781a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
----------------------------------------------------------------------
diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSource.java
index 81a0a71,baba19c..bc3ef9e
--- 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
@@@ -127,6 -139,15 +133,9 @@@ public class GraphTraversalSource imple
          return (GraphTraversalSource) TraversalSource.super.withoutStrategies(traversalStrategyClasses);
      }
  
 -    @Override
 -    @Deprecated
 -    public GraphTraversalSource withBindings(final Bindings bindings) {
 -        return (GraphTraversalSource) TraversalSource.super.withBindings(bindings);
 -    }
 -
+     /**
+      * {@inheritDoc}
+      */
      @Override
      public GraphTraversalSource withComputer(final Computer computer) {
          return (GraphTraversalSource) TraversalSource.super.withComputer(computer);
@@@ -247,6 -319,30 +307,10 @@@
  
      //// SPAWNS
  
 -    /**
 -     * @deprecated As of release 3.1.0, replaced by {@link #addV()}
 -     */
 -    @Deprecated
 -    public GraphTraversal<Vertex, Vertex> addV(final Object... keyValues) {
 -        ElementHelper.legalPropertyKeyValueArray(keyValues);
 -        if (keyValues.length != 0 && keyValues[0].equals(T.label)) {
 -            final GraphTraversal<Vertex, Vertex> traversal = this.addV(keyValues[1].toString());
 -            for (int i = 2; i < keyValues.length; i = i + 2) {
 -                traversal.property(keyValues[i], keyValues[i + 1]);
 -            }
 -            return traversal;
 -        } else {
 -            final GraphTraversal<Vertex, Vertex> traversal = this.addV();
 -            for (int i = 0; i < keyValues.length; i = i + 2) {
 -                traversal.property(keyValues[i], keyValues[i + 1]);
 -            }
 -            return traversal;
 -        }
 -    }
+ 
+     /**
+      * Spawns a {@link GraphTraversal} by adding a vertex with the specified label.
+      */
      public GraphTraversal<Vertex, Vertex> addV(final String label) {
          final GraphTraversalSource clone = this.clone();
          clone.bytecode.addStep(GraphTraversal.Symbols.addV, label);
@@@ -254,34 -350,19 +318,49 @@@
          return traversal.addStep(new AddVertexStartStep(traversal, label));
      }
  
+     /**
++     * Spawns a {@link GraphTraversal} by adding a vertex with the label as determined by a {@link Traversal}.
++     */
 +    public GraphTraversal<Vertex, Vertex> addV(final Traversal<?, String> vertexLabelTraversal) {
 +        final GraphTraversalSource clone = this.clone();
 +        clone.bytecode.addStep(GraphTraversal.Symbols.addV, vertexLabelTraversal);
 +        final GraphTraversal.Admin<Vertex, Vertex> traversal = new DefaultGraphTraversal<>(clone);
 +        return traversal.addStep(new AddVertexStartStep(traversal, vertexLabelTraversal));
 +    }
 +
++    /**
+      * Spawns a {@link GraphTraversal} by adding a vertex with the default label.
+      */
      public GraphTraversal<Vertex, Vertex> addV() {
          final GraphTraversalSource clone = this.clone();
          clone.bytecode.addStep(GraphTraversal.Symbols.addV);
          final GraphTraversal.Admin<Vertex, Vertex> traversal = new DefaultGraphTraversal<>(clone);
 -        return traversal.addStep(new AddVertexStartStep(traversal, null));
 +        return traversal.addStep(new AddVertexStartStep(traversal, (String)null));
 +    }
 +
++    /**
++     * Spawns a {@link GraphTraversal} by adding a edge with the specified label.
++     */
 +    public GraphTraversal<Edge, Edge> addE(final String label) {
 +        final GraphTraversalSource clone = this.clone();
 +        clone.bytecode.addStep(GraphTraversal.Symbols.addE, label);
 +        final GraphTraversal.Admin<Edge, Edge> traversal = new DefaultGraphTraversal<>(clone);
 +        return traversal.addStep(new AddEdgeStartStep(traversal, label));
 +    }
 +
++    /**
++     * Spawns a {@link GraphTraversal} by adding a edge with a label as specified by the provided {@link Traversal}.
++     */
 +    public GraphTraversal<Edge, Edge> addE(final Traversal<?, String> edgeLabelTraversal) {
 +        final GraphTraversalSource clone = this.clone();
 +        clone.bytecode.addStep(GraphTraversal.Symbols.addE, edgeLabelTraversal);
 +        final GraphTraversal.Admin<Edge, Edge> traversal = new DefaultGraphTraversal<>(clone);
 +        return traversal.addStep(new AddEdgeStartStep(traversal, edgeLabelTraversal));
      }
  
+     /**
+      * Spawns a {@link GraphTraversal} starting it with arbitrary values.
+      */
      public <S> GraphTraversal<S, S> inject(S... starts) {
          final GraphTraversalSource clone = this.clone();
          clone.bytecode.addStep(GraphTraversal.Symbols.inject, starts);


[24/26] tinkerpop git commit: TINKERPOP-1996 none() doesn't need to be removed in HadoopIoStrategy

Posted by sp...@apache.org.
TINKERPOP-1996 none() doesn't need to be removed in HadoopIoStrategy

Not sure why this was there in the first place. Removing it not allows Hadoop integration tests to pass, but seems to have no real effect on existing operations.


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

Branch: refs/heads/TINKERPOP-1996
Commit: f78c87da3b7b4f98b168880070d2592a39aed2e9
Parents: 28c7fad
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jul 12 08:17:56 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:59:39 2018 -0400

----------------------------------------------------------------------
 .../process/computer/traversal/strategy/HadoopIoStrategy.java     | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f78c87da/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
index 38d5a7f..89ee04b 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
@@ -60,9 +60,6 @@ public final class HadoopIoStrategy extends AbstractTraversalStrategy<TraversalS
 
             TraversalHelper.replaceStep((Step) readWriting, hadoopIoStep, traversal);
         }
-
-        if (traversal.getEndStep() instanceof NoneStep)
-            traversal.removeStep(1);
     }
 
     public static HadoopIoStrategy instance() {


[26/26] tinkerpop git commit: TINKERPOP-1996 Made read()/write() terminator steps

Posted by sp...@apache.org.
TINKERPOP-1996 Made read()/write() terminator steps

Without this approach the with() operator couldn't be used because the traversal would already be iterated on the call to read() and write(). In this way read() and write() are both terminators and modulators at the same time.


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

Branch: refs/heads/TINKERPOP-1996
Commit: 2e6c1708bc9526df6d3ac5af1657720d9702868e
Parents: f02daaf
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jul 11 10:20:39 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:59:39 2018 -0400

----------------------------------------------------------------------
 .../decoration/VertexProgramStrategy.java       |   5 +-
 .../process/traversal/TraversalStrategies.java  |   2 -
 .../traversal/dsl/graph/GraphTraversal.java     |  34 +++++
 .../dsl/graph/GraphTraversalSource.java         |  19 +--
 .../process/traversal/step/ReadWriting.java     |  40 ++++++
 .../gremlin/process/traversal/step/Reading.java |  32 -----
 .../gremlin/process/traversal/step/Writing.java |  32 -----
 .../process/traversal/step/map/IoStep.java      | 135 +++++++++++++++++++
 .../process/traversal/step/map/ReadStep.java    | 113 ----------------
 .../process/traversal/step/map/WriteStep.java   | 111 ---------------
 .../strategy/verification/IoUsageStrategy.java  |  74 ----------
 .../decoration/VertexProgramStrategyTest.java   |   4 +-
 .../verification/IoUsageStrategyTest.java       |  93 -------------
 .../process/traversal/step/map/ReadTest.java    |   8 +-
 .../traversal/step/map/HadoopIoStep.java        | 110 +++++++++++++++
 .../traversal/step/map/HadoopReadStep.java      |  82 -----------
 .../traversal/step/map/HadoopWriteStep.java     |  82 -----------
 .../traversal/strategy/HadoopIoStrategy.java    |  30 ++---
 .../structure/TinkerGraphPlayTest.java          |   2 +-
 19 files changed, 343 insertions(+), 665 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/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 c83039a..cb99652 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
@@ -34,8 +34,7 @@ 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.__;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Writing;
+import org.apache.tinkerpop.gremlin.process.traversal.step.ReadWriting;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
@@ -102,7 +101,7 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
 
         // wrap all non-VertexComputing steps into a TraversalVertexProgramStep
         currentStep = traversal.getStartStep();
-        if (!(currentStep instanceof Reading) && !(currentStep instanceof Writing)) {
+        if (!(currentStep instanceof ReadWriting)) {
             while (!(currentStep instanceof EmptyStep)) {
                 final Traversal.Admin<?, ?> computerTraversal = new DefaultTraversal<>();
                 final Step<?, ?> firstLegalOLAPStep = getFirstLegalOLAPStep(currentStep);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index 66b0236..ef3e841 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -36,7 +36,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.Path
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.CountStrategy;
 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.IoUsageStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.StandardVerificationStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -223,7 +222,6 @@ public interface TraversalStrategies extends Serializable, Cloneable {
                     PathRetractionStrategy.instance(),
                     LazyBarrierStrategy.instance(),
                     ProfileStrategy.instance(),
-                    IoUsageStrategy.instance(),
                     StandardVerificationStrategy.instance());
             GRAPH_CACHE.put(Graph.class, graphStrategies);
             GRAPH_CACHE.put(EmptyGraph.class, new DefaultTraversalStrategies());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
index 6d75745..a7d420a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
@@ -39,6 +39,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.ByModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
 import org.apache.tinkerpop.gremlin.process.traversal.step.FromToModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
+import org.apache.tinkerpop.gremlin.process.traversal.step.ReadWriting;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TimesModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.branch.BranchStep;
@@ -2705,6 +2706,38 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
 
     ////
 
+    ///////////////////// IO TERMINATOR STEPS /////////////////////
+
+    /**
+     * This step is technically a step modulator for the the {@link GraphTraversalSource#io(String)} step which
+     * instructs the step to perform a read with its given configuration.
+     *
+     * @return the traversal that has been iterated with the read IO action executed
+     * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#io-step" target="_blank">Reference Documentation - IO Step</a>
+     * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#read-step" target="_blank">Reference Documentation - Read Step</a>
+     * @since 3.4.0
+     */
+    public default GraphTraversal<S,E> read() {
+        this.asAdmin().getBytecode().addStep(Symbols.read);
+        ((ReadWriting) this.asAdmin().getEndStep()).setMode(ReadWriting.Mode.READING);
+        return this.iterate();
+    }
+
+    /**
+     * This step is technically a step modulator for the the {@link GraphTraversalSource#io(String)} step which
+     * instructs the step to perform a write with its given configuration.
+     *
+     * @return the traversal that has been iterated with the write IO action executed
+     * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#io-step" target="_blank">Reference Documentation - IO Step</a>
+     * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#write-step" target="_blank">Reference Documentation - Write Step</a>
+     * @since 3.4.0
+     */
+    public default GraphTraversal<S,E> write() {
+        this.asAdmin().getBytecode().addStep(Symbols.write);
+        ((ReadWriting) this.asAdmin().getEndStep()).setMode(ReadWriting.Mode.WRITING);
+        return this.iterate();
+    }
+
     /**
      * Iterates the traversal presumably for the generation of side-effects.
      */
@@ -2789,6 +2822,7 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
         public static final String skip = "skip";
         public static final String tail = "tail";
         public static final String coin = "coin";
+        public static final String io = "io";
         public static final String read = "read";
         public static final String write = "write";
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/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 49e012f..aa4995d 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
@@ -24,7 +24,6 @@ import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
-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;
@@ -32,8 +31,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddEdgeStartStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStartStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.IoStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.InjectStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.RequirementsStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
@@ -43,8 +41,6 @@ import org.apache.tinkerpop.gremlin.structure.Transaction;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
-import java.util.Map;
-import java.util.NoSuchElementException;
 import java.util.Optional;
 import java.util.function.BinaryOperator;
 import java.util.function.Supplier;
@@ -395,18 +391,11 @@ public class GraphTraversalSource implements TraversalSource {
         return traversal.addStep(new GraphStep<>(traversal, Edge.class, true, edgesIds));
     }
 
-    public <S> GraphTraversal<S, S> read(final String file) {
+    public <S> GraphTraversal<S, S> io(final String file) {
         final GraphTraversalSource clone = this.clone();
-        clone.bytecode.addStep(GraphTraversal.Symbols.read, file);
+        clone.bytecode.addStep(GraphTraversal.Symbols.io, file);
         final GraphTraversal.Admin<S,S> traversal = new DefaultGraphTraversal<>(clone);
-        return traversal.addStep(new ReadStep<S>(traversal, file)).iterate();
-    }
-
-    public <S> GraphTraversal<S, S> write(final String file) {
-        final GraphTraversalSource clone = this.clone();
-        clone.bytecode.addStep(GraphTraversal.Symbols.write, file);
-        final GraphTraversal.Admin<S,S> traversal = new DefaultGraphTraversal<>(clone);
-        return traversal.addStep(new WriteStep<S>(traversal, file)).iterate();
+        return traversal.addStep(new IoStep<S>(traversal, file));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ReadWriting.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ReadWriting.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ReadWriting.java
new file mode 100644
index 0000000..18de925
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ReadWriting.java
@@ -0,0 +1,40 @@
+/*
+ * 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.step;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface ReadWriting extends Configuring {
+
+    public enum Mode {
+        UNSET,
+        READING,
+        WRITING
+    }
+
+    /**
+     * Get the file location to write to.
+     */
+    public String getFile();
+
+    public void setMode(final Mode mode);
+
+    public Mode getMode();
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
deleted file mode 100644
index 3f7c714..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
+++ /dev/null
@@ -1,32 +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.process.traversal.step;
-
-/**
- * An interface for describing steps that will read a graph from some specified location.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public interface Reading extends Configuring {
-
-    /**
-     * Get the file location to read from.
-     */
-    public String getFile();
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
deleted file mode 100644
index fe56363..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
+++ /dev/null
@@ -1,32 +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.process.traversal.step;
-
-/**
- * An interface for describing steps that will write a graph to some specified location.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public interface Writing extends Configuring {
-
-    /**
-     * Get the file location to write to.
-     */
-    public String getFile();
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
new file mode 100644
index 0000000..8d22427
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
@@ -0,0 +1,135 @@
+/*
+ * 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.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.ReadWriting;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
+import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class IoStep<S> extends AbstractStep<S,S> implements ReadWriting {
+    private Parameters parameters = new Parameters();
+    private boolean first = true;
+    private String file;
+    private Mode mode = Mode.UNSET;
+
+    public IoStep(final Traversal.Admin traversal, final String file) {
+        super(traversal);
+
+        if (null == file || file.isEmpty())
+            throw new IllegalArgumentException("file cannot be null or empty");
+
+        this.file = file;
+    }
+
+    @Override
+    public void setMode(final Mode mode) {
+        this.mode = mode;
+    }
+
+    @Override
+    public Mode getMode() {
+        return mode;
+    }
+
+    @Override
+    public String getFile() {
+        return file;
+    }
+
+    @Override
+    public Parameters getParameters() {
+        return this.parameters;
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
+    protected Traverser.Admin<S> processNextStart() {
+        if (mode == Mode.UNSET) throw new IllegalStateException("IO mode was not set to read() or write()");
+        if (!this.first) throw FastNoSuchElementException.instance();
+
+        this.first = false;
+        final File file = new File(this.file);
+
+        if (mode == Mode.READING) {
+            if (!file.exists()) throw new IllegalStateException(this.file + " does not exist");
+
+            try (final InputStream stream = new FileInputStream(file)) {
+                final Graph graph = (Graph) this.traversal.getGraph().get();
+                GryoReader.build().create().readGraph(stream, graph);
+
+                return EmptyTraverser.instance();
+            } catch (IOException ioe) {
+                throw new IllegalStateException(String.format("Could not read file %s into graph", this.file), ioe);
+            }
+        } else if (mode == Mode.WRITING) {
+            try (final OutputStream stream = new FileOutputStream(file)) {
+                final Graph graph = (Graph) this.traversal.getGraph().get();
+                GryoWriter.build().create().writeGraph(stream, graph);
+
+                return EmptyTraverser.instance();
+            } catch (IOException ioe) {
+                throw new IllegalStateException(String.format("Could not write file %s from graph", this.file), ioe);
+            }
+        } else {
+            throw new IllegalStateException("Invalid ReadWriting.Mode configured in IoStep: " + mode.name());
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        final int hash = super.hashCode() ^ this.parameters.hashCode();
+        return (null != this.file) ? (hash ^ file.hashCode()) : hash;
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.stepString(this, file, this.parameters);
+    }
+
+    @Override
+    public IoStep clone() {
+        final IoStep clone = (IoStep) super.clone();
+        clone.parameters = this.parameters.clone();
+        clone.file = this.file;
+        clone.mode = this.mode;
+        return clone;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
deleted file mode 100644
index 99f7e66..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
+++ /dev/null
@@ -1,113 +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.process.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
-import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
-import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Reads data from a file into a {@link Graph}. This step is meant to be used as the first and last step in a
- * traversal.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class ReadStep<S> extends AbstractStep<S,S> implements Reading {
-
-    private Parameters parameters = new Parameters();
-    private boolean first = true;
-    private String file;
-
-    public ReadStep(final Traversal.Admin traversal, final String file) {
-        super(traversal);
-
-        if (null == file || file.isEmpty())
-            throw new IllegalArgumentException("file cannot be null or empty");
-
-        this.file = file;
-    }
-
-    @Override
-    public String getFile() {
-        return file;
-    }
-
-    @Override
-    public Parameters getParameters() {
-        return this.parameters;
-    }
-
-    @Override
-    public void configure(final Object... keyValues) {
-        this.parameters.set(null, keyValues);
-    }
-
-    @Override
-    protected Traverser.Admin<S> processNextStart() {
-        if (!this.first) throw FastNoSuchElementException.instance();
-
-        this.first = false;
-        final File file = new File(this.file);
-        if (!file.exists()) throw new IllegalStateException(this.file + " does not exist");
-
-        try (final InputStream stream = new FileInputStream(file)) {
-            final Graph graph = (Graph) this.traversal.getGraph().get();
-            GryoReader.build().create().readGraph(stream, graph);
-
-            return EmptyTraverser.instance();
-        } catch (IOException ioe) {
-            throw new IllegalStateException(String.format("Could not read file %s into graph", this.file), ioe);
-        }
-    }
-
-    @Override
-    public int hashCode() {
-        final int hash = super.hashCode() ^ this.parameters.hashCode();
-        return (null != this.file) ? (hash ^ file.hashCode()) : hash;
-    }
-
-    @Override
-    public String toString() {
-        return StringFactory.stepString(this, file, this.parameters);
-    }
-
-    @Override
-    public ReadStep clone() {
-        final ReadStep clone = (ReadStep) super.clone();
-        clone.parameters = this.parameters.clone();
-        clone.file = this.file;
-        return clone;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
deleted file mode 100644
index 20ffec9..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
+++ /dev/null
@@ -1,111 +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.process.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Writing;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
-import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
-import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
-import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * Writes data to a file from a {@link Graph}. This step is meant to be used as the first and last step in a
- * traversal.
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class WriteStep<S> extends AbstractStep<S,S> implements Writing {
-
-    private Parameters parameters = new Parameters();
-    private boolean first = true;
-    private String file;
-
-    public WriteStep(final Traversal.Admin traversal, final String file) {
-        super(traversal);
-
-        if (null == file || file.isEmpty())
-            throw new IllegalArgumentException("file cannot be null or empty");
-
-        this.file = file;
-    }
-
-    @Override
-    public String getFile() {
-        return file;
-    }
-
-    @Override
-    public Parameters getParameters() {
-        return this.parameters;
-    }
-
-    @Override
-    public void configure(final Object... keyValues) {
-        this.parameters.set(null, keyValues);
-    }
-
-    @Override
-    protected Traverser.Admin<S> processNextStart() {
-        if (!this.first) throw FastNoSuchElementException.instance();
-
-        this.first = false;
-        final File file = new File(this.file);
-        try (final OutputStream stream = new FileOutputStream(file)) {
-            final Graph graph = (Graph) this.traversal.getGraph().get();
-            GryoWriter.build().create().writeGraph(stream, graph);
-
-            return EmptyTraverser.instance();
-        } catch (IOException ioe) {
-            throw new IllegalStateException(String.format("Could not write file %s from graph", this.file), ioe);
-        }
-    }
-
-    @Override
-    public int hashCode() {
-        final int hash = super.hashCode() ^ this.parameters.hashCode();
-        return (null != this.file) ? (hash ^ file.hashCode()) : hash;
-    }
-
-    @Override
-    public String toString() {
-        return StringFactory.stepString(this, file, this.parameters);
-    }
-
-    @Override
-    public WriteStep clone() {
-        final WriteStep clone = (WriteStep) super.clone();
-        clone.parameters = this.parameters.clone();
-        clone.file = this.file;
-        return clone;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
deleted file mode 100644
index b4a0669..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
+++ /dev/null
@@ -1,74 +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.process.traversal.strategy.verification;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-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.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.step.filter.NoneStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteStep;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
-
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * {@code IoUsageStrategy} prevents the {@link GraphTraversalSource#read(String)} and
- * {@link GraphTraversalSource#write(String)} steps from being used outside of their intended scope, which is as the
- * first and last step in a traversal. Therefore, it can only be used as {@code g.read('file.gryo')} and
- * {@code g.write('file.gryo')}. As both of these steps take additional configuration, the use of the
- * {@link GraphTraversal#with(String, Object)} is acceptable.
- * <p/>
- *
- * @author Stephen Mallette (http://stephen.genoprime.com)
- * @example <pre>
- * g.read('file.kryo').V()            // throws VerificationException
- * g.write('file.kryo').V()           // throws VerificationException
- * </pre>
- */
-public final class IoUsageStrategy extends AbstractTraversalStrategy<TraversalStrategy.VerificationStrategy> implements TraversalStrategy.VerificationStrategy {
-
-    private static final IoUsageStrategy INSTANCE = new IoUsageStrategy();
-
-    private IoUsageStrategy() {
-    }
-
-    @Override
-    public void apply(final Traversal.Admin<?, ?> traversal) {
-        final Step start = traversal.getStartStep();
-        final Step end = traversal.getEndStep();
-        if ((start instanceof ReadStep || start instanceof WriteStep) && end != start) {
-            if ((end instanceof NoneStep && traversal.getSteps().size() > 2)) {
-                throw new VerificationException("The read() or write() steps must be the first and only step in the traversal - they cannot be used with other steps", traversal);
-            }
-        }
-    }
-
-    public static IoUsageStrategy instance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public Set<Class<? extends VerificationStrategy>> applyPrior() {
-        return Collections.singleton(ComputerVerificationStrategy.class);
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
index 71cb22d..972db9a 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
@@ -69,8 +69,8 @@ public class VertexProgramStrategyTest {
         final ComputerResultStep computerResultStep = new ComputerResultStep(EmptyTraversal.instance());
 
         return Arrays.asList(new Traversal[][]{
-                { EmptyGraph.instance().traversal().read("blah.json"), EmptyGraph.instance().traversal().read("blah.json")},
-                { EmptyGraph.instance().traversal().write("blah.json"), EmptyGraph.instance().traversal().write("blah.json")},
+                { EmptyGraph.instance().traversal().io("blah.json").read(), EmptyGraph.instance().traversal().io("blah.json").read()},
+                { EmptyGraph.instance().traversal().io("blah.json").write(), EmptyGraph.instance().traversal().io("blah.json").write()},
                 {__.V().out().count(), start().addStep(traversal(__.V().out().count())).addStep(computerResultStep)},
                 {__.V().pageRank().out().count(), start().pageRank().asAdmin().addStep(traversal(__.V().out().count())).addStep(computerResultStep)},
                 {__.V().out().pageRank(), start().addStep(traversal(__.V().out())).pageRank().asAdmin().addStep(traversal(__.identity())).addStep(computerResultStep)},

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategyTest.java
deleted file mode 100644
index 907e2b7..0000000
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategyTest.java
+++ /dev/null
@@ -1,93 +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.process.traversal.strategy.verification;
-
-import org.apache.tinkerpop.gremlin.TestHelper;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
-import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
-import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-@RunWith(Parameterized.class)
-public class IoUsageStrategyTest {
-
-    private static final GraphTraversalSource g = EmptyGraph.instance().traversal();
-
-    private static File junkFile;
-
-    static {
-        try {
-            junkFile = TestHelper.generateTempFile(IoUsageStrategyTest.class, "fake", "kryo");
-        } catch (IOException ioe) {
-            throw new RuntimeException(ioe);
-        }
-    }
-
-    @Parameterized.Parameters(name = "{0}")
-    public static Iterable<Object[]> data() {
-        return Arrays.asList(new Object[][]{
-                {"g.read('a.kryo')", g.read(junkFile.getAbsolutePath()), true},
-                {"g.write('a.kryo')", g.write(junkFile.getAbsolutePath()), true},
-                {"g.read('a.kryo').with(\"x\", \"y\")", g.read(junkFile.getAbsolutePath()).with("x", "y"), true},
-                {"g.write('a.kryo').with(\"x\", \"y\")", g.write(junkFile.getAbsolutePath()).with("x", "y"), true},
-                {"g.read('a.kryo').V()", g.read(junkFile.getAbsolutePath()).V(), false},
-                {"g.write('a.kryo').V()", g.write(junkFile.getAbsolutePath()).V(), false}
-        });
-    }
-
-    @Parameterized.Parameter(value = 0)
-    public String name;
-
-    @Parameterized.Parameter(value = 1)
-    public Traversal traversal;
-
-    @Parameterized.Parameter(value = 2)
-    public boolean allow;
-
-    @Test
-    public void shouldBeVerified() {
-        final TraversalStrategies strategies = new DefaultTraversalStrategies();
-        strategies.addStrategies(IoUsageStrategy.instance());
-        traversal.asAdmin().setStrategies(strategies);
-        if (allow) {
-            traversal.asAdmin().applyStrategies();
-        } else {
-            try {
-                traversal.asAdmin().applyStrategies();
-                fail("The strategy should not allow read()/write() to be used with other steps: " + this.traversal);
-            } catch (VerificationException ise) {
-                assertTrue(ise.getMessage().contains("read() or write() steps"));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
index 2cfc3f7..6b7b67e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
@@ -43,11 +43,11 @@ import static org.junit.Assert.assertTrue;
 @RunWith(GremlinProcessRunner.class)
 public abstract class ReadTest extends AbstractGremlinProcessTest {
 
-    public abstract Traversal<Map<String,Object>, Map<String,Object>> get_g_read()  throws IOException;
+    public abstract Traversal<Object,Object> get_g_io_read()  throws IOException;
 
     @Test
     public void g_read() throws IOException {
-        final Traversal<Map<String,Object>, Map<String,Object>> traversal = get_g_read();
+        final Traversal<Object,Object> traversal = get_g_io_read();
         printTraversalForm(traversal);
         assertTrue(traversal.hasNext());
 
@@ -56,9 +56,9 @@ public abstract class ReadTest extends AbstractGremlinProcessTest {
 
     public static class Traversals extends ReadTest {
         @Override
-        public Traversal<Map<String,Object>, Map<String,Object>> get_g_read() throws IOException {
+        public Traversal<Object,Object> get_g_io_read() throws IOException {
             final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
-            return g.read(fileToRead);
+            return g.io(fileToRead).read();
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopIoStep.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopIoStep.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopIoStep.java
new file mode 100644
index 0000000..83a95e0
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopIoStep.java
@@ -0,0 +1,110 @@
+/*
+ * 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.hadoop.process.computer.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.hadoop.Constants;
+import org.apache.tinkerpop.gremlin.process.computer.GraphFilter;
+import org.apache.tinkerpop.gremlin.process.computer.Memory;
+import org.apache.tinkerpop.gremlin.process.computer.clone.CloneVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.VertexProgramStep;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.step.ReadWriting;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class HadoopIoStep extends VertexProgramStep implements ReadWriting {
+
+    private Parameters parameters = new Parameters();
+    private Mode mode = Mode.UNSET;
+    private String file;
+
+    public HadoopIoStep(final Traversal.Admin traversal, final String file) {
+        super(traversal);
+        this.file = file;
+    }
+
+    @Override
+    public void setMode(final Mode mode) {
+        this.mode = mode;
+    }
+
+    @Override
+    public Mode getMode() {
+        return mode;
+    }
+
+    @Override
+    public String getFile() {
+        return file;
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        // TODO: probably should write to the Configuration selectively - no need for actual Parameters?????????
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
+    public Parameters getParameters() {
+        return parameters;
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.stepString(this, new GraphFilter(this.computer));
+    }
+
+    @Override
+    public CloneVertexProgram generateProgram(final Graph graph, final Memory memory) {
+        if (mode == Mode.UNSET)
+            throw new IllegalStateException("IO mode was not set to read() or write()");
+        else if (mode == Mode.READING)
+            configureForRead(graph);
+        else if (mode == Mode.WRITING)
+            configureForWrite(graph);
+        else
+            throw new IllegalStateException("Invalid ReadWriting.Mode configured in IoStep: " + mode.name());
+
+        return CloneVertexProgram.build().create(graph);
+    }
+
+    @Override
+    public HadoopIoStep clone() {
+        return (HadoopIoStep) super.clone();
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+
+    private void configureForRead(final Graph graph) {
+        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER, "org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat");
+        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION, file);
+    }
+
+    private void configureForWrite(final Graph graph) {
+        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_GRAPH_WRITER, "org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat");
+        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION, file);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
deleted file mode 100644
index 1ec3d38..0000000
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
+++ /dev/null
@@ -1,82 +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.hadoop.process.computer.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.hadoop.Constants;
-import org.apache.tinkerpop.gremlin.process.computer.GraphFilter;
-import org.apache.tinkerpop.gremlin.process.computer.Memory;
-import org.apache.tinkerpop.gremlin.process.computer.clone.CloneVertexProgram;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.VertexProgramStep;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class HadoopReadStep extends VertexProgramStep implements Reading {
-
-    private Parameters parameters = new Parameters();
-
-    public HadoopReadStep(final Traversal.Admin traversal, final String localFile) {
-        super(traversal);
-
-        final Graph graph = (Graph) traversal.getGraph().get();
-        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER, "org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat");
-        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION, localFile);
-    }
-
-    @Override
-    public String getFile() {
-        return (String) ((Graph) traversal.getGraph().get()).configuration().getProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION);
-    }
-
-    @Override
-    public void configure(final Object... keyValues) {
-        // TODO: probably should write to the Configuration selectively - no need for actual Parameters?????????
-        this.parameters.set(null, keyValues);
-    }
-
-    @Override
-    public Parameters getParameters() {
-        return parameters;
-    }
-
-    @Override
-    public String toString() {
-        return StringFactory.stepString(this, new GraphFilter(this.computer));
-    }
-
-    @Override
-    public CloneVertexProgram generateProgram(final Graph graph, final Memory memory) {
-        return CloneVertexProgram.build().create(graph);
-    }
-
-    @Override
-    public HadoopReadStep clone() {
-        return (HadoopReadStep) super.clone();
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
deleted file mode 100644
index 2bb8e67..0000000
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
+++ /dev/null
@@ -1,82 +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.hadoop.process.computer.traversal.step.map;
-
-import org.apache.tinkerpop.gremlin.hadoop.Constants;
-import org.apache.tinkerpop.gremlin.process.computer.GraphFilter;
-import org.apache.tinkerpop.gremlin.process.computer.Memory;
-import org.apache.tinkerpop.gremlin.process.computer.clone.CloneVertexProgram;
-import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.VertexProgramStep;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
-import org.apache.tinkerpop.gremlin.structure.Graph;
-import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
-
-/**
- * @author Stephen Mallette (http://stephen.genoprime.com)
- */
-public class HadoopWriteStep extends VertexProgramStep implements Reading {
-
-    private Parameters parameters = new Parameters();
-
-    public HadoopWriteStep(final Traversal.Admin traversal, final String localFile) {
-        super(traversal);
-
-        final Graph graph = (Graph) traversal.getGraph().get();
-        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_GRAPH_WRITER, "org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat");
-        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION, localFile);
-    }
-
-    @Override
-    public String getFile() {
-        return (String) ((Graph) traversal.getGraph().get()).configuration().getProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION);
-    }
-
-    @Override
-    public void configure(final Object... keyValues) {
-        // TODO: probably should write to the Configuration selectively - no need for actual Parameters?????????
-        this.parameters.set(null, keyValues);
-    }
-
-    @Override
-    public Parameters getParameters() {
-        return parameters;
-    }
-
-    @Override
-    public String toString() {
-        return StringFactory.stepString(this, new GraphFilter(this.computer));
-    }
-
-    @Override
-    public CloneVertexProgram generateProgram(final Graph graph, final Memory memory) {
-        return CloneVertexProgram.build().create(graph);
-    }
-
-    @Override
-    public HadoopWriteStep clone() {
-        return (HadoopWriteStep) super.clone();
-    }
-
-    @Override
-    public int hashCode() {
-        return super.hashCode();
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
index 7e0e23c..1805df8 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
@@ -19,14 +19,13 @@
 
 package org.apache.tinkerpop.gremlin.hadoop.process.computer.traversal.strategy;
 
-import org.apache.tinkerpop.gremlin.hadoop.process.computer.traversal.step.map.HadoopReadStep;
-import org.apache.tinkerpop.gremlin.hadoop.process.computer.traversal.step.map.HadoopWriteStep;
+import org.apache.tinkerpop.gremlin.hadoop.process.computer.traversal.step.map.HadoopIoStep;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Writing;
+import org.apache.tinkerpop.gremlin.process.traversal.step.ReadWriting;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.NoneStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.IoStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 
@@ -43,23 +42,16 @@ public final class HadoopIoStrategy extends AbstractTraversalStrategy<TraversalS
 
     @Override
     public void apply(final Traversal.Admin<?, ?> traversal) {
-        // replace Reading and Writing steps with hadoop specific ones
-        if (traversal.getStartStep() instanceof Reading) {
-            final Reading reading = (Reading) traversal.getStartStep();
-            final HadoopReadStep hadoopReadStep = new HadoopReadStep(traversal, reading.getFile());
-            reading.getParameters().getRaw().entrySet().forEach(kv ->
-                hadoopReadStep.configure(null, kv.getKey(), kv.getValue())
+        // replace IoStep steps with hadoop specific one
+        if (traversal.getStartStep() instanceof IoStep) {
+            final ReadWriting readWriting = (ReadWriting) traversal.getStartStep();
+            final HadoopIoStep hadoopIoStep = new HadoopIoStep(traversal, readWriting.getFile());
+            hadoopIoStep.setMode(readWriting.getMode());
+            readWriting.getParameters().getRaw().entrySet().forEach(kv ->
+                    hadoopIoStep.configure(null, kv.getKey(), kv.getValue())
             );
 
-            TraversalHelper.replaceStep((Step) reading, hadoopReadStep, traversal);
-        } else if (traversal.getStartStep() instanceof Writing) {
-            final Writing writing = (Writing) traversal.getStartStep();
-            final HadoopWriteStep hadoopWriteStep = new HadoopWriteStep(traversal, writing.getFile());
-            writing.getParameters().getRaw().entrySet().forEach(kv ->
-                hadoopWriteStep.configure(null, kv.getKey(), kv.getValue())
-            );
-
-            TraversalHelper.replaceStep((Step) writing, hadoopWriteStep, traversal);
+            TraversalHelper.replaceStep((Step) readWriting, hadoopIoStep, traversal);
         }
 
         if (traversal.getEndStep() instanceof NoneStep)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2e6c1708/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
index 82bf2d7..69062ef 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
@@ -340,7 +340,7 @@ public class TinkerGraphPlayTest {
     public void testBlah() {
         TinkerGraph graph = TinkerGraph.open();
         GraphTraversalSource g = graph.traversal();
-        g.read("../data/tinkerpop-modern.kryo");
+        g.io("../data/tinkerpop-modern.kryo").read();
 
         IoTest.assertModernGraph(graph, true, false);
     }


[19/26] tinkerpop git commit: TINKERPOP-1996 Have the basics of OLAP read()/write() steps working

Posted by sp...@apache.org.
TINKERPOP-1996 Have the basics of OLAP read()/write() steps working

This is still fairly skeletal at this point. Just trying to make sure things work properly before building read()/write() out fully.


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

Branch: refs/heads/TINKERPOP-1996
Commit: 23815ec2878f84cf86aa3408d4414ca4aa2065ca
Parents: 3641e91
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jul 10 12:21:52 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:59:38 2018 -0400

----------------------------------------------------------------------
 .../decoration/VertexProgramStrategy.java       | 34 ++++----
 .../process/traversal/TraversalStrategies.java  |  2 +
 .../gremlin/process/traversal/step/Reading.java | 27 +++++++
 .../gremlin/process/traversal/step/Writing.java | 26 +++++++
 .../process/traversal/step/map/ReadStep.java    | 10 ++-
 .../process/traversal/step/map/WriteStep.java   |  8 +-
 .../strategy/verification/IoUsageStrategy.java  |  8 ++
 .../decoration/VertexProgramStrategyTest.java   |  3 +
 .../gremlin/process/ProcessStandardSuite.java   |  2 +
 .../process/traversal/step/map/ReadTest.java    | 64 +++++++++++++++
 .../traversal/step/map/HadoopReadStep.java      | 82 ++++++++++++++++++++
 .../traversal/step/map/HadoopWriteStep.java     | 82 ++++++++++++++++++++
 .../traversal/strategy/HadoopIoStrategy.java    | 68 ++++++++++++++++
 .../gremlin/hadoop/structure/HadoopGraph.java   |  8 ++
 14 files changed, 407 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/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 89e40cb..c83039a 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
@@ -34,6 +34,8 @@ 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.__;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Writing;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
@@ -100,23 +102,26 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
 
         // wrap all non-VertexComputing steps into a TraversalVertexProgramStep
         currentStep = traversal.getStartStep();
-        while (!(currentStep instanceof EmptyStep)) {
-            Traversal.Admin<?, ?> computerTraversal = new DefaultTraversal<>();
-            Step<?, ?> firstLegalOLAPStep = getFirstLegalOLAPStep(currentStep);
-            Step<?, ?> lastLegalOLAPStep = getLastLegalOLAPStep(currentStep);
-            if (!(firstLegalOLAPStep instanceof EmptyStep)) {
-                int index = TraversalHelper.stepIndex(firstLegalOLAPStep, traversal);
-                TraversalHelper.removeToTraversal(firstLegalOLAPStep, lastLegalOLAPStep.getNextStep(), (Traversal.Admin) computerTraversal);
-                final TraversalVertexProgramStep traversalVertexProgramStep = new TraversalVertexProgramStep(traversal, computerTraversal);
-                traversal.addStep(index, traversalVertexProgramStep);
-            }
-            currentStep = traversal.getStartStep();
+        if (!(currentStep instanceof Reading) && !(currentStep instanceof Writing)) {
             while (!(currentStep instanceof EmptyStep)) {
-                if (!(currentStep instanceof VertexComputing))
-                    break;
-                currentStep = currentStep.getNextStep();
+                final Traversal.Admin<?, ?> computerTraversal = new DefaultTraversal<>();
+                final Step<?, ?> firstLegalOLAPStep = getFirstLegalOLAPStep(currentStep);
+                final Step<?, ?> lastLegalOLAPStep = getLastLegalOLAPStep(currentStep);
+                if (!(firstLegalOLAPStep instanceof EmptyStep)) {
+                    final int index = TraversalHelper.stepIndex(firstLegalOLAPStep, traversal);
+                    TraversalHelper.removeToTraversal(firstLegalOLAPStep, lastLegalOLAPStep.getNextStep(), (Traversal.Admin) computerTraversal);
+                    final TraversalVertexProgramStep traversalVertexProgramStep = new TraversalVertexProgramStep(traversal, computerTraversal);
+                    traversal.addStep(index, traversalVertexProgramStep);
+                }
+                currentStep = traversal.getStartStep();
+                while (!(currentStep instanceof EmptyStep)) {
+                    if (!(currentStep instanceof VertexComputing))
+                        break;
+                    currentStep = currentStep.getNextStep();
+                }
             }
         }
+
         // if the last vertex computing step is a TraversalVertexProgramStep convert to OLTP with ComputerResultStep
         TraversalHelper.getLastStepOfAssignableClass(VertexComputing.class, traversal).ifPresent(step -> {
             if (step instanceof TraversalVertexProgramStep) {
@@ -126,6 +131,7 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
                 TraversalHelper.insertAfterStep(computerResultStep, (Step) step, traversal);
             }
         });
+        
         // if there is a dangling vertex computing step, add an identity traversal (solve this in the future with a specialized MapReduce)
         if (traversal.getEndStep() instanceof VertexComputing && !(traversal.getEndStep() instanceof TraversalVertexProgramStep)) {
             final TraversalVertexProgramStep traversalVertexProgramStep = new TraversalVertexProgramStep(traversal, __.identity().asAdmin());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index ef3e841..66b0236 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -36,6 +36,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.Path
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.CountStrategy;
 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.IoUsageStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.StandardVerificationStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -222,6 +223,7 @@ public interface TraversalStrategies extends Serializable, Cloneable {
                     PathRetractionStrategy.instance(),
                     LazyBarrierStrategy.instance(),
                     ProfileStrategy.instance(),
+                    IoUsageStrategy.instance(),
                     StandardVerificationStrategy.instance());
             GRAPH_CACHE.put(Graph.class, graphStrategies);
             GRAPH_CACHE.put(EmptyGraph.class, new DefaultTraversalStrategies());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
new file mode 100644
index 0000000..b79378b
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
@@ -0,0 +1,27 @@
+/*
+ * 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.step;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface Reading extends Configuring {
+
+    public String getLocalFile();
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
new file mode 100644
index 0000000..7b455f2
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
@@ -0,0 +1,26 @@
+/*
+ * 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.step;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface Writing extends Configuring {
+    public String getLocalFile();
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
index afc3e53..2612d18 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
@@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
@@ -43,7 +44,7 @@ import java.util.Map;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object>> implements Configuring {
+public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object>> implements Reading {
 
     private Parameters parameters = new Parameters();
     private boolean first = true;
@@ -54,12 +55,16 @@ public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object
 
         if (null == localFile || localFile.isEmpty())
             throw new IllegalArgumentException("localFile cannot be null or empty");
-        if (!new File(localFile).exists()) throw new IllegalStateException(localFile + " does not exist");
 
         this.localFile = localFile;
     }
 
     @Override
+    public String getLocalFile() {
+        return localFile;
+    }
+
+    @Override
     public Parameters getParameters() {
         return this.parameters;
     }
@@ -76,6 +81,7 @@ public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object
         this.first = false;
         final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
         final File file = new File(localFile);
+        if (!file.exists()) throw new IllegalStateException(localFile + " does not exist");
 
         try (final InputStream stream = new FileInputStream(file)) {
             final Graph graph = (Graph) this.traversal.getGraph().get();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
index e9346cf..3a035e7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
@@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Writing;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
@@ -43,7 +44,7 @@ import java.util.Map;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class WriteStep extends AbstractStep<Map<String,Object>, Map<String,Object>> implements Configuring {
+public class WriteStep extends AbstractStep<Map<String,Object>, Map<String,Object>> implements Writing {
 
     private Parameters parameters = new Parameters();
     private boolean first = true;
@@ -59,6 +60,11 @@ public class WriteStep extends AbstractStep<Map<String,Object>, Map<String,Objec
     }
 
     @Override
+    public String getLocalFile() {
+        return localFile;
+    }
+
+    @Override
     public Parameters getParameters() {
         return this.parameters;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
index 95761ff..e9c7ec8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
@@ -26,6 +26,9 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 
+import java.util.Collections;
+import java.util.Set;
+
 /**
  * {@code IoUsageStrategy} prevents the {@link GraphTraversalSource#read(String)} and
  * {@link GraphTraversalSource#write(String)} steps from being used outside of their intended scope, which is as the
@@ -57,4 +60,9 @@ public final class IoUsageStrategy extends AbstractTraversalStrategy<TraversalSt
     public static IoUsageStrategy instance() {
         return INSTANCE;
     }
+
+    @Override
+    public Set<Class<? extends VerificationStrategy>> applyPrior() {
+        return Collections.singleton(ComputerVerificationStrategy.class);
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
index c091bb3..71cb22d 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/VertexProgramStrategyTest.java
@@ -32,6 +32,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ComputerVerificationStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.util.EmptyTraversal;
+import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -68,6 +69,8 @@ public class VertexProgramStrategyTest {
         final ComputerResultStep computerResultStep = new ComputerResultStep(EmptyTraversal.instance());
 
         return Arrays.asList(new Traversal[][]{
+                { EmptyGraph.instance().traversal().read("blah.json"), EmptyGraph.instance().traversal().read("blah.json")},
+                { EmptyGraph.instance().traversal().write("blah.json"), EmptyGraph.instance().traversal().write("blah.json")},
                 {__.V().out().count(), start().addStep(traversal(__.V().out().count())).addStep(computerResultStep)},
                 {__.V().pageRank().out().count(), start().pageRank().asAdmin().addStep(traversal(__.V().out().count())).addStep(computerResultStep)},
                 {__.V().out().pageRank(), start().addStep(traversal(__.V().out())).pageRank().asAdmin().addStep(traversal(__.identity())).addStep(computerResultStep)},

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
index f7c19ac..43da8b7 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/ProcessStandardSuite.java
@@ -63,6 +63,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.map.PathTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProfileTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ProjectTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.PropertiesTest;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.SelectTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.SumTest;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.UnfoldTest;
@@ -153,6 +154,7 @@ public class ProcessStandardSuite extends AbstractGremlinSuite {
             ProfileTest.Traversals.class,
             ProjectTest.Traversals.class,
             PropertiesTest.Traversals.class,
+            ReadTest.Traversals.class,
             SelectTest.Traversals.class,
             VertexTest.Traversals.class,
             UnfoldTest.Traversals.class,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
new file mode 100644
index 0000000..2cfc3f7
--- /dev/null
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.step.map;
+
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
+import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
+import org.apache.tinkerpop.gremlin.process.IgnoreEngine;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.io.IoTest;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoResourceAccess;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+@RunWith(GremlinProcessRunner.class)
+public abstract class ReadTest extends AbstractGremlinProcessTest {
+
+    public abstract Traversal<Map<String,Object>, Map<String,Object>> get_g_read()  throws IOException;
+
+    @Test
+    public void g_read() throws IOException {
+        final Traversal<Map<String,Object>, Map<String,Object>> traversal = get_g_read();
+        printTraversalForm(traversal);
+        assertTrue(traversal.hasNext());
+
+        IoTest.assertModernGraph(graph, false, true);
+    }
+
+    public static class Traversals extends ReadTest {
+        @Override
+        public Traversal<Map<String,Object>, Map<String,Object>> get_g_read() throws IOException {
+            final String fileToRead = TestHelper.generateTempFileFromResource(ReadTest.class, GryoResourceAccess.class, "tinkerpop-modern-v3d0.kryo", "").getAbsolutePath().replace('\\', '/');
+            return g.read(fileToRead);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
new file mode 100644
index 0000000..c896d76
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
@@ -0,0 +1,82 @@
+/*
+ * 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.hadoop.process.computer.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.hadoop.Constants;
+import org.apache.tinkerpop.gremlin.process.computer.GraphFilter;
+import org.apache.tinkerpop.gremlin.process.computer.Memory;
+import org.apache.tinkerpop.gremlin.process.computer.clone.CloneVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.VertexProgramStep;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class HadoopReadStep extends VertexProgramStep implements Reading {
+
+    private Parameters parameters = new Parameters();
+
+    public HadoopReadStep(final Traversal.Admin traversal, final String localFile) {
+        super(traversal);
+
+        final Graph graph = (Graph) traversal.getGraph().get();
+        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_GRAPH_READER, "org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat");
+        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION, localFile);
+    }
+
+    @Override
+    public String getLocalFile() {
+        return (String) ((Graph) traversal.getGraph().get()).configuration().getProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION);
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        // TODO: probably should write to the Configuration selectively - no need for actual Parameters?????????
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
+    public Parameters getParameters() {
+        return parameters;
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.stepString(this, new GraphFilter(this.computer));
+    }
+
+    @Override
+    public CloneVertexProgram generateProgram(final Graph graph, final Memory memory) {
+        return CloneVertexProgram.build().create(graph);
+    }
+
+    @Override
+    public HadoopReadStep clone() {
+        return (HadoopReadStep) super.clone();
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
new file mode 100644
index 0000000..0711a2e
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
@@ -0,0 +1,82 @@
+/*
+ * 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.hadoop.process.computer.traversal.step.map;
+
+import org.apache.tinkerpop.gremlin.hadoop.Constants;
+import org.apache.tinkerpop.gremlin.process.computer.GraphFilter;
+import org.apache.tinkerpop.gremlin.process.computer.Memory;
+import org.apache.tinkerpop.gremlin.process.computer.clone.CloneVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.VertexProgramStep;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class HadoopWriteStep extends VertexProgramStep implements Reading {
+
+    private Parameters parameters = new Parameters();
+
+    public HadoopWriteStep(final Traversal.Admin traversal, final String localFile) {
+        super(traversal);
+
+        final Graph graph = (Graph) traversal.getGraph().get();
+        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_GRAPH_WRITER, "org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat");
+        graph.configuration().setProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION, localFile);
+    }
+
+    @Override
+    public String getLocalFile() {
+        return (String) ((Graph) traversal.getGraph().get()).configuration().getProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION);
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        // TODO: probably should write to the Configuration selectively - no need for actual Parameters?????????
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
+    public Parameters getParameters() {
+        return parameters;
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.stepString(this, new GraphFilter(this.computer));
+    }
+
+    @Override
+    public CloneVertexProgram generateProgram(final Graph graph, final Memory memory) {
+        return CloneVertexProgram.build().create(graph);
+    }
+
+    @Override
+    public HadoopWriteStep clone() {
+        return (HadoopWriteStep) super.clone();
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
new file mode 100644
index 0000000..47986f9
--- /dev/null
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
@@ -0,0 +1,68 @@
+/*
+ *  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.hadoop.process.computer.traversal.strategy;
+
+import org.apache.tinkerpop.gremlin.hadoop.process.computer.traversal.step.map.HadoopReadStep;
+import org.apache.tinkerpop.gremlin.hadoop.process.computer.traversal.step.map.HadoopWriteStep;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Writing;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public final class HadoopIoStrategy extends AbstractTraversalStrategy<TraversalStrategy.ProviderOptimizationStrategy>
+        implements TraversalStrategy.ProviderOptimizationStrategy {
+
+    private static final HadoopIoStrategy INSTANCE = new HadoopIoStrategy();
+
+    private HadoopIoStrategy() {
+    }
+
+    @Override
+    public void apply(final Traversal.Admin<?, ?> traversal) {
+        // replace Reading and Writing steps with hadoop specific ones
+        if (traversal.getStartStep() instanceof Reading) {
+            final Reading reading = (Reading) traversal.getStartStep();
+            final HadoopReadStep hadoopReadStep = new HadoopReadStep(traversal, reading.getLocalFile());
+            reading.getParameters().getRaw().entrySet().forEach(kv ->
+                hadoopReadStep.configure(null, kv.getKey(), kv.getValue())
+            );
+
+            TraversalHelper.replaceStep((Step) reading, hadoopReadStep, traversal);
+        } else if (traversal.getStartStep() instanceof Writing) {
+            final Writing writing = (Writing) traversal.getStartStep();
+            final HadoopWriteStep hadoopWriteStep = new HadoopWriteStep(traversal, writing.getLocalFile());
+            writing.getParameters().getRaw().entrySet().forEach(kv ->
+                hadoopWriteStep.configure(null, kv.getKey(), kv.getValue())
+            );
+
+            TraversalHelper.replaceStep((Step) writing, hadoopWriteStep, traversal);
+        }
+    }
+
+    public static HadoopIoStrategy instance() {
+        return INSTANCE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/23815ec2/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
index ea8334b..14c5360 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
@@ -24,9 +24,11 @@ import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.tinkerpop.gremlin.hadoop.Constants;
 import org.apache.tinkerpop.gremlin.hadoop.process.computer.AbstractHadoopGraphComputer;
+import org.apache.tinkerpop.gremlin.hadoop.process.computer.traversal.strategy.HadoopIoStrategy;
 import org.apache.tinkerpop.gremlin.hadoop.structure.io.HadoopEdgeIterator;
 import org.apache.tinkerpop.gremlin.hadoop.structure.io.HadoopVertexIterator;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Transaction;
@@ -148,6 +150,12 @@ public final class HadoopGraph implements Graph {
         this.setProperty(Graph.GRAPH, HadoopGraph.class.getName());
     }};
 
+    static {
+        TraversalStrategies.GlobalCache.registerStrategies(HadoopGraph.class,
+                TraversalStrategies.GlobalCache.getStrategies(Graph.class).clone().addStrategies(
+                        HadoopIoStrategy.instance()));
+    }
+
     protected final HadoopConfiguration configuration;
 
     private HadoopGraph(final Configuration configuration) {


[21/26] tinkerpop git commit: TINKERPOP-1996 read()/write() api changes for return type

Posted by sp...@apache.org.
TINKERPOP-1996 read()/write() api changes for return type

No more weird Map status return for read() and write(). Both just work like a terminator and self iterate to return nothing.


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

Branch: refs/heads/TINKERPOP-1996
Commit: f02daaf55cf847f1d47080653857e824eb804feb
Parents: 585980b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jul 10 14:53:52 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:59:38 2018 -0400

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversalSource.java | 18 ++++++++++--------
 .../process/traversal/step/map/ReadStep.java      | 12 ++++--------
 .../process/traversal/step/map/WriteStep.java     | 13 ++++---------
 .../strategy/verification/IoUsageStrategy.java    | 10 ++++++++--
 .../Process/Traversal/GraphTraversalSource.cs     | 12 ++++++------
 .../traversal/strategy/HadoopIoStrategy.java      |  4 ++++
 .../structure/TinkerGraphPlayTest.java            | 10 ++++++++++
 7 files changed, 46 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f02daaf5/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 9b82108..49e012f 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
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.strategy.decoration.RemoteStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+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;
@@ -43,6 +44,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 import java.util.Map;
+import java.util.NoSuchElementException;
 import java.util.Optional;
 import java.util.function.BinaryOperator;
 import java.util.function.Supplier;
@@ -393,18 +395,18 @@ public class GraphTraversalSource implements TraversalSource {
         return traversal.addStep(new GraphStep<>(traversal, Edge.class, true, edgesIds));
     }
 
-    public GraphTraversal<Map<String,Object>, Map<String,Object>> read(final String localFile) {
+    public <S> GraphTraversal<S, S> read(final String file) {
         final GraphTraversalSource clone = this.clone();
-        clone.bytecode.addStep(GraphTraversal.Symbols.read, localFile);
-        final GraphTraversal.Admin<Map<String,Object>, Map<String,Object>> traversal = new DefaultGraphTraversal<>(clone);
-        return traversal.addStep(new ReadStep(traversal, localFile));
+        clone.bytecode.addStep(GraphTraversal.Symbols.read, file);
+        final GraphTraversal.Admin<S,S> traversal = new DefaultGraphTraversal<>(clone);
+        return traversal.addStep(new ReadStep<S>(traversal, file)).iterate();
     }
 
-    public GraphTraversal<Map<String,Object>, Map<String,Object>> write(final String localFile) {
+    public <S> GraphTraversal<S, S> write(final String file) {
         final GraphTraversalSource clone = this.clone();
-        clone.bytecode.addStep(GraphTraversal.Symbols.write, localFile);
-        final GraphTraversal.Admin<Map<String,Object>, Map<String,Object>> traversal = new DefaultGraphTraversal<>(clone);
-        return traversal.addStep(new WriteStep(traversal, localFile));
+        clone.bytecode.addStep(GraphTraversal.Symbols.write, file);
+        final GraphTraversal.Admin<S,S> traversal = new DefaultGraphTraversal<>(clone);
+        return traversal.addStep(new WriteStep<S>(traversal, file)).iterate();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f02daaf5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
index 7c71ab5..99f7e66 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
@@ -43,7 +44,7 @@ import java.util.Map;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object>> implements Reading {
+public class ReadStep<S> extends AbstractStep<S,S> implements Reading {
 
     private Parameters parameters = new Parameters();
     private boolean first = true;
@@ -74,11 +75,10 @@ public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object
     }
 
     @Override
-    protected Traverser.Admin<Map<String,Object>> processNextStart() {
+    protected Traverser.Admin<S> processNextStart() {
         if (!this.first) throw FastNoSuchElementException.instance();
 
         this.first = false;
-        final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
         final File file = new File(this.file);
         if (!file.exists()) throw new IllegalStateException(this.file + " does not exist");
 
@@ -86,11 +86,7 @@ public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object
             final Graph graph = (Graph) this.traversal.getGraph().get();
             GryoReader.build().create().readGraph(stream, graph);
 
-            final Map<String,Object> stats = new LinkedHashMap<>();
-            stats.put("vertices", IteratorUtils.count(graph.vertices()));
-            stats.put("edges", IteratorUtils.count(graph.edges()));
-
-            return generator.generate(stats, this, 1L);
+            return EmptyTraverser.instance();
         } catch (IOException ioe) {
             throw new IllegalStateException(String.format("Could not read file %s into graph", this.file), ioe);
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f02daaf5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
index d27cd24..20ffec9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Writing;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.EmptyTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
@@ -43,7 +44,7 @@ import java.util.Map;
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public class WriteStep extends AbstractStep<Map<String,Object>, Map<String,Object>> implements Writing {
+public class WriteStep<S> extends AbstractStep<S,S> implements Writing {
 
     private Parameters parameters = new Parameters();
     private boolean first = true;
@@ -74,22 +75,16 @@ public class WriteStep extends AbstractStep<Map<String,Object>, Map<String,Objec
     }
 
     @Override
-    protected Traverser.Admin<Map<String,Object>> processNextStart() {
+    protected Traverser.Admin<S> processNextStart() {
         if (!this.first) throw FastNoSuchElementException.instance();
 
         this.first = false;
-        final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
-
         final File file = new File(this.file);
         try (final OutputStream stream = new FileOutputStream(file)) {
             final Graph graph = (Graph) this.traversal.getGraph().get();
             GryoWriter.build().create().writeGraph(stream, graph);
 
-            final Map<String, Object> stats = new LinkedHashMap<>();
-            stats.put("vertices", IteratorUtils.count(graph.vertices()));
-            stats.put("edges", IteratorUtils.count(graph.edges()));
-
-            return generator.generate(stats, this, 1L);
+            return EmptyTraverser.instance();
         } catch (IOException ioe) {
             throw new IllegalStateException(String.format("Could not write file %s from graph", this.file), ioe);
         }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f02daaf5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
index e9c7ec8..b4a0669 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
@@ -18,10 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.verification;
 
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 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.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.NoneStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
@@ -52,8 +54,12 @@ public final class IoUsageStrategy extends AbstractTraversalStrategy<TraversalSt
 
     @Override
     public void apply(final Traversal.Admin<?, ?> traversal) {
-        if ((traversal.getStartStep() instanceof ReadStep || traversal.getStartStep() instanceof WriteStep) && traversal.getSteps().size() > 1) {
-            throw new VerificationException("The read() or write() steps must be the first and only step in the traversal - they cannot be used with other steps", traversal);
+        final Step start = traversal.getStartStep();
+        final Step end = traversal.getEndStep();
+        if ((start instanceof ReadStep || start instanceof WriteStep) && end != start) {
+            if ((end instanceof NoneStep && traversal.getSteps().size() > 2)) {
+                throw new VerificationException("The read() or write() steps must be the first and only step in the traversal - they cannot be used with other steps", traversal);
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f02daaf5/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
index 630ac28..4292850 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
@@ -337,10 +337,10 @@ namespace Gremlin.Net.Process.Traversal
         ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the read step to that
         ///     traversal.
         /// </summary>
-        public GraphTraversal<IDictionary<string, object>, IDictionary<string, object>> Read(string localFile)
+        public GraphTraversal<S, S> Read<S>(string file)
         {
-            var traversal = new GraphTraversal<IDictionary<string, object>, IDictionary<string, object>>(TraversalStrategies, new Bytecode(Bytecode));
-                traversal.Bytecode.AddStep("read", localFile);
+            var traversal = new GraphTraversal<S, S>(TraversalStrategies, new Bytecode(Bytecode));
+                traversal.Bytecode.AddStep("read", file);
             return traversal;
         }
 
@@ -348,10 +348,10 @@ namespace Gremlin.Net.Process.Traversal
         ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the write step to that
         ///     traversal.
         /// </summary>
-        public GraphTraversal<IDictionary<string, object>, IDictionary<string, object>> Write(string localFile)
+        public GraphTraversal<S, S> Write<S>(string file)
         {
-            var traversal = new GraphTraversal<IDictionary<string, object>, IDictionary<string, object>>(TraversalStrategies, new Bytecode(Bytecode));
-                traversal.Bytecode.AddStep("write", localFile);
+            var traversal = new GraphTraversal<S, S>(TraversalStrategies, new Bytecode(Bytecode));
+                traversal.Bytecode.AddStep("write", file);
             return traversal;
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f02daaf5/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
index d8d8bab..7e0e23c 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Writing;
+import org.apache.tinkerpop.gremlin.process.traversal.step.filter.NoneStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 
@@ -60,6 +61,9 @@ public final class HadoopIoStrategy extends AbstractTraversalStrategy<TraversalS
 
             TraversalHelper.replaceStep((Step) writing, hadoopWriteStep, traversal);
         }
+
+        if (traversal.getEndStep() instanceof NoneStep)
+            traversal.removeStep(1);
     }
 
     public static HadoopIoStrategy instance() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f02daaf5/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
index e0018fc..82bf2d7 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
@@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSo
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.PathRetractionStrategy;
 import org.apache.tinkerpop.gremlin.structure.*;
+import org.apache.tinkerpop.gremlin.structure.io.IoTest;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
 import org.apache.tinkerpop.gremlin.util.TimeUtil;
 import org.junit.Ignore;
@@ -334,4 +335,13 @@ public class TinkerGraphPlayTest {
         System.out.println(g.V().as("a").both().as("b").dedup("a", "b").by(T.label).select("a", "b").toList());
 
     }
+
+    @Test
+    public void testBlah() {
+        TinkerGraph graph = TinkerGraph.open();
+        GraphTraversalSource g = graph.traversal();
+        g.read("../data/tinkerpop-modern.kryo");
+
+        IoTest.assertModernGraph(graph, true, false);
+    }
 }


[12/26] tinkerpop git commit: Include JavaScript GLV DriverRemoteConnection close() fix in CHANGELOG

Posted by sp...@apache.org.
Include JavaScript GLV DriverRemoteConnection close() fix in CHANGELOG


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

Branch: refs/heads/TINKERPOP-1996
Commit: b0c836b4e6d13bb973ce84588683d68bb36f92dc
Parents: 59d2f10
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Jul 12 11:52:41 2018 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Jul 12 11:52:41 2018 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b0c836b4/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 1d05615..ee49c09 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -38,6 +38,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Fixed bug in `GroovyTranslator` that didn't properly handle empty `Map` objects.
 * Added concrete configuration methods to `SparkGraphComputer` to make a more clear API for configuring it.
 * Fixed a bug in `TinkerGraphCountStrategy`, which didn't consider that certain map steps may not emit an element.
+* Fixed a bug in JavaScript GLV where DriverRemoteConnection close() method didn't returned a Promise instance.
 
 [[release-3-2-9]]
 === TinkerPop 3.2.9 (Release Date: May 8, 2018)


[23/26] tinkerpop git commit: TINKERPOP-1996 Added some javadoc and code formatting

Posted by sp...@apache.org.
TINKERPOP-1996 Added some javadoc and code formatting


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

Branch: refs/heads/TINKERPOP-1996
Commit: 1fd43c6a941c426c34273ab3122a8852b75f84b3
Parents: 2e6c170
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jul 11 10:36:11 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:59:39 2018 -0400

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversalSource.java     | 14 ++++++++++++++
 .../gremlin/process/traversal/step/ReadWriting.java   |  8 ++++++++
 .../gremlin/process/traversal/step/map/IoStep.java    |  2 ++
 .../computer/traversal/step/map/HadoopIoStep.java     |  4 ++++
 .../computer/traversal/strategy/HadoopIoStrategy.java |  7 +++++++
 .../tinkergraph/structure/TinkerGraphPlayTest.java    |  2 --
 6 files changed, 35 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1fd43c6a/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 aa4995d..7357418 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
@@ -391,6 +391,20 @@ public class GraphTraversalSource implements TraversalSource {
         return traversal.addStep(new GraphStep<>(traversal, Edge.class, true, edgesIds));
     }
 
+    /**
+     * Performs a read or write based operation on the {@link Graph} backing this {@code GraphTraversalSource}. This
+     * step can be accompanied by the {@link GraphTraversal#with(String, Object)} modulator for further configuration
+     * and must be accompanied by a {@link GraphTraversal#read()} or {@link GraphTraversal#write()} modulator step
+     * which will terminate the traversal.
+     *
+     * @param file the name of file for which the read or write will apply - note that the context of how this
+     *             parameter is used is wholly dependent on the implementation
+     * @return the traversal with the {@link IoStep} added
+     * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#io-step" target="_blank">Reference Documentation - IO Step</a>
+     * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#read-step" target="_blank">Reference Documentation - Read Step</a>
+     * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#write-step" target="_blank">Reference Documentation - Write Step</a>
+     * @since 3.4.0
+     */
     public <S> GraphTraversal<S, S> io(final String file) {
         final GraphTraversalSource clone = this.clone();
         clone.bytecode.addStep(GraphTraversal.Symbols.io, file);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1fd43c6a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ReadWriting.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ReadWriting.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ReadWriting.java
index 18de925..d0e8bbf 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ReadWriting.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/ReadWriting.java
@@ -18,11 +18,19 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step;
 
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+
 /**
+ * An interface that defines a {@link Step} as one that handles IO based operations for a {@link Graph}.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface ReadWriting extends Configuring {
 
+    /**
+     * Determines the mode of the the IO operation as being for reading or writing (or by default "unset")
+     */
     public enum Mode {
         UNSET,
         READING,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1fd43c6a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
index 8d22427..b633360 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/IoStep.java
@@ -38,6 +38,8 @@ import java.io.InputStream;
 import java.io.OutputStream;
 
 /**
+ * Handles read and write operations into the {@link Graph}.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class IoStep<S> extends AbstractStep<S,S> implements ReadWriting {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1fd43c6a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopIoStep.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopIoStep.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopIoStep.java
index 83a95e0..62937da 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopIoStep.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopIoStep.java
@@ -24,12 +24,16 @@ import org.apache.tinkerpop.gremlin.process.computer.Memory;
 import org.apache.tinkerpop.gremlin.process.computer.clone.CloneVertexProgram;
 import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.VertexProgramStep;
 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.step.ReadWriting;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
 /**
+ * An OLAP oriented step for doing IO operations with {@link GraphTraversalSource#io(String)} which uses the
+ * {@link CloneVertexProgram} for its implementation.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class HadoopIoStep extends VertexProgramStep implements ReadWriting {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1fd43c6a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
index 1805df8..38d5a7f 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
@@ -20,6 +20,8 @@
 package org.apache.tinkerpop.gremlin.hadoop.process.computer.traversal.strategy;
 
 import org.apache.tinkerpop.gremlin.hadoop.process.computer.traversal.step.map.HadoopIoStep;
+import org.apache.tinkerpop.gremlin.process.computer.clone.CloneVertexProgram;
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.VertexProgramStep;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -30,6 +32,11 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversal
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 
 /**
+ * The default implementation of the {@link IoStep} is a single threaded operation and doesn't properly take into
+ * account the method by which OLAP read/writes take place with Hadoop. This strategy removes that step and replaces
+ * it with the {@link HadoopIoStep} which is a {@link VertexProgramStep} that uses the {@link CloneVertexProgram} to
+ * execute the IO operation in an OLAP fashion.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class HadoopIoStrategy extends AbstractTraversalStrategy<TraversalStrategy.ProviderOptimizationStrategy>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1fd43c6a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
index 69062ef..598e434 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphPlayTest.java
@@ -20,9 +20,7 @@ package org.apache.tinkerpop.gremlin.tinkergraph.structure;
 
 import org.apache.tinkerpop.gremlin.process.computer.Computer;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-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.__;


[06/26] tinkerpop git commit: Added some javadoc CTR

Posted by sp...@apache.org.
Added some javadoc CTR


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

Branch: refs/heads/TINKERPOP-1996
Commit: 309957bc210eacc93114a261e3dbf1bb0db40231
Parents: 34a648b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sat Jun 30 06:24:23 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Sat Jun 30 06:24:23 2018 -0400

----------------------------------------------------------------------
 .../dsl/graph/GraphTraversalSource.java         | 84 +++++++++++++++++++-
 1 file changed, 83 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/309957bc/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 1b6a218..baba19c 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
@@ -122,11 +122,17 @@ public class GraphTraversalSource implements TraversalSource {
 
     //// CONFIGURATIONS
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public GraphTraversalSource withStrategies(final TraversalStrategy... traversalStrategies) {
         return (GraphTraversalSource) TraversalSource.super.withStrategies(traversalStrategies);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     @SuppressWarnings({"unchecked"})
     public GraphTraversalSource withoutStrategies(final Class<? extends TraversalStrategy>... traversalStrategyClasses) {
@@ -139,76 +145,121 @@ public class GraphTraversalSource implements TraversalSource {
         return (GraphTraversalSource) TraversalSource.super.withBindings(bindings);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public GraphTraversalSource withComputer(final Computer computer) {
         return (GraphTraversalSource) TraversalSource.super.withComputer(computer);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public GraphTraversalSource withComputer(final Class<? extends GraphComputer> graphComputerClass) {
         return (GraphTraversalSource) TraversalSource.super.withComputer(graphComputerClass);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public GraphTraversalSource withComputer() {
         return (GraphTraversalSource) TraversalSource.super.withComputer();
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSideEffect(final String key, final Supplier<A> initialValue, final BinaryOperator<A> reducer) {
         return (GraphTraversalSource) TraversalSource.super.withSideEffect(key, initialValue, reducer);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSideEffect(final String key, final A initialValue, final BinaryOperator<A> reducer) {
         return (GraphTraversalSource) TraversalSource.super.withSideEffect(key, initialValue, reducer);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSideEffect(final String key, final A initialValue) {
         return (GraphTraversalSource) TraversalSource.super.withSideEffect(key, initialValue);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSideEffect(final String key, final Supplier<A> initialValue) {
         return (GraphTraversalSource) TraversalSource.super.withSideEffect(key, initialValue);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSack(final Supplier<A> initialValue, final UnaryOperator<A> splitOperator, final BinaryOperator<A> mergeOperator) {
         return (GraphTraversalSource) TraversalSource.super.withSack(initialValue, splitOperator, mergeOperator);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSack(final A initialValue, final UnaryOperator<A> splitOperator, final BinaryOperator<A> mergeOperator) {
         return (GraphTraversalSource) TraversalSource.super.withSack(initialValue, splitOperator, mergeOperator);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSack(final A initialValue) {
         return (GraphTraversalSource) TraversalSource.super.withSack(initialValue);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSack(final Supplier<A> initialValue) {
         return (GraphTraversalSource) TraversalSource.super.withSack(initialValue);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSack(final Supplier<A> initialValue, final UnaryOperator<A> splitOperator) {
         return (GraphTraversalSource) TraversalSource.super.withSack(initialValue, splitOperator);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSack(final A initialValue, final UnaryOperator<A> splitOperator) {
         return (GraphTraversalSource) TraversalSource.super.withSack(initialValue, splitOperator);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSack(final Supplier<A> initialValue, final BinaryOperator<A> mergeOperator) {
         return (GraphTraversalSource) TraversalSource.super.withSack(initialValue, mergeOperator);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public <A> GraphTraversalSource withSack(final A initialValue, final BinaryOperator<A> mergeOperator) {
         return (GraphTraversalSource) TraversalSource.super.withSack(initialValue, mergeOperator);
@@ -230,16 +281,25 @@ public class GraphTraversalSource implements TraversalSource {
         return clone;
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public GraphTraversalSource withRemote(final Configuration conf) {
         return (GraphTraversalSource) TraversalSource.super.withRemote(conf);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public GraphTraversalSource withRemote(final String configFile) throws Exception {
         return (GraphTraversalSource) TraversalSource.super.withRemote(configFile);
     }
 
+    /**
+     * {@inheritDoc}
+     */
     @Override
     public GraphTraversalSource withRemote(final RemoteConnection connection) {
         try {
@@ -280,6 +340,9 @@ public class GraphTraversalSource implements TraversalSource {
         }
     }
 
+    /**
+     * Spawns a {@link GraphTraversal} by adding a vertex with the specified label.
+     */
     public GraphTraversal<Vertex, Vertex> addV(final String label) {
         final GraphTraversalSource clone = this.clone();
         clone.bytecode.addStep(GraphTraversal.Symbols.addV, label);
@@ -287,6 +350,9 @@ public class GraphTraversalSource implements TraversalSource {
         return traversal.addStep(new AddVertexStartStep(traversal, label));
     }
 
+    /**
+     * Spawns a {@link GraphTraversal} by adding a vertex with the default label.
+     */
     public GraphTraversal<Vertex, Vertex> addV() {
         final GraphTraversalSource clone = this.clone();
         clone.bytecode.addStep(GraphTraversal.Symbols.addV);
@@ -294,6 +360,9 @@ public class GraphTraversalSource implements TraversalSource {
         return traversal.addStep(new AddVertexStartStep(traversal, null));
     }
 
+    /**
+     * Spawns a {@link GraphTraversal} starting it with arbitrary values.
+     */
     public <S> GraphTraversal<S, S> inject(S... starts) {
         final GraphTraversalSource clone = this.clone();
         clone.bytecode.addStep(GraphTraversal.Symbols.inject, starts);
@@ -301,6 +370,10 @@ public class GraphTraversalSource implements TraversalSource {
         return traversal.addStep(new InjectStep<S>(traversal, starts));
     }
 
+    /**
+     * Spawns a {@link GraphTraversal} starting with all vertices or some subset of vertices as specified by their
+     * unique identifier.
+     */
     public GraphTraversal<Vertex, Vertex> V(final Object... vertexIds) {
         final GraphTraversalSource clone = this.clone();
         clone.bytecode.addStep(GraphTraversal.Symbols.V, vertexIds);
@@ -308,6 +381,10 @@ public class GraphTraversalSource implements TraversalSource {
         return traversal.addStep(new GraphStep<>(traversal, Vertex.class, true, vertexIds));
     }
 
+    /**
+     * Spawns a {@link GraphTraversal} starting with all edges or some subset of edges as specified by their unique
+     * identifier.
+     */
     public GraphTraversal<Edge, Edge> E(final Object... edgesIds) {
         final GraphTraversalSource clone = this.clone();
         clone.bytecode.addStep(GraphTraversal.Symbols.E, edgesIds);
@@ -315,11 +392,16 @@ public class GraphTraversalSource implements TraversalSource {
         return traversal.addStep(new GraphStep<>(traversal, Edge.class, true, edgesIds));
     }
 
-
+    /**
+     * Proxies calls through to the underlying {@link Graph#tx()}.
+     */
     public Transaction tx() {
         return this.graph.tx();
     }
 
+    /**
+     * If there is an underlying {@link RemoteConnection} it will be closed by this method.
+     */
     @Override
     public void close() throws Exception {
         if (connection != null) connection.close();


[13/26] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by sp...@apache.org.
Merge branch 'tp32' into tp33


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

Branch: refs/heads/TINKERPOP-1996
Commit: bf07f13b50ad9ac49d6815bebc5ab82ed4b2e8a7
Parents: 1f15781 b0c836b
Author: Jorge Bay Gondra <jo...@gmail.com>
Authored: Thu Jul 12 11:52:54 2018 +0200
Committer: Jorge Bay Gondra <jo...@gmail.com>
Committed: Thu Jul 12 11:52:54 2018 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../lib/driver/driver-remote-connection.js      | 20 ++++++++++----------
 2 files changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bf07f13b/CHANGELOG.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bf07f13b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
----------------------------------------------------------------------


[03/26] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by sp...@apache.org.
Merge branch 'tp32' into tp33


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

Branch: refs/heads/TINKERPOP-1996
Commit: 65ba04f19dd218f10dbf45ee169db7f688357721
Parents: ef888a1 34a648b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jun 29 15:21:42 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 29 15:21:42 2018 -0400

----------------------------------------------------------------------
 gremlin-dotnet/glv/generate.groovy | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/65ba04f1/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------


[20/26] tinkerpop git commit: TINKERPOP-1996 Minor refactoring of Reading/Writing and javadoc

Posted by sp...@apache.org.
TINKERPOP-1996 Minor refactoring of Reading/Writing and javadoc


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

Branch: refs/heads/TINKERPOP-1996
Commit: 585980bbb1c9e545c6bf0baf7bc2cfb9847901ec
Parents: 23815ec
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jul 10 12:55:06 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:59:38 2018 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/step/Reading.java |  7 ++++-
 .../gremlin/process/traversal/step/Writing.java |  8 +++++-
 .../process/traversal/step/map/ReadStep.java    | 27 ++++++++++----------
 .../process/traversal/step/map/WriteStep.java   | 25 +++++++++---------
 .../traversal/step/map/HadoopReadStep.java      |  2 +-
 .../traversal/step/map/HadoopWriteStep.java     |  2 +-
 .../traversal/strategy/HadoopIoStrategy.java    |  4 +--
 7 files changed, 42 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/585980bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
index b79378b..3f7c714 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Reading.java
@@ -19,9 +19,14 @@
 package org.apache.tinkerpop.gremlin.process.traversal.step;
 
 /**
+ * An interface for describing steps that will read a graph from some specified location.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface Reading extends Configuring {
 
-    public String getLocalFile();
+    /**
+     * Get the file location to read from.
+     */
+    public String getFile();
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/585980bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
index 7b455f2..fe56363 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Writing.java
@@ -19,8 +19,14 @@
 package org.apache.tinkerpop.gremlin.process.traversal.step;
 
 /**
+ * An interface for describing steps that will write a graph to some specified location.
+ *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface Writing extends Configuring {
-    public String getLocalFile();
+
+    /**
+     * Get the file location to write to.
+     */
+    public String getFile();
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/585980bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
index 2612d18..7c71ab5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
@@ -21,7 +21,6 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Reading;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
@@ -48,20 +47,20 @@ public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object
 
     private Parameters parameters = new Parameters();
     private boolean first = true;
-    private String localFile;
+    private String file;
 
-    public ReadStep(final Traversal.Admin traversal, final String localFile) {
+    public ReadStep(final Traversal.Admin traversal, final String file) {
         super(traversal);
 
-        if (null == localFile || localFile.isEmpty())
-            throw new IllegalArgumentException("localFile cannot be null or empty");
+        if (null == file || file.isEmpty())
+            throw new IllegalArgumentException("file cannot be null or empty");
 
-        this.localFile = localFile;
+        this.file = file;
     }
 
     @Override
-    public String getLocalFile() {
-        return localFile;
+    public String getFile() {
+        return file;
     }
 
     @Override
@@ -80,8 +79,8 @@ public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object
 
         this.first = false;
         final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
-        final File file = new File(localFile);
-        if (!file.exists()) throw new IllegalStateException(localFile + " does not exist");
+        final File file = new File(this.file);
+        if (!file.exists()) throw new IllegalStateException(this.file + " does not exist");
 
         try (final InputStream stream = new FileInputStream(file)) {
             final Graph graph = (Graph) this.traversal.getGraph().get();
@@ -93,26 +92,26 @@ public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object
 
             return generator.generate(stats, this, 1L);
         } catch (IOException ioe) {
-            throw new IllegalStateException(String.format("Could not read file %s into graph", localFile), ioe);
+            throw new IllegalStateException(String.format("Could not read file %s into graph", this.file), ioe);
         }
     }
 
     @Override
     public int hashCode() {
         final int hash = super.hashCode() ^ this.parameters.hashCode();
-        return (null != this.localFile) ? (hash ^ localFile.hashCode()) : hash;
+        return (null != this.file) ? (hash ^ file.hashCode()) : hash;
     }
 
     @Override
     public String toString() {
-        return StringFactory.stepString(this, localFile, this.parameters);
+        return StringFactory.stepString(this, file, this.parameters);
     }
 
     @Override
     public ReadStep clone() {
         final ReadStep clone = (ReadStep) super.clone();
         clone.parameters = this.parameters.clone();
-        clone.localFile = this.localFile;
+        clone.file = this.file;
         return clone;
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/585980bb/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
index 3a035e7..d27cd24 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
@@ -21,7 +21,6 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.map;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Writing;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
@@ -48,20 +47,20 @@ public class WriteStep extends AbstractStep<Map<String,Object>, Map<String,Objec
 
     private Parameters parameters = new Parameters();
     private boolean first = true;
-    private String localFile;
+    private String file;
 
-    public WriteStep(final Traversal.Admin traversal, final String localFile) {
+    public WriteStep(final Traversal.Admin traversal, final String file) {
         super(traversal);
 
-        if (null == localFile || localFile.isEmpty())
-            throw new IllegalArgumentException("localFile cannot be null or empty");
+        if (null == file || file.isEmpty())
+            throw new IllegalArgumentException("file cannot be null or empty");
 
-        this.localFile = localFile;
+        this.file = file;
     }
 
     @Override
-    public String getLocalFile() {
-        return localFile;
+    public String getFile() {
+        return file;
     }
 
     @Override
@@ -81,7 +80,7 @@ public class WriteStep extends AbstractStep<Map<String,Object>, Map<String,Objec
         this.first = false;
         final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
 
-        final File file = new File(localFile);
+        final File file = new File(this.file);
         try (final OutputStream stream = new FileOutputStream(file)) {
             final Graph graph = (Graph) this.traversal.getGraph().get();
             GryoWriter.build().create().writeGraph(stream, graph);
@@ -92,26 +91,26 @@ public class WriteStep extends AbstractStep<Map<String,Object>, Map<String,Objec
 
             return generator.generate(stats, this, 1L);
         } catch (IOException ioe) {
-            throw new IllegalStateException(String.format("Could not write file %s from graph", localFile), ioe);
+            throw new IllegalStateException(String.format("Could not write file %s from graph", this.file), ioe);
         }
     }
 
     @Override
     public int hashCode() {
         final int hash = super.hashCode() ^ this.parameters.hashCode();
-        return (null != this.localFile) ? (hash ^ localFile.hashCode()) : hash;
+        return (null != this.file) ? (hash ^ file.hashCode()) : hash;
     }
 
     @Override
     public String toString() {
-        return StringFactory.stepString(this, localFile, this.parameters);
+        return StringFactory.stepString(this, file, this.parameters);
     }
 
     @Override
     public WriteStep clone() {
         final WriteStep clone = (WriteStep) super.clone();
         clone.parameters = this.parameters.clone();
-        clone.localFile = this.localFile;
+        clone.file = this.file;
         return clone;
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/585980bb/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
index c896d76..1ec3d38 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopReadStep.java
@@ -45,7 +45,7 @@ public class HadoopReadStep extends VertexProgramStep implements Reading {
     }
 
     @Override
-    public String getLocalFile() {
+    public String getFile() {
         return (String) ((Graph) traversal.getGraph().get()).configuration().getProperty(Constants.GREMLIN_HADOOP_INPUT_LOCATION);
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/585980bb/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
index 0711a2e..2bb8e67 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/step/map/HadoopWriteStep.java
@@ -45,7 +45,7 @@ public class HadoopWriteStep extends VertexProgramStep implements Reading {
     }
 
     @Override
-    public String getLocalFile() {
+    public String getFile() {
         return (String) ((Graph) traversal.getGraph().get()).configuration().getProperty(Constants.GREMLIN_HADOOP_OUTPUT_LOCATION);
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/585980bb/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
index 47986f9..d8d8bab 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/process/computer/traversal/strategy/HadoopIoStrategy.java
@@ -45,7 +45,7 @@ public final class HadoopIoStrategy extends AbstractTraversalStrategy<TraversalS
         // replace Reading and Writing steps with hadoop specific ones
         if (traversal.getStartStep() instanceof Reading) {
             final Reading reading = (Reading) traversal.getStartStep();
-            final HadoopReadStep hadoopReadStep = new HadoopReadStep(traversal, reading.getLocalFile());
+            final HadoopReadStep hadoopReadStep = new HadoopReadStep(traversal, reading.getFile());
             reading.getParameters().getRaw().entrySet().forEach(kv ->
                 hadoopReadStep.configure(null, kv.getKey(), kv.getValue())
             );
@@ -53,7 +53,7 @@ public final class HadoopIoStrategy extends AbstractTraversalStrategy<TraversalS
             TraversalHelper.replaceStep((Step) reading, hadoopReadStep, traversal);
         } else if (traversal.getStartStep() instanceof Writing) {
             final Writing writing = (Writing) traversal.getStartStep();
-            final HadoopWriteStep hadoopWriteStep = new HadoopWriteStep(traversal, writing.getLocalFile());
+            final HadoopWriteStep hadoopWriteStep = new HadoopWriteStep(traversal, writing.getFile());
             writing.getParameters().getRaw().entrySet().forEach(kv ->
                 hadoopWriteStep.configure(null, kv.getKey(), kv.getValue())
             );


[22/26] tinkerpop git commit: TINKERPOP-1996 Introduce read() and write() steps

Posted by sp...@apache.org.
TINKERPOP-1996 Introduce read() and write() steps


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

Branch: refs/heads/TINKERPOP-1996
Commit: 3641e9106141cc52b4266ce0179637f1660ab680
Parents: 3852c87
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jun 29 15:04:17 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:59:38 2018 -0400

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java     |   2 +
 .../dsl/graph/GraphTraversalSource.java         |  17 +++
 .../process/traversal/step/map/ReadStep.java    | 112 +++++++++++++++++++
 .../process/traversal/step/map/WriteStep.java   | 111 ++++++++++++++++++
 .../strategy/verification/IoUsageStrategy.java  |  60 ++++++++++
 .../verification/IoUsageStrategyTest.java       |  93 +++++++++++++++
 .../glv/GraphTraversalSource.template           |   4 +-
 gremlin-dotnet/glv/generate.groovy              |   5 +-
 .../Process/Traversal/GraphTraversalSource.cs   |  22 ++++
 .../lib/process/graph-traversal.js              |  20 ++++
 .../gremlin_python/process/graph_traversal.py   |  10 ++
 11 files changed, 452 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
index 7d1e7e4..6d75745 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
@@ -2789,6 +2789,8 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
         public static final String skip = "skip";
         public static final String tail = "tail";
         public static final String coin = "coin";
+        public static final String read = "read";
+        public static final String write = "write";
 
         public static final String timeLimit = "timeLimit";
         public static final String simplePath = "simplePath";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/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 bc3ef9e..9b82108 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
@@ -31,6 +31,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddEdgeStartStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.AddVertexStartStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.InjectStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.RequirementsStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
@@ -40,6 +42,7 @@ import org.apache.tinkerpop.gremlin.structure.Transaction;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 
+import java.util.Map;
 import java.util.Optional;
 import java.util.function.BinaryOperator;
 import java.util.function.Supplier;
@@ -390,6 +393,20 @@ public class GraphTraversalSource implements TraversalSource {
         return traversal.addStep(new GraphStep<>(traversal, Edge.class, true, edgesIds));
     }
 
+    public GraphTraversal<Map<String,Object>, Map<String,Object>> read(final String localFile) {
+        final GraphTraversalSource clone = this.clone();
+        clone.bytecode.addStep(GraphTraversal.Symbols.read, localFile);
+        final GraphTraversal.Admin<Map<String,Object>, Map<String,Object>> traversal = new DefaultGraphTraversal<>(clone);
+        return traversal.addStep(new ReadStep(traversal, localFile));
+    }
+
+    public GraphTraversal<Map<String,Object>, Map<String,Object>> write(final String localFile) {
+        final GraphTraversalSource clone = this.clone();
+        clone.bytecode.addStep(GraphTraversal.Symbols.write, localFile);
+        final GraphTraversal.Admin<Map<String,Object>, Map<String,Object>> traversal = new DefaultGraphTraversal<>(clone);
+        return traversal.addStep(new WriteStep(traversal, localFile));
+    }
+
     /**
      * Proxies calls through to the underlying {@link Graph#tx()}.
      */

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
new file mode 100644
index 0000000..afc3e53
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ReadStep.java
@@ -0,0 +1,112 @@
+/*
+ * 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.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Reads data from a file into a {@link Graph}. This step is meant to be used as the first and last step in a
+ * traversal.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ReadStep extends AbstractStep<Map<String,Object>, Map<String,Object>> implements Configuring {
+
+    private Parameters parameters = new Parameters();
+    private boolean first = true;
+    private String localFile;
+
+    public ReadStep(final Traversal.Admin traversal, final String localFile) {
+        super(traversal);
+
+        if (null == localFile || localFile.isEmpty())
+            throw new IllegalArgumentException("localFile cannot be null or empty");
+        if (!new File(localFile).exists()) throw new IllegalStateException(localFile + " does not exist");
+
+        this.localFile = localFile;
+    }
+
+    @Override
+    public Parameters getParameters() {
+        return this.parameters;
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
+    protected Traverser.Admin<Map<String,Object>> processNextStart() {
+        if (!this.first) throw FastNoSuchElementException.instance();
+
+        this.first = false;
+        final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
+        final File file = new File(localFile);
+
+        try (final InputStream stream = new FileInputStream(file)) {
+            final Graph graph = (Graph) this.traversal.getGraph().get();
+            GryoReader.build().create().readGraph(stream, graph);
+
+            final Map<String,Object> stats = new LinkedHashMap<>();
+            stats.put("vertices", IteratorUtils.count(graph.vertices()));
+            stats.put("edges", IteratorUtils.count(graph.edges()));
+
+            return generator.generate(stats, this, 1L);
+        } catch (IOException ioe) {
+            throw new IllegalStateException(String.format("Could not read file %s into graph", localFile), ioe);
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        final int hash = super.hashCode() ^ this.parameters.hashCode();
+        return (null != this.localFile) ? (hash ^ localFile.hashCode()) : hash;
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.stepString(this, localFile, this.parameters);
+    }
+
+    @Override
+    public ReadStep clone() {
+        final ReadStep clone = (ReadStep) super.clone();
+        clone.parameters = this.parameters.clone();
+        clone.localFile = this.localFile;
+        return clone;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
new file mode 100644
index 0000000..e9346cf
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/WriteStep.java
@@ -0,0 +1,111 @@
+/*
+ * 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.step.map;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Configuring;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
+import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Writes data to a file from a {@link Graph}. This step is meant to be used as the first and last step in a
+ * traversal.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class WriteStep extends AbstractStep<Map<String,Object>, Map<String,Object>> implements Configuring {
+
+    private Parameters parameters = new Parameters();
+    private boolean first = true;
+    private String localFile;
+
+    public WriteStep(final Traversal.Admin traversal, final String localFile) {
+        super(traversal);
+
+        if (null == localFile || localFile.isEmpty())
+            throw new IllegalArgumentException("localFile cannot be null or empty");
+
+        this.localFile = localFile;
+    }
+
+    @Override
+    public Parameters getParameters() {
+        return this.parameters;
+    }
+
+    @Override
+    public void configure(final Object... keyValues) {
+        this.parameters.set(null, keyValues);
+    }
+
+    @Override
+    protected Traverser.Admin<Map<String,Object>> processNextStart() {
+        if (!this.first) throw FastNoSuchElementException.instance();
+
+        this.first = false;
+        final TraverserGenerator generator = this.getTraversal().getTraverserGenerator();
+
+        final File file = new File(localFile);
+        try (final OutputStream stream = new FileOutputStream(file)) {
+            final Graph graph = (Graph) this.traversal.getGraph().get();
+            GryoWriter.build().create().writeGraph(stream, graph);
+
+            final Map<String, Object> stats = new LinkedHashMap<>();
+            stats.put("vertices", IteratorUtils.count(graph.vertices()));
+            stats.put("edges", IteratorUtils.count(graph.edges()));
+
+            return generator.generate(stats, this, 1L);
+        } catch (IOException ioe) {
+            throw new IllegalStateException(String.format("Could not write file %s from graph", localFile), ioe);
+        }
+    }
+
+    @Override
+    public int hashCode() {
+        final int hash = super.hashCode() ^ this.parameters.hashCode();
+        return (null != this.localFile) ? (hash ^ localFile.hashCode()) : hash;
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.stepString(this, localFile, this.parameters);
+    }
+
+    @Override
+    public WriteStep clone() {
+        final WriteStep clone = (WriteStep) super.clone();
+        clone.parameters = this.parameters.clone();
+        clone.localFile = this.localFile;
+        return clone;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
new file mode 100644
index 0000000..95761ff
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategy.java
@@ -0,0 +1,60 @@
+/*
+ * 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.verification;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+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.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.ReadStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.map.WriteStep;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
+
+/**
+ * {@code IoUsageStrategy} prevents the {@link GraphTraversalSource#read(String)} and
+ * {@link GraphTraversalSource#write(String)} steps from being used outside of their intended scope, which is as the
+ * first and last step in a traversal. Therefore, it can only be used as {@code g.read('file.gryo')} and
+ * {@code g.write('file.gryo')}. As both of these steps take additional configuration, the use of the
+ * {@link GraphTraversal#with(String, Object)} is acceptable.
+ * <p/>
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ * @example <pre>
+ * g.read('file.kryo').V()            // throws VerificationException
+ * g.write('file.kryo').V()           // throws VerificationException
+ * </pre>
+ */
+public final class IoUsageStrategy extends AbstractTraversalStrategy<TraversalStrategy.VerificationStrategy> implements TraversalStrategy.VerificationStrategy {
+
+    private static final IoUsageStrategy INSTANCE = new IoUsageStrategy();
+
+    private IoUsageStrategy() {
+    }
+
+    @Override
+    public void apply(final Traversal.Admin<?, ?> traversal) {
+        if ((traversal.getStartStep() instanceof ReadStep || traversal.getStartStep() instanceof WriteStep) && traversal.getSteps().size() > 1) {
+            throw new VerificationException("The read() or write() steps must be the first and only step in the traversal - they cannot be used with other steps", traversal);
+        }
+    }
+
+    public static IoUsageStrategy instance() {
+        return INSTANCE;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategyTest.java
new file mode 100644
index 0000000..907e2b7
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/IoUsageStrategyTest.java
@@ -0,0 +1,93 @@
+/*
+ * 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.verification;
+
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
+import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+@RunWith(Parameterized.class)
+public class IoUsageStrategyTest {
+
+    private static final GraphTraversalSource g = EmptyGraph.instance().traversal();
+
+    private static File junkFile;
+
+    static {
+        try {
+            junkFile = TestHelper.generateTempFile(IoUsageStrategyTest.class, "fake", "kryo");
+        } catch (IOException ioe) {
+            throw new RuntimeException(ioe);
+        }
+    }
+
+    @Parameterized.Parameters(name = "{0}")
+    public static Iterable<Object[]> data() {
+        return Arrays.asList(new Object[][]{
+                {"g.read('a.kryo')", g.read(junkFile.getAbsolutePath()), true},
+                {"g.write('a.kryo')", g.write(junkFile.getAbsolutePath()), true},
+                {"g.read('a.kryo').with(\"x\", \"y\")", g.read(junkFile.getAbsolutePath()).with("x", "y"), true},
+                {"g.write('a.kryo').with(\"x\", \"y\")", g.write(junkFile.getAbsolutePath()).with("x", "y"), true},
+                {"g.read('a.kryo').V()", g.read(junkFile.getAbsolutePath()).V(), false},
+                {"g.write('a.kryo').V()", g.write(junkFile.getAbsolutePath()).V(), false}
+        });
+    }
+
+    @Parameterized.Parameter(value = 0)
+    public String name;
+
+    @Parameterized.Parameter(value = 1)
+    public Traversal traversal;
+
+    @Parameterized.Parameter(value = 2)
+    public boolean allow;
+
+    @Test
+    public void shouldBeVerified() {
+        final TraversalStrategies strategies = new DefaultTraversalStrategies();
+        strategies.addStrategies(IoUsageStrategy.instance());
+        traversal.asAdmin().setStrategies(strategies);
+        if (allow) {
+            traversal.asAdmin().applyStrategies();
+        } else {
+            try {
+                traversal.asAdmin().applyStrategies();
+                fail("The strategy should not allow read()/write() to be used with other steps: " + this.traversal);
+            } catch (VerificationException ise) {
+                assertTrue(ise.getMessage().contains("read() or write() steps"));
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/gremlin-dotnet/glv/GraphTraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/GraphTraversalSource.template b/gremlin-dotnet/glv/GraphTraversalSource.template
index afa4297..23d66e5 100644
--- a/gremlin-dotnet/glv/GraphTraversalSource.template
+++ b/gremlin-dotnet/glv/GraphTraversalSource.template
@@ -127,9 +127,9 @@ namespace Gremlin.Net.Process.Traversal
         ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the <%= method.methodName %> step to that
         ///     traversal.
         /// </summary>
-        public GraphTraversal<$method.typeNameString> <%= toCSharpMethodName.call(method.methodName) %><%= method.tParam %>(<%= method.parameters %>)
+        public GraphTraversal<$method.t1, $method.t2> <%= toCSharpMethodName.call(method.methodName) %><%= method.tParam %>(<%= method.parameters %>)
         {
-            var traversal = new GraphTraversal<$method.typeNameString>(TraversalStrategies, new Bytecode(Bytecode));
+            var traversal = new GraphTraversal<$method.t1, $method.t2>(TraversalStrategies, new Bytecode(Bytecode));
             <%  if (method.parameters.contains("params ")) {
           %>var args = new List<$method.argsListType>(<%= method.paramNames.init().size() %> + <%= method.paramNames.last() %>.Length) {<%= method.paramNames.init().join(", ") %>};
             args.AddRange(<%= method.paramNames.last() %>);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/generate.groovy b/gremlin-dotnet/glv/generate.groovy
index e542471..bd2d9d7 100644
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@ -38,6 +38,7 @@ def toCSharpTypeMap = ["Long": "long",
                        "Object[]": "object[]",
                        "Class": "Type",
                        "Class[]": "Type[]",
+                       "java.util.Map<java.lang.String, java.lang.Object>": "IDictionary<string, object>",
                        "java.util.Map<java.lang.String, E2>": "IDictionary<string, E2>",
                        "java.util.Map<java.lang.String, B>": "IDictionary<string, E2>",
                        "java.util.Map<java.lang.Object, E2>": "IDictionary<object, E2>",
@@ -251,13 +252,13 @@ def binding = ["pmethods": P.class.getMethods().
                         unique { a,b -> a.name <=> b.name ?: getCSharpParamTypeString(a) <=> getCSharpParamTypeString(b) }.
                         collect { javaMethod ->
                             def typeNames = getJavaGenericTypeParameterTypeNames(javaMethod)
-                            def typeNameString = typeNames.join(", ")
+                            def t1 = toCSharpType(typeNames[0])
                             def t2 = toCSharpType(typeNames[1])
                             def tParam = getCSharpGenericTypeParam(t2)
                             def parameters = getCSharpParamString(javaMethod, true)
                             def paramNames = getParamNames(javaMethod.parameters)
                             def argsListType = getArgsListType(parameters)
-                            return ["methodName": javaMethod.name, "typeNameString": typeNameString, "tParam":tParam, "parameters":parameters, "paramNames":paramNames, "argsListType":argsListType]
+                            return ["methodName": javaMethod.name, "t1":t1, "t2":t2, "tParam":tParam, "parameters":parameters, "paramNames":paramNames, "argsListType":argsListType]
                         },
                "graphStepMethods": GraphTraversal.getMethods().
                         findAll { GraphTraversal.class.equals(it.returnType) }.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
index 2816c05..630ac28 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversalSource.cs
@@ -333,6 +333,28 @@ namespace Gremlin.Net.Process.Traversal
             return traversal;
         }
 
+        /// <summary>
+        ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the read step to that
+        ///     traversal.
+        /// </summary>
+        public GraphTraversal<IDictionary<string, object>, IDictionary<string, object>> Read(string localFile)
+        {
+            var traversal = new GraphTraversal<IDictionary<string, object>, IDictionary<string, object>>(TraversalStrategies, new Bytecode(Bytecode));
+                traversal.Bytecode.AddStep("read", localFile);
+            return traversal;
+        }
+
+        /// <summary>
+        ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> off this graph traversal source and adds the write step to that
+        ///     traversal.
+        /// </summary>
+        public GraphTraversal<IDictionary<string, object>, IDictionary<string, object>> Write(string localFile)
+        {
+            var traversal = new GraphTraversal<IDictionary<string, object>, IDictionary<string, object>>(TraversalStrategies, new Bytecode(Bytecode));
+                traversal.Bytecode.AddStep("write", localFile);
+            return traversal;
+        }
+
     }
     
 #pragma warning restore 1591

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
index f143542..8fa51de 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/graph-traversal.js
@@ -172,6 +172,26 @@ class GraphTraversalSource {
     return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
   }
   
+  /**
+   * read GraphTraversalSource step method.
+   * @param {...Object} args
+   * @returns {GraphTraversal}
+   */
+  read(...args) {
+    const b = new Bytecode(this.bytecode).addStep('read', args);
+    return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+  }
+  
+  /**
+   * write GraphTraversalSource step method.
+   * @param {...Object} args
+   * @returns {GraphTraversal}
+   */
+  write(...args) {
+    const b = new Bytecode(this.bytecode).addStep('write', args);
+    return new GraphTraversal(this.graph, new TraversalStrategies(this.traversalStrategies), b);
+  }
+  
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3641e910/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 bb81d87..e559613 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
@@ -106,6 +106,16 @@ class GraphTraversalSource(object):
         traversal.bytecode.add_step("inject", *args)
         return traversal
 
+    def read(self, *args):
+        traversal = self.get_graph_traversal()
+        traversal.bytecode.add_step("read", *args)
+        return traversal
+
+    def write(self, *args):
+        traversal = self.get_graph_traversal()
+        traversal.bytecode.add_step("write", *args)
+        return traversal
+
 
 class GraphTraversal(Traversal):
     def __init__(self, graph, traversal_strategies, bytecode):


[18/26] tinkerpop git commit: Merge branch 'TINKERPOP-1986'

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1986'


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

Branch: refs/heads/TINKERPOP-1996
Commit: 3852c87343bacce513fc5cfb1cf9095fa759cb43
Parents: 8c05c19 3108016
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jul 12 10:54:47 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:54:47 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  3 +-
 docs/src/reference/gremlin-variants.asciidoc    |  4 +--
 docs/src/upgrade/release-3.4.x.asciidoc         |  7 ++++-
 .../gremlin/jsr223/GremlinScriptEngine.java     | 25 ---------------
 .../gremlin/jsr223/ImportCustomizer.java        |  8 -----
 .../strategy/decoration/PartitionStrategy.java  | 12 --------
 .../strategy/decoration/SubgraphStrategy.java   | 16 ----------
 .../decoration/PartitionStrategyTest.java       |  8 ++---
 .../PartitionStrategyTraverseTest.java          |  2 +-
 .../SubgraphStrategyTraverseTest.java           |  2 +-
 .../Strategy/Decoration/SubgraphStrategy.cs     | 22 +++++++-------
 .../DriverRemoteConnection/StrategiesTests.cs   | 20 ++++++------
 .../PartitionStrategyProcessTest.java           | 32 ++++++++++----------
 .../decoration/SubgraphStrategyProcessTest.java |  8 ++---
 .../decoration/TranslationStrategy.java         |  2 +-
 15 files changed, 58 insertions(+), 113 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3852c873/CHANGELOG.asciidoc
----------------------------------------------------------------------


[10/26] tinkerpop git commit: fix(DriverRemoteConnection): return the promise on close

Posted by sp...@apache.org.
fix(DriverRemoteConnection): return the promise on close

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

Branch: refs/heads/TINKERPOP-1996
Commit: f6e50ae231ebd6cf9e488522967ad1d483de4781
Parents: 309957b
Author: Elliott Foster <el...@codebrews.com>
Authored: Tue Jul 3 12:35:55 2018 -0500
Committer: GitHub <no...@github.com>
Committed: Tue Jul 3 12:35:55 2018 -0500

----------------------------------------------------------------------
 .../lib/driver/driver-remote-connection.js      | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f6e50ae2/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
index d9e6000..0f7cedb 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
@@ -190,16 +190,16 @@ class DriverRemoteConnection extends RemoteConnection {
    * @return {Promise}
    */
   close() {
-    if (this._closePromise) {
-      return this._closePromise;
-    }
-    this._closePromise = new Promise(resolve => {
-      this._ws.on('close', function () {
-        this.isOpen = false;
-        resolve();
+    if (!this._closePromise) {
+      this._closePromise = new Promise(resolve => {
+        this._ws.on('close', function () {
+          this.isOpen = false;
+          resolve();
+        });
+        this._ws.close();
       });
-      this._ws.close();
-    });
+    }
+    return this._closePromise;
   }
 }
 
@@ -226,4 +226,4 @@ const bufferFromString = (Int8Array.from !== Buffer.from && Buffer.from) || func
   return new Buffer(text, 'utf8');
 };
 
-module.exports = DriverRemoteConnection;
\ No newline at end of file
+module.exports = DriverRemoteConnection;


[04/26] tinkerpop git commit: Merge branch 'tp33'

Posted by sp...@apache.org.
Merge branch 'tp33'


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

Branch: refs/heads/TINKERPOP-1996
Commit: 734b01f358c59c9e16b2479c5bcdfb95a7e75e78
Parents: ec7e27e 65ba04f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Jun 29 15:21:49 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Jun 29 15:21:49 2018 -0400

----------------------------------------------------------------------
 gremlin-dotnet/glv/generate.groovy | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------



[17/26] tinkerpop git commit: Merge branch 'tp33'

Posted by sp...@apache.org.
Merge branch 'tp33'


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

Branch: refs/heads/TINKERPOP-1996
Commit: 8c05c19ea816b5671778187a94721a82fd1bbc92
Parents: 3cd352e a6ba2d5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jul 12 10:51:35 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:51:35 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                           | 1 +
 .../java/org/apache/tinkerpop/gremlin/driver/Handler.java    | 8 ++++++++
 .../gremlin/driver/handler/WebSocketClientHandler.java       | 5 -----
 3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8c05c19e/CHANGELOG.asciidoc
----------------------------------------------------------------------


[08/26] tinkerpop git commit: Merge branch 'tp33'

Posted by sp...@apache.org.
Merge branch 'tp33'


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

Branch: refs/heads/TINKERPOP-1996
Commit: 11895ceb1de2fd918ae51b168dddd75e18712ecf
Parents: 1f240fe 1f15781
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sat Jun 30 06:28:31 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Sat Jun 30 06:28:31 2018 -0400

----------------------------------------------------------------------
 .../dsl/graph/GraphTraversalSource.java         | 94 +++++++++++++++++++-
 1 file changed, 93 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[15/26] tinkerpop git commit: TINKERPOP-1999 Prevented java driver from hanging on disorderly server shutdown

Posted by sp...@apache.org.
TINKERPOP-1999 Prevented java driver from hanging on disorderly server shutdown

We didn't see this before because all tests had assumed an orderly shutdown. In orderly shutdown the server actually manages to send a kill message which the driver respects. In disorderly shutdown, the channel just goes inactive and as described in TINKERPOP-1999 that event was not being handled properly on the driver causing it to hang. I tried to write a test for this but was unable to as I can't figure out how to write an "disorderly shutdown" which basically involves "pulling the plug" on the server. CTR


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

Branch: refs/heads/TINKERPOP-1996
Commit: 3dcabd4f1b23fecde28c79a10502ad562d934c8d
Parents: b0c836b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Jul 12 10:07:04 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Jul 12 10:07:04 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                           | 1 +
 .../java/org/apache/tinkerpop/gremlin/driver/Handler.java    | 8 ++++++++
 .../gremlin/driver/handler/WebSocketClientHandler.java       | 5 -----
 3 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dcabd4f/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ee49c09..a25e7a5 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-2-10]]
 === TinkerPop 3.2.10 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Fixed bug in Java driver where an disorderly shutdown of the server would cause the client to hang.
 * Added a dotnet template project that should make it easier to get started with Gremlin.Net.
 * Removed `ThreadInterruptCustomizerProvider` from documentation as a way to timeout.
 * Added Docker images for Gremlin Console and Gremlin Server.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dcabd4f/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
index 1bd0a3b..a6528b2 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Handler.java
@@ -201,6 +201,14 @@ final class Handler {
         }
 
         @Override
+        public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
+            // occurs when the server shutsdown in a disorderly fashion, otherwise in an orderly shutdown the server
+            // should fire off a close message which will properly release the driver.
+            super.channelInactive(ctx);
+            throw new IllegalStateException("Connection to server is no longer active");
+        }
+
+        @Override
         protected void channelRead0(final ChannelHandlerContext channelHandlerContext, final ResponseMessage response) throws Exception {
             try {
                 final ResponseStatusCode statusCode = response.getStatus().getCode();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dcabd4f/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java
index 0a1f2f7..7b5858b 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/handler/WebSocketClientHandler.java
@@ -62,11 +62,6 @@ public final class WebSocketClientHandler extends SimpleChannelInboundHandler<Ob
     }
 
     @Override
-    public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
-        //System.out.println("WebSocket Client disconnected!");
-    }
-
-    @Override
     protected void channelRead0(final ChannelHandlerContext ctx, final Object msg) throws Exception {
         final Channel ch = ctx.channel();
         if (!handshaker.isHandshakeComplete()) {