You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by rd...@apache.org on 2018/10/05 11:37:23 UTC

[01/48] tinkerpop git commit: optmizes collection copy with Collections addAll [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-2037 24ca28e08 -> ee6802e76 (forced update)


optmizes collection copy with Collections addAll


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

Branch: refs/heads/TINKERPOP-2037
Commit: 0e34073d8a756a52eda571bd9ddac0b94b42d54a
Parents: ca3a343
Author: Otavio Santana <ot...@gmail.com>
Authored: Wed Aug 22 16:45:19 2018 -0300
Committer: Otavio Santana <ot...@gmail.com>
Committed: Wed Aug 22 16:54:16 2018 -0300

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java        | 17 +++++------------
 .../step/sideEffect/SideEffectCapStep.java         |  4 +---
 2 files changed, 6 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e34073d/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 1dccead..5ba7823 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
@@ -149,6 +149,7 @@ import org.apache.tinkerpop.gremlin.util.function.ConstantSupplier;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
@@ -1484,16 +1485,12 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
         else {
             final List<Object> ids = new ArrayList<>();
             if (id instanceof Object[]) {
-                for (final Object i : (Object[]) id) {
-                    ids.add(i);
-                }
+                Collections.addAll(ids, (Object[]) id);
             } else
                 ids.add(id);
             for (final Object i : otherIds) {
                 if (i.getClass().isArray()) {
-                    for (final Object ii : (Object[]) i) {
-                        ids.add(ii);
-                    }
+                    Collections.addAll(ids, (Object[]) i);
                 } else
                     ids.add(i);
             }
@@ -1559,16 +1556,12 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
         else {
             final List<Object> values = new ArrayList<>();
             if (value instanceof Object[]) {
-                for (final Object v : (Object[]) value) {
-                    values.add(v);
-                }
+                Collections.addAll(values, (Object[]) value);
             } else
                 values.add(value);
             for (final Object v : otherValues) {
                 if (v instanceof Object[]) {
-                    for (final Object vv : (Object[]) v) {
-                        values.add(vv);
-                    }
+                    Collections.addAll(values, (Object[]) v);
                 } else
                     values.add(v);
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0e34073d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SideEffectCapStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SideEffectCapStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SideEffectCapStep.java
index 5ac5b27..337dbe4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SideEffectCapStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SideEffectCapStep.java
@@ -46,9 +46,7 @@ public final class SideEffectCapStep<S, E> extends SupplyingBarrierStep<S, E> {
         super(traversal);
         this.sideEffectKeys = new ArrayList<>(1 + sideEffectKeys.length);
         this.sideEffectKeys.add(sideEffectKey);
-        for (final String key : sideEffectKeys) {
-            this.sideEffectKeys.add(key);
-        }
+        Collections.addAll(this.sideEffectKeys, sideEffectKeys);
     }
 
     @Override


[46/48] tinkerpop git commit: Merge branch 'tp32' into tp33

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

Conflicts:
	gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java


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

Branch: refs/heads/TINKERPOP-2037
Commit: d9ccefcea9274f00e7339b840624286e198d7832
Parents: 86b1be5 4bdb006
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Oct 5 06:57:09 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Oct 5 06:57:09 2018 -0400

----------------------------------------------------------------------
 .../groovy/jsr223/GremlinGroovyScriptEngineTest.java     | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d9ccefce/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
----------------------------------------------------------------------
diff --cc gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
index 3e1d153,2803c24..83ac13d
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
@@@ -22,13 -22,16 +22,9 @@@ import groovy.lang.Closure
  import groovy.lang.MissingPropertyException;
  import org.apache.commons.lang.exception.ExceptionUtils;
  import org.apache.commons.lang3.concurrent.BasicThreadFactory;
 -import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
 -import org.apache.tinkerpop.gremlin.groovy.NoImportCustomizerProvider;
 -import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCustomizerProvider;
--import org.apache.tinkerpop.gremlin.structure.Vertex;
  import org.apache.tinkerpop.gremlin.util.function.Lambda;
--import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
  import org.javatuples.Pair;
  import org.junit.Test;
--import org.slf4j.Logger;
--import org.slf4j.LoggerFactory;
  
  import javax.script.Bindings;
  import javax.script.ScriptContext;
@@@ -61,8 -73,8 +57,6 @@@ import static org.junit.Assert.fail
   * @author Stephen Mallette (http://stephen.genoprime.com)
   */
  public class GremlinGroovyScriptEngineTest {
--    private static final Logger logger = LoggerFactory.getLogger(GremlinGroovyScriptEngineTest.class);
--
      private static final Object[] EMPTY_ARGS = new Object[0];
  
      @Test
@@@ -162,8 -220,78 +156,7 @@@
          engine.eval("assert 1==0");
      }
  
- 
      @Test
 -    public void shouldLoadImportsViaDependencyManagerInterface() throws Exception {
 -        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE);
 -        try {
 -            engine.eval("Vertex.class.getName()");
 -            fail("Should have thrown an exception because no imports were supplied");
 -        } catch (Exception se) {
 -            assertTrue(se instanceof ScriptException);
 -        }
 -
 -        engine.addImports(new HashSet<>(Arrays.asList("import org.apache.tinkerpop.gremlin.structure.Vertex")));
 -        assertEquals(Vertex.class.getName(), engine.eval("Vertex.class.getName()"));
 -    }
 -
 -    @Test
 -    public void shouldLoadImportsViaDependencyManagerInterfaceAdditively() throws Exception {
 -        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE);
 -        try {
 -            engine.eval("Vertex.class.getName()");
 -            fail("Should have thrown an exception because no imports were supplied");
 -        } catch (Exception se) {
 -            assertTrue(se instanceof ScriptException);
 -        }
 -
 -        try {
 -            engine.eval("StreamFactory.class.getName()");
 -            fail("Should have thrown an exception because no imports were supplied");
 -        } catch (Exception se) {
 -            assertTrue(se instanceof ScriptException);
 -        }
 -
 -        engine.addImports(new HashSet<>(Arrays.asList("import " + Vertex.class.getCanonicalName())));
 -        assertEquals(Vertex.class.getName(), engine.eval("Vertex.class.getName()"));
 -
 -        try {
 -            engine.eval("IteratorUtils.class.getName()");
 -            fail("Should have thrown an exception because no imports were supplied");
 -        } catch (Exception se) {
 -            assertTrue(se instanceof ScriptException);
 -        }
 -
 -        engine.addImports(new HashSet<>(Arrays.asList("import " + IteratorUtils.class.getCanonicalName())));
 -        assertEquals(Vertex.class.getName(), engine.eval("Vertex.class.getName()"));
 -        assertEquals(IteratorUtils.class.getName(), engine.eval("IteratorUtils.class.getName()"));
 -    }
 -
 -    @Test
 -    public void shouldAllowsMultipleImports() throws Exception {
 -        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE);
 -        try {
 -            engine.eval("Color.RED");
 -            fail("Should have thrown an exception because no imports were supplied");
 -        } catch (Exception se) {
 -            assertTrue(se instanceof ScriptException);
 -        }
 -
 -        try {
 -            engine.eval("SystemColor.ACTIVE_CAPTION");
 -            fail("Should have thrown an exception because no imports were supplied");
 -        } catch (Exception se) {
 -            assertTrue(se instanceof ScriptException);
 -        }
 -
 -        engine.addImports(new HashSet<>(Arrays.asList("import java.awt.Color")));
 -        assertEquals(Color.RED, engine.eval("Color.RED"));
 -
 -        engine.addImports(new HashSet<>(Arrays.asList("import java.awt.SystemColor")));
 -        assertEquals(Color.RED, engine.eval("Color.RED"));
 -        assertEquals(SystemColor.ACTIVE_CAPTION, engine.eval("SystemColor.ACTIVE_CAPTION"));
 -    }
 -
 -    @Test
      public void shouldClearEngineScopeOnReset() throws Exception {
          final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
          engine.eval("x = { y -> y + 1}");
@@@ -177,7 -305,7 +170,7 @@@
              engine.eval("x(1)");
              fail("Bindings should have been cleared.");
          } catch (Exception ex) {
--
++            // do nothing = expected
          }
  
          b = engine.getContext().getBindings(ScriptContext.ENGINE_SCOPE);
@@@ -198,6 -382,6 +191,7 @@@
              scriptEngine.eval("addOne(1)");
              fail("Should have tossed ScriptException since addOne is not yet defined.");
          } catch (ScriptException se) {
++            // do nothing = expected
          }
  
          // validate that the addOne function works
@@@ -211,6 -395,6 +205,7 @@@
              scriptEngine.eval("addOne(1)");
              fail("Should have tossed ScriptException since addOne is no longer defined after reset.");
          } catch (ScriptException se) {
++            // do nothing = expected
          }
      }
  


[04/48] tinkerpop git commit: TINKERPOP-2040 Updated changelog

Posted by rd...@apache.org.
TINKERPOP-2040 Updated changelog


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

Branch: refs/heads/TINKERPOP-2037
Commit: 92c74c3d7ffc25b234187ef2459f8d3d529ac8db
Parents: e5c2e9c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Oct 1 09:12:30 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 1 16:18:28 2018 -0400

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/92c74c3d/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 6d9770f..9160d09 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -37,6 +37,8 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Added synchronized `Map` to Gryo 1.0 registrations.
 * Added `Triple` to Gryo 1.0 registrations.
 * Improved escaping of special characters in strings passed to the `GroovyTranslator`.
+* Improved ability of `GroovyTranslator` to handle more types supported by GraphSON.
+* Improved ability of `GroovyTranslator` to handle custom types.
 * Added better internal processing of `Column` in `by(Function)`.
 * Added `hasNext()` support on `Traversal` for `gremlin-python`.
 * Added support for additional extended types in Gremlin.Net with `decimal`, `TimeSpan`, `BigInteger`, `byte`, `byte[]`, `char` and `short`.


[11/48] tinkerpop git commit: TINKERPOP-2055 Added tests for .Net on special numbers

Posted by rd...@apache.org.
TINKERPOP-2055 Added tests for .Net on special numbers


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

Branch: refs/heads/TINKERPOP-2037
Commit: b542027825fe905c0c46b81a00fe7dfd5275e8c6
Parents: 2d3041f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 05:11:56 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 3 05:11:56 2018 -0400

----------------------------------------------------------------------
 .../IO/GraphSON/GraphSONReaderTests.cs          | 38 ++++++++++++++++++--
 .../IO/GraphSON/GraphSONWriterTests.cs          | 30 ++++++++++++++++
 2 files changed, 66 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b5420278/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
index 74bf385..08a91ae 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
@@ -24,11 +24,9 @@
 using System;
 using System.Collections.Generic;
 using System.Numerics;
-using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
 using Gremlin.Net.Structure.IO.GraphSON;
 using Moq;
-using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Xunit;
 
@@ -178,6 +176,42 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         }
 
         [Fact]
+        public void ShouldDeserializeNaN()
+        {
+            var serializedValue = "{\"@type\":\"g:Double\",\"@value\":'NaN'}";
+            var reader = CreateStandardGraphSONReader();
+
+            var jObject = JObject.Parse(serializedValue);
+            var deserializedValue = reader.ToObject(jObject);
+
+            Assert.Equal(Double.NaN, deserializedValue);
+        }
+
+        [Fact]
+        public void ShouldDeserializePositiveInfinity()
+        {
+            var serializedValue = "{\"@type\":\"g:Double\",\"@value\":'Infinity'}";
+            var reader = CreateStandardGraphSONReader();
+
+            var jObject = JObject.Parse(serializedValue);
+            var deserializedValue = reader.ToObject(jObject);
+
+            Assert.Equal(Double.PositiveInfinity, deserializedValue);
+        }
+
+        [Fact]
+        public void ShouldDeserializeNegativeInfinity()
+        {
+            var serializedValue = "{\"@type\":\"g:Double\",\"@value\":'-Infinity'}";
+            var reader = CreateStandardGraphSONReader();
+
+            var jObject = JObject.Parse(serializedValue);
+            var deserializedValue = reader.ToObject(jObject);
+
+            Assert.Equal(Double.NegativeInfinity, deserializedValue);
+        }
+
+        [Fact]
         public void ShouldDeserializeDecimal()
         {
             var serializedValue = "{\"@type\":\"gx:BigDecimal\",\"@value\":-8.201}";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b5420278/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
index a544fb3..13fbddc 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
@@ -81,6 +81,36 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         }
 
         [Fact]
+        public void ShouldSerializeNaN()
+        {
+            var writer = CreateStandardGraphSONWriter();
+
+            var graphSon = writer.WriteObject(Double.NaN);
+
+            Assert.Equal("{\"@type\":\"g:Double\",\"@value\":\"NaN\"}", graphSon);
+        }
+
+        [Fact]
+        public void ShouldSerializePositiveInfinity()
+        {
+            var writer = CreateStandardGraphSONWriter();
+
+            var graphSon = writer.WriteObject(Double.PositiveInfinity);
+
+            Assert.Equal("{\"@type\":\"g:Double\",\"@value\":\"Infinity\"}", graphSon);
+        }
+
+        [Fact]
+        public void ShouldSerializeNegativeInfinity()
+        {
+            var writer = CreateStandardGraphSONWriter();
+
+            var graphSon = writer.WriteObject(Double.NegativeInfinity);
+
+            Assert.Equal("{\"@type\":\"g:Double\",\"@value\":\"-Infinity\"}", graphSon);
+        }
+
+        [Fact]
         public void ShouldSerializeDecimal()
         {
             var writer = CreateStandardGraphSONWriter();


[28/48] tinkerpop git commit: renamed text predicates and added some javadoc comments

Posted by rd...@apache.org.
renamed text predicates and added some javadoc comments


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

Branch: refs/heads/TINKERPOP-2037
Commit: 9b965861ed95ffff04beaebe07f99f0ce427f702
Parents: f057fb3
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Tue Oct 2 13:11:23 2018 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Oct 4 07:45:08 2018 -0700

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc       | 12 +--
 docs/src/upgrade/release-3.4.x.asciidoc         |  4 +-
 .../gremlin/process/traversal/Text.java         | 78 ++++++++++++++------
 .../gremlin/process/traversal/TextP.java        | 28 +++----
 .../gremlin/process/traversal/PTest.java        | 28 +++----
 .../GraphSONMapperPartialEmbeddedTypeTest.java  | 10 +--
 .../src/Gremlin.Net/Process/Traversal/TextP.cs  | 24 +++---
 .../TraversalEvaluation/TextPParameter.cs       |  2 +-
 gremlin-javascript/glv/TraversalSource.template |  4 +-
 .../gremlin-javascript/lib/process/traversal.js | 26 +++----
 .../jython/gremlin_python/process/traversal.py  | 60 +++++++--------
 gremlin-test/features/filter/Has.feature        | 20 ++---
 .../process/traversal/step/filter/HasTest.java  | 50 ++++++-------
 13 files changed, 191 insertions(+), 155 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index fdd261a..85dc1c0 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -3376,12 +3376,12 @@ The provided predicates are outlined in the table below and are used in various
 | `P.between(number,number)` | Is the incoming number greater than or equal to the first provided number and less than the second?
 | `P.within(objects...)` | Is the incoming object in the array of provided objects?
 | `P.without(objects...)` | Is the incoming object not in the array of the provided objects?
-| `TextP.startsWith(string)` | Does the incoming `String` start with the provided `String`?
-| `TextP.endsWith(string)` | Does the incoming `String` end with the provided `String`?
-| `TextP.contains(string)` | Does the incoming `String` contain the provided `String`?
-| `TextP.startsNotWith(string)` | TODO: find a better name
-| `TextP.endsNotWith(string)` | TODO: find a better name
-| `TextP.absent(string)` | TODO: find a better name
+| `TextP.startingWith(string)` | Does the incoming `String` start with the provided `String`?
+| `TextP.endingWith(string)` | Does the incoming `String` end with the provided `String`?
+| `TextP.containing(string)` | Does the incoming `String` contain the provided `String`?
+| `TextP.notStartingWith(string)` | Does the incoming `String` not start with the provided `String`?
+| `TextP.notEndingWith(string)` | Does the incoming `String` not end with the provided `String`?
+| `TextP.notContaining(string)` | Does the incoming `String` not contain the provided `String`?
 |=========================================================
 
 [gremlin-groovy]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/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 213577a..21e1899 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -35,10 +35,10 @@ Gremlin now supports simple text predicates on top of the existing `P` predicate
 
 [source,groovy]
 ----
-gremlin> g.V().has("person","name", contains("o")).valueMap()
+gremlin> g.V().has("person","name", containing("o")).valueMap()
 ==>[name:[marko],age:[29]]
 ==>[name:[josh],age:[32]]
-gremlin> g.V().has("person","name", contains("o").and(gte("j").and(endsWith("ko")))).valueMap()
+gremlin> g.V().has("person","name", containing("o").and(gte("j").and(endingWith("ko")))).valueMap()
 ==>[name:[marko],age:[29]]
 ----
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
index 5169309..9c25825 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
@@ -21,97 +21,131 @@ package org.apache.tinkerpop.gremlin.process.traversal;
 import java.util.function.BiPredicate;
 
 /**
+ * {@link Text} is a {@link java.util.function.BiPredicate} that determines whether the first string starts with, starts
+ * not with, ends with, ends not with, contains or does not contain the second string argument.
+ *
  * @author Daniel Kuppitz (http://gremlin.guru)
+ * @since 3.4.0
  */
 public enum Text implements BiPredicate<String, String> {
 
-    startsWith {
+    /**
+     * Evaluates if the first string starts with the second.
+     *
+     * @since 3.4.0
+     */
+    startingWith {
         @Override
         public boolean test(final String value, final String prefix) {
             return value.startsWith(prefix);
         }
 
         /**
-         * The negative of {@code startsWith} is {@link #startsNotWith}.
+         * The negative of {@code startsWith} is {@link #notStartingWith}.
          */
         @Override
         public Text negate() {
-            return startsNotWith;
+            return notStartingWith;
         }
     },
 
-    startsNotWith {
+    /**
+     * Evaluates if the first string does not start with the second.
+     *
+     * @since 3.4.0
+     */
+    notStartingWith {
         @Override
         public boolean test(final String value, final String prefix) {
-            return !startsWith.test(value, prefix);
+            return !startingWith.test(value, prefix);
         }
 
         /**
-         * The negative of {@code startsNotWith} is {@link #startsWith}.
+         * The negative of {@code startsNotWith} is {@link #startingWith}.
          */
         @Override
         public Text negate() {
-            return startsWith;
+            return startingWith;
         }
     },
 
-    endsWith {
+    /**
+     * Evaluates if the first string ends with the second.
+     *
+     * @since 3.4.0
+     */
+    endingWith {
         @Override
         public boolean test(final String value, final String suffix) {
             return value.endsWith(suffix);
         }
 
         /**
-         * The negative of {@code endsWith} is {@link #endsNotWith}.
+         * The negative of {@code endsWith} is {@link #notEndingWith}.
          */
         @Override
         public Text negate() {
-            return endsNotWith;
+            return notEndingWith;
         }
     },
 
-    endsNotWith {
+    /**
+     * Evaluates if the first string does not end with the second.
+     *
+     * @since 3.4.0
+     */
+    notEndingWith {
         @Override
         public boolean test(final String value, final String prefix) {
-            return !endsWith.test(value, prefix);
+            return !endingWith.test(value, prefix);
         }
 
         /**
-         * The negative of {@code endsNotWith} is {@link #endsWith}.
+         * The negative of {@code endsNotWith} is {@link #endingWith}.
          */
         @Override
         public Text negate() {
-            return endsWith;
+            return endingWith;
         }
     },
 
-    contains {
+    /**
+     * Evaluates if the first string contains the second.
+     *
+     * @since 3.4.0
+     */
+    containing {
         @Override
         public boolean test(final String value, final String search) {
             return value.contains(search);
         }
 
         /**
-         * The negative of {@code contains} is {@link #absent}.
+         * The negative of {@code contains} is {@link #notContaining}.
          */
         @Override
         public Text negate() {
-            return absent;
+            return notContaining;
         }
     },
 
-    absent{
+    /**
+     * Evaluates if the first string does not contain the second.
+     *
+     * @since 3.4.0
+     */
+    notContaining {
         @Override
         public boolean test(final String value, final String search) {
-            return !contains.test(value, search);
+            return !containing.test(value, search);
         }
 
         /**
-         * The negative of {@code absent} is {@link #contains}.
+         * The negative of {@code absent} is {@link #containing}.
          */
         @Override
         public Text negate() {
-            return contains;
+            return containing;
         }
     };
 
@@ -120,4 +154,4 @@ public enum Text implements BiPredicate<String, String> {
      */
     @Override
     public abstract Text negate();
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TextP.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TextP.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TextP.java
index 2b1b976..2c28853 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TextP.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TextP.java
@@ -21,6 +21,8 @@ package org.apache.tinkerpop.gremlin.process.traversal;
 import java.util.function.BiPredicate;
 
 /**
+ * Predefined {@code Predicate} values that can be used as {@code String} filters.
+ *
  * @author Daniel Kuppitz (http://gremlin.guru)
  */
 public class TextP extends P<String> {
@@ -56,8 +58,8 @@ public class TextP extends P<String> {
      *
      * @since 3.4.0
      */
-    public static TextP startsWith(final String value) {
-        return new TextP(Text.startsWith, value);
+    public static TextP startingWith(final String value) {
+        return new TextP(Text.startingWith, value);
     }
 
     /**
@@ -65,8 +67,8 @@ public class TextP extends P<String> {
      *
      * @since 3.4.0
      */
-    public static TextP startsNotWith(final String value) {
-        return new TextP(Text.startsNotWith, value);
+    public static TextP notStartingWith(final String value) {
+        return new TextP(Text.notStartingWith, value);
     }
 
     /**
@@ -74,8 +76,8 @@ public class TextP extends P<String> {
      *
      * @since 3.4.0
      */
-    public static TextP endsWith(final String value) {
-        return new TextP(Text.endsWith, value);
+    public static TextP endingWith(final String value) {
+        return new TextP(Text.endingWith, value);
     }
 
     /**
@@ -83,8 +85,8 @@ public class TextP extends P<String> {
      *
      * @since 3.4.0
      */
-    public static TextP endsNotWith(final String value) {
-        return new TextP(Text.endsNotWith, value);
+    public static TextP notEndingWith(final String value) {
+        return new TextP(Text.notEndingWith, value);
     }
 
     /**
@@ -92,8 +94,8 @@ public class TextP extends P<String> {
      *
      * @since 3.4.0
      */
-    public static TextP contains(final String value) {
-        return new TextP(Text.contains, value);
+    public static TextP containing(final String value) {
+        return new TextP(Text.containing, value);
     }
 
     /**
@@ -101,7 +103,7 @@ public class TextP extends P<String> {
      *
      * @since 3.4.0
      */
-    public static TextP absent(final String value) {
-        return new TextP(Text.absent, value);
+    public static TextP notContaining(final String value) {
+        return new TextP(Text.notContaining, value);
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
index 0e21ece..686fd0e 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
@@ -95,20 +95,20 @@ public class PTest {
                     {P.between("m", "n").or(P.eq("daniel")), "daniel", true},
                     {P.between("m", "n").or(P.eq("daniel")), "stephen", false},
                     // text predicates
-                    {TextP.contains("ark"), "marko", true},
-                    {TextP.contains("ark"), "josh", false},
-                    {TextP.startsWith("jo"), "marko", false},
-                    {TextP.startsWith("jo"), "josh", true},
-                    {TextP.endsWith("ter"), "marko", false},
-                    {TextP.endsWith("ter"), "peter", true},
-                    {TextP.contains("o"), "marko", true},
-                    {TextP.contains("o"), "josh", true},
-                    {TextP.contains("o").and(P.gte("j")), "marko", true},
-                    {TextP.contains("o").and(P.gte("j")), "josh", true},
-                    {TextP.contains("o").and(P.gte("j")).and(TextP.endsWith("ko")), "marko", true},
-                    {TextP.contains("o").and(P.gte("j")).and(TextP.endsWith("ko")), "josh", false},
-                    {TextP.contains("o").and(P.gte("j").and(TextP.endsWith("ko"))), "marko", true},
-                    {TextP.contains("o").and(P.gte("j").and(TextP.endsWith("ko"))), "josh", false},
+                    {TextP.containing("ark"), "marko", true},
+                    {TextP.containing("ark"), "josh", false},
+                    {TextP.startingWith("jo"), "marko", false},
+                    {TextP.startingWith("jo"), "josh", true},
+                    {TextP.endingWith("ter"), "marko", false},
+                    {TextP.endingWith("ter"), "peter", true},
+                    {TextP.containing("o"), "marko", true},
+                    {TextP.containing("o"), "josh", true},
+                    {TextP.containing("o").and(P.gte("j")), "marko", true},
+                    {TextP.containing("o").and(P.gte("j")), "josh", true},
+                    {TextP.containing("o").and(P.gte("j")).and(TextP.endingWith("ko")), "marko", true},
+                    {TextP.containing("o").and(P.gte("j")).and(TextP.endingWith("ko")), "josh", false},
+                    {TextP.containing("o").and(P.gte("j").and(TextP.endingWith("ko"))), "marko", true},
+                    {TextP.containing("o").and(P.gte("j").and(TextP.endingWith("ko"))), "josh", false},
             }));
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
index 92c4df6..9533353 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
@@ -329,11 +329,11 @@ public class GraphSONMapperPartialEmbeddedTypeTest extends AbstractGraphSONTest
                 P.without(Arrays.asList(1,2,3,4)),
                 P.eq(1).and(P.eq(2)),
                 P.eq(1).or(P.eq(2)),
-                TextP.contains("ark"),
-                TextP.startsWith("mar"),
-                TextP.endsWith("ko"),
-                TextP.endsWith("ko").and(P.gte("mar")),
-                P.gte("mar").and(TextP.endsWith("ko")));
+                TextP.containing("ark"),
+                TextP.startingWith("mar"),
+                TextP.endingWith("ko"),
+                TextP.endingWith("ko").and(P.gte("mar")),
+                P.gte("mar").and(TextP.endingWith("ko")));
 
         for (P p : variantsOfP) {
             if (p instanceof TextP) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TextP.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TextP.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TextP.cs
index b8e8a64..3047f75 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TextP.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TextP.cs
@@ -49,34 +49,34 @@ namespace Gremlin.Net.Process.Traversal
         }
 
 
-        public static TextP Absent(string value)
+        public static TextP Containing(string value)
         {
-            return new TextP("absent", value);
+            return new TextP("containing", value);
         }
 
-        public static TextP Contains(string value)
+        public static TextP EndingWith(string value)
         {
-            return new TextP("contains", value);
+            return new TextP("endingWith", value);
         }
 
-        public static TextP EndsNotWith(string value)
+        public static TextP NotContaining(string value)
         {
-            return new TextP("endsNotWith", value);
+            return new TextP("notContaining", value);
         }
 
-        public static TextP EndsWith(string value)
+        public static TextP NotEndingWith(string value)
         {
-            return new TextP("endsWith", value);
+            return new TextP("notEndingWith", value);
         }
 
-        public static TextP StartsNotWith(string value)
+        public static TextP NotStartingWith(string value)
         {
-            return new TextP("startsNotWith", value);
+            return new TextP("notStartingWith", value);
         }
 
-        public static TextP StartsWith(string value)
+        public static TextP StartingWith(string value)
         {
-            return new TextP("startsWith", value);
+            return new TextP("startingWith", value);
         }
 
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TextPParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TextPParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TextPParameter.cs
index 5999659..198cd74 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TextPParameter.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TextPParameter.cs
@@ -31,7 +31,7 @@ using Gremlin.Net.Process.Traversal;
 namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
 {
     /// <summary>
-    /// Represents a parameter for a traversal predicate (ie: TextP.contains())
+    /// Represents a parameter for a traversal predicate (ie: TextP.containing())
     /// </summary>
     internal class TextPParameter : ITokenParameter, IEquatable<TextPParameter>
     {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-javascript/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
index 46d96b5..cdbec26 100644
--- a/gremlin-javascript/glv/TraversalSource.template
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -194,12 +194,12 @@ class TextP {
 <% tpmethods.each{ method -> %>
   /** @param {...Object} args */
   static <%= toJs.call(method) %>(...args) {
-    return createTP('<%= method %>', args);
+    return createTextP('<%= method %>', args);
   }
 <% } %>
 }
 
-function createTP(operator, args) {
+function createTextP(operator, args) {
   args.unshift(null, operator);
   return new (Function.prototype.bind.apply(TextP, args));
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index 89f8ddc..81853a6 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -341,38 +341,38 @@ class TextP {
   }
 
   /** @param {...Object} args */
-  static absent(...args) {
-    return createTP('absent', args);
+  static containing(...args) {
+    return createTextP('containing', args);
   }
 
   /** @param {...Object} args */
-  static contains(...args) {
-    return createTP('contains', args);
+  static endingWith(...args) {
+    return createTextP('endingWith', args);
   }
 
   /** @param {...Object} args */
-  static endsNotWith(...args) {
-    return createTP('endsNotWith', args);
+  static notContaining(...args) {
+    return createTextP('notContaining', args);
   }
 
   /** @param {...Object} args */
-  static endsWith(...args) {
-    return createTP('endsWith', args);
+  static notEndingWith(...args) {
+    return createTextP('notEndingWith', args);
   }
 
   /** @param {...Object} args */
-  static startsNotWith(...args) {
-    return createTP('startsNotWith', args);
+  static notStartingWith(...args) {
+    return createTextP('notStartingWith', args);
   }
 
   /** @param {...Object} args */
-  static startsWith(...args) {
-    return createTP('startsWith', args);
+  static startingWith(...args) {
+    return createTextP('startingWith', args);
   }
 
 }
 
-function createTP(operator, args) {
+function createTextP(operator, args) {
   args.unshift(null, operator);
   return new (Function.prototype.bind.apply(TextP, args));
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index 7d7d518..c1458bc 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -327,28 +327,28 @@ class TextP(P):
         P.__init__(self, operator, value, other)
 
     @staticmethod
-    def absent(*args):
-        return TextP("absent", *args)
+    def containing(*args):
+        return TextP("containing", *args)
 
     @staticmethod
-    def contains(*args):
-        return TextP("contains", *args)
+    def endingWith(*args):
+        return TextP("endingWith", *args)
 
     @staticmethod
-    def endsNotWith(*args):
-        return TextP("endsNotWith", *args)
+    def notContaining(*args):
+        return TextP("notContaining", *args)
 
     @staticmethod
-    def endsWith(*args):
-        return TextP("endsWith", *args)
+    def notEndingWith(*args):
+        return TextP("notEndingWith", *args)
 
     @staticmethod
-    def startsNotWith(*args):
-        return TextP("startsNotWith", *args)
+    def notStartingWith(*args):
+        return TextP("notStartingWith", *args)
 
     @staticmethod
-    def startsWith(*args):
-        return TextP("startsWith", *args)
+    def startingWith(*args):
+        return TextP("startingWith", *args)
 
     def __eq__(self, other):
         return isinstance(other, self.__class__) and self.operator == other.operator and self.value == other.value and self.other == other.other
@@ -356,29 +356,29 @@ class TextP(P):
     def __repr__(self):
         return self.operator + "(" + str(self.value) + ")" if self.other is None else self.operator + "(" + str(self.value) + "," + str(self.other) + ")"
 
-def absent(*args):
-    return TextP.absent(*args)
-statics.add_static('absent',absent)
+def containing(*args):
+    return TextP.containing(*args)
+statics.add_static('containing',containing)
 
-def contains(*args):
-    return TextP.contains(*args)
-statics.add_static('contains',contains)
+def endingWith(*args):
+    return TextP.endingWith(*args)
+statics.add_static('endingWith',endingWith)
 
-def endsNotWith(*args):
-    return TextP.endsNotWith(*args)
-statics.add_static('endsNotWith',endsNotWith)
+def notContaining(*args):
+    return TextP.notContaining(*args)
+statics.add_static('notContaining',notContaining)
 
-def endsWith(*args):
-    return TextP.endsWith(*args)
-statics.add_static('endsWith',endsWith)
+def notEndingWith(*args):
+    return TextP.notEndingWith(*args)
+statics.add_static('notEndingWith',notEndingWith)
 
-def startsNotWith(*args):
-    return TextP.startsNotWith(*args)
-statics.add_static('startsNotWith',startsNotWith)
+def notStartingWith(*args):
+    return TextP.notStartingWith(*args)
+statics.add_static('notStartingWith',notStartingWith)
 
-def startsWith(*args):
-    return TextP.startsWith(*args)
-statics.add_static('startsWith',startsWith)
+def startingWith(*args):
+    return TextP.startingWith(*args)
+statics.add_static('startingWith',startingWith)
 
 
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-test/features/filter/Has.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Has.feature b/gremlin-test/features/filter/Has.feature
index e272c05..30fc4b3 100644
--- a/gremlin-test/features/filter/Has.feature
+++ b/gremlin-test/features/filter/Has.feature
@@ -559,55 +559,55 @@ Feature: Step - has()
       | result |
       | d[6].l |
 
-  Scenario: g_V_hasXname_containsXarkXX
+  Scenario: g_V_hasXname_containingXarkXX
     Given the modern graph
     And the traversal of
       """
-      g.V().has("name", TextP.contains("ark"))
+      g.V().has("name", TextP.containing("ark"))
       """
     When iterated to list
     Then the result should be unordered
       | result |
       | v[marko] |
 
-  Scenario: g_V_hasXname_startsWithXmarXX
+  Scenario: g_V_hasXname_startingWithXmarXX
     Given the modern graph
     And the traversal of
       """
-      g.V().has("name", TextP.startsWith("mar"))
+      g.V().has("name", TextP.startingWith("mar"))
       """
     When iterated to list
     Then the result should be unordered
       | result |
       | v[marko] |
 
-  Scenario: g_V_hasXname_endsWithXasXX
+  Scenario: g_V_hasXname_endingWithXasXX
     Given the modern graph
     And the traversal of
       """
-      g.V().has("name", TextP.endsWith("as"))
+      g.V().has("name", TextP.endingWith("as"))
       """
     When iterated to list
     Then the result should be unordered
       | result |
       | v[vadas] |
 
-  Scenario: g_V_hasXperson_name_containsXoX_andXltXmXXX
+  Scenario: g_V_hasXperson_name_containingXoX_andXltXmXXX
     Given the modern graph
     And the traversal of
       """
-      g.V().has("person", "name", TextP.contains("o").and(P.lt("m")))
+      g.V().has("person", "name", TextP.containing("o").and(P.lt("m")))
       """
     When iterated to list
     Then the result should be unordered
       | result |
       | v[josh] |
 
-  Scenario: g_V_hasXname_gtXmX_andXcontainsXoXXX
+  Scenario: g_V_hasXname_gtXmX_andXcontainingXoXXX
     Given the modern graph
     And the traversal of
       """
-      g.V().has("name", P.gt("m").and(TextP.contains("o")))
+      g.V().has("name", P.gt("m").and(TextP.containing("o")))
       """
     When iterated to list
     Then the result should be unordered

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b965861/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
index 8f7d035..ce075da 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
@@ -126,15 +126,15 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Long> get_g_V_hasXage_withoutX27_29X_count();
 
-    public abstract Traversal<Vertex, Vertex> get_g_V_hasXname_containsXarkXX();
+    public abstract Traversal<Vertex, Vertex> get_g_V_hasXname_containingXarkXX();
 
-    public abstract Traversal<Vertex,Vertex> get_g_V_hasXname_startsWithXmarXX();
+    public abstract Traversal<Vertex,Vertex> get_g_V_hasXname_startingWithXmarXX();
 
-    public abstract Traversal<Vertex,Vertex> get_g_V_hasXname_endsWithXasXX();
+    public abstract Traversal<Vertex,Vertex> get_g_V_hasXname_endingWithXasXX();
 
-    public abstract Traversal<Vertex,Vertex> get_g_V_hasXperson_name_containsXoX_andXltXmXXX();
+    public abstract Traversal<Vertex,Vertex> get_g_V_hasXperson_name_containingXoX_andXltXmXXX();
 
-    public abstract Traversal<Vertex,Vertex> get_g_V_hasXname_gtXmX_andXcontainsXoXXX();
+    public abstract Traversal<Vertex,Vertex> get_g_V_hasXname_gtXmX_andXcontainingXoXXX();
 
     @Test
     @LoadGraphWith(MODERN)
@@ -560,8 +560,8 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    public void g_V_hasXname_containsXarkXX() {
-        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_containsXarkXX();
+    public void g_V_hasXname_containingXarkXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_containingXarkXX();
         printTraversalForm(traversal);
         assertTrue(traversal.hasNext());
         assertTrue(traversal.next().value("name").equals("marko"));
@@ -570,8 +570,8 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    public void g_V_hasXname_startsWithXmarXX() {
-        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_startsWithXmarXX();
+    public void g_V_hasXname_startingWithXmarXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_startingWithXmarXX();
         printTraversalForm(traversal);
         assertTrue(traversal.hasNext());
         assertTrue(traversal.next().value("name").equals("marko"));
@@ -580,8 +580,8 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    public void g_V_hasXname_endsWithXasXX() {
-        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_endsWithXasXX();
+    public void g_V_hasXname_endingWithXasXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_endingWithXasXX();
         printTraversalForm(traversal);
         assertTrue(traversal.hasNext());
         assertTrue(traversal.next().value("name").equals("vadas"));
@@ -590,8 +590,8 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    public void g_V_hasXperson_name_containsXoX_andXltXmXXX() {
-        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXperson_name_containsXoX_andXltXmXXX();
+    public void g_V_hasXperson_name_containingXoX_andXltXmXXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXperson_name_containingXoX_andXltXmXXX();
         printTraversalForm(traversal);
         assertTrue(traversal.hasNext());
         assertTrue(traversal.next().value("name").equals("josh"));
@@ -600,8 +600,8 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    public void g_V_hasXname_gtXmX_andXcontainsXoXXX() {
-        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_gtXmX_andXcontainsXoXXX();
+    public void g_V_hasXname_gtXmX_andXcontainingXoXXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_gtXmX_andXcontainingXoXXX();
         printTraversalForm(traversal);
         assertTrue(traversal.hasNext());
         assertTrue(traversal.next().value("name").equals("marko"));
@@ -790,28 +790,28 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasXname_containsXarkXX() {
-            return g.V().has("name", TextP.contains("ark"));
+        public Traversal<Vertex, Vertex> get_g_V_hasXname_containingXarkXX() {
+            return g.V().has("name", TextP.containing("ark"));
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasXname_startsWithXmarXX() {
-            return g.V().has("name", TextP.startsWith("mar"));
+        public Traversal<Vertex, Vertex> get_g_V_hasXname_startingWithXmarXX() {
+            return g.V().has("name", TextP.startingWith("mar"));
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasXname_endsWithXasXX() {
-            return g.V().has("name", TextP.endsWith("as"));
+        public Traversal<Vertex, Vertex> get_g_V_hasXname_endingWithXasXX() {
+            return g.V().has("name", TextP.endingWith("as"));
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasXperson_name_containsXoX_andXltXmXXX() {
-            return g.V().has("person","name", TextP.contains("o").and(P.lt("m")));
+        public Traversal<Vertex, Vertex> get_g_V_hasXperson_name_containingXoX_andXltXmXXX() {
+            return g.V().has("person","name", TextP.containing("o").and(P.lt("m")));
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasXname_gtXmX_andXcontainsXoXXX() {
-            return g.V().has("name", P.gt("m").and(TextP.contains("o")));
+        public Traversal<Vertex, Vertex> get_g_V_hasXname_gtXmX_andXcontainingXoXXX() {
+            return g.V().has("name", P.gt("m").and(TextP.containing("o")));
         }
     }
 }
\ No newline at end of file


[32/48] tinkerpop git commit: TINKERPOP-2041 Fixed .NET tests around TP predicates

Posted by rd...@apache.org.
TINKERPOP-2041 Fixed .NET tests around TP predicates


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

Branch: refs/heads/TINKERPOP-2037
Commit: 79d4a056e311971c765bf1b9bd84b48582df7698
Parents: 68c47af
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 28 08:27:25 2018 -0400
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Oct 4 07:45:08 2018 -0700

----------------------------------------------------------------------
 .../src/Gremlin.Net/Process/Traversal/TP.cs     |  2 +-
 .../Gherkin/TraversalEvaluation/TPParameter.cs  | 97 ++++++++++++++++++++
 .../TraversalEvaluation/TraversalParser.cs      |  4 +
 3 files changed, 102 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/79d4a056/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
index ac6415d..abebd1e 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
@@ -39,7 +39,7 @@ namespace Gremlin.Net.Process.Traversal
     public class TP : P
     {
         /// <summary>
-        ///     Initializes a new instance of the <see cref="P" /> class.
+        ///     Initializes a new instance of the <see cref="TP" /> class.
         /// </summary>
         /// <param name="operatorName">The name of the predicate.</param>
         /// <param name="value">The value of the predicate.</param>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/79d4a056/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TPParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TPParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TPParameter.cs
new file mode 100644
index 0000000..9100c6f
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TPParameter.cs
@@ -0,0 +1,97 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Dynamic;
+using System.Linq;
+using System.Reflection;
+using Gremlin.Net.Process.Traversal;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    /// <summary>
+    /// Represents a parameter for a traversal predicate (ie: TP.contains())
+    /// </summary>
+    internal class TPParameter : ITokenParameter, IEquatable<TPParameter>
+    {
+        private IDictionary<string, object> _contextParameterValues;
+        public IList<Token> Tokens { get; }
+        
+        public TPParameter(IList<Token> tokens)
+        {
+            Tokens = tokens;
+        }
+
+        public bool Equals(TPParameter other)
+        {
+            return Tokens.SequenceEqual(other.Tokens);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((TPParameter) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return Tokens != null ? Tokens.GetHashCode() : 0;
+        }
+
+        public object GetValue()
+        {
+            var type = typeof(TP);
+            object instance = null;
+            for (var i = 1; i < Tokens.Count; i++)
+            {
+                var token = Tokens[i];
+                token.SetContextParameterValues(_contextParameterValues);
+                var method = type.GetMethod(TraversalParser.GetCsharpName(token.Name),
+                    BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);
+                if (method == null)
+                {
+                    throw new InvalidOperationException($"Predicate (TP) method '{token}' not found for testing");
+                }
+                
+                var parameters = method.IsStatic
+                    ? new object[] {token.Parameters.Select(p => p.GetValue().ToString()).First()}
+                    : token.Parameters.Select(p => p.GetValue()).ToArray();
+                instance = method.Invoke(instance, parameters);
+            }
+            return instance;
+        }
+
+        public Type GetParameterType()
+        {
+            return typeof(TP);
+        }
+
+        public void SetContextParameterValues(IDictionary<string, object> parameterValues)
+        {
+            _contextParameterValues = parameterValues;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/79d4a056/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index f8e4095..1065780 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -406,6 +406,10 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 var tokens = ParseTokens(text, ref i);
                 return new StaticTraversalParameter(tokens, text.Substring(startIndex, i - startIndex));
             }
+            if (text.Length >= i + 3 && text.Substring(i, 3) == "TP.")
+            {
+                return new TPParameter(ParseTokens(text, ref i));
+            }
             if (text.Substring(i, 2).StartsWith("P."))
             {
                 return new PParameter(ParseTokens(text, ref i));


[38/48] tinkerpop git commit: Merge branch 'TINKERPOP-2055' into tp32

Posted by rd...@apache.org.
Merge branch 'TINKERPOP-2055' into tp32


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

Branch: refs/heads/TINKERPOP-2037
Commit: 80fa89bdff687f4dcd3c48965be7cb9478fadccc
Parents: b510613 bd7048d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 14:03:44 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 14:03:44 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 docs/src/dev/io/graphson.asciidoc               |  2 +
 .../io/graphson/GraphSONSerializersV2d0.java    | 19 ++++++++--
 .../GraphSONMapperEmbeddedTypeTest.java         | 15 ++++++++
 .../IO/GraphSON/GraphSONReaderTests.cs          | 38 ++++++++++++++++++-
 .../IO/GraphSON/GraphSONWriterTests.cs          | 30 +++++++++++++++
 .../lib/structure/io/type-serializers.js        | 30 ++++++++++++++-
 .../test/unit/graphson-test.js                  | 39 ++++++++++++++++++++
 .../gremlin_python/structure/io/graphson.py     | 26 +++++++++++++
 .../jython/tests/structure/io/test_graphson.py  | 25 +++++++++++++
 10 files changed, 218 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/80fa89bd/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index f3340cc,33d35d3..a7e6388
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -38,10 -37,8 +38,11 @@@ image::https://raw.githubusercontent.co
  * Added support for GraphSON serialization of `Date` in Javascript.
  * Added synchronized `Map` to Gryo 1.0 registrations.
  * Added `Triple` to Gryo 1.0 registrations.
+ * Added support for `Double.NaN`, `Double.POSITIVE_INFINITY` and `Double.NEGATIVE_INFINITY`.
  * Improved escaping of special characters in strings passed to the `GroovyTranslator`.
 +* Added `Cluster` configuration option to set a custom validation script to use to test server connectivity in the Java driver.
 +* Improved ability of `GroovyTranslator` to handle more types supported by GraphSON.
 +* Improved ability of `GroovyTranslator` to handle custom types.
  * Added better internal processing of `Column` in `by(Function)`.
  * Added `hasNext()` support on `Traversal` for `gremlin-python`.
  * Added support for additional extended types in Gremlin.Net with `decimal`, `TimeSpan`, `BigInteger`, `byte`, `byte[]`, `char` and `short`.


[19/48] tinkerpop git commit: Merge branch 'tp33' of https://git-wip-us.apache.org/repos/asf/tinkerpop into tp33

Posted by rd...@apache.org.
Merge branch 'tp33' of https://git-wip-us.apache.org/repos/asf/tinkerpop into tp33


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

Branch: refs/heads/TINKERPOP-2037
Commit: 1faf7629cb7b3882e91a8f437ad23197aba385dc
Parents: 8ca2778 650f31f
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Oct 3 12:33:02 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Oct 3 12:33:02 2018 +0200

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java     | 48 ++++++++++++--------
 .../step/sideEffect/SideEffectCapStep.java      |  4 +-
 2 files changed, 30 insertions(+), 22 deletions(-)
----------------------------------------------------------------------



[47/48] tinkerpop git commit: Merge branch 'tp33'

Posted by rd...@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/73444c32
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/73444c32
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/73444c32

Branch: refs/heads/TINKERPOP-2037
Commit: 73444c321dfebf6b10e516b8f7c39c6039c5a3f6
Parents: 2d69efd d9ccefc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Oct 5 07:02:40 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Oct 5 07:02:40 2018 -0400

----------------------------------------------------------------------
 .../groovy/jsr223/GremlinGroovyScriptEngineTest.java     | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------



[08/48] tinkerpop git commit: TINKERPOP-2055 Added support for special Double values

Posted by rd...@apache.org.
TINKERPOP-2055 Added support for special Double values

Includes Nan and the infinity values.


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

Branch: refs/heads/TINKERPOP-2037
Commit: afc12bd27bc9c4c26b3ba2594c4c0810d5d76421
Parents: e7af98b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 2 15:35:53 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Oct 2 15:35:53 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                               |  1 +
 .../io/graphson/GraphSONSerializersV2d0.java     | 19 ++++++++++++++++---
 .../graphson/GraphSONMapperEmbeddedTypeTest.java | 15 +++++++++++++++
 3 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/afc12bd2/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e93c1c9..33d35d3 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -37,6 +37,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Added support for GraphSON serialization of `Date` in Javascript.
 * Added synchronized `Map` to Gryo 1.0 registrations.
 * Added `Triple` to Gryo 1.0 registrations.
+* Added support for `Double.NaN`, `Double.POSITIVE_INFINITY` and `Double.NEGATIVE_INFINITY`.
 * Improved escaping of special characters in strings passed to the `GroovyTranslator`.
 * Added better internal processing of `Column` in `by(Function)`.
 * Added `hasNext()` support on `Traversal` for `gremlin-python`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/afc12bd2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV2d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV2d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV2d0.java
index 2ddb37a..177e2d0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV2d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV2d0.java
@@ -677,7 +677,7 @@ class GraphSONSerializersV2d0 {
         }
 
         @Override
-        public Integer deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+        public Integer deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
             return jsonParser.getIntValue();
         }
 
@@ -694,8 +694,21 @@ class GraphSONSerializersV2d0 {
         }
 
         @Override
-        public Double deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-            return jsonParser.getDoubleValue();
+        public Double deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+            if (jsonParser.getCurrentToken().isNumeric())
+                return jsonParser.getDoubleValue();
+            else  {
+                final String numberText = jsonParser.getValueAsString();
+                if ("NaN".equalsIgnoreCase(numberText))
+                    return Double.NaN;
+                else if ("-Infinity".equals(numberText) || "-INF".equalsIgnoreCase(numberText))
+                    return Double.NEGATIVE_INFINITY;
+                else if ("Infinity".equals(numberText) || "INF".equals(numberText))
+                    return Double.POSITIVE_INFINITY;
+                else
+                    throw new IllegalStateException("Double value unexpected: " + numberText);
+            }
+
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/afc12bd2/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java
index 9079c8a..e5f2693 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java
@@ -42,7 +42,9 @@ import java.time.Year;
 import java.time.YearMonth;
 import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
 import static org.hamcrest.core.StringStartsWith.startsWith;
 import static org.junit.Assert.assertEquals;
@@ -72,6 +74,19 @@ public class GraphSONMapperEmbeddedTypeTest extends AbstractGraphSONTest {
     public String version;
 
     @Test
+    public void shouldHandleNumberConstants() throws Exception {
+        assumeThat(version, startsWith("v2"));
+
+        final List<Object> o = new ArrayList<>();
+        o.add(123.321d);
+        o.add(Double.NaN);
+        o.add(Double.NEGATIVE_INFINITY);
+        o.add(Double.POSITIVE_INFINITY);
+
+        assertEquals(o, serializeDeserialize(mapper, o, List.class));
+    }
+
+    @Test
     public void shouldHandleBiFunctionLambda() throws Exception {
         assumeThat(version, startsWith("v2"));
 


[15/48] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by rd...@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/650f31f1
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/650f31f1
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/650f31f1

Branch: refs/heads/TINKERPOP-2037
Commit: 650f31f1b8bee2ddfcda56afd41612a2e3d36b6a
Parents: c10bde3 76c9aba
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 06:12:56 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 3 06:12:56 2018 -0400

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java     | 48 ++++++++++++--------
 .../step/sideEffect/SideEffectCapStep.java      |  4 +-
 2 files changed, 30 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/650f31f1/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------


[43/48] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by rd...@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/86b1be53
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/86b1be53
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/86b1be53

Branch: refs/heads/TINKERPOP-2037
Commit: 86b1be53538def07deb337025467ee4b5e04dd37
Parents: 5b9b81f ca034f1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 16:47:46 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 16:47:46 2018 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/process/computer/GraphFilter.java  | 5 +++--
 .../traversal/strategy/optimization/GraphFilterStrategy.java    | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[12/48] tinkerpop git commit: TINKERPOP-2055 Updated IO docs to include special numbers

Posted by rd...@apache.org.
TINKERPOP-2055 Updated IO docs to include special numbers


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

Branch: refs/heads/TINKERPOP-2037
Commit: a083fbff62fcc38a3dae9b138f56b0d052e0c143
Parents: b542027
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 05:30:27 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 3 05:30:27 2018 -0400

----------------------------------------------------------------------
 docs/src/dev/io/graphson.asciidoc | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a083fbff/docs/src/dev/io/graphson.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/io/graphson.asciidoc b/docs/src/dev/io/graphson.asciidoc
index c120634..064ac2e 100644
--- a/docs/src/dev/io/graphson.asciidoc
+++ b/docs/src/dev/io/graphson.asciidoc
@@ -1491,6 +1491,8 @@ types. By default, TinkerPop types will have the namespace "g" (or "gx" for "ext
 
 ==== Double
 
+While the `@value` is expected to be a JSON number, it might also be a `String` of `NaN`, `Infinity` or `-Infinity`.
+
 [source,json]
 ----
 {


[06/48] tinkerpop git commit: TINKERPOP-2040 Added more tests to cover more GraphSON types

Posted by rd...@apache.org.
TINKERPOP-2040 Added more tests to cover more GraphSON types


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

Branch: refs/heads/TINKERPOP-2037
Commit: 67e2ee85dd8048ca21a72889cf8a0218f2add081
Parents: 774371d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Sep 25 13:46:38 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 1 16:18:28 2018 -0400

----------------------------------------------------------------------
 .../groovy/jsr223/GroovyTranslatorTest.java     | 30 ++++++++++++++++++++
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  4 +++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/67e2ee85/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
index 686c7bd..c224642 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
@@ -22,6 +22,9 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223;
 import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.process.traversal.Order;
+import org.apache.tinkerpop.gremlin.process.traversal.Pop;
+import org.apache.tinkerpop.gremlin.process.traversal.Scope;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -31,6 +34,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
+import org.apache.tinkerpop.gremlin.structure.Column;
+import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
@@ -185,6 +190,31 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
     }
 
     @Test
+    public void shouldHandleColumn() {
+        assertTranslation("Column.keys", Column.keys);
+    }
+
+    @Test
+    public void shouldHandleDirection() {
+        assertTranslation("Direction.BOTH", Direction.BOTH);
+    }
+
+    @Test
+    public void shouldHandleOrder() {
+        assertTranslation("Order.decr", Order.decr);
+    }
+
+    @Test
+    public void shouldHandlePop() {
+        assertTranslation("Pop.last", Pop.last);
+    }
+
+    @Test
+    public void shouldHandleScope() {
+        assertTranslation("Scope.local", Scope.local);
+    }
+
+    @Test
     public void shouldOverrideDefaultTypeTranslationWithSomethingBonkers() {
         final String thingToSuffixAllStringsWith = "-why-would-anyone-do-this";
         final String script = GroovyTranslator.of("g", x -> x instanceof String ? x + thingToSuffixAllStringsWith : x).

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/67e2ee85/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 1d122c6..9cd7791 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -22,7 +22,9 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223;
 import groovy.json.StringEscapeUtils;
 import org.apache.commons.configuration.ConfigurationConverter;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.process.traversal.Order;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
@@ -32,6 +34,8 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
+import org.apache.tinkerpop.gremlin.structure.Column;
+import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.Vertex;


[07/48] tinkerpop git commit: TINKERPOP-2040 Provide improved type handling for GroovyTranslator

Posted by rd...@apache.org.
TINKERPOP-2040 Provide improved type handling for GroovyTranslator

Refactored testing and added support for UUID, Date, Timestamp as well as a method to override standard type handling.


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

Branch: refs/heads/TINKERPOP-2037
Commit: 774371dc38d2d73be142eaa69c958226ac660892
Parents: 0403156
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 20 11:53:07 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 1 16:18:28 2018 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/Translator.java   |  34 ++++
 .../groovy/jsr223/GroovyTranslatorTest.java     | 162 +++++++++++++++----
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  32 +++-
 3 files changed, 195 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/774371dc/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Translator.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Translator.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Translator.java
index 7e97fb3..0346092 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Translator.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Translator.java
@@ -19,6 +19,8 @@
 
 package org.apache.tinkerpop.gremlin.process.traversal;
 
+import java.util.function.UnaryOperator;
+
 /**
  * A Translator will translate {@link Bytecode} into another representation. That representation may be a
  * Java instance via {@link StepTranslator} or a String script in some language via {@link ScriptTranslator}.
@@ -55,10 +57,42 @@ public interface Translator<S, T> {
 
     ///
 
+    /**
+     * Translates bytecode to a string representation.
+     */
     public interface ScriptTranslator extends Translator<String, String> {
 
+        /**
+         * Provides a way to customize and override the standard translation process. A {@link ScriptTranslator}
+         * implementation can choose to expose a way to accept a {@code TypeTranslator} which will convert an incoming
+         * object to a different form which will then be normally processed or can return a {@link Handled} object
+         * with the already translated script.
+         */
+        public interface TypeTranslator extends UnaryOperator<Object> {
+            public static TypeTranslator identity() {
+                return t -> t;
+            }
+        }
+
+        /**
+         * Contains a completed type translation from the {@link TypeTranslator}.
+         */
+        public class Handled {
+            private final String translation;
+
+            public Handled(final String translation) {
+                this.translation = translation;
+            }
+
+            public String getTranslation() {
+                return translation;
+            }
+        }
     }
 
+    /**
+     * Translates bytecode to actual steps.
+     */
     public interface StepTranslator<S extends TraversalSource, T extends Traversal.Admin<?, ?>> extends Translator<S, T> {
 
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/774371dc/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
index 942f1a5..686c7bd 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
@@ -22,6 +22,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223;
 import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 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;
@@ -32,47 +33,56 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.Transl
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
 import org.junit.Test;
 
 import javax.script.Bindings;
+import javax.script.ScriptException;
 import javax.script.SimpleBindings;
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Calendar;
 import java.util.Collections;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.UUID;
 import java.util.function.Function;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
 public class GroovyTranslatorTest extends AbstractGremlinTest {
 
+    private static final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
+
     @Test
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldHandleStrategies() throws Exception {
-        GraphTraversalSource g = graph.traversal();
-        g = g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
+        final GraphTraversalSource g = graph.traversal().withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
         }})));
         final Bindings bindings = new SimpleBindings();
         bindings.put("g", g);
-        Traversal.Admin<Vertex, Object> traversal = new GremlinGroovyScriptEngine().eval(g.V().values("name").asAdmin().getBytecode(), bindings, "g");
+        Traversal.Admin<Vertex, Object> traversal = engine.eval(g.V().values("name").asAdmin().getBytecode(), bindings, "g");
         assertEquals("marko", traversal.next());
         assertFalse(traversal.hasNext());
         //
-        traversal = new GremlinGroovyScriptEngine().eval(g.withoutStrategies(SubgraphStrategy.class).V().count().asAdmin().getBytecode(), bindings, "g");
+        traversal = engine.eval(g.withoutStrategies(SubgraphStrategy.class).V().count().asAdmin().getBytecode(), bindings, "g");
         assertEquals(new Long(6), traversal.next());
         assertFalse(traversal.hasNext());
         //
-        traversal = new GremlinGroovyScriptEngine().eval(g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
+        traversal = engine.eval(g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
         }})), ReadOnlyStrategy.instance()).V().values("name").asAdmin().getBytecode(), bindings, "g");
         assertEquals("marko", traversal.next());
@@ -81,10 +91,10 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
 
     @Test
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
-    public void shouldSupportStringSupplierLambdas() throws Exception {
+    public void shouldSupportStringSupplierLambdas() {
         GraphTraversalSource g = graph.traversal();
         g = g.withStrategies(new TranslationStrategy(g, GroovyTranslator.of("g")));
-        GraphTraversal.Admin<Vertex, Integer> t = g.withSideEffect("lengthSum", 0).withSack(1)
+        final GraphTraversal.Admin<Vertex, Integer> t = g.withSideEffect("lengthSum", 0).withSack(1)
                 .V()
                 .filter(Lambda.predicate("it.get().label().equals('person')"))
                 .flatMap(Lambda.function("it.get().vertices(Direction.OUT)"))
@@ -130,25 +140,77 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
                         ".order().by({a,b -> a <=> b})" +
                         ".sack({ a,b -> a + b })",
                 script);
+        assertThatScriptOk(script, "g", g);
     }
 
     @Test
     @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
     public void shouldHandleMaps() {
-        final GraphTraversalSource g = graph.traversal();
         final String script = GroovyTranslator.of("g").translate(g.V().id().is(new LinkedHashMap<Object,Object>() {{
             put(3, "32");
             put(Arrays.asList(1, 2, 3.1d), 4);
         }}).asAdmin().getBytecode());
         assertEquals("g.V().id().is([((int) 3):(\"32\"),([(int) 1, (int) 2, 3.1d]):((int) 4)])", script);
+        assertThatScriptOk(script, "g", g);
     }
 
     @Test
     public void shouldHandleEmptyMaps() {
         final Function identity = new Lambda.OneArgLambda("it.get()", "gremlin-groovy");
-        final GraphTraversalSource g = graph.traversal();
         final String script = GroovyTranslator.of("g").translate(g.inject(Collections.emptyMap()).map(identity).asAdmin().getBytecode());
         assertEquals("g.inject([]).map({it.get()})", script);
+        assertThatScriptOk(script, "g", g);
+    }
+
+    @Test
+    public void shouldHandleDate() {
+        final Calendar c = Calendar.getInstance();
+        c.set(1975, Calendar.SEPTEMBER, 7);
+        final Date d = c.getTime();
+        assertTranslation(String.format("new java.util.Date(%s)", d.getTime()), d);
+    }
+
+    @Test
+    public void shouldHandleTimestamp() {
+        final Calendar c = Calendar.getInstance();
+        c.set(1975, Calendar.SEPTEMBER, 7);
+        final Timestamp t = new Timestamp(c.getTime().getTime());
+        assertTranslation(String.format("new java.sql.Timestamp(%s)", t.getTime()), t);
+    }
+
+    @Test
+    public void shouldHandleUuid() {
+        final UUID uuid = UUID.fromString("ffffffff-fd49-1e4b-0000-00000d4b8a1d");
+        assertTranslation(String.format("java.util.UUID.fromString('%s')", uuid), uuid);
+    }
+
+    @Test
+    public void shouldOverrideDefaultTypeTranslationWithSomethingBonkers() {
+        final String thingToSuffixAllStringsWith = "-why-would-anyone-do-this";
+        final String script = GroovyTranslator.of("g", x -> x instanceof String ? x + thingToSuffixAllStringsWith : x).
+                translate(g.inject("yyy", "xxx").asAdmin().getBytecode());
+        assertEquals(String.format("g.inject(\"yyy%s\",\"xxx%s\")", thingToSuffixAllStringsWith, thingToSuffixAllStringsWith), script);
+        assertThatScriptOk(script, "g", g);
+    }
+
+    @Test
+    public void shouldIncludeCustomTypeTranslationForSomethingSilly() {
+        final SillyClass notSillyEnough = SillyClass.from("not silly enough", 100);
+        final GraphTraversalSource g = graph.traversal();
+
+        // without type translation we get uglinesss
+        final String scriptBad = GroovyTranslator.of("g").
+                translate(g.inject(notSillyEnough).asAdmin().getBytecode());
+        assertEquals(String.format("g.inject(%s)", "not silly enough:100"), scriptBad);
+
+        // with type translation we get valid gremlin
+        final String scriptGood = GroovyTranslator.of("g",
+                x -> x instanceof SillyClass ?
+                        new Translator.ScriptTranslator.Handled(String.format("org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslatorTest.SillyClass.from('%s', (int) %s)",
+                        ((SillyClass) x).getX(), ((SillyClass) x).getY())) : x).
+                translate(g.inject(notSillyEnough).asAdmin().getBytecode());
+        assertEquals(String.format("g.inject(org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslatorTest.SillyClass.from('%s', (int) %s))", notSillyEnough.getX(), notSillyEnough.getY()), scriptGood);
+        assertThatScriptOk(scriptGood, "g", g);
     }
 
     @Test
@@ -158,20 +220,8 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
 
     @Test
     public void shouldEscapeStrings() {
-        final GraphTraversalSource g = graph.traversal();
-        final String script = GroovyTranslator.of("g").translate(g.addV("customer")
-                .property("customer_id", 501L)
-                .property("name", "Foo\u0020Bar")
-                .property("age", 25)
-                .property("special", "`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?")
-                .asAdmin().getBytecode());
-
-        assertEquals("g.addV(\"customer\")" +
-                        ".property(\"customer_id\",501L)" +
-                        ".property(\"name\",\"Foo Bar\")" +
-                        ".property(\"age\",(int) 25)" +
-                        ".property(\"special\",\"\"\"`~!@#\\$%^&*()-_=+[{]}\\\\|;:'\\\",<.>/?\"\"\")",
-                script);
+        assertTranslation("501L,\"Foo Bar\",(int) 25,\"\"\"`~!@#\\$%^&*()-_=+[{]}\\\\|;:'\\\",<.>/?\"\"\"",
+                501L, "Foo\u0020Bar", 25, "`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?");
     }
 
     @Test
@@ -181,33 +231,87 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
         final Object id1 = "customer:10:foo\u0020bar\u0020\u0024100#90"; // customer:10:foo bar $100#90
         final Vertex vertex1 = DetachedVertex.build().setLabel("customer").setId(id1)
                 .create();
-        final String script1 = GroovyTranslator.of("g").translate(g.V(vertex1).asAdmin().getBytecode());
-        assertEquals("g.V(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(" +
+        final String script1 = GroovyTranslator.of("g").translate(g.inject(vertex1).asAdmin().getBytecode());
+        assertEquals("g.inject(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(" +
                         "\"customer:10:foo bar \\$100#90\"," +
                         "\"customer\", Collections.emptyMap()))",
                 script1);
+        assertThatScriptOk(script1, "g", g);
 
         final Object id2 = "user:20:foo\\u0020bar\\u005c\\u0022mr\\u005c\\u0022\\u00241000#50"; // user:20:foo\u0020bar\u005c\u0022mr\u005c\u0022\u00241000#50
         final Vertex vertex2 = DetachedVertex.build().setLabel("user").setId(id2)
                 .create();
-        final String script2 = GroovyTranslator.of("g").translate(g.V(vertex2).asAdmin().getBytecode());
-        assertEquals("g.V(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(" +
+        final String script2 = GroovyTranslator.of("g").translate(g.inject(vertex2).asAdmin().getBytecode());
+        assertEquals("g.inject(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(" +
                         "\"user:20:foo\\\\u0020bar\\\\u005c\\\\u0022mr\\\\u005c\\\\u0022\\\\u00241000#50\"," +
                         "\"user\", Collections.emptyMap()))",
                 script2);
+        assertThatScriptOk(script2, "g", g);
 
         final Object id3 = "knows:30:foo\u0020bar\u0020\u0024100:\\u0020\\u0024500#70";
         final Edge edge = DetachedEdge.build().setLabel("knows").setId(id3)
                 .setOutV((DetachedVertex) vertex1)
                 .setInV((DetachedVertex) vertex2)
                 .create();
-        final String script3 = GroovyTranslator.of("g").translate(g.E(edge).asAdmin().getBytecode());
-        assertEquals("g.E(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge(" +
+        final String script3 = GroovyTranslator.of("g").translate(g.inject(edge).asAdmin().getBytecode());
+        assertEquals("g.inject(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge(" +
                         "\"knows:30:foo bar \\$100:\\\\u0020\\\\u0024500#70\"," +
                         "\"knows\",Collections.emptyMap()," +
                         "\"customer:10:foo bar \\$100#90\",\"customer\"," +
                         "\"user:20:foo\\\\u0020bar\\\\u005c\\\\u0022mr\\\\u005c\\\\u0022\\\\u00241000#50\",\"user\"))",
                 script3);
+        assertThatScriptOk(script3, "g", g);
+    }
+
+    public static Object eval(final String s, final Object... args) throws ScriptException {
+        return engine.eval(s, new SimpleBindings(ElementHelper.asMap(args)));
+    }
+
+    public static Object eval(final String s, final Bindings b) throws ScriptException {
+        return engine.eval(s, b);
+    }
+
+    private void assertTranslation(final String expectedTranslation, final Object... objs) {
+        final String script = GroovyTranslator.of("g").translate(g.inject(objs).asAdmin().getBytecode());
+        assertEquals(String.format("g.inject(%s)", expectedTranslation), script);
+        assertThatScriptOk(script, "g", g);
+    }
+
+    private void assertThatScriptOk(final String s, final Object... args) {
+        try {
+            assertNotNull(eval(s, args));
+        } catch (ScriptException se) {
+            se.printStackTrace();
+            fail("Script should have eval'd");
+        }
+    }
+
+    public static class SillyClass {
+
+        private final String x;
+        private final int y;
+
+        private SillyClass(final String x, final int y) {
+            this.x = x;
+            this.y = y;
+        }
+
+        public static SillyClass from(final String x, final int y) {
+            return new SillyClass(x, y);
+        }
+
+        public String getX() {
+            return x;
+        }
+
+        public int getY() {
+            return y;
+        }
+
+        @Override
+        public String toString() {
+            return x + ":" + String.valueOf(y);
+        }
     }
 
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/774371dc/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 0452e0b..1d122c6 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -39,11 +39,16 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
 
+import java.sql.Timestamp;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
+import java.util.UUID;
+import java.util.function.UnaryOperator;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -53,13 +58,19 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
     private static final boolean IS_TESTING = Boolean.valueOf(System.getProperty("is.testing", "false"));
 
     private final String traversalSource;
+    private final TypeTranslator typeTranslator;
 
-    private GroovyTranslator(final String traversalSource) {
+    private GroovyTranslator(final String traversalSource, final TypeTranslator typeTranslator) {
         this.traversalSource = traversalSource;
+        this.typeTranslator = typeTranslator;
     }
 
     public static final GroovyTranslator of(final String traversalSource) {
-        return new GroovyTranslator(traversalSource);
+        return of(traversalSource, TypeTranslator.identity());
+    }
+
+    public static final GroovyTranslator of(final String traversalSource, final TypeTranslator typeTranslator) {
+        return new GroovyTranslator(traversalSource, Optional.ofNullable(typeTranslator).orElse(TypeTranslator.identity()));
     }
 
     ///////
@@ -108,8 +119,15 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
         return traversalScript.toString();
     }
 
-    private String convertToString(final Object object) {
-        if (object instanceof Bytecode.Binding)
+    private String convertToString(final Object o) {
+        // a TypeTranslator that returns Handled means that the typetranslator figure out how to convert the
+        // object to a string and it should be used as-is, otherwise it gets passed down the line through the normal
+        // process
+        final Object object = typeTranslator.apply(o);
+
+        if (object instanceof Handled)
+            return ((Handled) object).getTranslation();
+        else if (object instanceof Bytecode.Binding)
             return ((Bytecode.Binding) object).variable();
         else if (object instanceof Bytecode)
             return this.internalTranslate("__", (Bytecode) object);
@@ -155,6 +173,12 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             return "(int) " + object;
         else if (object instanceof Class)
             return ((Class) object).getCanonicalName();
+        else if (object instanceof Timestamp)
+            return "new java.sql.Timestamp(" + ((Timestamp) object).getTime() + ")";
+        else if (object instanceof Date)
+            return "new java.util.Date(" + ((Date) object).getTime() + ")";
+        else if (object instanceof UUID)
+            return "java.util.UUID.fromString('" + object.toString() + "')";
         else if (object instanceof P)
             return convertPToString((P) object, new StringBuilder()).toString();
         else if (object instanceof SackFunctions.Barrier)


[27/48] tinkerpop git commit: TINKERPOP-2044 Configurable traversal to validate host connectivity.

Posted by rd...@apache.org.
TINKERPOP-2044 Configurable traversal to validate host connectivity.


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

Branch: refs/heads/TINKERPOP-2037
Commit: b510613b10962a3e8d95c3e590b5f58297227d0e
Parents: 88d6f77
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Sep 28 15:54:30 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 08:16:44 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../src/reference/gremlin-applications.asciidoc |  1 +
 .../tinkerpop/gremlin/driver/Cluster.java       | 30 ++++++++++++++++++--
 .../gremlin/driver/ConnectionPool.java          |  3 +-
 .../tinkerpop/gremlin/driver/Settings.java      | 15 +++++++---
 .../tinkerpop/gremlin/driver/SettingsTest.java  |  8 ++++--
 .../server/GremlinDriverIntegrateTest.java      | 27 +++++++++++++++++-
 7 files changed, 74 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b510613b/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index c4523d8..f3340cc 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -39,6 +39,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * Added synchronized `Map` to Gryo 1.0 registrations.
 * Added `Triple` to Gryo 1.0 registrations.
 * Improved escaping of special characters in strings passed to the `GroovyTranslator`.
+* Added `Cluster` configuration option to set a custom validation script to use to test server connectivity in the Java driver.
 * Improved ability of `GroovyTranslator` to handle more types supported by GraphSON.
 * Improved ability of `GroovyTranslator` to handle custom types.
 * Added better internal processing of `Column` in `by(Function)`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b510613b/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index 1cd9964..5607667 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -750,6 +750,7 @@ The following table describes the various configuration options for the Gremlin
 |connectionPool.sslSkipCertValidation |Configures the `TrustManager` to trust all certs without any validation. Should not be used in production.|false
 |connectionPool.trustStore |File location for a SSL Certificate Chain to use when SSL is enabled. If this value is not provided and SSL is enabled, the default `TrustManager` will be used. |_none_
 |connectionPool.trustStorePassword |The password of the `trustStore` if it is password-protected |_none_
+|connectionPool.validationRequest |A script that is used to test server connectivity. A good script to use is one that evaluates quickly and returns no data. The default simply returns an empty string, but if a graph is required by a particular provider, a good traversal might be `g.inject()`. |_''_
 |hosts |The list of hosts that the driver will connect to. |localhost
 |jaasEntry |Sets the `AuthProperties.Property.JAAS_ENTRY` properties for authentication to Gremlin Server. |_none_
 |nioPoolSize |Size of the pool for handling request/response operations. |available processors

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b510613b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
index 9adaaa1..c090584 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
@@ -25,11 +25,16 @@ import io.netty.handler.ssl.SslContextBuilder;
 import io.netty.handler.ssl.SslProvider;
 import io.netty.handler.ssl.util.InsecureTrustManagerFactory;
 import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.driver.message.RequestMessage;
 import org.apache.tinkerpop.gremlin.driver.ser.Serializers;
 import io.netty.bootstrap.Bootstrap;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.nio.NioEventLoopGroup;
 import org.apache.commons.lang3.concurrent.BasicThreadFactory;
+import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion;
+import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -60,10 +65,10 @@ import java.util.Optional;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.Supplier;
 import java.util.stream.Collectors;
 
 /**
@@ -204,7 +209,8 @@ public final class Cluster {
                 .maxSimultaneousUsagePerConnection(settings.connectionPool.maxSimultaneousUsagePerConnection)
                 .minSimultaneousUsagePerConnection(settings.connectionPool.minSimultaneousUsagePerConnection)
                 .maxConnectionPoolSize(settings.connectionPool.maxSize)
-                .minConnectionPoolSize(settings.connectionPool.minSize);
+                .minConnectionPoolSize(settings.connectionPool.minSize)
+                .validationRequest(settings.connectionPool.validationRequest);
 
         if (settings.username != null && settings.password != null)
             builder.credentials(settings.username, settings.password);
@@ -465,6 +471,10 @@ public final class Cluster {
         return manager.authProps;
     }
 
+    RequestMessage.Builder validationRequest() {
+        return manager.validationRequest.get();
+    }
+
     SslContext createSSLContext() throws Exception {
         // if the context is provided then just use that and ignore the other settings
         if (manager.sslContextOptional.isPresent())
@@ -575,6 +585,7 @@ public final class Cluster {
         private String trustStore = null;
         private String trustStorePassword = null;
         private String keyStoreType = null;
+        private String validationRequest = "''";
         private List<String> sslEnabledProtocols = new ArrayList<>();
         private List<String> sslCipherSuites = new ArrayList<>();
         private boolean sslSkipCertValidation = false;
@@ -889,6 +900,17 @@ public final class Cluster {
         }
 
         /**
+         * Specify a valid Gremlin script that can be used to test remote operations. This script should be designed
+         * to return quickly with the least amount of overhead possible. By default, the script sends an empty string.
+         * If the graph does not support that sort of script because it requires all scripts to include a reference
+         * to a graph then a good option might be {@code g.inject()}.
+         */
+        public Builder validationRequest(final String script) {
+            validationRequest = script;
+            return this;
+        }
+
+        /**
          * Time in milliseconds to wait before attempting to reconnect to a dead host after it has been marked dead.
          *
          * @deprecated As of release 3.2.3, the value of the initial delay is now the same as the {@link #reconnectInterval}.
@@ -1020,6 +1042,7 @@ public final class Cluster {
         private final LoadBalancingStrategy loadBalancingStrategy;
         private final AuthProperties authProps;
         private final Optional<SslContext> sslContextOptional;
+        private final Supplier<RequestMessage.Builder> validationRequest;
 
         private final ScheduledThreadPoolExecutor executor;
 
@@ -1066,6 +1089,7 @@ public final class Cluster {
             connectionPoolSettings.sslSkipCertValidation = builder.sslSkipCertValidation;
             connectionPoolSettings.keepAliveInterval = builder.keepAliveInterval;
             connectionPoolSettings.channelizer = builder.channelizer;
+            connectionPoolSettings.validationRequest = builder.validationRequest;
 
             sslContextOptional = Optional.ofNullable(builder.sslContext);
 
@@ -1079,6 +1103,8 @@ public final class Cluster {
             this.executor = new ScheduledThreadPoolExecutor(builder.workerPoolSize,
                     new BasicThreadFactory.Builder().namingPattern("gremlin-driver-worker-%d").build());
             this.executor.setRemoveOnCancelPolicy(true);
+
+            validationRequest = () -> RequestMessage.build(Tokens.OPS_EVAL).add(Tokens.ARGS_GREMLIN, builder.validationRequest);
         }
 
         private void validateBuilder(final Builder builder) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b510613b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
index 8d63e13..39ded33 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
@@ -387,7 +387,6 @@ final class ConnectionPool {
 
         // let the load-balancer know that the host is acting poorly
         this.cluster.loadBalancingStrategy().onUnavailable(host);
-
     }
 
     /**
@@ -400,7 +399,7 @@ final class ConnectionPool {
         Connection connection = null;
         try {
             connection = borrowConnection(cluster.connectionPoolSettings().maxWaitForConnection, TimeUnit.MILLISECONDS);
-            final RequestMessage ping = RequestMessage.build(Tokens.OPS_EVAL).add(Tokens.ARGS_GREMLIN, "''").create();
+            final RequestMessage ping = client.buildMessage(cluster.validationRequest()).create();
             final CompletableFuture<ResultSet> f = new CompletableFuture<>();
             connection.write(ping, f);
             f.get().all().get();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b510613b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
index fedd337..c2ae045 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
@@ -243,6 +243,8 @@ final class Settings {
             if (connectionPoolConf.containsKey("keepAliveInterval"))
                 cpSettings.keepAliveInterval = connectionPoolConf.getLong("keepAliveInterval");
 
+            if (connectionPoolConf.containsKey("validationRequest"))
+                cpSettings.validationRequest = connectionPoolConf.getString("validationRequest");
 
             settings.connectionPool = cpSettings;
         }
@@ -258,28 +260,28 @@ final class Settings {
 
         /**
          * The trusted certificate in PEM format.
-         * @deprecated As of release 3.2.10, replaced by {@link trustStore}
+         * @deprecated As of release 3.2.10, replaced by {@link #trustStore}
          */
         @Deprecated
         public String trustCertChainFile = null;
 
         /**
          * The X.509 certificate chain file in PEM format.
-         * @deprecated As of release 3.2.10, replaced by {@link keyStore}
+         * @deprecated As of release 3.2.10, replaced by {@link #keyStore}
          */
         @Deprecated
         public String keyCertChainFile = null;
 
         /**
          * The PKCS#8 private key file in PEM format.
-         * @deprecated As of release 3.2.10, replaced by {@link keyStore}
+         * @deprecated As of release 3.2.10, replaced by {@link #keyStore}
          */
         @Deprecated
         public String keyFile = null;
 
         /**
          * The password of the {@link #keyFile}, or {@code null} if it's not password-protected.
-         * @deprecated As of release 3.2.10, replaced by {@link keyStorePassword}
+         * @deprecated As of release 3.2.10, replaced by {@link #keyStorePassword}
          */
         @Deprecated
         public String keyPassword = null;
@@ -420,6 +422,11 @@ final class Settings {
         public String channelizer = Channelizer.WebSocketChannelizer.class.getName();
 
         /**
+         * A valid Gremlin script that can be used to test remote operations.
+         */
+        public String validationRequest = "''";
+
+        /**
          * @deprecated as of 3.1.1-incubating, and not replaced as this property was never implemented internally
          * as the way to establish sessions
          */

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b510613b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
index 56e0ec8..63c4308 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
@@ -18,7 +18,9 @@
  */
 package org.apache.tinkerpop.gremlin.driver;
 
+import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
 
 import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.Configuration;
@@ -69,6 +71,7 @@ public class SettingsTest {
         conf.setProperty("connectionPool.reconnectInitialDelay", 1000);
         conf.setProperty("connectionPool.resultIterationBatchSize", 1100);
         conf.setProperty("connectionPool.channelizer", "channelizer0");
+        conf.setProperty("connectionPool.validationRequest", "g.inject()");
 
         final Settings settings = Settings.from(conf);
 
@@ -82,7 +85,7 @@ public class SettingsTest {
         assertEquals(Arrays.asList("255.0.0.1", "255.0.0.2", "255.0.0.3"), settings.hosts);
         assertEquals("my.serializers.MySerializer", settings.serializer.className);
         assertEquals("thing", settings.serializer.config.get("any"));
-        assertEquals(true, settings.connectionPool.enableSsl);
+        assertThat(settings.connectionPool.enableSsl, is(true));
         assertEquals("X.509", settings.connectionPool.keyCertChainFile);
         assertEquals("PKCS#8", settings.connectionPool.keyFile);
         assertEquals("password1", settings.connectionPool.keyPassword);
@@ -94,7 +97,7 @@ public class SettingsTest {
         assertEquals("password3", settings.connectionPool.trustStorePassword);
         assertEquals(Arrays.asList("TLSv1.1","TLSv1.2"), settings.connectionPool.sslEnabledProtocols);
         assertEquals(Arrays.asList("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384", "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"), settings.connectionPool.sslCipherSuites);
-        assertEquals(true, settings.connectionPool.sslSkipCertValidation);
+        assertThat(settings.connectionPool.sslSkipCertValidation, is(true));
         assertEquals(100, settings.connectionPool.minSize);
         assertEquals(200, settings.connectionPool.maxSize);
         assertEquals(300, settings.connectionPool.minSimultaneousUsagePerConnection);
@@ -107,5 +110,6 @@ public class SettingsTest {
         assertEquals(1000, settings.connectionPool.reconnectInitialDelay);
         assertEquals(1100, settings.connectionPool.resultIterationBatchSize);
         assertEquals("channelizer0", settings.connectionPool.channelizer);
+        assertEquals("g.inject()", settings.connectionPool.validationRequest);
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b510613b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
index c5ff608..1f759d0 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
@@ -285,7 +285,7 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
     }
 
     @Test
-    public void shouldEventuallySucceedOnSameServer() throws Exception {
+    public void shouldEventuallySucceedOnSameServerWithDefault() throws Exception {
         stopServer();
 
         final Cluster cluster = TestClientFactory.open();
@@ -310,6 +310,31 @@ public class GremlinDriverIntegrateTest extends AbstractGremlinServerIntegration
     }
 
     @Test
+    public void shouldEventuallySucceedOnSameServerWithScript() throws Exception {
+        stopServer();
+
+        final Cluster cluster = TestClientFactory.build().validationRequest("g.inject()").create();
+        final Client client = cluster.connect();
+
+        try {
+            client.submit("1+1").all().join().get(0).getInt();
+            fail("Should not have gone through because the server is not running");
+        } catch (Exception i) {
+            final Throwable root = ExceptionUtils.getRootCause(i);
+            assertThat(root, instanceOf(TimeoutException.class));
+        }
+
+        startServer();
+
+        // default reconnect time is 1 second so wait some extra time to be sure it has time to try to bring it
+        // back to life
+        TimeUnit.SECONDS.sleep(3);
+        assertEquals(2, client.submit("1+1").all().join().get(0).getInt());
+
+        cluster.close();
+    }
+
+    @Test
     public void shouldEventuallySucceedWithRoundRobin() throws Exception {
         final String noGremlinServer = "74.125.225.19";
         final Cluster cluster = TestClientFactory.build().addContactPoint(noGremlinServer).create();


[26/48] tinkerpop git commit: Merge branch 'TINKERPOP-2049'

Posted by rd...@apache.org.
Merge branch 'TINKERPOP-2049'


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

Branch: refs/heads/TINKERPOP-2037
Commit: 3a8f580880796fb81619c3572ab2167088320026
Parents: 2ae8c5b 9b4cddb
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 06:48:39 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 06:48:39 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                 |  2 +-
 .../traversal/dsl/graph/GraphTraversal.java        | 17 +++++++++++++++++
 .../traversal/dsl/graph/GraphTraversalTest.java    | 15 +++++++++++++--
 .../Process/Traversal/GraphTraversal.cs            |  9 +++++++++
 gremlin-test/features/map/ShortestPath.feature     |  4 ++--
 .../traversal/step/map/ShortestPathTest.java       |  4 ++--
 6 files changed, 44 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3a8f5808/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------


[34/48] tinkerpop git commit: Renamed `TP` to `TextP` as proposed by @robertdale

Posted by rd...@apache.org.
Renamed `TP` to `TextP` as proposed by @robertdale


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

Branch: refs/heads/TINKERPOP-2037
Commit: f057fb3601ab12dfe8dc10361c9916c904fc5a0d
Parents: 79d4a05
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Oct 1 09:27:35 2018 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Oct 4 07:45:08 2018 -0700

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc       |  16 +--
 docs/src/upgrade/release-3.4.x.asciidoc         |   2 +-
 .../tinkerpop/gremlin/jsr223/CoreImports.java   |   6 +-
 .../tinkerpop/gremlin/process/traversal/TP.java | 107 -------------------
 .../gremlin/process/traversal/TextP.java        | 107 +++++++++++++++++++
 .../structure/io/graphson/GraphSONModule.java   |  10 +-
 .../io/graphson/TraversalSerializersV2d0.java   |  12 +--
 .../io/graphson/TraversalSerializersV3d0.java   |  12 +--
 .../structure/io/gryo/GryoSerializersV1d0.java  |  10 +-
 .../structure/io/gryo/GryoSerializersV3d0.java  |  10 +-
 .../gremlin/structure/io/gryo/GryoVersion.java  |   6 +-
 .../gremlin/process/traversal/PTest.java        |  28 ++---
 .../GraphSONMapperPartialEmbeddedTypeTest.java  |  16 +--
 gremlin-dotnet/glv/TP.template                  |  71 ------------
 gremlin-dotnet/glv/TextP.template               |  71 ++++++++++++
 gremlin-dotnet/glv/generate.groovy              |  12 +--
 .../src/Gremlin.Net/Process/Traversal/TP.cs     |  96 -----------------
 .../src/Gremlin.Net/Process/Traversal/TextP.cs  |  96 +++++++++++++++++
 .../Structure/IO/GraphSON/GraphSONWriter.cs     |   2 +-
 .../Structure/IO/GraphSON/TPSerializer.cs       |  45 --------
 .../Structure/IO/GraphSON/TextPSerializer.cs    |  45 ++++++++
 .../Gherkin/TraversalEvaluation/TPParameter.cs  |  97 -----------------
 .../TraversalEvaluation/TextPParameter.cs       |  97 +++++++++++++++++
 .../TraversalEvaluation/TraversalParser.cs      |   6 +-
 .../gremlin/groovy/jsr223/GroovyTranslator.java |   8 +-
 gremlin-javascript/glv/TraversalSource.template |   6 +-
 gremlin-javascript/glv/generate.groovy          |   6 +-
 .../main/javascript/gremlin-javascript/index.js |   2 +-
 .../gremlin-javascript/lib/process/traversal.js |   6 +-
 .../lib/structure/io/graph-serializer.js        |   4 +-
 .../lib/structure/io/type-serializers.js        |  10 +-
 .../test/cucumber/feature-steps.js              |   2 +-
 gremlin-python/glv/TraversalSource.template     |   6 +-
 gremlin-python/glv/generate.groovy              |   6 +-
 .../gremlin/python/jsr223/PythonTranslator.java |   8 +-
 .../jython/gremlin_python/process/traversal.py  |  26 ++---
 .../gremlin_python/structure/io/graphsonV2d0.py |   8 +-
 .../gremlin_python/structure/io/graphsonV3d0.py |   8 +-
 .../src/main/jython/radish/feature_steps.py     |   4 +-
 gremlin-test/features/filter/Has.feature        |  10 +-
 .../process/traversal/step/filter/HasTest.java  |  12 +--
 41 files changed, 556 insertions(+), 556 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index da7260c..fdd261a 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -3357,8 +3357,8 @@ interface. Steps that allow for this type of modulation will explicitly state so
 == A Note on Predicates
 
 A `P` is a predicate of the form `Function<Object,Boolean>`. That is, given some object, return true or false. As of
-the relase of TinkerPop 3.4.0, Gremlin also supports simple text predicates, which only work on `String` values. The `TP`
-text predicates extends the `P` predicates, but are specialized in that they are of the form `Function<String,Boolean>`.
+the relase of TinkerPop 3.4.0, Gremlin also supports simple text predicates, which only work on `String` values. The `TextP`
+text predicates extend the `P` predicates, but are specialized in that they are of the form `Function<String,Boolean>`.
 The provided predicates are outlined in the table below and are used in various steps such as <<has-step,`has()`>>-step,
 <<where-step,`where()`>>-step, <<is-step,`is()`>>-step, etc.
 
@@ -3376,12 +3376,12 @@ The provided predicates are outlined in the table below and are used in various
 | `P.between(number,number)` | Is the incoming number greater than or equal to the first provided number and less than the second?
 | `P.within(objects...)` | Is the incoming object in the array of provided objects?
 | `P.without(objects...)` | Is the incoming object not in the array of the provided objects?
-| `TP.startsWith(string)` | Does the incoming `String` start with the provided `String`?
-| `TP.endsWith(string)` | Does the incoming `String` end with the provided `String`?
-| `TP.contains(string)` | Does the incoming `String` contain the provided `String`?
-| `TP.startsNotWith(string)` | TODO: find a better name
-| `TP.endsNotWith(string)` | TODO: find a better name
-| `TP.absent(string)` | TODO: find a better name
+| `TextP.startsWith(string)` | Does the incoming `String` start with the provided `String`?
+| `TextP.endsWith(string)` | Does the incoming `String` end with the provided `String`?
+| `TextP.contains(string)` | Does the incoming `String` contain the provided `String`?
+| `TextP.startsNotWith(string)` | TODO: find a better name
+| `TextP.endsNotWith(string)` | TODO: find a better name
+| `TextP.absent(string)` | TODO: find a better name
 |=========================================================
 
 [gremlin-groovy]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/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 c26b9c7..213577a 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -31,7 +31,7 @@ Please see the link:https://github.com/apache/tinkerpop/blob/3.4.0/CHANGELOG.asc
 
 ==== Added text predicates
 
-Gremlin now supports simple text predicates on top of the existing `P` predicates. Both, the new `TP` text predicates and the old `P` predicates, can be chained using `and()` and `or()`.
+Gremlin now supports simple text predicates on top of the existing `P` predicates. Both, the new `TextP` text predicates and the old `P` predicates, can be chained using `and()` and `or()`.
 
 [source,groovy]
 ----

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
index 38ef258..d60502a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
@@ -67,7 +67,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
@@ -182,7 +182,7 @@ public final class CoreImports {
         CLASS_IMPORTS.add(TraversalOptionParent.class);
         CLASS_IMPORTS.add(TraversalOptionParent.Pick.class);
         CLASS_IMPORTS.add(P.class);
-        CLASS_IMPORTS.add(TP.class);
+        CLASS_IMPORTS.add(TextP.class);
         // remote
         CLASS_IMPORTS.add(RemoteConnection.class);
         CLASS_IMPORTS.add(RemoteGraph.class);
@@ -293,7 +293,7 @@ public final class CoreImports {
 
         uniqueMethods(IoCore.class).forEach(METHOD_IMPORTS::add);
         uniqueMethods(P.class).forEach(METHOD_IMPORTS::add);
-        uniqueMethods(TP.class).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(TextP.class).forEach(METHOD_IMPORTS::add);
         uniqueMethods(__.class).filter(m -> !m.getName().equals("__")).forEach(METHOD_IMPORTS::add);
         uniqueMethods(Computer.class).forEach(METHOD_IMPORTS::add);
         uniqueMethods(TimeUtil.class).forEach(METHOD_IMPORTS::add);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TP.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TP.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TP.java
deleted file mode 100644
index fc245a4..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TP.java
+++ /dev/null
@@ -1,107 +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;
-
-import java.util.function.BiPredicate;
-
-/**
- * @author Daniel Kuppitz (http://gremlin.guru)
- */
-public class TP extends P<String> {
-
-    @SuppressWarnings("WeakerAccess")
-    public TP(final BiPredicate<String, String> biPredicate, final String value) {
-        super(biPredicate, value);
-    }
-
-    @Override
-    public boolean equals(final Object other) {
-        return other instanceof TP && super.equals(other);
-    }
-
-    @Override
-    public String toString() {
-        return null == this.originalValue ? this.biPredicate.toString() : this.biPredicate.toString() + "(" + this.originalValue + ")";
-    }
-
-    @Override
-    public TP negate() {
-        return new TP(this.biPredicate.negate(), this.originalValue);
-    }
-
-    public TP clone() {
-        return (TP) super.clone();
-    }
-
-    //////////////// statics
-
-    /**
-     * Determines if String does start with the given value.
-     *
-     * @since 3.4.0
-     */
-    public static TP startsWith(final String value) {
-        return new TP(Text.startsWith, value);
-    }
-
-    /**
-     * Determines if String does not start with the given value.
-     *
-     * @since 3.4.0
-     */
-    public static TP startsNotWith(final String value) {
-        return new TP(Text.startsNotWith, value);
-    }
-
-    /**
-     * Determines if String does start with the given value.
-     *
-     * @since 3.4.0
-     */
-    public static TP endsWith(final String value) {
-        return new TP(Text.endsWith, value);
-    }
-
-    /**
-     * Determines if String does not start with the given value.
-     *
-     * @since 3.4.0
-     */
-    public static TP endsNotWith(final String value) {
-        return new TP(Text.endsNotWith, value);
-    }
-
-    /**
-     * Determines if String does contain the given value.
-     *
-     * @since 3.4.0
-     */
-    public static TP contains(final String value) {
-        return new TP(Text.contains, value);
-    }
-
-    /**
-     * Determines if String does not contain the given value.
-     *
-     * @since 3.4.0
-     */
-    public static TP absent(final String value) {
-        return new TP(Text.absent, value);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TextP.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TextP.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TextP.java
new file mode 100644
index 0000000..2b1b976
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TextP.java
@@ -0,0 +1,107 @@
+/*
+ * 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 java.util.function.BiPredicate;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public class TextP extends P<String> {
+
+    @SuppressWarnings("WeakerAccess")
+    public TextP(final BiPredicate<String, String> biPredicate, final String value) {
+        super(biPredicate, value);
+    }
+
+    @Override
+    public boolean equals(final Object other) {
+        return other instanceof TextP && super.equals(other);
+    }
+
+    @Override
+    public String toString() {
+        return null == this.originalValue ? this.biPredicate.toString() : this.biPredicate.toString() + "(" + this.originalValue + ")";
+    }
+
+    @Override
+    public TextP negate() {
+        return new TextP(this.biPredicate.negate(), this.originalValue);
+    }
+
+    public TextP clone() {
+        return (TextP) super.clone();
+    }
+
+    //////////////// statics
+
+    /**
+     * Determines if String does start with the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TextP startsWith(final String value) {
+        return new TextP(Text.startsWith, value);
+    }
+
+    /**
+     * Determines if String does not start with the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TextP startsNotWith(final String value) {
+        return new TextP(Text.startsNotWith, value);
+    }
+
+    /**
+     * Determines if String does start with the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TextP endsWith(final String value) {
+        return new TextP(Text.endsWith, value);
+    }
+
+    /**
+     * Determines if String does not start with the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TextP endsNotWith(final String value) {
+        return new TextP(Text.endsNotWith, value);
+    }
+
+    /**
+     * Determines if String does contain the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TextP contains(final String value) {
+        return new TextP(Text.contains, value);
+    }
+
+    /**
+     * Determines if String does not contain the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TextP absent(final String value) {
+        return new TextP(Text.absent, value);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index 74647a1..ed0df64 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -28,7 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -146,7 +146,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                     put(AndP.class, "P");
                     put(OrP.class, "P");
                     put(P.class, "P");
-                    put(TP.class, "TP");
+                    put(TextP.class, "TextP");
                     Stream.of(
                             VertexProperty.Cardinality.class,
                             Column.class,
@@ -272,7 +272,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                     TraversalOptionParent.Pick.values(),
                     T.values()).flatMap(Stream::of).forEach(e -> addDeserializer(e.getClass(), new TraversalSerializersV3d0.EnumJacksonDeserializer(e.getDeclaringClass())));
             addDeserializer(P.class, new TraversalSerializersV3d0.PJacksonDeserializer());
-            addDeserializer(TP.class, new TraversalSerializersV3d0.TPJacksonDeserializer());
+            addDeserializer(TextP.class, new TraversalSerializersV3d0.TextPJacksonDeserializer());
             addDeserializer(Lambda.class, new TraversalSerializersV3d0.LambdaJacksonDeserializer());
             addDeserializer(Traverser.class, new TraversalSerializersV3d0.TraverserJacksonDeserializer());
             Arrays.asList(
@@ -362,7 +362,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                     put(AndP.class, "P");
                     put(OrP.class, "P");
                     put(P.class, "P");
-                    put(TP.class, "TP");
+                    put(TextP.class, "TextP");
                     Stream.of(
                             VertexProperty.Cardinality.class,
                             Column.class,
@@ -480,7 +480,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                     TraversalOptionParent.Pick.values(),
                     T.values()).flatMap(Stream::of).forEach(e -> addDeserializer(e.getClass(), new TraversalSerializersV2d0.EnumJacksonDeserializer(e.getDeclaringClass())));
             addDeserializer(P.class, new TraversalSerializersV2d0.PJacksonDeserializer());
-            addDeserializer(TP.class, new TraversalSerializersV2d0.TPJacksonDeserializer());
+            addDeserializer(TextP.class, new TraversalSerializersV2d0.TextPJacksonDeserializer());
             addDeserializer(Lambda.class, new TraversalSerializersV2d0.LambdaJacksonDeserializer());
             addDeserializer(Traverser.class, new TraversalSerializersV2d0.TraverserJacksonDeserializer());
             Arrays.asList(

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
index 7ba4ca5..5297733 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
@@ -24,7 +24,7 @@ import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -373,14 +373,14 @@ final class TraversalSerializersV2d0 {
         }
     }
 
-    final static class TPJacksonDeserializer extends StdDeserializer<TP> {
+    final static class TextPJacksonDeserializer extends StdDeserializer<TextP> {
 
-        public TPJacksonDeserializer() {
-            super(TP.class);
+        public TextPJacksonDeserializer() {
+            super(TextP.class);
         }
 
         @Override
-        public TP deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+        public TextP deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
             String predicate = null;
             String value = null;
 
@@ -395,7 +395,7 @@ final class TraversalSerializersV2d0 {
             }
 
             try {
-                return (TP) TP.class.getMethod(predicate, String.class).invoke(null, value);
+                return (TextP) TextP.class.getMethod(predicate, String.class).invoke(null, value);
             } catch (final Exception e) {
                 throw new IllegalStateException(e.getMessage(), e);
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java
index ca01ec0..d3aa60e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java
@@ -24,7 +24,7 @@ import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -371,14 +371,14 @@ final class TraversalSerializersV3d0 {
         }
     }
 
-    final static class TPJacksonDeserializer extends StdDeserializer<TP> {
+    final static class TextPJacksonDeserializer extends StdDeserializer<TextP> {
 
-        public TPJacksonDeserializer() {
-            super(TP.class);
+        public TextPJacksonDeserializer() {
+            super(TextP.class);
         }
 
         @Override
-        public TP deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+        public TextP deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
             String predicate = null;
             String value = null;
 
@@ -393,7 +393,7 @@ final class TraversalSerializersV3d0 {
             }
 
             try {
-                return (TP) TP.class.getMethod(predicate, String.class).invoke(null, value);
+                return (TextP) TextP.class.getMethod(predicate, String.class).invoke(null, value);
             } catch (final Exception e) {
                 throw new IllegalStateException(e.getMessage(), e);
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java
index c7de4ec..7697462 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java
@@ -22,7 +22,7 @@ import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraver
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.util.AndP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
@@ -229,20 +229,20 @@ public final class GryoSerializersV1d0 {
         }
     }
 
-    public final static class TPSerializer implements SerializerShim<TP> {
+    public final static class TextPSerializer implements SerializerShim<TextP> {
         @Override
-        public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final TP p) {
+        public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final TextP p) {
             output.writeString(p.getBiPredicate().toString());
             kryo.writeObject(output, p.getValue());
         }
 
         @Override
-        public <I extends InputShim> TP read(final KryoShim<I, ?> kryo, final I input, final Class<TP> clazz) {
+        public <I extends InputShim> TextP read(final KryoShim<I, ?> kryo, final I input, final Class<TextP> clazz) {
             final String predicate = input.readString();
             final String value = kryo.readObject(input, String.class);
 
             try {
-                return (TP) TP.class.getMethod(predicate, String.class).invoke(null, value);
+                return (TextP) TextP.class.getMethod(predicate, String.class).invoke(null, value);
             } catch (final Exception e) {
                 throw new IllegalStateException(e.getMessage(), e);
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java
index ffda00e..e35bd33 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java
@@ -22,7 +22,7 @@ import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraver
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.util.AndP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
@@ -345,20 +345,20 @@ public final class GryoSerializersV3d0 {
         }
     }
 
-    public final static class TPSerializer implements SerializerShim<TP> {
+    public final static class TextPSerializer implements SerializerShim<TextP> {
         @Override
-        public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final TP p) {
+        public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final TextP p) {
             output.writeString(p.getBiPredicate().toString());
             kryo.writeObject(output, p.getValue());
         }
 
         @Override
-        public <I extends InputShim> TP read(final KryoShim<I, ?> kryo, final I input, final Class<TP> clazz) {
+        public <I extends InputShim> TextP read(final KryoShim<I, ?> kryo, final I input, final Class<TextP> clazz) {
             final String predicate = input.readString();
             final String value = kryo.readObject(input, String.class);
 
             try {
-                return (TP) TP.class.getMethod(predicate, String.class).invoke(null, value);
+                return (TextP) TextP.class.getMethod(predicate, String.class).invoke(null, value);
             } catch (final Exception e) {
                 throw new IllegalStateException(e.getMessage(), e);
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
index fb62fee..0829fbb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
@@ -33,7 +33,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.RangeGlobalStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.FoldStep;
@@ -312,7 +312,7 @@ public enum GryoVersion {
 
             add(GryoTypeReg.of(Bytecode.class, 122, new GryoSerializersV3d0.BytecodeSerializer()));
             add(GryoTypeReg.of(P.class, 124, new GryoSerializersV3d0.PSerializer()));
-            add(GryoTypeReg.of(TP.class, 186, new GryoSerializersV3d0.TPSerializer())); // ***LAST ID***
+            add(GryoTypeReg.of(TextP.class, 186, new GryoSerializersV3d0.TextPSerializer())); // ***LAST ID***
             add(GryoTypeReg.of(Lambda.class, 125, new GryoSerializersV3d0.LambdaSerializer()));
             add(GryoTypeReg.of(Bytecode.Binding.class, 126, new GryoSerializersV3d0.BindingSerializer()));
             add(GryoTypeReg.of(Order.class, 127));
@@ -504,7 +504,7 @@ public enum GryoVersion {
 
             add(GryoTypeReg.of(Bytecode.class, 122, new GryoSerializersV1d0.BytecodeSerializer()));
             add(GryoTypeReg.of(P.class, 124, new GryoSerializersV1d0.PSerializer()));
-            add(GryoTypeReg.of(TP.class, 186, new GryoSerializersV1d0.TPSerializer())); // ***LAST ID***
+            add(GryoTypeReg.of(TextP.class, 186, new GryoSerializersV1d0.TextPSerializer())); // ***LAST ID***
             add(GryoTypeReg.of(Lambda.class, 125, new GryoSerializersV1d0.LambdaSerializer()));
             add(GryoTypeReg.of(Bytecode.Binding.class, 126, new GryoSerializersV1d0.BindingSerializer()));
             add(GryoTypeReg.of(Order.class, 127));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
index 1060b4e..0e21ece 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
@@ -95,20 +95,20 @@ public class PTest {
                     {P.between("m", "n").or(P.eq("daniel")), "daniel", true},
                     {P.between("m", "n").or(P.eq("daniel")), "stephen", false},
                     // text predicates
-                    {TP.contains("ark"), "marko", true},
-                    {TP.contains("ark"), "josh", false},
-                    {TP.startsWith("jo"), "marko", false},
-                    {TP.startsWith("jo"), "josh", true},
-                    {TP.endsWith("ter"), "marko", false},
-                    {TP.endsWith("ter"), "peter", true},
-                    {TP.contains("o"), "marko", true},
-                    {TP.contains("o"), "josh", true},
-                    {TP.contains("o").and(P.gte("j")), "marko", true},
-                    {TP.contains("o").and(P.gte("j")), "josh", true},
-                    {TP.contains("o").and(P.gte("j")).and(TP.endsWith("ko")), "marko", true},
-                    {TP.contains("o").and(P.gte("j")).and(TP.endsWith("ko")), "josh", false},
-                    {TP.contains("o").and(P.gte("j").and(TP.endsWith("ko"))), "marko", true},
-                    {TP.contains("o").and(P.gte("j").and(TP.endsWith("ko"))), "josh", false},
+                    {TextP.contains("ark"), "marko", true},
+                    {TextP.contains("ark"), "josh", false},
+                    {TextP.startsWith("jo"), "marko", false},
+                    {TextP.startsWith("jo"), "josh", true},
+                    {TextP.endsWith("ter"), "marko", false},
+                    {TextP.endsWith("ter"), "peter", true},
+                    {TextP.contains("o"), "marko", true},
+                    {TextP.contains("o"), "josh", true},
+                    {TextP.contains("o").and(P.gte("j")), "marko", true},
+                    {TextP.contains("o").and(P.gte("j")), "josh", true},
+                    {TextP.contains("o").and(P.gte("j")).and(TextP.endsWith("ko")), "marko", true},
+                    {TextP.contains("o").and(P.gte("j")).and(TextP.endsWith("ko")), "josh", false},
+                    {TextP.contains("o").and(P.gte("j").and(TextP.endsWith("ko"))), "marko", true},
+                    {TextP.contains("o").and(P.gte("j").and(TextP.endsWith("ko"))), "josh", false},
             }));
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
index 52a7ee4..92c4df6 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
@@ -21,7 +21,7 @@ package org.apache.tinkerpop.gremlin.structure.io.graphson;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.shaded.jackson.databind.JsonMappingException;
 import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper;
@@ -329,15 +329,15 @@ public class GraphSONMapperPartialEmbeddedTypeTest extends AbstractGraphSONTest
                 P.without(Arrays.asList(1,2,3,4)),
                 P.eq(1).and(P.eq(2)),
                 P.eq(1).or(P.eq(2)),
-                TP.contains("ark"),
-                TP.startsWith("mar"),
-                TP.endsWith("ko"),
-                TP.endsWith("ko").and(P.gte("mar")),
-                P.gte("mar").and(TP.endsWith("ko")));
+                TextP.contains("ark"),
+                TextP.startsWith("mar"),
+                TextP.endsWith("ko"),
+                TextP.endsWith("ko").and(P.gte("mar")),
+                P.gte("mar").and(TextP.endsWith("ko")));
 
         for (P p : variantsOfP) {
-            if (p instanceof TP) {
-                assertEquals(p, serializeDeserialize(mapper, p, TP.class));
+            if (p instanceof TextP) {
+                assertEquals(p, serializeDeserialize(mapper, p, TextP.class));
             } else {
                 assertEquals(p, serializeDeserialize(mapper, p, P.class));
             }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/glv/TP.template
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/TP.template b/gremlin-dotnet/glv/TP.template
deleted file mode 100644
index 22320ea..0000000
--- a/gremlin-dotnet/glv/TP.template
+++ /dev/null
@@ -1,71 +0,0 @@
-#region License
-
-/*
- * 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.
- */
-
-#endregion
-
-// THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace Gremlin.Net.Process.Traversal
-{
-#pragma warning disable 1591
-
-    /// <summary>
-    ///     A <see cref="TP" /> is a predicate of the form Func&lt;string, bool&gt;.
-    ///     That is, given some string, return true or false.
-    /// </summary>
-    public class TP : P
-    {
-        /// <summary>
-        ///     Initializes a new instance of the <see cref="TP" /> class.
-        /// </summary>
-        /// <param name="operatorName">The name of the predicate.</param>
-        /// <param name="value">The value of the predicate.</param>
-        /// <param name="other">An optional other predicate that is used as an argument for this predicate.</param>
-        public TP(string operatorName, string value, P other = null) : base(operatorName, value, other)
-        {
-        }
-
-<% tpmethods.each { method -> %>
-        public static TP <%= toCSharpMethodName.call(method) %>(string value)
-        {
-            return new TP("<%= method %>", value);
-        }
-<% } %>
-
-        private static T[] ToGenericArray<T>(ICollection<T> collection)
-        {
-            return collection?.ToArray() ?? new T[0];
-        }
-
-        /// <inheritdoc />
-        public override string ToString()
-        {
-            return Other == null ? \$"{OperatorName}({Value})" : \$"{OperatorName}({Value},{Other})";
-        }
-    }
-
-#pragma warning restore 1591
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/glv/TextP.template
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/TextP.template b/gremlin-dotnet/glv/TextP.template
new file mode 100644
index 0000000..3e289f6
--- /dev/null
+++ b/gremlin-dotnet/glv/TextP.template
@@ -0,0 +1,71 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+// THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace Gremlin.Net.Process.Traversal
+{
+#pragma warning disable 1591
+
+    /// <summary>
+    ///     A <see cref="TextP" /> is a predicate of the form Func&lt;string, bool&gt;.
+    ///     That is, given some string, return true or false.
+    /// </summary>
+    public class TextP : P
+    {
+        /// <summary>
+        ///     Initializes a new instance of the <see cref="TextP" /> class.
+        /// </summary>
+        /// <param name="operatorName">The name of the predicate.</param>
+        /// <param name="value">The value of the predicate.</param>
+        /// <param name="other">An optional other predicate that is used as an argument for this predicate.</param>
+        public TextP(string operatorName, string value, P other = null) : base(operatorName, value, other)
+        {
+        }
+
+<% tpmethods.each { method -> %>
+        public static TextP <%= toCSharpMethodName.call(method) %>(string value)
+        {
+            return new TextP("<%= method %>", value);
+        }
+<% } %>
+
+        private static T[] ToGenericArray<T>(ICollection<T> collection)
+        {
+            return collection?.ToArray() ?? new T[0];
+        }
+
+        /// <inheritdoc />
+        public override string ToString()
+        {
+            return Other == null ? \$"{OperatorName}({Value})" : \$"{OperatorName}({Value},{Other})";
+        }
+    }
+
+#pragma warning restore 1591
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/generate.groovy b/gremlin-dotnet/glv/generate.groovy
index 3dbd959..0655fd1 100644
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@ -26,7 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
 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.P
-import org.apache.tinkerpop.gremlin.process.traversal.TP
+import org.apache.tinkerpop.gremlin.process.traversal.TextP
 import org.apache.tinkerpop.gremlin.process.traversal.IO
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
 import org.apache.tinkerpop.gremlin.structure.Direction
@@ -60,7 +60,7 @@ def toCSharpTypeMap = ["Long": "long",
                        "Traversal[]": "ITraversal[]",
                        "Predicate": "IPredicate",
                        "P": "P",
-                       "TP": "TP",
+                       "TextP": "TextP",
                        "TraversalStrategy": "ITraversalStrategy",
                        "TraversalStrategy[]": "ITraversalStrategy[]",
                        "Function": "IFunction",
@@ -243,9 +243,9 @@ def binding = ["pmethods": P.class.getMethods().
         collect { it.name }.
         unique().
         sort { a, b -> a <=> b },
-               "tpmethods": TP.class.getMethods().
+               "tpmethods": TextP.class.getMethods().
                        findAll { Modifier.isStatic(it.getModifiers()) }.
-                       findAll { TP.class.isAssignableFrom(it.returnType) }.
+                       findAll { TextP.class.isAssignableFrom(it.returnType) }.
                        collect { it.name }.
                        unique().
                        sort { a, b -> a <=> b },
@@ -342,8 +342,8 @@ def pTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/P.template
 def pFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/P.cs")
 pFile.newWriter().withWriter{ it << pTemplate }
 
-def tpTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/TP.template")).make(binding)
-def tpFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/TP.cs")
+def tpTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/TextP.template")).make(binding)
+def tpFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/TextP.cs")
 tpFile.newWriter().withWriter{ it << tpTemplate }
 
 binding.tokens.each {k,v ->

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
deleted file mode 100644
index abebd1e..0000000
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-#region License
-
-/*
- * 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.
- */
-
-#endregion
-
-// THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-
-namespace Gremlin.Net.Process.Traversal
-{
-#pragma warning disable 1591
-
-    /// <summary>
-    ///     A <see cref="TP" /> is a predicate of the form Func&lt;string, bool&gt;.
-    ///     That is, given some string, return true or false.
-    /// </summary>
-    public class TP : P
-    {
-        /// <summary>
-        ///     Initializes a new instance of the <see cref="TP" /> class.
-        /// </summary>
-        /// <param name="operatorName">The name of the predicate.</param>
-        /// <param name="value">The value of the predicate.</param>
-        /// <param name="other">An optional other predicate that is used as an argument for this predicate.</param>
-        public TP(string operatorName, string value, P other = null) : base(operatorName, value, other)
-        {
-        }
-
-
-        public static TP Absent(string value)
-        {
-            return new TP("absent", value);
-        }
-
-        public static TP Contains(string value)
-        {
-            return new TP("contains", value);
-        }
-
-        public static TP EndsNotWith(string value)
-        {
-            return new TP("endsNotWith", value);
-        }
-
-        public static TP EndsWith(string value)
-        {
-            return new TP("endsWith", value);
-        }
-
-        public static TP StartsNotWith(string value)
-        {
-            return new TP("startsNotWith", value);
-        }
-
-        public static TP StartsWith(string value)
-        {
-            return new TP("startsWith", value);
-        }
-
-
-        private static T[] ToGenericArray<T>(ICollection<T> collection)
-        {
-            return collection?.ToArray() ?? new T[0];
-        }
-
-        /// <inheritdoc />
-        public override string ToString()
-        {
-            return Other == null ? $"{OperatorName}({Value})" : $"{OperatorName}({Value},{Other})";
-        }
-    }
-
-#pragma warning restore 1591
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TextP.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TextP.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TextP.cs
new file mode 100644
index 0000000..b8e8a64
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TextP.cs
@@ -0,0 +1,96 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+// THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace Gremlin.Net.Process.Traversal
+{
+#pragma warning disable 1591
+
+    /// <summary>
+    ///     A <see cref="TextP" /> is a predicate of the form Func&lt;string, bool&gt;.
+    ///     That is, given some string, return true or false.
+    /// </summary>
+    public class TextP : P
+    {
+        /// <summary>
+        ///     Initializes a new instance of the <see cref="TextP" /> class.
+        /// </summary>
+        /// <param name="operatorName">The name of the predicate.</param>
+        /// <param name="value">The value of the predicate.</param>
+        /// <param name="other">An optional other predicate that is used as an argument for this predicate.</param>
+        public TextP(string operatorName, string value, P other = null) : base(operatorName, value, other)
+        {
+        }
+
+
+        public static TextP Absent(string value)
+        {
+            return new TextP("absent", value);
+        }
+
+        public static TextP Contains(string value)
+        {
+            return new TextP("contains", value);
+        }
+
+        public static TextP EndsNotWith(string value)
+        {
+            return new TextP("endsNotWith", value);
+        }
+
+        public static TextP EndsWith(string value)
+        {
+            return new TextP("endsWith", value);
+        }
+
+        public static TextP StartsNotWith(string value)
+        {
+            return new TextP("startsNotWith", value);
+        }
+
+        public static TextP StartsWith(string value)
+        {
+            return new TextP("startsWith", value);
+        }
+
+
+        private static T[] ToGenericArray<T>(ICollection<T> collection)
+        {
+            return collection?.ToArray() ?? new T[0];
+        }
+
+        /// <inheritdoc />
+        public override string ToString()
+        {
+            return Other == null ? $"{OperatorName}({Value})" : $"{OperatorName}({Value},{Other})";
+        }
+    }
+
+#pragma warning restore 1591
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
index 3178d21..3268ae4 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
@@ -58,7 +58,7 @@ namespace Gremlin.Net.Structure.IO.GraphSON
                 {typeof(Type), new ClassSerializer()},
                 {typeof(EnumWrapper), new EnumSerializer()},
                 {typeof(P), new PSerializer()},
-                {typeof(TP), new TPSerializer()},
+                {typeof(TextP), new TextPSerializer()},
                 {typeof(Vertex), new VertexSerializer()},
                 {typeof(Edge), new EdgeSerializer()},
                 {typeof(Property), new PropertySerializer()},

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TPSerializer.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TPSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TPSerializer.cs
deleted file mode 100644
index 22ed358..0000000
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TPSerializer.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-#region License
-
-/*
- * 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.
- */
-
-#endregion
-
-using System.Collections.Generic;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.Structure.IO.GraphSON
-{
-    internal class TPSerializer : IGraphSONSerializer
-    {
-        public Dictionary<string, dynamic> Dictify(dynamic predicate, GraphSONWriter writer)
-        {
-            TP p = predicate;
-            var value = p.Other == null
-                ? writer.ToDict(p.Value)
-                : new List<dynamic> {writer.ToDict(p.Value), writer.ToDict(p.Other)};
-            var dict = new Dictionary<string, dynamic>
-            {
-                {"predicate", p.OperatorName},
-                {"value", value}
-            };
-            return GraphSONUtil.ToTypedValue("TP", dict);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TextPSerializer.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TextPSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TextPSerializer.cs
new file mode 100644
index 0000000..586be2d
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TextPSerializer.cs
@@ -0,0 +1,45 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System.Collections.Generic;
+using Gremlin.Net.Process.Traversal;
+
+namespace Gremlin.Net.Structure.IO.GraphSON
+{
+    internal class TextPSerializer : IGraphSONSerializer
+    {
+        public Dictionary<string, dynamic> Dictify(dynamic predicate, GraphSONWriter writer)
+        {
+            TextP p = predicate;
+            var value = p.Other == null
+                ? writer.ToDict(p.Value)
+                : new List<dynamic> {writer.ToDict(p.Value), writer.ToDict(p.Other)};
+            var dict = new Dictionary<string, dynamic>
+            {
+                {"predicate", p.OperatorName},
+                {"value", value}
+            };
+            return GraphSONUtil.ToTypedValue("TextP", dict);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TPParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TPParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TPParameter.cs
deleted file mode 100644
index 9100c6f..0000000
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TPParameter.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-#region License
-
-/*
- * 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.
- */
-
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Dynamic;
-using System.Linq;
-using System.Reflection;
-using Gremlin.Net.Process.Traversal;
-
-namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
-{
-    /// <summary>
-    /// Represents a parameter for a traversal predicate (ie: TP.contains())
-    /// </summary>
-    internal class TPParameter : ITokenParameter, IEquatable<TPParameter>
-    {
-        private IDictionary<string, object> _contextParameterValues;
-        public IList<Token> Tokens { get; }
-        
-        public TPParameter(IList<Token> tokens)
-        {
-            Tokens = tokens;
-        }
-
-        public bool Equals(TPParameter other)
-        {
-            return Tokens.SequenceEqual(other.Tokens);
-        }
-
-        public override bool Equals(object obj)
-        {
-            if (ReferenceEquals(null, obj)) return false;
-            if (ReferenceEquals(this, obj)) return true;
-            if (obj.GetType() != GetType()) return false;
-            return Equals((TPParameter) obj);
-        }
-
-        public override int GetHashCode()
-        {
-            return Tokens != null ? Tokens.GetHashCode() : 0;
-        }
-
-        public object GetValue()
-        {
-            var type = typeof(TP);
-            object instance = null;
-            for (var i = 1; i < Tokens.Count; i++)
-            {
-                var token = Tokens[i];
-                token.SetContextParameterValues(_contextParameterValues);
-                var method = type.GetMethod(TraversalParser.GetCsharpName(token.Name),
-                    BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);
-                if (method == null)
-                {
-                    throw new InvalidOperationException($"Predicate (TP) method '{token}' not found for testing");
-                }
-                
-                var parameters = method.IsStatic
-                    ? new object[] {token.Parameters.Select(p => p.GetValue().ToString()).First()}
-                    : token.Parameters.Select(p => p.GetValue()).ToArray();
-                instance = method.Invoke(instance, parameters);
-            }
-            return instance;
-        }
-
-        public Type GetParameterType()
-        {
-            return typeof(TP);
-        }
-
-        public void SetContextParameterValues(IDictionary<string, object> parameterValues)
-        {
-            _contextParameterValues = parameterValues;
-        }
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TextPParameter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TextPParameter.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TextPParameter.cs
new file mode 100644
index 0000000..5999659
--- /dev/null
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TextPParameter.cs
@@ -0,0 +1,97 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Dynamic;
+using System.Linq;
+using System.Reflection;
+using Gremlin.Net.Process.Traversal;
+
+namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
+{
+    /// <summary>
+    /// Represents a parameter for a traversal predicate (ie: TextP.contains())
+    /// </summary>
+    internal class TextPParameter : ITokenParameter, IEquatable<TextPParameter>
+    {
+        private IDictionary<string, object> _contextParameterValues;
+        public IList<Token> Tokens { get; }
+        
+        public TextPParameter(IList<Token> tokens)
+        {
+            Tokens = tokens;
+        }
+
+        public bool Equals(TextPParameter other)
+        {
+            return Tokens.SequenceEqual(other.Tokens);
+        }
+
+        public override bool Equals(object obj)
+        {
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            if (obj.GetType() != GetType()) return false;
+            return Equals((TextPParameter) obj);
+        }
+
+        public override int GetHashCode()
+        {
+            return Tokens != null ? Tokens.GetHashCode() : 0;
+        }
+
+        public object GetValue()
+        {
+            var type = typeof(TextP);
+            object instance = null;
+            for (var i = 1; i < Tokens.Count; i++)
+            {
+                var token = Tokens[i];
+                token.SetContextParameterValues(_contextParameterValues);
+                var method = type.GetMethod(TraversalParser.GetCsharpName(token.Name),
+                    BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);
+                if (method == null)
+                {
+                    throw new InvalidOperationException($"Predicate (TextP) method '{token}' not found for testing");
+                }
+                
+                var parameters = method.IsStatic
+                    ? new object[] {token.Parameters.Select(p => p.GetValue().ToString()).First()}
+                    : token.Parameters.Select(p => p.GetValue()).ToArray();
+                instance = method.Invoke(instance, parameters);
+            }
+            return instance;
+        }
+
+        public Type GetParameterType()
+        {
+            return typeof(TextP);
+        }
+
+        public void SetContextParameterValues(IDictionary<string, object> parameterValues)
+        {
+            _contextParameterValues = parameterValues;
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
index 1065780..139cd2d 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Gherkin/TraversalEvaluation/TraversalParser.cs
@@ -406,9 +406,9 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
                 var tokens = ParseTokens(text, ref i);
                 return new StaticTraversalParameter(tokens, text.Substring(startIndex, i - startIndex));
             }
-            if (text.Length >= i + 3 && text.Substring(i, 3) == "TP.")
+            if (text.Length >= i + 6 && text.Substring(i, 6) == "TextP.")
             {
-                return new TPParameter(ParseTokens(text, ref i));
+                return new TextPParameter(ParseTokens(text, ref i));
             }
             if (text.Substring(i, 2).StartsWith("P."))
             {
@@ -482,4 +482,4 @@ namespace Gremlin.Net.IntegrationTest.Gherkin.TraversalEvaluation
             EndParameters
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index a3e593a..ae892f3 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -24,7 +24,7 @@ import org.apache.commons.configuration.ConfigurationConverter;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -226,7 +226,7 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
     }
 
     private StringBuilder convertPToString(final P p, final StringBuilder current) {
-        if (p instanceof TP) return convertTPToString((TP) p, current);
+        if (p instanceof TextP) return convertTextPToString((TextP) p, current);
         if (p instanceof ConnectiveP) {
             final List<P<?>> list = ((ConnectiveP) p).getPredicates();
             for (int i = 0; i < list.size(); i++) {
@@ -240,8 +240,8 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
         return current;
     }
 
-    private StringBuilder convertTPToString(final TP p, final StringBuilder current) {
-        current.append("TP.").append(p.getBiPredicate().toString()).append("(").append(convertToString(p.getValue())).append(")");
+    private StringBuilder convertTextPToString(final TextP p, final StringBuilder current) {
+        current.append("TextP.").append(p.getBiPredicate().toString()).append("(").append(convertToString(p.getValue())).append(")");
         return current;
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-javascript/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
index 14df95b..46d96b5 100644
--- a/gremlin-javascript/glv/TraversalSource.template
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -162,7 +162,7 @@ function createP(operator, args) {
   return new (Function.prototype.bind.apply(P, args));
 }
 
-class TP {
+class TextP {
   /**
    * Represents an operation.
    * @constructor
@@ -201,7 +201,7 @@ class TP {
 
 function createTP(operator, args) {
   args.unshift(null, operator);
-  return new (Function.prototype.bind.apply(TP, args));
+  return new (Function.prototype.bind.apply(TextP, args));
 }
 
 class Traverser {
@@ -241,7 +241,7 @@ class EnumValue {
 module.exports = {
   EnumValue,
   P,
-  TP,
+  TextP,
   IO,
   Traversal,
   TraversalSideEffects,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-javascript/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/generate.groovy b/gremlin-javascript/glv/generate.groovy
index 243c607..575f847 100644
--- a/gremlin-javascript/glv/generate.groovy
+++ b/gremlin-javascript/glv/generate.groovy
@@ -28,7 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
 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.P
-import org.apache.tinkerpop.gremlin.process.traversal.TP
+import org.apache.tinkerpop.gremlin.process.traversal.TextP
 import org.apache.tinkerpop.gremlin.process.traversal.IO
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
 import java.lang.reflect.Modifier
@@ -70,9 +70,9 @@ def binding = ["enums": CoreImports.getClassImports()
                        collect { it.name }.
                        unique().
                        sort { a, b -> a <=> b },
-               "tpmethods": TP.class.getMethods().
+               "tpmethods": TextP.class.getMethods().
                        findAll { Modifier.isStatic(it.getModifiers()) }.
-                       findAll { TP.class.isAssignableFrom(it.returnType) }.
+                       findAll { TextP.class.isAssignableFrom(it.returnType) }.
                        collect { it.name }.
                        unique().
                        sort { a, b -> a <=> b },

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index b15ecbc..f6456b7 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -49,7 +49,7 @@ module.exports = {
     Bytecode: Bytecode,
     EnumValue: t.EnumValue,
     P: t.P,
-    TP: t.TP,
+    TextP: t.TextP,
     Traversal: t.Traversal,
     TraversalSideEffects: t.TraversalSideEffects,
     TraversalStrategies: strategiesModule.TraversalStrategies,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index ca9d062..89f8ddc 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -310,7 +310,7 @@ function createP(operator, args) {
   return new (Function.prototype.bind.apply(P, args));
 }
 
-class TP {
+class TextP {
   /**
    * Represents an operation.
    * @constructor
@@ -374,7 +374,7 @@ class TP {
 
 function createTP(operator, args) {
   args.unshift(null, operator);
-  return new (Function.prototype.bind.apply(TP, args));
+  return new (Function.prototype.bind.apply(TextP, args));
 }
 
 class Traverser {
@@ -414,7 +414,7 @@ class EnumValue {
 module.exports = {
   EnumValue,
   P,
-  TP,
+  TextP,
   IO,
   Traversal,
   TraversalSideEffects,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
index fca8375..52d9e93 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
@@ -162,7 +162,7 @@ const deserializers = {
   'g:Property': typeSerializers.PropertySerializer,
   'g:Path': typeSerializers.Path3Serializer,
   'g:T': typeSerializers.TSerializer,
-  'g:TP': typeSerializers.TPSerializer,
+  'g:TextP': typeSerializers.TextPSerializer,
   'g:List': typeSerializers.ListSerializer,
   'g:Set': typeSerializers.SetSerializer,
   'g:Map': typeSerializers.MapSerializer
@@ -174,7 +174,7 @@ const serializers = [
   typeSerializers.BytecodeSerializer,
   typeSerializers.TraverserSerializer,
   typeSerializers.PSerializer,
-  typeSerializers.TPSerializer,
+  typeSerializers.TextPSerializer,
   typeSerializers.LambdaSerializer,
   typeSerializers.EnumSerializer,
   typeSerializers.VertexSerializer,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
index 576c721..2ea3d27 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
@@ -150,11 +150,11 @@ class PSerializer extends TypeSerializer {
   }
 }
 
-class TPSerializer extends TypeSerializer {
-  /** @param {TP} item */
+class TextPSerializer extends TypeSerializer {
+  /** @param {TextP} item */
   serialize(item) {
     const result = {};
-    result[typeKey] = 'g:TP';
+    result[typeKey] = 'g:TextP';
     const resultValue = result[valueKey] = {
       'predicate': item.operator
     };
@@ -168,7 +168,7 @@ class TPSerializer extends TypeSerializer {
   }
 
   canBeUsedFor(value) {
-    return (value instanceof t.TP);
+    return (value instanceof t.TextP);
   }
 }
 
@@ -406,7 +406,7 @@ module.exports = {
   PathSerializer,
   PropertySerializer,
   PSerializer,
-  TPSerializer,
+  TextPSerializer,
   SetSerializer,
   TSerializer,
   TraverserSerializer,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index abef2a2..d1d5b52 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -218,7 +218,7 @@ function getSandbox(g, parameters) {
     },
     Order: traversalModule.order,
     P: traversalModule.P,
-    TP: traversalModule.TP,
+    TextP: traversalModule.TextP,
     IO: traversalModule.IO,
     Pick: traversalModule.pick,
     Pop: traversalModule.pop,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-python/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-python/glv/TraversalSource.template b/gremlin-python/glv/TraversalSource.template
index 00a5934..4f40a5f 100644
--- a/gremlin-python/glv/TraversalSource.template
+++ b/gremlin-python/glv/TraversalSource.template
@@ -152,13 +152,13 @@ def <%= method %>(*args):
 statics.add_static('<%= method %>',<%= method %>)
 <% } %>
 
-class TP(P):
+class TextP(P):
     def __init__(self, operator, value, other=None):
         P.__init__(self, operator, value, other)
 <% tpmethods.each { method -> %>
     @staticmethod
     def <%= method %>(*args):
-        return TP("<%= toJava.call(method) %>", *args)
+        return TextP("<%= toJava.call(method) %>", *args)
 <% } %>
     def __eq__(self, other):
         return isinstance(other, self.__class__) and self.operator == other.operator and self.value == other.value and self.other == other.other
@@ -167,7 +167,7 @@ class TP(P):
         return self.operator + "(" + str(self.value) + ")" if self.other is None else self.operator + "(" + str(self.value) + "," + str(self.other) + ")"
 <% tpmethods.findAll{!it.equals("clone")}.each { method -> %>
 def <%= method %>(*args):
-    return TP.<%= method %>(*args)
+    return TextP.<%= method %>(*args)
 statics.add_static('<%= method %>',<%= method %>)
 <% } %>
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-python/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/glv/generate.groovy b/gremlin-python/glv/generate.groovy
index 8c3d647..60d8381 100644
--- a/gremlin-python/glv/generate.groovy
+++ b/gremlin-python/glv/generate.groovy
@@ -26,7 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
 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.P
-import org.apache.tinkerpop.gremlin.process.traversal.TP
+import org.apache.tinkerpop.gremlin.process.traversal.TextP
 import org.apache.tinkerpop.gremlin.process.traversal.IO
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
 import java.lang.reflect.Modifier
@@ -64,9 +64,9 @@ def binding = ["enums": CoreImports.getClassImports()
                        collect { toPython(it.name) }.
                        unique().
                        sort { a, b -> a <=> b },
-               "tpmethods": TP.class.getMethods().
+               "tpmethods": TextP.class.getMethods().
                        findAll { Modifier.isStatic(it.getModifiers()) }.
-                       findAll { TP.class.isAssignableFrom(it.returnType) }.
+                       findAll { TextP.class.isAssignableFrom(it.returnType) }.
                        collect { toPython(it.name) }.
                        unique().
                        sort { a, b -> a <=> b },

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index 0d2695a..59669b1 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -24,7 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
@@ -225,7 +225,7 @@ public class PythonTranslator implements Translator.ScriptTranslator {
     }
 
     private StringBuilder convertPToString(final P p, final StringBuilder current) {
-        if (p instanceof TP) return convertTPToString((TP) p, current);
+        if (p instanceof TextP) return convertTextPToString((TextP) p, current);
         if (p instanceof ConnectiveP) {
             final List<P<?>> list = ((ConnectiveP) p).getPredicates();
             for (int i = 0; i < list.size(); i++) {
@@ -239,8 +239,8 @@ public class PythonTranslator implements Translator.ScriptTranslator {
         return current;
     }
 
-    private StringBuilder convertTPToString(final TP p, final StringBuilder current) {
-        current.append(convertStatic("TP.")).append(p.getBiPredicate().toString()).append("(").append(convertToString(p.getValue())).append(")");
+    private StringBuilder convertTextPToString(final TextP p, final StringBuilder current) {
+        current.append(convertStatic("TextP.")).append(p.getBiPredicate().toString()).append("(").append(convertToString(p.getValue())).append(")");
         return current;
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index a4d9708..7d7d518 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -322,33 +322,33 @@ def without(*args):
 statics.add_static('without',without)
 
 
-class TP(P):
+class TextP(P):
     def __init__(self, operator, value, other=None):
         P.__init__(self, operator, value, other)
 
     @staticmethod
     def absent(*args):
-        return TP("absent", *args)
+        return TextP("absent", *args)
 
     @staticmethod
     def contains(*args):
-        return TP("contains", *args)
+        return TextP("contains", *args)
 
     @staticmethod
     def endsNotWith(*args):
-        return TP("endsNotWith", *args)
+        return TextP("endsNotWith", *args)
 
     @staticmethod
     def endsWith(*args):
-        return TP("endsWith", *args)
+        return TextP("endsWith", *args)
 
     @staticmethod
     def startsNotWith(*args):
-        return TP("startsNotWith", *args)
+        return TextP("startsNotWith", *args)
 
     @staticmethod
     def startsWith(*args):
-        return TP("startsWith", *args)
+        return TextP("startsWith", *args)
 
     def __eq__(self, other):
         return isinstance(other, self.__class__) and self.operator == other.operator and self.value == other.value and self.other == other.other
@@ -357,27 +357,27 @@ class TP(P):
         return self.operator + "(" + str(self.value) + ")" if self.other is None else self.operator + "(" + str(self.value) + "," + str(self.other) + ")"
 
 def absent(*args):
-    return TP.absent(*args)
+    return TextP.absent(*args)
 statics.add_static('absent',absent)
 
 def contains(*args):
-    return TP.contains(*args)
+    return TextP.contains(*args)
 statics.add_static('contains',contains)
 
 def endsNotWith(*args):
-    return TP.endsNotWith(*args)
+    return TextP.endsNotWith(*args)
 statics.add_static('endsNotWith',endsNotWith)
 
 def endsWith(*args):
-    return TP.endsWith(*args)
+    return TextP.endsWith(*args)
 statics.add_static('endsWith',endsWith)
 
 def startsNotWith(*args):
-    return TP.startsNotWith(*args)
+    return TextP.startsNotWith(*args)
 statics.add_static('startsNotWith',startsNotWith)
 
 def startsWith(*args):
-    return TP.startsWith(*args)
+    return TextP.startsWith(*args)
 statics.add_static('startsWith',startsWith)
 
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
index 2cb0b5b..490269a 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
@@ -27,7 +27,7 @@ from aenum import Enum
 
 from gremlin_python import statics
 from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType
-from gremlin_python.process.traversal import Binding, Bytecode, P, TP, Traversal, Traverser, TraversalStrategy
+from gremlin_python.process.traversal import Binding, Bytecode, P, TextP, Traversal, Traverser, TraversalStrategy
 from gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path
 
 # When we fall back to a superclass's serializer, we iterate over this map.
@@ -278,15 +278,15 @@ class PSerializer(_GraphSONTypeIO):
         return GraphSONUtil.typedValue("P", out)
 
 
-class TPSerializer(_GraphSONTypeIO):
-    python_type = TP
+class TextPSerializer(_GraphSONTypeIO):
+    python_type = TextP
 
     @classmethod
     def dictify(cls, p, writer):
         out = {"predicate": p.operator,
                "value": [writer.toDict(p.value), writer.toDict(p.other)] if p.other is not None else
                writer.toDict(p.value)}
-        return GraphSONUtil.typedValue("TP", out)
+        return GraphSONUtil.typedValue("TextP", out)
 
 
 class BindingSerializer(_GraphSONTypeIO):


[33/48] tinkerpop git commit: Renamed `TP` to `TextP` as proposed by @robertdale

Posted by rd...@apache.org.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
index 266e23d..2d32d47 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
@@ -27,7 +27,7 @@ from aenum import Enum
 
 from gremlin_python import statics
 from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType, DictType, ListType, SetType
-from gremlin_python.process.traversal import Binding, Bytecode, P, TP, Traversal, Traverser, TraversalStrategy, T
+from gremlin_python.process.traversal import Binding, Bytecode, P, TextP, Traversal, Traverser, TraversalStrategy, T
 from gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path
 
 # When we fall back to a superclass's serializer, we iterate over this map.
@@ -284,15 +284,15 @@ class PSerializer(_GraphSONTypeIO):
         return GraphSONUtil.typedValue("P", out)
 
 
-class TPSerializer(_GraphSONTypeIO):
-    python_type = TP
+class TextPSerializer(_GraphSONTypeIO):
+    python_type = TextP
 
     @classmethod
     def dictify(cls, p, writer):
         out = {"predicate": p.operator,
                "value": [writer.toDict(p.value), writer.toDict(p.other)] if p.other is not None else
                writer.toDict(p.value)}
-        return GraphSONUtil.typedValue("TP", out)
+        return GraphSONUtil.typedValue("TextP", out)
 
 
 class BindingSerializer(_GraphSONTypeIO):

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-python/src/main/jython/radish/feature_steps.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/feature_steps.py b/gremlin-python/src/main/jython/radish/feature_steps.py
index 151d6d5..4777ef3 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -21,7 +21,7 @@ import json
 import re
 from gremlin_python.structure.graph import Graph, Path
 from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.traversal import Barrier, Cardinality, P, TP, Pop, Scope, Column, Order, Direction, T, Pick, Operator, IO
+from gremlin_python.process.traversal import Barrier, Cardinality, P, TextP, Pop, Scope, Column, Order, Direction, T, Pick, Operator, IO
 from radish import given, when, then
 from hamcrest import *
 
@@ -256,7 +256,7 @@ def _make_traversal(g, traversal_string, params):
          "Direction": Direction,
          "Order": Order,
          "P": P,
-         "TP": TP,
+         "TextP": TextP,
          "IO": IO,
          "Pick": Pick,
          "Pop": Pop,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-test/features/filter/Has.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Has.feature b/gremlin-test/features/filter/Has.feature
index 9d2bf4f..e272c05 100644
--- a/gremlin-test/features/filter/Has.feature
+++ b/gremlin-test/features/filter/Has.feature
@@ -563,7 +563,7 @@ Feature: Step - has()
     Given the modern graph
     And the traversal of
       """
-      g.V().has("name", TP.contains("ark"))
+      g.V().has("name", TextP.contains("ark"))
       """
     When iterated to list
     Then the result should be unordered
@@ -574,7 +574,7 @@ Feature: Step - has()
     Given the modern graph
     And the traversal of
       """
-      g.V().has("name", TP.startsWith("mar"))
+      g.V().has("name", TextP.startsWith("mar"))
       """
     When iterated to list
     Then the result should be unordered
@@ -585,7 +585,7 @@ Feature: Step - has()
     Given the modern graph
     And the traversal of
       """
-      g.V().has("name", TP.endsWith("as"))
+      g.V().has("name", TextP.endsWith("as"))
       """
     When iterated to list
     Then the result should be unordered
@@ -596,7 +596,7 @@ Feature: Step - has()
     Given the modern graph
     And the traversal of
       """
-      g.V().has("person", "name", TP.contains("o").and(P.lt("m")))
+      g.V().has("person", "name", TextP.contains("o").and(P.lt("m")))
       """
     When iterated to list
     Then the result should be unordered
@@ -607,7 +607,7 @@ Feature: Step - has()
     Given the modern graph
     And the traversal of
       """
-      g.V().has("name", P.gt("m").and(TP.contains("o")))
+      g.V().has("name", P.gt("m").and(TextP.contains("o")))
       """
     When iterated to list
     Then the result should be unordered

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f057fb36/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
index cb4abab..8f7d035 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
@@ -23,7 +23,7 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.TP;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -791,27 +791,27 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
         @Override
         public Traversal<Vertex, Vertex> get_g_V_hasXname_containsXarkXX() {
-            return g.V().has("name", TP.contains("ark"));
+            return g.V().has("name", TextP.contains("ark"));
         }
 
         @Override
         public Traversal<Vertex, Vertex> get_g_V_hasXname_startsWithXmarXX() {
-            return g.V().has("name", TP.startsWith("mar"));
+            return g.V().has("name", TextP.startsWith("mar"));
         }
 
         @Override
         public Traversal<Vertex, Vertex> get_g_V_hasXname_endsWithXasXX() {
-            return g.V().has("name", TP.endsWith("as"));
+            return g.V().has("name", TextP.endsWith("as"));
         }
 
         @Override
         public Traversal<Vertex, Vertex> get_g_V_hasXperson_name_containsXoX_andXltXmXXX() {
-            return g.V().has("person","name", TP.contains("o").and(P.lt("m")));
+            return g.V().has("person","name", TextP.contains("o").and(P.lt("m")));
         }
 
         @Override
         public Traversal<Vertex, Vertex> get_g_V_hasXname_gtXmX_andXcontainsXoXXX() {
-            return g.V().has("name", P.gt("m").and(TP.contains("o")));
+            return g.V().has("name", P.gt("m").and(TextP.contains("o")));
         }
     }
 }
\ No newline at end of file


[30/48] tinkerpop git commit: TINKERPOP-2041 Implemented text predicates

Posted by rd...@apache.org.
TINKERPOP-2041 Implemented text predicates


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

Branch: refs/heads/TINKERPOP-2037
Commit: 519ca65c0aef496a1fc1c4d2166622c41ff9c1e4
Parents: 3a8f580
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Wed Sep 26 15:44:35 2018 -0700
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Oct 4 07:45:08 2018 -0700

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   1 +
 docs/src/reference/the-traversal.asciidoc       |  34 +++--
 docs/src/upgrade/release-3.4.x.asciidoc         |  15 +++
 .../tinkerpop/gremlin/jsr223/CoreImports.java   |   3 +
 .../tinkerpop/gremlin/process/traversal/TP.java | 107 ++++++++++++++++
 .../gremlin/process/traversal/Text.java         | 123 +++++++++++++++++++
 .../structure/io/graphson/GraphSONModule.java   |   5 +
 .../io/graphson/TraversalSerializersV2d0.java   |  35 ++++++
 .../io/graphson/TraversalSerializersV3d0.java   |  35 ++++++
 .../structure/io/gryo/GryoSerializersV1d0.java  |  21 ++++
 .../structure/io/gryo/GryoSerializersV3d0.java  |  21 ++++
 .../gremlin/structure/io/gryo/GryoVersion.java  |   7 +-
 .../gremlin/process/traversal/PTest.java        |  15 +++
 .../GraphSONMapperPartialEmbeddedTypeTest.java  |  14 ++-
 gremlin-dotnet/glv/TP.template                  |  71 +++++++++++
 gremlin-dotnet/glv/generate.groovy              |  14 ++-
 .../src/Gremlin.Net/Process/Traversal/TP.cs     |  96 +++++++++++++++
 .../Structure/IO/GraphSON/GraphSONWriter.cs     |   3 +-
 .../Structure/IO/GraphSON/TPSerializer.cs       |  45 +++++++
 .../gremlin/groovy/jsr223/GroovyTranslator.java |   7 ++
 gremlin-javascript/glv/TraversalSource.template |  45 ++++++-
 gremlin-javascript/glv/generate.groovy          |   7 ++
 .../main/javascript/gremlin-javascript/index.js |   1 +
 .../gremlin-javascript/lib/process/traversal.js |  70 ++++++++++-
 .../lib/structure/io/type-serializers.js        |  24 +++-
 .../test/cucumber/feature-steps.js              |   1 +
 gremlin-python/glv/TraversalSource.template     |  21 +++-
 gremlin-python/glv/generate.groovy              |   9 +-
 .../gremlin/python/jsr223/PythonTranslator.java |   7 ++
 .../jython/gremlin_python/process/traversal.py  |  61 ++++++++-
 .../gremlin_python/structure/io/graphsonV2d0.py |  13 +-
 .../gremlin_python/structure/io/graphsonV3d0.py |  13 +-
 .../src/main/jython/radish/feature_steps.py     |   3 +-
 gremlin-test/features/filter/Has.feature        |  57 ++++++++-
 .../process/traversal/step/filter/HasTest.java  |  86 +++++++++++++
 35 files changed, 1061 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index b475c86..554ec2f 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 
 This release also includes changes from <<release-3-3-3, 3.3.3>>.
 
+* Added text predicates.
 * Rewrote `ConnectiveStrategy` to support an arbitrary number of infix notations in a single traversal.
 * GraphSON `MessageSerializer`s will automatically register the GremlinServerModule to a provided GraphSONMapper.
 * Removed support for `-i` option in Gremlin Server which was previously deprecated.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index 6146f9b..da7260c 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -3356,24 +3356,32 @@ interface. Steps that allow for this type of modulation will explicitly state so
 [[a-note-on-predicates]]
 == A Note on Predicates
 
-A `P` is a predicate of the form `Function<Object,Boolean>`. That is, given some object, return true or false. The
-provided predicates are outlined in the table below and are used in various steps such as <<has-step,`has()`>>-step,
+A `P` is a predicate of the form `Function<Object,Boolean>`. That is, given some object, return true or false. As of
+the relase of TinkerPop 3.4.0, Gremlin also supports simple text predicates, which only work on `String` values. The `TP`
+text predicates extends the `P` predicates, but are specialized in that they are of the form `Function<String,Boolean>`.
+The provided predicates are outlined in the table below and are used in various steps such as <<has-step,`has()`>>-step,
 <<where-step,`where()`>>-step, <<is-step,`is()`>>-step, etc.
 
 [width="100%",cols="3,15",options="header"]
 |=========================================================
 | Predicate | Description
-| `eq(object)` | Is the incoming object equal to the provided object?
-| `neq(object)` | Is the incoming object not equal to the provided object?
-| `lt(number)` | Is the incoming number less than the provided number?
-| `lte(number)` | Is the incoming number less than or equal to the provided number?
-| `gt(number)` | Is the incoming number greater than the provided number?
-| `gte(number)` | Is the incoming number greater than or equal to the provided number?
-| `inside(number,number)` | Is the incoming number greater than the first provided number and less than the second?
-| `outside(number,number)` | Is the incoming number less than the first provided number or greater than the second?
-| `between(number,number)` | Is the incoming number greater than or equal to the first provided number and less than the second?
-| `within(objects...)` | Is the incoming object in the array of provided objects?
-| `without(objects...)` | Is the incoming object not in the array of the provided objects?
+| `P.eq(object)` | Is the incoming object equal to the provided object?
+| `P.neq(object)` | Is the incoming object not equal to the provided object?
+| `P.lt(number)` | Is the incoming number less than the provided number?
+| `P.lte(number)` | Is the incoming number less than or equal to the provided number?
+| `P.gt(number)` | Is the incoming number greater than the provided number?
+| `P.gte(number)` | Is the incoming number greater than or equal to the provided number?
+| `P.inside(number,number)` | Is the incoming number greater than the first provided number and less than the second?
+| `P.outside(number,number)` | Is the incoming number less than the first provided number or greater than the second?
+| `P.between(number,number)` | Is the incoming number greater than or equal to the first provided number and less than the second?
+| `P.within(objects...)` | Is the incoming object in the array of provided objects?
+| `P.without(objects...)` | Is the incoming object not in the array of the provided objects?
+| `TP.startsWith(string)` | Does the incoming `String` start with the provided `String`?
+| `TP.endsWith(string)` | Does the incoming `String` end with the provided `String`?
+| `TP.contains(string)` | Does the incoming `String` contain the provided `String`?
+| `TP.startsNotWith(string)` | TODO: find a better name
+| `TP.endsNotWith(string)` | TODO: find a better name
+| `TP.absent(string)` | TODO: find a better name
 |=========================================================
 
 [gremlin-groovy]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/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 69a2502..c26b9c7 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -29,6 +29,21 @@ Please see the link:https://github.com/apache/tinkerpop/blob/3.4.0/CHANGELOG.asc
 
 === Upgrading for Users
 
+==== Added text predicates
+
+Gremlin now supports simple text predicates on top of the existing `P` predicates. Both, the new `TP` text predicates and the old `P` predicates, can be chained using `and()` and `or()`.
+
+[source,groovy]
+----
+gremlin> g.V().has("person","name", contains("o")).valueMap()
+==>[name:[marko],age:[29]]
+==>[name:[josh],age:[32]]
+gremlin> g.V().has("person","name", contains("o").and(gte("j").and(endsWith("ko")))).valueMap()
+==>[name:[marko],age:[29]]
+----
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-2041[TINKERPOP-2041]
+
 ==== Changed infix behavior
 
 The infix notation of `and()` and `or()` now supports an arbitrary number of traversals and `ConnectiveStrategy` produces a traversal with proper AND and OR semantics.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
index 2b1e33e..38ef258 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
@@ -67,6 +67,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
@@ -181,6 +182,7 @@ public final class CoreImports {
         CLASS_IMPORTS.add(TraversalOptionParent.class);
         CLASS_IMPORTS.add(TraversalOptionParent.Pick.class);
         CLASS_IMPORTS.add(P.class);
+        CLASS_IMPORTS.add(TP.class);
         // remote
         CLASS_IMPORTS.add(RemoteConnection.class);
         CLASS_IMPORTS.add(RemoteGraph.class);
@@ -291,6 +293,7 @@ public final class CoreImports {
 
         uniqueMethods(IoCore.class).forEach(METHOD_IMPORTS::add);
         uniqueMethods(P.class).forEach(METHOD_IMPORTS::add);
+        uniqueMethods(TP.class).forEach(METHOD_IMPORTS::add);
         uniqueMethods(__.class).filter(m -> !m.getName().equals("__")).forEach(METHOD_IMPORTS::add);
         uniqueMethods(Computer.class).forEach(METHOD_IMPORTS::add);
         uniqueMethods(TimeUtil.class).forEach(METHOD_IMPORTS::add);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TP.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TP.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TP.java
new file mode 100644
index 0000000..fc245a4
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TP.java
@@ -0,0 +1,107 @@
+/*
+ * 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 java.util.function.BiPredicate;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public class TP extends P<String> {
+
+    @SuppressWarnings("WeakerAccess")
+    public TP(final BiPredicate<String, String> biPredicate, final String value) {
+        super(biPredicate, value);
+    }
+
+    @Override
+    public boolean equals(final Object other) {
+        return other instanceof TP && super.equals(other);
+    }
+
+    @Override
+    public String toString() {
+        return null == this.originalValue ? this.biPredicate.toString() : this.biPredicate.toString() + "(" + this.originalValue + ")";
+    }
+
+    @Override
+    public TP negate() {
+        return new TP(this.biPredicate.negate(), this.originalValue);
+    }
+
+    public TP clone() {
+        return (TP) super.clone();
+    }
+
+    //////////////// statics
+
+    /**
+     * Determines if String does start with the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TP startsWith(final String value) {
+        return new TP(Text.startsWith, value);
+    }
+
+    /**
+     * Determines if String does not start with the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TP startsNotWith(final String value) {
+        return new TP(Text.startsNotWith, value);
+    }
+
+    /**
+     * Determines if String does start with the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TP endsWith(final String value) {
+        return new TP(Text.endsWith, value);
+    }
+
+    /**
+     * Determines if String does not start with the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TP endsNotWith(final String value) {
+        return new TP(Text.endsNotWith, value);
+    }
+
+    /**
+     * Determines if String does contain the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TP contains(final String value) {
+        return new TP(Text.contains, value);
+    }
+
+    /**
+     * Determines if String does not contain the given value.
+     *
+     * @since 3.4.0
+     */
+    public static TP absent(final String value) {
+        return new TP(Text.absent, value);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
new file mode 100644
index 0000000..5169309
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Text.java
@@ -0,0 +1,123 @@
+/*
+ * 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 java.util.function.BiPredicate;
+
+/**
+ * @author Daniel Kuppitz (http://gremlin.guru)
+ */
+public enum Text implements BiPredicate<String, String> {
+
+    startsWith {
+        @Override
+        public boolean test(final String value, final String prefix) {
+            return value.startsWith(prefix);
+        }
+
+        /**
+         * The negative of {@code startsWith} is {@link #startsNotWith}.
+         */
+        @Override
+        public Text negate() {
+            return startsNotWith;
+        }
+    },
+
+    startsNotWith {
+        @Override
+        public boolean test(final String value, final String prefix) {
+            return !startsWith.test(value, prefix);
+        }
+
+        /**
+         * The negative of {@code startsNotWith} is {@link #startsWith}.
+         */
+        @Override
+        public Text negate() {
+            return startsWith;
+        }
+    },
+
+    endsWith {
+        @Override
+        public boolean test(final String value, final String suffix) {
+            return value.endsWith(suffix);
+        }
+
+        /**
+         * The negative of {@code endsWith} is {@link #endsNotWith}.
+         */
+        @Override
+        public Text negate() {
+            return endsNotWith;
+        }
+    },
+
+    endsNotWith {
+        @Override
+        public boolean test(final String value, final String prefix) {
+            return !endsWith.test(value, prefix);
+        }
+
+        /**
+         * The negative of {@code endsNotWith} is {@link #endsWith}.
+         */
+        @Override
+        public Text negate() {
+            return endsWith;
+        }
+    },
+
+    contains {
+        @Override
+        public boolean test(final String value, final String search) {
+            return value.contains(search);
+        }
+
+        /**
+         * The negative of {@code contains} is {@link #absent}.
+         */
+        @Override
+        public Text negate() {
+            return absent;
+        }
+    },
+
+    absent{
+        @Override
+        public boolean test(final String value, final String search) {
+            return !contains.test(value, search);
+        }
+
+        /**
+         * The negative of {@code absent} is {@link #contains}.
+         */
+        @Override
+        public Text negate() {
+            return contains;
+        }
+    };
+
+    /**
+     * Produce the opposite representation of the current {@code Text} enum.
+     */
+    @Override
+    public abstract Text negate();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index 1bccd7c..74647a1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -145,6 +146,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                     put(AndP.class, "P");
                     put(OrP.class, "P");
                     put(P.class, "P");
+                    put(TP.class, "TP");
                     Stream.of(
                             VertexProperty.Cardinality.class,
                             Column.class,
@@ -270,6 +272,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                     TraversalOptionParent.Pick.values(),
                     T.values()).flatMap(Stream::of).forEach(e -> addDeserializer(e.getClass(), new TraversalSerializersV3d0.EnumJacksonDeserializer(e.getDeclaringClass())));
             addDeserializer(P.class, new TraversalSerializersV3d0.PJacksonDeserializer());
+            addDeserializer(TP.class, new TraversalSerializersV3d0.TPJacksonDeserializer());
             addDeserializer(Lambda.class, new TraversalSerializersV3d0.LambdaJacksonDeserializer());
             addDeserializer(Traverser.class, new TraversalSerializersV3d0.TraverserJacksonDeserializer());
             Arrays.asList(
@@ -359,6 +362,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                     put(AndP.class, "P");
                     put(OrP.class, "P");
                     put(P.class, "P");
+                    put(TP.class, "TP");
                     Stream.of(
                             VertexProperty.Cardinality.class,
                             Column.class,
@@ -476,6 +480,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                     TraversalOptionParent.Pick.values(),
                     T.values()).flatMap(Stream::of).forEach(e -> addDeserializer(e.getClass(), new TraversalSerializersV2d0.EnumJacksonDeserializer(e.getDeclaringClass())));
             addDeserializer(P.class, new TraversalSerializersV2d0.PJacksonDeserializer());
+            addDeserializer(TP.class, new TraversalSerializersV2d0.TPJacksonDeserializer());
             addDeserializer(Lambda.class, new TraversalSerializersV2d0.LambdaJacksonDeserializer());
             addDeserializer(Traverser.class, new TraversalSerializersV2d0.TraverserJacksonDeserializer());
             Arrays.asList(

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
index 2a07723..7ba4ca5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV2d0.java
@@ -24,6 +24,7 @@ import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -372,6 +373,40 @@ final class TraversalSerializersV2d0 {
         }
     }
 
+    final static class TPJacksonDeserializer extends StdDeserializer<TP> {
+
+        public TPJacksonDeserializer() {
+            super(TP.class);
+        }
+
+        @Override
+        public TP deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+            String predicate = null;
+            String value = null;
+
+            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
+                if (jsonParser.getCurrentName().equals(GraphSONTokens.PREDICATE)) {
+                    jsonParser.nextToken();
+                    predicate = jsonParser.getText();
+                } else if (jsonParser.getCurrentName().equals(GraphSONTokens.VALUE)) {
+                    jsonParser.nextToken();
+                    value = deserializationContext.readValue(jsonParser, String.class);
+                }
+            }
+
+            try {
+                return (TP) TP.class.getMethod(predicate, String.class).invoke(null, value);
+            } catch (final Exception e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
+        }
+
+        @Override
+        public boolean isCachable() {
+            return true;
+        }
+    }
+
     final static class LambdaJacksonDeserializer extends StdDeserializer<Lambda> {
 
         public LambdaJacksonDeserializer() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java
index eaa7b0f..ca01ec0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/TraversalSerializersV3d0.java
@@ -24,6 +24,7 @@ import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
@@ -370,6 +371,40 @@ final class TraversalSerializersV3d0 {
         }
     }
 
+    final static class TPJacksonDeserializer extends StdDeserializer<TP> {
+
+        public TPJacksonDeserializer() {
+            super(TP.class);
+        }
+
+        @Override
+        public TP deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+            String predicate = null;
+            String value = null;
+
+            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
+                if (jsonParser.getCurrentName().equals(GraphSONTokens.PREDICATE)) {
+                    jsonParser.nextToken();
+                    predicate = jsonParser.getText();
+                } else if (jsonParser.getCurrentName().equals(GraphSONTokens.VALUE)) {
+                    jsonParser.nextToken();
+                    value = deserializationContext.readValue(jsonParser, String.class);
+                }
+            }
+
+            try {
+                return (TP) TP.class.getMethod(predicate, String.class).invoke(null, value);
+            } catch (final Exception e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
+        }
+
+        @Override
+        public boolean isCachable() {
+            return true;
+        }
+    }
+
     final static class LambdaJacksonDeserializer extends StdDeserializer<Lambda> {
 
         public LambdaJacksonDeserializer() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java
index ca7c241..c7de4ec 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV1d0.java
@@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraver
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.util.AndP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
@@ -228,6 +229,26 @@ public final class GryoSerializersV1d0 {
         }
     }
 
+    public final static class TPSerializer implements SerializerShim<TP> {
+        @Override
+        public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final TP p) {
+            output.writeString(p.getBiPredicate().toString());
+            kryo.writeObject(output, p.getValue());
+        }
+
+        @Override
+        public <I extends InputShim> TP read(final KryoShim<I, ?> kryo, final I input, final Class<TP> clazz) {
+            final String predicate = input.readString();
+            final String value = kryo.readObject(input, String.class);
+
+            try {
+                return (TP) TP.class.getMethod(predicate, String.class).invoke(null, value);
+            } catch (final Exception e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
+        }
+    }
+
     public final static class LambdaSerializer implements SerializerShim<Lambda> {
         @Override
         public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final Lambda lambda) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java
index fee9345..ffda00e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoSerializersV3d0.java
@@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraver
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.util.AndP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
@@ -344,6 +345,26 @@ public final class GryoSerializersV3d0 {
         }
     }
 
+    public final static class TPSerializer implements SerializerShim<TP> {
+        @Override
+        public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final TP p) {
+            output.writeString(p.getBiPredicate().toString());
+            kryo.writeObject(output, p.getValue());
+        }
+
+        @Override
+        public <I extends InputShim> TP read(final KryoShim<I, ?> kryo, final I input, final Class<TP> clazz) {
+            final String predicate = input.readString();
+            final String value = kryo.readObject(input, String.class);
+
+            try {
+                return (TP) TP.class.getMethod(predicate, String.class).invoke(null, value);
+            } catch (final Exception e) {
+                throw new IllegalStateException(e.getMessage(), e);
+            }
+        }
+    }
+
     public final static class LambdaSerializer implements SerializerShim<Lambda> {
         @Override
         public <O extends OutputShim> void write(final KryoShim<?, O> kryo, final O output, final Lambda lambda) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
index 7af3766..fb62fee 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/gryo/GryoVersion.java
@@ -33,6 +33,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.filter.RangeGlobalStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.FoldStep;
@@ -244,7 +245,7 @@ public enum GryoVersion {
             add(GryoTypeReg.of(Collections.singleton(null).getClass(), 54));
             add(GryoTypeReg.of(Collections.singletonList(null).getClass(), 24));
             add(GryoTypeReg.of(Collections.singletonMap(null, null).getClass(), 23));
-            add(GryoTypeReg.of(Types.COLLECTIONS_SYNCHRONIZED_MAP, 185, new UtilSerializers.SynchronizedMapSerializer()));  // ***LAST ID***
+            add(GryoTypeReg.of(Types.COLLECTIONS_SYNCHRONIZED_MAP, 185, new UtilSerializers.SynchronizedMapSerializer()));
             add(GryoTypeReg.of(Contains.class, 49));
             add(GryoTypeReg.of(Currency.class, 40));
             add(GryoTypeReg.of(Date.class, 38));
@@ -311,6 +312,7 @@ public enum GryoVersion {
 
             add(GryoTypeReg.of(Bytecode.class, 122, new GryoSerializersV3d0.BytecodeSerializer()));
             add(GryoTypeReg.of(P.class, 124, new GryoSerializersV3d0.PSerializer()));
+            add(GryoTypeReg.of(TP.class, 186, new GryoSerializersV3d0.TPSerializer())); // ***LAST ID***
             add(GryoTypeReg.of(Lambda.class, 125, new GryoSerializersV3d0.LambdaSerializer()));
             add(GryoTypeReg.of(Bytecode.Binding.class, 126, new GryoSerializersV3d0.BindingSerializer()));
             add(GryoTypeReg.of(Order.class, 127));
@@ -436,7 +438,7 @@ public enum GryoVersion {
             add(GryoTypeReg.of(Collections.singleton(null).getClass(), 54));
             add(GryoTypeReg.of(Collections.singletonList(null).getClass(), 24));
             add(GryoTypeReg.of(Collections.singletonMap(null, null).getClass(), 23));
-            add(GryoTypeReg.of(Types.COLLECTIONS_SYNCHRONIZED_MAP, 185, new UtilSerializers.SynchronizedMapSerializer()));  // ***LAST ID***
+            add(GryoTypeReg.of(Types.COLLECTIONS_SYNCHRONIZED_MAP, 185, new UtilSerializers.SynchronizedMapSerializer()));
             add(GryoTypeReg.of(Contains.class, 49));
             add(GryoTypeReg.of(Currency.class, 40));
             add(GryoTypeReg.of(Date.class, 38));
@@ -502,6 +504,7 @@ public enum GryoVersion {
 
             add(GryoTypeReg.of(Bytecode.class, 122, new GryoSerializersV1d0.BytecodeSerializer()));
             add(GryoTypeReg.of(P.class, 124, new GryoSerializersV1d0.PSerializer()));
+            add(GryoTypeReg.of(TP.class, 186, new GryoSerializersV1d0.TPSerializer())); // ***LAST ID***
             add(GryoTypeReg.of(Lambda.class, 125, new GryoSerializersV1d0.LambdaSerializer()));
             add(GryoTypeReg.of(Bytecode.Binding.class, 126, new GryoSerializersV1d0.BindingSerializer()));
             add(GryoTypeReg.of(Order.class, 127));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
index 6ec33cc..1060b4e 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/PTest.java
@@ -94,6 +94,21 @@ public class PTest {
                     {P.between("m", "n").or(P.eq("daniel")), "marko", true},
                     {P.between("m", "n").or(P.eq("daniel")), "daniel", true},
                     {P.between("m", "n").or(P.eq("daniel")), "stephen", false},
+                    // text predicates
+                    {TP.contains("ark"), "marko", true},
+                    {TP.contains("ark"), "josh", false},
+                    {TP.startsWith("jo"), "marko", false},
+                    {TP.startsWith("jo"), "josh", true},
+                    {TP.endsWith("ter"), "marko", false},
+                    {TP.endsWith("ter"), "peter", true},
+                    {TP.contains("o"), "marko", true},
+                    {TP.contains("o"), "josh", true},
+                    {TP.contains("o").and(P.gte("j")), "marko", true},
+                    {TP.contains("o").and(P.gte("j")), "josh", true},
+                    {TP.contains("o").and(P.gte("j")).and(TP.endsWith("ko")), "marko", true},
+                    {TP.contains("o").and(P.gte("j")).and(TP.endsWith("ko")), "josh", false},
+                    {TP.contains("o").and(P.gte("j").and(TP.endsWith("ko"))), "marko", true},
+                    {TP.contains("o").and(P.gte("j").and(TP.endsWith("ko"))), "josh", false},
             }));
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
index 4e86ebd..52a7ee4 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperPartialEmbeddedTypeTest.java
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.structure.io.graphson;
 import org.apache.tinkerpop.gremlin.process.remote.traversal.DefaultRemoteTraverser;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.shaded.jackson.databind.JsonMappingException;
 import org.apache.tinkerpop.shaded.jackson.databind.ObjectMapper;
@@ -327,10 +328,19 @@ public class GraphSONMapperPartialEmbeddedTypeTest extends AbstractGraphSONTest
                 P.without(1,2,3,4),
                 P.without(Arrays.asList(1,2,3,4)),
                 P.eq(1).and(P.eq(2)),
-                P.eq(1).or(P.eq(2)));
+                P.eq(1).or(P.eq(2)),
+                TP.contains("ark"),
+                TP.startsWith("mar"),
+                TP.endsWith("ko"),
+                TP.endsWith("ko").and(P.gte("mar")),
+                P.gte("mar").and(TP.endsWith("ko")));
 
         for (P p : variantsOfP) {
-            assertEquals(p, serializeDeserialize(mapper, p, P.class));
+            if (p instanceof TP) {
+                assertEquals(p, serializeDeserialize(mapper, p, TP.class));
+            } else {
+                assertEquals(p, serializeDeserialize(mapper, p, P.class));
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-dotnet/glv/TP.template
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/TP.template b/gremlin-dotnet/glv/TP.template
new file mode 100644
index 0000000..22320ea
--- /dev/null
+++ b/gremlin-dotnet/glv/TP.template
@@ -0,0 +1,71 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+// THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace Gremlin.Net.Process.Traversal
+{
+#pragma warning disable 1591
+
+    /// <summary>
+    ///     A <see cref="TP" /> is a predicate of the form Func&lt;string, bool&gt;.
+    ///     That is, given some string, return true or false.
+    /// </summary>
+    public class TP : P
+    {
+        /// <summary>
+        ///     Initializes a new instance of the <see cref="TP" /> class.
+        /// </summary>
+        /// <param name="operatorName">The name of the predicate.</param>
+        /// <param name="value">The value of the predicate.</param>
+        /// <param name="other">An optional other predicate that is used as an argument for this predicate.</param>
+        public TP(string operatorName, string value, P other = null) : base(operatorName, value, other)
+        {
+        }
+
+<% tpmethods.each { method -> %>
+        public static TP <%= toCSharpMethodName.call(method) %>(string value)
+        {
+            return new TP("<%= method %>", value);
+        }
+<% } %>
+
+        private static T[] ToGenericArray<T>(ICollection<T> collection)
+        {
+            return collection?.ToArray() ?? new T[0];
+        }
+
+        /// <inheritdoc />
+        public override string ToString()
+        {
+            return Other == null ? \$"{OperatorName}({Value})" : \$"{OperatorName}({Value},{Other})";
+        }
+    }
+
+#pragma warning restore 1591
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-dotnet/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/glv/generate.groovy b/gremlin-dotnet/glv/generate.groovy
index 0c93f3d..3dbd959 100644
--- a/gremlin-dotnet/glv/generate.groovy
+++ b/gremlin-dotnet/glv/generate.groovy
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
 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.P
+import org.apache.tinkerpop.gremlin.process.traversal.TP
 import org.apache.tinkerpop.gremlin.process.traversal.IO
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
 import org.apache.tinkerpop.gremlin.structure.Direction
@@ -59,6 +60,7 @@ def toCSharpTypeMap = ["Long": "long",
                        "Traversal[]": "ITraversal[]",
                        "Predicate": "IPredicate",
                        "P": "P",
+                       "TP": "TP",
                        "TraversalStrategy": "ITraversalStrategy",
                        "TraversalStrategy[]": "ITraversalStrategy[]",
                        "Function": "IFunction",
@@ -241,6 +243,12 @@ def binding = ["pmethods": P.class.getMethods().
         collect { it.name }.
         unique().
         sort { a, b -> a <=> b },
+               "tpmethods": TP.class.getMethods().
+                       findAll { Modifier.isStatic(it.getModifiers()) }.
+                       findAll { TP.class.isAssignableFrom(it.returnType) }.
+                       collect { it.name }.
+                       unique().
+                       sort { a, b -> a <=> b },
                "sourceStepMethods": GraphTraversalSource.getMethods(). // SOURCE STEPS
                         findAll { GraphTraversalSource.class.equals(it.returnType) }.
                         findAll {
@@ -334,6 +342,10 @@ def pTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/P.template
 def pFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/P.cs")
 pFile.newWriter().withWriter{ it << pTemplate }
 
+def tpTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/TP.template")).make(binding)
+def tpFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/TP.cs")
+tpFile.newWriter().withWriter{ it << tpTemplate }
+
 binding.tokens.each {k,v ->
     def tokenTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/Token.template")).make([tokenFields: v, tokenName: k])
     def tokenFile = new File("${projectBaseDir}/src/Gremlin.Net/Process/Traversal/${k}.cs")
@@ -382,4 +394,4 @@ def templateCsprojFile = new File("${projectBaseDir}/src/Gremlin.Net.Template/Gr
 templateCsprojFile.newWriter().withWriter{ it << templateCsprojTemplate }
 def nuspecTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/Gremlin.Net.Template.nuspec.template")).make(["projectVersion":versionToUse])
 def nuspecFile = new File("${projectBaseDir}/src/Gremlin.Net.Template/Gremlin.Net.Template.nuspec")
-nuspecFile.newWriter().withWriter{ it << nuspecTemplate }
\ No newline at end of file
+nuspecFile.newWriter().withWriter{ it << nuspecTemplate }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
new file mode 100644
index 0000000..ac6415d
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/TP.cs
@@ -0,0 +1,96 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+// THIS IS A GENERATED FILE - DO NOT MODIFY THIS FILE DIRECTLY - see pom.xml
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace Gremlin.Net.Process.Traversal
+{
+#pragma warning disable 1591
+
+    /// <summary>
+    ///     A <see cref="TP" /> is a predicate of the form Func&lt;string, bool&gt;.
+    ///     That is, given some string, return true or false.
+    /// </summary>
+    public class TP : P
+    {
+        /// <summary>
+        ///     Initializes a new instance of the <see cref="P" /> class.
+        /// </summary>
+        /// <param name="operatorName">The name of the predicate.</param>
+        /// <param name="value">The value of the predicate.</param>
+        /// <param name="other">An optional other predicate that is used as an argument for this predicate.</param>
+        public TP(string operatorName, string value, P other = null) : base(operatorName, value, other)
+        {
+        }
+
+
+        public static TP Absent(string value)
+        {
+            return new TP("absent", value);
+        }
+
+        public static TP Contains(string value)
+        {
+            return new TP("contains", value);
+        }
+
+        public static TP EndsNotWith(string value)
+        {
+            return new TP("endsNotWith", value);
+        }
+
+        public static TP EndsWith(string value)
+        {
+            return new TP("endsWith", value);
+        }
+
+        public static TP StartsNotWith(string value)
+        {
+            return new TP("startsNotWith", value);
+        }
+
+        public static TP StartsWith(string value)
+        {
+            return new TP("startsWith", value);
+        }
+
+
+        private static T[] ToGenericArray<T>(ICollection<T> collection)
+        {
+            return collection?.ToArray() ?? new T[0];
+        }
+
+        /// <inheritdoc />
+        public override string ToString()
+        {
+            return Other == null ? $"{OperatorName}({Value})" : $"{OperatorName}({Value},{Other})";
+        }
+    }
+
+#pragma warning restore 1591
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
index 9349e57..3178d21 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/GraphSONWriter.cs
@@ -58,6 +58,7 @@ namespace Gremlin.Net.Structure.IO.GraphSON
                 {typeof(Type), new ClassSerializer()},
                 {typeof(EnumWrapper), new EnumSerializer()},
                 {typeof(P), new PSerializer()},
+                {typeof(TP), new TPSerializer()},
                 {typeof(Vertex), new VertexSerializer()},
                 {typeof(Edge), new EdgeSerializer()},
                 {typeof(Property), new PropertySerializer()},
@@ -163,4 +164,4 @@ namespace Gremlin.Net.Structure.IO.GraphSON
                 yield return ToDict(e);
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TPSerializer.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TPSerializer.cs b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TPSerializer.cs
new file mode 100644
index 0000000..22ed358
--- /dev/null
+++ b/gremlin-dotnet/src/Gremlin.Net/Structure/IO/GraphSON/TPSerializer.cs
@@ -0,0 +1,45 @@
+#region License
+
+/*
+ * 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.
+ */
+
+#endregion
+
+using System.Collections.Generic;
+using Gremlin.Net.Process.Traversal;
+
+namespace Gremlin.Net.Structure.IO.GraphSON
+{
+    internal class TPSerializer : IGraphSONSerializer
+    {
+        public Dictionary<string, dynamic> Dictify(dynamic predicate, GraphSONWriter writer)
+        {
+            TP p = predicate;
+            var value = p.Other == null
+                ? writer.ToDict(p.Value)
+                : new List<dynamic> {writer.ToDict(p.Value), writer.ToDict(p.Other)};
+            var dict = new Dictionary<string, dynamic>
+            {
+                {"predicate", p.OperatorName},
+                {"value", value}
+            };
+            return GraphSONUtil.ToTypedValue("TP", dict);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 717e1bc..a3e593a 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -24,6 +24,7 @@ import org.apache.commons.configuration.ConfigurationConverter;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -225,6 +226,7 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
     }
 
     private StringBuilder convertPToString(final P p, final StringBuilder current) {
+        if (p instanceof TP) return convertTPToString((TP) p, current);
         if (p instanceof ConnectiveP) {
             final List<P<?>> list = ((ConnectiveP) p).getPredicates();
             for (int i = 0; i < list.size(); i++) {
@@ -237,4 +239,9 @@ public final class GroovyTranslator implements Translator.ScriptTranslator {
             current.append("P.").append(p.getBiPredicate().toString()).append("(").append(convertToString(p.getValue())).append(")");
         return current;
     }
+
+    private StringBuilder convertTPToString(final TP p, final StringBuilder current) {
+        current.append("TP.").append(p.getBiPredicate().toString()).append("(").append(convertToString(p.getValue())).append(")");
+        return current;
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-javascript/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/TraversalSource.template b/gremlin-javascript/glv/TraversalSource.template
index ffe0fbc..14df95b 100644
--- a/gremlin-javascript/glv/TraversalSource.template
+++ b/gremlin-javascript/glv/TraversalSource.template
@@ -162,6 +162,48 @@ function createP(operator, args) {
   return new (Function.prototype.bind.apply(P, args));
 }
 
+class TP {
+  /**
+   * Represents an operation.
+   * @constructor
+   */
+  constructor(operator, value, other) {
+    this.operator = operator;
+    this.value = value;
+    this.other = other;
+  }
+
+  /**
+   * Returns the string representation of the instance.
+   * @returns {string}
+   */
+  toString() {
+    if (this.other === undefined) {
+      return this.operator + '(' + this.value + ')';
+    }
+    return this.operator + '(' + this.value + ', ' + this.other + ')';
+  }
+
+  and(arg) {
+    return new P('and', this, arg);
+  }
+
+  or(arg) {
+    return new P('or', this, arg);
+  }
+<% tpmethods.each{ method -> %>
+  /** @param {...Object} args */
+  static <%= toJs.call(method) %>(...args) {
+    return createTP('<%= method %>', args);
+  }
+<% } %>
+}
+
+function createTP(operator, args) {
+  args.unshift(null, operator);
+  return new (Function.prototype.bind.apply(TP, args));
+}
+
 class Traverser {
   constructor(object, bulk) {
     this.object = object;
@@ -199,6 +241,7 @@ class EnumValue {
 module.exports = {
   EnumValue,
   P,
+  TP,
   IO,
   Traversal,
   TraversalSideEffects,
@@ -208,4 +251,4 @@ enums.each{ enumClass ->
         enumClass.getEnumConstants().sort { a, b -> a.name() <=> b.name() }.collect { toJs.call(it.name()) }.join(' ') + "')"
 }
 %>
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-javascript/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-javascript/glv/generate.groovy b/gremlin-javascript/glv/generate.groovy
index aab55d4..243c607 100644
--- a/gremlin-javascript/glv/generate.groovy
+++ b/gremlin-javascript/glv/generate.groovy
@@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
 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.P
+import org.apache.tinkerpop.gremlin.process.traversal.TP
 import org.apache.tinkerpop.gremlin.process.traversal.IO
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
 import java.lang.reflect.Modifier
@@ -69,6 +70,12 @@ def binding = ["enums": CoreImports.getClassImports()
                        collect { it.name }.
                        unique().
                        sort { a, b -> a <=> b },
+               "tpmethods": TP.class.getMethods().
+                       findAll { Modifier.isStatic(it.getModifiers()) }.
+                       findAll { TP.class.isAssignableFrom(it.returnType) }.
+                       collect { it.name }.
+                       unique().
+                       sort { a, b -> a <=> b },
                "sourceStepMethods": GraphTraversalSource.getMethods(). // SOURCE STEPS
                        findAll { GraphTraversalSource.class.equals(it.returnType) }.
                        findAll {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
index c2e810d..b15ecbc 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/index.js
@@ -49,6 +49,7 @@ module.exports = {
     Bytecode: Bytecode,
     EnumValue: t.EnumValue,
     P: t.P,
+    TP: t.TP,
     Traversal: t.Traversal,
     TraversalSideEffects: t.TraversalSideEffects,
     TraversalStrategies: strategiesModule.TraversalStrategies,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
index 2b9ba26..ca9d062 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/process/traversal.js
@@ -310,6 +310,73 @@ function createP(operator, args) {
   return new (Function.prototype.bind.apply(P, args));
 }
 
+class TP {
+  /**
+   * Represents an operation.
+   * @constructor
+   */
+  constructor(operator, value, other) {
+    this.operator = operator;
+    this.value = value;
+    this.other = other;
+  }
+
+  /**
+   * Returns the string representation of the instance.
+   * @returns {string}
+   */
+  toString() {
+    if (this.other === undefined) {
+      return this.operator + '(' + this.value + ')';
+    }
+    return this.operator + '(' + this.value + ', ' + this.other + ')';
+  }
+
+  and(arg) {
+    return new P('and', this, arg);
+  }
+
+  or(arg) {
+    return new P('or', this, arg);
+  }
+
+  /** @param {...Object} args */
+  static absent(...args) {
+    return createTP('absent', args);
+  }
+
+  /** @param {...Object} args */
+  static contains(...args) {
+    return createTP('contains', args);
+  }
+
+  /** @param {...Object} args */
+  static endsNotWith(...args) {
+    return createTP('endsNotWith', args);
+  }
+
+  /** @param {...Object} args */
+  static endsWith(...args) {
+    return createTP('endsWith', args);
+  }
+
+  /** @param {...Object} args */
+  static startsNotWith(...args) {
+    return createTP('startsNotWith', args);
+  }
+
+  /** @param {...Object} args */
+  static startsWith(...args) {
+    return createTP('startsWith', args);
+  }
+
+}
+
+function createTP(operator, args) {
+  args.unshift(null, operator);
+  return new (Function.prototype.bind.apply(TP, args));
+}
+
 class Traverser {
   constructor(object, bulk) {
     this.object = object;
@@ -347,6 +414,7 @@ class EnumValue {
 module.exports = {
   EnumValue,
   P,
+  TP,
   IO,
   Traversal,
   TraversalSideEffects,
@@ -363,4 +431,4 @@ module.exports = {
   pop: toEnum('Pop', 'all first last mixed'),
   scope: toEnum('Scope', 'global local'),
   t: toEnum('T', 'id key label value')
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
index 0e17cc8..ca81c2a 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
@@ -150,6 +150,28 @@ class PSerializer extends TypeSerializer {
   }
 }
 
+class TPSerializer extends TypeSerializer {
+  /** @param {TP} item */
+  serialize(item) {
+    const result = {};
+    result[typeKey] = 'g:TP';
+    const resultValue = result[valueKey] = {
+      'predicate': item.operator
+    };
+    if (item.other === undefined || item.other === null) {
+      resultValue['value'] = this.writer.adaptObject(item.value);
+    }
+    else {
+      resultValue['value'] = [ this.writer.adaptObject(item.value), this.writer.adaptObject(item.other) ];
+    }
+    return result;
+  }
+
+  canBeUsedFor(value) {
+    return (value instanceof t.TP);
+  }
+}
+
 class LambdaSerializer extends TypeSerializer {
   /** @param {Function} item */
   serialize(item) {
@@ -391,4 +413,4 @@ module.exports = {
   valueKey,
   VertexPropertySerializer,
   VertexSerializer
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
index a0ddddb..abef2a2 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js
@@ -218,6 +218,7 @@ function getSandbox(g, parameters) {
     },
     Order: traversalModule.order,
     P: traversalModule.P,
+    TP: traversalModule.TP,
     IO: traversalModule.IO,
     Pick: traversalModule.pick,
     Pop: traversalModule.pop,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-python/glv/TraversalSource.template
----------------------------------------------------------------------
diff --git a/gremlin-python/glv/TraversalSource.template b/gremlin-python/glv/TraversalSource.template
index 713681b..00a5934 100644
--- a/gremlin-python/glv/TraversalSource.template
+++ b/gremlin-python/glv/TraversalSource.template
@@ -152,6 +152,25 @@ def <%= method %>(*args):
 statics.add_static('<%= method %>',<%= method %>)
 <% } %>
 
+class TP(P):
+    def __init__(self, operator, value, other=None):
+        P.__init__(self, operator, value, other)
+<% tpmethods.each { method -> %>
+    @staticmethod
+    def <%= method %>(*args):
+        return TP("<%= toJava.call(method) %>", *args)
+<% } %>
+    def __eq__(self, other):
+        return isinstance(other, self.__class__) and self.operator == other.operator and self.value == other.value and self.other == other.other
+
+    def __repr__(self):
+        return self.operator + "(" + str(self.value) + ")" if self.other is None else self.operator + "(" + str(self.value) + "," + str(self.other) + ")"
+<% tpmethods.findAll{!it.equals("clone")}.each { method -> %>
+def <%= method %>(*args):
+    return TP.<%= method %>(*args)
+statics.add_static('<%= method %>',<%= method %>)
+<% } %>
+
 <% tokens.each { k,v -> %>
 '''
 <%= k %>
@@ -324,4 +343,4 @@ class Binding(object):
         return hash(self.key) + hash(self.value)
 
     def __repr__(self):
-        return "binding[" + self.key + "=" + str(self.value) + "]"
\ No newline at end of file
+        return "binding[" + self.key + "=" + str(self.value) + "]"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-python/glv/generate.groovy
----------------------------------------------------------------------
diff --git a/gremlin-python/glv/generate.groovy b/gremlin-python/glv/generate.groovy
index c7ad241..8c3d647 100644
--- a/gremlin-python/glv/generate.groovy
+++ b/gremlin-python/glv/generate.groovy
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource
 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.P
+import org.apache.tinkerpop.gremlin.process.traversal.TP
 import org.apache.tinkerpop.gremlin.process.traversal.IO
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__
 import java.lang.reflect.Modifier
@@ -63,6 +64,12 @@ def binding = ["enums": CoreImports.getClassImports()
                        collect { toPython(it.name) }.
                        unique().
                        sort { a, b -> a <=> b },
+               "tpmethods": TP.class.getMethods().
+                       findAll { Modifier.isStatic(it.getModifiers()) }.
+                       findAll { TP.class.isAssignableFrom(it.returnType) }.
+                       collect { toPython(it.name) }.
+                       unique().
+                       sort { a, b -> a <=> b },
                "sourceStepMethods": GraphTraversalSource.getMethods(). // SOURCE STEPS
                        findAll { GraphTraversalSource.class.equals(it.returnType) }.
                        findAll {
@@ -102,4 +109,4 @@ traversalFile.newWriter().withWriter{ it << traversalTemplate }
 
 def graphTraversalTemplate = engine.createTemplate(new File("${projectBaseDir}/glv/GraphTraversalSource.template")).make(binding)
 def graphTraversalFile = new File("${projectBaseDir}/src/main/jython/gremlin_python/process/graph_traversal.py")
-graphTraversalFile.newWriter().withWriter{ it << graphTraversalTemplate }
\ No newline at end of file
+graphTraversalFile.newWriter().withWriter{ it << graphTraversalTemplate }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
index 0bc324e..0d2695a 100644
--- a/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
+++ b/gremlin-python/src/main/java/org/apache/tinkerpop/gremlin/python/jsr223/PythonTranslator.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
 import org.apache.tinkerpop.gremlin.process.traversal.Operator;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
@@ -224,6 +225,7 @@ public class PythonTranslator implements Translator.ScriptTranslator {
     }
 
     private StringBuilder convertPToString(final P p, final StringBuilder current) {
+        if (p instanceof TP) return convertTPToString((TP) p, current);
         if (p instanceof ConnectiveP) {
             final List<P<?>> list = ((ConnectiveP) p).getPredicates();
             for (int i = 0; i < list.size(); i++) {
@@ -237,6 +239,11 @@ public class PythonTranslator implements Translator.ScriptTranslator {
         return current;
     }
 
+    private StringBuilder convertTPToString(final TP p, final StringBuilder current) {
+        current.append(convertStatic("TP.")).append(p.getBiPredicate().toString()).append("(").append(convertToString(p.getValue())).append(")");
+        return current;
+    }
+
     protected String convertLambdaToString(final Lambda lambda) {
         final String lambdaString = lambda.getLambdaScript().trim();
         return lambdaString.startsWith("lambda") ? lambdaString : "lambda " + lambdaString;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
index 094bd6d..a4d9708 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/traversal.py
@@ -322,6 +322,65 @@ def without(*args):
 statics.add_static('without',without)
 
 
+class TP(P):
+    def __init__(self, operator, value, other=None):
+        P.__init__(self, operator, value, other)
+
+    @staticmethod
+    def absent(*args):
+        return TP("absent", *args)
+
+    @staticmethod
+    def contains(*args):
+        return TP("contains", *args)
+
+    @staticmethod
+    def endsNotWith(*args):
+        return TP("endsNotWith", *args)
+
+    @staticmethod
+    def endsWith(*args):
+        return TP("endsWith", *args)
+
+    @staticmethod
+    def startsNotWith(*args):
+        return TP("startsNotWith", *args)
+
+    @staticmethod
+    def startsWith(*args):
+        return TP("startsWith", *args)
+
+    def __eq__(self, other):
+        return isinstance(other, self.__class__) and self.operator == other.operator and self.value == other.value and self.other == other.other
+
+    def __repr__(self):
+        return self.operator + "(" + str(self.value) + ")" if self.other is None else self.operator + "(" + str(self.value) + "," + str(self.other) + ")"
+
+def absent(*args):
+    return TP.absent(*args)
+statics.add_static('absent',absent)
+
+def contains(*args):
+    return TP.contains(*args)
+statics.add_static('contains',contains)
+
+def endsNotWith(*args):
+    return TP.endsNotWith(*args)
+statics.add_static('endsNotWith',endsNotWith)
+
+def endsWith(*args):
+    return TP.endsWith(*args)
+statics.add_static('endsWith',endsWith)
+
+def startsNotWith(*args):
+    return TP.startsNotWith(*args)
+statics.add_static('startsNotWith',startsNotWith)
+
+def startsWith(*args):
+    return TP.startsWith(*args)
+statics.add_static('startsWith',startsWith)
+
+
 
 '''
 IO
@@ -556,4 +615,4 @@ class Binding(object):
         return hash(self.key) + hash(self.value)
 
     def __repr__(self):
-        return "binding[" + self.key + "=" + str(self.value) + "]"
\ No newline at end of file
+        return "binding[" + self.key + "=" + str(self.value) + "]"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
index d53a080..2cb0b5b 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
@@ -27,7 +27,7 @@ from aenum import Enum
 
 from gremlin_python import statics
 from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType
-from gremlin_python.process.traversal import Binding, Bytecode, P, Traversal, Traverser, TraversalStrategy
+from gremlin_python.process.traversal import Binding, Bytecode, P, TP, Traversal, Traverser, TraversalStrategy
 from gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path
 
 # When we fall back to a superclass's serializer, we iterate over this map.
@@ -278,6 +278,17 @@ class PSerializer(_GraphSONTypeIO):
         return GraphSONUtil.typedValue("P", out)
 
 
+class TPSerializer(_GraphSONTypeIO):
+    python_type = TP
+
+    @classmethod
+    def dictify(cls, p, writer):
+        out = {"predicate": p.operator,
+               "value": [writer.toDict(p.value), writer.toDict(p.other)] if p.other is not None else
+               writer.toDict(p.value)}
+        return GraphSONUtil.typedValue("TP", out)
+
+
 class BindingSerializer(_GraphSONTypeIO):
     python_type = Binding
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
index 5539448..266e23d 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
@@ -27,7 +27,7 @@ from aenum import Enum
 
 from gremlin_python import statics
 from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType, DictType, ListType, SetType
-from gremlin_python.process.traversal import Binding, Bytecode, P, Traversal, Traverser, TraversalStrategy, T
+from gremlin_python.process.traversal import Binding, Bytecode, P, TP, Traversal, Traverser, TraversalStrategy, T
 from gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path
 
 # When we fall back to a superclass's serializer, we iterate over this map.
@@ -284,6 +284,17 @@ class PSerializer(_GraphSONTypeIO):
         return GraphSONUtil.typedValue("P", out)
 
 
+class TPSerializer(_GraphSONTypeIO):
+    python_type = TP
+
+    @classmethod
+    def dictify(cls, p, writer):
+        out = {"predicate": p.operator,
+               "value": [writer.toDict(p.value), writer.toDict(p.other)] if p.other is not None else
+               writer.toDict(p.value)}
+        return GraphSONUtil.typedValue("TP", out)
+
+
 class BindingSerializer(_GraphSONTypeIO):
     python_type = Binding
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-python/src/main/jython/radish/feature_steps.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/radish/feature_steps.py b/gremlin-python/src/main/jython/radish/feature_steps.py
index aff73dc..151d6d5 100644
--- a/gremlin-python/src/main/jython/radish/feature_steps.py
+++ b/gremlin-python/src/main/jython/radish/feature_steps.py
@@ -21,7 +21,7 @@ import json
 import re
 from gremlin_python.structure.graph import Graph, Path
 from gremlin_python.process.graph_traversal import __
-from gremlin_python.process.traversal import Barrier, Cardinality, P, Pop, Scope, Column, Order, Direction, T, Pick, Operator, IO
+from gremlin_python.process.traversal import Barrier, Cardinality, P, TP, Pop, Scope, Column, Order, Direction, T, Pick, Operator, IO
 from radish import given, when, then
 from hamcrest import *
 
@@ -256,6 +256,7 @@ def _make_traversal(g, traversal_string, params):
          "Direction": Direction,
          "Order": Order,
          "P": P,
+         "TP": TP,
          "IO": IO,
          "Pick": Pick,
          "Pop": Pop,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-test/features/filter/Has.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/filter/Has.feature b/gremlin-test/features/filter/Has.feature
index ddf9984..9d2bf4f 100644
--- a/gremlin-test/features/filter/Has.feature
+++ b/gremlin-test/features/filter/Has.feature
@@ -557,4 +557,59 @@ Feature: Step - has()
     When iterated to list
     Then the result should be unordered
       | result |
-      | d[6].l |
\ No newline at end of file
+      | d[6].l |
+
+  Scenario: g_V_hasXname_containsXarkXX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("name", TP.contains("ark"))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+
+  Scenario: g_V_hasXname_startsWithXmarXX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("name", TP.startsWith("mar"))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |
+
+  Scenario: g_V_hasXname_endsWithXasXX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("name", TP.endsWith("as"))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[vadas] |
+
+  Scenario: g_V_hasXperson_name_containsXoX_andXltXmXXX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("person", "name", TP.contains("o").and(P.lt("m")))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[josh] |
+
+  Scenario: g_V_hasXname_gtXmX_andXcontainsXoXXX
+    Given the modern graph
+    And the traversal of
+      """
+      g.V().has("name", P.gt("m").and(TP.contains("o")))
+      """
+    When iterated to list
+    Then the result should be unordered
+      | result |
+      | v[marko] |

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/519ca65c/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
index 3bdb24a..cb4abab 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
+import org.apache.tinkerpop.gremlin.process.traversal.TP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.structure.Edge;
@@ -125,6 +126,16 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Long> get_g_V_hasXage_withoutX27_29X_count();
 
+    public abstract Traversal<Vertex, Vertex> get_g_V_hasXname_containsXarkXX();
+
+    public abstract Traversal<Vertex,Vertex> get_g_V_hasXname_startsWithXmarXX();
+
+    public abstract Traversal<Vertex,Vertex> get_g_V_hasXname_endsWithXasXX();
+
+    public abstract Traversal<Vertex,Vertex> get_g_V_hasXperson_name_containsXoX_andXltXmXXX();
+
+    public abstract Traversal<Vertex,Vertex> get_g_V_hasXname_gtXmX_andXcontainsXoXXX();
+
     @Test
     @LoadGraphWith(MODERN)
     public void g_V_outXcreatedX_hasXname__mapXlengthX_isXgtX3XXX_name() {
@@ -547,6 +558,56 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
         assertEquals(2L, traversal.next().longValue());
     }
 
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_V_hasXname_containsXarkXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_containsXarkXX();
+        printTraversalForm(traversal);
+        assertTrue(traversal.hasNext());
+        assertTrue(traversal.next().value("name").equals("marko"));
+        assertFalse(traversal.hasNext());
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_V_hasXname_startsWithXmarXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_startsWithXmarXX();
+        printTraversalForm(traversal);
+        assertTrue(traversal.hasNext());
+        assertTrue(traversal.next().value("name").equals("marko"));
+        assertFalse(traversal.hasNext());
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_V_hasXname_endsWithXasXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_endsWithXasXX();
+        printTraversalForm(traversal);
+        assertTrue(traversal.hasNext());
+        assertTrue(traversal.next().value("name").equals("vadas"));
+        assertFalse(traversal.hasNext());
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_V_hasXperson_name_containsXoX_andXltXmXXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXperson_name_containsXoX_andXltXmXXX();
+        printTraversalForm(traversal);
+        assertTrue(traversal.hasNext());
+        assertTrue(traversal.next().value("name").equals("josh"));
+        assertFalse(traversal.hasNext());
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_V_hasXname_gtXmX_andXcontainsXoXXX() {
+        final Traversal<Vertex, Vertex> traversal = get_g_V_hasXname_gtXmX_andXcontainsXoXXX();
+        printTraversalForm(traversal);
+        assertTrue(traversal.hasNext());
+        assertTrue(traversal.next().value("name").equals("marko"));
+        assertFalse(traversal.hasNext());
+    }
+
     public static class Traversals extends HasTest {
         @Override
         public Traversal<Edge, Edge> get_g_EX11X_outV_outE_hasXid_10X(final Object e11Id, final Object e10Id) {
@@ -727,5 +788,30 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
         public Traversal<Vertex, Long> get_g_V_hasXage_withoutX27_29X_count() {
             return g.V().has("age", P.without(27, 29)).count();
         }
+
+        @Override
+        public Traversal<Vertex, Vertex> get_g_V_hasXname_containsXarkXX() {
+            return g.V().has("name", TP.contains("ark"));
+        }
+
+        @Override
+        public Traversal<Vertex, Vertex> get_g_V_hasXname_startsWithXmarXX() {
+            return g.V().has("name", TP.startsWith("mar"));
+        }
+
+        @Override
+        public Traversal<Vertex, Vertex> get_g_V_hasXname_endsWithXasXX() {
+            return g.V().has("name", TP.endsWith("as"));
+        }
+
+        @Override
+        public Traversal<Vertex, Vertex> get_g_V_hasXperson_name_containsXoX_andXltXmXXX() {
+            return g.V().has("person","name", TP.contains("o").and(P.lt("m")));
+        }
+
+        @Override
+        public Traversal<Vertex, Vertex> get_g_V_hasXname_gtXmX_andXcontainsXoXXX() {
+            return g.V().has("name", P.gt("m").and(TP.contains("o")));
+        }
     }
 }
\ No newline at end of file


[03/48] tinkerpop git commit: TINKERPOP-2049 Added with(k) overload

Posted by rd...@apache.org.
TINKERPOP-2049 Added with(k) overload

Makes flag-like uses of with() a bit more succinct.


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

Branch: refs/heads/TINKERPOP-2037
Commit: 9b4cddb94a97a1ea3dee79259e25c2aa28518972
Parents: 1e3d4d2
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 27 08:49:41 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Sep 27 15:38:19 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                 |  2 +-
 .../traversal/dsl/graph/GraphTraversal.java        | 17 +++++++++++++++++
 .../traversal/dsl/graph/GraphTraversalTest.java    | 15 +++++++++++++--
 .../Process/Traversal/GraphTraversal.cs            |  9 +++++++++
 gremlin-test/features/map/ShortestPath.feature     |  4 ++--
 .../traversal/step/map/ShortestPathTest.java       |  4 ++--
 6 files changed, 44 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b4cddb9/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index efb3e43..8f9f328 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -49,7 +49,7 @@ This release also includes changes from <<release-3-3-3, 3.3.3>>.
 * Moved `Parameterizing` interface to the `org.apache.tinkerpop.gremlin.process.traversal.step` package with other marker interfaces of its type.
 * Replaced `Parameterizing.addPropertyMutations()` with `Configuring.configure()`.
 * Changed interface hierarchy for `Parameterizing` and `Mutating` interfaces as they are tightly related.
-* Introduced the `with()` step modulator which can supply configuration options to `Configuring` steps.
+* Introduced the `with(k,v)` and `with(k)` step modulators which can supply configuration options to `Configuring` steps.
 * Added `connectedComponent()` step and related `VertexProgram`.
 * Added `supportsUpsert()` option to `VertexFeatures` and `EdgeFeatures`.
 * `min()` and `max()` now support all types implementing `Comparable`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b4cddb9/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 0f8677e..66b45ec 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
@@ -2564,6 +2564,23 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
     //// WITH-MODULATOR
 
     /**
+     * Provides a configuration to a step in the form of a key which is the same as {@code with(key, true)}. The key
+     * of the configuration must be step specific and therefore a configuration could be supplied that is not known to
+     * be valid until execution.
+     *
+     * @param key the key of the configuration to apply to a step
+     * @return the traversal with a modulated step
+     * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#with-step" target="_blank">Reference Documentation - With Step</a>
+     * @since 3.4.0
+     */
+    public default GraphTraversal<S,E> with(final String key) {
+        this.asAdmin().getBytecode().addStep(Symbols.with, key);
+        final Object[] configPair = { key, true };
+        ((Configuring) this.asAdmin().getEndStep()).configure(configPair);
+        return this;
+    }
+
+    /**
      * Provides a configuration to a step in the form of a key and value pair. The key of the configuration must be
      * step specific and therefore a configuration could be supplied that is not known to be valid until execution.
      *

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b4cddb9/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 0d57f49..166c890 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
@@ -33,6 +33,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Random;
 import java.util.Set;
+import java.util.function.Consumer;
 
 import static org.junit.Assert.assertEquals;
 
@@ -45,7 +46,7 @@ public class GraphTraversalTest {
 
     private static Set<String> NO_GRAPH = new HashSet<>(Arrays.asList("asAdmin", "by", "read", "write", "with", "option", "iterate", "to", "from", "profile", "pageRank", "connectedComponent", "peerPressure", "shortestPath", "program", "none"));
     private static Set<String> NO_ANONYMOUS = new HashSet<>(Arrays.asList("start", "__"));
-    private static Set<String> IGNORES_BYTECODE = new HashSet<>(Arrays.asList("asAdmin", "read", "write", "iterate", "mapValues", "mapKeys"));
+    private static Set<String> IGNORES_BYTECODE = new HashSet<>(Arrays.asList("asAdmin", "read", "write", "iterate"));
 
     @Test
     public void shouldHaveMethodsOfGraphTraversalOnAnonymousGraphTraversal() {
@@ -100,10 +101,16 @@ public class GraphTraversalTest {
                 ///
                 if (stepMethod.getName().equals("by"))
                     traversal.order();
+                else if (stepMethod.getName().equals("with"))
+                    randomPossibleStep(random, traversal,
+                            GraphTraversal::V, GraphTraversal::shortestPath, GraphTraversal::pageRank,
+                            GraphTraversal::connectedComponent, GraphTraversal::peerPressure, t -> t.addE("link"),
+                            GraphTraversal::addV);
                 else if (stepMethod.getName().equals("option"))
                     traversal.branch(__.identity().out(randomString(random)));
                 else if (stepMethod.getName().equals("to") || stepMethod.getName().equals("from"))
                     traversal.addE(randomString(random));
+
                 if (stepMethod.getName().equals("range")) {
                     if (Scope.class.isAssignableFrom(stepMethod.getParameterTypes()[0])) {
                         list.add(arguments[0] = Scope.local);
@@ -166,7 +173,11 @@ public class GraphTraversalTest {
         }
     }
 
-    private final static String randomString(final Random random) {
+    private static void randomPossibleStep(final Random random, final GraphTraversal t, final Consumer<GraphTraversal>... possible) {
+        possible[random.nextInt(possible.length)].accept(t);
+    }
+
+    private static String randomString(final Random random) {
         String s = "";
         for (int i = 0; i < random.nextInt(10) + 1; i++) {
             s = (s + (char) (random.nextInt(100) + 1)).trim();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b4cddb9/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 83dbe85..b4d342f 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -1724,6 +1724,15 @@ namespace Gremlin.Net.Process.Traversal
         /// <summary>
         ///     Adds the with step to this <see cref="GraphTraversal{SType, EType}" />.
         /// </summary>
+        public GraphTraversal<S, E> With (string key)
+        {
+            Bytecode.AddStep("with", key);
+            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);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b4cddb9/gremlin-test/features/map/ShortestPath.feature
----------------------------------------------------------------------
diff --git a/gremlin-test/features/map/ShortestPath.feature b/gremlin-test/features/map/ShortestPath.feature
index eff743f..9ae01b2 100644
--- a/gremlin-test/features/map/ShortestPath.feature
+++ b/gremlin-test/features/map/ShortestPath.feature
@@ -113,7 +113,7 @@ Feature: Step - shortestPath()
     Given the modern graph
     And the traversal of
       """
-      g.withComputer().V().shortestPath().with("~tinkerpop.shortestPath.includeEdges", true)
+      g.withComputer().V().shortestPath().with("~tinkerpop.shortestPath.includeEdges")
       """
     When iterated to list
     Then the result should be unordered
@@ -206,7 +206,7 @@ Feature: Step - shortestPath()
     And the traversal of
       """
       g.withComputer().V().shortestPath().
-          with("~tinkerpop.shortestPath.includeEdges", true).
+          with("~tinkerpop.shortestPath.includeEdges").
           with("~tinkerpop.shortestPath.edges", __.outE())
       """
     When iterated to list

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9b4cddb9/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ShortestPathTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ShortestPathTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ShortestPathTest.java
index a55215b..620f566 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ShortestPathTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ShortestPathTest.java
@@ -276,7 +276,7 @@ public abstract class ShortestPathTest extends AbstractGremlinProcessTest {
 
         @Override
         public Traversal<Vertex, Path> get_g_V_shortestPath_edgesIncluded() {
-            return g.V().shortestPath().with(includeEdges, true);
+            return g.V().shortestPath().with(includeEdges);
         }
 
         @Override
@@ -291,7 +291,7 @@ public abstract class ShortestPathTest extends AbstractGremlinProcessTest {
 
         @Override
         public Traversal<Vertex, Path> get_g_V_shortestPath_edgesIncluded_edgesXoutEX() {
-            return g.V().shortestPath().with(includeEdges, true).with(edges, __.outE());
+            return g.V().shortestPath().with(includeEdges).with(edges, __.outE());
         }
 
         @Override


[42/48] tinkerpop git commit: Merge branch 'pr-948' into tp32

Posted by rd...@apache.org.
Merge branch 'pr-948' into tp32


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

Branch: refs/heads/TINKERPOP-2037
Commit: ca034f12aa2103e2b718ce52859cb51b52c3728a
Parents: 80fa89b 48d5d1d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 16:47:33 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 16:47:33 2018 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/process/computer/GraphFilter.java  | 5 +++--
 .../traversal/strategy/optimization/GraphFilterStrategy.java    | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[44/48] tinkerpop git commit: Merge branch 'tp33'

Posted by rd...@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/2d69efd5
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2d69efd5
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2d69efd5

Branch: refs/heads/TINKERPOP-2037
Commit: 2d69efd50373835a2962c48b42f6b81935d24152
Parents: e330ad6 86b1be5
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 16:47:56 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 16:47:56 2018 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/process/computer/GraphFilter.java  | 5 +++--
 .../traversal/strategy/optimization/GraphFilterStrategy.java    | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[31/48] tinkerpop git commit: TINKERPOP-2041 Fixed gremlin-javascript serializers for TP

Posted by rd...@apache.org.
TINKERPOP-2041 Fixed gremlin-javascript serializers for TP


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

Branch: refs/heads/TINKERPOP-2037
Commit: 68c47afa017deb9deabba1cf025ecddd68cd42fa
Parents: 519ca65
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Sep 27 16:33:26 2018 -0400
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Oct 4 07:45:08 2018 -0700

----------------------------------------------------------------------
 .../gremlin-javascript/lib/structure/io/graph-serializer.js        | 2 ++
 .../gremlin-javascript/lib/structure/io/type-serializers.js        | 1 +
 2 files changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68c47afa/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
index 9ce1761..fca8375 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/graph-serializer.js
@@ -162,6 +162,7 @@ const deserializers = {
   'g:Property': typeSerializers.PropertySerializer,
   'g:Path': typeSerializers.Path3Serializer,
   'g:T': typeSerializers.TSerializer,
+  'g:TP': typeSerializers.TPSerializer,
   'g:List': typeSerializers.ListSerializer,
   'g:Set': typeSerializers.SetSerializer,
   'g:Map': typeSerializers.MapSerializer
@@ -173,6 +174,7 @@ const serializers = [
   typeSerializers.BytecodeSerializer,
   typeSerializers.TraverserSerializer,
   typeSerializers.PSerializer,
+  typeSerializers.TPSerializer,
   typeSerializers.LambdaSerializer,
   typeSerializers.EnumSerializer,
   typeSerializers.VertexSerializer,

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/68c47afa/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
index ca81c2a..576c721 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
@@ -406,6 +406,7 @@ module.exports = {
   PathSerializer,
   PropertySerializer,
   PSerializer,
+  TPSerializer,
   SetSerializer,
   TSerializer,
   TraverserSerializer,


[16/48] tinkerpop git commit: Merge branch 'tp33'

Posted by rd...@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/7ac00a13
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7ac00a13
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7ac00a13

Branch: refs/heads/TINKERPOP-2037
Commit: 7ac00a13b4bfce60bc62e5c8d952681027ffebed
Parents: b788201 650f31f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 06:13:04 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 3 06:13:04 2018 -0400

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java     | 48 ++++++++++++--------
 .../step/sideEffect/SideEffectCapStep.java      |  4 +-
 2 files changed, 30 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7ac00a13/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------


[29/48] tinkerpop git commit: TINKERPOP-2041 Added IO tests for TextP

Posted by rd...@apache.org.
TINKERPOP-2041 Added IO tests for TextP


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

Branch: refs/heads/TINKERPOP-2037
Commit: 8b69b34b6393a3071c0cd491ea9ec0ca09a1e5ae
Parents: 9b96586
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 15:01:40 2018 -0400
Committer: Daniel Kuppitz <da...@hotmail.com>
Committed: Thu Oct 4 07:45:08 2018 -0700

----------------------------------------------------------------------
 docs/src/dev/io/graphson.asciidoc               | 26 ++++++++++++++++++++
 .../scripts/generate-graphson-resources.groovy  | 12 ++++-----
 .../tinkerpop/gremlin/structure/io/Model.java   |  9 +++++++
 .../io/AbstractTypedCompatibilityTest.java      | 14 +++++++++++
 .../io/graphson/_3_4_0/textp-v2d0-partial.json  |  7 ++++++
 .../io/graphson/_3_4_0/textp-v3d0.json          |  7 ++++++
 .../structure/io/gryo/_3_4_0/textp-v1d0.kryo    |  1 +
 .../structure/io/gryo/_3_4_0/textp-v3d0.kryo    |  1 +
 8 files changed, 71 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8b69b34b/docs/src/dev/io/graphson.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/io/graphson.asciidoc b/docs/src/dev/io/graphson.asciidoc
index d140a2f..1c9081c 100644
--- a/docs/src/dev/io/graphson.asciidoc
+++ b/docs/src/dev/io/graphson.asciidoc
@@ -3014,6 +3014,19 @@ The following `Bytecode` example represents the traversal of `g.V().hasLabel('pe
 }
 ----
 
+==== TextP
+
+[source,json]
+----
+{
+  "@type" : "g:TextP",
+  "@value" : {
+    "predicate" : "containing",
+    "value" : "ark"
+  }
+}
+----
+
 ==== TraversalMetrics
 
 [source,json]
@@ -5392,6 +5405,19 @@ Please see <<_p,P>> for additional information on `within`.
 }
 ----
 
+==== TextP
+
+[source,json]
+----
+{
+  "@type" : "g:TextP",
+  "@value" : {
+    "predicate" : "containing",
+    "value" : "ark"
+  }
+}
+----
+
 ==== TraversalMetrics
 
 [source,json]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8b69b34b/gremlin-tools/gremlin-io-test/scripts/generate-graphson-resources.groovy
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/scripts/generate-graphson-resources.groovy b/gremlin-tools/gremlin-io-test/scripts/generate-graphson-resources.groovy
index 55b4fa6..03112ed 100644
--- a/gremlin-tools/gremlin-io-test/scripts/generate-graphson-resources.groovy
+++ b/gremlin-tools/gremlin-io-test/scripts/generate-graphson-resources.groovy
@@ -59,19 +59,19 @@ toJson = { o, type, mapper, comment = "", suffix = "" ->
 
 writeSupportedV1Objects = { writer, mapper ->
     writer.write("=== Graph Structure\n\n")
-    model.entries("Graph Structure").findAll{it.isCompatibleWith(GraphSONCompatibility.V1D0_3_3_0)}.each {
+    model.entries("Graph Structure").findAll{it.isCompatibleWith(GraphSONCompatibility.V1D0_3_4_0)}.each {
         writer.write(toJsonV1d0NoTypes(it.getObject(), it.getTitle(), mapper, it.getDescription()))
     }
 
     writer.write("\n")
     writer.write("=== RequestMessage\n\n")
-    model.entries("RequestMessage").findAll{it.isCompatibleWith(GraphSONCompatibility.V1D0_3_3_0)}.each {
+    model.entries("RequestMessage").findAll{it.isCompatibleWith(GraphSONCompatibility.V1D0_3_4_0)}.each {
         writer.write(toJsonV1d0NoTypes(it.getObject(), it.getTitle(), mapper, it.getDescription()))
     }
 
     writer.write("\n")
     writer.write("=== ResponseMessage\n\n")
-    model.entries("ResponseMessage").findAll{it.isCompatibleWith(GraphSONCompatibility.V1D0_3_3_0)}.each {
+    model.entries("ResponseMessage").findAll{it.isCompatibleWith(GraphSONCompatibility.V1D0_3_4_0)}.each {
         writer.write(toJsonV1d0NoTypes(it.getObject(), it.getTitle(), mapper, it.getDescription()))
     }
 }
@@ -156,7 +156,7 @@ mapper = GraphSONMapper.build().
 
 file = new File("${projectBuildDir}/dev-docs/out-graphson-2d0-partial.txt")
 if (file.exists()) file.delete()
-file.withWriter { writeSupportedV2V3Objects(it, mapper, toJsonV2d0PartialTypes, {it.isCompatibleWith(GraphSONCompatibility.V2D0_PARTIAL_3_3_1)}, v2ExtendedDescription) }
+file.withWriter { writeSupportedV2V3Objects(it, mapper, toJsonV2d0PartialTypes, {it.isCompatibleWith(GraphSONCompatibility.V2D0_PARTIAL_3_4_0)}, v2ExtendedDescription) }
 
 mapper = GraphSONMapper.build().
         addRegistry(TinkerIoRegistryV2d0.instance()).
@@ -167,7 +167,7 @@ mapper = GraphSONMapper.build().
 
 file = new File("${projectBuildDir}/dev-docs/out-graphson-2d0-no-type.txt")
 if (file.exists()) file.delete()
-file.withWriter { writeSupportedV2V3Objects(it, mapper, toJsonV2d0NoTypes, {it.isCompatibleWith(GraphSONCompatibility.V2D0_NO_TYPE_3_3_1)}, v2ExtendedDescription) }
+file.withWriter { writeSupportedV2V3Objects(it, mapper, toJsonV2d0NoTypes, {it.isCompatibleWith(GraphSONCompatibility.V2D0_NO_TYPE_3_4_0)}, v2ExtendedDescription) }
 
 mapper = GraphSONMapper.build().
         addRegistry(TinkerIoRegistryV2d0.instance()).
@@ -189,7 +189,7 @@ mapper = GraphSONMapper.build().
 
 file = new File("${projectBuildDir}/dev-docs/out-graphson-3d0.txt")
 if (file.exists()) file.delete()
-file.withWriter { writeSupportedV2V3Objects(it, mapper, toJsonV3d0, {it.isCompatibleWith(GraphSONCompatibility.V3D0_PARTIAL_3_3_1)}, v3ExtendedDescription) }
+file.withWriter { writeSupportedV2V3Objects(it, mapper, toJsonV3d0, {it.isCompatibleWith(GraphSONCompatibility.V3D0_PARTIAL_3_4_0)}, v3ExtendedDescription) }
 
 def ver = "_" + "${projectVersion}".replace(".","_").replace("-SNAPSHOT","")
 def target = "${projectBaseDir}/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/" + ver

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8b69b34b/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java b/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
index 3ad676f..f01b0fc 100644
--- a/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
+++ b/gremlin-tools/gremlin-io-test/src/main/java/org/apache/tinkerpop/gremlin/structure/io/Model.java
@@ -29,6 +29,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalMetrics;
@@ -106,6 +107,12 @@ public class Model {
         final Compatibility[] noTypeGraphSONPlusGryo3_2_3 = Compatibilities.with(GryoCompatibility.class).beforeRelease("3.2.4").join(Compatibilities.UNTYPED_GRAPHSON).matchToArray();
         final Compatibility[] noTypeGraphSONPlusGryo3_3_0 = Compatibilities.with(GryoCompatibility.class).beforeRelease("3.3.0").join(Compatibilities.UNTYPED_GRAPHSON).matchToArray();
 
+        // the inverse of this definition is basically 3.4.0 or better for both GraphSON and Gryo with no support for
+        // untyped GraphSON anywhere along the way
+        final Compatibility[] before3_4_0 = Compatibilities.with(GryoCompatibility.class).beforeRelease("3.4.0")
+                .join(Compatibilities.with(GraphSONCompatibility.class).configuredAs(".*no-types|v1d0")
+                .join(Compatibilities.with(GraphSONCompatibility.class).beforeRelease("3.4.0"))).matchToArray();
+
         // there is no point to testing gryo for list/map/set as they are kryo primitives essentially
         final Compatibility[] noGraphSONBeforeV3AndNoGryo = Compatibilities.with(GraphSONCompatibility.class).configuredAs(".*v2d0-partial|v1d0|v2d0-no-types").join(Compatibilities.GRYO_ONLY).matchToArray();
 
@@ -164,6 +171,8 @@ public class Model {
         addGraphProcessEntry(P.gt(0).or(P.within(-1, -10, -100)), "P or", "", noTypeGraphSONPlusGryo3_2_3);
         addGraphProcessEntry(Scope.local, "Scope", "", Compatibilities.UNTYPED_GRAPHSON.matchToArray());
         addGraphProcessEntry(T.label, "T", "", Compatibilities.UNTYPED_GRAPHSON.matchToArray());
+        // TextP was only added at 3.4.0 and is not supported with untyped GraphSON of any sort
+        addGraphProcessEntry(TextP.containing("ark"), "TextP", "", before3_4_0);
         addGraphProcessEntry(createStaticTraversalMetrics(), "TraversalMetrics", "", noTypeGraphSONPlusGryo3_3_0);
         addGraphProcessEntry(g.V().hasLabel("person").asAdmin().nextTraverser(), "Traverser", "", Compatibilities.UNTYPED_GRAPHSON.matchToArray());
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8b69b34b/gremlin-tools/gremlin-io-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java b/gremlin-tools/gremlin-io-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java
index 67e5901..f34a6c4 100644
--- a/gremlin-tools/gremlin-io-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java
+++ b/gremlin-tools/gremlin-io-test/src/test/java/org/apache/tinkerpop/gremlin/structure/io/AbstractTypedCompatibilityTest.java
@@ -28,6 +28,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
+import org.apache.tinkerpop.gremlin.process.traversal.TextP;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Tree;
 import org.apache.tinkerpop.gremlin.process.traversal.util.Metrics;
@@ -840,6 +841,19 @@ public abstract class AbstractTypedCompatibilityTest extends AbstractCompatibili
     }
 
     @Test
+    public void shouldReadWriteTextP() throws Exception {
+        final String resourceName = "textp";
+        assumeCompatibility(resourceName);
+
+        final TextP resource = findModelEntryObject(resourceName);
+        final TextP fromStatic = read(getCompatibility().readFromResource(resourceName), TextP.class);
+        final TextP recycled = read(write(fromStatic, TextP.class), TextP.class);
+        assertEquals(fromStatic, recycled);
+        assertEquals(resource, fromStatic);
+        assertEquals(resource, recycled);
+    }
+
+    @Test
     public void shouldReadWriteTimestamp() throws Exception {
         final String resourceName = "timestamp";
         assumeCompatibility(resourceName);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8b69b34b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_4_0/textp-v2d0-partial.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_4_0/textp-v2d0-partial.json b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_4_0/textp-v2d0-partial.json
new file mode 100644
index 0000000..2820989
--- /dev/null
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_4_0/textp-v2d0-partial.json
@@ -0,0 +1,7 @@
+{
+  "@type" : "g:TextP",
+  "@value" : {
+    "predicate" : "containing",
+    "value" : "ark"
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8b69b34b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_4_0/textp-v3d0.json
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_4_0/textp-v3d0.json b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_4_0/textp-v3d0.json
new file mode 100644
index 0000000..2820989
--- /dev/null
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/graphson/_3_4_0/textp-v3d0.json
@@ -0,0 +1,7 @@
+{
+  "@type" : "g:TextP",
+  "@value" : {
+    "predicate" : "containing",
+    "value" : "ark"
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8b69b34b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_4_0/textp-v1d0.kryo
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_4_0/textp-v1d0.kryo b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_4_0/textp-v1d0.kryo
new file mode 100644
index 0000000..d71eb0f
--- /dev/null
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_4_0/textp-v1d0.kryo
@@ -0,0 +1 @@
+containin�ar�
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8b69b34b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_4_0/textp-v3d0.kryo
----------------------------------------------------------------------
diff --git a/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_4_0/textp-v3d0.kryo b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_4_0/textp-v3d0.kryo
new file mode 100644
index 0000000..d71eb0f
--- /dev/null
+++ b/gremlin-tools/gremlin-io-test/src/test/resources/org/apache/tinkerpop/gremlin/structure/io/gryo/_3_4_0/textp-v3d0.kryo
@@ -0,0 +1 @@
+containin�ar�
\ No newline at end of file


[13/48] tinkerpop git commit: Expose WebSocket configuration TINKERPOP-2015

Posted by rd...@apache.org.
Expose WebSocket configuration TINKERPOP-2015

Users can now provide a delegate to the Gremlin.Net driver that will be
used to configure WebSocket connections.


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

Branch: refs/heads/TINKERPOP-2037
Commit: b440742393135fdd88d4af18b09ade5f5011133e
Parents: e7af98b
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Sun Sep 9 14:49:03 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Oct 3 12:08:14 2018 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../src/Gremlin.Net/Driver/Connection.cs        |  6 +++--
 .../src/Gremlin.Net/Driver/ConnectionFactory.cs |  8 +++++--
 .../src/Gremlin.Net/Driver/GremlinClient.cs     |  9 +++++--
 .../Gremlin.Net/Driver/WebSocketConnection.cs   |  9 +++++--
 .../Driver/GremlinClientTests.cs                | 25 ++++++++++++++++++++
 6 files changed, 50 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4407423/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index e93c1c9..36a34f2 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 
 * Removed conflicting non-indy groovy core dependency
 * Bumped jython-standalone 2.7.1
+* Added a delegate to the Gremlin.Net driver that can be used to configure the WebSocket connection.
 * SSL security enhancements
 * Added Gremlin version to Gremlin Server startup logging output.
 * Fixed problem with Gremlin Server sometimes returning an additional message after a failure.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4407423/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
index dbbd375..f63e20b 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
@@ -23,6 +23,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Net.WebSockets;
 using System.Text;
 using System.Threading.Tasks;
 using Gremlin.Net.Driver.Messages;
@@ -38,18 +39,19 @@ namespace Gremlin.Net.Driver
         private readonly GraphSONWriter _graphSONWriter;
         private readonly JsonMessageSerializer _messageSerializer = new JsonMessageSerializer();
         private readonly Uri _uri;
-        private readonly WebSocketConnection _webSocketConnection = new WebSocketConnection();
+        private readonly WebSocketConnection _webSocketConnection;
         private readonly string _username;
         private readonly string _password;
 
         public Connection(Uri uri, string username, string password, GraphSONReader graphSONReader,
-            GraphSONWriter graphSONWriter)
+            GraphSONWriter graphSONWriter, Action<ClientWebSocketOptions> webSocketConfiguration)
         {
             _uri = uri;
             _username = username;
             _password = password;
             _graphSONReader = graphSONReader;
             _graphSONWriter = graphSONWriter;
+            _webSocketConnection = new WebSocketConnection(webSocketConfiguration);
         }
 
         public async Task<IReadOnlyCollection<T>> SubmitAsync<T>(RequestMessage requestMessage)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4407423/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs
index 0041a67..8b14ed9 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs
@@ -21,6 +21,8 @@
 
 #endregion
 
+using System;
+using System.Net.WebSockets;
 using Gremlin.Net.Structure.IO.GraphSON;
 
 namespace Gremlin.Net.Driver
@@ -29,20 +31,22 @@ namespace Gremlin.Net.Driver
     {
         private readonly GraphSONReader _graphSONReader;
         private readonly GraphSONWriter _graphSONWriter;
+        private readonly Action<ClientWebSocketOptions> _webSocketConfiguration;
         private readonly GremlinServer _gremlinServer;
 
         public ConnectionFactory(GremlinServer gremlinServer, GraphSONReader graphSONReader,
-            GraphSONWriter graphSONWriter)
+            GraphSONWriter graphSONWriter, Action<ClientWebSocketOptions> webSocketConfiguration)
         {
             _gremlinServer = gremlinServer;
             _graphSONReader = graphSONReader;
             _graphSONWriter = graphSONWriter;
+            _webSocketConfiguration = webSocketConfiguration;
         }
 
         public Connection CreateConnection()
         {
             return new Connection(_gremlinServer.Uri, _gremlinServer.Username, _gremlinServer.Password, _graphSONReader,
-                _graphSONWriter);
+                _graphSONWriter, _webSocketConfiguration);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4407423/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
index 46dd8a6..a5cb46c 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
@@ -23,6 +23,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Net.WebSockets;
 using System.Threading.Tasks;
 using Gremlin.Net.Driver.Messages;
 using Gremlin.Net.Structure.IO.GraphSON;
@@ -42,12 +43,16 @@ namespace Gremlin.Net.Driver
         /// <param name="gremlinServer">The <see cref="GremlinServer" /> the requests should be sent to.</param>
         /// <param name="graphSONReader">A <see cref="GraphSONReader" /> instance to read received GraphSON data.</param>
         /// <param name="graphSONWriter">a <see cref="GraphSONWriter" /> instance to write GraphSON data.</param>
+        /// <param name="webSocketConfiguration">
+        ///     A delegate that will be invoked with the <see cref="ClientWebSocketOptions" />
+        ///     object used to configure WebSocket connections.
+        /// </param>
         public GremlinClient(GremlinServer gremlinServer, GraphSONReader graphSONReader = null,
-            GraphSONWriter graphSONWriter = null)
+            GraphSONWriter graphSONWriter = null, Action<ClientWebSocketOptions> webSocketConfiguration = null)
         {
             var reader = graphSONReader ?? new GraphSONReader();
             var writer = graphSONWriter ?? new GraphSONWriter();
-            var connectionFactory = new ConnectionFactory(gremlinServer, reader, writer);
+            var connectionFactory = new ConnectionFactory(gremlinServer, reader, writer, webSocketConfiguration);
             _connectionPool = new ConnectionPool(connectionFactory);
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4407423/gremlin-dotnet/src/Gremlin.Net/Driver/WebSocketConnection.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Driver/WebSocketConnection.cs b/gremlin-dotnet/src/Gremlin.Net/Driver/WebSocketConnection.cs
index b5a4cc8..aefa32a 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/WebSocketConnection.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/WebSocketConnection.cs
@@ -33,11 +33,16 @@ namespace Gremlin.Net.Driver
     {
         private const int ReceiveBufferSize = 1024;
         private const WebSocketMessageType MessageType = WebSocketMessageType.Binary;
-        private ClientWebSocket _client;
+        private readonly ClientWebSocket _client;
 
-        public async Task ConnectAsync(Uri uri)
+        public WebSocketConnection(Action<ClientWebSocketOptions> webSocketConfiguration)
         {
             _client = new ClientWebSocket();
+            webSocketConfiguration?.Invoke(_client.Options);
+        }
+
+        public async Task ConnectAsync(Uri uri)
+        {
             await _client.ConnectAsync(uri, CancellationToken.None).ConfigureAwait(false);
         }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4407423/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs
index 351b83d..9a421d5 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs
@@ -23,6 +23,7 @@
 
 using System;
 using System.Collections.Generic;
+using System.Net.WebSockets;
 using System.Threading.Tasks;
 using Gremlin.Net.Driver;
 using Gremlin.Net.Driver.Exceptions;
@@ -208,5 +209,29 @@ namespace Gremlin.Net.IntegrationTest.Driver
                 Assert.Equal(a + b, response);
             }
         }
+
+        [Fact]
+        public async Task ShouldConfigureWebSocketOptionsAsSpecified()
+        {
+            var gremlinServer = new GremlinServer(TestHost, TestPort);
+            ClientWebSocketOptions optionsSet = null;
+            var expectedKeepAliveInterval = TimeSpan.FromMilliseconds(11);
+            var webSocketConfiguration =
+                new Action<ClientWebSocketOptions>(options =>
+                {
+                    options.UseDefaultCredentials = false;
+                    options.KeepAliveInterval = expectedKeepAliveInterval;
+                    optionsSet = options;
+                });
+            using (var gremlinClient = new GremlinClient(gremlinServer, webSocketConfiguration: webSocketConfiguration))
+            {
+                // send dummy message to create at least one connection
+                await gremlinClient.SubmitAsync(_requestMessageProvider.GetDummyMessage());
+                
+                Assert.NotNull(optionsSet);
+                Assert.False(optionsSet.UseDefaultCredentials);
+                Assert.Equal(expectedKeepAliveInterval, optionsSet.KeepAliveInterval);
+            }
+        }
     }
 }
\ No newline at end of file


[17/48] tinkerpop git commit: Merge branch 'tp32' into tp33

Posted by rd...@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/8ca27786
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8ca27786
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8ca27786

Branch: refs/heads/TINKERPOP-2037
Commit: 8ca277863861699ca2fa7913735687f6e65b486b
Parents: c10bde3 b440742
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Oct 3 12:31:08 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Oct 3 12:31:08 2018 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../src/Gremlin.Net/Driver/Connection.cs        |  6 +++--
 .../src/Gremlin.Net/Driver/ConnectionFactory.cs |  7 ++++--
 .../src/Gremlin.Net/Driver/GremlinClient.cs     | 11 +++++++--
 .../Gremlin.Net/Driver/WebSocketConnection.cs   |  9 +++++--
 .../Driver/GremlinClientTests.cs                | 25 ++++++++++++++++++++
 6 files changed, 51 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ca27786/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
index 279c708,f63e20b..b79f0e6
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
@@@ -36,21 -37,21 +37,22 @@@ namespace Gremlin.Net.Drive
      {
          private readonly GraphSONReader _graphSONReader;
          private readonly GraphSONWriter _graphSONWriter;
 -        private readonly JsonMessageSerializer _messageSerializer = new JsonMessageSerializer();
 +        private readonly JsonMessageSerializer _messageSerializer;
          private readonly Uri _uri;
-         private readonly WebSocketConnection _webSocketConnection = new WebSocketConnection();
+         private readonly WebSocketConnection _webSocketConnection;
          private readonly string _username;
          private readonly string _password;
  
          public Connection(Uri uri, string username, string password, GraphSONReader graphSONReader,
-                           GraphSONWriter graphSONWriter, string mimeType)
 -            GraphSONWriter graphSONWriter, Action<ClientWebSocketOptions> webSocketConfiguration)
++            GraphSONWriter graphSONWriter, string mimeType, Action<ClientWebSocketOptions> webSocketConfiguration)
          {
              _uri = uri;
              _username = username;
              _password = password;
              _graphSONReader = graphSONReader;
              _graphSONWriter = graphSONWriter;
 +            _messageSerializer = new JsonMessageSerializer(mimeType);
+             _webSocketConnection = new WebSocketConnection(webSocketConfiguration);
          }
  
          public async Task<IReadOnlyCollection<T>> SubmitAsync<T>(RequestMessage requestMessage)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ca27786/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs
index e2ff5b7,8b14ed9..7a6c2d5
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/ConnectionFactory.cs
@@@ -30,22 -31,22 +31,24 @@@ namespace Gremlin.Net.Drive
      {
          private readonly GraphSONReader _graphSONReader;
          private readonly GraphSONWriter _graphSONWriter;
+         private readonly Action<ClientWebSocketOptions> _webSocketConfiguration;
          private readonly GremlinServer _gremlinServer;
 +        private readonly string _mimeType;
  
          public ConnectionFactory(GremlinServer gremlinServer, GraphSONReader graphSONReader,
-                                  GraphSONWriter graphSONWriter, string mimeType)
 -            GraphSONWriter graphSONWriter, Action<ClientWebSocketOptions> webSocketConfiguration)
++            GraphSONWriter graphSONWriter, string mimeType, Action<ClientWebSocketOptions> webSocketConfiguration)
          {
              _gremlinServer = gremlinServer;
 -            _graphSONReader = graphSONReader;
 -            _graphSONWriter = graphSONWriter;
 +            _mimeType = mimeType;
 +            _graphSONReader = graphSONReader ?? throw new ArgumentNullException(nameof(graphSONReader));
 +            _graphSONWriter = graphSONWriter ?? throw new ArgumentNullException(nameof(graphSONWriter));
+             _webSocketConfiguration = webSocketConfiguration;
          }
  
          public Connection CreateConnection()
          {
              return new Connection(_gremlinServer.Uri, _gremlinServer.Username, _gremlinServer.Password, _graphSONReader,
-                                  _graphSONWriter, _mimeType);
 -                _graphSONWriter, _webSocketConfiguration);
++                                 _graphSONWriter, _mimeType, _webSocketConfiguration);
          }
      }
  }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ca27786/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
index 2b47cbc,a5cb46c..54d7634
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
@@@ -52,13 -43,16 +53,19 @@@ namespace Gremlin.Net.Drive
          /// <param name="gremlinServer">The <see cref="GremlinServer" /> the requests should be sent to.</param>
          /// <param name="graphSONReader">A <see cref="GraphSONReader" /> instance to read received GraphSON data.</param>
          /// <param name="graphSONWriter">a <see cref="GraphSONWriter" /> instance to write GraphSON data.</param>
 +        /// <param name="mimeType">The GraphSON version mime type, defaults to latest supported by the server.</param>
+         /// <param name="webSocketConfiguration">
+         ///     A delegate that will be invoked with the <see cref="ClientWebSocketOptions" />
+         ///     object used to configure WebSocket connections.
+         /// </param>
          public GremlinClient(GremlinServer gremlinServer, GraphSONReader graphSONReader = null,
-                              GraphSONWriter graphSONWriter = null, string mimeType = null)
 -            GraphSONWriter graphSONWriter = null, Action<ClientWebSocketOptions> webSocketConfiguration = null)
++            GraphSONWriter graphSONWriter = null, string mimeType = null,
++            Action<ClientWebSocketOptions> webSocketConfiguration = null)
          {
 -            var reader = graphSONReader ?? new GraphSONReader();
 -            var writer = graphSONWriter ?? new GraphSONWriter();
 -            var connectionFactory = new ConnectionFactory(gremlinServer, reader, writer, webSocketConfiguration);
 +            var reader = graphSONReader ?? new GraphSON3Reader();
 +            var writer = graphSONWriter ?? new GraphSON3Writer();
-             var connectionFactory = new ConnectionFactory(gremlinServer, reader, writer, mimeType ?? DefaultMimeType);
++            var connectionFactory = new ConnectionFactory(gremlinServer, reader, writer, mimeType ?? DefaultMimeType,
++                webSocketConfiguration);
              _connectionPool = new ConnectionPool(connectionFactory);
          }
  


[39/48] tinkerpop git commit: Merge branch 'tp32' into tp33

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

Conflicts:
	gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java
	gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
	gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs


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

Branch: refs/heads/TINKERPOP-2037
Commit: 28bf30468cca9bbd5c95b3814619801348cfad96
Parents: 650d1e8 80fa89b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 14:10:54 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 14:10:54 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 docs/src/dev/io/graphson.asciidoc               |  2 +
 .../io/graphson/GraphSONSerializersV2d0.java    | 19 ++++++--
 .../GraphSONMapperEmbeddedTypeTest.java         | 14 ++++++
 .../IO/GraphSON/GraphSONReaderTests.cs          | 49 +++++++++++++++++---
 .../IO/GraphSON/GraphSONWriterTests.cs          | 32 ++++++++++++-
 .../lib/structure/io/type-serializers.js        | 30 +++++++++++-
 .../test/unit/graphson-test.js                  | 39 ++++++++++++++++
 .../gremlin_python/structure/io/graphsonV2d0.py | 26 +++++++++++
 .../tests/structure/io/test_graphsonV2d0.py     | 25 ++++++++++
 10 files changed, 224 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28bf3046/docs/src/dev/io/graphson.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28bf3046/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV2d0.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28bf3046/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java
----------------------------------------------------------------------
diff --cc gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java
index a375e3b,e5f2693..c9400cd
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperEmbeddedTypeTest.java
@@@ -44,16 -44,8 +44,17 @@@ import java.time.ZoneOffset
  import java.time.ZonedDateTime;
  import java.util.ArrayList;
  import java.util.Arrays;
 +import java.util.HashMap;
 +import java.util.Iterator;
 +import java.util.LinkedHashMap;
 +import java.util.LinkedHashSet;
  import java.util.List;
 +import java.util.Map;
 +import java.util.Set;
  
 +import static org.hamcrest.CoreMatchers.any;
 +import static org.hamcrest.Matchers.either;
++import static org.hamcrest.core.IsNot.not;
  import static org.hamcrest.core.StringStartsWith.startsWith;
  import static org.junit.Assert.assertEquals;
  import static org.junit.Assume.assumeThat;
@@@ -85,58 -74,21 +86,71 @@@ public class GraphSONMapperEmbeddedType
      public String version;
  
      @Test
+     public void shouldHandleNumberConstants() throws Exception {
 -        assumeThat(version, startsWith("v2"));
++        assumeThat(version, not(startsWith("v1")));
+ 
+         final List<Object> o = new ArrayList<>();
+         o.add(123.321d);
+         o.add(Double.NaN);
+         o.add(Double.NEGATIVE_INFINITY);
+         o.add(Double.POSITIVE_INFINITY);
+ 
+         assertEquals(o, serializeDeserialize(mapper, o, List.class));
+     }
+ 
+     @Test
 +    public void shouldHandleMap() throws Exception {
 +        assumeThat(version, startsWith("v3"));
 +
 +        final Map<Object,Object> o = new LinkedHashMap<>();
 +        o.put("string key", "string value");
 +        o.put(1, 1);
 +        o.put(1L, 1L);
 +
 +        final List<Object> l = Arrays.asList("test", 1, 5L);
 +        o.put(l, "crazy");
 +
 +        assertEquals(o, serializeDeserialize(mapper, o, Map.class));
 +    }
 +
 +    @Test
 +    public void shouldHandleList() throws Exception {
 +        assumeThat(version, startsWith("v3"));
 +
 +        final List<Object> o = new ArrayList<>();
 +        o.add("test");
 +        o.add(1);
 +        o.add(1);
 +        o.add(1L);
 +        o.add(1L);
 +
 +        final List<Object> l = Arrays.asList("test", 1, 5L);
 +        o.add(l);
 +
 +        assertEquals(o, serializeDeserialize(mapper, o, List.class));
 +    }
 +
 +    @Test
 +    public void shouldHandleSet() throws Exception {
 +        assumeThat(version, startsWith("v3"));
 +
 +        final Set<Object> o = new LinkedHashSet<>();
 +        o.add("test");
 +        o.add(1);
 +        o.add(1);
 +        o.add(1L);
 +        o.add(1L);
 +
 +        final List<Object> l = Arrays.asList("test", 1, 5L);
 +        o.add(l);
 +
 +        assertEquals(o, serializeDeserialize(mapper, o, Set.class));
 +
 +    }
 +
 +    @Test
      public void shouldHandleBiFunctionLambda() throws Exception {
 -        assumeThat(version, startsWith("v2"));
 +        assumeThat(version, either(startsWith("v2")).or(startsWith("v3")));
  
          final Lambda o = (Lambda) Lambda.biFunction("x,y -> 'test'");
          assertEquals(o, serializeDeserialize(mapper, o, Lambda.class));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28bf3046/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
index 00cf853,08a91ae..15e5b05
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
@@@ -35,30 -34,9 +34,30 @@@ namespace Gremlin.Net.UnitTest.Structur
  {
      public class GraphSONReaderTests
      {
 -        private GraphSONReader CreateStandardGraphSONReader()
 +        /// <summary>
 +        /// Parameters for each test supporting multiple versions of GraphSON
 +        /// </summary>
 +        public static IEnumerable<object[]> Versions => new []
          {
 -            return new GraphSONReader();
 +            new object[] { 2 },
 +            new object[] { 3 }
 +        };
-         
++
 +        /// <summary>
 +        /// Parameters for each collections test supporting multiple versions of GraphSON
 +        /// </summary>
 +        public static IEnumerable<object[]> VersionsSupportingCollections => new []
 +        {
 +            new object[] { 3 }
 +        };
-         
++
 +        private GraphSONReader CreateStandardGraphSONReader(int version)
 +        {
 +            if (version == 3)
 +            {
 +                return new GraphSON3Reader();
 +            }
 +            return new GraphSON2Reader();
          }
  
          //During CI, we encountered a case where Newtonsoft.Json version 9.0.0
@@@ -197,11 -175,47 +196,47 @@@
              Assert.Equal(31.2, deserializedValue);
          }
  
 -        [Fact]
 -        public void ShouldDeserializeNaN()
 +        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeNaN(int version)
+         {
+             var serializedValue = "{\"@type\":\"g:Double\",\"@value\":'NaN'}";
+             var reader = CreateStandardGraphSONReader();
+ 
+             var jObject = JObject.Parse(serializedValue);
+             var deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(Double.NaN, deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializePositiveInfinity()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializePositiveInfinity(int version)
+         {
+             var serializedValue = "{\"@type\":\"g:Double\",\"@value\":'Infinity'}";
+             var reader = CreateStandardGraphSONReader();
+ 
+             var jObject = JObject.Parse(serializedValue);
+             var deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(Double.PositiveInfinity, deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializeNegativeInfinity()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldDeserializeNegativeInfinity(int version)
+         {
+             var serializedValue = "{\"@type\":\"g:Double\",\"@value\":'-Infinity'}";
+             var reader = CreateStandardGraphSONReader();
+ 
+             var jObject = JObject.Parse(serializedValue);
+             var deserializedValue = reader.ToObject(jObject);
+ 
+             Assert.Equal(Double.NegativeInfinity, deserializedValue);
+         }
+ 
 -        [Fact]
 -        public void ShouldDeserializeDecimal()
++        [Theory, MemberData(nameof(Versions))]
 +        public void ShouldDeserializeDecimal(int version)
          {
              var serializedValue = "{\"@type\":\"gx:BigDecimal\",\"@value\":-8.201}";
 -            var reader = CreateStandardGraphSONReader();
 +            var reader = CreateStandardGraphSONReader(version);
  
              var jObject = JObject.Parse(serializedValue);
              decimal deserializedValue = reader.ToObject(jObject);
@@@ -220,12 -234,12 +255,12 @@@
  
              Assert.Equal(7.5M, deserializedValue);
          }
-         
+ 
 -        [Fact]
 -        public void ShouldDeserializeList()
 +        [Theory, MemberData(nameof(Versions))]
 +        public void ShouldDeserializeList(int version)
          {
              var serializedValue = "[{\"@type\":\"g:Int32\",\"@value\":5},{\"@type\":\"g:Int32\",\"@value\":6}]";
 -            var reader = CreateStandardGraphSONReader();
 +            var reader = CreateStandardGraphSONReader(version);
  
              var jObject = JArray.Parse(serializedValue);
              var deserializedValue = reader.ToObject(jObject);
@@@ -373,53 -360,6 +408,53 @@@
              Assert.Equal(typeof(int), readVertex.Id.GetType());
          }
  
 +        [Theory, MemberData(nameof(VersionsSupportingCollections))]
 +        public void ShouldDeserializeEmptyGList(int version)
 +        {
 +            var graphSon =
 +                "{\"@type\":\"g:List\", \"@value\": []}";
 +            var reader = CreateStandardGraphSONReader(version);
 +
 +            var deserializedValue = reader.ToObject(JObject.Parse(graphSon));
 +            Assert.Equal(new object[0], deserializedValue);
 +        }
 +
 +        [Theory, MemberData(nameof(VersionsSupportingCollections))]
 +        public void ShouldDeserializeGList(int version)
 +        {
 +            const string json = "{\"@type\":\"g:List\", \"@value\": [{\"@type\": \"g:Int32\", \"@value\": 1}," +
 +                                "{\"@type\": \"g:Int32\", \"@value\": 2}, {\"@type\": \"g:Int32\", \"@value\": 3}]}";
 +            var reader = CreateStandardGraphSONReader(version);
 +
 +            var deserializedValue = reader.ToObject(JObject.Parse(json));
-                 
++
 +            Assert.Equal((IList<object>)new object[] { 1, 2, 3}, deserializedValue);
 +        }
 +
 +        [Theory, MemberData(nameof(VersionsSupportingCollections))]
 +        public void ShouldDeserializeGSet(int version)
 +        {
 +            const string json = "{\"@type\":\"g:Set\", \"@value\": [{\"@type\": \"g:Int32\", \"@value\": 1}," +
 +                                "{\"@type\": \"g:Int32\", \"@value\": 2}, {\"@type\": \"g:Int32\", \"@value\": 3}]}";
 +            var reader = CreateStandardGraphSONReader(version);
 +
 +            var deserializedValue = reader.ToObject(JObject.Parse(json));
-                 
++
 +            Assert.Equal((ISet<object>)new HashSet<object>{ 1, 2, 3}, deserializedValue);
 +        }
 +
 +        [Theory, MemberData(nameof(VersionsSupportingCollections))]
 +        public void ShouldDeserializeGMap(int version)
 +        {
 +            const string json = "{\"@type\":\"g:Map\", \"@value\": [\"a\",{\"@type\": \"g:Int32\", \"@value\": 1}, " +
 +                                "\"b\", {\"@type\": \"g:Int32\", \"@value\": 2}]}";
 +            var reader = CreateStandardGraphSONReader(version);
 +
 +            var deserializedValue = reader.ToObject(JObject.Parse(json));
-                 
++
 +            Assert.Equal(new Dictionary<object, object>{ { "a", 1 }, { "b", 2 }}, deserializedValue);
 +        }
 +
          [Fact]
          public void ShouldDeserializeTraverser()
          {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28bf3046/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
index 2d30fa1,13fbddc..07f00a9
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
@@@ -35,36 -35,15 +35,36 @@@ namespace Gremlin.Net.UnitTest.Structur
  {
      public class GraphSONWriterTests
      {
 -        private GraphSONWriter CreateStandardGraphSONWriter()
 +        /// <summary>
 +        /// Parameters for each test supporting multiple versions of GraphSON
 +        /// </summary>
 +        public static IEnumerable<object[]> Versions => new []
          {
 -            return new GraphSONWriter();
 +            new object[] { 2 },
 +            new object[] { 3 }
 +        };
-         
++
 +        /// <summary>
 +        /// Parameters for each collections test supporting multiple versions of GraphSON
 +        /// </summary>
 +        public static IEnumerable<object[]> VersionsSupportingCollections => new []
 +        {
 +            new object[] { 3 }
 +        };
 +
 +        private GraphSONWriter CreateGraphSONWriter(int version)
 +        {
 +            if (version == 3)
 +            {
 +                return new GraphSON3Writer();
 +            }
 +            return new GraphSON2Writer();
          }
  
 -        [Fact]
 -        public void ShouldSerializeInt()
 +        [Theory, MemberData(nameof(Versions))]
 +        public void ShouldSerializeInt(int version)
          {
 -            var writer = CreateStandardGraphSONWriter();
 +            var writer = CreateGraphSONWriter(version);
  
              var graphSon = writer.WriteObject(1);
  
@@@ -101,10 -80,40 +101,40 @@@
              Assert.Equal("{\"@type\":\"g:Double\",\"@value\":3.2}", graphSon);
          }
  
 -        [Fact]
 -        public void ShouldSerializeNaN()
 +        [Theory, MemberData(nameof(Versions))]
++        public void ShouldSerializeNaN(int version)
+         {
 -            var writer = CreateStandardGraphSONWriter();
++            var writer = CreateGraphSONWriter(version);
+ 
+             var graphSon = writer.WriteObject(Double.NaN);
+ 
+             Assert.Equal("{\"@type\":\"g:Double\",\"@value\":\"NaN\"}", graphSon);
+         }
+ 
 -        [Fact]
 -        public void ShouldSerializePositiveInfinity()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldSerializePositiveInfinity(int version)
+         {
 -            var writer = CreateStandardGraphSONWriter();
++            var writer = CreateGraphSONWriter(version);
+ 
+             var graphSon = writer.WriteObject(Double.PositiveInfinity);
+ 
+             Assert.Equal("{\"@type\":\"g:Double\",\"@value\":\"Infinity\"}", graphSon);
+         }
+ 
 -        [Fact]
 -        public void ShouldSerializeNegativeInfinity()
++        [Theory, MemberData(nameof(Versions))]
++        public void ShouldSerializeNegativeInfinity(int version)
+         {
 -            var writer = CreateStandardGraphSONWriter();
++            var writer = CreateGraphSONWriter();
+ 
+             var graphSon = writer.WriteObject(Double.NegativeInfinity);
+ 
+             Assert.Equal("{\"@type\":\"g:Double\",\"@value\":\"-Infinity\"}", graphSon);
+         }
+ 
 -        [Fact]
 -        public void ShouldSerializeDecimal()
++        [Theory, MemberData(nameof(Versions))]
 +        public void ShouldSerializeDecimal(int version)
          {
 -            var writer = CreateStandardGraphSONWriter();
 +            var writer = CreateGraphSONWriter(version);
  
              var graphSon = writer.WriteObject(6.5M);
  

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28bf3046/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28bf3046/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
----------------------------------------------------------------------
diff --cc gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
index d53a080,0000000..18598b7
mode 100644,000000..100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
@@@ -1,469 -1,0 +1,495 @@@
 +'''
 +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.
 +'''
 +import datetime
 +import json
 +import time
 +import uuid
++import math
 +from collections import OrderedDict
 +
 +import six
 +from aenum import Enum
 +
 +from gremlin_python import statics
 +from gremlin_python.statics import FloatType, FunctionType, IntType, LongType, TypeType
 +from gremlin_python.process.traversal import Binding, Bytecode, P, Traversal, Traverser, TraversalStrategy
 +from gremlin_python.structure.graph import Edge, Property, Vertex, VertexProperty, Path
 +
 +# When we fall back to a superclass's serializer, we iterate over this map.
 +# We want that iteration order to be consistent, so we use an OrderedDict,
 +# not a dict.
 +_serializers = OrderedDict()
 +_deserializers = {}
 +
 +
 +class GraphSONTypeType(type):
 +    def __new__(mcs, name, bases, dct):
 +        cls = super(GraphSONTypeType, mcs).__new__(mcs, name, bases, dct)
 +        if not name.startswith('_'):
 +            if cls.python_type:
 +                _serializers[cls.python_type] = cls
 +            if cls.graphson_type:
 +                _deserializers[cls.graphson_type] = cls
 +        return cls
 +
 +
 +class GraphSONUtil(object):
 +    TYPE_KEY = "@type"
 +    VALUE_KEY = "@value"
 +
 +    @classmethod
 +    def typedValue(cls, type_name, value, prefix="g"):
 +        out = {cls.TYPE_KEY: cls.formatType(prefix, type_name)}
 +        if value is not None:
 +            out[cls.VALUE_KEY] = value
 +        return out
 +
 +    @classmethod
 +    def formatType(cls, prefix, type_name):
 +        return "%s:%s" % (prefix, type_name)
 +
 +
 +# Read/Write classes split to follow precedence of the Java API
 +class GraphSONWriter(object):
 +    def __init__(self, serializer_map=None):
 +        """
 +        :param serializer_map: map from Python type to serializer instance implementing `dictify`
 +        """
 +        self.serializers = _serializers.copy()
 +        if serializer_map:
 +            self.serializers.update(serializer_map)
 +
 +    def writeObject(self, objectData):
 +        # to JSON
 +        return json.dumps(self.toDict(objectData), separators=(',', ':'))
 +
 +    def toDict(self, obj):
 +        """
 +        Encodes python objects in GraphSON type-tagged dict values
 +        """
 +        try:
 +            return self.serializers[type(obj)].dictify(obj, self)
 +        except KeyError:
 +            for key, serializer in self.serializers.items():
 +                if isinstance(obj, key):
 +                    return serializer.dictify(obj, self)
 +
 +        # list and map are treated as normal json objs (could be isolated serializers)
 +        if isinstance(obj, (list, set)):
 +            return [self.toDict(o) for o in obj]
 +        elif isinstance(obj, dict):
 +            return dict((self.toDict(k), self.toDict(v)) for k, v in obj.items())
 +        else:
 +            return obj
 +
 +
 +class GraphSONReader(object):
 +    def __init__(self, deserializer_map=None):
 +        """
 +        :param deserializer_map: map from GraphSON type tag to deserializer instance implementing `objectify`
 +        """
 +        self.deserializers = _deserializers.copy()
 +        if deserializer_map:
 +            self.deserializers.update(deserializer_map)
 +
 +    def readObject(self, jsonData):
 +        # from JSON
 +        return self.toObject(json.loads(jsonData))
 +
 +    def toObject(self, obj):
 +        """
 +        Unpacks GraphSON type-tagged dict values into objects mapped in self.deserializers
 +        """
 +        if isinstance(obj, dict):
 +            try:
 +                return self.deserializers[obj[GraphSONUtil.TYPE_KEY]].objectify(obj[GraphSONUtil.VALUE_KEY], self)
 +            except KeyError:
 +                pass
 +            # list and map are treated as normal json objs (could be isolated deserializers)
 +            return dict((self.toObject(k), self.toObject(v)) for k, v in obj.items())
 +        elif isinstance(obj, list):
 +            return [self.toObject(o) for o in obj]
 +        else:
 +            return obj
 +
 +
 +@six.add_metaclass(GraphSONTypeType)
 +class _GraphSONTypeIO(object):
 +    python_type = None
 +    graphson_type = None
 +
 +    symbolMap = {"global_": "global", "as_": "as", "in_": "in", "and_": "and",
 +                 "or_": "or", "is_": "is", "not_": "not", "from_": "from",
 +                 "set_": "set", "list_": "list", "all_": "all"}
 +
 +    @classmethod
 +    def unmangleKeyword(cls, symbol):
 +        return cls.symbolMap.get(symbol, symbol)
 +
 +    def dictify(self, obj, writer):
 +        raise NotImplementedError()
 +
 +    def objectify(self, d, reader):
 +        raise NotImplementedError()
 +
 +
 +class _BytecodeSerializer(_GraphSONTypeIO):
 +    @classmethod
 +    def _dictify_instructions(cls, instructions, writer):
 +        out = []
 +        for instruction in instructions:
 +            inst = [instruction[0]]
 +            inst.extend(writer.toDict(arg) for arg in instruction[1:])
 +            out.append(inst)
 +        return out
 +
 +    @classmethod
 +    def dictify(cls, bytecode, writer):
 +        if isinstance(bytecode, Traversal):
 +            bytecode = bytecode.bytecode
 +        out = {}
 +        if bytecode.source_instructions:
 +            out["source"] = cls._dictify_instructions(bytecode.source_instructions, writer)
 +        if bytecode.step_instructions:
 +            out["step"] = cls._dictify_instructions(bytecode.step_instructions, writer)
 +        return GraphSONUtil.typedValue("Bytecode", out)
 +
 +class TraversalSerializer(_BytecodeSerializer):
 +    python_type = Traversal
 +
 +
 +class BytecodeSerializer(_BytecodeSerializer):
 +    python_type = Bytecode
 +
 +
 +class VertexSerializer(_GraphSONTypeIO):
 +    python_type = Vertex
 +    graphson_type = "g:Vertex"
 +
 +    @classmethod
 +    def dictify(cls, vertex, writer):
 +        return GraphSONUtil.typedValue("Vertex", {"id": writer.toDict(vertex.id),
 +                                                  "label": writer.toDict(vertex.label)})
 +
 +
 +class EdgeSerializer(_GraphSONTypeIO):
 +    python_type = Edge
 +    graphson_type = "g:Edge"
 +
 +    @classmethod
 +    def dictify(cls, edge, writer):
 +        return GraphSONUtil.typedValue("Edge", {"id": writer.toDict(edge.id),
 +                                                "outV": writer.toDict(edge.outV.id),
 +                                                "outVLabel": writer.toDict(edge.outV.label),
 +                                                "label": writer.toDict(edge.label),
 +                                                "inV": writer.toDict(edge.inV.id),
 +                                                "inVLabel": writer.toDict(edge.inV.label)})
 +
 +
 +class VertexPropertySerializer(_GraphSONTypeIO):
 +    python_type = VertexProperty
 +    graphson_type = "g:VertexProperty"
 +
 +    @classmethod
 +    def dictify(cls, vertex_property, writer):
 +        return GraphSONUtil.typedValue("VertexProperty", {"id": writer.toDict(vertex_property.id),
 +                                                          "label": writer.toDict(vertex_property.label),
 +                                                          "value": writer.toDict(vertex_property.value),
 +                                                          "vertex": writer.toDict(vertex_property.vertex.id)})
 +
 +
 +class PropertySerializer(_GraphSONTypeIO):
 +    python_type = Property
 +    graphson_type = "g:Property"
 +
 +    @classmethod
 +    def dictify(cls, property, writer):
 +        elementDict = writer.toDict(property.element)
 +        if elementDict is not None:
 +            valueDict = elementDict["@value"]
 +            if "outVLabel" in valueDict:
 +                del valueDict["outVLabel"]
 +            if "inVLabel" in valueDict:
 +                del valueDict["inVLabel"]
 +            if "properties" in valueDict:
 +                del valueDict["properties"]
 +            if "value" in valueDict:
 +                del valueDict["value"]
 +        return GraphSONUtil.typedValue("Property", {"key": writer.toDict(property.key),
 +                                                    "value": writer.toDict(property.value),
 +                                                    "element": elementDict})
 +
 +
 +class TraversalStrategySerializer(_GraphSONTypeIO):
 +    python_type = TraversalStrategy
 +
 +    @classmethod
 +    def dictify(cls, strategy, writer):
 +        return GraphSONUtil.typedValue(strategy.strategy_name, writer.toDict(strategy.configuration))
 +
 +
 +class TraverserIO(_GraphSONTypeIO):
 +    python_type = Traverser
 +    graphson_type = "g:Traverser"
 +
 +    @classmethod
 +    def dictify(cls, traverser, writer):
 +        return GraphSONUtil.typedValue("Traverser", {"value": writer.toDict(traverser.object),
 +                                                     "bulk": writer.toDict(traverser.bulk)})
 +
 +    @classmethod
 +    def objectify(cls, d, reader):
 +        return Traverser(reader.toObject(d["value"]),
 +                         reader.toObject(d["bulk"]))
 +
 +
 +class EnumSerializer(_GraphSONTypeIO):
 +    python_type = Enum
 +
 +    @classmethod
 +    def dictify(cls, enum, _):
 +        return GraphSONUtil.typedValue(cls.unmangleKeyword(type(enum).__name__),
 +                                       cls.unmangleKeyword(str(enum.name)))
 +
 +
 +class PSerializer(_GraphSONTypeIO):
 +    python_type = P
 +
 +    @classmethod
 +    def dictify(cls, p, writer):
 +        out = {"predicate": p.operator,
 +               "value": [writer.toDict(p.value), writer.toDict(p.other)] if p.other is not None else
 +               writer.toDict(p.value)}
 +        return GraphSONUtil.typedValue("P", out)
 +
 +
 +class BindingSerializer(_GraphSONTypeIO):
 +    python_type = Binding
 +
 +    @classmethod
 +    def dictify(cls, binding, writer):
 +        out = {"key": binding.key,
 +               "value": writer.toDict(binding.value)}
 +        return GraphSONUtil.typedValue("Binding", out)
 +
 +
 +class LambdaSerializer(_GraphSONTypeIO):
 +    python_type = FunctionType
 +
 +    @classmethod
 +    def dictify(cls, lambda_object, writer):
 +        lambda_result = lambda_object()
 +        script = lambda_result if isinstance(lambda_result, str) else lambda_result[0]
 +        language = statics.default_lambda_language if isinstance(lambda_result, str) else lambda_result[1]
 +        out = {"script": script,
 +               "language": language}
 +        if language == "gremlin-jython" or language == "gremlin-python":
 +            if not script.strip().startswith("lambda"):
 +                script = "lambda " + script
 +                out["script"] = script
 +            out["arguments"] = six.get_function_code(eval(out["script"])).co_argcount
 +        else:
 +            out["arguments"] = -1
 +        return GraphSONUtil.typedValue("Lambda", out)
 +
 +
 +class TypeSerializer(_GraphSONTypeIO):
 +    python_type = TypeType
 +
 +    @classmethod
 +    def dictify(cls, typ, writer):
 +        return writer.toDict(typ())
 +
 +
 +class UUIDIO(_GraphSONTypeIO):
 +    python_type = uuid.UUID
 +    graphson_type = "g:UUID"
 +    graphson_base_type = "UUID"
 +
 +    @classmethod
 +    def dictify(cls, obj, writer):
 +        return GraphSONUtil.typedValue(cls.graphson_base_type, str(obj))
 +
 +    @classmethod
 +    def objectify(cls, d, reader):
 +        return cls.python_type(d)
 +
 +
 +class DateIO(_GraphSONTypeIO):
 +    python_type = datetime.datetime
 +    graphson_type = "g:Date"
 +    graphson_base_type = "Date"
 +
 +    @classmethod
 +    def dictify(cls, obj, writer):
 +        # Java timestamp expects miliseconds
 +        if six.PY3:
 +            pts = obj.timestamp()
 +        else:
 +            # Hack for legacy Python
 +            # timestamp() in Python 3.3
 +            pts = time.mktime((obj.year, obj.month, obj.day,
 +			                   obj.hour, obj.minute, obj.second,
 +			                   -1, -1, -1)) + obj.microsecond / 1e6
 +
 +        # Have to use int because of legacy Python
 +        ts = int(round(pts * 1000))
 +        return GraphSONUtil.typedValue(cls.graphson_base_type, ts)
 +
 +    @classmethod
 +    def objectify(cls, ts, reader):
 +        # Python timestamp expects seconds
 +        return datetime.datetime.fromtimestamp(ts / 1000.0)
 +
 +
 +# Based on current implementation, this class must always be declared before FloatIO.
 +# Seems pretty fragile for future maintainers. Maybe look into this.
 +class TimestampIO(_GraphSONTypeIO):
 +    """A timestamp in Python is type float"""
 +    python_type = statics.timestamp
 +    graphson_type = "g:Timestamp"
 +    graphson_base_type = "Timestamp"
 +
 +    @classmethod
 +    def dictify(cls, obj, writer):
 +        # Java timestamp expects milliseconds integer
 +        # Have to use int because of legacy Python
 +        ts = int(round(obj * 1000))
 +        return GraphSONUtil.typedValue(cls.graphson_base_type, ts)
 +
 +    @classmethod
 +    def objectify(cls, ts, reader):
 +        # Python timestamp expects seconds
 +        return cls.python_type(ts / 1000.0)
 +
 +
 +class _NumberIO(_GraphSONTypeIO):
 +    @classmethod
 +    def dictify(cls, n, writer):
 +        if isinstance(n, bool):  # because isinstance(False, int) and isinstance(True, int)
 +            return n
 +        return GraphSONUtil.typedValue(cls.graphson_base_type, n)
 +
 +    @classmethod
 +    def objectify(cls, v, _):
 +        return cls.python_type(v)
 +
 +
 +class FloatIO(_NumberIO):
 +    python_type = FloatType
 +    graphson_type = "g:Float"
 +    graphson_base_type = "Float"
 +
++    @classmethod
++    def dictify(cls, n, writer):
++        if isinstance(n, bool):  # because isinstance(False, int) and isinstance(True, int)
++            return n
++        elif math.isnan(n):
++            return GraphSONUtil.typedValue(cls.graphson_base_type, "NaN")
++        elif math.isinf(n) and n > 0:
++            return GraphSONUtil.typedValue(cls.graphson_base_type, "Infinity")
++        elif math.isinf(n) and n < 0:
++            return GraphSONUtil.typedValue(cls.graphson_base_type, "-Infinity")
++        else:
++            return GraphSONUtil.typedValue(cls.graphson_base_type, n)
++
++    @classmethod
++    def objectify(cls, v, _):
++        if isinstance(v, str):
++            if v == 'NaN':
++                return float('nan')
++            elif v == "Infinity":
++                return float('inf')
++            elif v == "-Infinity":
++                return float('-inf')
++
++        return cls.python_type(v)
++
 +
 +class DoubleIO(FloatIO):
 +    graphson_type = "g:Double"
 +    graphson_base_type = "Double"
 +
 +
 +class Int64IO(_NumberIO):
 +    python_type = LongType
 +    graphson_type = "g:Int64"
 +    graphson_base_type = "Int64"
 +
 +
 +class Int32IO(_NumberIO):
 +    python_type = IntType
 +    graphson_type = "g:Int32"
 +    graphson_base_type = "Int32"
 +
 +    @classmethod
 +    def dictify(cls, n, writer):
 +        if isinstance(n, bool):
 +            return n
 +        return GraphSONUtil.typedValue(cls.graphson_base_type, n)
 +
 +
 +class VertexDeserializer(_GraphSONTypeIO):
 +    graphson_type = "g:Vertex"
 +
 +    @classmethod
 +    def objectify(cls, d, reader):
 +        return Vertex(reader.toObject(d["id"]), d.get("label", "vertex"))
 +
 +
 +class EdgeDeserializer(_GraphSONTypeIO):
 +    graphson_type = "g:Edge"
 +
 +    @classmethod
 +    def objectify(cls, d, reader):
 +        return Edge(reader.toObject(d["id"]),
 +                    Vertex(reader.toObject(d["outV"]), d.get("outVLabel", "vertex")),
 +                    d.get("label", "edge"),
 +                    Vertex(reader.toObject(d["inV"]), d.get("inVLabel", "vertex")))
 +
 +
 +class VertexPropertyDeserializer(_GraphSONTypeIO):
 +    graphson_type = "g:VertexProperty"
 +
 +    @classmethod
 +    def objectify(cls, d, reader):
 +        vertex = Vertex(reader.toObject(d.get("vertex"))) if "vertex" in d else None
 +        return VertexProperty(reader.toObject(d["id"]),
 +                              d["label"],
 +                              reader.toObject(d["value"]),
 +                              vertex)
 +
 +
 +class PropertyDeserializer(_GraphSONTypeIO):
 +    graphson_type = "g:Property"
 +
 +    @classmethod
 +    def objectify(cls, d, reader):
 +        element = reader.toObject(d["element"]) if "element" in d else None
 +        return Property(d["key"], reader.toObject(d["value"]), element)
 +
 +
 +class PathDeserializer(_GraphSONTypeIO):
 +    graphson_type = "g:Path"
 +
 +    @classmethod
 +    def objectify(cls, d, reader):
 +        labels = [set(label) for label in d["labels"]]
 +        objects = [reader.toObject(o) for o in d["objects"]]
 +        return Path(labels, objects)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/28bf3046/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py
----------------------------------------------------------------------
diff --cc gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py
index 416a9a4,0000000..e6ea550
mode 100644,000000..100644
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py
@@@ -1,377 -1,0 +1,402 @@@
 +"""
 +Licensed to the Apache Software Foundation (ASF) under one
 +or more contributor license agreements.  See the NOTICE file
 +distributed with this work for additional information
 +regarding copyright ownership.  The ASF licenses this file
 +to you under the Apache License, Version 2.0 (the
 +"License"); you may not use this file except in compliance
 +with the License.  You may obtain a copy of the License at
 +
 +http://www.apache.org/licenses/LICENSE-2.0
 +
 +Unless required by applicable law or agreed to in writing,
 +software distributed under the License is distributed on an
 +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 +KIND, either express or implied.  See the License for the
 +specific language governing permissions and limitations
 +under the License.
 +"""
 +
 +__author__ = 'Marko A. Rodriguez (http://markorodriguez.com)'
 +
 +import datetime
 +import time
 +import json
 +import uuid
++import math
 +
 +from mock import Mock
 +
 +import six
 +
 +from gremlin_python.statics import *
 +from gremlin_python.structure.graph import Vertex, Edge, Property, VertexProperty, Graph, Path
 +from gremlin_python.structure.io.graphsonV2d0 import GraphSONWriter, GraphSONReader, GraphSONUtil
 +import gremlin_python.structure.io.graphsonV2d0
 +from gremlin_python.process.traversal import P
 +from gremlin_python.process.strategies import SubgraphStrategy
 +from gremlin_python.process.graph_traversal import __
 +
 +
 +class TestGraphSONReader(object):
 +    graphson_reader = GraphSONReader()
 +
 +    def test_number_input(self):
 +        x = self.graphson_reader.readObject(json.dumps({
 +            "@type": "g:Int32",
 +            "@value": 31
 +        }))
 +        assert isinstance(x, int)
 +        assert 31 == x
 +        ##
 +        x = self.graphson_reader.readObject(json.dumps({
 +            "@type": "g:Int64",
 +            "@value": 31
 +        }))
 +        assert isinstance(x, long)
 +        assert long(31) == x
 +        ##
 +        x = self.graphson_reader.readObject(json.dumps({
 +            "@type": "g:Float",
 +            "@value": 31.3
 +        }))
 +        assert isinstance(x, float)
 +        assert 31.3 == x
 +        ##
 +        x = self.graphson_reader.readObject(json.dumps({
 +            "@type": "g:Double",
 +            "@value": 31.2
 +        }))
 +        assert isinstance(x, float)
 +        assert 31.2 == x
++        ##
++        x = self.graphson_reader.readObject(json.dumps({
++            "@type": "g:Double",
++            "@value": "NaN"
++        }))
++        assert isinstance(x, float)
++        assert math.isnan(x)
++        ##
++        x = self.graphson_reader.readObject(json.dumps({
++            "@type": "g:Double",
++            "@value": "Infinity"
++        }))
++        assert isinstance(x, float)
++        assert math.isinf(x) and x > 0
++        ##
++        x = self.graphson_reader.readObject(json.dumps({
++            "@type": "g:Double",
++            "@value": "-Infinity"
++        }))
++        assert isinstance(x, float)
++        assert math.isinf(x) and x < 0
 +
 +    def test_graph(self):
 +        vertex = self.graphson_reader.readObject("""
 +        {"@type":"g:Vertex", "@value":{"id":{"@type":"g:Int32","@value":1},"label":"person","outE":{"created":[{"id":{"@type":"g:Int32","@value":9},"inV":{"@type":"g:Int32","@value":3},"properties":{"weight":{"@type":"g:Double","@value":0.4}}}],"knows":[{"id":{"@type":"g:Int32","@value":7},"inV":{"@type":"g:Int32","@value":2},"properties":{"weight":{"@type":"g:Double","@value":0.5}}},{"id":{"@type":"g:Int32","@value":8},"inV":{"@type":"g:Int32","@value":4},"properties":{"weight":{"@type":"g:Double","@value":1.0}}}]},"properties":{"name":[{"id":{"@type":"g:Int64","@value":0},"value":"marko"}],"age":[{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29}}]}}}""")
 +        assert isinstance(vertex, Vertex)
 +        assert "person" == vertex.label
 +        assert 1 == vertex.id
 +        assert isinstance(vertex.id, int)
 +        assert vertex == Vertex(1)
 +        ##
 +        vertex = self.graphson_reader.readObject("""
 +        {"@type":"g:Vertex", "@value":{"id":{"@type":"g:Float","@value":45.23}}}""")
 +        assert isinstance(vertex, Vertex)
 +        assert 45.23 == vertex.id
 +        assert isinstance(vertex.id, FloatType)
 +        assert "vertex" == vertex.label
 +        assert vertex == Vertex(45.23)
 +        ##
 +        vertex_property = self.graphson_reader.readObject("""
 +        {"@type":"g:VertexProperty", "@value":{"id":"anId","label":"aKey","value":true,"vertex":{"@type":"g:Int32","@value":9}}}""")
 +        assert isinstance(vertex_property, VertexProperty)
 +        assert "anId" == vertex_property.id
 +        assert "aKey" == vertex_property.label
 +        assert vertex_property.value
 +        assert vertex_property.vertex == Vertex(9)
 +        ##
 +        vertex_property = self.graphson_reader.readObject("""
 +        {"@type":"g:VertexProperty", "@value":{"id":{"@type":"g:Int32","@value":1},"label":"name","value":"marko"}}""")
 +        assert isinstance(vertex_property, VertexProperty)
 +        assert 1 == vertex_property.id
 +        assert "name" == vertex_property.label
 +        assert "marko" == vertex_property.value
 +        assert vertex_property.vertex is None
 +        ##
 +        edge = self.graphson_reader.readObject("""
 +        {"@type":"g:Edge", "@value":{"id":{"@type":"g:Int64","@value":17},"label":"knows","inV":"x","outV":"y","inVLabel":"xLab","properties":{"aKey":"aValue","bKey":true}}}""")
 +        # print edge
 +        assert isinstance(edge, Edge)
 +        assert 17 == edge.id
 +        assert "knows" == edge.label
 +        assert edge.inV == Vertex("x", "xLabel")
 +        assert edge.outV == Vertex("y", "vertex")
 +        ##
 +        property = self.graphson_reader.readObject("""
 +        {"@type":"g:Property", "@value":{"key":"aKey","value":{"@type":"g:Int64","@value":17},"element":{"@type":"g:Edge","@value":{"id":{"@type":"g:Int64","@value":122},"label":"knows","inV":"x","outV":"y","inVLabel":"xLab"}}}}""")
 +        # print property
 +        assert isinstance(property, Property)
 +        assert "aKey" == property.key
 +        assert 17 == property.value
 +        assert Edge(122, Vertex("x"), "knows", Vertex("y")) == property.element
 +
 +    def test_path(self):
 +        path = self.graphson_reader.readObject(
 +            """{"@type":"g:Path","@value":{"labels":[["a"],["b","c"],[]],"objects":[{"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":1},"label":"person","properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":0},"value":"marko","label":"name"}}],"age":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":1},"value":{"@type":"g:Int32","@value":29},"label":"age"}}]}}},{"@type":"g:Vertex","@value":{"id":{"@type":"g:Int32","@value":3},"label":"software","properties":{"name":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":4},"value":"lop","label":"name"}}],"lang":[{"@type":"g:VertexProperty","@value":{"id":{"@type":"g:Int64","@value":5},"value":"java","label":"lang"}}]}}},"lop"]}}"""
 +        )
 +        assert isinstance(path, Path)
 +        if six.PY3:
 +            assert "[v[1], v[3], 'lop']" == str(path)
 +        else:
 +            assert "[v[1], v[3], u'lop']" == str(path)
 +        assert Vertex(1) == path[0]
 +        assert Vertex(1) == path["a"]
 +        assert "lop" == path[2]
 +        assert 3 == len(path)
 +
 +    def test_custom_mapping(self):
 +
 +        # extended mapping
 +        class X(object):
 +            pass
 +
 +        type_string = "test:Xtype"
 +        override_string = "g:Int64"
 +        serdes = Mock()
 +
 +        reader = GraphSONReader(deserializer_map={type_string: serdes})
 +        assert type_string in reader.deserializers
 +
 +        # base dicts are not modified
 +        assert type_string not in gremlin_python.structure.io.graphsonV2d0._deserializers
 +
 +        x = X()
 +        o = reader.toObject({GraphSONUtil.TYPE_KEY: type_string, GraphSONUtil.VALUE_KEY: x})
 +        serdes.objectify.assert_called_once_with(x, reader)
 +        assert o is serdes.objectify()
 +
 +        # overridden mapping
 +        type_string = "g:Int64"
 +        serdes = Mock()
 +        reader = GraphSONReader(deserializer_map={type_string: serdes, override_string: serdes})
 +        assert gremlin_python.structure.io.graphsonV2d0._deserializers[type_string] is not reader.deserializers[type_string]
 +
 +        value = 3
 +        o = reader.toObject({GraphSONUtil.TYPE_KEY: type_string, GraphSONUtil.VALUE_KEY: value})
 +        serdes.objectify.assert_called_once_with(value, reader)
 +        assert o is serdes.objectify()
 +
 +    def test_datetime(self):
 +        expected = datetime.datetime(2016, 12, 14, 16, 14, 36, 295000)
 +        pts = time.mktime((expected.year, expected.month, expected.day,
 +                                           expected.hour, expected.minute, expected.second,
 +                                           -1, -1, -1)) + expected.microsecond / 1e6
 +        timestamp = int(round(pts * 1000))
 +        dt = self.graphson_reader.readObject(json.dumps({"@type": "g:Date", "@value": timestamp}))
 +        assert isinstance(dt, datetime.datetime)
 +        # TINKERPOP-1848
 +        assert dt == expected
 +
 +    def test_timestamp(self):
 +        dt = self.graphson_reader.readObject(json.dumps({"@type": "g:Timestamp", "@value": 1481750076295}))
 +        assert isinstance(dt, timestamp)
 +        assert float(dt) == 1481750076.295
 +
 +    def test_uuid(self):
 +        prop = self.graphson_reader.readObject(
 +            json.dumps({'@type': 'g:UUID', '@value': "41d2e28a-20a4-4ab0-b379-d810dede3786"}))
 +        assert isinstance(prop, uuid.UUID)
 +        assert str(prop) == '41d2e28a-20a4-4ab0-b379-d810dede3786'
 +
 +
 +class TestGraphSONWriter(object):
 +    graphson_writer = GraphSONWriter()
 +    graphson_reader = GraphSONReader()
 +
 +    def test_number_output(self):
 +        assert {"@type": "g:Int64", "@value": 2} == json.loads(self.graphson_writer.writeObject(long(2)))
 +        assert {"@type": "g:Int32", "@value": 1} == json.loads(self.graphson_writer.writeObject(1))
 +        assert {"@type": "g:Double", "@value": 3.2} == json.loads(self.graphson_writer.writeObject(3.2))
 +        assert """true""" == self.graphson_writer.writeObject(True)
 +
 +    def test_numbers(self):
 +        assert {"@type": "g:Int64", "@value": 2} == json.loads(self.graphson_writer.writeObject(long(2)))
 +        assert {"@type": "g:Int32", "@value": 1} == json.loads(self.graphson_writer.writeObject(1))
 +        assert {"@type": "g:Double", "@value": 3.2} == json.loads(self.graphson_writer.writeObject(3.2))
++        assert {"@type": "g:Double", "@value": "NaN"} == json.loads(self.graphson_writer.writeObject(float('nan')))
++        assert {"@type": "g:Double", "@value": "Infinity"} == json.loads(self.graphson_writer.writeObject(float('inf')))
++        assert {"@type": "g:Double", "@value": "-Infinity"} == json.loads(self.graphson_writer.writeObject(float('-inf')))
 +        assert """true""" == self.graphson_writer.writeObject(True)
 +
 +    def test_P(self):
 +        result = {'@type': 'g:P',
 +                  '@value': {
 +                      'predicate': 'and',
 +                      'value': [{
 +                          '@type': 'g:P',
 +                          '@value': {
 +                              'predicate': 'or',
 +                              'value': [{
 +                                  '@type': 'g:P',
 +                                  '@value': {'predicate': 'lt', 'value': 'b'}
 +                              },
 +                                  {'@type': 'g:P', '@value': {'predicate': 'gt', 'value': 'c'}}
 +                              ]
 +                          }
 +                      },
 +                          {'@type': 'g:P', '@value': {'predicate': 'neq', 'value': 'd'}}]}}
 +
 +        assert result == json.loads(
 +            self.graphson_writer.writeObject(P.lt("b").or_(P.gt("c")).and_(P.neq("d"))))
 +
 +        result = {'@type': 'g:P', '@value': {'predicate':'within','value': [{"@type": "g:Int32", "@value": 1},{"@type": "g:Int32", "@value": 2}]}}
 +        assert result == json.loads(self.graphson_writer.writeObject(P.within([1,2])))
 +
 +    def test_strategies(self):
 +        # we have a proxy model for now given that we don't want to have to have g:XXX all registered on the Gremlin traversal machine (yet)
 +        assert {"@type": "g:SubgraphStrategy", "@value": {}} == json.loads(
 +            self.graphson_writer.writeObject(SubgraphStrategy))
 +        assert {"@type": "g:SubgraphStrategy", "@value": {
 +            "vertices": {"@type": "g:Bytecode", "@value": {"step": [["has", "name", "marko"]]}}}} == json.loads(
 +            self.graphson_writer.writeObject(SubgraphStrategy(vertices=__.has("name", "marko"))))
 +
 +    def test_graph(self):
 +        # TODO: this assert is not compatible with python 3 and now that we test with both 2 and 3 it fails
 +        assert {"@type": "g:Vertex", "@value": {"id": {"@type": "g:Int64", "@value": 12}, "label": "person"}} == json.loads(self.graphson_writer.writeObject(Vertex(long(12), "person")))
 +
 +        assert {"@type": "g:Edge", "@value": {"id": {"@type": "g:Int32", "@value": 7},
 +                                              "outV": {"@type": "g:Int32", "@value": 0},
 +                                              "outVLabel": "person",
 +                                              "label": "knows",
 +                                              "inV": {"@type": "g:Int32", "@value": 1},
 +                                              "inVLabel": "dog"}} == json.loads(
 +            self.graphson_writer.writeObject(Edge(7, Vertex(0, "person"), "knows", Vertex(1, "dog"))))
 +        assert {"@type": "g:VertexProperty", "@value": {"id": "blah", "label": "keyA", "value": True,
 +                                                        "vertex": "stephen"}} == json.loads(
 +            self.graphson_writer.writeObject(VertexProperty("blah", "keyA", True, Vertex("stephen"))))
 +
 +        assert {"@type": "g:Property",
 +                "@value": {"key": "name", "value": "marko", "element": {"@type": "g:VertexProperty",
 +                                                                        "@value": {
 +                                                                            "vertex": "vertexId",
 +                                                                            "id": {"@type": "g:Int32", "@value": 1234},
 +                                                                            "label": "aKey"}}}} == json.loads(
 +            self.graphson_writer.writeObject(
 +                Property("name", "marko", VertexProperty(1234, "aKey", 21345, Vertex("vertexId")))))
 +
 +        vertex = self.graphson_reader.readObject(self.graphson_writer.writeObject(Vertex(1, "person")))
 +        assert 1 == vertex.id
 +        assert "person" == vertex.label
 +
 +        edge = self.graphson_reader.readObject(
 +            self.graphson_writer.writeObject(Edge(3, Vertex(1, "person"), "knows", Vertex(2, "dog"))))
 +        assert "knows" == edge.label
 +        assert 3 == edge.id
 +        assert 1 == edge.outV.id
 +        assert 2 == edge.inV.id
 +
 +        vertex_property = self.graphson_reader.readObject(
 +            self.graphson_writer.writeObject(VertexProperty(1, "age", 32, Vertex(1))))
 +        assert 1 == vertex_property.id
 +        assert "age" == vertex_property.key
 +        assert 32 == vertex_property.value
 +
 +        property = self.graphson_reader.readObject(self.graphson_writer.writeObject(Property("age", 32.2, Edge(1,Vertex(2),"knows",Vertex(3)))))
 +        assert "age" == property.key
 +        assert 32.2 == property.value
 +
 +    def test_custom_mapping(self):
 +        # extended mapping
 +        class X(object):
 +            pass
 +
 +        serdes = Mock()
 +        writer = GraphSONWriter(serializer_map={X: serdes})
 +        assert X in writer.serializers
 +
 +        # base dicts are not modified
 +        assert X not in gremlin_python.structure.io.graphsonV2d0._serializers
 +
 +        obj = X()
 +        d = writer.toDict(obj)
 +        serdes.dictify.assert_called_once_with(obj, writer)
 +        assert d is serdes.dictify()
 +
 +        # overridden mapping
 +        serdes = Mock()
 +        writer = GraphSONWriter(serializer_map={int: serdes})
 +        assert gremlin_python.structure.io.graphsonV2d0._serializers[int] is not writer.serializers[int]
 +
 +        value = 3
 +        d = writer.toDict(value)
 +        serdes.dictify.assert_called_once_with(value, writer)
 +        assert d is serdes.dictify()
 +
 +    def test_write_long(self):
 +        mapping = self.graphson_writer.toDict(1)
 +        assert mapping['@type'] == 'g:Int32'
 +        assert mapping['@value'] == 1
 +
 +        mapping = self.graphson_writer.toDict(long(1))
 +        assert mapping['@type'] == 'g:Int64'
 +        assert mapping['@value'] == 1
 +
 +    def test_datetime(self):
 +        expected = json.dumps({"@type": "g:Date", "@value": 1481750076295}, separators=(',', ':'))
 +        dt = datetime.datetime.fromtimestamp(1481750076295 / 1000.0)
 +        output = self.graphson_writer.writeObject(dt)
 +        assert expected == output
 +
 +    def test_timestamp(self):
 +        expected = json.dumps({"@type": "g:Timestamp", "@value": 1481750076295}, separators=(',', ':'))
 +        ts = timestamp(1481750076295 / 1000.0)
 +        output = self.graphson_writer.writeObject(ts)
 +        assert expected == output
 +
 +    def test_uuid(self):
 +        expected = json.dumps({'@type': 'g:UUID', '@value': "41d2e28a-20a4-4ab0-b379-d810dede3786"}, separators=(',', ':'))
 +        prop = uuid.UUID("41d2e28a-20a4-4ab0-b379-d810dede3786")
 +        output = self.graphson_writer.writeObject(prop)
 +        assert expected == output
 +
 +
 +class TestFunctionalGraphSONIO(object):
 +    """Functional IO tests"""
 +
 +    def test_timestamp(self, remote_connection_v2):
 +        g = Graph().traversal().withRemote(remote_connection_v2)
 +        ts = timestamp(1481750076295 / 1000)
 +        resp = g.addV('test_vertex').property('ts', ts)
 +        resp = resp.toList()
 +        vid = resp[0].id
 +        try:
 +            ts_prop = g.V(vid).properties('ts').toList()[0]
 +            assert isinstance(ts_prop.value, timestamp)
 +            assert ts_prop.value == ts
 +        finally:
 +            g.V(vid).drop().iterate()
 +
 +    def test_datetime(self, remote_connection_v2):
 +        g = Graph().traversal().withRemote(remote_connection_v2)
 +        dt = datetime.datetime.fromtimestamp(1481750076295 / 1000)
 +        resp = g.addV('test_vertex').property('dt', dt).toList()
 +        vid = resp[0].id
 +        try:
 +            dt_prop = g.V(vid).properties('dt').toList()[0]
 +            assert isinstance(dt_prop.value, datetime.datetime)
 +            assert dt_prop.value == dt
 +        finally:
 +            g.V(vid).drop().iterate()
 +
 +    def test_uuid(self, remote_connection_v2):
 +        g = Graph().traversal().withRemote(remote_connection_v2)
 +        uid = uuid.UUID("41d2e28a-20a4-4ab0-b379-d810dede3786")
 +        resp = g.addV('test_vertex').property('uuid', uid).toList()
 +        vid = resp[0].id
 +        try:
 +            uid_prop = g.V(vid).properties('uuid').toList()[0]
 +            assert isinstance(uid_prop.value, uuid.UUID)
 +            assert uid_prop.value == uid
 +        finally:
 +            g.V(vid).drop().iterate()


[22/48] tinkerpop git commit: reverts class StarGraphGryoSerializer

Posted by rd...@apache.org.
reverts class StarGraphGryoSerializer


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

Branch: refs/heads/TINKERPOP-2037
Commit: 48d5d1d4d33cd1d95354062764858e1a1b4e5d38
Parents: 9e1865a
Author: Otavio Santana <ot...@gmail.com>
Authored: Wed Oct 3 15:11:00 2018 -0300
Committer: Otavio Santana <ot...@gmail.com>
Committed: Wed Oct 3 15:11:00 2018 -0300

----------------------------------------------------------------------
 .../gremlin/structure/util/star/StarGraphGryoSerializer.java      | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/48d5d1d4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
index 86bbf98..b2379ce 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
@@ -18,7 +18,6 @@
  */
 package org.apache.tinkerpop.gremlin.structure.util.star;
 
-import java.util.EnumMap;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -35,7 +34,7 @@ import org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim.shaded.ShadedSeri
  */
 public final class StarGraphGryoSerializer extends ShadedSerializerAdapter<StarGraph>  {
 
-    private static final Map<Direction, StarGraphGryoSerializer> CACHE = new EnumMap<>(Direction.class);
+    private static final Map<Direction, StarGraphGryoSerializer> CACHE = new HashMap<>();
 
     static {
         CACHE.put(Direction.BOTH, new StarGraphGryoSerializer(Direction.BOTH));


[24/48] tinkerpop git commit: Merge branch 'tp32' into tp33

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

Conflicts:
	gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
	gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java


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

Branch: refs/heads/TINKERPOP-2037
Commit: 2b4c993ddd16a45545555858d480103952374897
Parents: 1faf762 88d6f77
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 16:09:06 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 3 16:09:06 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   2 +
 .../gremlin/jsr223/TranslatorCustomizer.java    |  38 ++++
 .../gremlin/process/traversal/Translator.java   |  34 +++
 .../jsr223/GremlinGroovyScriptEngine.java       |  11 +-
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  34 ++-
 .../groovy/jsr223/GroovyTranslatorTest.java     | 215 +++++++++++++++++--
 6 files changed, 309 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2b4c993d/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
----------------------------------------------------------------------
diff --cc gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 03ea883,b96b8b9..7785da6
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@@ -222,19 -236,27 +224,20 @@@ public class GremlinGroovyScriptEngine 
      private final ImportGroovyCustomizer importGroovyCustomizer;
      private final List<GroovyCustomizer> groovyCustomizers;
  
 -    private final Set<Artifact> artifactsToUse = new HashSet<>();
      private final boolean interpreterModeEnabled;
      private final long expectedCompilationTime;
+     private final Translator.ScriptTranslator.TypeTranslator typeTranslator;
  
      /**
 -     * Creates a new instance using the {@link DefaultImportCustomizerProvider}.
 +     * There is no need to require type checking infrastructure if type checking is not enabled.
       */
 -    public GremlinGroovyScriptEngine() {
 -        this(new Customizer[0]);
 -    }
 +    private final boolean typeCheckingEnabled;
  
      /**
 -     * @deprecated As of release 3.0.1, replaced by {@link #GremlinGroovyScriptEngine(CompilerCustomizerProvider...)}
 +     * Creates a new instance using no {@link Customizer}.
       */
 -    @Deprecated
 -    public GremlinGroovyScriptEngine(final ImportCustomizerProvider importCustomizerProvider) {
 -        this((CompilerCustomizerProvider) importCustomizerProvider);
 +    public GremlinGroovyScriptEngine() {
 +        this(new Customizer[0]);
      }
  
      public GremlinGroovyScriptEngine(final Customizer... customizers) {
@@@ -273,6 -289,58 +276,12 @@@
          interpreterModeEnabled = groovyCustomizers.stream()
                  .anyMatch(p -> p.getClass().equals(InterpreterModeGroovyCustomizer.class));
  
+         final Optional<TranslatorCustomizer> translatorCustomizer = listOfCustomizers.stream().
+                 filter(p -> p instanceof TranslatorCustomizer).
+                 map(p -> (TranslatorCustomizer) p).findFirst();
+         typeTranslator = translatorCustomizer.isPresent() ? translatorCustomizer.get().createTypeTranslator() :
+                 Translator.ScriptTranslator.TypeTranslator.identity();
+ 
 -        // not using the old provider model so set that to empty list so that when createClassLoader is called
 -        // it knows to use groovyCustomizers instead
 -        customizerProviders = Collections.emptyList();
 -
 -        createClassLoader();
 -    }
 -
 -    /**
 -     * Creates a new instance with the specified {@link CompilerCustomizerProvider} objects.
 -     *
 -     * @deprecated As of release 3.2.4, replaced by {@link #GremlinGroovyScriptEngine(Customizer...)}.
 -     */
 -    @Deprecated
 -    public GremlinGroovyScriptEngine(final CompilerCustomizerProvider... compilerCustomizerProviders) {
 -        final List<CompilerCustomizerProvider> providers = Arrays.asList(compilerCustomizerProviders);
 -
 -        GremlinLoader.load();
 -
 -        importCustomizerProvider = providers.stream()
 -                .filter(p -> p instanceof ImportCustomizerProvider)
 -                .map(p -> (ImportCustomizerProvider) p)
 -                .findFirst().orElse(NoImportCustomizerProvider.INSTANCE);
 -
 -        // determine if interpreter mode should be enabled
 -        interpreterModeEnabled = providers.stream()
 -                .anyMatch(p -> p.getClass().equals(InterpreterModeCustomizerProvider.class));
 -
 -        final Optional<CompilationOptionsCustomizerProvider> compilationOptionsCustomizerProvider = providers.stream()
 -                .filter(p -> p instanceof CompilationOptionsCustomizerProvider)
 -                .map(p -> (CompilationOptionsCustomizerProvider) p).findFirst();
 -        expectedCompilationTime = compilationOptionsCustomizerProvider.isPresent() ?
 -            compilationOptionsCustomizerProvider.get().getExpectedCompilationTime() : 5000;
 -
 -        // remove used providers as the rest will be applied directly
 -        customizerProviders = providers.stream()
 -                .filter(p -> p != null && !(p instanceof ImportCustomizerProvider) && !(p instanceof CompilationOptionsCustomizerProvider))
 -                .collect(Collectors.toList());
 -
 -        // groovy customizers are not used here - set to empty list so that the customizerProviders get used
 -        // in createClassLoader
 -        groovyCustomizers = Collections.emptyList();
 -        importGroovyCustomizer = null;
 -
 -        // TypeTranslator can only be set by a Customizer - use this old deprecated stuff and you're outta luck
 -        typeTranslator = Translator.ScriptTranslator.TypeTranslator.identity();
 -
          createClassLoader();
      }
  

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2b4c993d/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --cc gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 8024590,949fcac..717e1bc
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@@ -49,10 -57,14 +56,12 @@@ import java.util.UUID
   */
  public final class GroovyTranslator implements Translator.ScriptTranslator {
  
 -    private static final boolean IS_TESTING = Boolean.valueOf(System.getProperty("is.testing", "false"));
 -
      private final String traversalSource;
+     private final TypeTranslator typeTranslator;
  
-     private GroovyTranslator(final String traversalSource) {
+     private GroovyTranslator(final String traversalSource, final TypeTranslator typeTranslator) {
          this.traversalSource = traversalSource;
+         this.typeTranslator = typeTranslator;
      }
  
      public static final GroovyTranslator of(final String traversalSource) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2b4c993d/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
----------------------------------------------------------------------
diff --cc gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
index 057f2f1,0000000..2cbc962
mode 100644,000000..100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
@@@ -1,226 -1,0 +1,401 @@@
 +/*
 + *  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.groovy.jsr223;
 +
 +import org.apache.commons.configuration.MapConfiguration;
++import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
++import org.apache.tinkerpop.gremlin.jsr223.TranslatorCustomizer;
++import org.apache.tinkerpop.gremlin.process.traversal.Order;
++import org.apache.tinkerpop.gremlin.process.traversal.Pop;
++import org.apache.tinkerpop.gremlin.process.traversal.Scope;
++import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 +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.__;
 +import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
 +import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy;
 +import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
++import org.apache.tinkerpop.gremlin.structure.Column;
++import org.apache.tinkerpop.gremlin.structure.Direction;
 +import org.apache.tinkerpop.gremlin.structure.Edge;
++import org.apache.tinkerpop.gremlin.structure.Graph;
 +import org.apache.tinkerpop.gremlin.structure.Vertex;
++import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 +import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge;
 +import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
 +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory;
 +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
 +import org.apache.tinkerpop.gremlin.util.function.Lambda;
 +import org.junit.Test;
 +
 +import javax.script.Bindings;
++import javax.script.ScriptException;
 +import javax.script.SimpleBindings;
++import java.sql.Timestamp;
 +import java.util.ArrayList;
 +import java.util.Arrays;
++import java.util.Calendar;
 +import java.util.Collections;
++import java.util.Date;
 +import java.util.HashMap;
 +import java.util.LinkedHashMap;
 +import java.util.List;
++import java.util.UUID;
 +import java.util.function.Function;
 +
++import static org.hamcrest.core.Is.is;
 +import static org.junit.Assert.assertEquals;
 +import static org.junit.Assert.assertFalse;
++import static org.junit.Assert.assertNotNull;
++import static org.junit.Assert.assertThat;
++import static org.junit.Assert.fail;
 +
 +/**
 + * @author Marko A. Rodriguez (http://markorodriguez.com)
 + */
 +public class GroovyTranslatorTest {
 +
++    private Graph graph = TinkerGraph.open();
++    private GraphTraversalSource g = graph.traversal();
++    private static final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine();
++
 +    @Test
 +    public void shouldHandleStrategies() throws Exception {
 +        final TinkerGraph graph = TinkerFactory.createModern();
-         GraphTraversalSource g = graph.traversal();
-         g = g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
++        final GraphTraversalSource g = graph.traversal().withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
 +            put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
 +        }})));
 +        final Bindings bindings = new SimpleBindings();
 +        bindings.put("g", g);
-         Traversal.Admin<Vertex, Object> traversal = new GremlinGroovyScriptEngine().eval(g.V().values("name").asAdmin().getBytecode(), bindings, "g");
++        Traversal.Admin<Vertex, Object> traversal = engine.eval(g.V().values("name").asAdmin().getBytecode(), bindings, "g");
 +        assertEquals("marko", traversal.next());
 +        assertFalse(traversal.hasNext());
 +        //
-         traversal = new GremlinGroovyScriptEngine().eval(g.withoutStrategies(SubgraphStrategy.class).V().count().asAdmin().getBytecode(), bindings, "g");
++        traversal = engine.eval(g.withoutStrategies(SubgraphStrategy.class).V().count().asAdmin().getBytecode(), bindings, "g");
 +        assertEquals(new Long(6), traversal.next());
 +        assertFalse(traversal.hasNext());
 +        //
-         traversal = new GremlinGroovyScriptEngine().eval(g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
++        traversal = engine.eval(g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
 +            put(SubgraphStrategy.VERTICES, __.has("name", "marko"));
 +        }})), ReadOnlyStrategy.instance()).V().values("name").asAdmin().getBytecode(), bindings, "g");
 +        assertEquals("marko", traversal.next());
 +        assertFalse(traversal.hasNext());
 +    }
 +
 +    @Test
-     public void shouldSupportStringSupplierLambdas() throws Exception {
++    public void shouldSupportStringSupplierLambdas() {
 +        final TinkerGraph graph = TinkerFactory.createModern();
 +        GraphTraversalSource g = graph.traversal();
 +        g = g.withStrategies(new TranslationStrategy(g, GroovyTranslator.of("g")));
-         GraphTraversal.Admin<Vertex, Integer> t = g.withSideEffect("lengthSum", 0).withSack(1)
++        final GraphTraversal.Admin<Vertex, Integer> t = g.withSideEffect("lengthSum", 0).withSack(1)
 +                .V()
 +                .filter(Lambda.predicate("it.get().label().equals('person')"))
 +                .flatMap(Lambda.function("it.get().vertices(Direction.OUT)"))
 +                .map(Lambda.<Traverser<Object>, Integer>function("it.get().value('name').length()"))
 +                .sideEffect(Lambda.consumer("{ x -> x.sideEffects(\"lengthSum\", x.<Integer>sideEffects('lengthSum') + x.get()) }"))
 +                .order().by(Lambda.comparator("a,b -> a <=> b"))
 +                .sack(Lambda.biFunction("{ a,b -> a + b }"))
 +                .asAdmin();
 +        final List<Integer> sacks = new ArrayList<>();
 +        final List<Integer> lengths = new ArrayList<>();
 +        while (t.hasNext()) {
 +            final Traverser.Admin<Integer> traverser = t.nextTraverser();
 +            sacks.add(traverser.sack());
 +            lengths.add(traverser.get());
 +        }
 +        assertFalse(t.hasNext());
 +        //
 +        assertEquals(6, lengths.size());
 +        assertEquals(3, lengths.get(0).intValue());
 +        assertEquals(3, lengths.get(1).intValue());
 +        assertEquals(3, lengths.get(2).intValue());
 +        assertEquals(4, lengths.get(3).intValue());
 +        assertEquals(5, lengths.get(4).intValue());
 +        assertEquals(6, lengths.get(5).intValue());
 +        ///
 +        assertEquals(6, sacks.size());
 +        assertEquals(4, sacks.get(0).intValue());
 +        assertEquals(4, sacks.get(1).intValue());
 +        assertEquals(4, sacks.get(2).intValue());
 +        assertEquals(5, sacks.get(3).intValue());
 +        assertEquals(6, sacks.get(4).intValue());
 +        assertEquals(7, sacks.get(5).intValue());
 +        //
 +        assertEquals(24, t.getSideEffects().<Number>get("lengthSum").intValue());
 +
 +        final String script = GroovyTranslator.of("g").translate(t.getBytecode());
 +        assertEquals("g.withStrategies(org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy.instance())" +
 +                        ".withSideEffect(\"lengthSum\",(int) 0).withSack((int) 1)" +
 +                        ".V()" +
 +                        ".filter({it.get().label().equals('person')})" +
 +                        ".flatMap({it.get().vertices(Direction.OUT)})" +
 +                        ".map({it.get().value('name').length()})" +
 +                        ".sideEffect({ x -> x.sideEffects(\"lengthSum\", x.<Integer>sideEffects('lengthSum') + x.get()) })" +
 +                        ".order().by({a,b -> a <=> b})" +
 +                        ".sack({ a,b -> a + b })",
 +                script);
 +    }
 +
 +    @Test
 +    public void shouldHandleMaps() {
 +        final TinkerGraph graph = TinkerFactory.createModern();
-         GraphTraversalSource g = graph.traversal();
-         String script = GroovyTranslator.of("g").translate(g.V().id().is(new LinkedHashMap<Object,Object>() {{
++        final GraphTraversalSource g = graph.traversal();
++        final String script = GroovyTranslator.of("g").translate(g.V().id().is(new LinkedHashMap<Object,Object>() {{
 +            put(3, "32");
 +            put(Arrays.asList(1, 2, 3.1d), 4);
 +        }}).asAdmin().getBytecode());
 +        assertEquals("g.V().id().is([((int) 3):(\"32\"),([(int) 1, (int) 2, 3.1d]):((int) 4)])", script);
++        assertThatScriptOk(script, "g", g);
 +    }
 +
 +    @Test
 +    public void shouldHandleEmptyMaps() {
 +        final TinkerGraph graph = TinkerFactory.createModern();
-         final Function identity = new Lambda.OneArgLambda("it.get()", "gremlin-groovy");
 +        final GraphTraversalSource g = graph.traversal();
++        final Function identity = new Lambda.OneArgLambda("it.get()", "gremlin-groovy");
 +        final String script = GroovyTranslator.of("g").translate(g.inject(Collections.emptyMap()).map(identity).asAdmin().getBytecode());
 +        assertEquals("g.inject([]).map({it.get()})", script);
++        assertThatScriptOk(script, "g", g);
++    }
++
++    @Test
++    public void shouldHandleDate() {
++        final Calendar c = Calendar.getInstance();
++        c.set(1975, Calendar.SEPTEMBER, 7);
++        final Date d = c.getTime();
++        assertTranslation(String.format("new java.util.Date(%s)", d.getTime()), d);
++    }
++
++    @Test
++    public void shouldHandleTimestamp() {
++        final Calendar c = Calendar.getInstance();
++        c.set(1975, Calendar.SEPTEMBER, 7);
++        final Timestamp t = new Timestamp(c.getTime().getTime());
++        assertTranslation(String.format("new java.sql.Timestamp(%s)", t.getTime()), t);
++    }
++
++    @Test
++    public void shouldHandleUuid() {
++        final UUID uuid = UUID.fromString("ffffffff-fd49-1e4b-0000-00000d4b8a1d");
++        assertTranslation(String.format("java.util.UUID.fromString('%s')", uuid), uuid);
++    }
++
++    @Test
++    public void shouldHandleColumn() {
++        assertTranslation("Column.keys", Column.keys);
++    }
++
++    @Test
++    public void shouldHandleDirection() {
++        assertTranslation("Direction.BOTH", Direction.BOTH);
++    }
++
++    @Test
++    public void shouldHandleOrder() {
++        assertTranslation("Order.decr", Order.decr);
++    }
++
++    @Test
++    public void shouldHandlePop() {
++        assertTranslation("Pop.last", Pop.last);
++    }
++
++    @Test
++    public void shouldHandleScope() {
++        assertTranslation("Scope.local", Scope.local);
++    }
++
++    @Test
++    public void shouldOverrideDefaultTypeTranslationWithSomethingBonkers() {
++        final TinkerGraph graph = TinkerGraph.open();
++        final GraphTraversalSource g = graph.traversal();
++        final String thingToSuffixAllStringsWith = "-why-would-anyone-do-this";
++        final String script = GroovyTranslator.of("g", x -> x instanceof String ? x + thingToSuffixAllStringsWith : x).
++                translate(g.inject("yyy", "xxx").asAdmin().getBytecode());
++        assertEquals(String.format("g.inject(\"yyy%s\",\"xxx%s\")", thingToSuffixAllStringsWith, thingToSuffixAllStringsWith), script);
++        assertThatScriptOk(script, "g", g);
++    }
++
++    @Test
++    public void shouldIncludeCustomTypeTranslationForSomethingSilly() throws Exception {
++        final TinkerGraph graph = TinkerGraph.open();
++        final SillyClass notSillyEnough = SillyClass.from("not silly enough", 100);
++        final GraphTraversalSource g = graph.traversal();
++
++        // without type translation we get uglinesss
++        final String scriptBad = GroovyTranslator.of("g").
++                translate(g.inject(notSillyEnough).asAdmin().getBytecode());
++        assertEquals(String.format("g.inject(%s)", "not silly enough:100"), scriptBad);
++
++        // with type translation we get valid gremlin
++        final String scriptGood = GroovyTranslator.of("g",
++                x -> x instanceof SillyClass ?
++                        new Translator.ScriptTranslator.Handled(String.format("org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslatorTest.SillyClass.from('%s', (int) %s)",
++                        ((SillyClass) x).getX(), ((SillyClass) x).getY())) : x).
++                translate(g.inject(notSillyEnough).asAdmin().getBytecode());
++        assertEquals(String.format("g.inject(org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslatorTest.SillyClass.from('%s', (int) %s))", notSillyEnough.getX(), notSillyEnough.getY()), scriptGood);
++        assertThatScriptOk(scriptGood, "g", g);
++
++        final GremlinGroovyScriptEngine customEngine = new GremlinGroovyScriptEngine(new SillyClassTranslatorCustomizer());
++        final Bindings b = new SimpleBindings();
++        b.put("g", g);
++        final Traversal t = customEngine.eval(g.inject(notSillyEnough).asAdmin().getBytecode(), b, "g");
++        final SillyClass sc = (SillyClass) t.next();
++        assertEquals(notSillyEnough.getX(), sc.getX());
++        assertEquals(notSillyEnough.getY(), sc.getY());
++        assertThat(t.hasNext(), is(false));
 +    }
 +
 +    @Test
 +    public void shouldHaveValidToString() {
 +        assertEquals("translator[h:gremlin-groovy]", GroovyTranslator.of("h").toString());
 +    }
 +
 +    @Test
 +    public void shouldEscapeStrings() {
 +        final TinkerGraph graph = TinkerFactory.createModern();
 +        final GraphTraversalSource g = graph.traversal();
 +        final String script = GroovyTranslator.of("g").translate(g.addV("customer")
 +                .property("customer_id", 501L)
 +                .property("name", "Foo\u0020Bar")
 +                .property("age", 25)
 +                .property("special", "`~!@#$%^&*()-_=+[{]}\\|;:'\",<.>/?")
 +                .asAdmin().getBytecode());
 +
 +        assertEquals("g.addV(\"customer\")" +
 +                        ".property(\"customer_id\",501L)" +
 +                        ".property(\"name\",\"Foo Bar\")" +
 +                        ".property(\"age\",(int) 25)" +
 +                        ".property(\"special\",\"\"\"`~!@#\\$%^&*()-_=+[{]}\\\\|;:'\\\",<.>/?\"\"\")",
 +                script);
 +    }
 +
 +    @Test
 +    public void shouldHandleVertexAndEdge() {
 +        final TinkerGraph graph = TinkerFactory.createModern();
 +        final GraphTraversalSource g = graph.traversal();
 +
 +        final Object id1 = "customer:10:foo\u0020bar\u0020\u0024100#90"; // customer:10:foo bar $100#90
 +        final Vertex vertex1 = DetachedVertex.build().setLabel("customer").setId(id1)
 +                .create();
-         final String script1 = GroovyTranslator.of("g").translate(g.V(vertex1).asAdmin().getBytecode());
-         assertEquals("g.V(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(" +
++        final String script1 = GroovyTranslator.of("g").translate(g.inject(vertex1).asAdmin().getBytecode());
++        assertEquals("g.inject(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(" +
 +                        "\"customer:10:foo bar \\$100#90\"," +
 +                        "\"customer\", Collections.emptyMap()))",
 +                script1);
++        assertThatScriptOk(script1, "g", g);
 +
 +        final Object id2 = "user:20:foo\\u0020bar\\u005c\\u0022mr\\u005c\\u0022\\u00241000#50"; // user:20:foo\u0020bar\u005c\u0022mr\u005c\u0022\u00241000#50
 +        final Vertex vertex2 = DetachedVertex.build().setLabel("user").setId(id2)
 +                .create();
-         final String script2 = GroovyTranslator.of("g").translate(g.V(vertex2).asAdmin().getBytecode());
-         assertEquals("g.V(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(" +
++        final String script2 = GroovyTranslator.of("g").translate(g.inject(vertex2).asAdmin().getBytecode());
++        assertEquals("g.inject(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(" +
 +                        "\"user:20:foo\\\\u0020bar\\\\u005c\\\\u0022mr\\\\u005c\\\\u0022\\\\u00241000#50\"," +
 +                        "\"user\", Collections.emptyMap()))",
 +                script2);
++        assertThatScriptOk(script2, "g", g);
 +
 +        final Object id3 = "knows:30:foo\u0020bar\u0020\u0024100:\\u0020\\u0024500#70";
 +        final Edge edge = DetachedEdge.build().setLabel("knows").setId(id3)
 +                .setOutV((DetachedVertex) vertex1)
 +                .setInV((DetachedVertex) vertex2)
 +                .create();
-         final String script3 = GroovyTranslator.of("g").translate(g.E(edge).asAdmin().getBytecode());
-         assertEquals("g.E(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge(" +
++        final String script3 = GroovyTranslator.of("g").translate(g.inject(edge).asAdmin().getBytecode());
++        assertEquals("g.inject(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedEdge(" +
 +                        "\"knows:30:foo bar \\$100:\\\\u0020\\\\u0024500#70\"," +
 +                        "\"knows\",Collections.emptyMap()," +
 +                        "\"customer:10:foo bar \\$100#90\",\"customer\"," +
 +                        "\"user:20:foo\\\\u0020bar\\\\u005c\\\\u0022mr\\\\u005c\\\\u0022\\\\u00241000#50\",\"user\"))",
 +                script3);
++        assertThatScriptOk(script3, "g", g);
 +
 +        final String script4 = GroovyTranslator.of("g").translate(
 +                g.addE("knows").from(vertex1).to(vertex2).property("when", "2018/09/21")
-                 .asAdmin().getBytecode());
++                        .asAdmin().getBytecode());
 +        assertEquals("g.addE(\"knows\")" +
-                 ".from(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(\"customer:10:foo bar \\$100#90\",\"customer\", Collections.emptyMap()))" +
-                 ".to(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(\"user:20:foo\\\\u0020bar\\\\u005c\\\\u0022mr\\\\u005c\\\\u0022\\\\u00241000#50\",\"user\", Collections.emptyMap()))" +
-                 ".property(\"when\",\"2018/09/21\")",
++                        ".from(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(\"customer:10:foo bar \\$100#90\",\"customer\", Collections.emptyMap()))" +
++                        ".to(new org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex(\"user:20:foo\\\\u0020bar\\\\u005c\\\\u0022mr\\\\u005c\\\\u0022\\\\u00241000#50\",\"user\", Collections.emptyMap()))" +
++                        ".property(\"when\",\"2018/09/21\")",
 +                script4);
 +    }
 +
++    public static Object eval(final String s, final Object... args) throws ScriptException {
++        return engine.eval(s, new SimpleBindings(ElementHelper.asMap(args)));
++    }
++
++    public static Object eval(final String s, final Bindings b) throws ScriptException {
++        return engine.eval(s, b);
++    }
++
++    private void assertTranslation(final String expectedTranslation, final Object... objs) {
++        final String script = GroovyTranslator.of("g").translate(g.inject(objs).asAdmin().getBytecode());
++        assertEquals(String.format("g.inject(%s)", expectedTranslation), script);
++        assertThatScriptOk(script, "g", g);
++    }
++
++    private void assertThatScriptOk(final String s, final Object... args) {
++        try {
++            assertNotNull(eval(s, args));
++        } catch (ScriptException se) {
++            se.printStackTrace();
++            fail("Script should have eval'd");
++        }
++    }
++
++    public static class SillyClass {
++
++        private final String x;
++        private final int y;
++
++        private SillyClass(final String x, final int y) {
++            this.x = x;
++            this.y = y;
++        }
++
++        public static SillyClass from(final String x, final int y) {
++            return new SillyClass(x, y);
++        }
++
++        public String getX() {
++            return x;
++        }
++
++        public int getY() {
++            return y;
++        }
++
++        @Override
++        public String toString() {
++            return x + ":" + String.valueOf(y);
++        }
++    }
++
++    public static class SillyClassTranslatorCustomizer implements TranslatorCustomizer {
++
++        @Override
++        public Translator.ScriptTranslator.TypeTranslator createTypeTranslator() {
++            return x -> x instanceof SillyClass ?
++                    new Translator.ScriptTranslator.Handled(String.format("org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslatorTest.SillyClass.from('%s', (int) %s)",
++                            ((SillyClass) x).getX(), ((SillyClass) x).getY())) : x;
++        }
++    }
 +}


[40/48] tinkerpop git commit: TINKERPOP-2055 Support NaN/Infinity on GraphSON 3.0

Posted by rd...@apache.org.
TINKERPOP-2055 Support NaN/Infinity on GraphSON 3.0


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

Branch: refs/heads/TINKERPOP-2037
Commit: 5b9b81fdea9778f777a01aa2a70bc93510f16399
Parents: 28bf304
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 14:53:04 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 14:53:04 2018 -0400

----------------------------------------------------------------------
 .../structure/io/graphson/GraphSONModule.java   |  2 +-
 .../io/graphson/GraphSONSerializersV3d0.java    | 23 ++++++++++++-----
 .../IO/GraphSON/GraphSONReaderTests.cs          |  7 +++---
 .../IO/GraphSON/GraphSONWriterTests.cs          |  2 +-
 .../gremlin_python/structure/io/graphsonV3d0.py | 26 ++++++++++++++++++++
 .../tests/structure/io/test_graphsonV3d0.py     | 22 +++++++++++++++++
 6 files changed, 71 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b9b81fd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
index 2e795a5..39f1927 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
@@ -254,7 +254,7 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
 
             // numbers
             addDeserializer(Integer.class, new GraphSONSerializersV3d0.IntegerJackonsDeserializer());
-            addDeserializer(Double.class, new GraphSONSerializersV3d0.DoubleJackonsDeserializer());
+            addDeserializer(Double.class, new GraphSONSerializersV3d0.DoubleJacksonDeserializer());
 
             // traversal
             addDeserializer(Bytecode.class, new TraversalSerializersV3d0.BytecodeJacksonDeserializer());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b9b81fd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV3d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV3d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV3d0.java
index 8c601b1..8d80478 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV3d0.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV3d0.java
@@ -47,11 +47,9 @@ import org.apache.tinkerpop.shaded.jackson.core.JsonProcessingException;
 import org.apache.tinkerpop.shaded.jackson.core.JsonToken;
 import org.apache.tinkerpop.shaded.jackson.databind.DeserializationContext;
 import org.apache.tinkerpop.shaded.jackson.databind.JavaType;
-import org.apache.tinkerpop.shaded.jackson.databind.JsonNode;
 import org.apache.tinkerpop.shaded.jackson.databind.SerializerProvider;
 import org.apache.tinkerpop.shaded.jackson.databind.deser.std.StdDeserializer;
 import org.apache.tinkerpop.shaded.jackson.databind.jsontype.TypeSerializer;
-import org.apache.tinkerpop.shaded.jackson.databind.node.ArrayNode;
 import org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdKeySerializer;
 import org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdScalarSerializer;
 import org.apache.tinkerpop.shaded.jackson.databind.ser.std.StdSerializer;
@@ -705,15 +703,28 @@ class GraphSONSerializersV3d0 {
         }
     }
 
-    static class DoubleJackonsDeserializer extends StdDeserializer<Double> {
+    static class DoubleJacksonDeserializer extends StdDeserializer<Double> {
 
-        protected DoubleJackonsDeserializer() {
+        protected DoubleJacksonDeserializer() {
             super(Double.class);
         }
 
         @Override
-        public Double deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-            return jsonParser.getDoubleValue();
+        public Double deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
+            if (jsonParser.getCurrentToken().isNumeric())
+                return jsonParser.getDoubleValue();
+            else  {
+                final String numberText = jsonParser.getValueAsString();
+                if ("NaN".equalsIgnoreCase(numberText))
+                    return Double.NaN;
+                else if ("-Infinity".equals(numberText) || "-INF".equalsIgnoreCase(numberText))
+                    return Double.NEGATIVE_INFINITY;
+                else if ("Infinity".equals(numberText) || "INF".equals(numberText))
+                    return Double.POSITIVE_INFINITY;
+                else
+                    throw new IllegalStateException("Double value unexpected: " + numberText);
+            }
+
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b9b81fd/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
index 15e5b05..af48f02 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
@@ -24,6 +24,7 @@
 using System;
 using System.Collections.Generic;
 using System.Numerics;
+using Gremlin.Net.Process.Traversal;
 using Gremlin.Net.Structure;
 using Gremlin.Net.Structure.IO.GraphSON;
 using Moq;
@@ -200,7 +201,7 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         public void ShouldDeserializeNaN(int version)
         {
             var serializedValue = "{\"@type\":\"g:Double\",\"@value\":'NaN'}";
-            var reader = CreateStandardGraphSONReader();
+            var reader = CreateStandardGraphSONReader(version);
 
             var jObject = JObject.Parse(serializedValue);
             var deserializedValue = reader.ToObject(jObject);
@@ -212,7 +213,7 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         public void ShouldDeserializePositiveInfinity(int version)
         {
             var serializedValue = "{\"@type\":\"g:Double\",\"@value\":'Infinity'}";
-            var reader = CreateStandardGraphSONReader();
+            var reader = CreateStandardGraphSONReader(version);
 
             var jObject = JObject.Parse(serializedValue);
             var deserializedValue = reader.ToObject(jObject);
@@ -224,7 +225,7 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         public void ShouldDeserializeNegativeInfinity(int version)
         {
             var serializedValue = "{\"@type\":\"g:Double\",\"@value\":'-Infinity'}";
-            var reader = CreateStandardGraphSONReader();
+            var reader = CreateStandardGraphSONReader(version);
 
             var jObject = JObject.Parse(serializedValue);
             var deserializedValue = reader.ToObject(jObject);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b9b81fd/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
index 07f00a9..c8ec43a 100644
--- a/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONWriterTests.cs
@@ -124,7 +124,7 @@ namespace Gremlin.Net.UnitTest.Structure.IO.GraphSON
         [Theory, MemberData(nameof(Versions))]
         public void ShouldSerializeNegativeInfinity(int version)
         {
-            var writer = CreateGraphSONWriter();
+            var writer = CreateGraphSONWriter(version);
 
             var graphSon = writer.WriteObject(Double.NegativeInfinity);
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b9b81fd/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
index 5539448..a041421 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
@@ -20,6 +20,7 @@ import datetime
 import json
 import time
 import uuid
+import math
 from collections import OrderedDict
 
 import six
@@ -464,6 +465,31 @@ class FloatIO(_NumberIO):
     graphson_type = "g:Float"
     graphson_base_type = "Float"
 
+    @classmethod
+    def dictify(cls, n, writer):
+        if isinstance(n, bool):  # because isinstance(False, int) and isinstance(True, int)
+            return n
+        elif math.isnan(n):
+            return GraphSONUtil.typedValue(cls.graphson_base_type, "NaN")
+        elif math.isinf(n) and n > 0:
+            return GraphSONUtil.typedValue(cls.graphson_base_type, "Infinity")
+        elif math.isinf(n) and n < 0:
+            return GraphSONUtil.typedValue(cls.graphson_base_type, "-Infinity")
+        else:
+            return GraphSONUtil.typedValue(cls.graphson_base_type, n)
+
+    @classmethod
+    def objectify(cls, v, _):
+        if isinstance(v, str):
+            if v == 'NaN':
+                return float('nan')
+            elif v == "Infinity":
+                return float('inf')
+            elif v == "-Infinity":
+                return float('-inf')
+
+        return cls.python_type(v)
+
 
 class DoubleIO(FloatIO):
     graphson_type = "g:Double"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5b9b81fd/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py
index 16de67f..4aa4eed 100644
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py
@@ -23,6 +23,7 @@ import datetime
 import time
 import json
 import uuid
+import math
 
 from mock import Mock
 
@@ -96,6 +97,27 @@ class TestGraphSONReader(object):
         }))
         assert isinstance(x, float)
         assert 31.2 == x
+        ##
+        x = self.graphson_reader.readObject(json.dumps({
+            "@type": "g:Double",
+            "@value": "NaN"
+        }))
+        assert isinstance(x, float)
+        assert math.isnan(x)
+        ##
+        x = self.graphson_reader.readObject(json.dumps({
+            "@type": "g:Double",
+            "@value": "Infinity"
+        }))
+        assert isinstance(x, float)
+        assert math.isinf(x) and x > 0
+        ##
+        x = self.graphson_reader.readObject(json.dumps({
+            "@type": "g:Double",
+            "@value": "-Infinity"
+        }))
+        assert isinstance(x, float)
+        assert math.isinf(x) and x < 0
 
     def test_graph(self):
         vertex = self.graphson_reader.readObject("""


[45/48] tinkerpop git commit: Moved tests that fail periodically to integration tests.

Posted by rd...@apache.org.
Moved tests that fail periodically to integration tests.

These tests require Grape and external resources to pass. Those resources seem to be less dependable on Travis sometimes and causes test failures. CTR


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

Branch: refs/heads/TINKERPOP-2037
Commit: 4bdb006c5ee418f27ef7bb8a9330714ce414c50f
Parents: ca034f1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Oct 5 06:38:42 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Oct 5 06:53:21 2018 -0400

----------------------------------------------------------------------
 .../jsr223/GremlinGroovyScriptEngineTest.java   | 33 ++---------------
 .../GremlinGroovyScriptEngineIntegrateTest.java | 37 ++++++++++++++++++++
 2 files changed, 39 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4bdb006c/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
index 54e997f..2803c24 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java
@@ -38,7 +38,8 @@ import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
 import javax.script.ScriptException;
 import javax.script.SimpleBindings;
-import java.awt.*;
+import java.awt.Color;
+import java.awt.SystemColor;
 import java.io.StringWriter;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -266,36 +267,6 @@ public class GremlinGroovyScriptEngineTest {
     }
 
     @Test
-    public void shouldLoadImportsViaDependencyManagerFromDependencyGatheredByUse() throws Exception {
-        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE);
-        try {
-            engine.eval("org.apache.commons.math3.util.FastMath.abs(-1235)");
-            fail("Should have thrown an exception because no imports were supplied");
-        } catch (Exception se) {
-            assertTrue(se instanceof ScriptException);
-        }
-
-        engine.addImports(new HashSet<>(Arrays.asList("import org.apache.commons.math3.util.FastMath")));
-        engine.use("org.apache.commons", "commons-math3", "3.2");
-        assertEquals(1235, engine.eval("org.apache.commons.math3.util.FastMath.abs(-1235)"));
-    }
-
-    @Test
-    public void shouldAllowsUseToBeExecutedAfterImport() throws Exception {
-        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE);
-        try {
-            engine.eval("org.apache.commons.math3.util.FastMath.abs(-1235)");
-            fail("Should have thrown an exception because no imports were supplied");
-        } catch (Exception se) {
-            assertTrue(se instanceof ScriptException);
-        }
-
-        engine.use("org.apache.commons", "commons-math3", "3.2");
-        engine.addImports(new HashSet<>(Arrays.asList("import org.apache.commons.math3.util.FastMath")));
-        assertEquals(1235, engine.eval("org.apache.commons.math3.util.FastMath.abs(-1235)"));
-    }
-
-    @Test
     public void shouldAllowsMultipleImports() throws Exception {
         final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE);
         try {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4bdb006c/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/jsr223/GremlinGroovyScriptEngineIntegrateTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/jsr223/GremlinGroovyScriptEngineIntegrateTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/jsr223/GremlinGroovyScriptEngineIntegrateTest.java
index 5242d3b..c595209 100644
--- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/jsr223/GremlinGroovyScriptEngineIntegrateTest.java
+++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/jsr223/GremlinGroovyScriptEngineIntegrateTest.java
@@ -18,16 +18,23 @@
  */
 package org.apache.tinkerpop.gremlin.jsr223;
 
+import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
+import org.apache.tinkerpop.gremlin.groovy.NoImportCustomizerProvider;
 import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
 import org.javatuples.Pair;
 import org.junit.Ignore;
 import org.junit.Test;
 
+import javax.script.ScriptException;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Random;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
@@ -52,4 +59,34 @@ public class GremlinGroovyScriptEngineIntegrateTest {
             }
         }
     }
+
+    @Test
+    public void shouldLoadImportsViaDependencyManagerFromDependencyGatheredByUse() throws Exception {
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE);
+        try {
+            engine.eval("org.apache.commons.math3.util.FastMath.abs(-1235)");
+            fail("Should have thrown an exception because no imports were supplied");
+        } catch (Exception se) {
+            assertTrue(se instanceof ScriptException);
+        }
+
+        engine.addImports(new HashSet<>(Arrays.asList("import org.apache.commons.math3.util.FastMath")));
+        engine.use("org.apache.commons", "commons-math3", "3.2");
+        assertEquals(1235, engine.eval("org.apache.commons.math3.util.FastMath.abs(-1235)"));
+    }
+
+    @Test
+    public void shouldAllowsUseToBeExecutedAfterImport() throws Exception {
+        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE);
+        try {
+            engine.eval("org.apache.commons.math3.util.FastMath.abs(-1235)");
+            fail("Should have thrown an exception because no imports were supplied");
+        } catch (Exception se) {
+            assertTrue(se instanceof ScriptException);
+        }
+
+        engine.use("org.apache.commons", "commons-math3", "3.2");
+        engine.addImports(new HashSet<>(Arrays.asList("import org.apache.commons.math3.util.FastMath")));
+        assertEquals(1235, engine.eval("org.apache.commons.math3.util.FastMath.abs(-1235)"));
+    }
 }


[02/48] tinkerpop git commit: fixes traversal

Posted by rd...@apache.org.
fixes traversal


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

Branch: refs/heads/TINKERPOP-2037
Commit: b34bf4da9bf4829d6474ccdb9397a30b705bd01d
Parents: 0e34073
Author: Otavio Santana <ot...@gmail.com>
Authored: Tue Sep 25 15:57:52 2018 -0300
Committer: Otavio Santana <ot...@gmail.com>
Committed: Tue Sep 25 15:57:52 2018 -0300

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java     | 37 ++++++++++++++------
 1 file changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b34bf4da/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 5ba7823..ba09a7c 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
@@ -1480,22 +1480,39 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
      * @since 3.2.2
      */
     public default GraphTraversal<S, E> hasId(final Object id, final Object... otherIds) {
-        if (id instanceof P)
+        if (id instanceof P) {
             return this.hasId((P) id);
+        }
         else {
-            final List<Object> ids = new ArrayList<>();
+            Object[] ids;
             if (id instanceof Object[]) {
-                Collections.addAll(ids, (Object[]) id);
-            } else
-                ids.add(id);
+                ids = (Object[]) id;
+            } else {
+                ids = new Object[] {id};
+            }
+            int size = ids.length;
+            int capacity = size;
             for (final Object i : otherIds) {
                 if (i.getClass().isArray()) {
-                    Collections.addAll(ids, (Object[]) i);
-                } else
-                    ids.add(i);
+                    final Object[] tmp = (Object[]) i;
+                    int newLength = size + tmp.length;
+                    if (capacity < newLength) {
+                        ids = Arrays.copyOf(ids, capacity = size + tmp.length);
+                    }
+                    System.arraycopy(tmp, 0, ids, size, tmp.length);
+                    size = newLength;
+                } else {
+                    if (capacity == size) {
+                        ids = Arrays.copyOf(ids, capacity = size * 2);
+                    }
+                    ids[size++] = i;
+                }
+            }
+            if (capacity > size) {
+                ids = Arrays.copyOf(ids, size);
             }
-            this.asAdmin().getBytecode().addStep(Symbols.hasId, ids.toArray());
-            return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.id.getAccessor(), ids.size() == 1 ? P.eq(ids.get(0)) : P.within(ids)));
+            this.asAdmin().getBytecode().addStep(Symbols.hasId, ids);
+            return TraversalHelper.addHasContainer(this.asAdmin(), new HasContainer(T.id.getAccessor(), ids.length == 1 ? P.eq(ids[0]) : P.within(ids)));
         }
     }
 


[48/48] tinkerpop git commit: TINKERPOP-2037 removed groovy-sql

Posted by rd...@apache.org.
TINKERPOP-2037 removed groovy-sql


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

Branch: refs/heads/TINKERPOP-2037
Commit: ee6802e76a4212dfba8e63cdf3eb4baa4b9dede8
Parents: 73444c3
Author: Robert Dale <ro...@gmail.com>
Authored: Tue Oct 2 12:24:31 2018 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Fri Oct 5 07:36:44 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                      |  1 +
 docs/src/upgrade/release-3.4.x.asciidoc | 19 +++++++++++++++++++
 gremlin-driver/pom.xml                  | 13 -------------
 3 files changed, 20 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ee6802e7/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 14d79aa..06ad72a 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 This release also includes changes from <<release-3-3-3, 3.3.3>>.
 
 * Added text predicates.
+* Removed groovy-sql
 * Rewrote `ConnectiveStrategy` to support an arbitrary number of infix notations in a single traversal.
 * GraphSON `MessageSerializer`s will automatically register the GremlinServerModule to a provided GraphSONMapper.
 * Removed support for `-i` option in Gremlin Server which was previously deprecated.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ee6802e7/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 21e1899..d7780f3 100644
--- a/docs/src/upgrade/release-3.4.x.asciidoc
+++ b/docs/src/upgrade/release-3.4.x.asciidoc
@@ -44,6 +44,25 @@ gremlin> g.V().has("person","name", containing("o").and(gte("j").and(endingWith(
 
 See: link:https://issues.apache.org/jira/browse/TINKERPOP-2041[TINKERPOP-2041]
 
+==== Removed groovy-sql dependency
+
+Gremlin Console and Gremlin Server no longer include groovy-sql.  If you depend on groovy-sql,
+you can install it in Gremlin Console or Gremlin Server using the plugin system.
+
+Console:
+```
+:install org.codehaus.groovy groovy-sql 2.5.2
+```
+
+Server:
+```
+bin/gremlin-server.sh install org.codehaus.groovy groovy-sql 2.5.2
+```
+
+If your project depended on groovy-sql transitively, simply include it in your project's build file (e.g. maven: pom.xml).
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-2037[TINKERPOP-2037]
+
 ==== Changed infix behavior
 
 The infix notation of `and()` and `or()` now supports an arbitrary number of traversals and `ConnectiveStrategy` produces a traversal with proper AND and OR semantics.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ee6802e7/gremlin-driver/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-driver/pom.xml b/gremlin-driver/pom.xml
index 9f1670c..724d415 100644
--- a/gremlin-driver/pom.xml
+++ b/gremlin-driver/pom.xml
@@ -56,19 +56,6 @@ limitations under the License.
             </exclusions>
         </dependency>
         <dependency>
-            <groupId>org.codehaus.groovy</groupId>
-            <artifactId>groovy-sql</artifactId>
-            <version>${groovy.version}</version>
-            <classifier>indy</classifier>
-            <exclusions>
-                <!-- exclude non-indy type -->
-                <exclusion>
-                    <groupId>org.codehaus.groovy</groupId>
-                    <artifactId>groovy</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
         </dependency>


[18/48] tinkerpop git commit: Merge branch 'tp33'

Posted by rd...@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/21d2444c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/21d2444c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/21d2444c

Branch: refs/heads/TINKERPOP-2037
Commit: 21d2444c6f404d24ed47d08f03806d73244b5691
Parents: 7ac00a1 8ca2778
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Oct 3 12:31:48 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Oct 3 12:31:48 2018 +0200

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../src/Gremlin.Net/Driver/Connection.cs        |  6 +++--
 .../src/Gremlin.Net/Driver/ConnectionFactory.cs |  7 ++++--
 .../src/Gremlin.Net/Driver/GremlinClient.cs     | 11 +++++++--
 .../Gremlin.Net/Driver/WebSocketConnection.cs   |  9 +++++--
 .../Driver/GremlinClientTests.cs                | 25 ++++++++++++++++++++
 6 files changed, 51 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/21d2444c/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
----------------------------------------------------------------------
diff --cc gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
index 822fc65,b79f0e6..92e0d35
--- a/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Driver/Connection.cs
@@@ -51,9 -52,10 +52,10 @@@ namespace Gremlin.Net.Drive
              _graphSONReader = graphSONReader;
              _graphSONWriter = graphSONWriter;
              _messageSerializer = new JsonMessageSerializer(mimeType);
+             _webSocketConnection = new WebSocketConnection(webSocketConfiguration);
          }
  
 -        public async Task<IReadOnlyCollection<T>> SubmitAsync<T>(RequestMessage requestMessage)
 +        public async Task<ResultSet<T>> SubmitAsync<T>(RequestMessage requestMessage)
          {
              await SendAsync(requestMessage).ConfigureAwait(false);
              return await ReceiveAsync<T>().ConfigureAwait(false);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/21d2444c/gremlin-dotnet/src/Gremlin.Net/Driver/GremlinClient.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/21d2444c/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs
----------------------------------------------------------------------


[41/48] tinkerpop git commit: Merge branch 'tp33'

Posted by rd...@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/e330ad67
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/e330ad67
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/e330ad67

Branch: refs/heads/TINKERPOP-2037
Commit: e330ad67d142316276624617015d3cc477c1ecad
Parents: 9e40789 5b9b81f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 14:53:46 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 14:53:46 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 docs/src/dev/io/graphson.asciidoc               |  2 +
 .../structure/io/graphson/GraphSONModule.java   |  2 +-
 .../io/graphson/GraphSONSerializersV2d0.java    | 19 ++++++--
 .../io/graphson/GraphSONSerializersV3d0.java    | 23 +++++++---
 .../GraphSONMapperEmbeddedTypeTest.java         | 14 ++++++
 .../IO/GraphSON/GraphSONReaderTests.cs          | 48 +++++++++++++++++---
 .../IO/GraphSON/GraphSONWriterTests.cs          | 32 ++++++++++++-
 .../lib/structure/io/type-serializers.js        | 30 +++++++++++-
 .../test/unit/graphson-test.js                  | 39 ++++++++++++++++
 .../gremlin_python/structure/io/graphsonV2d0.py | 26 +++++++++++
 .../gremlin_python/structure/io/graphsonV3d0.py | 26 +++++++++++
 .../tests/structure/io/test_graphsonV2d0.py     | 25 ++++++++++
 .../tests/structure/io/test_graphsonV3d0.py     | 22 +++++++++
 14 files changed, 290 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e330ad67/docs/src/dev/io/graphson.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e330ad67/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONModule.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e330ad67/gremlin-dotnet/test/Gremlin.Net.UnitTest/Structure/IO/GraphSON/GraphSONReaderTests.cs
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e330ad67/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e330ad67/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV2d0.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e330ad67/gremlin-python/src/main/jython/gremlin_python/structure/io/graphsonV3d0.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e330ad67/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV2d0.py
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e330ad67/gremlin-python/src/main/jython/tests/structure/io/test_graphsonV3d0.py
----------------------------------------------------------------------


[37/48] tinkerpop git commit: TINKERPOP-2055 Minor comment fixes

Posted by rd...@apache.org.
TINKERPOP-2055 Minor comment fixes


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

Branch: refs/heads/TINKERPOP-2037
Commit: bd7048dda3e9fb20b717412ee708cffc62f2ca41
Parents: a083fbf
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 14:02:08 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 14:02:19 2018 -0400

----------------------------------------------------------------------
 .../javascript/gremlin-javascript/test/unit/graphson-test.js   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bd7048dd/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
index a1ac0d6..66a36c6 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
@@ -46,7 +46,7 @@ describe('GraphSONReader', function () {
       assert.strictEqual(result, item[1]);
     });
   });
-  it('should parse GraphSON Nan from GraphSON', function () {
+  it('should parse GraphSON NaN from GraphSON', function () {
       const reader = new GraphSONReader();
       var result = reader.read({
                 "@type": "g:Double",
@@ -54,7 +54,7 @@ describe('GraphSONReader', function () {
               });
       assert.ok(isNaN(result));
   });
-  it('should parse GraphSON -Infinity and Nan from GraphSON', function () {
+  it('should parse GraphSON -Infinity from GraphSON', function () {
       const reader = new GraphSONReader();
       var result = reader.read({
                 "@type": "g:Double",
@@ -62,7 +62,7 @@ describe('GraphSONReader', function () {
               });
       assert.strictEqual(result, Number.NEGATIVE_INFINITY);
   });
-  it('should parse GraphSON Infinity and Nan from GraphSON', function () {
+  it('should parse GraphSON Infinity from GraphSON', function () {
       const reader = new GraphSONReader();
       var result = reader.read({
                 "@type": "g:Double",


[05/48] tinkerpop git commit: TINKERPOP-2040 Hooked up Customizer for TypeTranslator

Posted by rd...@apache.org.
TINKERPOP-2040 Hooked up Customizer for TypeTranslator

Enables the Groovy GremlinScriptEngine to use custom TypeTranslators


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

Branch: refs/heads/TINKERPOP-2037
Commit: e5c2e9cdc18751e755a21add02a75261c169cf32
Parents: 67e2ee8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Sep 25 17:29:49 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 1 16:18:28 2018 -0400

----------------------------------------------------------------------
 .../gremlin/jsr223/TranslatorCustomizer.java    | 38 ++++++++++++++++++++
 .../groovy/jsr223/GroovyTranslatorTest.java     | 23 +++++++++++-
 .../jsr223/GremlinGroovyScriptEngine.java       | 15 ++++++--
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  8 ++---
 4 files changed, 76 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e5c2e9cd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/TranslatorCustomizer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/TranslatorCustomizer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/TranslatorCustomizer.java
new file mode 100644
index 0000000..4468255
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/TranslatorCustomizer.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.jsr223;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.process.traversal.Translator;
+
+/**
+ * Provides a way to customize and override {@link Bytecode} to script translation. Not all {@link GremlinScriptEngine}
+ * will support this capability as translation is optional.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public interface TranslatorCustomizer extends Customizer {
+
+    /**
+     * Construct a {@link Translator.ScriptTranslator.TypeTranslator} that will be used by a
+     * {@link Translator.ScriptTranslator} instance within the {@link GremlinScriptEngine} to translate
+     * {@link Bytecode} to a script.
+     */
+    public Translator.ScriptTranslator.TypeTranslator createTypeTranslator();
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e5c2e9cd/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
index c224642..1622d3d 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslatorTest.java
@@ -22,6 +22,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223;
 import org.apache.commons.configuration.MapConfiguration;
 import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.jsr223.TranslatorCustomizer;
 import org.apache.tinkerpop.gremlin.process.traversal.Order;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
@@ -59,9 +60,11 @@ import java.util.List;
 import java.util.UUID;
 import java.util.function.Function;
 
+import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
 /**
@@ -224,7 +227,7 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
     }
 
     @Test
-    public void shouldIncludeCustomTypeTranslationForSomethingSilly() {
+    public void shouldIncludeCustomTypeTranslationForSomethingSilly() throws Exception {
         final SillyClass notSillyEnough = SillyClass.from("not silly enough", 100);
         final GraphTraversalSource g = graph.traversal();
 
@@ -241,6 +244,15 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
                 translate(g.inject(notSillyEnough).asAdmin().getBytecode());
         assertEquals(String.format("g.inject(org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslatorTest.SillyClass.from('%s', (int) %s))", notSillyEnough.getX(), notSillyEnough.getY()), scriptGood);
         assertThatScriptOk(scriptGood, "g", g);
+
+        final GremlinGroovyScriptEngine customEngine = new GremlinGroovyScriptEngine(new SillyClassTranslatorCustomizer());
+        final Bindings b = new SimpleBindings();
+        b.put("g", g);
+        final Traversal t = customEngine.eval(g.inject(notSillyEnough).asAdmin().getBytecode(), b, "g");
+        final SillyClass sc = (SillyClass) t.next();
+        assertEquals(notSillyEnough.getX(), sc.getX());
+        assertEquals(notSillyEnough.getY(), sc.getY());
+        assertThat(t.hasNext(), is(false));
     }
 
     @Test
@@ -344,4 +356,13 @@ public class GroovyTranslatorTest extends AbstractGremlinTest {
         }
     }
 
+    public static class SillyClassTranslatorCustomizer implements TranslatorCustomizer {
+
+        @Override
+        public Translator.ScriptTranslator.TypeTranslator createTypeTranslator() {
+            return x -> x instanceof SillyClass ?
+                    new Translator.ScriptTranslator.Handled(String.format("org.apache.tinkerpop.gremlin.groovy.jsr223.GroovyTranslatorTest.SillyClass.from('%s', (int) %s)",
+                            ((SillyClass) x).getX(), ((SillyClass) x).getY())) : x;
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e5c2e9cd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
index 381dd88..b96b8b9 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
@@ -30,7 +30,6 @@ import groovy.lang.MissingMethodException;
 import groovy.lang.MissingPropertyException;
 import groovy.lang.Script;
 import groovy.lang.Tuple;
-import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider;
 import org.apache.tinkerpop.gremlin.groovy.DefaultImportCustomizerProvider;
 import org.apache.tinkerpop.gremlin.groovy.EmptyImportCustomizerProvider;
@@ -49,7 +48,9 @@ import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptContext;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineFactory;
 import org.apache.tinkerpop.gremlin.jsr223.ImportCustomizer;
+import org.apache.tinkerpop.gremlin.jsr223.TranslatorCustomizer;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
+import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.codehaus.groovy.ast.ClassHelper;
@@ -241,6 +242,7 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
     private final Set<Artifact> artifactsToUse = new HashSet<>();
     private final boolean interpreterModeEnabled;
     private final long expectedCompilationTime;
+    private final Translator.ScriptTranslator.TypeTranslator typeTranslator;
 
     /**
      * Creates a new instance using the {@link DefaultImportCustomizerProvider}.
@@ -287,6 +289,12 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
         interpreterModeEnabled = groovyCustomizers.stream()
                 .anyMatch(p -> p.getClass().equals(InterpreterModeGroovyCustomizer.class));
 
+        final Optional<TranslatorCustomizer> translatorCustomizer = listOfCustomizers.stream().
+                filter(p -> p instanceof TranslatorCustomizer).
+                map(p -> (TranslatorCustomizer) p).findFirst();
+        typeTranslator = translatorCustomizer.isPresent() ? translatorCustomizer.get().createTypeTranslator() :
+                Translator.ScriptTranslator.TypeTranslator.identity();
+
         // not using the old provider model so set that to empty list so that when createClassLoader is called
         // it knows to use groovyCustomizers instead
         customizerProviders = Collections.emptyList();
@@ -330,6 +338,9 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
         groovyCustomizers = Collections.emptyList();
         importGroovyCustomizer = null;
 
+        // TypeTranslator can only be set by a Customizer - use this old deprecated stuff and you're outta luck
+        typeTranslator = Translator.ScriptTranslator.TypeTranslator.identity();
+
         createClassLoader();
     }
 
@@ -464,7 +475,7 @@ public class GremlinGroovyScriptEngine extends GroovyScriptEngineImpl
         inner.putAll(bytecode.getBindings());
         inner.put(HIDDEN_G, b);
 
-        return (Traversal.Admin) this.eval(GroovyTranslator.of(HIDDEN_G).translate(bytecode), inner);
+        return (Traversal.Admin) this.eval(GroovyTranslator.of(HIDDEN_G, typeTranslator).translate(bytecode), inner);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e5c2e9cd/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 9cd7791..949fcac 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -22,9 +22,7 @@ package org.apache.tinkerpop.gremlin.groovy.jsr223;
 import groovy.json.StringEscapeUtils;
 import org.apache.commons.configuration.ConfigurationConverter;
 import org.apache.tinkerpop.gremlin.process.traversal.Bytecode;
-import org.apache.tinkerpop.gremlin.process.traversal.Order;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
-import org.apache.tinkerpop.gremlin.process.traversal.Pop;
 import org.apache.tinkerpop.gremlin.process.traversal.SackFunctions;
 import org.apache.tinkerpop.gremlin.process.traversal.Translator;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
@@ -34,8 +32,6 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalOptionParent
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.TraversalStrategyProxy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
-import org.apache.tinkerpop.gremlin.structure.Column;
-import org.apache.tinkerpop.gremlin.structure.Direction;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -52,10 +48,12 @@ import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.UUID;
-import java.util.function.UnaryOperator;
 
 /**
+ * Converts bytecode to a Groovy string of Gremlin.
+ *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public final class GroovyTranslator implements Translator.ScriptTranslator {
 


[35/48] tinkerpop git commit: Merge branch 'tp32' into tp33

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

Conflicts:
	gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
	gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java


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

Branch: refs/heads/TINKERPOP-2037
Commit: 650d1e84d0b7d6f8a213a67df593c43134e156fe
Parents: 2b4c993 b510613
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 12:11:28 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 12:11:28 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../src/reference/gremlin-applications.asciidoc |  1 +
 .../tinkerpop/gremlin/driver/Cluster.java       | 30 ++++++++++++++++++--
 .../gremlin/driver/ConnectionPool.java          |  3 +-
 .../tinkerpop/gremlin/driver/Settings.java      | 15 +++++++---
 .../tinkerpop/gremlin/driver/SettingsTest.java  |  8 ++++--
 .../server/GremlinDriverIntegrateTest.java      | 27 +++++++++++++++++-
 7 files changed, 74 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/650d1e84/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/650d1e84/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
----------------------------------------------------------------------
diff --cc gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
index cee1309,c090584..fe1d896
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
@@@ -880,6 -900,28 +891,17 @@@ public final class Cluster 
          }
  
          /**
+          * Specify a valid Gremlin script that can be used to test remote operations. This script should be designed
+          * to return quickly with the least amount of overhead possible. By default, the script sends an empty string.
+          * If the graph does not support that sort of script because it requires all scripts to include a reference
+          * to a graph then a good option might be {@code g.inject()}.
+          */
+         public Builder validationRequest(final String script) {
+             validationRequest = script;
+             return this;
+         }
+ 
+         /**
 -         * Time in milliseconds to wait before attempting to reconnect to a dead host after it has been marked dead.
 -         *
 -         * @deprecated As of release 3.2.3, the value of the initial delay is now the same as the {@link #reconnectInterval}.
 -         */
 -        @Deprecated
 -        public Builder reconnectIntialDelay(final int initialDelay) {
 -            this.reconnectInitialDelay = initialDelay;
 -            return this;
 -        }
 -
 -        /**
           * Time in milliseconds to wait between retries when attempting to reconnect to a dead host.
           */
          public Builder reconnectInterval(final int interval) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/650d1e84/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
----------------------------------------------------------------------
diff --cc gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
index 37cecb4,c2ae045..61edd86
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
@@@ -409,6 -420,27 +411,11 @@@ final class Settings 
           * {@link org.apache.tinkerpop.gremlin.driver.Channelizer.WebSocketChannelizer}.
           */
          public String channelizer = Channelizer.WebSocketChannelizer.class.getName();
+ 
+         /**
+          * A valid Gremlin script that can be used to test remote operations.
+          */
+         public String validationRequest = "''";
 -
 -        /**
 -         * @deprecated as of 3.1.1-incubating, and not replaced as this property was never implemented internally
 -         * as the way to establish sessions
 -         */
 -        @Deprecated
 -        public String sessionId = null;
 -
 -        /**
 -         * @deprecated as of 3.1.1-incubating, and not replaced as this property was never implemented internally
 -         * as the way to establish sessions
 -         */
 -        @Deprecated
 -        public Optional<String> optionalSessionId() {
 -            return Optional.ofNullable(sessionId);
 -        }
      }
  
      public static class SerializerSettings {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/650d1e84/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
----------------------------------------------------------------------
diff --cc gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
index 4ef0692,63c4308..c140f04
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/SettingsTest.java
@@@ -66,8 -68,10 +68,9 @@@ public class SettingsTest 
          conf.setProperty("connectionPool.maxWaitForConnection", 700);
          conf.setProperty("connectionPool.maxContentLength", 800);
          conf.setProperty("connectionPool.reconnectInterval", 900);
 -        conf.setProperty("connectionPool.reconnectInitialDelay", 1000);
          conf.setProperty("connectionPool.resultIterationBatchSize", 1100);
          conf.setProperty("connectionPool.channelizer", "channelizer0");
+         conf.setProperty("connectionPool.validationRequest", "g.inject()");
  
          final Settings settings = Settings.from(conf);
  
@@@ -103,7 -107,9 +106,8 @@@
          assertEquals(700, settings.connectionPool.maxWaitForConnection);
          assertEquals(800, settings.connectionPool.maxContentLength);
          assertEquals(900, settings.connectionPool.reconnectInterval);
 -        assertEquals(1000, settings.connectionPool.reconnectInitialDelay);
          assertEquals(1100, settings.connectionPool.resultIterationBatchSize);
          assertEquals("channelizer0", settings.connectionPool.channelizer);
+         assertEquals("g.inject()", settings.connectionPool.validationRequest);
      }
  }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/650d1e84/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
----------------------------------------------------------------------


[25/48] tinkerpop git commit: Merge branch 'tp33'

Posted by rd...@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/2ae8c5be
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2ae8c5be
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2ae8c5be

Branch: refs/heads/TINKERPOP-2037
Commit: 2ae8c5becc4318e45d6a48d32ea5e8f3eed451e5
Parents: 21d2444 2b4c993
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 16:09:48 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 3 16:09:48 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   2 +
 .../gremlin/jsr223/TranslatorCustomizer.java    |  38 ++++
 .../gremlin/process/traversal/Translator.java   |  34 +++
 .../jsr223/GremlinGroovyScriptEngine.java       |  11 +-
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  34 ++-
 .../groovy/jsr223/GroovyTranslatorTest.java     | 215 +++++++++++++++++--
 6 files changed, 309 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2ae8c5be/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngine.java
----------------------------------------------------------------------


[20/48] tinkerpop git commit: Merge branch 'tp32' of https://git-wip-us.apache.org/repos/asf/tinkerpop into tp32

Posted by rd...@apache.org.
Merge branch 'tp32' of https://git-wip-us.apache.org/repos/asf/tinkerpop into tp32


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

Branch: refs/heads/TINKERPOP-2037
Commit: fcbce509fc2957bae74ef585875dd872322a9b21
Parents: b440742 76c9aba
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Wed Oct 3 12:33:23 2018 +0200
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Wed Oct 3 12:33:23 2018 +0200

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java     | 48 ++++++++++++--------
 .../step/sideEffect/SideEffectCapStep.java      |  4 +-
 2 files changed, 30 insertions(+), 22 deletions(-)
----------------------------------------------------------------------



[14/48] tinkerpop git commit: Merge branch 'pr-920' into tp32

Posted by rd...@apache.org.
Merge branch 'pr-920' into tp32


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

Branch: refs/heads/TINKERPOP-2037
Commit: 76c9aba94f0f5c464fe4be975809c7dce9c7b92b
Parents: e7af98b b34bf4d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 06:12:43 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 3 06:12:43 2018 -0400

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java     | 48 ++++++++++++--------
 .../step/sideEffect/SideEffectCapStep.java      |  4 +-
 2 files changed, 30 insertions(+), 22 deletions(-)
----------------------------------------------------------------------



[21/48] tinkerpop git commit: Optimazes Map with enum using the EnumMap implementation

Posted by rd...@apache.org.
Optimazes Map with enum using the EnumMap implementation


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

Branch: refs/heads/TINKERPOP-2037
Commit: 9e1865a98d9350451d29dc837e053109d714d7e3
Parents: fcbce50
Author: Otavio Santana <ot...@gmail.com>
Authored: Wed Oct 3 14:17:07 2018 -0300
Committer: Otavio Santana <ot...@gmail.com>
Committed: Wed Oct 3 14:17:07 2018 -0300

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/process/computer/GraphFilter.java  | 5 +++--
 .../traversal/strategy/optimization/GraphFilterStrategy.java    | 4 ++--
 .../gremlin/structure/util/star/StarGraphGryoSerializer.java    | 3 ++-
 3 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e1865a9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java
index 3718d16..65d74d2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java
@@ -31,6 +31,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 
 import java.io.Serializable;
 import java.util.Collections;
+import java.util.EnumMap;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -80,7 +81,7 @@ public final class GraphFilter implements Cloneable, Serializable {
 
     private Traversal.Admin<Vertex, Vertex> vertexFilter = null;
     private Traversal.Admin<Vertex, Edge> edgeFilter = null;
-    private Map<Direction, Map<String, Legal>> edgeLegality = new HashMap<>();
+    private Map<Direction, Map<String, Legal>> edgeLegality = new EnumMap<>(Direction.class);
     private boolean allowNoEdges = false;
 
     public GraphFilter() {
@@ -118,7 +119,7 @@ public final class GraphFilter implements Cloneable, Serializable {
             throw GraphComputer.Exceptions.edgeFilterAccessesAdjacentVertices(edgeFilter);
         this.edgeFilter = edgeFilter.asAdmin().clone();
         ////
-        this.edgeLegality = new HashMap<>();
+        this.edgeLegality = new EnumMap<>(Direction.class);
         this.edgeLegality.put(Direction.OUT, new HashMap<>());
         this.edgeLegality.put(Direction.IN, new HashMap<>());
         this.edgeLegality.put(Direction.BOTH, new HashMap<>());

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e1865a9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategy.java
index c32777b..cc0e6b4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/optimization/GraphFilterStrategy.java
@@ -39,7 +39,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
 
 import java.util.Collections;
-import java.util.HashMap;
+import java.util.EnumMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
@@ -77,7 +77,7 @@ public final class GraphFilterStrategy extends AbstractTraversalStrategy<Travers
             return null; // if the traversal is an edge traversal, don't filter (this can be made less stringent)
         if (TraversalHelper.hasStepOfAssignableClassRecursively(LambdaHolder.class, traversal))
             return null; // if the traversal contains lambdas, don't filter as you don't know what is being accessed by the lambdas
-        final Map<Direction, Set<String>> directionLabels = new HashMap<>();
+        final Map<Direction, Set<String>> directionLabels = new EnumMap<>(Direction.class);
         final Set<String> outLabels = new HashSet<>();
         final Set<String> inLabels = new HashSet<>();
         final Set<String> bothLabels = new HashSet<>();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e1865a9/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
index b2379ce..86bbf98 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphGryoSerializer.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.structure.util.star;
 
+import java.util.EnumMap;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -34,7 +35,7 @@ import org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim.shaded.ShadedSeri
  */
 public final class StarGraphGryoSerializer extends ShadedSerializerAdapter<StarGraph>  {
 
-    private static final Map<Direction, StarGraphGryoSerializer> CACHE = new HashMap<>();
+    private static final Map<Direction, StarGraphGryoSerializer> CACHE = new EnumMap<>(Direction.class);
 
     static {
         CACHE.put(Direction.BOTH, new StarGraphGryoSerializer(Direction.BOTH));


[10/48] tinkerpop git commit: TINKERPOP-2055 Added special number handling in javascript

Posted by rd...@apache.org.
TINKERPOP-2055 Added special number handling in javascript


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

Branch: refs/heads/TINKERPOP-2037
Commit: 2d3041f226310379c966214461c79cf47432f4c9
Parents: 854914e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 04:33:40 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 3 04:33:40 2018 -0400

----------------------------------------------------------------------
 .../lib/structure/io/type-serializers.js        | 30 ++++++++++++++-
 .../test/unit/graphson-test.js                  | 39 ++++++++++++++++++++
 2 files changed, 67 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d3041f2/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
index fdf049f..5583c47 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/io/type-serializers.js
@@ -49,11 +49,37 @@ class TypeSerializer {
 
 class NumberSerializer extends TypeSerializer {
   serialize(item) {
-    return item;
+    if (isNaN(item)) {
+      return {
+        [typeKey]: 'g:Double',
+        [valueKey]: 'NaN'
+      };
+    } else if (item === Number.POSITIVE_INFINITY) {
+      return {
+        [typeKey]: 'g:Double',
+        [valueKey]: 'Infinity'
+      };
+    } else if (item === Number.NEGATIVE_INFINITY) {
+      return {
+        [typeKey]: 'g:Double',
+        [valueKey]: '-Infinity'
+      };
+    } else {
+      return item;
+    }
   }
 
   deserialize(obj) {
-    return parseFloat(obj[valueKey]);
+    var val = obj[valueKey];
+    if (val === 'NaN') {
+      return NaN;
+    } else if (val === 'Infinity') {
+      return Number.POSITIVE_INFINITY;
+    } else if (val === '-Infinity') {
+      return Number.NEGATIVE_INFINITY;
+    } else {
+      return parseFloat(val);
+    }
   }
 
   canBeUsedFor(value) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/2d3041f2/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
----------------------------------------------------------------------
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
index b459407..a1ac0d6 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/test/unit/graphson-test.js
@@ -46,6 +46,30 @@ describe('GraphSONReader', function () {
       assert.strictEqual(result, item[1]);
     });
   });
+  it('should parse GraphSON Nan from GraphSON', function () {
+      const reader = new GraphSONReader();
+      var result = reader.read({
+                "@type": "g:Double",
+                "@value": "NaN"
+              });
+      assert.ok(isNaN(result));
+  });
+  it('should parse GraphSON -Infinity and Nan from GraphSON', function () {
+      const reader = new GraphSONReader();
+      var result = reader.read({
+                "@type": "g:Double",
+                "@value": "-Infinity"
+              });
+      assert.strictEqual(result, Number.NEGATIVE_INFINITY);
+  });
+  it('should parse GraphSON Infinity and Nan from GraphSON', function () {
+      const reader = new GraphSONReader();
+      var result = reader.read({
+                "@type": "g:Double",
+                "@value": "Infinity"
+              });
+      assert.strictEqual(result, Number.POSITIVE_INFINITY);
+  });
   it('should parse Date', function() {
     const obj = { "@type" : "g:Date", "@value" : 1481750076295 };
     const reader = new GraphSONReader();
@@ -102,6 +126,21 @@ describe('GraphSONWriter', function () {
     const writer = new GraphSONWriter();
     assert.strictEqual(writer.write(2), '2');
   });
+  it('should write NaN', function () {
+    const writer = new GraphSONWriter();
+    const expected = JSON.stringify({ "@type" : "g:Double", "@value" : "NaN" });
+    assert.strictEqual(writer.write(NaN), expected);
+  });
+  it('should write Infinity', function () {
+    const writer = new GraphSONWriter();
+    const expected = JSON.stringify({ "@type" : "g:Double", "@value" : "Infinity" });
+    assert.strictEqual(writer.write(Number.POSITIVE_INFINITY), expected);
+  });
+  it('should write -Infinity', function () {
+    const writer = new GraphSONWriter();
+    const expected = JSON.stringify({ "@type" : "g:Double", "@value" : "-Infinity" });
+    assert.strictEqual(writer.write(Number.NEGATIVE_INFINITY), expected);
+  });
   it('should write Date', function() {
     const writer = new GraphSONWriter();
     const expected = JSON.stringify({ "@type" : "g:Date", "@value" : 1481750076295 });


[23/48] tinkerpop git commit: Merge branch 'TINKERPOP-2040' into tp32

Posted by rd...@apache.org.
Merge branch 'TINKERPOP-2040' into tp32


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

Branch: refs/heads/TINKERPOP-2037
Commit: 88d6f778694e6c65ddde6fdcc18948327e01914a
Parents: fcbce50 92c74c3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Oct 3 15:28:58 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Oct 3 15:28:58 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   2 +
 .../gremlin/jsr223/TranslatorCustomizer.java    |  38 ++++
 .../gremlin/process/traversal/Translator.java   |  34 +++
 .../groovy/jsr223/GroovyTranslatorTest.java     | 213 ++++++++++++++++---
 .../jsr223/GremlinGroovyScriptEngine.java       |  15 +-
 .../gremlin/groovy/jsr223/GroovyTranslator.java |  34 ++-
 6 files changed, 301 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


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


[09/48] tinkerpop git commit: TINKERPOP-2055 Support for special numbers in python

Posted by rd...@apache.org.
TINKERPOP-2055 Support for special numbers in python


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

Branch: refs/heads/TINKERPOP-2037
Commit: 854914e6e3adbf7f0854eb0fec0c3a38b61d4644
Parents: afc12bd
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Oct 2 16:55:50 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Oct 2 16:55:50 2018 -0400

----------------------------------------------------------------------
 .../gremlin_python/structure/io/graphson.py     | 26 ++++++++++++++++++++
 .../jython/tests/structure/io/test_graphson.py  | 25 +++++++++++++++++++
 2 files changed, 51 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/854914e6/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
index 24e86bb..f3411ba 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/io/graphson.py
@@ -20,6 +20,7 @@ import datetime
 import json
 import time
 import uuid
+import math
 from collections import OrderedDict
 
 import six
@@ -381,6 +382,31 @@ class FloatIO(_NumberIO):
     graphson_type = "g:Float"
     graphson_base_type = "Float"
 
+    @classmethod
+    def dictify(cls, n, writer):
+        if isinstance(n, bool):  # because isinstance(False, int) and isinstance(True, int)
+            return n
+        elif math.isnan(n):
+            return GraphSONUtil.typedValue(cls.graphson_base_type, "NaN")
+        elif math.isinf(n) and n > 0:
+            return GraphSONUtil.typedValue(cls.graphson_base_type, "Infinity")
+        elif math.isinf(n) and n < 0:
+            return GraphSONUtil.typedValue(cls.graphson_base_type, "-Infinity")
+        else:
+            return GraphSONUtil.typedValue(cls.graphson_base_type, n)
+
+    @classmethod
+    def objectify(cls, v, _):
+        if isinstance(v, str):
+            if v == 'NaN':
+                return float('nan')
+            elif v == "Infinity":
+                return float('inf')
+            elif v == "-Infinity":
+                return float('-inf')
+
+        return cls.python_type(v)
+
 
 class DoubleIO(FloatIO):
     graphson_type = "g:Double"

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/854914e6/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
index 928b33f..37e99c6 100644
--- a/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
+++ b/gremlin-python/src/main/jython/tests/structure/io/test_graphson.py
@@ -22,6 +22,7 @@ import datetime
 import time
 import json
 import uuid
+import math
 
 from mock import Mock
 
@@ -70,6 +71,27 @@ class TestGraphSONReader(object):
         }))
         assert isinstance(x, float)
         assert 31.2 == x
+        ##
+        x = self.graphson_reader.readObject(json.dumps({
+            "@type": "g:Double",
+            "@value": "NaN"
+        }))
+        assert isinstance(x, float)
+        assert math.isnan(x)
+        ##
+        x = self.graphson_reader.readObject(json.dumps({
+            "@type": "g:Double",
+            "@value": "Infinity"
+        }))
+        assert isinstance(x, float)
+        assert math.isinf(x) and x > 0
+        ##
+        x = self.graphson_reader.readObject(json.dumps({
+            "@type": "g:Double",
+            "@value": "-Infinity"
+        }))
+        assert isinstance(x, float)
+        assert math.isinf(x) and x < 0
 
     def test_graph(self):
         vertex = self.graphson_reader.readObject(
@@ -163,6 +185,9 @@ class TestGraphSONWriter(object):
         assert {"@type": "g:Int64", "@value": 2} == json.loads(self.graphson_writer.writeObject(long(2)))
         assert {"@type": "g:Int32", "@value": 1} == json.loads(self.graphson_writer.writeObject(1))
         assert {"@type": "g:Double", "@value": 3.2} == json.loads(self.graphson_writer.writeObject(3.2))
+        assert {"@type": "g:Double", "@value": "NaN"} == json.loads(self.graphson_writer.writeObject(float('nan')))
+        assert {"@type": "g:Double", "@value": "Infinity"} == json.loads(self.graphson_writer.writeObject(float('inf')))
+        assert {"@type": "g:Double", "@value": "-Infinity"} == json.loads(self.graphson_writer.writeObject(float('-inf')))
         assert """true""" == self.graphson_writer.writeObject(True)
 
     def test_P(self):


[36/48] tinkerpop git commit: Merge branch 'tp33'

Posted by rd...@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/9e407898
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9e407898
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9e407898

Branch: refs/heads/TINKERPOP-2037
Commit: 9e4078983bb41a66f17cd33d599168a8ec78295b
Parents: 8b69b34 650d1e8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Oct 4 12:12:02 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Oct 4 12:12:02 2018 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../src/reference/gremlin-applications.asciidoc |  1 +
 .../tinkerpop/gremlin/driver/Cluster.java       | 30 ++++++++++++++++++--
 .../gremlin/driver/ConnectionPool.java          |  3 +-
 .../tinkerpop/gremlin/driver/Settings.java      | 15 +++++++---
 .../tinkerpop/gremlin/driver/SettingsTest.java  |  8 ++++--
 .../server/GremlinDriverIntegrateTest.java      | 27 +++++++++++++++++-
 7 files changed, 74 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e407898/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/9e407898/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java
----------------------------------------------------------------------