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 2015/04/13 19:22:22 UTC

[01/43] incubator-tinkerpop git commit: Change the serialization model for custom identifiers given TINKERPOP3-581

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master c906ee255 -> 9716d379d


Change the serialization model for custom identifiers given TINKERPOP3-581

Using a Map to represent an custom element in GraphSON doesn't work so well for non-JVM languages and doesn't enable the default serialization pattern for GraphSON to be set with embedTypes as false.  This commit sets up for greater support for non-JVM language bindings which must conform to the JSON type system.


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

Branch: refs/heads/master
Commit: 339f6ce855245f7677ac099d80d027d61929b74d
Parents: 22f1752
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 8 08:36:27 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 8 08:36:27 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/IoTest.java     | 62 +++++++-------------
 1 file changed, 20 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/339f6ce8/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index 4af8db5..c3041f7 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -20,13 +20,10 @@ package org.apache.tinkerpop.gremlin.structure;
 
 import com.fasterxml.jackson.core.JsonGenerationException;
 import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonParser;
 import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
 import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
 import com.fasterxml.jackson.databind.module.SimpleModule;
 import com.fasterxml.jackson.databind.ser.std.StdSerializer;
@@ -81,7 +78,6 @@ import java.io.StringWriter;
 import java.io.Writer;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Optional;
 import java.util.UUID;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -273,13 +269,12 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_ANY_IDS)
