You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2016/08/27 00:54:50 UTC

[35/50] [abbrv] tinkerpop git commit: Added GraphSONX as an extension module to the core types.

Added GraphSONX as an extension module to the core types.

Some types might be good for better parity with gryo but were too tied to Java to be easy for GLV devs to support. Adding an extension module makes things a little easier on the GLVs providing a simpler level to support.


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

Branch: refs/heads/master
Commit: 5c9cbf65785b92427e5bb540e1df185b9e10dc2c
Parents: 186f26b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Aug 26 12:33:53 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Aug 26 12:33:53 2016 -0400

----------------------------------------------------------------------
 docs/src/reference/the-graph.asciidoc           |   9 ++
 .../structure/io/graphson/GraphSONMapper.java   |  20 +--
 .../structure/io/graphson/GraphSONModule.java   |  73 ----------
 .../structure/io/graphson/GraphSONTokens.java   |   1 +
 .../io/graphson/GraphSONXModuleV2d0.java        | 140 +++++++++++++++++++
 .../GraphSONMapperEmbeddedTypeTest.java         |   4 +-
 .../io/graphson/GraphSONMapperTest.java         |   2 +-
 ...aphSONMapperV2d0PartialEmbeddedTypeTest.java |   3 +-
 .../TinkerGraphGraphSONSerializerV2d0Test.java  |   3 +
 .../io/graphson/GraphSONTranslator.java         |   7 +-
 .../TinkerGraphGraphSONTranslatorProvider.java  |   1 +
 11 files changed, 167 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/docs/src/reference/the-graph.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graph.asciidoc b/docs/src/reference/the-graph.asciidoc
index b7fbc74..ef70454 100644
--- a/docs/src/reference/the-graph.asciidoc
+++ b/docs/src/reference/the-graph.asciidoc
@@ -695,6 +695,15 @@ TinkerPop includes types for graph elements:
 * Metrics -> "g:Metrics"
 * TraversalMetrics -> `g:TraversalMetrics"
 
+GraphSON 2.0 can also be configured with "extended" types that build on top of the core types in the "g" namespace.
+The extended types are in the "gx" namespace as exposed by `GraphSONXModuleV2d0` and includes additional types like
+mappings to Java's `java.time.*` classes, `BigInteger`, `BigDecimal` and others. This module can be added when building
+a `GraphSONMapper` by calling the `addCustomModule()` method on the `Builder`.
+
+IMPORTANT: When using the extended type system in Gremlin Server, support for these types when used in the context of
+Gremlin Language Variants is dependent on the programming language, the driver and its serializers. These
+implementations are only required to support the core types and not the extended ones.
+
 Here's the same previous example of GraphSON 1.0, but with GraphSON 2.0:
 
 [gremlin-groovy]

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
index 1378f6e..7e46c98 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapper.java
@@ -29,13 +29,8 @@ import org.apache.tinkerpop.shaded.jackson.databind.jsontype.TypeResolverBuilder
 import org.apache.tinkerpop.shaded.jackson.databind.jsontype.impl.StdTypeResolverBuilder;
 import org.apache.tinkerpop.shaded.jackson.databind.module.SimpleModule;
 import org.apache.tinkerpop.shaded.jackson.databind.ser.DefaultSerializerProvider;
-import org.apache.tinkerpop.shaded.jackson.databind.util.TokenBuffer;
 import org.javatuples.Pair;
 
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -45,8 +40,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.TimeZone;
 import java.util.UUID;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * An extension to the standard Jackson {@code ObjectMapper} which automatically registers the standard
@@ -171,23 +164,14 @@ public class GraphSONMapper implements Mapper<ObjectMapper> {
     }
 
 
-    private void registerJavaBaseTypes(GraphSONTypeIdResolver graphSONTypeIdResolver) {
+    private void registerJavaBaseTypes(final GraphSONTypeIdResolver graphSONTypeIdResolver) {
         Arrays.asList(
-                BigInteger.class,
-                BigDecimal.class,
-                Byte.class,
-                Character.class,
                 UUID.class,
-                InetAddress.class,
-                InetSocketAddress.class,
                 Class.class,
                 Calendar.class,
                 Date.class,
                 TimeZone.class,
-                Timestamp.class,
-                AtomicBoolean.class,
-                AtomicReference.class,
-                TokenBuffer.class
+                Timestamp.class
         ).forEach(e -> graphSONTypeIdResolver.addCustomType(String.format("%s:%s", GraphSONTokens.GREMLIN_TYPE_NAMESPACE, e.getSimpleName()), e));
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/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 cf80428..787867f 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
@@ -46,7 +46,6 @@ import org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSeriali
 import org.apache.tinkerpop.gremlin.structure.util.star.StarGraphGraphSONSerializerV2d0;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
 
-import java.nio.ByteBuffer;
 import java.time.Duration;
 import java.time.Instant;
 import java.time.LocalDate;
@@ -90,28 +89,11 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
                 new LinkedHashMap<Class, String>() {{
                     // Those don't have deserializers because handled by Jackson,
                     // but we still want to rename them in GraphSON
-                    put(ByteBuffer.class, "ByteBuffer");
-                    put(Short.class, "Int16");
                     put(Integer.class, "Int32");
                     put(Long.class, "Int64");
                     put(Double.class, "Double");
                     put(Float.class, "Float");
 
-                    // Time serializers/deserializers
-                    put(Duration.class, "Duration");
-                    put(Instant.class, "Instant");
-                    put(LocalDate.class, "LocalDate");
-                    put(LocalDateTime.class, "LocalDateTime");
-                    put(LocalTime.class, "LocalTime");
-                    put(MonthDay.class, "MonthDay");
-                    put(OffsetDateTime.class, "OffsetDateTime");
-                    put(OffsetTime.class, "OffsetTime");
-                    put(Period.class, "Period");
-                    put(Year.class, "Year");
-                    put(YearMonth.class, "YearMonth");
-                    put(ZonedDateTime.class, "ZonedDateTime");
-                    put(ZoneOffset.class, "ZoneOffset");
-
                     // Tinkerpop Graph objects
                     put(Lambda.class, "Lambda");
                     put(Vertex.class, "Vertex");
@@ -167,21 +149,6 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
             addSerializer(Integer.class, new GraphSONSerializersV2d0.IntegerGraphSONSerializer());
             addSerializer(Double.class, new GraphSONSerializersV2d0.DoubleGraphSONSerializer());
 
-            // java.time
-            addSerializer(Duration.class, new JavaTimeSerializersV2d0.DurationJacksonSerializer());
-            addSerializer(Instant.class, new JavaTimeSerializersV2d0.InstantJacksonSerializer());
-            addSerializer(LocalDate.class, new JavaTimeSerializersV2d0.LocalDateJacksonSerializer());
-            addSerializer(LocalDateTime.class, new JavaTimeSerializersV2d0.LocalDateTimeJacksonSerializer());
-            addSerializer(LocalTime.class, new JavaTimeSerializersV2d0.LocalTimeJacksonSerializer());
-            addSerializer(MonthDay.class, new JavaTimeSerializersV2d0.MonthDayJacksonSerializer());
-            addSerializer(OffsetDateTime.class, new JavaTimeSerializersV2d0.OffsetDateTimeJacksonSerializer());
-            addSerializer(OffsetTime.class, new JavaTimeSerializersV2d0.OffsetTimeJacksonSerializer());
-            addSerializer(Period.class, new JavaTimeSerializersV2d0.PeriodJacksonSerializer());
-            addSerializer(Year.class, new JavaTimeSerializersV2d0.YearJacksonSerializer());
-            addSerializer(YearMonth.class, new JavaTimeSerializersV2d0.YearMonthJacksonSerializer());
-            addSerializer(ZonedDateTime.class, new JavaTimeSerializersV2d0.ZonedDateTimeJacksonSerializer());
-            addSerializer(ZoneOffset.class, new JavaTimeSerializersV2d0.ZoneOffsetJacksonSerializer());
-
             // traversal
             addSerializer(Traversal.class, new GraphSONTraversalSerializersV2d0.TraversalJacksonSerializer());
             addSerializer(Bytecode.class, new GraphSONTraversalSerializersV2d0.BytecodeJacksonSerializer());
@@ -211,21 +178,6 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
             addDeserializer(TraversalMetrics.class, new GraphSONSerializersV2d0.TraversalMetricsJacksonDeserializer());
             addDeserializer(Tree.class, new GraphSONSerializersV2d0.TreeJacksonDeserializer());
 
-            // java.time
-            addDeserializer(Duration.class, new JavaTimeSerializersV2d0.DurationJacksonDeserializer());
-            addDeserializer(Instant.class, new JavaTimeSerializersV2d0.InstantJacksonDeserializer());
-            addDeserializer(LocalDate.class, new JavaTimeSerializersV2d0.LocalDateJacksonDeserializer());
-            addDeserializer(LocalDateTime.class, new JavaTimeSerializersV2d0.LocalDateTimeJacksonDeserializer());
-            addDeserializer(LocalTime.class, new JavaTimeSerializersV2d0.LocalTimeJacksonDeserializer());
-            addDeserializer(MonthDay.class, new JavaTimeSerializersV2d0.MonthDayJacksonDeserializer());
-            addDeserializer(OffsetDateTime.class, new JavaTimeSerializersV2d0.OffsetDateTimeJacksonDeserializer());
-            addDeserializer(OffsetTime.class, new JavaTimeSerializersV2d0.OffsetTimeJacksonDeserializer());
-            addDeserializer(Period.class, new JavaTimeSerializersV2d0.PeriodJacksonDeserializer());
-            addDeserializer(Year.class, new JavaTimeSerializersV2d0.YearJacksonDeserializer());
-            addDeserializer(YearMonth.class, new JavaTimeSerializersV2d0.YearMonthJacksonDeserializer());
-            addDeserializer(ZonedDateTime.class, new JavaTimeSerializersV2d0.ZonedDateTimeJacksonDeserializer());
-            addDeserializer(ZoneOffset.class, new JavaTimeSerializersV2d0.ZoneOffsetJacksonDeserializer());
-
             // traversal
             addDeserializer(Bytecode.class, new GraphSONTraversalSerializersV2d0.BytecodeJacksonDeserializer());
             addDeserializer(Bytecode.Binding.class, new GraphSONTraversalSerializersV2d0.BindingJacksonDeserializer());
@@ -322,31 +274,6 @@ abstract class GraphSONModule extends TinkerPopJacksonModule {
             addDeserializer(YearMonth.class, new JavaTimeSerializersV1d0.YearMonthJacksonDeserializer());
             addDeserializer(ZonedDateTime.class, new JavaTimeSerializersV1d0.ZonedDateTimeJacksonDeserializer());
             addDeserializer(ZoneOffset.class, new JavaTimeSerializersV1d0.ZoneOffsetJacksonDeserializer());
-
-            // traversal
-            // TODO: review (added for integration with new GraphSON model for GLV bytecode)
-            /*addSerializer(Traversal.class, new GraphSONTraversalSerializersV2d0.TraversalJacksonSerializer());
-            addSerializer(Bytecode.class, new GraphSONTraversalSerializersV2d0.BytecodeJacksonSerializer());
-            addSerializer(VertexProperty.Cardinality.class, new GraphSONTraversalSerializersV2d0.EnumJacksonSerializer());
-            addSerializer(Column.class, new GraphSONTraversalSerializersV2d0.EnumJacksonSerializer());
-            addSerializer(Direction.class, new GraphSONTraversalSerializersV2d0.EnumJacksonSerializer());
-            addSerializer(SackFunctions.Barrier.class, new GraphSONTraversalSerializersV2d0.EnumJacksonSerializer());
-            addSerializer(Operator.class, new GraphSONTraversalSerializersV2d0.EnumJacksonSerializer());
-            addSerializer(Order.class, new GraphSONTraversalSerializersV2d0.EnumJacksonSerializer());
-            addSerializer(Pop.class, new GraphSONTraversalSerializersV2d0.EnumJacksonSerializer());
-            addSerializer(Scope.class, new GraphSONTraversalSerializersV2d0.EnumJacksonSerializer());
-            addSerializer(T.class, new GraphSONTraversalSerializersV2d0.EnumJacksonSerializer());
-            addSerializer(P.class, new GraphSONTraversalSerializersV2d0.PJacksonSerializer());
-            addSerializer(Lambda.class, new GraphSONTraversalSerializersV2d0.LambdaJacksonSerializer());
-            addSerializer(Bytecode.Binding.class, new GraphSONTraversalSerializersV2d0.BindingJacksonSerializer());
-            addSerializer(Traverser.class, new GraphSONTraversalSerializersV2d0.TraverserJacksonSerializer());*/
-            // -- deserializers for traversal
-            //addDeserializer(Bytecode.class, new GraphSONTraversalSerializersV2d0.BytecodeJacksonDeserializer());
-            //addDeserializer(Enum.class, new GraphSONTraversalSerializersV2d0.EnumJacksonDeserializer());
-            //addDeserializer(P.class, new GraphSONTraversalSerializersV2d0.PJacksonDeserializer());
-            //addDeserializer(Lambda.class, new GraphSONTraversalSerializersV2d0.LambdaJacksonDeserializer());
-            //addDeserializer(Bytecode.Binding.class, new GraphSONTraversalSerializersV2d0.BindingJacksonDeserializer());
-
         }
 
         public static Builder build() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTokens.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTokens.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTokens.java
index ff8cfd6..9f0648a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTokens.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTokens.java
@@ -48,6 +48,7 @@ public final class GraphSONTokens {
     public static final String IN_LABEL = "inVLabel";
     public static final String OUT_LABEL = "outVLabel";
     public static final String GREMLIN_TYPE_NAMESPACE = "g";
+    public static final String GREMLINX_TYPE_NAMESPACE = "gx";
 
     // TraversalExplanation Tokens
     public static final String ORIGINAL = "original";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONXModuleV2d0.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONXModuleV2d0.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONXModuleV2d0.java
new file mode 100644
index 0000000..5e7a9aa
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONXModuleV2d0.java
@@ -0,0 +1,140 @@
+/*
+ * 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.structure.io.graphson;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.LocalTime;
+import java.time.MonthDay;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.Period;
+import java.time.Year;
+import java.time.YearMonth;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Version 2.0 of GraphSON extensions.
+ */
+public final class GraphSONXModuleV2d0 extends GraphSONModule {
+
+    private static final Map<Class, String> TYPE_DEFINITIONS = Collections.unmodifiableMap(
+            new LinkedHashMap<Class, String>() {{
+                put(ByteBuffer.class, "ByteBuffer");
+                put(Short.class, "Int16");
+                put(BigInteger.class, "BigInteger");
+                put(BigDecimal.class, "BigDecimal");
+                put(Byte.class, "Byte");
+                put(Character.class, "Char");
+
+                // Time serializers/deserializers
+                put(Duration.class, "Duration");
+                put(Instant.class, "Instant");
+                put(LocalDate.class, "LocalDate");
+                put(LocalDateTime.class, "LocalDateTime");
+                put(LocalTime.class, "LocalTime");
+                put(MonthDay.class, "MonthDay");
+                put(OffsetDateTime.class, "OffsetDateTime");
+                put(OffsetTime.class, "OffsetTime");
+                put(Period.class, "Period");
+                put(Year.class, "Year");
+                put(YearMonth.class, "YearMonth");
+                put(ZonedDateTime.class, "ZonedDateTime");
+                put(ZoneOffset.class, "ZoneOffset");
+            }});
+
+    /**
+     * Constructs a new object.
+     */
+    protected GraphSONXModuleV2d0(final boolean normalize) {
+        super("graphsonx-2.0");
+
+        /////////////////////// SERIALIZERS ////////////////////////////
+
+        // java.time
+        addSerializer(Duration.class, new JavaTimeSerializersV2d0.DurationJacksonSerializer());
+        addSerializer(Instant.class, new JavaTimeSerializersV2d0.InstantJacksonSerializer());
+        addSerializer(LocalDate.class, new JavaTimeSerializersV2d0.LocalDateJacksonSerializer());
+        addSerializer(LocalDateTime.class, new JavaTimeSerializersV2d0.LocalDateTimeJacksonSerializer());
+        addSerializer(LocalTime.class, new JavaTimeSerializersV2d0.LocalTimeJacksonSerializer());
+        addSerializer(MonthDay.class, new JavaTimeSerializersV2d0.MonthDayJacksonSerializer());
+        addSerializer(OffsetDateTime.class, new JavaTimeSerializersV2d0.OffsetDateTimeJacksonSerializer());
+        addSerializer(OffsetTime.class, new JavaTimeSerializersV2d0.OffsetTimeJacksonSerializer());
+        addSerializer(Period.class, new JavaTimeSerializersV2d0.PeriodJacksonSerializer());
+        addSerializer(Year.class, new JavaTimeSerializersV2d0.YearJacksonSerializer());
+        addSerializer(YearMonth.class, new JavaTimeSerializersV2d0.YearMonthJacksonSerializer());
+        addSerializer(ZonedDateTime.class, new JavaTimeSerializersV2d0.ZonedDateTimeJacksonSerializer());
+        addSerializer(ZoneOffset.class, new JavaTimeSerializersV2d0.ZoneOffsetJacksonSerializer());
+
+        /////////////////////// DESERIALIZERS ////////////////////////////
+
+        // java.time
+        addDeserializer(Duration.class, new JavaTimeSerializersV2d0.DurationJacksonDeserializer());
+        addDeserializer(Instant.class, new JavaTimeSerializersV2d0.InstantJacksonDeserializer());
+        addDeserializer(LocalDate.class, new JavaTimeSerializersV2d0.LocalDateJacksonDeserializer());
+        addDeserializer(LocalDateTime.class, new JavaTimeSerializersV2d0.LocalDateTimeJacksonDeserializer());
+        addDeserializer(LocalTime.class, new JavaTimeSerializersV2d0.LocalTimeJacksonDeserializer());
+        addDeserializer(MonthDay.class, new JavaTimeSerializersV2d0.MonthDayJacksonDeserializer());
+        addDeserializer(OffsetDateTime.class, new JavaTimeSerializersV2d0.OffsetDateTimeJacksonDeserializer());
+        addDeserializer(OffsetTime.class, new JavaTimeSerializersV2d0.OffsetTimeJacksonDeserializer());
+        addDeserializer(Period.class, new JavaTimeSerializersV2d0.PeriodJacksonDeserializer());
+        addDeserializer(Year.class, new JavaTimeSerializersV2d0.YearJacksonDeserializer());
+        addDeserializer(YearMonth.class, new JavaTimeSerializersV2d0.YearMonthJacksonDeserializer());
+        addDeserializer(ZonedDateTime.class, new JavaTimeSerializersV2d0.ZonedDateTimeJacksonDeserializer());
+        addDeserializer(ZoneOffset.class, new JavaTimeSerializersV2d0.ZoneOffsetJacksonDeserializer());
+    }
+
+    public static Builder build() {
+        return new Builder();
+    }
+
+    @Override
+    public Map<Class, String> getTypeDefinitions() {
+        return TYPE_DEFINITIONS;
+    }
+
+    @Override
+    public String getTypeNamespace() {
+        return GraphSONTokens.GREMLINX_TYPE_NAMESPACE;
+    }
+
+    public static final class Builder implements GraphSONModuleBuilder {
+
+        private Builder() {
+        }
+
+        @Override
+        public GraphSONModule create(final boolean normalize) {
+            return new GraphSONXModuleV2d0(normalize);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/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 716a803..94ccb70 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
@@ -50,7 +50,9 @@ public class GraphSONMapperEmbeddedTypeTest extends AbstractGraphSONTest {
     public static Iterable<Object[]> data() {
         return Arrays.asList(new Object[][]{
                 {GraphSONMapper.build().version(GraphSONVersion.V1_0).embedTypes(true).create().createMapper()},
-                {GraphSONMapper.build().version(GraphSONVersion.V2_0).typeInfo(TypeInfo.PARTIAL_TYPES).create().createMapper()},
+                {GraphSONMapper.build().version(GraphSONVersion.V2_0)
+                        .addCustomModule(GraphSONXModuleV2d0.build().create(false))
+                        .typeInfo(TypeInfo.PARTIAL_TYPES).create().createMapper()},
         });
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java
index fa31239..217cc6f 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperTest.java
@@ -52,7 +52,7 @@ public class GraphSONMapperTest {
     public static Iterable<Object[]> data() {
         return Arrays.asList(new Object[][]{
                 {GraphSONMapper.build().version(GraphSONVersion.V1_0).embedTypes(false).create().createMapper()},
-                {GraphSONMapper.build().version(GraphSONVersion.V2_0).typeInfo(TypeInfo.NO_TYPES).create().createMapper()},
+                {GraphSONMapper.build().version(GraphSONVersion.V2_0).addCustomModule(GraphSONXModuleV2d0.build().create(false)).typeInfo(TypeInfo.NO_TYPES).create().createMapper()},
         });
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperV2d0PartialEmbeddedTypeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperV2d0PartialEmbeddedTypeTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperV2d0PartialEmbeddedTypeTest.java
index 0136199..7144ef4 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperV2d0PartialEmbeddedTypeTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONMapperV2d0PartialEmbeddedTypeTest.java
@@ -50,6 +50,7 @@ public class GraphSONMapperV2d0PartialEmbeddedTypeTest extends AbstractGraphSONT
 
     private final ObjectMapper mapper = GraphSONMapper.build()
             .version(GraphSONVersion.V2_0)
+            .addCustomModule(GraphSONXModuleV2d0.build().create(false))
             .typeInfo(TypeInfo.PARTIAL_TYPES)
             .create()
             .createMapper();
@@ -131,7 +132,7 @@ public class GraphSONMapperV2d0PartialEmbeddedTypeTest extends AbstractGraphSONT
             mapper.readValue(inputStream, Instant.class);
             fail("Should have failed decoding the value");
         } catch (Exception e) {
-            assertThat(e.getMessage(), containsString("Could not deserialize the JSON value as required. Nested exception: java.lang.InstantiationException: Cannot deserialize the value with the detected type contained in the JSON ('" + GraphSONTokens.GREMLIN_TYPE_NAMESPACE + ":ZoneOffset') to the type specified in parameter to the object mapper (class java.time.Instant). Those types are incompatible."));
+            assertThat(e.getMessage(), containsString("Could not deserialize the JSON value as required. Nested exception: java.lang.InstantiationException: Cannot deserialize the value with the detected type contained in the JSON ('" + GraphSONTokens.GREMLINX_TYPE_NAMESPACE + ":ZoneOffset') to the type specified in parameter to the object mapper (class java.time.Instant). Those types are incompatible."));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGraphSONSerializerV2d0Test.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGraphSONSerializerV2d0Test.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGraphSONSerializerV2d0Test.java
index 9005233..d668d9a 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGraphSONSerializerV2d0Test.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphGraphSONSerializerV2d0Test.java
@@ -37,6 +37,7 @@ import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONXModuleV2d0;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.TypeInfo;
 import org.junit.Test;
 
@@ -62,11 +63,13 @@ public class TinkerGraphGraphSONSerializerV2d0Test {
     // As of TinkerPop 3.2.1 default for GraphSON 2.0 means types enabled.
     private final Mapper defaultMapperV2d0 = GraphSONMapper.build()
             .version(GraphSONVersion.V2_0)
+            .addCustomModule(GraphSONXModuleV2d0.build().create(false))
             .addRegistry(TinkerIoRegistryV2d0.getInstance())
             .create();
 
     private final Mapper noTypesMapperV2d0 = GraphSONMapper.build()
             .version(GraphSONVersion.V2_0)
+            .addCustomModule(GraphSONXModuleV2d0.build().create(false))
             .typeInfo(TypeInfo.NO_TYPES)
             .addRegistry(TinkerIoRegistryV2d0.getInstance())
             .create();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java
index d113475..57d2560 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/GraphSONTranslator.java
@@ -29,6 +29,7 @@ import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONMapper;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONReader;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONVersion;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONWriter;
+import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONXModuleV2d0;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -39,8 +40,10 @@ import java.io.ByteArrayOutputStream;
 final class GraphSONTranslator<S extends TraversalSource, T extends Traversal.Admin<?, ?>> implements Translator.StepTranslator<S, T> {
 
     private final JavaTranslator<S, T> wrappedTranslator;
-    private final GraphSONWriter writer = GraphSONWriter.build().mapper(GraphSONMapper.build().version(GraphSONVersion.V2_0).create()).create();
-    private final GraphSONReader reader = GraphSONReader.build().mapper(GraphSONMapper.build().version(GraphSONVersion.V2_0).create()).create();
+    private final GraphSONMapper mapper = GraphSONMapper.build()
+            .addCustomModule(GraphSONXModuleV2d0.build().create(false)).version(GraphSONVersion.V2_0).create();
+    private final GraphSONWriter writer = GraphSONWriter.build().mapper(mapper).create();
+    private final GraphSONReader reader = GraphSONReader.build().mapper(mapper).create();
 
     public GraphSONTranslator(final JavaTranslator<S, T> wrappedTranslator) {
         this.wrappedTranslator = wrappedTranslator;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5c9cbf65/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
index 3967d96..f5a229d 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/io/graphson/TinkerGraphGraphSONTranslatorProvider.java
@@ -54,6 +54,7 @@ public class TinkerGraphGraphSONTranslatorProvider extends TinkerGraphProvider {
             "g_V_hasLabelXpersonX_asXpX_VXsoftwareX_addInEXuses_pX",
             "g_VXv1X_hasXage_gt_30X",
             //
+
             PageRankTest.Traversals.class.getCanonicalName(),
             ProgramTest.Traversals.class.getCanonicalName(),
             TraversalInterruptionTest.class.getCanonicalName(),