-    public void shouldProperlySerializeDeserializeCustomIdWithGraphSON() throws Exception {
+    public void shouldProperlySerializeCustomIdWithGraphSON() throws Exception {
         final UUID id = UUID.fromString("AF4B5965-B176-4552-B3C1-FBBE2F52C305");
         graph.addVertex(T.id, new CustomId("vertex", id));
 
         final SimpleModule module = new SimpleModule();
         module.addSerializer(CustomId.class, new CustomId.CustomIdJacksonSerializer());
-        module.addDeserializer(CustomId.class, new CustomId.CustomIdJacksonDeserializer());
         final GraphWriter writer = graph.io().graphSONWriter().mapper(
                 graph.io().graphSONMapper().addCustomModule(module).embedTypes(true).create()).create();
 
@@ -2559,6 +2554,11 @@ public class IoTest extends AbstractGremlinTest {
             return elementId;
         }
 
+        @Override
+        public String toString() {
+            return cluster + ":" + elementId;
+        }
+
         static class CustomIdJacksonSerializer extends StdSerializer<CustomId> {
             public CustomIdJacksonSerializer() {
                 super(CustomId.class);
@@ -2577,44 +2577,22 @@ public class IoTest extends AbstractGremlinTest {
             }
 
             private void ser(final CustomId customId, final JsonGenerator jsonGenerator, final boolean includeType) throws IOException {
-                jsonGenerator.writeStartObject();
-
-                if (includeType)
+                if (includeType) {
+                    // when the type is included add "class" as a key and then try to utilize as much of the
+                    // default serialization provided by jackson data-bind as possible.  for example, write
+                    // the uuid as an object so that when jackson serializes it, it uses the uuid serializer
+                    // to write it out with the type.  in this way, data-bind should be able to deserialize
+                    // it back when types are embedded.
+                    jsonGenerator.writeStartObject();
                     jsonGenerator.writeStringField(GraphSONTokens.CLASS, CustomId.class.getName());
-
-                jsonGenerator.writeObjectField("cluster", customId.getCluster());
-                jsonGenerator.writeObjectField("elementId", customId.getElementId().toString());
-                jsonGenerator.writeEndObject();
-            }
-        }
-
-        static class CustomIdJacksonDeserializer extends StdDeserializer<CustomId> {
-            public CustomIdJacksonDeserializer() {
-                super(CustomId.class);
-            }
-
-            @Override
-            public CustomId deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-                String cluster = null;
-                UUID id = null;
-
-                while (!jsonParser.getCurrentToken().isStructEnd()) {
-                    if (jsonParser.getText().equals("cluster")) {
-                        jsonParser.nextToken();
-                        cluster = jsonParser.getText();
-                    } else if (jsonParser.getText().equals("elementId")) {
-                        jsonParser.nextToken();
-                        id = UUID.fromString(jsonParser.getText());
-                    } else
-                        jsonParser.nextToken();
+                    jsonGenerator.writeStringField("cluster", customId.getCluster());
+                    jsonGenerator.writeObjectField("elementId", customId.getElementId());
+                    jsonGenerator.writeEndObject();
+                } else {
+                    // when types are not embedded, stringify or resort to JSON primitive representations of the
+                    // type so that non-jvm languages can better interoperate with the TinkerPop stack.
+                    jsonGenerator.writeString(customId.toString());
                 }
-
-                if (!Optional.ofNullable(cluster).isPresent())
-                    throw deserializationContext.mappingException("Could not deserialze CustomId: 'cluster' is required");
-                if (!Optional.ofNullable(id).isPresent())
-                    throw deserializationContext.mappingException("Could not deserialze CustomId: 'id' is required");
-
-                return new CustomId(cluster, id);
             }
         }
     }


[03/43] incubator-tinkerpop git commit: Correct test names.

Posted by sp...@apache.org.
Correct test names.


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

Branch: refs/heads/master
Commit: 9886d7749dd161406ad45fe61461cf35b4b00687
Parents: 021fa74
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 8 09:27:05 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 8 09:27:05 2015 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/structure/FeatureSupportTest.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9886d774/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
index 706c363..f4969ba 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
@@ -707,7 +707,7 @@ public class FeatureSupportTest {
         @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_UUID_IDS, supported = false)
-        public void shouldSupportStringIdsIfUuidIdsAreGeneratedFromTheGraph() throws Exception {
+        public void shouldSupportUuidIdsIfUuidIdsAreGeneratedFromTheGraph() throws Exception {
             final Vertex v = graph.addVertex();
             final VertexProperty p = v.property("name", "stephen");
             if (p.id() instanceof UUID)
@@ -718,7 +718,7 @@ public class FeatureSupportTest {
         @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false)
-        public void shouldSupportStringIdsIfNumericIdsAreGeneratedFromTheGraph() throws Exception {
+        public void shouldSupportNumericIdsIfNumericIdsAreGeneratedFromTheGraph() throws Exception {
             final Vertex v = graph.addVertex();
             final VertexProperty p = v.property("name", "stephen");
             if (p.id() instanceof Number)


[35/43] incubator-tinkerpop git commit: Add tests to enforce support of usersupplied ids if supportsAnyId is true.

Posted by sp...@apache.org.
Add tests to enforce support of usersupplied ids if supportsAnyId is true.


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

Branch: refs/heads/master
Commit: aa3d5387e5ba20f9a7065217ffaa0fba0d6a0914
Parents: ce1aeae
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 13:09:23 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 13:09:23 2015 -0400

----------------------------------------------------------------------
 .../gremlin/structure/FeatureSupportTest.java     | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/aa3d5387/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
index 5d84c56..a3ddad7 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
@@ -826,6 +826,24 @@ public class FeatureSupportTest {
         }
 
         @Test
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = VertexFeatures.FEATURE_ANY_IDS)
+        public void shouldNotSupportAnyIdsUnlessUserSuppliedIdsIsSupportedOnVertex() {
+            assertTrue(vertexFeatures.supportsUserSuppliedIds());
+        }
+
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = EdgeFeatures.FEATURE_ANY_IDS)
+        public void shouldNotSupportAnyIdsUnlessUserSuppliedIdsIsSupportedOnEdge() {
+            assertTrue(edgeFeatures.supportsUserSuppliedIds());
+        }
+
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.VertexPropertyFeatures.class, feature = VertexPropertyFeatures.FEATURE_ANY_IDS)
+        public void shouldNotSupportAnyIdsUnlessUserSuppliedIdsIsSupportedOnVertexProperty() {
+            assertTrue(vertexPropertyFeatures.supportsUserSuppliedIds());
+        }
+
+        @Test
         public void shouldSupportADataTypeIfGraphHasVariablesEnabled() {
             assertEquals(variablesFeatures.supportsVariables(), (variablesFeatures.supportsBooleanValues() || variablesFeatures.supportsDoubleValues()
                     || variablesFeatures.supportsFloatValues() || variablesFeatures.supportsIntegerValues()


[22/43] incubator-tinkerpop git commit: Check for specific type in IdManagers and return without additional conversion.

Posted by sp...@apache.org.
Check for specific type in IdManagers and return without additional conversion.

Seems to save a tick or two on the processing as performance tests seem to run more inline as a result.


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

Branch: refs/heads/master
Commit: fe106adcc69a708f8c99be9ce97f5617a84217fc
Parents: c3c1c01
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 08:50:47 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 08:50:47 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/fe106adc/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 1d26304..339d677 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -488,7 +488,9 @@ public class TinkerGraph implements Graph {
 
             @Override
             public Object convert(final Object id) {
-                if (id instanceof Number)
+                if (id instanceof Long)
+                    return id;
+                else if (id instanceof Number)
                     return ((Number) id).longValue();
                 else if (id instanceof String)
                     return Long.parseLong((String) id);
@@ -509,7 +511,9 @@ public class TinkerGraph implements Graph {
 
             @Override
             public Object convert(final Object id) {
-                if (id instanceof Number)
+                if (id instanceof Integer)
+                    return id;
+                else if (id instanceof Number)
                     return ((Number) id).intValue();
                 else if (id instanceof String)
                     return Integer.parseInt((String) id);


[36/43] incubator-tinkerpop git commit: Forgot to remove todo from previous commit.

Posted by sp...@apache.org.
Forgot to remove todo from previous commit.


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

Branch: refs/heads/master
Commit: a4c62be7a51c6aee138f23514ce9c144fd87ba79
Parents: aa3d538
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 13:10:22 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 13:10:22 2015 -0400

----------------------------------------------------------------------
 .../src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/a4c62be7/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 7afdd5f..72ffc85 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -732,7 +732,6 @@ public interface Graph extends AutoCloseable {
                 return true;
             }
 
-            // todo: need a test to enforce this condition
             /**
              * Determines if an {@link Element} any Java object is a suitable identifier.  Note that this
              * setting can only return true if {@link #supportsUserSuppliedIds()} is true.


[25/43] incubator-tinkerpop git commit: Removed todo as g.V(traverser) wasn't ever really supported.

Posted by sp...@apache.org.
Removed todo as g.V(traverser) wasn't ever really supported.

The test was simply not showing the error until i added id validation to tinkergraph.


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

Branch: refs/heads/master
Commit: fb7ee1af87b8278d0b6d52568dd0951560a103a6
Parents: 78d2710
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 09:35:01 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 09:35:01 2015 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java  | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/fb7ee1af/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
index 0606409..aed4b23 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
@@ -101,7 +101,6 @@ public class TraversalPerformanceTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
     @Test
     public void g_V_out_mapXout_out_valuesXnameX_toListX() throws Exception {
-        // todo: this used to be g.V().out().map(v -> g.V(v).out().out().values("name").toList()).iterate(); - should g.V() accept Traverser??
         g.V().out().map(v -> g.V(v.get()).out().out().values("name").toList()).iterate();
     }
 


[29/43] incubator-tinkerpop git commit: Removed todos - tracked by TINKERPOP3-624

Posted by sp...@apache.org.
Removed todos - tracked by TINKERPOP3-624


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

Branch: refs/heads/master
Commit: 7ee771f7548004b8cd7ac8e8c1661537b499b36c
Parents: 34f826c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 11:38:07 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 11:38:07 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java       | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/7ee771f7/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 4cb310e..dda6ad2 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -239,13 +239,11 @@ public class TinkerGraph implements Graph {
 
     @Override
     public Iterator<Vertex> vertices(final Object... vertexIds) {
-        // todo: what if we have Reference/DetachedVertex???????????????????????????
         return createElementIterator(Vertex.class, vertices, vertexIdManager, vertexIds);
     }
 
     @Override
     public Iterator<Edge> edges(final Object... edgeIds) {
-        // todo: what if we have Reference/DetachedVertex???????????????????????????
         return createElementIterator(Edge.class, edges, edgeIdManager, edgeIds);
     }
 


[12/43] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into TINKERPOP3-581

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into TINKERPOP3-581


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

Branch: refs/heads/master
Commit: 9a877b7aa75f59802ed0b41e101e3ce42d2eeb95
Parents: afb9b12 e09e229
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 14:55:48 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 14:55:48 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   6 +-
 .../gremlin/process/computer/GraphComputer.java |   4 +
 .../gremlin/process/computer/Memory.java        |   3 +
 .../traversal/step/map/ComputerResultStep.java  |   2 +-
 .../gremlin/process/traversal/Traverser.java    |   2 +-
 .../traverser/util/AbstractTraverser.java       |  18 +-
 .../traversal/traverser/util/TraverserSet.java  |   4 +-
 .../tinkerpop/gremlin/structure/Edge.java       |   3 +
 .../tinkerpop/gremlin/structure/Element.java    |   3 +
 .../tinkerpop/gremlin/structure/Graph.java      |   7 +-
 .../tinkerpop/gremlin/structure/Property.java   |   3 +
 .../gremlin/structure/Transaction.java          |   4 +
 .../tinkerpop/gremlin/structure/Vertex.java     |   4 +
 .../gremlin/structure/VertexProperty.java       |   4 +
 .../structure/io/gryo/GremlinClassResolver.java | 206 ------------------
 .../structure/io/gryo/GryoClassResolver.java    | 211 +++++++++++++++++++
 .../gremlin/structure/io/gryo/GryoMapper.java   |  15 +-
 .../gremlin/structure/util/Attachable.java      |  76 +++++++
 .../structure/util/detached/Attachable.java     |  33 ---
 .../structure/util/detached/DetachedEdge.java   |  10 +-
 .../util/detached/DetachedElement.java          |  11 +-
 .../util/detached/DetachedFactory.java          |   4 +
 .../structure/util/detached/DetachedPath.java   |   5 +-
 .../util/detached/DetachedProperty.java         |  14 +-
 .../structure/util/detached/DetachedVertex.java |  31 ++-
 .../util/detached/DetachedVertexProperty.java   |   6 +-
 .../structure/util/reference/ReferenceEdge.java |  89 ++++++++
 .../util/reference/ReferenceElement.java        |  74 +++++++
 .../util/reference/ReferenceFactory.java        |  81 +++++++
 .../structure/util/reference/ReferencePath.java |  75 +++++++
 .../util/reference/ReferenceProperty.java       | 111 ++++++++++
 .../util/reference/ReferenceVertex.java         | 101 +++++++++
 .../util/reference/ReferenceVertexProperty.java | 101 +++++++++
 .../gremlin/structure/util/star/StarGraph.java  |  33 ++-
 .../gremlin/util/iterator/IteratorUtils.java    |   6 +
 .../apache/tinkerpop/gremlin/GraphProvider.java |   3 +-
 .../structure/StructureStandardSuite.java       |   4 +
 .../util/detached/DetachedEdgeTest.java         |   4 +-
 .../util/detached/DetachedPropertyTest.java     |   2 +-
 .../detached/DetachedVertexPropertyTest.java    |   2 +-
 .../util/detached/DetachedVertexTest.java       |   9 +-
 .../util/reference/ReferenceVertexTest.java     | 159 ++++++++++++++
 .../structure/util/star/StarGraphTest.java      | 126 +++++++++++
 43 files changed, 1352 insertions(+), 317 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9a877b7a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9a877b7a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
----------------------------------------------------------------------


[31/43] incubator-tinkerpop git commit: Alter IoTest to not treat identifiers for GraphSON serialization as lossy.

Posted by sp...@apache.org.
Alter IoTest to not treat identifiers for GraphSON serialization as lossy.


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

Branch: refs/heads/master
Commit: f4c4b93719ce11460b5d19b51db06d671ea093c7
Parents: bcc55bf
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 12:53:36 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 12:53:36 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/IoTest.java     | 90 +++++++++++---------
 .../tinkergraph/TinkerGraphProvider.java        | 19 +++++
 2 files changed, 68 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f4c4b937/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index d73cd75..94993ec 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -76,7 +76,6 @@ import java.io.OutputStream;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.io.Writer;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.UUID;
@@ -741,9 +740,9 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
-                    assertEquals(e.id().toString(), detachedEdge.id().toString()); // lossy
-                    assertEquals(v1.id().toString(), detachedEdge.outVertex().id().toString()); // lossy
-                    assertEquals(v2.id().toString(), detachedEdge.inVertex().id().toString());  // lossy
+                    assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
+                    assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id().toString()).next().id());
+                    assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id().toString()).next().id());
                     assertEquals(v1.label(), detachedEdge.outVertex().label());
                     assertEquals(v2.label(), detachedEdge.inVertex().label());
                     assertEquals(e.label(), detachedEdge.label());
@@ -776,9 +775,9 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
-                    assertEquals(e.id().toString(), detachedEdge.id().toString()); // lossy
-                    assertEquals(v1.id().toString(), detachedEdge.outVertex().id().toString()); // lossy
-                    assertEquals(v2.id().toString(), detachedEdge.inVertex().id().toString());  // lossy
+                    assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
+                    assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id().toString()).next().id());
+                    assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id().toString()).next().id());
                     assertEquals(v1.label(), detachedEdge.outVertex().label());
                     assertEquals(v2.label(), detachedEdge.inVertex().label());
                     assertEquals(e.label(), detachedEdge.label());
@@ -810,9 +809,9 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
-                    assertEquals(e.id().toString(), detachedEdge.id().toString()); // lossy
-                    assertEquals(v1.id().toString(), detachedEdge.outVertex().id().toString()); // lossy
-                    assertEquals(v2.id().toString(), detachedEdge.inVertex().id().toString());  // lossy
+                    assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
+                    assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id().toString()).next().id());
+                    assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id().toString()).next().id());
                     assertEquals(v1.label(), detachedEdge.outVertex().label());
                     assertEquals(v2.label(), detachedEdge.inVertex().label());
                     assertEquals(e.label(), detachedEdge.label());
@@ -882,6 +881,9 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
+                    // a quick reminder here that the purpose of these id assertions is to ensure that those with
+                    // complex ids that are not simply toString'd (i.e. are complex objects in JSON as well)
+                    // properly respond to filtering in Graph.edges/vertices
                     assertEquals(e.id(), graph.edges(detachedEdge.id()).next().id());
                     assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id()).next().id());
                     assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id()).next().id());
@@ -1119,7 +1121,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
-                    assertEquals(v1.id().toString(), detachedVertex.id().toString()); // lossy
+                    assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
                     assertEquals(v1.label(), detachedVertex.label());
                     assertEquals(2, IteratorUtils.count(detachedVertex.properties()));
                     assertEquals("marko", detachedVertex.properties("name").next().value());
@@ -1153,7 +1155,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
-                    assertEquals(v1.id().toString(), detachedVertex.id().toString()); // lossy
+                    assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
                     assertEquals(v1.label(), detachedVertex.label());
                     assertEquals(2, IteratorUtils.count(detachedVertex.properties()));
                     assertEquals("marko", detachedVertex.properties("name").next().value());
@@ -1187,7 +1189,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
-                    assertEquals(v1.id().toString(), detachedVertex.id().toString()); // lossy
+                    assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
                     assertEquals(v1.label(), detachedVertex.label());
                     assertEquals(0, IteratorUtils.count(detachedVertex.properties()));
 
@@ -1221,7 +1223,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, detachedVertex -> {
-                    assertEquals(v1.id().toString(), detachedVertex.id().toString()); // lossy
+                    assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
                     assertEquals(v1.label(), detachedVertex.label());
                     assertEquals(4, IteratorUtils.count(detachedVertex.properties()));
                     assertEquals("a", detachedVertex.property("propsSquared").value("x"));
@@ -1389,7 +1391,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
-                            assertEquals(v1.id().toString(), detachedVertex.id().toString());  // lossy
+                            assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
                             assertEquals(v1.label(), detachedVertex.label());
                             assertEquals(1, IteratorUtils.count(detachedVertex.properties()));
                             assertEquals("marko", detachedVertex.value("name"));
@@ -1397,9 +1399,9 @@ public class IoTest extends AbstractGremlinTest {
                             return null;
                         },
                         detachedEdge -> {
-                            assertEquals(e.id().toString(), detachedEdge.id().toString());  // lossy
-                            assertEquals(v1.id().toString(), detachedEdge.outVertex().id().toString());  // lossy
-                            assertEquals(v2.id().toString(), detachedEdge.inVertex().id().toString());   // lossy
+                            assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
+                            assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id().toString()).next().id());
+                            assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id().toString()).next().id());
                             assertEquals(v1.label(), detachedEdge.outVertex().label());
                             assertEquals(v2.label(), detachedEdge.inVertex().label());
                             assertEquals(e.label(), detachedEdge.label());
@@ -1486,7 +1488,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
-                            assertEquals(v1.id().toString(), detachedVertex.id().toString());  // lossy
+                            assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
                             assertEquals(v1.label(), detachedVertex.label());
                             assertEquals(1, IteratorUtils.count(detachedVertex.properties()));
                             assertEquals("marko", detachedVertex.value("name"));
@@ -1494,9 +1496,9 @@ public class IoTest extends AbstractGremlinTest {
                             return null;
                         },
                         detachedEdge -> {
-                            assertEquals(e.id().toString(), detachedEdge.id().toString());  // lossy
-                            assertEquals(v1.id().toString(), detachedEdge.inVertex().id().toString());  // lossy
-                            assertEquals(v2.id().toString(), detachedEdge.outVertex().id().toString());   // lossy
+                            assertEquals(e.id(), graph.edges(detachedEdge.id().toString()).next().id());
+                            assertEquals(v1.id(), graph.vertices(detachedEdge.inVertex().id().toString()).next().id());
+                            assertEquals(v2.id(), graph.vertices(detachedEdge.outVertex().id().toString()).next().id());
                             assertEquals(v1.label(), detachedEdge.outVertex().label());
                             assertEquals(v2.label(), detachedEdge.inVertex().label());
                             assertEquals(e.label(), detachedEdge.label());
@@ -1600,7 +1602,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
-                            assertEquals(v1.id().toString(), detachedVertex.id().toString());  // lossy
+                            assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
                             assertEquals(v1.label(), detachedVertex.label());
                             assertEquals(1, IteratorUtils.count(detachedVertex.properties()));
                             assertEquals("marko", detachedVertex.value("name"));
@@ -1608,20 +1610,20 @@ public class IoTest extends AbstractGremlinTest {
                             return null;
                         },
                         detachedEdge -> {
-                            if (detachedEdge.id().toString().equals(e1.id().toString())) {      // lossy
-                                assertEquals(e1.id().toString(), detachedEdge.id().toString());  // lossy
-                                assertEquals(v1.id().toString(), detachedEdge.inVertex().id().toString());  // lossy
-                                assertEquals(v2.id().toString(), detachedEdge.outVertex().id().toString());   // lossy
+                            if (graph.edges(detachedEdge.id().toString()).next().id().equals(e1.id())) {
+                                assertEquals(e1.id(), graph.edges(detachedEdge.id().toString()).next().id());
+                                assertEquals(v1.id(), graph.vertices(detachedEdge.inVertex().id().toString()).next().id());
+                                assertEquals(v2.id(), graph.vertices(detachedEdge.outVertex().id().toString()).next().id());
                                 assertEquals(v1.label(), detachedEdge.outVertex().label());
                                 assertEquals(v2.label(), detachedEdge.inVertex().label());
                                 assertEquals(e1.label(), detachedEdge.label());
                                 assertEquals(1, IteratorUtils.count(detachedEdge.properties()));
                                 assertEquals(0.5d, detachedEdge.value("weight"), 0.000001d);                      // lossy
                                 edge1Called.set(true);
-                            } else if (detachedEdge.id().toString().equals(e2.id().toString())) { // lossy
-                                assertEquals(e2.id().toString(), detachedEdge.id().toString());  // lossy
-                                assertEquals(v2.id().toString(), detachedEdge.inVertex().id().toString());  // lossy
-                                assertEquals(v1.id().toString(), detachedEdge.outVertex().id().toString());   // lossy
+                            } else if (graph.edges(detachedEdge.id().toString()).next().id().equals(e2.id())) {
+                                assertEquals(e2.id(), graph.edges(detachedEdge.id().toString()).next().id());
+                                assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id().toString()).next().id());
+                                assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id().toString()).next().id());
                                 assertEquals(v1.label(), detachedEdge.outVertex().label());
                                 assertEquals(v2.label(), detachedEdge.inVertex().label());
                                 assertEquals(e2.label(), detachedEdge.label());
@@ -1665,6 +1667,9 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
+                    // a quick reminder here that the purpose of these id assertions is to ensure that those with
+                    // complex ids that are not simply toString'd (i.e. are complex objects in JSON as well)
+                    // properly respond to filtering in Graph.edges/vertices
                     assertEquals(v1.id(), graph.vertices(detachedVertex.id()).next().id());
                     assertEquals(v1.label(), detachedVertex.label());
                     assertEquals(1, IteratorUtils.count(detachedVertex.properties()));
@@ -1672,6 +1677,9 @@ public class IoTest extends AbstractGremlinTest {
                     vertexCalled.set(true);
                     return null;
                 }, detachedEdge -> {
+                    // a quick reminder here that the purpose of these id assertions is to ensure that those with
+                    // complex ids that are not simply toString'd (i.e. are complex objects in JSON as well)
+                    // properly respond to filtering in Graph.edges/vertices
                     if (graph.edges(detachedEdge.id()).next().id().equals(e1.id())) {
                         assertEquals(v2.id(), graph.vertices(detachedEdge.outVertex().id()).next().id());
                         assertEquals(v1.id(), graph.vertices(detachedEdge.inVertex().id()).next().id());
@@ -1779,7 +1787,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.IN, detachedVertex -> {
-                    assertEquals(v1.id().toString(), detachedVertex.id().toString());  // lossy
+                    assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
                     assertEquals(v1.label(), detachedVertex.label());
                     assertEquals(1, IteratorUtils.count(detachedVertex.properties()));
                     assertEquals("marko", detachedVertex.value("name"));
@@ -1787,10 +1795,10 @@ public class IoTest extends AbstractGremlinTest {
 
                     return null;
                 }, detachedEdge -> {
-                    if (detachedEdge.id().toString().equals(e1.id().toString())) { // lossy
-                        assertEquals(e1.id().toString(), detachedEdge.id().toString());  // lossy
-                        assertEquals(v1.id().toString(), detachedEdge.inVertex().id().toString());  // lossy
-                        assertEquals(v2.id().toString(), detachedEdge.outVertex().id().toString());   // lossy
+                    if (graph.edges(detachedEdge.id().toString()).next().id().equals(e1.id())) {
+                        assertEquals(e1.id(), graph.edges(detachedEdge.id().toString()).next().id());
+                        assertEquals(v1.id(), graph.vertices(detachedEdge.inVertex().id().toString()).next().id());
+                        assertEquals(v2.id(), graph.vertices(detachedEdge.outVertex().id().toString()).next().id());
                         assertEquals(v1.label(), detachedEdge.outVertex().label());
                         assertEquals(v2.label(), detachedEdge.inVertex().label());
                         assertEquals(e1.label(), detachedEdge.label());
@@ -1886,17 +1894,17 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.OUT, detachedVertex -> {
-                    assertEquals(v1.id().toString(), detachedVertex.id().toString());  // lossy
+                    assertEquals(v1.id(), graph.vertices(detachedVertex.id().toString()).next().id());
                     assertEquals(v1.label(), detachedVertex.label());
                     assertEquals(1, IteratorUtils.count(detachedVertex.properties()));
                     assertEquals("marko", detachedVertex.value("name"));
                     vertexCalled.set(true);
                     return null;
                 }, detachedEdge -> {
-                    if (detachedEdge.id().toString().equals(e2.id().toString())) {     // lossy
-                        assertEquals(e2.id().toString(), detachedEdge.id().toString());  // lossy
-                        assertEquals(v2.id().toString(), detachedEdge.inVertex().id().toString());  // lossy
-                        assertEquals(v1.id().toString(), detachedEdge.outVertex().id().toString());   // lossy
+                    if (graph.edges(detachedEdge.id().toString()).next().id().equals(e2.id())) {
+                        assertEquals(e2.id(), graph.edges(detachedEdge.id().toString()).next().id());
+                        assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id().toString()).next().id());
+                        assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id().toString()).next().id());
                         assertEquals(v1.label(), detachedEdge.outVertex().label());
                         assertEquals(v2.label(), detachedEdge.inVertex().label());
                         assertEquals(e2.label(), detachedEdge.label());

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f4c4b937/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
index 65db06a..056ab71 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.AbstractGraphProvider;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.GraphTest;
+import org.apache.tinkerpop.gremlin.structure.IoTest;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
@@ -110,6 +111,24 @@ public class TinkerGraphProvider extends AbstractGraphProvider {
                 return TinkerGraph.DefaultIdManager.LONG;
             else if (testsThatNeedUuidIdManager.contains(testMethodName))
                 return TinkerGraph.DefaultIdManager.UUID;
+        } else if (test.equals(IoTest.class)) {
+            final Set<String> testsThatNeedLongIdManager = new HashSet<String>(){{
+                add("shouldReadWriteEdgeToGraphSON");
+                add("shouldReadWriteDetachedEdgeAsReferenceToGraphSON");
+                add("shouldReadWriteDetachedEdgeToGraphSON");
+                add("shouldReadWriteVertexNoEdgesToGraphSON");
+                add("shouldReadWriteDetachedVertexNoEdgesToGraphSON");
+                add("shouldReadWriteDetachedVertexAsReferenceNoEdgesToGraphSON");
+                add("shouldReadWriteVertexMultiPropsNoEdgesToGraphSON");
+                add("shouldReadWriteVertexWithOUTOUTEdgesToGraphSON");
+                add("shouldReadWriteVertexWithININEdgesToGraphSON");
+                add("shouldReadWriteVertexWithBOTHBOTHEdgesToGraphSON");
+                add("shouldReadWriteVertexWithBOTHINEdgesToGraphSON");
+                add("shouldReadWriteVertexWithBOTHOUTEdgesToGraphSON");
+            }};
+
+            if (testsThatNeedLongIdManager.contains(testMethodName))
+                return TinkerGraph.DefaultIdManager.LONG;
         }
 
         return TinkerGraph.DefaultIdManager.ANY;


[30/43] incubator-tinkerpop git commit: Remove GraphProvider.reconstituteGraphSONIdentifier method TINKERPOP3-581

Posted by sp...@apache.org.
Remove GraphProvider.reconstituteGraphSONIdentifier method TINKERPOP3-581

This method is no longer relevant as we can assume that complex identifiers will either be toString() values that can be filtered by the Graph.vertices/edges or if not using toString and instead going for a more complex format (which is discourage for sake of non-jvm devs) must be supported by filters to Graph.vertices/edges


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

Branch: refs/heads/master
Commit: bcc55bf674f6fccbb8c8e053e18cb6cdae4dc3c2
Parents: 7ee771f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 12:09:36 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 12:09:36 2015 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/GraphProvider.java | 20 --------------------
 .../tinkerpop/gremlin/structure/IoTest.java     | 20 ++++++++++----------
 2 files changed, 10 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bcc55bf6/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
index f61ed0a..749026d 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
@@ -221,26 +221,6 @@ public interface GraphProvider {
     public void loadGraphData(final Graph graph, final LoadGraphWith loadGraphWith, final Class testClass, final String testName);
 
     /**
-     * Converts the GraphSON representation of an identifier to the implementation's representation of an identifier.
-     * When serializing a mapper identifier type to GraphSON an implementer will typically specify a mapper serializer
-     * in {@link org.apache.tinkerpop.gremlin.structure.Graph.Io}.  That will serialize the identifier to a GraphSON representation.
-     * When the GraphSON is deserialized, the identifier is written to an
-     * {@link Attachable} object where it is passed to a user supplied
-     * conversion {@link java.util.function.Function} that ultimately processes it.  It is in this conversion process
-     * that vendor specific identifier conversion would occur (if desired).  This method mimics that conversion by
-     * providing the mechanism that a test can use to do the conversion.
-     *
-     * @param clazz The {@link Element} class that represents the identifier.
-     * @param id    The identifier to convert.
-     * @param <ID>  The type of the identifier.
-     * @return The reconstituted identifier.
-     */
-    public default <ID> ID reconstituteGraphSONIdentifier(final Class<? extends Element> clazz, final Object id) {
-        // todo: do we still need this?
-        return (ID) id;
-    }
-
-    /**
      * Get the set of concrete implementations of certain classes and interfaces utilized by the test suite. This
      * method should return any implementations or extensions of the following interfaces or classes:
      * <ul>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bcc55bf6/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index 17170fc..d73cd75 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -882,9 +882,9 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readEdge(bais, detachedEdge -> {
-                    assertEquals(e.id(), graphProvider.reconstituteGraphSONIdentifier(Edge.class, detachedEdge.id()));
-                    assertEquals(v1.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.outVertex().id()));
-                    assertEquals(v2.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.inVertex().id()));
+                    assertEquals(e.id(), graph.edges(detachedEdge.id()).next().id());
+                    assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id()).next().id());
+                    assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id()).next().id());
                     assertEquals(v1.label(), detachedEdge.outVertex().label());
                     assertEquals(v2.label(), detachedEdge.inVertex().label());
                     assertEquals(e.label(), detachedEdge.label());
@@ -1665,25 +1665,25 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONReader reader = graph.io().graphSONReader().mapper(graph.io().graphSONMapper().embedTypes(true).create()).create();
             try (final ByteArrayInputStream bais = new ByteArrayInputStream(os.toByteArray())) {
                 reader.readVertex(bais, Direction.BOTH, detachedVertex -> {
-                    assertEquals(v1.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedVertex.id()));
+                    assertEquals(v1.id(), graph.vertices(detachedVertex.id()).next().id());
                     assertEquals(v1.label(), detachedVertex.label());
                     assertEquals(1, IteratorUtils.count(detachedVertex.properties()));
                     assertEquals(v1.value("name"), detachedVertex.value("name").toString());
                     vertexCalled.set(true);
                     return null;
                 }, detachedEdge -> {
-                    if (graphProvider.reconstituteGraphSONIdentifier(Edge.class, detachedEdge.id()).equals(e1.id())) {
-                        assertEquals(v2.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.outVertex().id()));
-                        assertEquals(v1.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.inVertex().id()));
+                    if (graph.edges(detachedEdge.id()).next().id().equals(e1.id())) {
+                        assertEquals(v2.id(), graph.vertices(detachedEdge.outVertex().id()).next().id());
+                        assertEquals(v1.id(), graph.vertices(detachedEdge.inVertex().id()).next().id());
                         assertEquals(v1.label(), detachedEdge.outVertex().label());
                         assertEquals(v2.label(), detachedEdge.inVertex().label());
                         assertEquals(e1.label(), detachedEdge.label());
                         assertEquals(1, IteratorUtils.count(detachedEdge.properties()));
                         assertEquals(0.5f, detachedEdge.value("weight"), 0.00001f);
                         edge1Called.set(true);
-                    } else if (graphProvider.reconstituteGraphSONIdentifier(Edge.class, detachedEdge.id()).equals(e2.id())) {
-                        assertEquals(v1.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.outVertex().id()));
-                        assertEquals(v2.id(), graphProvider.reconstituteGraphSONIdentifier(Vertex.class, detachedEdge.inVertex().id()));
+                    } else if (graph.edges(detachedEdge.id()).next().id().equals(e2.id())) {
+                        assertEquals(v1.id(), graph.vertices(detachedEdge.outVertex().id()).next().id());
+                        assertEquals(v2.id(), graph.vertices(detachedEdge.inVertex().id()).next().id());
                         assertEquals(v1.label(), detachedEdge.outVertex().label());
                         assertEquals(v2.label(), detachedEdge.inVertex().label());
                         assertEquals(e1.label(), detachedEdge.label());


[32/43] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into TINKERPOP3-581

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into TINKERPOP3-581


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

Branch: refs/heads/master
Commit: 59493d60aaa8de9eb4460279f7f95d747d3633cc
Parents: f4c4b93 24fd909
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 12:54:31 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 12:54:31 2015 -0400

----------------------------------------------------------------------
 .../process/computer/spark/SparkExecutor.java   |  4 +-
 .../computer/spark/SparkGraphComputer.java      | 16 +++---
 .../gremlin/hadoop/structure/io/IOClasses.java  | 52 ++++++++++++++++++++
 .../gremlin/hadoop/HadoopGraphProvider.java     |  1 +
 4 files changed, 65 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59493d60/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java
----------------------------------------------------------------------


[02/43] incubator-tinkerpop git commit: Removed feature check for numeric ids because convertId was being called.

Posted by sp...@apache.org.
Removed feature check for numeric ids because convertId was being called.

convertId ensures that a graph will convert the identifier to something the Graph can support so a check on the type is not relevant.


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

Branch: refs/heads/master
Commit: 021fa748e76588c0be6e5e0182d01ebf11856086
Parents: 339f6ce
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 8 08:46:07 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 8 08:46:07 2015 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/tinkerpop/gremlin/GraphProvider.java    | 4 +++-
 .../java/org/apache/tinkerpop/gremlin/structure/VertexTest.java  | 1 -
 2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/021fa748/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
index d6e5bb3..da355b9 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
@@ -154,7 +154,9 @@ public interface GraphProvider {
 
     /**
      * Converts an identifier from a test to an identifier accepted by the Graph instance.  Test that try to
-     * utilize an Element identifier will pass it to this method before usage.
+     * utilize an Element identifier will pass it to this method before usage.  This method should be sure to
+     * consistent in the return value such that calling it with "x" should always return the same transformed
+     * value.
      */
     default public Object convertId(final Object id) {
         return id;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/021fa748/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
index cafcbbd..7821601 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
@@ -150,7 +150,6 @@ public class VertexTest {
         @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
-        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
         public void shouldHaveExceptionConsistencyWhenAssigningSameIdOnEdge() {
             final Vertex v = graph.addVertex();
             final Object o = GraphManager.getGraphProvider().convertId("1");


[14/43] incubator-tinkerpop git commit: Default configs in TinkerFactory needed to be strings.

Posted by sp...@apache.org.
Default configs in TinkerFactory needed to be strings.


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

Branch: refs/heads/master
Commit: 869d32b946f3f1eda8c52ddc958f8360952810ca
Parents: a0fec7a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 15:33:03 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 15:33:03 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/869d32b9/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
index 21ad2a0..4deea4f 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
@@ -38,9 +38,9 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 public class TinkerFactory {
     public static TinkerGraph createClassic() {
         final Configuration conf = new BaseConfiguration();
-        conf.setProperty(TinkerGraph.CONFIG_VERTEX_ID, TinkerGraph.DefaultIdManager.INTEGER);
-        conf.setProperty(TinkerGraph.CONFIG_EDGE_ID, TinkerGraph.DefaultIdManager.INTEGER);
-        conf.setProperty(TinkerGraph.CONFIG_VERTEX_PROPERTY_ID, TinkerGraph.DefaultIdManager.INTEGER);
+        conf.setProperty(TinkerGraph.CONFIG_VERTEX_ID, TinkerGraph.DefaultIdManager.INTEGER.name());
+        conf.setProperty(TinkerGraph.CONFIG_EDGE_ID, TinkerGraph.DefaultIdManager.INTEGER.name());
+        conf.setProperty(TinkerGraph.CONFIG_VERTEX_PROPERTY_ID, TinkerGraph.DefaultIdManager.INTEGER.name());
 
         final TinkerGraph g = TinkerGraph.open(conf);
         generateClassic(g);


[09/43] incubator-tinkerpop git commit: Still trying to get all tests to run after enforcing id types in TinkerGraph.

Posted by sp...@apache.org.
Still trying to get all tests to run after enforcing id types in TinkerGraph.


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

Branch: refs/heads/master
Commit: 59028c8ad18f23609e31220a59717a2bc05b78af
Parents: 53a06b7
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 10:10:59 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 10:10:59 2015 -0400

----------------------------------------------------------------------
 .../traversal/step/sideEffect/GraphStep.java    |  18 +--
 .../apache/tinkerpop/gremlin/LoadGraphWith.java |   4 +-
 .../process/traversal/CoreTraversalTest.java    |   2 +-
 .../tinkerpop/gremlin/structure/EdgeTest.java   |   2 +-
 .../tinkerpop/gremlin/structure/VertexTest.java |  11 +-
 .../tinkergraph/structure/TinkerGraph.java      | 135 ++++++++++++-------
 .../tinkergraph/structure/TinkerHelper.java     |  43 +++++-
 .../tinkergraph/structure/TinkerVertex.java     |  15 ++-
 .../structure/TinkerVertexProperty.java         |  13 +-
 9 files changed, 158 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59028c8a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GraphStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GraphStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GraphStep.java
index bb78fbe..832100e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GraphStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/GraphStep.java
@@ -50,24 +50,10 @@ public class GraphStep<S extends Element> extends StartStep<S> implements Engine
         super(traversal);
         this.returnClass = returnClass;
         this.ids = ids;
-        //validate that all elements are either ids or elements. mixed is not supported.
-        boolean foundElements = false;
-        for (Object id : this.ids) {
-            boolean idIsElement = id instanceof Element;
-            if (foundElements && !idIsElement) {
-                throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
-            } else {
-                foundElements = foundElements || idIsElement;
-            }
-        }
-        if (foundElements) {
-            List<S> elementList = Arrays.asList(this.ids).stream().map(id->(S)id).collect(Collectors.toList());
-            this.iteratorSupplier = elementList::iterator;
-        } else {
-            this.iteratorSupplier = () -> (Iterator<S>) (Vertex.class.isAssignableFrom(this.returnClass) ?
+
+        this.iteratorSupplier = () -> (Iterator<S>) (Vertex.class.isAssignableFrom(this.returnClass) ?
                     this.getTraversal().getGraph().get().vertices(this.ids) :
                     this.getTraversal().getGraph().get().edges(this.ids));
-        }
     }
 
     public String toString() {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59028c8a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java
index b893891..20dac12 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/LoadGraphWith.java
@@ -93,7 +93,7 @@ public @interface LoadGraphWith {
             add(FeatureRequirement.Factory.create(FEATURE_MULTI_PROPERTIES, Graph.Features.VertexFeatures.class));
         }};
 
-        private static final List<FeatureRequirement> featuresRequiredByClassicDouble = new ArrayList<FeatureRequirement>() {{
+        private static final List<FeatureRequirement> featuresRequiredByModern = new ArrayList<FeatureRequirement>() {{
             add(FeatureRequirement.Factory.create(FEATURE_STRING_VALUES, VertexPropertyFeatures.class));
             add(FeatureRequirement.Factory.create(FEATURE_INTEGER_VALUES, VertexPropertyFeatures.class));
             add(FeatureRequirement.Factory.create(FEATURE_DOUBLE_VALUES, EdgePropertyFeatures.class));
@@ -126,7 +126,7 @@ public @interface LoadGraphWith {
                 case CREW:
                     return featuresRequiredByCrew;
                 case MODERN:
-                    return featuresRequiredByClassicDouble;
+                    return featuresRequiredByModern;
                 case GRATEFUL:
                     return featuresRequiredByGrateful;
             }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59028c8a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/CoreTraversalTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/CoreTraversalTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/CoreTraversalTest.java
index b208290..75216a1 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/CoreTraversalTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/CoreTraversalTest.java
@@ -81,7 +81,7 @@ public class CoreTraversalTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    public void shouldLoadEdgesViaVertices() {
+    public void shouldLoadEdgesViaEdges() {
         List<Edge> edges = g.E().toList();
         List<Edge> edgesReloaded = g.E(edges.toArray()).toList();
         assertEquals(edges.size(), edgesReloaded.size());

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59028c8a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java
index 35b427b..67eedf3 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/EdgeTest.java
@@ -120,7 +120,7 @@ public class EdgeTest {
         @Test(expected = NoSuchElementException.class)
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
         public void shouldThrowNoSuchElementExceptionIfEdgeWithIdNotPresent() {
-            g.E("this-id-should-not-be-in-the-modern-graph").next();
+            g.E(graphProvider.convertId(100)).next();
         }
 
         @Test

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59028c8a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
index 7821601..c281e27 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.FeatureRequirement;
 import org.apache.tinkerpop.gremlin.FeatureRequirementSet;
 import org.apache.tinkerpop.gremlin.GraphManager;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
+import org.apache.tinkerpop.gremlin.process.traversal.FastNoSuchElementException;
 import org.apache.tinkerpop.gremlin.process.traversal.T;
 import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexFeatures;
 import org.apache.tinkerpop.gremlin.structure.Graph.Features.VertexPropertyFeatures;
@@ -136,14 +137,8 @@ public class VertexTest {
 
         @Test(expected = NoSuchElementException.class)
         @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
-        public void shouldThrowNoSuchElementExceptionIfVertexWithIdNotPresentViaTraversal() {
-            graph.vertices("this-id-should-not-be-in-the-modern-graph").next();
-        }
-
-        @Test(expected = NoSuchElementException.class)
-        @LoadGraphWith(LoadGraphWith.GraphData.MODERN)
-        public void shouldThrowNoSuchElementExceptionIfVertexWithIdNotPresentViaIterators() {
-            graph.vertices("this-id-should-not-be-in-the-modern-graph").next();
+        public void shouldThrowNoSuchElementExceptionIfVertexWithIdNotPresent() {
+            graph.vertices(graphProvider.convertId(100)).next();
         }
 
         @Test

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59028c8a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 730c7ea..71d3eba 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -84,9 +84,9 @@ public class TinkerGraph implements Graph {
 
     private final static TinkerGraph EMPTY_GRAPH = new TinkerGraph();
 
-    private Class<?> vertexIdClass = null;
-    private Class<?> edgeIdClass = null;
-    private Class<?> vertexPropertyIdClass = null;
+    protected Class<?> vertexIdClass = null;
+    protected Class<?> edgeIdClass = null;
+    protected Class<?> vertexPropertyIdClass = null;
 
     /**
      * An empty private constructor that initializes {@link TinkerGraph}.
@@ -141,11 +141,13 @@ public class TinkerGraph implements Graph {
             if (this.vertices.containsKey(idValue))
                 throw Exceptions.vertexWithIdAlreadyExists(idValue);
         } else {
-            idValue = TinkerHelper.getNextId(this);
+            idValue = TinkerHelper.getNextId(this, Vertex.class);
         }
 
         // todo: enforce vertex id consistency with tests
-        if (vertexIdClass == null)
+        // if no value is defined on the graph for the expected id type then use whatever is currently set, otherwise
+        // if there is a value, ensure that the expected type matches what was provided.
+        if (null == vertexIdClass)
             vertexIdClass = idValue.getClass();
         else if (!idValue.getClass().equals(vertexIdClass)) {
             throw new IllegalStateException(String.format("Expecting a vertex identifier of %s but was %s", vertexIdClass, idValue.getClass()));
@@ -208,6 +210,7 @@ public class TinkerGraph implements Graph {
 
     @Override
     public Iterator<Vertex> vertices(final Object... vertexIds) {
+        // todo: this code looks a lot like edges() code - better reuse here somewhere?
         if (0 == vertexIds.length) {
             return this.vertices.values().iterator();
         } else if (1 == vertexIds.length) {
@@ -242,50 +245,40 @@ public class TinkerGraph implements Graph {
         }
     }
 
-    private UnaryOperator<Object> convertToId(final Object id, final Class<?> elementIdClass) {
-        if (id instanceof Number) {
-            if (elementIdClass != null) {
-                if (elementIdClass.equals(Long.class)) {
-                    return o -> ((Number) o).longValue();
-                } else if (elementIdClass.equals(Integer.class)) {
-                    return o -> ((Number) o).intValue();
-                } else if (elementIdClass.equals(Double.class)) {
-                    return o -> ((Number) o).doubleValue();
-                } else if (elementIdClass.equals(Float.class)) {
-                    return o -> ((Number) o).floatValue();
-                } else if (elementIdClass.equals(String.class)) {
-                    return o -> o.toString();
-                }
-            }
-        } else if (id instanceof String) {
-            if (elementIdClass != null) {
-                final String s = (String) id;
-                if (elementIdClass.equals(Long.class)) {
-                    return o -> Long.parseLong(s);
-                } else if (elementIdClass.equals(Integer.class)) {
-                    return o -> Integer.parseInt(s);
-                } else if (elementIdClass.equals(Double.class)) {
-                    return o -> Double.parseDouble(s);
-                } else if (elementIdClass.equals(Float.class)) {
-                    return o -> Float.parseFloat(s);
-                } else if (elementIdClass.equals(UUID.class)) {
-                    return o -> UUID.fromString(s);
-                }
-            }
-        }
-
-        return UnaryOperator.identity();
-    }
-
     @Override
     public Iterator<Edge> edges(final Object... edgeIds) {
         if (0 == edgeIds.length) {
             return this.edges.values().iterator();
         } else if (1 == edgeIds.length) {
-            final Edge edge = this.edges.get(edgeIds[0]);
-            return null == edge ? Collections.emptyIterator() : IteratorUtils.of(edge);
-        } else
-            return Stream.of(edgeIds).map(this.edges::get).filter(Objects::nonNull).iterator();
+            if (edgeIds[0] instanceof Edge) {
+                // no need to get the edge again, so just flip it back - some implementation may want to treat this
+                // as a refresh operation. that's not necessary for tinkergraph.
+                return IteratorUtils.of((Edge) edgeIds[0]);
+            } else {
+                // convert the id to the expected data type and lookup the vertex
+                final UnaryOperator<Object> conversionFunction = convertToId(edgeIds[0], edgeIdClass);
+                final Edge edge = this.edges.get(conversionFunction.apply(edgeIds[0]));
+                return null == edge ? Collections.emptyIterator() : IteratorUtils.of(edge);
+            }
+        } else {
+            // base the conversion function on the first item in the id list as the expectation is that these
+            // id values will be a uniform list
+            if (edgeIds[0] instanceof Edge) {
+                // based on the first item assume all vertices in the argument list
+                if (!Stream.of(edgeIds).allMatch(id -> id instanceof Edge))
+                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+
+                // no need to get the vertices again, so just flip it back - some implementation may want to treat this
+                // as a refresh operation. that's not necessary for tinkergraph.
+                return Stream.of(edgeIds).map(id -> (Edge) id).iterator();
+            } else {
+                final Class<?> firstClass = edgeIds[0].getClass();
+                if (!Stream.of(edgeIds).map(Object::getClass).allMatch(firstClass::equals))
+                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();     // todo: change exception to be ids of the same type
+                final UnaryOperator<Object> conversionFunction = convertToId(edgeIds[0], vertexIdClass);
+                return Stream.of(edgeIds).map(conversionFunction).map(this.edges::get).filter(Objects::nonNull).iterator();
+            }
+        }
     }
 
     /**
@@ -325,11 +318,11 @@ public class TinkerGraph implements Graph {
         public String toString() {
             return StringFactory.featureString(this);
         }
-    }
 
+    }
     public static class TinkerGraphVertexFeatures implements Features.VertexFeatures {
-        static final TinkerGraphVertexFeatures INSTANCE = new TinkerGraphVertexFeatures();
 
+        static final TinkerGraphVertexFeatures INSTANCE = new TinkerGraphVertexFeatures();
         private TinkerGraphVertexFeatures() {
         }
 
@@ -337,11 +330,11 @@ public class TinkerGraph implements Graph {
         public boolean supportsCustomIds() {
             return false;
         }
-    }
 
+    }
     public static class TinkerGraphEdgeFeatures implements Features.EdgeFeatures {
-        static final TinkerGraphEdgeFeatures INSTANCE = new TinkerGraphEdgeFeatures();
 
+        static final TinkerGraphEdgeFeatures INSTANCE = new TinkerGraphEdgeFeatures();
         private TinkerGraphEdgeFeatures() {
         }
 
@@ -349,11 +342,11 @@ public class TinkerGraph implements Graph {
         public boolean supportsCustomIds() {
             return false;
         }
-    }
 
+    }
     public static class TinkerGraphGraphFeatures implements Features.GraphFeatures {
-        static final TinkerGraphGraphFeatures INSTANCE = new TinkerGraphGraphFeatures();
 
+        static final TinkerGraphGraphFeatures INSTANCE = new TinkerGraphGraphFeatures();
         private TinkerGraphGraphFeatures() {
         }
 
@@ -371,6 +364,7 @@ public class TinkerGraph implements Graph {
         public boolean supportsThreadedTransactions() {
             return false;
         }
+
     }
 
     ///////////// GRAPH SPECIFIC INDEXING METHODS ///////////////
@@ -429,4 +423,45 @@ public class TinkerGraph implements Graph {
             throw new IllegalArgumentException("Class is not indexable: " + elementClass);
         }
     }
+
+    ///////////// HELPERS METHODS ///////////////
+
+    /**
+     * Function to coerce a provided identifier to a different type given the expected id type of an element.
+     * This allows something like {@code g.V(1,2,3)} and {@code g.V(1l,2l,3l)} to both mean the same thing.
+     */
+    private UnaryOperator<Object> convertToId(final Object id, final Class<?> elementIdClass) {
+        if (id instanceof Number) {
+            if (elementIdClass != null) {
+                if (elementIdClass.equals(Long.class)) {
+                    return o -> ((Number) o).longValue();
+                } else if (elementIdClass.equals(Integer.class)) {
+                    return o -> ((Number) o).intValue();
+                } else if (elementIdClass.equals(Double.class)) {
+                    return o -> ((Number) o).doubleValue();
+                } else if (elementIdClass.equals(Float.class)) {
+                    return o -> ((Number) o).floatValue();
+                } else if (elementIdClass.equals(String.class)) {
+                    return o -> o.toString();
+                }
+            }
+        } else if (id instanceof String) {
+            if (elementIdClass != null) {
+                final String s = (String) id;
+                if (elementIdClass.equals(Long.class)) {
+                    return o -> Long.parseLong(s);
+                } else if (elementIdClass.equals(Integer.class)) {
+                    return o -> Integer.parseInt(s);
+                } else if (elementIdClass.equals(Double.class)) {
+                    return o -> Double.parseDouble(s);
+                } else if (elementIdClass.equals(Float.class)) {
+                    return o -> Float.parseFloat(s);
+                } else if (elementIdClass.equals(UUID.class)) {
+                    return o -> UUID.fromString(s);
+                }
+            }
+        }
+
+        return UnaryOperator.identity();
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59028c8a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
index c84d37c..1b1311e 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.tinkergraph.structure;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 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.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
@@ -46,8 +47,35 @@ public final class TinkerHelper {
     private TinkerHelper() {
     }
 
-    protected final synchronized static long getNextId(final TinkerGraph graph) {
-        return Stream.generate(() -> (++graph.currentId)).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
+    protected final synchronized static Number getNextId(final TinkerGraph graph, final Class<? extends Element> element) {
+        final Class<?> idClass;
+        if (Vertex.class.isAssignableFrom(element))
+            idClass = graph.vertexIdClass;
+        else if (Edge.class.isAssignableFrom(element))
+            idClass = graph.edgeIdClass;
+        else if (VertexProperty.class.isAssignableFrom(element))
+            idClass = graph.vertexPropertyIdClass;
+        else
+            throw new IllegalArgumentException(String.format("Unexpected request for id for %s", element));
+
+        final Number next = Stream.generate(() -> (++graph.currentId)).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
+
+        // the class hasn't been set yet so assume Long - the class should be set by the caller after this
+        // value is returned
+        if (null == idClass)
+            return next.longValue();
+
+        if (idClass.equals(Long.class))
+            return next.longValue();
+        else if (idClass.equals(Integer.class))
+            return next.intValue();
+        else if (idClass.equals(Double.class))
+            return next.doubleValue();
+        else if (idClass.equals(Float.class))
+            return next.floatValue();
+        else
+            throw new IllegalStateException(String.format("TinkerGraph generates numeric identifiers, but this instance has already been initialized a identifier of type %s for %s", idClass, element));
+
     }
 
     protected static Edge addEdge(final TinkerGraph graph, final TinkerVertex outVertex, final TinkerVertex inVertex, final String label, final Object... keyValues) {
@@ -61,7 +89,16 @@ public final class TinkerHelper {
             if (graph.edges.containsKey(idValue))
                 throw Graph.Exceptions.edgeWithIdAlreadyExists(idValue);
         } else {
-            idValue = TinkerHelper.getNextId(graph);
+            idValue = TinkerHelper.getNextId(graph, Edge.class);
+        }
+
+        // todo: enforce edge id consistency with tests
+        // if no value is defined on the graph for the expected id type then use whatever is currently set, otherwise
+        // if there is a value, ensure that the expected type matches what was provided.
+        if (null == graph.edgeIdClass)
+            graph.edgeIdClass = idValue.getClass();
+        else if (!idValue.getClass().equals(graph.edgeIdClass)) {
+            throw new IllegalStateException(String.format("Expecting a edge identifier of %s but was %s", graph.edgeIdClass, idValue.getClass()));
         }
 
         edge = new TinkerEdge(idValue, outVertex, label, inVertex);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59028c8a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
index 9cdc7db..a5713cc 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
@@ -96,9 +96,18 @@ public class TinkerVertex extends TinkerElement implements Vertex {
             ElementHelper.attachProperties(vertexProperty, keyValues);
             return vertexProperty;
         } else {
-            final VertexProperty<V> vertexProperty = optionalId.isPresent() ?
-                    new TinkerVertexProperty<V>(optionalId.get(), this, key, value) :
-                    new TinkerVertexProperty<V>(this, key, value);
+            final Object idValue = optionalId.isPresent() ? optionalId.get() : TinkerHelper.getNextId(graph, VertexProperty.class);
+
+            // todo: enforce vertexproperty id consistency with tests
+            // if no value is defined on the graph for the expected id type then use whatever is currently set, otherwise
+            // if there is a value, ensure that the expected type matches what was provided.
+            if (null == graph.vertexPropertyIdClass)
+                graph.vertexPropertyIdClass = idValue.getClass();
+            else if (!idValue.getClass().equals(graph.vertexPropertyIdClass))
+                throw new IllegalStateException(String.format("Expecting a vertex identifier of %s but was %s", graph.vertexPropertyIdClass, idValue.getClass()));
+
+            final VertexProperty<V> vertexProperty = new TinkerVertexProperty<V>(idValue, this, key, value);
+
             if (null == this.properties) this.properties = new HashMap<>();
             final List<VertexProperty> list = this.properties.getOrDefault(key, new ArrayList<>());
             list.add(vertexProperty);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/59028c8a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java
index 66f15ea..2470733 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java
@@ -19,11 +19,13 @@
 package org.apache.tinkerpop.gremlin.tinkergraph.structure;
 
 import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Property;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.tinkergraph.process.computer.TinkerGraphView;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
 import java.util.Collections;
@@ -44,8 +46,13 @@ public class TinkerVertexProperty<V> extends TinkerElement implements VertexProp
     private final String key;
     private final V value;
 
+    /**
+     * This constructor will not validate the ID type against the {@link Graph}.  It will always just use a
+     * {@code Long} for its identifier.  This is useful for constructing a {@link VertexProperty} for usage
+     * with {@link TinkerGraphView}.
+     */
     public TinkerVertexProperty(final TinkerVertex vertex, final String key, final V value, final Object... propertyKeyValues) {
-        super(TinkerHelper.getNextId((TinkerGraph) vertex.graph()), key);
+        super(TinkerHelper.getNextId((TinkerGraph) vertex.graph(), VertexProperty.class), key);
         this.vertex = vertex;
         this.key = key;
         this.value = value;
@@ -53,6 +60,10 @@ public class TinkerVertexProperty<V> extends TinkerElement implements VertexProp
         ElementHelper.attachProperties(this, propertyKeyValues);
     }
 
+    /**
+     * Use this constructor to construct {@link VertexProperty} instances for {@link TinkerGraph} where the {@code id}
+     * can be explicitly set and validated against the expected data type.
+     */
     public TinkerVertexProperty(final Object id, final TinkerVertex vertex, final String key, final V value, final Object... propertyKeyValues) {
         super(id, key);
         this.vertex = vertex;


[33/43] incubator-tinkerpop git commit: Add javadoc.

Posted by sp...@apache.org.
Add javadoc.


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

Branch: refs/heads/master
Commit: 01f930babf1d44f453e44a6788df822d03b65839
Parents: 59493d6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 13:00:17 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 13:00:17 2015 -0400

----------------------------------------------------------------------
 .../org/apache/tinkerpop/gremlin/AbstractGraphProvider.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/01f930ba/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
index 8fe041b..e439d29 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
@@ -86,7 +86,10 @@ public abstract class AbstractGraphProvider implements GraphProvider {
         }
     }
 
-    // todo: these aren't used - remove???
+    /**
+     * Helper method for those building {@link GraphProvider} implementations that need to clean directories
+     * between test runs.
+     */
     protected static void deleteDirectory(final File directory) {
         if (directory.exists()) {
             for (File file : directory.listFiles()) {
@@ -107,6 +110,10 @@ public abstract class AbstractGraphProvider implements GraphProvider {
         if (directory.exists()) System.err.println("unable to delete directory " + directory.getAbsolutePath());
     }
 
+    /**
+     * Helper method for those build {@link GraphProvider} implementations that need a standard working directory
+     * for tests (e.g. graphs that persist data to disk).
+     */
     protected String getWorkingDirectory() {
         return TestHelper.makeTestDataPath(this.getClass(), "graph-provider-data").getAbsolutePath();
     }


[42/43] incubator-tinkerpop git commit: Simplify the IoTest.CustomIdJacksonSerializer code a little bit.

Posted by sp...@apache.org.
Simplify the IoTest.CustomIdJacksonSerializer code a little bit.

Serialization really does fall into two categories now typed and non-typed - the code is very different between them.


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

Branch: refs/heads/master
Commit: 4a06aaf1c855b41b4fedf0865a06c1975cb2f28d
Parents: b1e30ff
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Apr 13 07:03:22 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Apr 13 07:03:22 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/IoTest.java     | 34 ++++++++------------
 1 file changed, 13 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4a06aaf1/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index 94993ec..bf36d54 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -2574,32 +2574,24 @@ public class IoTest extends AbstractGremlinTest {
             @Override
             public void serialize(final CustomId customId, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider)
                     throws IOException, JsonGenerationException {
-                ser(customId, jsonGenerator, false);
+                // when types are not embedded, stringify or resort to JSON primitive representations of the
+                // type so that non-jvm languages can better interoperate with the TinkerPop stack.
+                jsonGenerator.writeString(customId.toString());
             }
 
             @Override
             public void serializeWithType(final CustomId customId, final JsonGenerator jsonGenerator,
                                           final SerializerProvider serializerProvider, final TypeSerializer typeSerializer) throws IOException, JsonProcessingException {
-                ser(customId, jsonGenerator, true);
-            }
-
-            private void ser(final CustomId customId, final JsonGenerator jsonGenerator, final boolean includeType) throws IOException {
-                if (includeType) {
-                    // when the type is included add "class" as a key and then try to utilize as much of the
-                    // default serialization provided by jackson data-bind as possible.  for example, write
-                    // the uuid as an object so that when jackson serializes it, it uses the uuid serializer
-                    // to write it out with the type.  in this way, data-bind should be able to deserialize
-                    // it back when types are embedded.
-                    jsonGenerator.writeStartObject();
-                    jsonGenerator.writeStringField(GraphSONTokens.CLASS, CustomId.class.getName());
-                    jsonGenerator.writeStringField("cluster", customId.getCluster());
-                    jsonGenerator.writeObjectField("elementId", customId.getElementId());
-                    jsonGenerator.writeEndObject();
-                } else {
-                    // when types are not embedded, stringify or resort to JSON primitive representations of the
-                    // type so that non-jvm languages can better interoperate with the TinkerPop stack.
-                    jsonGenerator.writeString(customId.toString());
-                }
+                // when the type is included add "class" as a key and then try to utilize as much of the
+                // default serialization provided by jackson data-bind as possible.  for example, write
+                // the uuid as an object so that when jackson serializes it, it uses the uuid serializer
+                // to write it out with the type.  in this way, data-bind should be able to deserialize
+                // it back when types are embedded.
+                jsonGenerator.writeStartObject();
+                jsonGenerator.writeStringField(GraphSONTokens.CLASS, CustomId.class.getName());
+                jsonGenerator.writeStringField("cluster", customId.getCluster());
+                jsonGenerator.writeObjectField("elementId", customId.getElementId());
+                jsonGenerator.writeEndObject();
             }
         }
     }


[17/43] incubator-tinkerpop git commit: Add some javadoc to the TinkerGraph.IdManager interface.

Posted by sp...@apache.org.
Add some javadoc to the TinkerGraph.IdManager interface.


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

Branch: refs/heads/master
Commit: 0559f8f877b6006adb44cc8b293326dfc6ac1c61
Parents: ec8258e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 15:53:56 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 15:53:56 2015 -0400

----------------------------------------------------------------------
 .../tinkergraph/structure/TinkerGraph.java      | 52 +++++++++++++-------
 1 file changed, 34 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0559f8f8/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index d310f94..31ff696 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -491,9 +491,25 @@ public class TinkerGraph implements Graph {
         return UnaryOperator.identity();
     }
 
+    /**
+     * TinkerGraph will use an implementation of this interface to generate identifiers when a user does not supply
+     * them and to handle identifier conversions when querying to provide better flexibility with respect to
+     * handling different data types that mean the same thing.  For example, the
+     * {@link DefaultIdManager#LONG} implementation will allow {@code g.vertices(1l, 2l)} and
+     * {@code g.vertices(1, 2)} to both return values.
+     *
+     * @param <T> the id type
+     */
     public interface IdManager<T> {
+        /**
+         * Generate an identifier which should be unique to the {@link TinkerGraph} instance.
+         */
         T getNextId(final TinkerGraph graph);
-        T convert(final Object o);
+
+        /**
+         * Convert an identifier to the type required by the manager.
+         */
+        T convert(final Object id);
     }
 
     public enum DefaultIdManager implements IdManager {
@@ -505,11 +521,11 @@ public class TinkerGraph implements Graph {
             }
 
             @Override
-            public Object convert(final Object o) {
-                if (o instanceof Number)
-                    return ((Number) o).longValue();
-                else if (o instanceof String)
-                    return Long.parseLong((String) o);
+            public Object convert(final Object id) {
+                if (id instanceof Number)
+                    return ((Number) id).longValue();
+                else if (id instanceof String)
+                    return Long.parseLong((String) id);
                 else
                     throw new IllegalArgumentException("Expected an id that is convertible to Long");
             }
@@ -522,11 +538,11 @@ public class TinkerGraph implements Graph {
             }
 
             @Override
-            public Object convert(final Object o) {
-                if (o instanceof Number)
-                    return ((Number) o).intValue();
-                else if (o instanceof String)
-                    return Integer.parseInt((String) o);
+            public Object convert(final Object id) {
+                if (id instanceof Number)
+                    return ((Number) id).intValue();
+                else if (id instanceof String)
+                    return Integer.parseInt((String) id);
                 else
                     throw new IllegalArgumentException("Expected an id that is convertible to Integer");
             }
@@ -538,11 +554,11 @@ public class TinkerGraph implements Graph {
             }
 
             @Override
-            public Object convert(final Object o) {
-                if (o instanceof java.util.UUID)
-                    return o;
-                else if (o instanceof String)
-                    return java.util.UUID.fromString((String) o);
+            public Object convert(final Object id) {
+                if (id instanceof java.util.UUID)
+                    return id;
+                else if (id instanceof String)
+                    return java.util.UUID.fromString((String) id);
                 else
                     throw new IllegalArgumentException("Expected an id that is convertible to UUID");
             }
@@ -555,8 +571,8 @@ public class TinkerGraph implements Graph {
             }
 
             @Override
-            public Object convert(final Object o) {
-                return o;
+            public Object convert(final Object id) {
+                return id;
             }
         }
     }


[26/43] incubator-tinkerpop git commit: Remove unused import from TinkerGraph.

Posted by sp...@apache.org.
Remove unused import from TinkerGraph.


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

Branch: refs/heads/master
Commit: 866f6e9d81baaddde33839f79609669cc5720508
Parents: fb7ee1a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 09:59:13 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 09:59:13 2015 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/866f6e9d/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 9cc7501..1fc00ae 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -43,7 +43,6 @@ import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
-import java.util.function.UnaryOperator;
 import java.util.stream.Stream;
 
 /**


[37/43] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into TINKERPOP3-581

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into TINKERPOP3-581


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

Branch: refs/heads/master
Commit: 975f0a1b21fe36993d506f80212fccb2f77894be
Parents: a4c62be 5081a2b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 13:32:12 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 13:32:12 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   5 +-
 docs/src/the-traversal.asciidoc                 |  34 ++-
 .../traversal/dsl/graph/GraphTraversal.java     |   5 -
 .../gremlin/process/traversal/dsl/graph/__.java |   4 -
 .../process/traversal/step/map/BackStep.java    |  64 ------
 .../traversal/traverser/util/TraverserSet.java  |   7 +-
 .../tinkerpop/gremlin/structure/Graph.java      |   4 +-
 .../step/filter/GroovyRangeTest.groovy          |  36 ---
 .../traversal/step/map/GroovyBackTest.groovy    | 146 ------------
 .../traversal/step/map/GroovySelectTest.groovy  | 112 +++++++++-
 .../process/GroovyProcessComputerSuite.java     |   2 -
 .../process/GroovyProcessStandardSuite.java     |   4 +-
 .../tinkerpop/gremlin/AbstractGremlinTest.java  |   2 +-
 .../gremlin/process/ProcessComputerSuite.java   |   6 +-
 .../gremlin/process/ProcessStandardSuite.java   |   4 +-
 .../traversal/step/filter/RangeTest.java        |  79 +------
 .../process/traversal/step/map/BackTest.java    | 220 -------------------
 .../process/traversal/step/map/SelectTest.java  | 183 ++++++++++++++-
 hadoop-gremlin/conf/hadoop-gryo.properties      |   3 -
 .../gremlin/hadoop/structure/io/IOClasses.java  |   2 +-
 20 files changed, 329 insertions(+), 593 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/975f0a1b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/975f0a1b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
----------------------------------------------------------------------


[43/43] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into TINKERPOP3-581

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into TINKERPOP3-581

Conflicts:
	gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java


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

Branch: refs/heads/master
Commit: 9716d379df5742dbf3cf1bf681bea0b5043c7d7f
Parents: 4a06aaf c906ee2
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Apr 13 13:10:36 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Apr 13 13:10:36 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  2 +
 .../tinkerpop/gremlin/structure/Element.java    |  6 --
 .../tinkerpop/gremlin/structure/Graph.java      | 14 ----
 .../tinkerpop/gremlin/structure/Property.java   |  8 +--
 .../gremlin/structure/VertexProperty.java       |  2 -
 .../util/detached/DetachedProperty.java         |  2 +-
 .../util/detached/DetachedVertexProperty.java   |  3 +-
 .../util/reference/ReferenceProperty.java       |  2 +-
 .../util/reference/ReferenceVertexProperty.java |  2 +-
 .../gremlin/structure/util/star/StarGraph.java  |  2 +-
 .../tinkerpop/gremlin/AbstractGremlinSuite.java | 71 --------------------
 .../gremlin/structure/FeatureSupportTest.java   | 14 ++--
 12 files changed, 20 insertions(+), 108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9716d379/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9716d379/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/9716d379/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
----------------------------------------------------------------------


[40/43] incubator-tinkerpop git commit: Add Apache License file to test class.

Posted by sp...@apache.org.
Add Apache License file to test class.


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

Branch: refs/heads/master
Commit: fed4ac871892e54018343a0e37a49a9f7b2f6457
Parents: 48bbd1f
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 15:30:33 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 15:30:33 2015 -0400

----------------------------------------------------------------------
 .../structure/TinkerGraphIdManagerTest.java       | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/fed4ac87/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphIdManagerTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphIdManagerTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphIdManagerTest.java
index 6de17ba..4bd8aad 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphIdManagerTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphIdManagerTest.java
@@ -1,3 +1,21 @@
+/*
+ * 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.tinkergraph.structure;
 
 import org.apache.commons.configuration.BaseConfiguration;


[11/43] incubator-tinkerpop git commit: Add direct configuration of the id manager for toy graphs.

Posted by sp...@apache.org.
Add direct configuration of the id manager for toy graphs.


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

Branch: refs/heads/master
Commit: afb9b12d09c16bbf3731bed849a15bc18200f431
Parents: 3cc550e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 14:55:05 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 14:55:05 2015 -0400

----------------------------------------------------------------------
 .../gremlin/tinkergraph/structure/TinkerFactory.java        | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/afb9b12d/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
index e89c9cc..21ad2a0 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerFactory.java
@@ -18,6 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.tinkergraph.structure;
 
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.process.traversal.T;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.LambdaFlatMapStep;
@@ -35,7 +37,12 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
  */
 public class TinkerFactory {
     public static TinkerGraph createClassic() {
-        final TinkerGraph g = TinkerGraph.open();
+        final Configuration conf = new BaseConfiguration();
+        conf.setProperty(TinkerGraph.CONFIG_VERTEX_ID, TinkerGraph.DefaultIdManager.INTEGER);
+        conf.setProperty(TinkerGraph.CONFIG_EDGE_ID, TinkerGraph.DefaultIdManager.INTEGER);
+        conf.setProperty(TinkerGraph.CONFIG_VERTEX_PROPERTY_ID, TinkerGraph.DefaultIdManager.INTEGER);
+
+        final TinkerGraph g = TinkerGraph.open(conf);
         generateClassic(g);
         return g;
     }


[16/43] incubator-tinkerpop git commit: Dropped an unused interface method on the TinkerGraph.IdManager.

Posted by sp...@apache.org.
Dropped an unused interface method on the TinkerGraph.IdManager.


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

Branch: refs/heads/master
Commit: ec8258e951cbc6a47b9b416e70cea6acc9d33c49
Parents: 85e1a71
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 15:46:24 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 15:46:24 2015 -0400

----------------------------------------------------------------------
 .../tinkergraph/structure/TinkerGraph.java      | 21 --------------------
 1 file changed, 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ec8258e9/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 4acbf66..d310f94 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -493,7 +493,6 @@ public class TinkerGraph implements Graph {
 
     public interface IdManager<T> {
         T getNextId(final TinkerGraph graph);
-        Class<? extends T> getIdClass();
         T convert(final Object o);
     }
 
@@ -506,11 +505,6 @@ public class TinkerGraph implements Graph {
             }
 
             @Override
-            public Class<? extends Long> getIdClass() {
-                return Long.class;
-            }
-
-            @Override
             public Object convert(final Object o) {
                 if (o instanceof Number)
                     return ((Number) o).longValue();
@@ -528,11 +522,6 @@ public class TinkerGraph implements Graph {
             }
 
             @Override
-            public Class<? extends Integer> getIdClass() {
-                return Integer.class;
-            }
-
-            @Override
             public Object convert(final Object o) {
                 if (o instanceof Number)
                     return ((Number) o).intValue();
@@ -549,11 +538,6 @@ public class TinkerGraph implements Graph {
             }
 
             @Override
-            public Class<? extends UUID> getIdClass() {
-                return java.util.UUID.class;
-            }
-
-            @Override
             public Object convert(final Object o) {
                 if (o instanceof java.util.UUID)
                     return o;
@@ -571,11 +555,6 @@ public class TinkerGraph implements Graph {
             }
 
             @Override
-            public Class<? extends Object> getIdClass() {
-                return Object.class;
-            }
-
-            @Override
             public Object convert(final Object o) {
                 return o;
             }


[21/43] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into TINKERPOP3-581

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into TINKERPOP3-581


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

Branch: refs/heads/master
Commit: c3c1c011671f7449e32e9f996999674858f4e7de
Parents: b67712a 26e7344
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 06:55:33 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 06:55:33 2015 -0400

----------------------------------------------------------------------
 .../gremlin/structure/io/gryo/GryoMapper.java   |   4 +
 .../util/reference/ReferenceVertexProperty.java |   9 +-
 .../gremlin/structure/util/star/StarGraph.java  |  26 ++---
 .../structure/StructureStandardSuite.java       |   2 +
 .../reference/ReferenceVertexPropertyTest.java  | 101 +++++++++++++++++++
 hadoop-gremlin/conf/hadoop-gryo.properties      |   2 +
 .../process/computer/spark/SparkExecutor.java   |   7 +-
 .../computer/spark/SparkGraphComputer.java      |   9 +-
 .../process/computer/spark/SparkMessenger.java  |   5 +-
 9 files changed, 137 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c3c1c011/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
----------------------------------------------------------------------


[06/43] incubator-tinkerpop git commit: Add some javadoc around Graph.edge/vertices.

Posted by sp...@apache.org.
Add some javadoc around Graph.edge/vertices.


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

Branch: refs/heads/master
Commit: 54f9bce562d920004e88c905df42f6253a8ddc7d
Parents: 4b7990c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 8 10:00:09 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 8 10:00:09 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/Graph.java      | 85 +++++++++++++++++++-
 1 file changed, 84 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/54f9bce5/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 376ab45..5066c06 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -158,7 +158,53 @@ public interface Graph extends AutoCloseable {
     }
 
     /**
-     * Get the {@link Vertex} objects in this graph with the provided vertex ids. If no ids are provided, get all vertices.
+     * Get the {@link Vertex} objects in this graph with the provided vertex ids. If no ids are provided, get all
+     * vertices.  Note that a vertex identifier does not need to correspond to the actual id used in the graph.  It
+     * needs to be a bit more flexible than that in that given the {@link Graph.Features} around id support, multiple
+     * arguments might be applicable here.
+     * <br/>
+     * If the graph return {@code true} for {@link Features.VertexFeatures#supportsNumericIds()} then it should support
+     * filters as with:
+     * <ul>
+     *     <li>g.V(v)</li>
+     *     <li>g.V(v.id())</li>
+     *     <li>g.V(1)</li>
+     *     <li>g.V(1L)</li>
+     *     <li>g.V(1.0d)</li>
+     *     <li>g.V(1.0f)</li>
+     *     <li>g.V("1")</li>
+     * </ul>
+     * <br/>
+     * If the graph return {@code true} for {@link Features.VertexFeatures#supportsCustomIds()} ()} then it should support
+     * filters as with:
+     * <ul>
+     *     <li>g.V(v)</li>
+     *     <li>g.V(v.id())</li>
+     *     <li>g.V(v.id().toString())</li>
+     * </ul>
+     * <br/>
+     * If the graph return {@code true} for {@link Features.VertexFeatures#supportsAnyIds()} ()} then it should support
+     * filters as with:
+     * <ul>
+     *     <li>g.V(v)</li>
+     *     <li>g.V(v.id())</li>
+     * </ul>
+     * <br/>
+     * If the graph return {@code true} for {@link Features.VertexFeatures#supportsStringIds()} ()} then it should support
+     * filters as with:
+     * <ul>
+     *     <li>g.V(v)</li>
+     *     <li>g.V(v.id().toString())</li>
+     *     <li>g.V("id")</li>
+     * </ul>
+     * <br/>
+     * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsStringIds()} ()} then it should support
+     * filters as with:
+     * <ul>
+     *     <li>g.V(v)</li>
+     *     <li>g.V(v.id().toString())</li>
+     *     <li>g.V("id")</li>
+     * </ul>
      *
      * @param vertexIds the ids of the vertices to get
      * @return an {@link Iterator} of vertices that match the provided vertex ids
@@ -167,6 +213,43 @@ public interface Graph extends AutoCloseable {
 
     /**
      * Get the {@link Edge} objects in this graph with the provided edge ids. If no ids are provided, get all edges.
+     * Note that an edge identifier does not need to correspond to the actual id used in the graph.  It
+     * needs to be a bit more flexible than that in that given the {@link Graph.Features} around id support, multiple
+     * arguments might be applicable here.
+     * <br/>
+     * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsNumericIds()} then it should support
+     * filters as with:
+     * <ul>
+     *     <li>g.E(e)</li>
+     *     <li>g.E(1)</li>
+     *     <li>g.E(1L)</li>
+     *     <li>g.E(1.0d)</li>
+     *     <li>g.E(1.0f)</li>
+     *     <li>g.E("1")</li>
+     * </ul>
+     * <br/>
+     * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsCustomIds()} ()} then it should support
+     * filters as with:
+     * <ul>
+     *     <li>g.E(e)</li>
+     *     <li>g.E(e.id())</li>
+     *     <li>g.E(e.id().toString())</li>
+     * </ul>
+     * <br/>
+     * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsAnyIds()} ()} then it should support
+     * filters as with:
+     * <ul>
+     *     <li>g.E(e)</li>
+     *     <li>g.E(e.id())</li>
+     * </ul>
+     * <br/>
+     * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsStringIds()} ()} then it should support
+     * filters as with:
+     * <ul>
+     *     <li>g.E(e)</li>
+     *     <li>g.E(e.id().toString())</li>
+     *     <li>g.E("id")</li>
+     * </ul>
      *
      * @param edgeIds the ids of the edges to get
      * @return an {@link Iterator} of edges that match the provided edge ids


[38/43] incubator-tinkerpop git commit: Refactor IdManager configuration in TinkerGraph.

Posted by sp...@apache.org.
Refactor IdManager configuration in TinkerGraph.

Provides for less cut/paste of similar code and improved readability of constructor.


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

Branch: refs/heads/master
Commit: 3aa7e215381723f29e982a54bd076816bf081e36
Parents: 975f0a1
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 13:56:01 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 13:56:01 2015 -0400

----------------------------------------------------------------------
 .../tinkergraph/structure/TinkerGraph.java      | 58 ++++++++------------
 1 file changed, 22 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3aa7e215/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 07cab24..aacc223 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -86,9 +86,9 @@ public class TinkerGraph implements Graph {
 
     private final static TinkerGraph EMPTY_GRAPH = new TinkerGraph(EMPTY_CONFIGURATION);
 
-    protected IdManager<?> vertexIdManager;
-    protected IdManager<?> edgeIdManager;
-    protected IdManager<?> vertexPropertyIdManager;
+    protected final IdManager<?> vertexIdManager;
+    protected final IdManager<?> edgeIdManager;
+    protected final IdManager<?> vertexPropertyIdManager;
 
     private final Configuration configuration;
 
@@ -97,39 +97,9 @@ public class TinkerGraph implements Graph {
      */
     private TinkerGraph(final Configuration configuration) {
         this.configuration = configuration;
-
-        final String vertexIdManagerConfigValue = configuration.getString(CONFIG_VERTEX_ID, DefaultIdManager.ANY.name());
-        try {
-            vertexIdManager = DefaultIdManager.valueOf(vertexIdManagerConfigValue);
-        } catch (IllegalArgumentException iae) {
-            try {
-                vertexIdManager = (IdManager) Class.forName(vertexIdManagerConfigValue).newInstance();
-            } catch (Exception ex) {
-                throw new IllegalStateException(String.format("Could not configure TinkerGraph vertex id manager with %s", vertexIdManagerConfigValue));
-            }
-        }
-
-        final String edgeIdManagerConfigValue = configuration.getString(CONFIG_EDGE_ID, DefaultIdManager.ANY.name());
-        try {
-            edgeIdManager = DefaultIdManager.valueOf(edgeIdManagerConfigValue);
-        } catch (IllegalArgumentException iae) {
-            try {
-                edgeIdManager = (IdManager) Class.forName(edgeIdManagerConfigValue).newInstance();
-            } catch (Exception ex) {
-                throw new IllegalStateException(String.format("Could not configure TinkerGraph edge id manager with %s", edgeIdManagerConfigValue));
-            }
-        }
-
-        final String vertexPropIdManagerConfigValue = configuration.getString(CONFIG_VERTEX_PROPERTY_ID, DefaultIdManager.ANY.name());
-        try {
-            vertexPropertyIdManager = DefaultIdManager.valueOf(vertexPropIdManagerConfigValue);
-        } catch (IllegalArgumentException iae) {
-            try {
-                vertexPropertyIdManager = (IdManager) Class.forName(vertexPropIdManagerConfigValue).newInstance();
-            } catch (Exception ex) {
-                throw new IllegalStateException(String.format("Could not configure TinkerGraph vertex property id manager with %s", vertexPropIdManagerConfigValue));
-            }
-        }
+        vertexIdManager = selectIdManager(configuration, CONFIG_VERTEX_ID, Vertex.class);
+        edgeIdManager = selectIdManager(configuration, CONFIG_EDGE_ID, Edge.class);
+        vertexPropertyIdManager = selectIdManager(configuration, CONFIG_VERTEX_PROPERTY_ID, VertexProperty.class);
     }
 
     public static TinkerGraph empty() {
@@ -426,6 +396,22 @@ public class TinkerGraph implements Graph {
     }
 
     /**
+     * Construct an {@link TinkerGraph.IdManager} from the TinkerGraph {@link Configuration}.
+     */
+    private static IdManager<?> selectIdManager(final Configuration config, final String configKey, final Class<? extends Element> clazz) {
+        final String vertexIdManagerConfigValue = config.getString(configKey, DefaultIdManager.ANY.name());
+        try {
+            return DefaultIdManager.valueOf(vertexIdManagerConfigValue);
+        } catch (IllegalArgumentException iae) {
+            try {
+                return (IdManager) Class.forName(vertexIdManagerConfigValue).newInstance();
+            } catch (Exception ex) {
+                throw new IllegalStateException(String.format("Could not configure TinkerGraph %s id manager with %s", clazz.getSimpleName(), vertexIdManagerConfigValue));
+            }
+        }
+    }
+
+    /**
      * TinkerGraph will use an implementation of this interface to generate identifiers when a user does not supply
      * them and to handle identifier conversions when querying to provide better flexibility with respect to
      * handling different data types that mean the same thing.  For example, the


[27/43] incubator-tinkerpop git commit: Add edge iteration tests to validate different types being passed to it for filtering TINKERPOP3-581

Posted by sp...@apache.org.
Add edge iteration tests to validate different types being passed to it for filtering TINKERPOP3-581


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

Branch: refs/heads/master
Commit: d564026a03b92cd9b2c0c4f3261c0c781e04e9cd
Parents: 866f6e9
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 11:15:08 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 11:15:08 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/GraphTest.java  | 546 ++++++++++++++++++-
 .../tinkerpop/gremlin/structure/VertexTest.java |  95 ++++
 .../tinkergraph/TinkerGraphProvider.java        |  10 +
 3 files changed, 650 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d564026a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
index f19902f..a059f0b 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
@@ -132,6 +132,7 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
     public void shouldAddVertexWithUserSuppliedNumericId() {
         graph.addVertex(T.id, 1000l);
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(1000l).next();
             assertEquals(1000l, v.id());
@@ -144,6 +145,7 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_STRING_IDS)
     public void shouldAddVertexWithUserSuppliedStringId() {
         graph.addVertex(T.id, "1000");
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices("1000").next();
             assertEquals("1000", v.id());
@@ -157,6 +159,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldAddVertexWithUserSuppliedUuidId() {
         final UUID uuid = UUID.randomUUID();
         graph.addVertex(T.id, uuid);
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(uuid).next();
             assertEquals(uuid, v.id());
@@ -170,6 +173,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldAddVertexWithUserSuppliedAnyIdUsingUuid() {
         final UUID uuid = UUID.randomUUID();
         graph.addVertex(T.id, uuid);
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(uuid).next();
             assertEquals(uuid, v.id());
@@ -183,6 +187,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldAddVertexWithUserSuppliedAnyIdUsingString() {
         final UUID uuid = UUID.randomUUID();
         graph.addVertex(T.id, uuid.toString());
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(uuid.toString()).next();
             assertEquals(uuid.toString(), v.id());
@@ -198,8 +203,9 @@ public class GraphTest extends AbstractGremlinTest {
 
         // this is different from "FEATURE_CUSTOM_IDS" as TinkerGraph does not define a specific id class
         // (i.e. TinkerId) for the identifier.
-        IoTest.CustomId customId = new IoTest.CustomId("test", uuid);
+        final IoTest.CustomId customId = new IoTest.CustomId("test", uuid);
         graph.addVertex(T.id, customId);
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(customId).next();
             assertEquals(customId, v.id());
@@ -212,6 +218,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithUuidIdSupportUsingVertex() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1).next();
             assertEquals(v1.id(), v.id());
@@ -224,6 +231,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithUuidIdSupportUsingVertexId() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1.id()).next();
             assertEquals(v1.id(), v.id());
@@ -236,6 +244,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithUuidIdSupportUsingStringRepresentation() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1.id().toString()).next();
             assertEquals(v1.id(), v.id());
@@ -249,6 +258,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1, v2)));
         });
@@ -261,6 +271,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1.id(), v2.id())));
         });
@@ -273,6 +284,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1.id().toString(), v2.id().toString())));
         });
@@ -283,6 +295,7 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_CUSTOM_IDS)
     public void shouldIterateVerticesWithCustomIdSupportUsingVertex() {
         final Vertex v1 = graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1).next();
             assertEquals(v1.id(), v.id());
@@ -294,6 +307,7 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_CUSTOM_IDS)
     public void shouldIterateVerticesWithCustomIdSupportUsingVertexId() {
         final Vertex v1 = graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1.id()).next();
             assertEquals(v1.id(), v.id());
@@ -305,6 +319,7 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_CUSTOM_IDS)
     public void shouldIterateVerticesWithCustomIdSupportUsingStringRepresentation() {
         final Vertex v1 = graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1.id().toString()).next();
             assertEquals(v1.id(), v.id());
@@ -317,6 +332,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithCustomIdSupportUsingVertices() {
         final Vertex v1 = graph.addVertex();
         final Vertex v2 = graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1, v2)));
         });
@@ -328,6 +344,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithCustomIdSupportUsingVertexIds() {
         final Vertex v1 = graph.addVertex();
         final Vertex v2 = graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1.id(), v2.id())));
         });
@@ -339,6 +356,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithCustomIdSupportUsingStringRepresentations() {
         final Vertex v1 = graph.addVertex();
         final Vertex v2 = graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1.id().toString(), v2.id().toString())));
         });
@@ -350,6 +368,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithNumericIdSupportUsingVertex() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1).next();
             assertEquals(v1.id(), v.id());
@@ -362,6 +381,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithNumericIdSupportUsingVertexId() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1.id()).next();
             assertEquals(v1.id(), v.id());
@@ -374,6 +394,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithNumericIdSupportUsingLongRepresentation() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(Long.parseLong(v1.id().toString())).next();
             assertEquals(v1.id(), v.id());
@@ -386,6 +407,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithNumericIdSupportUsingIntegerRepresentation() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(Integer.parseInt(v1.id().toString())).next();
             assertEquals(v1.id(), v.id());
@@ -398,6 +420,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentation() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(Float.parseFloat(v1.id().toString())).next();
             assertEquals(v1.id(), v.id());
@@ -410,6 +433,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentation() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(Double.parseDouble(v1.id().toString())).next();
             assertEquals(v1.id(), v.id());
@@ -422,6 +446,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithNumericIdSupportUsingStringRepresentation() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1.id().toString()).next();
             assertEquals(v1.id(), v.id());
@@ -435,6 +460,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1, v2)));
         });
@@ -447,6 +473,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1.id(), v2.id())));
         });
@@ -459,6 +486,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(Long.parseLong(v1.id().toString()), Long.parseLong(v2.id().toString()))));
         });
@@ -471,6 +499,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(Integer.parseInt(v1.id().toString()), Integer.parseInt(v2.id().toString()))));
         });
@@ -483,6 +512,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(Float.parseFloat(v1.id().toString()), Float.parseFloat(v2.id().toString()))));
         });
@@ -495,6 +525,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(Double.parseDouble(v1.id().toString()), Double.parseDouble(v2.id().toString()))));
         });
@@ -507,6 +538,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1.id().toString(), v2.id().toString())));
         });
@@ -546,6 +578,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithStringIdSupportUsingVertex() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1).next();
             assertEquals(v1.id(), v.id());
@@ -558,6 +591,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithStringIdSupportUsingVertexId() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1.id()).next();
             assertEquals(v1.id(), v.id());
@@ -570,6 +604,7 @@ public class GraphTest extends AbstractGremlinTest {
     public void shouldIterateVerticesWithStringIdSupportUsingStringRepresentation() {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(v1.id().toString()).next();
             assertEquals(v1.id(), v.id());
@@ -583,6 +618,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "2") : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1, v2)));
         });
@@ -595,6 +631,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "2") : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1.id(), v2.id())));
         });
@@ -607,6 +644,7 @@ public class GraphTest extends AbstractGremlinTest {
         // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
         final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
         final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "2") : graph.addVertex();
+        graph.addVertex();
         tryCommit(graph, graph -> {
             assertEquals(2, IteratorUtils.count(graph.vertices(v1.id().toString(), v2.id().toString())));
         });
@@ -1028,4 +1066,510 @@ public class GraphTest extends AbstractGremlinTest {
 
         graphProvider.clear(reopenedGraph, graphProvider.standardGraphConfiguration(this.getClass(), name.getMethodName(), null));
     }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateEdgesWithUuidIdSupportUsingEdge() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, UUID.randomUUID()) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateEdgesWithUuidIdSupportUsingEdgeId() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, UUID.randomUUID()) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1.id()).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateEdgesWithUuidIdSupportUsingStringRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, UUID.randomUUID()) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1.id().toString()).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateEdgesWithUuidIdSupportUsingEdges() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, UUID.randomUUID()) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, UUID.randomUUID()) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(e1, e2)));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateEdgesWithUuidIdSupportUsingEdgeIds() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, UUID.randomUUID()) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, UUID.randomUUID()) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(e1.id(), e2.id())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateEdgesWithUuidIdSupportUsingStringRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, UUID.randomUUID()) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, UUID.randomUUID()) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(e1.id().toString(), e2.id().toString())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateEdgesWithCustomIdSupportUsingEdge() {
+        final Vertex v = graph.addVertex();
+        final Edge e1 = v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateEdgesWithCustomIdSupportUsingEdgeId() {
+        final Vertex v = graph.addVertex();
+        final Edge e1 = v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1.id()).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateEdgesWithCustomIdSupportUsingStringRepresentation() {
+        final Vertex v = graph.addVertex();
+        final Edge e1 = v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1.id().toString()).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateEdgesWithCustomIdSupportUsingEdges() {
+        final Vertex v = graph.addVertex();
+        final Edge e1 = v.addEdge("self", v);
+        final Edge e2 = v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(e1, e2)));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateEdgesWithCustomIdSupportUsingEdgeIds() {
+        final Vertex v = graph.addVertex();
+        final Edge e1 = v.addEdge("self", v);
+        final Edge e2 = v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(e1.id(), e2.id())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateEdgesWithCustomIdSupportUsingStringRepresentations() {
+        final Vertex v = graph.addVertex();
+        final Edge e1 = v.addEdge("self", v);
+        final Edge e2 = v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(e1.id().toString(), e2.id().toString())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingEdge() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingEdgeId() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1.id()).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingLongRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(Long.parseLong(e1.id().toString())).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingIntegerRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(Integer.parseInt(e1.id().toString())).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingFloatRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(Float.parseFloat(e1.id().toString())).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingDoubleRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(Double.parseDouble(e1.id().toString())).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingStringRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1.id().toString()).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingVertices() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 2l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(e1, e2)));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingEdgeIds() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 2l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(e1.id(), e2.id())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingLongRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 2l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(Long.parseLong(e1.id().toString()), Long.parseLong(e2.id().toString()))));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingIntegerRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 2l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(Integer.parseInt(e1.id().toString()), Integer.parseInt(e2.id().toString()))));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingFloatRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 2l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(Float.parseFloat(e1.id().toString()), Float.parseFloat(e2.id().toString()))));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingDoubleRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 2l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(Double.parseDouble(e1.id().toString()), Double.parseDouble(e2.id().toString()))));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateEdgesWithNumericIdSupportUsingStringRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 1l) : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, 2l) : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(e1.id().toString(), e2.id().toString())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    public void shouldNotMixTypesForGettingSpecificEdgesWithEdgeFirst() {
+        final Vertex v = graph.addVertex();
+        final Edge e1 = v.addEdge("self", v);
+        try {
+            graph.edges(e1, graphProvider.convertId("1"));
+            fail("Should have thrown an exception because id arguments were mixed.");
+        } catch (Exception ex) {
+            final Exception expected = Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+            assertEquals(expected.getClass(), ex.getClass());
+            assertEquals(expected.getMessage(), ex.getMessage());
+        }
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    public void shouldNotMixTypesForGettingSpecificEdgesWithStringFirst() {
+        final Vertex v = graph.addVertex();
+        final Edge e1 = v.addEdge("self", v);
+        try {
+            graph.edges(graphProvider.convertId("1"), e1);
+            fail("Should have thrown an exception because id arguments were mixed.");
+        } catch (Exception ex) {
+            final Exception expected = Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+            assertEquals(expected.getClass(), ex.getClass());
+            assertEquals(expected.getMessage(), ex.getMessage());
+        }
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateEdgesWithStringIdSupportUsingEdge() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, "1") : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateEdgesWithStringIdSupportUsingEdgeId() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, "1") : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1.id()).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateEdgesWithStringIdSupportUsingStringRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, "1") : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            final Edge e = graph.edges(e1.id().toString()).next();
+            assertEquals(e1.id(), e.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateEdgesWithStringIdSupportUsingEdges() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, "1") : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, "2") : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(e1, e2)));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateEdgesWithStringIdSupportUsingEdgeIds() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, "1") : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, "2") : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(e1.id(), e2.id())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateEdgesWithStringIdSupportUsingStringRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v = graph.addVertex();
+        final Edge e1 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, "1") : v.addEdge("self", v);
+        final Edge e2 = graph.features().edge().supportsUserSuppliedIds() ? v.addEdge("self", v, T.id, "2") : v.addEdge("self", v);
+        v.addEdge("self", v);
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.edges(e1.id().toString(), e2.id().toString())));
+        });
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d564026a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
index c281e27..de2a20e 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexTest.java
@@ -42,6 +42,7 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.Set;
+import java.util.UUID;
 import java.util.function.Consumer;
 
 import static org.apache.tinkerpop.gremlin.structure.Graph.Features.PropertyFeatures.*;
@@ -55,6 +56,100 @@ import static org.junit.Assert.*;
 @RunWith(Enclosed.class)
 public class VertexTest {
 
+    public static class AddEdgeTest extends AbstractGremlinTest {
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_NUMERIC_IDS)
+        public void shouldAddEdgeWithUserSuppliedNumericId() {
+            final Vertex v = graph.addVertex();
+            v.addEdge("self", v, T.id, 1000l);
+            tryCommit(graph, graph -> {
+                final Edge e = graph.edges(1000l).next();
+                assertEquals(1000l, e.id());
+            });
+        }
+
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_STRING_IDS)
+        public void shouldAddEdgeWithUserSuppliedStringId() {
+            final Vertex v = graph.addVertex();
+            v.addEdge("self", v, T.id, "1000");
+            tryCommit(graph, graph -> {
+                final Edge e = graph.edges("1000").next();
+                assertEquals("1000", e.id());
+            });
+        }
+
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_UUID_IDS)
+        public void shouldAddEdgeWithUserSuppliedUuidId() {
+            final UUID uuid = UUID.randomUUID();
+            final Vertex v = graph.addVertex();
+            v.addEdge("self", v, T.id, uuid);
+            tryCommit(graph, graph -> {
+                final Edge e = graph.edges(uuid).next();
+                assertEquals(uuid, e.id());
+            });
+        }
+
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ANY_IDS)
+        public void shouldAddEdgeWithUserSuppliedAnyIdUsingUuid() {
+            final UUID uuid = UUID.randomUUID();
+            final Vertex v = graph.addVertex();
+            v.addEdge("self", v, T.id, uuid);
+            tryCommit(graph, graph -> {
+                final Edge e = graph.edges(uuid).next();
+                assertEquals(uuid, e.id());
+            });
+        }
+
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ANY_IDS)
+        public void shouldAddEdgeWithUserSuppliedAnyIdUsingString() {
+            final UUID uuid = UUID.randomUUID();
+            final Vertex v = graph.addVertex();
+            v.addEdge("self", v, T.id, uuid.toString());
+            tryCommit(graph, graph -> {
+                final Edge e = graph.edges(uuid.toString()).next();
+                assertEquals(uuid.toString(), e.id());
+            });
+        }
+
+        @Test
+        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_USER_SUPPLIED_IDS)
+        @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ANY_IDS)
+        public void shouldAddEdgeWithUserSuppliedAnyIdUsingAnyObject() {
+            final UUID uuid = UUID.randomUUID();
+
+            // this is different from "FEATURE_CUSTOM_IDS" as TinkerGraph does not define a specific id class
+            // (i.e. TinkerId) for the identifier.
+            final IoTest.CustomId customId = new IoTest.CustomId("test", uuid);
+            final Vertex v = graph.addVertex();
+            v.addEdge("self", v, T.id, customId);
+            tryCommit(graph, graph -> {
+                final Edge e = graph.edges(customId).next();
+                assertEquals(customId, e.id());
+            });
+        }
+    }
+
     @ExceptionCoverage(exceptionClass = Edge.Exceptions.class, methods = {
             "userSuppliedIdsNotSupported"
     })

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/d564026a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
index 596e565..65db06a 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
@@ -89,11 +89,21 @@ public class TinkerGraphProvider extends AbstractGraphProvider {
                 add("shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentations");
                 add("shouldIterateVerticesWithNumericIdSupportUsingStringRepresentation");
                 add("shouldIterateVerticesWithNumericIdSupportUsingStringRepresentations");
+                add("shouldIterateEdgesWithNumericIdSupportUsingDoubleRepresentation");
+                add("shouldIterateEdgesWithNumericIdSupportUsingDoubleRepresentations");
+                add("shouldIterateEdgesWithNumericIdSupportUsingIntegerRepresentation");
+                add("shouldIterateEdgesWithNumericIdSupportUsingIntegerRepresentations");
+                add("shouldIterateEdgesWithNumericIdSupportUsingFloatRepresentation");
+                add("shouldIterateEdgesWithNumericIdSupportUsingFloatRepresentations");
+                add("shouldIterateEdgesWithNumericIdSupportUsingStringRepresentation");
+                add("shouldIterateEdgesWithNumericIdSupportUsingStringRepresentations");
             }};
 
             final Set<String> testsThatNeedUuidIdManager = new HashSet<String>(){{
                 add("shouldIterateVerticesWithUuidIdSupportUsingStringRepresentation");
                 add("shouldIterateVerticesWithUuidIdSupportUsingStringRepresentations");
+                add("shouldIterateEdgesWithUuidIdSupportUsingStringRepresentation");
+                add("shouldIterateEdgesWithUuidIdSupportUsingStringRepresentations");
             }};
 
             if (testsThatNeedLongIdManager.contains(testMethodName))


[39/43] incubator-tinkerpop git commit: Add tests and docs around IdManager for TinkerGraph.

Posted by sp...@apache.org.
Add tests and docs around IdManager for TinkerGraph.


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

Branch: refs/heads/master
Commit: 48bbd1f3ef654f5c79da6bf09053b4ee9d505061
Parents: 3aa7e21
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 15:29:37 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 15:29:37 2015 -0400

----------------------------------------------------------------------
 docs/src/implementations.asciidoc               |  24 +++-
 .../tinkergraph/structure/TinkerGraph.java      |  20 ++-
 .../tinkergraph/structure/TinkerHelper.java     |   2 +-
 .../tinkergraph/structure/TinkerVertex.java     |   6 +-
 .../structure/TinkerGraphIdManagerTest.java     | 140 +++++++++++++++++++
 5 files changed, 179 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/48bbd1f3/docs/src/implementations.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/implementations.asciidoc b/docs/src/implementations.asciidoc
index 44e3c74..d0e9d7d 100644
--- a/docs/src/implementations.asciidoc
+++ b/docs/src/implementations.asciidoc
@@ -243,7 +243,7 @@ Validating with Gremlin-Test
 
 The operational semantics of any OLTP or OLAP implementation are validated by `gremlin-test`. Please provide the following test cases with your implementation, where `XXX` below denotes the name of your graph implementation (e.g. TinkerGraph, Neo4jGraph, HadoopGraph, etc.).
 
-NOTE: It is as important to look at "ignored" tests as it is to look at ones that fail.  The `gremlin-test` suite utilizes the `Feature` implementation exposed by the `Graph` to determine which tests to execute.  If a test utilizes features that are not supported by the graph, it will ignore them.  While that may be fine, implementers should validate that the ignored tests are appropriately bypassed and that there are no mistakes in their feature definitions.
+IMPORTANT: It is as important to look at "ignored" tests as it is to look at ones that fail.  The `gremlin-test` suite utilizes the `Feature` implementation exposed by the `Graph` to determine which tests to execute.  If a test utilizes features that are not supported by the graph, it will ignore them.  While that may be fine, implementers should validate that the ignored tests are appropriately bypassed and that there are no mistakes in their feature definitions.
 
 [source,java]
 ----
@@ -318,7 +318,9 @@ Also note that some of the tests in the Gremlin Test Suite are parameterized tes
 
 The annotation above shows that the name of each parameterized test will be prefixed with "expect" and have parentheses wrapped around the first parameter (at index 0) value supplied to each test.  This information can only be garnered by studying the test set up itself.  Once the pattern is determined and the specific unique name of the parameterized test is identified, add it to the `specific` property on the `OptOut` annotation in addition to the other arguments.
 
-These annotations help provide users a level of transparency into test suite compliance (via the xref:describe-graph[describeGraph()] utility function). It also allows implementers to have a lot of flexibility in terms of how they wish to support TinkerPop.  For example, maybe there is a single test case that prevents an implementer from claiming support of a `Feature`.  The implementer could choose to either not support the `Feature` or support it but "opt-out" of the test with a "reason" as to why so that users understand the limitation.
+These annotations help provide users a level of transparency into test suite compliance (via the xref:describe-graph[describeGraph()] utility function). It also allows implementers to have a lot of flexibility in terms of how they wish to support TinkerPop.  For example, maybe there is a single test case that prevents an implementer from claiming support of a `Feature`.  The implementer could choose to either not support the `Feature` or to support it but "opt-out" of the test with a "reason" as to why so that users understand the limitation.
+
+IMPORTANT: Before using `OptOut` be sure that the reason for using it is sound and it is more of a last resort.  It is possible that a test from the suite is doesn't properly represent the expectations of a feature, is too broad or narrow for the semantics it is trying to enforce or simply contains a bug.  Please consider raising issues in the developer mailing list with such concerns before assuming `OptOut` is the only answer.
 
 Accessibility via GremlinPlugin
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -407,7 +409,7 @@ Given the initial graph construction in the first code block, no index was defin
 Graph g = TinkerGraph.open();
 g.createIndex("name",Vertex.class)
 
-The runtimes for a vertex lookup by property is provided below for both no-index and indexed version of TinkerGraph over the Grateful Dead graph.
+The execution times for a vertex lookup by property is provided below for both no-index and indexed version of TinkerGraph over the Grateful Dead graph.
 
 [gremlin-groovy]
 ----
@@ -429,6 +431,22 @@ IMPORTANT: Each graph vendor will have different mechanism by which indices and
 
 NOTE: TinkerGraph is distributed with Gremlin Server and is therefore automatically available to it for configuration.
 
+Configuration
+~~~~~~~~~~~~~
+
+TinkerGraph has several settings that can be provided on creation via `Configuration` object:
+
+[width="100%",cols="2,10",options="header"]
+|=========================================================
+|Property |Description
+|gremlin.graph |`org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph`
+|gremlin.tinkergraph.vertexIdManager |The `IdManager` implementation to use for vertices.
+|gremlin.tinkergraph.edgeIdManager |The `IdManager` implementation to use for edges.
+|gremlin.tinkergraph.vertexPropertyIdManager |The `IdManager` implementation to use for vertex properties.
+|=========================================================
+
+The `IdManager` settings above refer to how TinkerGraph will control identifiers for vertices, edges and vertex properties.  There are several options for each of these settings: `ANY`, `LONG`, `INTEGER`, `UUID`, or the fully qualified class name of an `IdManager` implementation on the classpath.  When not specified, the default values for all settings is `ANY`, meaning that the graph will work with any object on the JVM as the identifier and will generate new identifiers from `Long` when the identifier is not user supplied.  TinkerGraph will also expect the user to understand the types used for identifiers when querying, meaning that `g.V(1)` and `g.V(1L)` could return two different vertices.  `LONG`, `INTEGER` and `UUID` settings will try to coerce identifier values to the expected type as well as generate new identifiers with that specified type.
+
 [[hadoop-gremlin]]
 Hadoop-Gremlin
 --------------

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/48bbd1f3/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index aacc223..5eb317d 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -71,9 +71,9 @@ public class TinkerGraph implements Graph {
         this.setProperty(Graph.GRAPH, TinkerGraph.class.getName());
     }};
 
-    public static final String CONFIG_VERTEX_ID = "tinkergraph.vertex.id";
-    public static final String CONFIG_EDGE_ID = "tinkergraph.edge.id";
-    public static final String CONFIG_VERTEX_PROPERTY_ID = "tinkergraph.vertex-property.id";
+    public static final String CONFIG_VERTEX_ID = "gremlin.tinkergraph.vertexIdManager";
+    public static final String CONFIG_EDGE_ID = "gremlin.tinkergraph.edgeIdManager";
+    public static final String CONFIG_VERTEX_PROPERTY_ID = "gremlin.tinkergraph.vertexPropertyIdManager";
 
     protected AtomicLong currentId = new AtomicLong(-1l);
     protected Map<Object, Vertex> vertices = new ConcurrentHashMap<>();
@@ -142,7 +142,7 @@ public class TinkerGraph implements Graph {
     @Override
     public Vertex addVertex(final Object... keyValues) {
         ElementHelper.legalPropertyKeyValueArray(keyValues);
-        Object idValue = ElementHelper.getIdValue(keyValues).orElse(null);
+        Object idValue = vertexIdManager.convert(ElementHelper.getIdValue(keyValues).orElse(null));
         final String label = ElementHelper.getLabelValue(keyValues).orElse(Vertex.DEFAULT_LABEL);
 
         if (null != idValue) {
@@ -448,7 +448,9 @@ public class TinkerGraph implements Graph {
 
             @Override
             public Object convert(final Object id) {
-                if (id instanceof Long)
+                if (null == id)
+                    return null;
+                else if (id instanceof Long)
                     return id;
                 else if (id instanceof Number)
                     return ((Number) id).longValue();
@@ -471,7 +473,9 @@ public class TinkerGraph implements Graph {
 
             @Override
             public Object convert(final Object id) {
-                if (id instanceof Integer)
+                if (null == id)
+                    return null;
+                else if (id instanceof Integer)
                     return id;
                 else if (id instanceof Number)
                     return ((Number) id).intValue();
@@ -494,7 +498,9 @@ public class TinkerGraph implements Graph {
 
             @Override
             public Object convert(final Object id) {
-                if (id instanceof java.util.UUID)
+                if (null == id)
+                    return null;
+                else if (id instanceof java.util.UUID)
                     return id;
                 else if (id instanceof String)
                     return java.util.UUID.fromString((String) id);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/48bbd1f3/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
index 08570c8..3105b7b 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
@@ -50,7 +50,7 @@ public final class TinkerHelper {
         ElementHelper.validateLabel(label);
         ElementHelper.legalPropertyKeyValueArray(keyValues);
 
-        Object idValue = ElementHelper.getIdValue(keyValues).orElse(null);
+        Object idValue = graph.edgeIdManager.convert(ElementHelper.getIdValue(keyValues).orElse(null));
 
         final Edge edge;
         if (null != idValue) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/48bbd1f3/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
index e9a4632..ec97d0b 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
@@ -92,11 +92,13 @@ public class TinkerVertex extends TinkerElement implements Vertex {
         if (optionalVertexProperty.isPresent()) return optionalVertexProperty.get();
 
         if (TinkerHelper.inComputerMode(this.graph)) {
-            VertexProperty<V> vertexProperty = (VertexProperty<V>) this.graph.graphView.addProperty(this, key, value);
+            final VertexProperty<V> vertexProperty = (VertexProperty<V>) this.graph.graphView.addProperty(this, key, value);
             ElementHelper.attachProperties(vertexProperty, keyValues);
             return vertexProperty;
         } else {
-            final Object idValue = optionalId.isPresent() ? optionalId.get() : graph.vertexPropertyIdManager.getNextId(graph);
+            final Object idValue = optionalId.isPresent() ?
+                    graph.vertexPropertyIdManager.convert(optionalId.get()) :
+                    graph.vertexPropertyIdManager.getNextId(graph);
 
             final VertexProperty<V> vertexProperty = new TinkerVertexProperty<V>(idValue, this, key, value);
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/48bbd1f3/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphIdManagerTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphIdManagerTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphIdManagerTest.java
new file mode 100644
index 0000000..6de17ba
--- /dev/null
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphIdManagerTest.java
@@ -0,0 +1,140 @@
+package org.apache.tinkerpop.gremlin.tinkergraph.structure;
+
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.traversal.T;
+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.VertexProperty;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.runners.Enclosed;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+@RunWith(Enclosed.class)
+public class TinkerGraphIdManagerTest {
+
+    @RunWith(Parameterized.class)
+    public static class NumberIdManagerTest {
+        private static final Configuration longIdManagerConfig = new BaseConfiguration();
+        private static final Configuration integerIdManagerConfig = new BaseConfiguration();
+
+        @Parameterized.Parameters(name = "{0}")
+        public static Iterable<Object[]> data() {
+            return Arrays.asList(new Object[][]{
+                    {"coerceLong", 100l, 200l, 300l},
+                    {"coerceInt", 100, 200, 300},
+                    {"coerceDouble", 100d, 200d, 300d},
+                    {"coerceFloat", 100f, 200f, 300f},
+                    {"coerceString", "100", "200", "300"}});
+        }
+
+        @Parameterized.Parameter(value = 0)
+        public String name;
+
+        @Parameterized.Parameter(value = 1)
+        public Object vertexIdValue;
+
+        @Parameterized.Parameter(value = 2)
+        public Object edgeIdValue;
+
+        @Parameterized.Parameter(value = 3)
+        public Object vertexPropertyIdValue;
+
+
+        @BeforeClass
+        public static void setup() {
+            longIdManagerConfig.addProperty(TinkerGraph.CONFIG_EDGE_ID, TinkerGraph.DefaultIdManager.LONG.name());
+            longIdManagerConfig.addProperty(TinkerGraph.CONFIG_VERTEX_ID, TinkerGraph.DefaultIdManager.LONG.name());
+            longIdManagerConfig.addProperty(TinkerGraph.CONFIG_VERTEX_PROPERTY_ID, TinkerGraph.DefaultIdManager.LONG.name());
+
+            integerIdManagerConfig.addProperty(TinkerGraph.CONFIG_EDGE_ID, TinkerGraph.DefaultIdManager.INTEGER.name());
+            integerIdManagerConfig.addProperty(TinkerGraph.CONFIG_VERTEX_ID, TinkerGraph.DefaultIdManager.INTEGER.name());
+            integerIdManagerConfig.addProperty(TinkerGraph.CONFIG_VERTEX_PROPERTY_ID, TinkerGraph.DefaultIdManager.INTEGER.name());
+        }
+
+        @Test
+        public void shouldUseLongIdManagerToCoerceTypes() {
+            final Graph graph = TinkerGraph.open(longIdManagerConfig);
+            final Vertex v = graph.addVertex(T.id, vertexIdValue);
+            final VertexProperty vp = v.property("test", "value", T.id, vertexPropertyIdValue);
+            final Edge e = v.addEdge("self", v, T.id, edgeIdValue);
+
+            assertEquals(100l, v.id());
+            assertEquals(200l, e.id());
+            assertEquals(300l, vp.id());
+        }
+
+        @Test
+        public void shouldUseIntegerIdManagerToCoerceTypes() {
+            final Graph graph = TinkerGraph.open(integerIdManagerConfig);
+            final Vertex v = graph.addVertex(T.id, vertexIdValue);
+            final VertexProperty vp = v.property("test", "value", T.id, vertexPropertyIdValue);
+            final Edge e = v.addEdge("self", v, T.id, edgeIdValue);
+
+            assertEquals(100, v.id());
+            assertEquals(200, e.id());
+            assertEquals(300, vp.id());
+        }
+    }
+
+
+    @RunWith(Parameterized.class)
+    public static class UuidIdManagerTest {
+        private static final Configuration idManagerConfig = new BaseConfiguration();
+
+        private static final UUID vertexId = UUID.fromString("0E939658-ADD2-4598-A722-2FC178E9B741");
+        private static final UUID edgeId = UUID.fromString("748179AA-E319-8C36-41AE-F3576B73E05C");
+        private static final UUID vertexPropertyId = UUID.fromString("EC27384C-39A0-923D-9410-271B585683B6");
+
+
+        @Parameterized.Parameters(name = "{0}")
+        public static Iterable<Object[]> data() {
+            return Arrays.asList(new Object[][]{
+                    {"coerceUuid", vertexId, edgeId, vertexPropertyId},
+                    {"coerceString", vertexId.toString(), edgeId.toString(), vertexPropertyId.toString()}});
+        }
+
+        @Parameterized.Parameter(value = 0)
+        public String name;
+
+        @Parameterized.Parameter(value = 1)
+        public Object vertexIdValue;
+
+        @Parameterized.Parameter(value = 2)
+        public Object edgeIdValue;
+
+        @Parameterized.Parameter(value = 3)
+        public Object vertexPropertyIdValue;
+
+
+        @BeforeClass
+        public static void setup() {
+            idManagerConfig.addProperty(TinkerGraph.CONFIG_EDGE_ID, TinkerGraph.DefaultIdManager.UUID.name());
+            idManagerConfig.addProperty(TinkerGraph.CONFIG_VERTEX_ID, TinkerGraph.DefaultIdManager.UUID.name());
+            idManagerConfig.addProperty(TinkerGraph.CONFIG_VERTEX_PROPERTY_ID, TinkerGraph.DefaultIdManager.UUID.name());
+        }
+
+        @Test
+        public void shouldUseIdManagerToCoerceTypes() {
+            final Graph graph = TinkerGraph.open(idManagerConfig);
+            final Vertex v = graph.addVertex(T.id, vertexIdValue);
+            final VertexProperty vp = v.property("test", "value", T.id, vertexPropertyIdValue);
+            final Edge e = v.addEdge("self", v, T.id, edgeIdValue);
+
+            assertEquals(vertexId, v.id());
+            assertEquals(edgeId, e.id());
+            assertEquals(vertexPropertyId, vp.id());
+        }
+    }
+}


[07/43] incubator-tinkerpop git commit: Add tests to enforce proper filtering of vertices during iteration TINKERPOP3-581

Posted by sp...@apache.org.
Add tests to enforce proper filtering of vertices during iteration TINKERPOP3-581

Updated TinkerGraph.vertices() implementation a bit.  Pushed some of the checking performed in GraphStep for non-uniform id arguments into the Graph.vertices() implementation so that it is handled at that level.  Still need to clean up in GraphStep a bit as that validation code probably doesn't need to be there anymore.


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

Branch: refs/heads/master
Commit: 0a22745146c79988a67dc8870970d7a8c70420e9
Parents: 54f9bce
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 8 16:22:35 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 8 16:22:35 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/Graph.java      |  84 ++--
 .../tinkerpop/gremlin/structure/GraphTest.java  | 426 ++++++++++++++++++-
 .../tinkergraph/structure/TinkerGraph.java      |  84 +++-
 3 files changed, 543 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0a227451/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
index 5066c06..1303ac1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Graph.java
@@ -166,44 +166,40 @@ public interface Graph extends AutoCloseable {
      * If the graph return {@code true} for {@link Features.VertexFeatures#supportsNumericIds()} then it should support
      * filters as with:
      * <ul>
-     *     <li>g.V(v)</li>
-     *     <li>g.V(v.id())</li>
-     *     <li>g.V(1)</li>
-     *     <li>g.V(1L)</li>
-     *     <li>g.V(1.0d)</li>
-     *     <li>g.V(1.0f)</li>
-     *     <li>g.V("1")</li>
+     *     <li>g.vertices(v.id())</li>
+     *     <li>g.vertices(1)</li>
+     *     <li>g.vertices(1L)</li>
+     *     <li>g.vertices(1.0d)</li>
+     *     <li>g.vertices(1.0f)</li>
+     *     <li>g.vertices("1")</li>
      * </ul>
      * <br/>
      * If the graph return {@code true} for {@link Features.VertexFeatures#supportsCustomIds()} ()} then it should support
      * filters as with:
      * <ul>
-     *     <li>g.V(v)</li>
-     *     <li>g.V(v.id())</li>
-     *     <li>g.V(v.id().toString())</li>
+     *     <li>g.vertices(v.id())</li>
+     *     <li>g.vertices(v.id().toString())</li>
      * </ul>
      * <br/>
      * If the graph return {@code true} for {@link Features.VertexFeatures#supportsAnyIds()} ()} then it should support
      * filters as with:
      * <ul>
-     *     <li>g.V(v)</li>
-     *     <li>g.V(v.id())</li>
+     *     <li>g.vertices(v.id())</li>
      * </ul>
      * <br/>
      * If the graph return {@code true} for {@link Features.VertexFeatures#supportsStringIds()} ()} then it should support
      * filters as with:
      * <ul>
-     *     <li>g.V(v)</li>
-     *     <li>g.V(v.id().toString())</li>
-     *     <li>g.V("id")</li>
+     *     <li>g.vertices(v)</li>
+     *     <li>g.vertices(v.id().toString())</li>
+     *     <li>g.vertices("id")</li>
      * </ul>
      * <br/>
      * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsStringIds()} ()} then it should support
      * filters as with:
      * <ul>
-     *     <li>g.V(v)</li>
-     *     <li>g.V(v.id().toString())</li>
-     *     <li>g.V("id")</li>
+     *     <li>g.vertices(v.id().toString())</li>
+     *     <li>g.vertices("id")</li>
      * </ul>
      *
      * @param vertexIds the ids of the vertices to get
@@ -220,35 +216,32 @@ public interface Graph extends AutoCloseable {
      * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsNumericIds()} then it should support
      * filters as with:
      * <ul>
-     *     <li>g.E(e)</li>
-     *     <li>g.E(1)</li>
-     *     <li>g.E(1L)</li>
-     *     <li>g.E(1.0d)</li>
-     *     <li>g.E(1.0f)</li>
-     *     <li>g.E("1")</li>
+     *     <li>g.edges(e.id())</li>
+     *     <li>g.edges(1)</li>
+     *     <li>g.edges(1L)</li>
+     *     <li>g.edges(1.0d)</li>
+     *     <li>g.edges(1.0f)</li>
+     *     <li>g.edges("1")</li>
      * </ul>
      * <br/>
      * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsCustomIds()} ()} then it should support
      * filters as with:
-     * <ul>
-     *     <li>g.E(e)</li>
-     *     <li>g.E(e.id())</li>
-     *     <li>g.E(e.id().toString())</li>
+     * <ul>\
+     *     <li>g.edges(e.id())</li>
+     *     <li>g.edges(e.id().toString())</li>
      * </ul>
      * <br/>
      * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsAnyIds()} ()} then it should support
      * filters as with:
      * <ul>
-     *     <li>g.E(e)</li>
-     *     <li>g.E(e.id())</li>
+     *     <li>g.edges(e.id())</li>
      * </ul>
      * <br/>
      * If the graph return {@code true} for {@link Features.EdgeFeatures#supportsStringIds()} ()} then it should support
      * filters as with:
      * <ul>
-     *     <li>g.E(e)</li>
-     *     <li>g.E(e.id().toString())</li>
-     *     <li>g.E("id")</li>
+     *     <li>g.edges(e.id().toString())</li>
+     *     <li>g.edges("id")</li>
      * </ul>
      *
      * @param edgeIds the ids of the edges to get
@@ -705,7 +698,7 @@ public interface Graph extends AutoCloseable {
             }
 
             /**
-             * Determines if an {@link Element} has numeric identifiers.
+             * Determines if an {@link Element} has numeric identifiers as their internal representation.
              */
             @FeatureDescriptor(name = FEATURE_NUMERIC_IDS)
             public default boolean supportsNumericIds() {
@@ -713,7 +706,7 @@ public interface Graph extends AutoCloseable {
             }
 
             /**
-             * Determines if an {@link Element} has string identifiers.
+             * Determines if an {@link Element} has string identifiers as their internal representation.
              */
             @FeatureDescriptor(name = FEATURE_STRING_IDS)
             public default boolean supportsStringIds() {
@@ -721,7 +714,7 @@ public interface Graph extends AutoCloseable {
             }
 
             /**
-             * Determines if an {@link Element} has UUID identifiers.
+             * Determines if an {@link Element} has UUID identifiers as their internal representation.
              */
             @FeatureDescriptor(name = FEATURE_UUID_IDS)
             public default boolean supportsUuidIds() {
@@ -729,16 +722,17 @@ public interface Graph extends AutoCloseable {
             }
 
             /**
-             * Determines if an {@link Element} has mapper identifiers where "mapper" refers to an implementation
-             * defined object.
+             * Determines if an {@link Element} has a specific custom object as their internal representation.
              */
             @FeatureDescriptor(name = FEATURE_CUSTOM_IDS)
             public default boolean supportsCustomIds() {
                 return true;
             }
 
+            // todo: need a test to enforce this condition
             /**
-             * Determines if an {@link Element} any Java object is a suitable identifier.
+             * Determines if an {@link Element} any Java object is a suitable identifier.  Note that this
+             * setting can only return true if {@link #supportsUserSuppliedIds()} is true.
              */
             @FeatureDescriptor(name = FEATURE_ANY_IDS)
             public default boolean supportsAnyIds() {
@@ -784,7 +778,7 @@ public interface Graph extends AutoCloseable {
             }
 
             /**
-             * Determines if an {@link VertexProperty} has numeric identifiers.
+             * Determines if an {@link VertexProperty} has numeric identifiers as their internal representation.
              */
             @FeatureDescriptor(name = FEATURE_NUMERIC_IDS)
             public default boolean supportsNumericIds() {
@@ -792,7 +786,7 @@ public interface Graph extends AutoCloseable {
             }
 
             /**
-             * Determines if an {@link VertexProperty} has string identifiers.
+             * Determines if an {@link VertexProperty} has string identifiers as their internal representation.
              */
             @FeatureDescriptor(name = FEATURE_STRING_IDS)
             public default boolean supportsStringIds() {
@@ -800,7 +794,7 @@ public interface Graph extends AutoCloseable {
             }
 
             /**
-             * Determines if an {@link VertexProperty} has UUID identifiers.
+             * Determines if an {@link VertexProperty} has UUID identifiers as their internal representation.
              */
             @FeatureDescriptor(name = FEATURE_UUID_IDS)
             public default boolean supportsUuidIds() {
@@ -808,8 +802,7 @@ public interface Graph extends AutoCloseable {
             }
 
             /**
-             * Determines if an {@link VertexProperty} has mapper identifiers where "mapper" refers to an implementation
-             * defined object.
+             * Determines if an {@link VertexProperty} has a specific custom object as their internal representation.
              */
             @FeatureDescriptor(name = FEATURE_CUSTOM_IDS)
             public default boolean supportsCustomIds() {
@@ -817,7 +810,8 @@ public interface Graph extends AutoCloseable {
             }
 
             /**
-             * Determines if an {@link VertexProperty} any Java object is a suitable identifier.
+             * Determines if an {@link VertexProperty} any Java object is a suitable identifier.  Note that this
+             * setting can only return true if {@link #supportsUserSuppliedIds()} is true.
              */
             @FeatureDescriptor(name = FEATURE_ANY_IDS)
             public default boolean supportsAnyIds() {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0a227451/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
index 996c116..d5c63e8 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
@@ -51,7 +51,8 @@ import static org.junit.Assert.*;
  */
 @ExceptionCoverage(exceptionClass = Graph.Exceptions.class, methods = {
         "vertexWithIdAlreadyExists",
-        "elementNotFound"
+        "elementNotFound",
+        "idArgsMustBeEitherIdOrElement"
 })
 @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
 public class GraphTest extends AbstractGremlinTest {
@@ -166,19 +167,34 @@ public class GraphTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ANY_IDS)
-    public void shouldAddVertexWithUserSuppliedAnyId() {
+    public void shouldAddVertexWithUserSuppliedAnyIdUsingUuid() {
         final UUID uuid = UUID.randomUUID();
         graph.addVertex(T.id, uuid);
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(uuid).next();
             assertEquals(uuid, v.id());
         });
+    }
 
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ANY_IDS)
+    public void shouldAddVertexWithUserSuppliedAnyIdUsingString() {
+        final UUID uuid = UUID.randomUUID();
         graph.addVertex(T.id, uuid.toString());
         tryCommit(graph, graph -> {
             final Vertex v = graph.vertices(uuid.toString()).next();
             assertEquals(uuid.toString(), v.id());
         });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_USER_SUPPLIED_IDS)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ANY_IDS)
+    public void shouldAddVertexWithUserSuppliedAnyIdUsingAnyObject() {
+        final UUID uuid = UUID.randomUUID();
 
         // this is different from "FEATURE_CUSTOM_IDS" as TinkerGraph does not define a specific id class
         // (i.e. TinkerId) for the identifier.
@@ -192,6 +208,412 @@ public class GraphTest extends AbstractGremlinTest {
 
     @Test
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateVerticesWithUuidIdSupportUsingVertex() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateVerticesWithUuidIdSupportUsingVertexId() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1.id()).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateVerticesWithUuidIdSupportUsingStringRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1.id().toString()).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateVerticesWithUuidIdSupportUsingVertices() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1, v2)));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateVerticesWithUuidIdSupportUsingVertexIds() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1.id(), v2.id())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_UUID_IDS)
+    public void shouldIterateVerticesWithUuidIdSupportUsingStringRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, UUID.randomUUID()) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1.id().toString(), v2.id().toString())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateVerticesWithCustomIdSupportUsingVertex() {
+        final Vertex v1 = graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateVerticesWithCustomIdSupportUsingVertexId() {
+        final Vertex v1 = graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1.id()).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateVerticesWithCustomIdSupportUsingStringRepresentation() {
+        final Vertex v1 = graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1.id().toString()).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateVerticesWithCustomIdSupportUsingVertices() {
+        final Vertex v1 = graph.addVertex();
+        final Vertex v2 = graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1, v2)));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateVerticesWithCustomIdSupportUsingVertexIds() {
+        final Vertex v1 = graph.addVertex();
+        final Vertex v2 = graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1.id(), v2.id())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_CUSTOM_IDS)
+    public void shouldIterateVerticesWithCustomIdSupportUsingStringRepresentations() {
+        final Vertex v1 = graph.addVertex();
+        final Vertex v2 = graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1.id().toString(), v2.id().toString())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingVertex() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingVertexId() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1.id()).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingLongRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(Long.parseLong(v1.id().toString())).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingIntegerRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(Integer.parseInt(v1.id().toString())).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(Float.parseFloat(v1.id().toString())).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(Double.parseDouble(v1.id().toString())).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingStringRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1.id().toString()).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingVertices() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1, v2)));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingVertexIds() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1.id(), v2.id())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingLongRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(Long.parseLong(v1.id().toString()), Long.parseLong(v2.id().toString()))));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingIntegerRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(Integer.parseInt(v1.id().toString()), Integer.parseInt(v2.id().toString()))));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(Float.parseFloat(v1.id().toString()), Float.parseFloat(v2.id().toString()))));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(Double.parseDouble(v1.id().toString()), Double.parseDouble(v2.id().toString()))));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_NUMERIC_IDS)
+    public void shouldIterateVerticesWithNumericIdSupportUsingStringRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 1l) : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, 2l) : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1.id().toString(), v2.id().toString())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    public void shouldNotMixTypesForGettingSpecificVerticesWithVertexFirst() {
+        final Vertex v1 = graph.addVertex();
+        try {
+            graph.vertices(v1, graphProvider.convertId("1"));
+            fail("Should have thrown an exception because id arguments were mixed.");
+        } catch (Exception ex) {
+            final Exception expected = Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+            assertEquals(expected.getClass(), ex.getClass());
+            assertEquals(expected.getMessage(), ex.getMessage());
+        }
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    public void shouldNotMixTypesForGettingSpecificVerticesWithStringFirst() {
+        final Vertex v1 = graph.addVertex();
+        try {
+            graph.vertices(graphProvider.convertId("1"), v1);
+            fail("Should have thrown an exception because id arguments were mixed.");
+        } catch (Exception ex) {
+            final Exception expected = Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+            assertEquals(expected.getClass(), ex.getClass());
+            assertEquals(expected.getMessage(), ex.getMessage());
+        }
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateVerticesWithStringIdSupportUsingVertex() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateVerticesWithStringIdSupportUsingVertexId() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1.id()).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateVerticesWithStringIdSupportUsingStringRepresentation() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
+        tryCommit(graph, graph -> {
+            final Vertex v = graph.vertices(v1.id().toString()).next();
+            assertEquals(v1.id(), v.id());
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateVerticesWithStringIdSupportUsingVertices() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "2") : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1, v2)));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateVerticesWithStringIdSupportUsingVertexIds() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "2") : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1.id(), v2.id())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_STRING_IDS)
+    public void shouldIterateVerticesWithStringIdSupportUsingStringRepresentations() {
+        // if the graph supports id assigned, it should allow it.  if the graph does not, it will generate one
+        final Vertex v1 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "1") : graph.addVertex();
+        final Vertex v2 = graph.features().vertex().supportsUserSuppliedIds() ? graph.addVertex(T.id, "2") : graph.addVertex();
+        tryCommit(graph, graph -> {
+            assertEquals(2, IteratorUtils.count(graph.vertices(v1.id().toString(), v2.id().toString())));
+        });
+    }
+
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_MULTI_PROPERTIES, supported = false)
     public void shouldOverwriteEarlierKeyValuesWithLaterKeyValuesOnAddVertexIfNoMultiProperty() {
         final Vertex v = graph.addVertex("test", "A", "test", "B", "test", "C");

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/0a227451/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 77f588f..730c7ea 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -39,8 +39,12 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.Set;
+import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Function;
+import java.util.function.UnaryOperator;
 import java.util.stream.Stream;
 
 /**
@@ -80,6 +84,10 @@ public class TinkerGraph implements Graph {
 
     private final static TinkerGraph EMPTY_GRAPH = new TinkerGraph();
 
+    private Class<?> vertexIdClass = null;
+    private Class<?> edgeIdClass = null;
+    private Class<?> vertexPropertyIdClass = null;
+
     /**
      * An empty private constructor that initializes {@link TinkerGraph}.
      */
@@ -136,8 +144,16 @@ public class TinkerGraph implements Graph {
             idValue = TinkerHelper.getNextId(this);
         }
 
+        // todo: enforce vertex id consistency with tests
+        if (vertexIdClass == null)
+            vertexIdClass = idValue.getClass();
+        else if (!idValue.getClass().equals(vertexIdClass)) {
+            throw new IllegalStateException(String.format("Expecting a vertex identifier of %s but was %s", vertexIdClass, idValue.getClass()));
+        }
+
         final Vertex vertex = new TinkerVertex(idValue, label, this);
         this.vertices.put(vertex.id(), vertex);
+
         ElementHelper.attachProperties(vertex, VertexProperty.Cardinality.list, keyValues);
         return vertex;
     }
@@ -195,10 +211,70 @@ public class TinkerGraph implements Graph {
         if (0 == vertexIds.length) {
             return this.vertices.values().iterator();
         } else if (1 == vertexIds.length) {
-            final Vertex vertex = this.vertices.get(vertexIds[0]);
-            return null == vertex ? Collections.emptyIterator() : IteratorUtils.of(vertex);
-        } else
-            return Stream.of(vertexIds).map(this.vertices::get).filter(Objects::nonNull).iterator();
+            if (vertexIds[0] instanceof Vertex) {
+                // no need to get the vertex again, so just flip it back - some implementation may want to treat this
+                // as a refresh operation. that's not necessary for tinkergraph.
+                return IteratorUtils.of((Vertex) vertexIds[0]);
+            } else {
+                // convert the id to the expected data type and lookup the vertex
+                final UnaryOperator<Object> conversionFunction = convertToId(vertexIds[0], vertexIdClass);
+                final Vertex vertex = this.vertices.get(conversionFunction.apply(vertexIds[0]));
+                return null == vertex ? Collections.emptyIterator() : IteratorUtils.of(vertex);
+            }
+        } else {
+            // base the conversion function on the first item in the id list as the expectation is that these
+            // id values will be a uniform list
+            if (vertexIds[0] instanceof Vertex) {
+                // based on the first item assume all vertices in the argument list
+                if (!Stream.of(vertexIds).allMatch(id -> id instanceof Vertex))
+                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+
+                // no need to get the vertices again, so just flip it back - some implementation may want to treat this
+                // as a refresh operation. that's not necessary for tinkergraph.
+                return Stream.of(vertexIds).map(id -> (Vertex) id).iterator();
+            } else {
+                final Class<?> firstClass = vertexIds[0].getClass();
+                if (!Stream.of(vertexIds).map(Object::getClass).allMatch(firstClass::equals))
+                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();     // todo: change exception to be ids of the same type
+                final UnaryOperator<Object> conversionFunction = convertToId(vertexIds[0], vertexIdClass);
+                return Stream.of(vertexIds).map(conversionFunction).map(this.vertices::get).filter(Objects::nonNull).iterator();
+            }
+        }
+    }
+
+    private UnaryOperator<Object> convertToId(final Object id, final Class<?> elementIdClass) {
+        if (id instanceof Number) {
+            if (elementIdClass != null) {
+                if (elementIdClass.equals(Long.class)) {
+                    return o -> ((Number) o).longValue();
+                } else if (elementIdClass.equals(Integer.class)) {
+                    return o -> ((Number) o).intValue();
+                } else if (elementIdClass.equals(Double.class)) {
+                    return o -> ((Number) o).doubleValue();
+                } else if (elementIdClass.equals(Float.class)) {
+                    return o -> ((Number) o).floatValue();
+                } else if (elementIdClass.equals(String.class)) {
+                    return o -> o.toString();
+                }
+            }
+        } else if (id instanceof String) {
+            if (elementIdClass != null) {
+                final String s = (String) id;
+                if (elementIdClass.equals(Long.class)) {
+                    return o -> Long.parseLong(s);
+                } else if (elementIdClass.equals(Integer.class)) {
+                    return o -> Integer.parseInt(s);
+                } else if (elementIdClass.equals(Double.class)) {
+                    return o -> Double.parseDouble(s);
+                } else if (elementIdClass.equals(Float.class)) {
+                    return o -> Float.parseFloat(s);
+                } else if (elementIdClass.equals(UUID.class)) {
+                    return o -> UUID.fromString(s);
+                }
+            }
+        }
+
+        return UnaryOperator.identity();
     }
 
     @Override


[08/43] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into TINKERPOP3-581

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into TINKERPOP3-581


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

Branch: refs/heads/master
Commit: 53a06b7c263077527230a28e3c47256fd8321928
Parents: 0a22745 c26342a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 08:24:52 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 08:24:52 2015 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   6 +
 .../traversal/dsl/graph/GraphTraversal.java     |   4 +-
 .../gremlin/process/traversal/dsl/graph/__.java |   4 +-
 .../step/sideEffect/SideEffectCapStep.java      |   9 +-
 .../traversal/traverser/util/TraverserSet.java  |   6 +-
 .../gremlin/structure/util/star/StarGraph.java  | 670 +++++++++++++++++++
 .../process/TraversalPerformanceTest.java       |   4 +-
 hadoop-gremlin/pom.xml                          |   5 -
 .../process/computer/spark/SparkExecutor.java   |  13 +-
 .../computer/spark/SparkGraphComputer.java      |  10 +-
 .../hadoop/structure/io/VertexWritable.java     |  11 +-
 .../io/graphson/GraphSONRecordReader.java       |   8 +-
 .../structure/io/gryo/GryoRecordReader.java     |   9 +-
 .../structure/io/script/ScriptRecordReader.java |   6 +-
 .../tinkergraph/structure/TinkerProperty.java   |   3 +
 .../tinkergraph/structure/TinkerGraphTest.java  |  20 +-
 16 files changed, 726 insertions(+), 62 deletions(-)
----------------------------------------------------------------------



[05/43] incubator-tinkerpop git commit: Correct previous commit - had some bad mis-types.

Posted by sp...@apache.org.
Correct previous commit - had some bad mis-types.


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

Branch: refs/heads/master
Commit: 4b7990c8c208fe19a3b2283f8407c1387291dca9
Parents: 66d981c
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 8 09:29:13 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 8 09:29:13 2015 -0400

----------------------------------------------------------------------
 .../org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/4b7990c8/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
index 8efa620..5d84c56 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
@@ -254,7 +254,7 @@ public class FeatureSupportTest {
         public void shouldSupportStringIdsIfStringIdsAreGeneratedFromTheGraph() throws Exception {
             final Vertex v = graph.addVertex();
             if (v.id() instanceof String)
-                fail(String.format(INVALID_git FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_STRING_IDS));
+                fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_STRING_IDS));
         }
 
         @Test


[28/43] incubator-tinkerpop git commit: Better reuse iterator creation code on vertices/edges in TinkerGraph.

Posted by sp...@apache.org.
Better reuse iterator creation code on vertices/edges in TinkerGraph.


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

Branch: refs/heads/master
Commit: 34f826cd72e22540015dc0c22fec2dc926a10ef8
Parents: d564026
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 11:27:10 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 11:27:10 2015 -0400

----------------------------------------------------------------------
 .../tinkergraph/structure/TinkerGraph.java      | 65 +++++++-------------
 1 file changed, 21 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/34f826cd/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 1fc00ae..4cb310e 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -239,70 +239,47 @@ public class TinkerGraph implements Graph {
 
     @Override
     public Iterator<Vertex> vertices(final Object... vertexIds) {
-        // todo: this code looks a lot like edges() code - better reuse here somewhere?
         // todo: what if we have Reference/DetachedVertex???????????????????????????
-        if (0 == vertexIds.length) {
-            return this.vertices.values().iterator();
-        } else if (1 == vertexIds.length) {
-            if (vertexIds[0] instanceof Vertex) {
-                // no need to get the vertex again, so just flip it back - some implementation may want to treat this
-                // as a refresh operation. that's not necessary for tinkergraph.
-                return IteratorUtils.of((Vertex) vertexIds[0]);
-            } else {
-                // convert the id to the expected data type and lookup the vertex
-                final Vertex vertex = this.vertices.get(vertexIdManager.convert(vertexIds[0]));
-                return null == vertex ? Collections.emptyIterator() : IteratorUtils.of(vertex);
-            }
-        } else {
-            // base the conversion function on the first item in the id list as the expectation is that these
-            // id values will be a uniform list
-            if (vertexIds[0] instanceof Vertex) {
-                // based on the first item assume all vertices in the argument list
-                if (!Stream.of(vertexIds).allMatch(id -> id instanceof Vertex))
-                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
-
-                // no need to get the vertices again, so just flip it back - some implementation may want to treat this
-                // as a refresh operation. that's not necessary for tinkergraph.
-                return Stream.of(vertexIds).map(id -> (Vertex) id).iterator();
-            } else {
-                final Class<?> firstClass = vertexIds[0].getClass();
-                if (!Stream.of(vertexIds).map(Object::getClass).allMatch(firstClass::equals))
-                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();     // todo: change exception to be ids of the same type
-                return Stream.of(vertexIds).map(vertexIdManager::convert).map(this.vertices::get).filter(Objects::nonNull).iterator();
-            }
-        }
+        return createElementIterator(Vertex.class, vertices, vertexIdManager, vertexIds);
     }
 
     @Override
     public Iterator<Edge> edges(final Object... edgeIds) {
-        if (0 == edgeIds.length) {
-            return this.edges.values().iterator();
-        } else if (1 == edgeIds.length) {
-            if (edgeIds[0] instanceof Edge) {
+        // todo: what if we have Reference/DetachedVertex???????????????????????????
+        return createElementIterator(Edge.class, edges, edgeIdManager, edgeIds);
+    }
+
+    private <T extends Element> Iterator<T> createElementIterator(final Class<T> clazz, final Map<Object, T> elements,
+                                                                  final IdManager idManager,
+                                                                  final Object... ids) {
+        if (0 == ids.length) {
+            return elements.values().iterator();
+        } else if (1 == ids.length) {
+            if (clazz.isAssignableFrom(ids[0].getClass())) {
                 // no need to get the edge again, so just flip it back - some implementation may want to treat this
                 // as a refresh operation. that's not necessary for tinkergraph.
-                return IteratorUtils.of((Edge) edgeIds[0]);
+                return IteratorUtils.of((T) ids[0]);
             } else {
                 // convert the id to the expected data type and lookup the vertex
-                final Edge edge = this.edges.get(edgeIdManager.convert(edgeIds[0]));
-                return null == edge ? Collections.emptyIterator() : IteratorUtils.of(edge);
+                final T element = elements.get(idManager.convert(ids[0]));
+                return null == element ? Collections.emptyIterator() : IteratorUtils.of(element);
             }
         } else {
             // base the conversion function on the first item in the id list as the expectation is that these
             // id values will be a uniform list
-            if (edgeIds[0] instanceof Edge) {
+            if (clazz.isAssignableFrom(ids[0].getClass())) {
                 // based on the first item assume all vertices in the argument list
-                if (!Stream.of(edgeIds).allMatch(id -> id instanceof Edge))
+                if (!Stream.of(ids).allMatch(id -> clazz.isAssignableFrom(id.getClass())))
                     throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
 
                 // no need to get the vertices again, so just flip it back - some implementation may want to treat this
                 // as a refresh operation. that's not necessary for tinkergraph.
-                return Stream.of(edgeIds).map(id -> (Edge) id).iterator();
+                return Stream.of(ids).map(id -> (T) id).iterator();
             } else {
-                final Class<?> firstClass = edgeIds[0].getClass();
-                if (!Stream.of(edgeIds).map(Object::getClass).allMatch(firstClass::equals))
+                final Class<?> firstClass = ids[0].getClass();
+                if (!Stream.of(ids).map(Object::getClass).allMatch(firstClass::equals))
                     throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();     // todo: change exception to be ids of the same type
-                return Stream.of(edgeIds).map(edgeIdManager::convert).map(this.edges::get).filter(Objects::nonNull).iterator();
+                return Stream.of(ids).map(id -> idManager.convert(id)).map(elements::get).filter(Objects::nonNull).iterator();
             }
         }
     }


[20/43] incubator-tinkerpop git commit: Generate numeric ids from the owning TinkerGraph instance.

Posted by sp...@apache.org.
Generate numeric ids from the owning TinkerGraph instance.

The enum should haven't have been maintaining the counters.


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

Branch: refs/heads/master
Commit: b67712a9d6c0f532c8333ab93c87112aba2a19a0
Parents: 16d97e0
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 16:53:41 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 16:53:41 2015 -0400

----------------------------------------------------------------------
 .../gremlin/tinkergraph/structure/TinkerGraph.java    | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/b67712a9/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 25b3a3e..1d26304 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -42,6 +42,7 @@ import java.util.Objects;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.UnaryOperator;
 import java.util.stream.Stream;
 
@@ -75,7 +76,7 @@ public class TinkerGraph implements Graph {
     public static final String CONFIG_EDGE_ID = "tinkergraph.edge.id";
     public static final String CONFIG_VERTEX_PROPERTY_ID = "tinkergraph.vertex-property.id";
 
-    protected Long currentId = -1l;
+    protected AtomicLong currentId = new AtomicLong(-1l);
     protected Map<Object, Vertex> vertices = new ConcurrentHashMap<>();
     protected Map<Object, Edge> edges = new ConcurrentHashMap<>();
 
@@ -217,7 +218,7 @@ public class TinkerGraph implements Graph {
         this.vertices.clear();
         this.edges.clear();
         this.variables = null;
-        this.currentId = 0l;
+        this.currentId.set(-1l);
         this.vertexIndex = null;
         this.edgeIndex = null;
     }
@@ -480,10 +481,9 @@ public class TinkerGraph implements Graph {
          * {@link Long} and will also attempt to convert {@code String} values
          */
         LONG {
-            private long currentId = -1l;
             @Override
             public Long getNextId(final TinkerGraph graph) {
-                return Stream.generate(() -> (++currentId)).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
+                return Stream.generate(() -> (graph.currentId.incrementAndGet())).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
             }
 
             @Override
@@ -502,10 +502,9 @@ public class TinkerGraph implements Graph {
          * {@link Integer} and will also attempt to convert {@code String} values
          */
         INTEGER {
-            private int currentId = -1;
             @Override
             public Integer getNextId(final TinkerGraph graph) {
-                return Stream.generate(() -> (++currentId)).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
+                return Stream.generate(() -> (graph.currentId.incrementAndGet())).map(Long::intValue).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
             }
 
             @Override
@@ -547,10 +546,9 @@ public class TinkerGraph implements Graph {
          * {@link TinkerGraph}, it will generate {@link Long} values for identifiers.
          */
         ANY {
-            private long currentId = -1l;
             @Override
             public Long getNextId(final TinkerGraph graph) {
-                return Stream.generate(() -> (++currentId)).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
+                return Stream.generate(() -> (graph.currentId.incrementAndGet())).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
             }
 
             @Override


[23/43] incubator-tinkerpop git commit: Improved error messaging in exception of IdManager.

Posted by sp...@apache.org.
Improved error messaging in exception of IdManager.


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

Branch: refs/heads/master
Commit: ef5f8f01b44b0a4da640bf59e6a18c6a09d33c37
Parents: fe106ad
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 09:13:06 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 09:13:06 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ef5f8f01/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 339d677..9cc7501 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -495,7 +495,7 @@ public class TinkerGraph implements Graph {
                 else if (id instanceof String)
                     return Long.parseLong((String) id);
                 else
-                    throw new IllegalArgumentException("Expected an id that is convertible to Long");
+                    throw new IllegalArgumentException(String.format("Expected an id that is convertible to Long but received %s", id.getClass()));
             }
         },
 
@@ -518,7 +518,7 @@ public class TinkerGraph implements Graph {
                 else if (id instanceof String)
                     return Integer.parseInt((String) id);
                 else
-                    throw new IllegalArgumentException("Expected an id that is convertible to Integer");
+                    throw new IllegalArgumentException(String.format("Expected an id that is convertible to Integer but received %s", id.getClass()));
             }
         },
 
@@ -539,7 +539,7 @@ public class TinkerGraph implements Graph {
                 else if (id instanceof String)
                     return java.util.UUID.fromString((String) id);
                 else
-                    throw new IllegalArgumentException("Expected an id that is convertible to UUID");
+                    throw new IllegalArgumentException(String.format("Expected an id that is convertible to UUID but received %s", id.getClass()));
             }
         },
 


[41/43] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into TINKERPOP3-581

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into TINKERPOP3-581


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

Branch: refs/heads/master
Commit: b1e30ff4e23a345e81255fe32a31ba2c6fd361ed
Parents: fed4ac8 8806a27
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Apr 13 06:58:21 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Apr 13 06:58:21 2015 -0400

----------------------------------------------------------------------
 docs/preprocessor/preprocess.sh                         | 12 +++++++++---
 .../groovy/jsr223/GremlinGroovyScriptEngine.java        |  4 ++--
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[18/43] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master' into TINKERPOP3-581

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master' into TINKERPOP3-581


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

Branch: refs/heads/master
Commit: b86c46645055cb34faa61d72fa0d81db01679115
Parents: 0559f8f 5575ab6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 15:54:23 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 15:54:23 2015 -0400

----------------------------------------------------------------------
 .../computer/traversal/TraverserExecutor.java   |   5 +-
 .../structure/StructureStandardSuite.java       |   6 +-
 .../util/detached/DetachedEdgeTest.java         |  17 +++
 .../util/detached/DetachedVertexTest.java       |  15 ++
 .../util/reference/ReferenceEdgeTest.java       | 152 +++++++++++++++++++
 .../util/reference/ReferenceVertexTest.java     |  18 ++-
 .../structure/util/star/StarGraphTest.java      |  49 +++++-
 7 files changed, 256 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[13/43] incubator-tinkerpop git commit: Fix up StarGraph to work within the context of TINKERPOP3-581

Posted by sp...@apache.org.
Fix up StarGraph to work within the context of TINKERPOP3-581

Make it so that StartGraph can properly handle g.vertices(v) and g.edges(e1).


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

Branch: refs/heads/master
Commit: a0fec7a68df53a9224095fc831a633a89560eec0
Parents: 9a877b7
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 15:12:36 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 15:12:36 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/util/star/StarGraph.java  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/a0fec7a6/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
index 335bd16..ee29470 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
@@ -91,6 +91,8 @@ public final class StarGraph implements Graph {
     public Iterator<Vertex> vertices(final Object... vertexIds) {
         if (null == this.starVertex)
             return Collections.emptyIterator();
+        else if (vertexIds.length > 0 && vertexIds[0] instanceof StarVertex)
+            return Stream.of(vertexIds).map(v -> (Vertex) v).iterator();  // todo: maybe do this better - not sure of star semantics here
         else if (ElementHelper.idExists(this.starVertex.id(), vertexIds))
             return IteratorUtils.of(this.starVertex);
         else
@@ -121,7 +123,13 @@ public final class StarGraph implements Graph {
                         this.starVertex.inEdges.values().stream(),
                         this.starVertex.outEdges.values().stream())
                         .flatMap(List::stream)
-                        .filter(edge -> ElementHelper.idExists(edge.id(), edgeIds))
+                        .filter(edge -> {
+                            // todo: kinda fishy - need to better nail down how stuff should work here - none of these feel consistent right now.
+                            if (edgeIds.length > 0 && edgeIds[0] instanceof Edge)
+                                return ElementHelper.idExists(edge.id(), Stream.of(edgeIds).map(e -> ((Edge) e).id()).toArray());
+                            else
+                                return ElementHelper.idExists(edge.id(), edgeIds);
+                        })
                         .iterator();
     }
 


[24/43] incubator-tinkerpop git commit: In this branch, g.V() doesn't accept a Traverser so correct syntax of performance test.

Posted by sp...@apache.org.
In this branch, g.V() doesn't accept a Traverser so correct syntax of performance test.

Not sure if g.V() should accept Traverser.  Unclear how this was working in master.  It does show that more tests are necessary in standard process tests.


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

Branch: refs/heads/master
Commit: 78d27103f0671ea2f3ecaa03366e5f9626971e2a
Parents: ef5f8f0
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 09:29:06 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 09:29:06 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/process/TraversalPerformanceTest.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/78d27103/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
index 2953464..0606409 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/TraversalPerformanceTest.java
@@ -101,7 +101,8 @@ public class TraversalPerformanceTest extends AbstractGremlinTest {
     @LoadGraphWith(LoadGraphWith.GraphData.GRATEFUL)
     @Test
     public void g_V_out_mapXout_out_valuesXnameX_toListX() throws Exception {
-        g.V().out().map(v -> g.V(v).out().out().values("name").toList()).iterate();
+        // todo: this used to be g.V().out().map(v -> g.V(v).out().out().values("name").toList()).iterate(); - should g.V() accept Traverser??
+        g.V().out().map(v -> g.V(v.get()).out().out().values("name").toList()).iterate();
     }
 
     @BenchmarkOptions(benchmarkRounds = DEFAULT_BENCHMARK_ROUNDS, warmupRounds = DEFAULT_WARMUP_ROUNDS, concurrency = BenchmarkOptions.CONCURRENCY_SEQUENTIAL)


[34/43] incubator-tinkerpop git commit: Remove todo - already implemented properly.

Posted by sp...@apache.org.
Remove todo - already implemented properly.


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

Branch: refs/heads/master
Commit: ce1aeaecce880ef5cd97497c3ad391ae552607c3
Parents: 01f930b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Apr 10 13:01:44 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Apr 10 13:01:44 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/ce1aeaec/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index dda6ad2..07cab24 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -276,7 +276,7 @@ public class TinkerGraph implements Graph {
             } else {
                 final Class<?> firstClass = ids[0].getClass();
                 if (!Stream.of(ids).map(Object::getClass).allMatch(firstClass::equals))
-                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();     // todo: change exception to be ids of the same type
+                    throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
                 return Stream.of(ids).map(id -> idManager.convert(id)).map(elements::get).filter(Objects::nonNull).iterator();
             }
         }


[19/43] incubator-tinkerpop git commit: Add javadoc to the TinkerGraph.DefaultIdManager.

Posted by sp...@apache.org.
Add javadoc to the TinkerGraph.DefaultIdManager.


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

Branch: refs/heads/master
Commit: 16d97e0772fbd9375fd9e2b1e54308e6158dd236
Parents: b86c466
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 16:07:48 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 16:07:48 2015 -0400

----------------------------------------------------------------------
 .../tinkergraph/structure/TinkerGraph.java      | 65 ++++++++------------
 1 file changed, 24 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/16d97e07/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 31ff696..25b3a3e 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -450,47 +450,6 @@ public class TinkerGraph implements Graph {
         }
     }
 
-    ///////////// HELPERS METHODS ///////////////
-
-    /**
-     * Function to coerce a provided identifier to a different type given the expected id type of an element.
-     * This allows something like {@code g.V(1,2,3)} and {@code g.V(1l,2l,3l)} to both mean the same thing.
-     */
-    private UnaryOperator<Object> convertToId(final Object id, final Class<?> elementIdClass) {
-        if (id instanceof Number) {
-            if (elementIdClass != null) {
-                if (elementIdClass.equals(Long.class)) {
-                    return o -> ((Number) o).longValue();
-                } else if (elementIdClass.equals(Integer.class)) {
-                    return o -> ((Number) o).intValue();
-                } else if (elementIdClass.equals(Double.class)) {
-                    return o -> ((Number) o).doubleValue();
-                } else if (elementIdClass.equals(Float.class)) {
-                    return o -> ((Number) o).floatValue();
-                } else if (elementIdClass.equals(String.class)) {
-                    return o -> o.toString();
-                }
-            }
-        } else if (id instanceof String) {
-            if (elementIdClass != null) {
-                final String s = (String) id;
-                if (elementIdClass.equals(Long.class)) {
-                    return o -> Long.parseLong(s);
-                } else if (elementIdClass.equals(Integer.class)) {
-                    return o -> Integer.parseInt(s);
-                } else if (elementIdClass.equals(Double.class)) {
-                    return o -> Double.parseDouble(s);
-                } else if (elementIdClass.equals(Float.class)) {
-                    return o -> Float.parseFloat(s);
-                } else if (elementIdClass.equals(UUID.class)) {
-                    return o -> UUID.fromString(s);
-                }
-            }
-        }
-
-        return UnaryOperator.identity();
-    }
-
     /**
      * TinkerGraph will use an implementation of this interface to generate identifiers when a user does not supply
      * them and to handle identifier conversions when querying to provide better flexibility with respect to
@@ -512,7 +471,14 @@ public class TinkerGraph implements Graph {
         T convert(final Object id);
     }
 
+    /**
+     * A default set of {@link IdManager} implementations for common identifier types.
+     */
     public enum DefaultIdManager implements IdManager {
+        /**
+         * Manages identifiers of type {@code Long}. Will convert any class that extends from {@link Number} to a
+         * {@link Long} and will also attempt to convert {@code String} values
+         */
         LONG {
             private long currentId = -1l;
             @Override
@@ -530,6 +496,11 @@ public class TinkerGraph implements Graph {
                     throw new IllegalArgumentException("Expected an id that is convertible to Long");
             }
         },
+
+        /**
+         * Manages identifiers of type {@code Integer}. Will convert any class that extends from {@link Number} to a
+         * {@link Integer} and will also attempt to convert {@code String} values
+         */
         INTEGER {
             private int currentId = -1;
             @Override
@@ -547,6 +518,11 @@ public class TinkerGraph implements Graph {
                     throw new IllegalArgumentException("Expected an id that is convertible to Integer");
             }
         },
+
+        /**
+         * Manages identifiers of type {@link java.util.UUID}. Will convert {@code String} values to
+         * {@link java.util.UUID}.
+         */
         UUID {
             @Override
             public UUID getNextId(final TinkerGraph graph) {
@@ -563,6 +539,13 @@ public class TinkerGraph implements Graph {
                     throw new IllegalArgumentException("Expected an id that is convertible to UUID");
             }
         },
+
+        /**
+         * Manages identifiers of any type.  This represents the default way {@link TinkerGraph} has always worked.
+         * In other words, there is no identifier conversion so if the identifier of a vertex is a {@code Long}, then
+         * trying to request it with an {@code Integer} will have no effect. Also, like the original
+         * {@link TinkerGraph}, it will generate {@link Long} values for identifiers.
+         */
         ANY {
             private long currentId = -1l;
             @Override


[15/43] incubator-tinkerpop git commit: Corrected broken tests in gremlin-driver related to some hard-coded ids that no longer applied.

Posted by sp...@apache.org.
Corrected broken tests in gremlin-driver related to some hard-coded ids that no longer applied.


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

Branch: refs/heads/master
Commit: 85e1a7145ddf3471b03790351554ff7dd13a7463
Parents: 869d32b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 15:44:40 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 15:44:40 2015 -0400

----------------------------------------------------------------------
 .../gremlin/driver/ser/GryoMessageSerializerV1D0Test.java      | 6 +++---
 .../driver/ser/JsonMessageSerializerGremlinV1d0Test.java       | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/85e1a714/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
index 1403c98..a3ea433 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/GryoMessageSerializerV1D0Test.java
@@ -171,14 +171,14 @@ public class GryoMessageSerializerV1D0Test {
         assertEquals(1, edgeList.size());
 
         final DetachedEdge deserializedEdge = edgeList.get(0);
-        assertEquals(2l, deserializedEdge.id());
+        assertEquals(e.id(), deserializedEdge.id());
         assertEquals("test", deserializedEdge.label());
 
         assertEquals(123, deserializedEdge.values("abc").next());
         assertEquals(1, IteratorUtils.count(deserializedEdge.properties()));
-        assertEquals(0l, deserializedEdge.outVertex().id());
+        assertEquals(v1.id(), deserializedEdge.outVertex().id());
         assertEquals(Vertex.DEFAULT_LABEL, deserializedEdge.outVertex().label());
-        assertEquals(1l, deserializedEdge.inVertex().id());
+        assertEquals(v2.id(), deserializedEdge.inVertex().id());
         assertEquals(Vertex.DEFAULT_LABEL, deserializedEdge.inVertex().label());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/85e1a714/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java
index 85c669e..907915f 100644
--- a/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java
+++ b/gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/JsonMessageSerializerGremlinV1d0Test.java
@@ -183,7 +183,7 @@ public class JsonMessageSerializerGremlinV1d0Test {
         assertEquals(1, vertexList.size());
 
         final Map<String, Object> deserializedVertex = vertexList.get(0);
-        assertEquals(0l, deserializedVertex.get(GraphSONTokens.ID));
+        assertEquals(v.id(), deserializedVertex.get(GraphSONTokens.ID));
         assertEquals(Vertex.DEFAULT_LABEL, deserializedVertex.get(GraphSONTokens.LABEL));
 
         final Map<String, Object> properties = (Map<String, Object>) deserializedVertex.get(GraphSONTokens.PROPERTIES);


[04/43] incubator-tinkerpop git commit: Correct test names.

Posted by sp...@apache.org.
Correct test names.


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

Branch: refs/heads/master
Commit: 66d981c1f4f465e90ad092ccca3b696a9badc842
Parents: 9886d77
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 8 09:28:46 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 8 09:28:46 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/FeatureSupportTest.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/66d981c1/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
index f4969ba..8efa620 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/FeatureSupportTest.java
@@ -254,14 +254,14 @@ public class FeatureSupportTest {
         public void shouldSupportStringIdsIfStringIdsAreGeneratedFromTheGraph() throws Exception {
             final Vertex v = graph.addVertex();
             if (v.id() instanceof String)
-                fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_STRING_IDS));
+                fail(String.format(INVALID_git FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_STRING_IDS));
         }
 
         @Test
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_UUID_IDS, supported = false)
-        public void shouldSupportStringIdsIfUuidIdsAreGeneratedFromTheGraph() throws Exception {
+        public void shouldSupportUuidIdsIfUuidIdsAreGeneratedFromTheGraph() throws Exception {
             final Vertex v = graph.addVertex();
             if (v.id() instanceof UUID)
                 fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_UUID_IDS));
@@ -271,7 +271,7 @@ public class FeatureSupportTest {
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false)
         @FeatureRequirement(featureClass = VertexFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false)
-        public void shouldSupportStringIdsIfNumericIdsAreGeneratedFromTheGraph() throws Exception {
+        public void shouldSupportNumericIdsIfNumericIdsAreGeneratedFromTheGraph() throws Exception {
             final Vertex v = graph.addVertex();
             if (v.id() instanceof Number)
                 fail(String.format(INVALID_FEATURE_SPECIFICATION, VertexFeatures.class.getSimpleName(), FEATURE_NUMERIC_IDS));
@@ -378,7 +378,7 @@ public class FeatureSupportTest {
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = EdgeFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false)
         @FeatureRequirement(featureClass = EdgeFeatures.class, feature = FEATURE_UUID_IDS, supported = false)
-        public void shouldSupportStringIdsIfUuidIdsAreGeneratedFromTheGraph() throws Exception {
+        public void shouldSupportUuidIdsIfUuidIdsAreGeneratedFromTheGraph() throws Exception {
             final Vertex v = graph.addVertex();
             final Edge e = v.addEdge("knows", v);
             if (e.id() instanceof UUID)
@@ -390,7 +390,7 @@ public class FeatureSupportTest {
         @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
         @FeatureRequirement(featureClass = EdgeFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS, supported = false)
         @FeatureRequirement(featureClass = EdgeFeatures.class, feature = FEATURE_NUMERIC_IDS, supported = false)
-        public void shouldSupportStringIdsIfNumericIdsAreGeneratedFromTheGraph() throws Exception {
+        public void shouldSupportNumericIdsIfNumericIdsAreGeneratedFromTheGraph() throws Exception {
             final Vertex v = graph.addVertex();
             final Edge e = v.addEdge("knows", v);
             if (e.id() instanceof Number)


[10/43] incubator-tinkerpop git commit: Major refactoring of TinkerGraph to get id management consistent. TINKERPOP3-581

Posted by sp...@apache.org.
Major refactoring of TinkerGraph to get id management consistent. TINKERPOP3-581

Introduced an IdManager interface to help control id conversions and explicity id management within TinkerGraph.  This allowed all tests to pass that involved the above refenced ticket.  Still have a broken test in hadoop-graph to debug.  Lots of cleanup to do yet.


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

Branch: refs/heads/master
Commit: 3cc550e25b420df62612d9f7c86b4452d70706cd
Parents: 59028c8
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Apr 9 14:42:12 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 9 14:42:12 2015 -0400

----------------------------------------------------------------------
 .../strategy/decoration/ElementIdStrategy.java  |   8 +-
 .../engine/GremlinExecutorPerformanceTest.java  |   2 +-
 .../gremlin/AbstractGraphProvider.java          |   9 +-
 .../tinkerpop/gremlin/AbstractGremlinSuite.java |   2 +-
 .../tinkerpop/gremlin/AbstractGremlinTest.java  |  13 +-
 .../apache/tinkerpop/gremlin/GraphProvider.java |  23 ++-
 .../generator/CommunityGeneratorTest.java       |   4 +-
 .../generator/DistributionGeneratorTest.java    |   6 +-
 .../traversal/step/sideEffect/SubgraphTest.java |   4 +-
 .../structure/GraphConstructionTest.java        |   4 +-
 .../tinkerpop/gremlin/structure/GraphTest.java  |   4 +-
 .../tinkerpop/gremlin/structure/IoTest.java     |  31 ++--
 .../gremlin/structure/TransactionTest.java      |   2 +-
 .../gremlin/hadoop/structure/HadoopGraph.java   |  45 ++++-
 .../gremlin/hadoop/HadoopGraphProvider.java     |   4 +-
 .../tinkergraph/structure/TinkerGraph.java      | 173 ++++++++++++++++---
 .../tinkergraph/structure/TinkerHelper.java     |  43 +----
 .../tinkergraph/structure/TinkerVertex.java     |  10 +-
 .../structure/TinkerVertexProperty.java         |   2 +-
 .../tinkergraph/TinkerGraphProvider.java        |  58 ++++++-
 20 files changed, 307 insertions(+), 140 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
index ec47787..d84073d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
@@ -80,13 +80,11 @@ public final class ElementIdStrategy extends AbstractTraversalStrategy {
             // note that it is then only necessary to replace the step if the id is a non-element.  other tests
             // in the suite validate that items in getIds() is uniform so it is ok to just test the first item
             // in the list.
-            if (graphStep.getIds().length > 0) {
+            if (graphStep.getIds().length > 0 && !(graphStep.getIds()[0] instanceof Element)) {
                 if (graphStep instanceof HasContainerHolder) {
-                    if (!(graphStep.getIds()[0] instanceof Element))
-                        ((HasContainerHolder) graphStep).addHasContainer(new HasContainer(this.idPropertyKey, Contains.within, Arrays.asList(graphStep.getIds())));
+                    ((HasContainerHolder) graphStep).addHasContainer(new HasContainer(this.idPropertyKey, Contains.within, Arrays.asList(graphStep.getIds())));
                 } else {
-                    if (!(graphStep.getIds()[0] instanceof Element))
-                        TraversalHelper.insertAfterStep(new HasStep(traversal, new HasContainer(this.idPropertyKey, Contains.within, Arrays.asList(graphStep.getIds()))), graphStep, traversal);
+                    TraversalHelper.insertAfterStep(new HasStep(traversal, new HasContainer(this.idPropertyKey, Contains.within, Arrays.asList(graphStep.getIds()))), graphStep, traversal);
                 }
                 graphStep.clearIds();
             }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java
index 5378141..651aaab 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorPerformanceTest.java
@@ -68,7 +68,7 @@ public class GremlinExecutorPerformanceTest extends AbstractGremlinTest {
     public void setup() throws Exception {
         super.setup();
         syntaxGraphConfig = graphProvider.newGraphConfiguration("gremlin-executor-test",
-                GremlinExecutorPerformanceTest.class, testName.getMethodName());
+                GremlinExecutorPerformanceTest.class, testName.getMethodName(), null);
         syntaxGraph = graphProvider.openTestGraph(syntaxGraphConfig);
         generator = new GremlinGenerator(syntaxGraph, rand);
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
index b27ab72..8fe041b 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGraphProvider.java
@@ -52,17 +52,19 @@ public abstract class AbstractGraphProvider implements GraphProvider {
      * @param graphName      a value that represents a unique configuration for a graph
      * @param test           the test class
      * @param testMethodName the name of the test method
+     * @param loadGraphWith  the data set to load and will be null if no data is to be loaded
      * @return a configuration {@link java.util.Map} that should be unique per the {@code graphName}
      */
     public abstract Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test,
-                                                             final String testMethodName);
+                                                             final String testMethodName, final LoadGraphWith.GraphData loadGraphWith);
 
     @Override
     public Configuration newGraphConfiguration(final String graphName, final Class<?> test,
                                                final String testMethodName,
-                                               final Map<String, Object> configurationOverrides) {
+                                               final Map<String, Object> configurationOverrides,
+                                               final LoadGraphWith.GraphData loadGraphWith) {
         final Configuration conf = new BaseConfiguration();
-        getBaseConfiguration(graphName, test, testMethodName).entrySet().stream()
+        getBaseConfiguration(graphName, test, testMethodName, loadGraphWith).entrySet().stream()
                 .forEach(e -> conf.setProperty(e.getKey(), e.getValue()));
 
         // assign overrides but don't allow gremlin.graph setting to be overridden.  the test suite should
@@ -84,6 +86,7 @@ public abstract class AbstractGraphProvider implements GraphProvider {
         }
     }
 
+    // todo: these aren't used - remove???
     protected static void deleteDirectory(final File directory) {
         if (directory.exists()) {
             for (File file : directory.listFiles()) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
index 4ab600f..3d02968 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinSuite.java
@@ -145,7 +145,7 @@ public abstract class AbstractGremlinSuite extends Suite {
         final Set<Class> implementations = graphProvider.getImplementations();
         final Set<Class> noImplementationRegistered = new HashSet<>();
 
-        final Configuration conf = graphProvider.newGraphConfiguration("prototype", AbstractGremlinSuite.class, "validateStructureInterfacesRegistered");
+        final Configuration conf = graphProvider.newGraphConfiguration("prototype", AbstractGremlinSuite.class, "validateStructureInterfacesRegistered", null);
         final Graph graph = graphProvider.openTestGraph(conf);
         final Set<Class> structureInterfaces = new HashSet<>(STRUCTURE_INTERFACES);
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
index b1fcc42..7c17c4a 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/AbstractGremlinTest.java
@@ -65,22 +65,22 @@ public abstract class AbstractGremlinTest {
 
     @Before
     public void setup() throws Exception {
+        final Method testMethod = this.getClass().getMethod(cleanMethodName(name.getMethodName()));
+        final LoadGraphWith[] loadGraphWiths = testMethod.getAnnotationsByType(LoadGraphWith.class);
+        final LoadGraphWith loadGraphWith = loadGraphWiths.length == 0 ? null : loadGraphWiths[0];
+        final LoadGraphWith.GraphData loadGraphWithData = null == loadGraphWith ? null : loadGraphWith.value();
+
         graphProvider = GraphManager.getGraphProvider();
-        config = graphProvider.standardGraphConfiguration(this.getClass(), name.getMethodName());
+        config = graphProvider.standardGraphConfiguration(this.getClass(), name.getMethodName(), loadGraphWithData);
 
         // this should clear state from a previously unfinished test. since the graph does not yet exist,
         // persisted graphs will likely just have their directories removed
         graphProvider.clear(config);
 
-        // not sure how the strategy can ever be null, but it seems to happen in the performance tests
         graph = graphProvider.openTestGraph(config);
         g = graphProvider.traversal(graph);
         graphComputerClass = g.getGraphComputer().isPresent() ? Optional.of(g.getGraphComputer().get().getClass()) : Optional.empty();
 
-        final Method testMethod = this.getClass().getMethod(cleanMethodName(name.getMethodName()));
-
-        final LoadGraphWith[] loadGraphWiths = testMethod.getAnnotationsByType(LoadGraphWith.class);
-
         // get feature requirements on the test method and add them to the list of ones to check
         final FeatureRequirement[] featureRequirement = testMethod.getAnnotationsByType(FeatureRequirement.class);
         final List<FeatureRequirement> frs = new ArrayList<>(Arrays.asList(featureRequirement));
@@ -110,7 +110,6 @@ public abstract class AbstractGremlinTest {
         beforeLoadGraphWith(graph);
 
         // load a graph with sample data if the annotation is present on the test
-        final LoadGraphWith loadGraphWith = loadGraphWiths.length == 0 ? null : loadGraphWiths[0];
         graphProvider.loadGraphData(graph, loadGraphWith, this.getClass(), name.getMethodName());
 
         afterLoadGraphWith(graph);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
index da355b9..3b80820 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/GraphProvider.java
@@ -104,17 +104,17 @@ public interface GraphProvider {
 
     /**
      * Creates a new {@link org.apache.tinkerpop.gremlin.structure.Graph} instance using the default
-     * {@link org.apache.commons.configuration.Configuration} from {@link #standardGraphConfiguration(Class, String)}.
+     * {@link org.apache.commons.configuration.Configuration} from {@link #standardGraphConfiguration(Class, String, LoadGraphWith.GraphData)}.
      * The default implementation converts the passes the
      */
-    default public Graph standardTestGraph(final Class<?> test, final String testMethodName) {
-        return GraphFactory.open(standardGraphConfiguration(test, testMethodName));
+    default public Graph standardTestGraph(final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) {
+        return GraphFactory.open(standardGraphConfiguration(test, testMethodName, loadGraphWith));
     }
 
     /**
      * Creates a new {@link org.apache.tinkerpop.gremlin.structure.Graph} instance from the Configuration object using
      * {@link org.apache.tinkerpop.gremlin.structure.util.GraphFactory}. The assumption here is that the {@code Configuration}
-     * has been created by one of the {@link #newGraphConfiguration(String, Class, String)} methods and has therefore
+     * has been created by one of the {@link #newGraphConfiguration(String, Class, String, LoadGraphWith.GraphData)} methods and has therefore
      * already been modified by the implementation as necessary for {@link Graph} creation.
      */
     default public Graph openTestGraph(final Configuration config) {
@@ -127,8 +127,8 @@ public interface GraphProvider {
      * should always return a configuration instance that generates the same {@link org.apache.tinkerpop.gremlin.structure.Graph} from the
      * {@link org.apache.tinkerpop.gremlin.structure.util.GraphFactory}.
      */
-    default public Configuration standardGraphConfiguration(final Class<?> test, final String testMethodName) {
-        return newGraphConfiguration("standard", test, testMethodName, Collections.<String, Object>emptyMap());
+    default public Configuration standardGraphConfiguration(final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) {
+        return newGraphConfiguration("standard", test, testMethodName, Collections.<String, Object>emptyMap(), loadGraphWith);
     }
 
     /**
@@ -179,11 +179,13 @@ public interface GraphProvider {
      * @param test                   the test class
      * @param testMethodName         the name of the test
      * @param configurationOverrides settings to override defaults with.
+     * @param loadGraphWith  the data set to load and will be null if no data is to be loaded
      */
     public Configuration newGraphConfiguration(final String graphName,
                                                final Class<?> test,
                                                final String testMethodName,
-                                               final Map<String, Object> configurationOverrides);
+                                               final Map<String, Object> configurationOverrides,
+                                               final LoadGraphWith.GraphData loadGraphWith);
 
     /**
      * When implementing this method ensure that a test suite can override any settings EXCEPT the
@@ -193,11 +195,13 @@ public interface GraphProvider {
      * @param graphName      a unique test graph name
      * @param test           the test class
      * @param testMethodName the name of the test
+     * @param loadGraphWith  the data set to load and will be null if no data is to be loaded
      */
     default public Configuration newGraphConfiguration(final String graphName,
                                                        final Class<?> test,
-                                                       final String testMethodName) {
-        return newGraphConfiguration(graphName, test, testMethodName, new HashMap<>());
+                                                       final String testMethodName,
+                                                       final LoadGraphWith.GraphData loadGraphWith) {
+        return newGraphConfiguration(graphName, test, testMethodName, new HashMap<>(), loadGraphWith);
     }
 
     /**
@@ -231,6 +235,7 @@ public interface GraphProvider {
      * @return The reconstituted identifier.
      */
     public default <ID> ID reconstituteGraphSONIdentifier(final Class<? extends Element> clazz, final Object id) {
+        // todo: do we still need this?
         return (ID) id;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java
index 8414bd5..7102ce5 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/CommunityGeneratorTest.java
@@ -82,7 +82,7 @@ public class CommunityGeneratorTest {
         @Test
         @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
         public void shouldGenerateDifferentGraph() throws Exception {
-            final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName(), null);
             final Graph graph1 = graphProvider.openTestGraph(configuration);
 
             try {
@@ -111,7 +111,7 @@ public class CommunityGeneratorTest {
         @Test
         @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
         public void shouldGenerateSameGraph() throws Exception {
-            final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName(), null);
             final Graph graph1 = graphProvider.openTestGraph(configuration);
 
             try {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java
index d0f3d96..2ca996c 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/algorithm/generator/DistributionGeneratorTest.java
@@ -75,10 +75,10 @@ public class DistributionGeneratorTest {
             // try this a few times because it's possible that the distribution generator is not random enough.
             // if it doesn't generate a random one after 5 times then there must be a problem
             do {
-                final Configuration configuration1 = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName());
+                final Configuration configuration1 = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName(), null);
                 final Graph g1 = graphProvider.openTestGraph(configuration1);
 
-                final Configuration configuration2 = graphProvider.newGraphConfiguration("g2", this.getClass(), name.getMethodName());
+                final Configuration configuration2 = graphProvider.newGraphConfiguration("g2", this.getClass(), name.getMethodName(), null);
                 final Graph g2 = graphProvider.openTestGraph(configuration2);
 
                 try {
@@ -112,7 +112,7 @@ public class DistributionGeneratorTest {
         @Test
         @FeatureRequirementSet(FeatureRequirementSet.Package.SIMPLE)
         public void shouldGenerateSameGraph() throws Exception {
-            final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName(), null);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             try {
                 final Iterable<Vertex> vordered = verticesByOid(graph);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphTest.java
index 14f905b..99aae9f 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/SubgraphTest.java
@@ -55,7 +55,7 @@ public abstract class SubgraphTest extends AbstractGremlinProcessTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
     public void g_V_withSideEffectXsgX_outEXknowsX_subgraphXsgX_name_capXsgX() throws Exception {
-        final Configuration config = graphProvider.newGraphConfiguration("subgraph", this.getClass(), name.getMethodName());
+        final Configuration config = graphProvider.newGraphConfiguration("subgraph", this.getClass(), name.getMethodName(), MODERN);
         graphProvider.clear(config);
         Graph subgraph = graphProvider.openTestGraph(config);
         /////
@@ -87,7 +87,7 @@ public abstract class SubgraphTest extends AbstractGremlinProcessTest {
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = FEATURE_USER_SUPPLIED_IDS)
     public void g_V_withSideEffectXsgX_repeatXbothEXcreatedX_subgraphXsgX_outVX_timesX5X_name_dedup() throws Exception {
-        final Configuration config = graphProvider.newGraphConfiguration("subgraph", this.getClass(), name.getMethodName());
+        final Configuration config = graphProvider.newGraphConfiguration("subgraph", this.getClass(), name.getMethodName(), MODERN);
         graphProvider.clear(config);
         final Graph subgraph = graphProvider.openTestGraph(config);
         /////

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphConstructionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphConstructionTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphConstructionTest.java
index bfde55e..2131159 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphConstructionTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphConstructionTest.java
@@ -43,7 +43,7 @@ public class GraphConstructionTest extends AbstractGremlinTest {
     @Test
     public void shouldOpenGraphThroughGraphFactoryViaApacheConfig() throws Exception {
         final Graph expectedGraph = graph;
-        final Configuration c = graphProvider.newGraphConfiguration("temp1", this.getClass(), name.getMethodName());
+        final Configuration c = graphProvider.newGraphConfiguration("temp1", this.getClass(), name.getMethodName(), null);
         final Graph createdGraph = GraphFactory.open(c);
 
         assertNotNull(createdGraph);
@@ -65,7 +65,7 @@ public class GraphConstructionTest extends AbstractGremlinTest {
      */
     @Test
     public void shouldMaintainOriginalConfigurationObjectGivenToFactory() {
-        final Configuration originalConfig = graphProvider.newGraphConfiguration("temp2", this.getClass(), name.getMethodName());
+        final Configuration originalConfig = graphProvider.newGraphConfiguration("temp2", this.getClass(), name.getMethodName(), null);
         final Graph createdGraph = GraphFactory.open(originalConfig);
 
         final Configuration configInGraph = createdGraph.configuration();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
index d5c63e8..f19902f 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/GraphTest.java
@@ -1011,7 +1011,7 @@ public class GraphTest extends AbstractGremlinTest {
         tryCommit(graph, assertVertexEdgeCounts(2, 1));
         graph.close();
 
-        final Graph reopenedGraph = graphProvider.standardTestGraph(this.getClass(), name.getMethodName());
+        final Graph reopenedGraph = graphProvider.standardTestGraph(this.getClass(), name.getMethodName(), null);
         assertVertexEdgeCounts(2, 1).accept(reopenedGraph);
 
         if (graph.features().vertex().properties().supportsStringValues()) {
@@ -1026,6 +1026,6 @@ public class GraphTest extends AbstractGremlinTest {
                 assertEquals("internet", edge.property("location").value());
         });
 
-        graphProvider.clear(reopenedGraph, graphProvider.standardGraphConfiguration(this.getClass(), name.getMethodName()));
+        graphProvider.clear(reopenedGraph, graphProvider.standardGraphConfiguration(this.getClass(), name.getMethodName(), null));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
index c3041f7..17170fc 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/IoTest.java
@@ -76,6 +76,7 @@ import java.io.OutputStream;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.io.Writer;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.UUID;
@@ -160,7 +161,7 @@ public class IoTest extends AbstractGremlinTest {
         try {
             graph.io().writeGraphML(f.getAbsolutePath());
 
-            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CLASSIC);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             g1.io().readGraphML(f.getAbsolutePath());
 
@@ -245,8 +246,7 @@ public class IoTest extends AbstractGremlinTest {
         validateXmlAgainstGraphMLXsd(f);
 
         // reusing the same config used for creation of "g".
-        final Configuration configuration = graphProvider.newGraphConfiguration(
-                "g2", this.getClass(), name.getMethodName());
+        final Configuration configuration = graphProvider.newGraphConfiguration("g2", this.getClass(), name.getMethodName(), null);
         graphProvider.clear(configuration);
         final Graph g2 = graphProvider.openTestGraph(configuration);
         final GraphMLReader r = GraphMLReader.build().create();
@@ -290,8 +290,7 @@ public class IoTest extends AbstractGremlinTest {
             assertEquals("AF4B5965-B176-4552-B3C1-FBBE2F52C305".toLowerCase(), idValue.get("elementId").asText());
 
             // reusing the same config used for creation of "g".
-            final Configuration configuration = graphProvider.newGraphConfiguration(
-                    "g2", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("g2", this.getClass(), name.getMethodName(), null);
             graphProvider.clear(configuration);
             final Graph g2 = graphProvider.openTestGraph(configuration);
 
@@ -322,7 +321,7 @@ public class IoTest extends AbstractGremlinTest {
         final GryoWriter writer = GryoWriter.build().mapper(gryo).create();
         final GryoReader reader = GryoReader.build().workingDirectory(tempPath).mapper(gryo).create();
 
-        final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+        final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), null);
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 
@@ -342,7 +341,7 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldMigrateGraphWithFloat() throws Exception {
-        final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+        final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), null);
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 
@@ -362,7 +361,7 @@ public class IoTest extends AbstractGremlinTest {
     @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
     public void shouldMigrateGraph() throws Exception {
-        final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+        final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 
@@ -389,7 +388,7 @@ public class IoTest extends AbstractGremlinTest {
             final GryoWriter writer = graph.io().gryoWriter().create();
             writer.writeGraph(os, graph);
 
-            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
@@ -416,7 +415,7 @@ public class IoTest extends AbstractGremlinTest {
         try {
             graph.io().writeGryo(f.getAbsolutePath());
 
-            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             g1.io().readGryo(f.getAbsolutePath());
 
@@ -443,7 +442,7 @@ public class IoTest extends AbstractGremlinTest {
             final GryoWriter writer = graph.io().gryoWriter().create();
             writer.writeGraph(os, graph);
 
-            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CREW);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             final GryoReader reader = GryoReader.build()
@@ -473,7 +472,7 @@ public class IoTest extends AbstractGremlinTest {
             final GryoWriter writer = graph.io().gryoWriter().create();
             writer.writeGraph(os, graph);
 
-            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CLASSIC);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             final GryoReader reader = graph.io().gryoReader().workingDirectory(tempPath).create();
@@ -497,7 +496,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONWriter writer = graph.io().graphSONWriter().create();
             writer.writeGraph(os, graph);
 
-            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CLASSIC);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             final GraphSONReader reader = graph.io().graphSONReader().create();
@@ -521,7 +520,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONWriter writer = graph.io().graphSONWriter().create();
             writer.writeGraph(os, graph);
 
-            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             final GraphSONReader reader = graph.io().graphSONReader().create();
@@ -545,7 +544,7 @@ public class IoTest extends AbstractGremlinTest {
         try {
             graph.io().writeGraphSON(f.getAbsolutePath());
 
-            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.MODERN);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             g1.io().readGraphSON(f.getAbsolutePath());
@@ -571,7 +570,7 @@ public class IoTest extends AbstractGremlinTest {
             final GraphSONWriter writer = graph.io().graphSONWriter().create();
             writer.writeGraph(os, graph);
 
-            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName());
+            final Configuration configuration = graphProvider.newGraphConfiguration("readGraph", this.getClass(), name.getMethodName(), LoadGraphWith.GraphData.CREW);
             graphProvider.clear(configuration);
             final Graph g1 = graphProvider.openTestGraph(configuration);
             final GraphSONReader reader = graph.io().graphSONReader().create();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
index 24dc683..c1be0c1 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
@@ -449,7 +449,7 @@ public class TransactionTest extends AbstractGremlinTest {
         // the idea behind this test is to simulate a gremlin-server environment where two graphs of the same type
         // are being mutated by multiple threads. originally replicated a bug that was part of OrientDB.
 
-        final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName());
+        final Configuration configuration = graphProvider.newGraphConfiguration("g1", this.getClass(), name.getMethodName(), null);
         graphProvider.clear(configuration);
         final Graph g1 = graphProvider.openTestGraph(configuration);
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
index 5355e33..e1fa5b3 100644
--- a/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
+++ b/hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/HadoopGraph.java
@@ -40,8 +40,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
+import java.util.Collections;
 import java.util.Iterator;
+import java.util.Objects;
 import java.util.Optional;
+import java.util.stream.Stream;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -201,7 +204,26 @@ public class HadoopGraph implements Graph {
     @Override
     public Iterator<Vertex> vertices(final Object... vertexIds) {
         try {
-            return 0 == vertexIds.length ? new HadoopVertexIterator(this) : IteratorUtils.filter(new HadoopVertexIterator(this), vertex -> ElementHelper.idExists(vertex.id(), vertexIds));
+            if (0 == vertexIds.length) {
+                return new HadoopVertexIterator(this);
+            } else {
+                // base the conversion function on the first item in the id list as the expectation is that these
+                // id values will be a uniform list
+                if (vertexIds[0] instanceof Vertex) {
+                    // based on the first item assume all vertices in the argument list
+                    if (!Stream.of(vertexIds).allMatch(id -> id instanceof Vertex))
+                        throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+
+                    // no need to get the vertices again, so just flip it back - some implementation may want to treat this
+                    // as a refresh operation. that's not necessary for hadoopgraph.
+                    return Stream.of(vertexIds).map(id -> (Vertex) id).iterator();
+                } else {
+                    final Class<?> firstClass = vertexIds[0].getClass();
+                    if (!Stream.of(vertexIds).map(Object::getClass).allMatch(firstClass::equals))
+                        throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();     // todo: change exception to be ids of the same type
+                    return IteratorUtils.filter(new HadoopVertexIterator(this), vertex -> ElementHelper.idExists(vertex.id(), vertexIds));
+                }
+            }
         } catch (final IOException e) {
             throw new IllegalStateException(e.getMessage(), e);
         }
@@ -210,7 +232,26 @@ public class HadoopGraph implements Graph {
     @Override
     public Iterator<Edge> edges(final Object... edgeIds) {
         try {
-            return 0 == edgeIds.length ? new HadoopEdgeIterator(this) : IteratorUtils.filter(new HadoopEdgeIterator(this), edge -> ElementHelper.idExists(edge.id(), edgeIds));
+            if (0 == edgeIds.length) {
+                return new HadoopEdgeIterator(this);
+            } else {
+                // base the conversion function on the first item in the id list as the expectation is that these
+                // id values will be a uniform list
+                if (edgeIds[0] instanceof Edge) {
+                    // based on the first item assume all Edges in the argument list
+                    if (!Stream.of(edgeIds).allMatch(id -> id instanceof Edge))
+                        throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
+
+                    // no need to get the vertices again, so just flip it back - some implementation may want to treat this
+                    // as a refresh operation. that's not necessary for hadoopgraph.
+                    return Stream.of(edgeIds).map(id -> (Edge) id).iterator();
+                } else {
+                    final Class<?> firstClass = edgeIds[0].getClass();
+                    if (!Stream.of(edgeIds).map(Object::getClass).allMatch(firstClass::equals))
+                        throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();     // todo: change exception to be ids of the same type
+                    return IteratorUtils.filter(new HadoopEdgeIterator(this), vertex -> ElementHelper.idExists(vertex.id(), edgeIds));
+                }
+            }
         } catch (final IOException e) {
             throw new IllegalStateException(e.getMessage(), e);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java
----------------------------------------------------------------------
diff --git a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java
index b8ba425..d8615bc 100644
--- a/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java
+++ b/hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/HadoopGraphProvider.java
@@ -24,7 +24,6 @@ import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
 import org.apache.tinkerpop.gremlin.AbstractGraphProvider;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.TestHelper;
-import org.apache.tinkerpop.gremlin.hadoop.process.computer.giraph.GiraphGraphComputer;
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopEdge;
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopElement;
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopGraph;
@@ -33,7 +32,6 @@ import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopProperty;
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopVertex;
 import org.apache.tinkerpop.gremlin.hadoop.structure.HadoopVertexProperty;
 import org.apache.tinkerpop.gremlin.hadoop.structure.io.graphson.GraphSONInputFormat;
-import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoInputFormat;
 import org.apache.tinkerpop.gremlin.hadoop.structure.io.gryo.GryoOutputFormat;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.io.graphson.GraphSONResourceAccess;
@@ -98,7 +96,7 @@ public class HadoopGraphProvider extends AbstractGraphProvider {
     }
 
     @Override
-    public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName) {
+    public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName, final LoadGraphWith.GraphData loadGraphWith) {
         return new HashMap<String, Object>() {{
             put(Graph.GRAPH, HadoopGraph.class.getName());
             put(Constants.GREMLIN_HADOOP_GRAPH_INPUT_FORMAT, GraphSONInputFormat.class.getCanonicalName());

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
index 71d3eba..4acbf66 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraph.java
@@ -39,11 +39,9 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Optional;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.function.Function;
 import java.util.function.UnaryOperator;
 import java.util.stream.Stream;
 
@@ -73,6 +71,10 @@ public class TinkerGraph implements Graph {
         this.setProperty(Graph.GRAPH, TinkerGraph.class.getName());
     }};
 
+    public static final String CONFIG_VERTEX_ID = "tinkergraph.vertex.id";
+    public static final String CONFIG_EDGE_ID = "tinkergraph.edge.id";
+    public static final String CONFIG_VERTEX_PROPERTY_ID = "tinkergraph.vertex-property.id";
+
     protected Long currentId = -1l;
     protected Map<Object, Vertex> vertices = new ConcurrentHashMap<>();
     protected Map<Object, Edge> edges = new ConcurrentHashMap<>();
@@ -82,16 +84,52 @@ public class TinkerGraph implements Graph {
     protected TinkerIndex<TinkerVertex> vertexIndex = null;
     protected TinkerIndex<TinkerEdge> edgeIndex = null;
 
-    private final static TinkerGraph EMPTY_GRAPH = new TinkerGraph();
+    private final static TinkerGraph EMPTY_GRAPH = new TinkerGraph(EMPTY_CONFIGURATION);
+
+    protected IdManager<?> vertexIdManager;
+    protected IdManager<?> edgeIdManager;
+    protected IdManager<?> vertexPropertyIdManager;
 
-    protected Class<?> vertexIdClass = null;
-    protected Class<?> edgeIdClass = null;
-    protected Class<?> vertexPropertyIdClass = null;
+    private final Configuration configuration;
 
     /**
      * An empty private constructor that initializes {@link TinkerGraph}.
      */
-    private TinkerGraph() {
+    private TinkerGraph(final Configuration configuration) {
+        this.configuration = configuration;
+
+        final String vertexIdManagerConfigValue = configuration.getString(CONFIG_VERTEX_ID, DefaultIdManager.ANY.name());
+        try {
+            vertexIdManager = DefaultIdManager.valueOf(vertexIdManagerConfigValue);
+        } catch (IllegalArgumentException iae) {
+            try {
+                vertexIdManager = (IdManager) Class.forName(vertexIdManagerConfigValue).newInstance();
+            } catch (Exception ex) {
+                throw new IllegalStateException(String.format("Could not configure TinkerGraph vertex id manager with %s", vertexIdManagerConfigValue));
+            }
+        }
+
+        final String edgeIdManagerConfigValue = configuration.getString(CONFIG_EDGE_ID, DefaultIdManager.ANY.name());
+        try {
+            edgeIdManager = DefaultIdManager.valueOf(edgeIdManagerConfigValue);
+        } catch (IllegalArgumentException iae) {
+            try {
+                edgeIdManager = (IdManager) Class.forName(edgeIdManagerConfigValue).newInstance();
+            } catch (Exception ex) {
+                throw new IllegalStateException(String.format("Could not configure TinkerGraph edge id manager with %s", edgeIdManagerConfigValue));
+            }
+        }
+
+        final String vertexPropIdManagerConfigValue = configuration.getString(CONFIG_VERTEX_PROPERTY_ID, DefaultIdManager.ANY.name());
+        try {
+            vertexPropertyIdManager = DefaultIdManager.valueOf(vertexPropIdManagerConfigValue);
+        } catch (IllegalArgumentException iae) {
+            try {
+                vertexPropertyIdManager = (IdManager) Class.forName(vertexPropIdManagerConfigValue).newInstance();
+            } catch (Exception ex) {
+                throw new IllegalStateException(String.format("Could not configure TinkerGraph vertex property id manager with %s", vertexPropIdManagerConfigValue));
+            }
+        }
     }
 
     public static TinkerGraph empty() {
@@ -107,7 +145,7 @@ public class TinkerGraph implements Graph {
      * Test Suite.
      */
     public static TinkerGraph open() {
-        return open(null);
+        return open(EMPTY_CONFIGURATION);
     }
 
     /**
@@ -126,7 +164,7 @@ public class TinkerGraph implements Graph {
      * @return a newly opened {@link org.apache.tinkerpop.gremlin.structure.Graph}
      */
     public static TinkerGraph open(final Configuration configuration) {
-        return new TinkerGraph();
+        return new TinkerGraph(configuration);
     }
 
     ////////////// STRUCTURE API METHODS //////////////////
@@ -141,16 +179,7 @@ public class TinkerGraph implements Graph {
             if (this.vertices.containsKey(idValue))
                 throw Exceptions.vertexWithIdAlreadyExists(idValue);
         } else {
-            idValue = TinkerHelper.getNextId(this, Vertex.class);
-        }
-
-        // todo: enforce vertex id consistency with tests
-        // if no value is defined on the graph for the expected id type then use whatever is currently set, otherwise
-        // if there is a value, ensure that the expected type matches what was provided.
-        if (null == vertexIdClass)
-            vertexIdClass = idValue.getClass();
-        else if (!idValue.getClass().equals(vertexIdClass)) {
-            throw new IllegalStateException(String.format("Expecting a vertex identifier of %s but was %s", vertexIdClass, idValue.getClass()));
+            idValue = vertexIdManager.getNextId(this);
         }
 
         final Vertex vertex = new TinkerVertex(idValue, label, this);
@@ -205,12 +234,13 @@ public class TinkerGraph implements Graph {
 
     @Override
     public Configuration configuration() {
-        return EMPTY_CONFIGURATION;
+        return configuration;
     }
 
     @Override
     public Iterator<Vertex> vertices(final Object... vertexIds) {
         // todo: this code looks a lot like edges() code - better reuse here somewhere?
+        // todo: what if we have Reference/DetachedVertex???????????????????????????
         if (0 == vertexIds.length) {
             return this.vertices.values().iterator();
         } else if (1 == vertexIds.length) {
@@ -220,8 +250,7 @@ public class TinkerGraph implements Graph {
                 return IteratorUtils.of((Vertex) vertexIds[0]);
             } else {
                 // convert the id to the expected data type and lookup the vertex
-                final UnaryOperator<Object> conversionFunction = convertToId(vertexIds[0], vertexIdClass);
-                final Vertex vertex = this.vertices.get(conversionFunction.apply(vertexIds[0]));
+                final Vertex vertex = this.vertices.get(vertexIdManager.convert(vertexIds[0]));
                 return null == vertex ? Collections.emptyIterator() : IteratorUtils.of(vertex);
             }
         } else {
@@ -239,8 +268,7 @@ public class TinkerGraph implements Graph {
                 final Class<?> firstClass = vertexIds[0].getClass();
                 if (!Stream.of(vertexIds).map(Object::getClass).allMatch(firstClass::equals))
                     throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();     // todo: change exception to be ids of the same type
-                final UnaryOperator<Object> conversionFunction = convertToId(vertexIds[0], vertexIdClass);
-                return Stream.of(vertexIds).map(conversionFunction).map(this.vertices::get).filter(Objects::nonNull).iterator();
+                return Stream.of(vertexIds).map(vertexIdManager::convert).map(this.vertices::get).filter(Objects::nonNull).iterator();
             }
         }
     }
@@ -256,8 +284,7 @@ public class TinkerGraph implements Graph {
                 return IteratorUtils.of((Edge) edgeIds[0]);
             } else {
                 // convert the id to the expected data type and lookup the vertex
-                final UnaryOperator<Object> conversionFunction = convertToId(edgeIds[0], edgeIdClass);
-                final Edge edge = this.edges.get(conversionFunction.apply(edgeIds[0]));
+                final Edge edge = this.edges.get(edgeIdManager.convert(edgeIds[0]));
                 return null == edge ? Collections.emptyIterator() : IteratorUtils.of(edge);
             }
         } else {
@@ -275,8 +302,7 @@ public class TinkerGraph implements Graph {
                 final Class<?> firstClass = edgeIds[0].getClass();
                 if (!Stream.of(edgeIds).map(Object::getClass).allMatch(firstClass::equals))
                     throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();     // todo: change exception to be ids of the same type
-                final UnaryOperator<Object> conversionFunction = convertToId(edgeIds[0], vertexIdClass);
-                return Stream.of(edgeIds).map(conversionFunction).map(this.edges::get).filter(Objects::nonNull).iterator();
+                return Stream.of(edgeIds).map(edgeIdManager::convert).map(this.edges::get).filter(Objects::nonNull).iterator();
             }
         }
     }
@@ -464,4 +490,95 @@ public class TinkerGraph implements Graph {
 
         return UnaryOperator.identity();
     }
+
+    public interface IdManager<T> {
+        T getNextId(final TinkerGraph graph);
+        Class<? extends T> getIdClass();
+        T convert(final Object o);
+    }
+
+    public enum DefaultIdManager implements IdManager {
+        LONG {
+            private long currentId = -1l;
+            @Override
+            public Long getNextId(final TinkerGraph graph) {
+                return Stream.generate(() -> (++currentId)).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
+            }
+
+            @Override
+            public Class<? extends Long> getIdClass() {
+                return Long.class;
+            }
+
+            @Override
+            public Object convert(final Object o) {
+                if (o instanceof Number)
+                    return ((Number) o).longValue();
+                else if (o instanceof String)
+                    return Long.parseLong((String) o);
+                else
+                    throw new IllegalArgumentException("Expected an id that is convertible to Long");
+            }
+        },
+        INTEGER {
+            private int currentId = -1;
+            @Override
+            public Integer getNextId(final TinkerGraph graph) {
+                return Stream.generate(() -> (++currentId)).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
+            }
+
+            @Override
+            public Class<? extends Integer> getIdClass() {
+                return Integer.class;
+            }
+
+            @Override
+            public Object convert(final Object o) {
+                if (o instanceof Number)
+                    return ((Number) o).intValue();
+                else if (o instanceof String)
+                    return Integer.parseInt((String) o);
+                else
+                    throw new IllegalArgumentException("Expected an id that is convertible to Integer");
+            }
+        },
+        UUID {
+            @Override
+            public UUID getNextId(final TinkerGraph graph) {
+                return java.util.UUID.randomUUID();
+            }
+
+            @Override
+            public Class<? extends UUID> getIdClass() {
+                return java.util.UUID.class;
+            }
+
+            @Override
+            public Object convert(final Object o) {
+                if (o instanceof java.util.UUID)
+                    return o;
+                else if (o instanceof String)
+                    return java.util.UUID.fromString((String) o);
+                else
+                    throw new IllegalArgumentException("Expected an id that is convertible to UUID");
+            }
+        },
+        ANY {
+            private long currentId = -1l;
+            @Override
+            public Long getNextId(final TinkerGraph graph) {
+                return Stream.generate(() -> (++currentId)).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
+            }
+
+            @Override
+            public Class<? extends Object> getIdClass() {
+                return Object.class;
+            }
+
+            @Override
+            public Object convert(final Object o) {
+                return o;
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
index 1b1311e..08570c8 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerHelper.java
@@ -21,7 +21,6 @@ package org.apache.tinkerpop.gremlin.tinkergraph.structure;
 import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
 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.Graph;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
@@ -47,37 +46,6 @@ public final class TinkerHelper {
     private TinkerHelper() {
     }
 
-    protected final synchronized static Number getNextId(final TinkerGraph graph, final Class<? extends Element> element) {
-        final Class<?> idClass;
-        if (Vertex.class.isAssignableFrom(element))
-            idClass = graph.vertexIdClass;
-        else if (Edge.class.isAssignableFrom(element))
-            idClass = graph.edgeIdClass;
-        else if (VertexProperty.class.isAssignableFrom(element))
-            idClass = graph.vertexPropertyIdClass;
-        else
-            throw new IllegalArgumentException(String.format("Unexpected request for id for %s", element));
-
-        final Number next = Stream.generate(() -> (++graph.currentId)).filter(id -> !graph.vertices.containsKey(id) && !graph.edges.containsKey(id)).findAny().get();
-
-        // the class hasn't been set yet so assume Long - the class should be set by the caller after this
-        // value is returned
-        if (null == idClass)
-            return next.longValue();
-
-        if (idClass.equals(Long.class))
-            return next.longValue();
-        else if (idClass.equals(Integer.class))
-            return next.intValue();
-        else if (idClass.equals(Double.class))
-            return next.doubleValue();
-        else if (idClass.equals(Float.class))
-            return next.floatValue();
-        else
-            throw new IllegalStateException(String.format("TinkerGraph generates numeric identifiers, but this instance has already been initialized a identifier of type %s for %s", idClass, element));
-
-    }
-
     protected static Edge addEdge(final TinkerGraph graph, final TinkerVertex outVertex, final TinkerVertex inVertex, final String label, final Object... keyValues) {
         ElementHelper.validateLabel(label);
         ElementHelper.legalPropertyKeyValueArray(keyValues);
@@ -89,16 +57,7 @@ public final class TinkerHelper {
             if (graph.edges.containsKey(idValue))
                 throw Graph.Exceptions.edgeWithIdAlreadyExists(idValue);
         } else {
-            idValue = TinkerHelper.getNextId(graph, Edge.class);
-        }
-
-        // todo: enforce edge id consistency with tests
-        // if no value is defined on the graph for the expected id type then use whatever is currently set, otherwise
-        // if there is a value, ensure that the expected type matches what was provided.
-        if (null == graph.edgeIdClass)
-            graph.edgeIdClass = idValue.getClass();
-        else if (!idValue.getClass().equals(graph.edgeIdClass)) {
-            throw new IllegalStateException(String.format("Expecting a edge identifier of %s but was %s", graph.edgeIdClass, idValue.getClass()));
+            idValue = graph.edgeIdManager.getNextId(graph);
         }
 
         edge = new TinkerEdge(idValue, outVertex, label, inVertex);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
index a5713cc..e9a4632 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertex.java
@@ -96,15 +96,7 @@ public class TinkerVertex extends TinkerElement implements Vertex {
             ElementHelper.attachProperties(vertexProperty, keyValues);
             return vertexProperty;
         } else {
-            final Object idValue = optionalId.isPresent() ? optionalId.get() : TinkerHelper.getNextId(graph, VertexProperty.class);
-
-            // todo: enforce vertexproperty id consistency with tests
-            // if no value is defined on the graph for the expected id type then use whatever is currently set, otherwise
-            // if there is a value, ensure that the expected type matches what was provided.
-            if (null == graph.vertexPropertyIdClass)
-                graph.vertexPropertyIdClass = idValue.getClass();
-            else if (!idValue.getClass().equals(graph.vertexPropertyIdClass))
-                throw new IllegalStateException(String.format("Expecting a vertex identifier of %s but was %s", graph.vertexPropertyIdClass, idValue.getClass()));
+            final Object idValue = optionalId.isPresent() ? optionalId.get() : graph.vertexPropertyIdManager.getNextId(graph);
 
             final VertexProperty<V> vertexProperty = new TinkerVertexProperty<V>(idValue, this, key, value);
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java
index 2470733..0a8d3f3 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerVertexProperty.java
@@ -52,7 +52,7 @@ public class TinkerVertexProperty<V> extends TinkerElement implements VertexProp
      * with {@link TinkerGraphView}.
      */
     public TinkerVertexProperty(final TinkerVertex vertex, final String key, final V value, final Object... propertyKeyValues) {
-        super(TinkerHelper.getNextId((TinkerGraph) vertex.graph(), VertexProperty.class), key);
+        super(((TinkerGraph) vertex.graph()).vertexPropertyIdManager.getNextId((TinkerGraph) vertex.graph()), key);
         this.vertex = vertex;
         this.key = key;
         this.value = value;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/3cc550e2/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
index e873008..596e565 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/TinkerGraphProvider.java
@@ -20,7 +20,9 @@ package org.apache.tinkerpop.gremlin.tinkergraph;
 
 import org.apache.commons.configuration.Configuration;
 import org.apache.tinkerpop.gremlin.AbstractGraphProvider;
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.GraphTest;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement;
 import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph;
@@ -50,9 +52,15 @@ public class TinkerGraphProvider extends AbstractGraphProvider {
     }};
 
     @Override
-    public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName) {
+    public Map<String, Object> getBaseConfiguration(final String graphName, final Class<?> test, final String testMethodName,
+                                                    final LoadGraphWith.GraphData loadGraphWith) {
+        final TinkerGraph.DefaultIdManager idManager = selectIdMakerFromGraphData(loadGraphWith);
+        final String idMaker = (idManager.equals(TinkerGraph.DefaultIdManager.ANY) ? selectIdMakerFromTest(test, testMethodName) : idManager).name();
         return new HashMap<String, Object>() {{
             put(Graph.GRAPH, TinkerGraph.class.getName());
+            put(TinkerGraph.CONFIG_VERTEX_ID, idMaker);
+            put(TinkerGraph.CONFIG_EDGE_ID, idMaker);
+            put(TinkerGraph.CONFIG_VERTEX_PROPERTY_ID, idMaker);
         }};
     }
 
@@ -66,4 +74,52 @@ public class TinkerGraphProvider extends AbstractGraphProvider {
     public Set<Class> getImplementations() {
         return IMPLEMENTATION;
     }
+
+    /**
+     * Some tests require special configuration for TinkerGraph to properly configure the id manager.
+     */
+    private TinkerGraph.DefaultIdManager selectIdMakerFromTest(final Class<?> test, final String testMethodName) {
+        if (test.equals(GraphTest.class)) {
+            final Set<String> testsThatNeedLongIdManager = new HashSet<String>(){{
+                add("shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentation");
+                add("shouldIterateVerticesWithNumericIdSupportUsingDoubleRepresentations");
+                add("shouldIterateVerticesWithNumericIdSupportUsingIntegerRepresentation");
+                add("shouldIterateVerticesWithNumericIdSupportUsingIntegerRepresentations");
+                add("shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentation");
+                add("shouldIterateVerticesWithNumericIdSupportUsingFloatRepresentations");
+                add("shouldIterateVerticesWithNumericIdSupportUsingStringRepresentation");
+                add("shouldIterateVerticesWithNumericIdSupportUsingStringRepresentations");
+            }};
+
+            final Set<String> testsThatNeedUuidIdManager = new HashSet<String>(){{
+                add("shouldIterateVerticesWithUuidIdSupportUsingStringRepresentation");
+                add("shouldIterateVerticesWithUuidIdSupportUsingStringRepresentations");
+            }};
+
+            if (testsThatNeedLongIdManager.contains(testMethodName))
+                return TinkerGraph.DefaultIdManager.LONG;
+            else if (testsThatNeedUuidIdManager.contains(testMethodName))
+                return TinkerGraph.DefaultIdManager.UUID;
+        }
+
+        return TinkerGraph.DefaultIdManager.ANY;
+    }
+
+    /**
+     * Test that load with specific graph data can be configured with a specific id manager as the data type to
+     * be used in the test for that graph is known.
+     */
+    private TinkerGraph.DefaultIdManager selectIdMakerFromGraphData(final LoadGraphWith.GraphData loadGraphWith) {
+        if (null == loadGraphWith) return TinkerGraph.DefaultIdManager.ANY;
+        if (loadGraphWith.equals(LoadGraphWith.GraphData.CLASSIC))
+            return TinkerGraph.DefaultIdManager.INTEGER;
+        else if (loadGraphWith.equals(LoadGraphWith.GraphData.MODERN))
+            return TinkerGraph.DefaultIdManager.INTEGER;
+        else if (loadGraphWith.equals(LoadGraphWith.GraphData.CREW))
+            return TinkerGraph.DefaultIdManager.INTEGER;
+        else if (loadGraphWith.equals(LoadGraphWith.GraphData.GRATEFUL))
+            return TinkerGraph.DefaultIdManager.INTEGER;
+        else
+            throw new IllegalStateException(String.format("Need to define a new %s for %s", TinkerGraph.IdManager.class.getName(), loadGraphWith.name()));
+    }
 }