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

[tinkerpop] 01/01: TINKERPOP-2078 Added ReferenceGraph

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch TINKERPOP-2078
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 9974f7d47d19c891a5e44df0c28cbe4ad8165753
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Tue Oct 23 18:32:24 2018 -0400

    TINKERPOP-2078 Added ReferenceGraph
    
    Basically replaces EmptyGraph.instance().withRemote() for ReferenceGraph.open().withRemote() which is a bit more intuitive.
---
 CHANGELOG.asciidoc                                 |   1 +
 docs/src/dev/provider/index.asciidoc               |   2 +-
 docs/src/reference/gremlin-applications.asciidoc   |  12 +--
 docs/src/upgrade/release-3.3.x.asciidoc            |  25 +++++
 .../archetype-resources/src/main/java/Service.java |   4 +-
 gremlin-console/conf/remote-graph.properties       |   2 +-
 .../tinkerpop/gremlin/jsr223/CoreImports.java      |   2 +
 .../process/remote/EmbeddedRemoteConnection.java   |   2 +-
 .../structure/util/reference/ReferenceGraph.java   | 112 +++++++++++++++++++++
 .../dsl/graph/GraphTraversalSourceTest.java        |   7 +-
 .../gremlin/structure/util/GraphFactoryTest.java   |  11 ++
 .../gremlin-javascript/lib/structure/graph.js      |   2 +-
 .../main/jython/gremlin_python/structure/graph.py  |   2 +-
 .../gremlin/server/GremlinServerIntegrateTest.java |  15 +--
 .../jsr223/GremlinEnabledScriptEngineTest.java     |   2 -
 .../process/traversal/CoreTraversalTest.java       |   7 +-
 16 files changed, 178 insertions(+), 30 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 9a47f3c..321b267 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-3-5]]
 === TinkerPop 3.3.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Introduced `ReferenceGraph` as a replacement for `EmptyGraph` when constructing remote `TraversalSource` instances.
 
 [[release-3-3-4]]
 === TinkerPop 3.3.4 (Release Date: October 15, 2018)
diff --git a/docs/src/dev/provider/index.asciidoc b/docs/src/dev/provider/index.asciidoc
index b782f41..136ecb0 100644
--- a/docs/src/dev/provider/index.asciidoc
+++ b/docs/src/dev/provider/index.asciidoc
@@ -1085,7 +1085,7 @@ To demonstrate consider this example:
 cluster = Cluster.open()
 client = cluster.connect()
 aliased = client.alias("g")
-g = org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph.INSTANCE.traversal()       <1>
+g = org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceGraph.open().traversal()       <1>
 rs = aliased.submit(g.V().both().barrier().both().barrier()).all().get()                    <2>
 aliased.submit(g.V().both().barrier().both().barrier().count()).all().get().get(0).getInt() <3>
 rs.collect{[value: it.getObject().get(), bulk: it.getObject().bulk()]}                      <4>
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index 4e79e9e..c489d40 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -1041,11 +1041,11 @@ To configure a "remote" traversal, there first needs to be a `TraversalSource`.
 from any `Graph` instance with the `traversal()` method. Of course, any traversals generated from this source using the
 `withRemote()` configuration option will not execute against the local graph. That could be confusing and it may be
 easier to think of the local graph as being "empty". To that end, it is recommended that when using `withRemote()`,
-the `TraversalSource` be generated with `EmptyGraph` as follows:
+the `TraversalSource` be generated with `ReferenceGraph` as follows:
 
 [gremlin-groovy]
 ----
-graph = EmptyGraph.instance()
+graph = ReferenceGraph.open()
 g = graph.traversal().withRemote('conf/remote-graph.properties')
 g.V().valueMap(true)
 g.close()
@@ -1061,7 +1061,7 @@ then re-use it.
 [gremlin-groovy]
 ----
 cluster = Cluster.open('conf/remote-objects.yaml')
-graph = EmptyGraph.instance()
+graph = ReferenceGraph.open()
 g = graph.traversal().withRemote(DriverRemoteConnection.using(cluster, "g"))
 g.V().valueMap(true)
 g.close()
@@ -1086,7 +1086,7 @@ Gremlin-Groovy, use `Bindings`.
 ----
 cluster = Cluster.open('conf/remote-objects.yaml')
 b = Bindings.instance()
-g = EmptyGraph.instance().traversal().withRemote(DriverRemoteConnection.using(cluster, "g"))
+g = ReferenceGraph.open().traversal().withRemote(DriverRemoteConnection.using(cluster, "g"))
 g.V(b.of('id',1)).out('created').values('name')
 g.V(b.of('id',4)).out('created').values('name')
 g.V(b.of('id',4)).out('created').values('name').getBytecode()
@@ -1954,7 +1954,7 @@ ResultSet results = client.submit("g.V().hasLabel('person')");
 
 // no properties returned from g.V().hasLabel("person") because this is using
 // Bytecode API with reference detachment
-Graph graph = EmptyGraph.instance();
+Graph graph = ReferenceGraph.open();
 GraphTraversalSource g = graph.traversal().
                                withRemote('conf/remote-graph.properties');
 List<Vertex> results = g.V().hasLabel("person").toList();
@@ -1968,7 +1968,7 @@ Cluster cluster = Cluster.open();
 Client client = cluster.connect();
 ResultSet results = client.submit("g.V().hasLabel('person').valueMap(true,'name')");
 
-Graph graph = EmptyGraph.instance();
+Graph graph = ReferenceGraph.open();
 GraphTraversalSource g = graph.traversal().
                                withRemote('conf/remote-graph.properties');
 List<Vertex> results = g.V().hasLabel("person").valueMap(true,'name').toList();
diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc
index 1cb2dbf..1e3b914 100644
--- a/docs/src/upgrade/release-3.3.x.asciidoc
+++ b/docs/src/upgrade/release-3.3.x.asciidoc
@@ -27,6 +27,31 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 
 Please see the link:https://github.com/apache/tinkerpop/blob/3.3.5/CHANGELOG.asciidoc#release-3-3-5[changelog] for a complete list of all the modifications that are part of this release.
 
+=== Upgrading for Users
+
+==== ReferenceGraph
+
+`ReferenceGraph.open()` is the replacement for `EmptyGraph.instance()` when forming remote `TraversalSource` instances
+using `withRemote()`. `EmptyGraph` is not being deprecated or removed and the change is mostly designed to help make
+the API a bit more intuitive to work with.
+
+[source,text]
+----
+gremlin> graph = ReferenceGraph.open()
+==>referencegraph[reference]
+gremlin> g = graph.traversal().withRemote('conf/remote-graph.properties')
+==>graphtraversalsource[referencegraph[reference], standard]
+gremlin> g.V().valueMap()
+==>[name:[marko],age:[29]]
+==>[name:[vadas],age:[27]]
+==>[name:[lop],lang:[java]]
+==>[name:[josh],age:[32]]
+==>[name:[ripple],lang:[java]]
+==>[name:[peter],age:[35]]
+----
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-2078[TINKERPOP-2078]
+
 == TinkerPop 3.3.4
 
 *Release Date: October 15, 2018*
diff --git a/gremlin-archetype/gremlin-archetype-server/src/main/resources/archetype-resources/src/main/java/Service.java b/gremlin-archetype/gremlin-archetype-server/src/main/resources/archetype-resources/src/main/java/Service.java
index bb3fc68..0ae53e0 100644
--- a/gremlin-archetype/gremlin-archetype-server/src/main/resources/archetype-resources/src/main/java/Service.java
+++ b/gremlin-archetype/gremlin-archetype-server/src/main/resources/archetype-resources/src/main/java/Service.java
@@ -21,7 +21,7 @@ package ${package};
 import org.apache.tinkerpop.gremlin.driver.Cluster;
 import org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteConnection;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
-import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceGraph;
 
 import java.util.List;
 
@@ -38,7 +38,7 @@ public class Service implements AutoCloseable {
      * Construct a remote GraphTraversalSource using the above created Cluster instance that will connect to Gremlin
      * Server.
      */
-    private final GraphTraversalSource g = EmptyGraph.instance().
+    private final GraphTraversalSource g = ReferenceGraph.open().
                                                       traversal().
                                                       withRemote(DriverRemoteConnection.using(cluster));
 
diff --git a/gremlin-console/conf/remote-graph.properties b/gremlin-console/conf/remote-graph.properties
index 4fbe0a7..8b1508d 100644
--- a/gremlin-console/conf/remote-graph.properties
+++ b/gremlin-console/conf/remote-graph.properties
@@ -18,7 +18,7 @@
 ##############################################################
 # This configuration is meant for use with withRemote().
 #
-# graph = EmptyGraph.instance()
+# graph = ReferenceGraph.open()
 # g = graph.traversal().withRemote('conf/remote-graph.properties')
 #
 # This file will work with:
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
index 88e2ec4..63b1fa2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/CoreImports.java
@@ -123,6 +123,7 @@ import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoWriter;
 import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import org.apache.tinkerpop.gremlin.structure.util.GraphFactory;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceGraph;
 import org.apache.tinkerpop.gremlin.util.Gremlin;
 import org.apache.tinkerpop.gremlin.util.TimeUtil;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
@@ -177,6 +178,7 @@ public final class CoreImports {
         // remote
         CLASS_IMPORTS.add(RemoteConnection.class);
         CLASS_IMPORTS.add(RemoteGraph.class);
+        CLASS_IMPORTS.add(ReferenceGraph.class);
         CLASS_IMPORTS.add(EmptyGraph.class);
         // io
         CLASS_IMPORTS.add(GraphReader.class);
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/EmbeddedRemoteConnection.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/EmbeddedRemoteConnection.java
index da1a03a..9da5cdc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/EmbeddedRemoteConnection.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/remote/EmbeddedRemoteConnection.java
@@ -40,7 +40,7 @@ import java.util.Iterator;
  * GraphTraversalSource g = graph.traversal();
  *
  * // setup the remote as normal but give it the embedded "g" so that it executes against that
- * final Graph remote = EmptyGraph.instance();
+ * final Graph remote = ReferenceGraph.open();
  * GraphTraversalSource simulatedRemoteG = remote.traversal().withRemote(new EmbeddedRemoteConnection(g));
  * assertEquals(6, simulatedRemoteG.V().count().next().intValue());
  * }
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceGraph.java
new file mode 100644
index 0000000..8c4b13b
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/reference/ReferenceGraph.java
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tinkerpop.gremlin.structure.util.reference;
+
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Transaction;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.GraphFactoryClass;
+import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
+import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+
+import java.util.Collections;
+import java.util.Iterator;
+
+/**
+ * Provides a "reference" to a {@link Graph} instance for purpose of create {@link GraphTraversalSource} instances
+ * using {@link GraphTraversalSource#withRemote(String)}. It takes no configuration and supports none of the
+ * Graph API methods making it largely a holder object akin to {@link EmptyGraph}.
+ *
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+@GraphFactoryClass(ReferenceGraph.ReferenceGraphFactory.class)
+public final class ReferenceGraph implements Graph {
+
+    private final Configuration configuration;
+
+    private ReferenceGraph(final Configuration conf) {
+        this.configuration = conf;
+    }
+
+    public static ReferenceGraph open() {
+        return open(new BaseConfiguration());
+    }
+    public static ReferenceGraph open(final Configuration conf) {
+        return new ReferenceGraph(conf);
+    }
+
+    @Override
+    public Vertex addVertex(final Object... keyValues) {
+        throw Exceptions.vertexAdditionsNotSupported();
+    }
+
+    @Override
+    public <C extends GraphComputer> C compute(final Class<C> graphComputerClass) {
+        throw Exceptions.graphComputerNotSupported();
+    }
+
+    @Override
+    public GraphComputer compute() {
+        throw Exceptions.graphComputerNotSupported();
+    }
+
+    @Override
+    public Transaction tx() {
+        throw Exceptions.transactionsNotSupported();
+    }
+
+    @Override
+    public Variables variables() {
+        throw Exceptions.variablesNotSupported();
+    }
+
+    @Override
+    public Configuration configuration() {
+        return this.configuration;
+    }
+
+    @Override
+    public void close() throws Exception { }
+
+    @Override
+    public Iterator<Vertex> vertices(final Object... vertexIds) {
+        return Collections.emptyIterator();
+    }
+
+    @Override
+    public Iterator<Edge> edges(final Object... edgeIds) {
+        return Collections.emptyIterator();
+    }
+
+    @Override
+    public String toString() {
+        return StringFactory.graphString(this, "reference");
+    }
+
+    public static final class ReferenceGraphFactory {
+        public static Graph open(final Configuration conf) {
+            return new ReferenceGraph(conf);
+        }
+    }
+}
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
index a645089..f5a4c4d 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversalSourceTest.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.remote.RemoteConnection;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.SubgraphStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.ReadOnlyStrategy;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceGraph;
 import org.junit.Test;
 
 import java.util.Collections;
@@ -41,7 +42,7 @@ public class GraphTraversalSourceTest {
     @Test
     public void shouldCloseRemoteConnectionOnWithRemote() throws Exception {
         final RemoteConnection mock = mock(RemoteConnection.class);
-        final GraphTraversalSource g = EmptyGraph.instance().traversal().withRemote(mock);
+        final GraphTraversalSource g = ReferenceGraph.open().traversal().withRemote(mock);
         g.close();
 
         verify(mock, times(1)).close();
@@ -51,12 +52,12 @@ public class GraphTraversalSourceTest {
     public void shouldNotAllowLeakRemoteConnectionsIfMultipleAreCreated() throws Exception {
         final RemoteConnection mock1 = mock(RemoteConnection.class);
         final RemoteConnection mock2 = mock(RemoteConnection.class);
-        EmptyGraph.instance().traversal().withRemote(mock1).withRemote(mock2);
+        ReferenceGraph.open().traversal().withRemote(mock1).withRemote(mock2);
     }
 
     @Test
     public void shouldSupportMapBasedStrategies() throws Exception {
-        GraphTraversalSource g = EmptyGraph.instance().traversal();
+        GraphTraversalSource g = ReferenceGraph.open().traversal();
         assertFalse(g.getStrategies().getStrategy(SubgraphStrategy.class).isPresent());
         g = g.withStrategies(SubgraphStrategy.create(new MapConfiguration(new HashMap<String, Object>() {{
             put("vertices", __.hasLabel("person"));
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactoryTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactoryTest.java
index 00bb350..1f1a84b 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactoryTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/structure/util/GraphFactoryTest.java
@@ -27,6 +27,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Transaction;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceGraph;
 import org.junit.Test;
 
 import java.io.File;
@@ -35,8 +36,10 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
 
 /**
@@ -249,6 +252,14 @@ public class GraphFactoryTest {
         assertSame(EmptyGraph.instance(), graph);
     }
 
+    @Test
+    public void shouldCreateReferenceGraphInstance() {
+        final Configuration conf = new BaseConfiguration();
+        conf.setProperty(Graph.GRAPH, ReferenceGraph.class.getName());
+        final Graph graph = GraphFactory.open(conf);
+        assertThat(graph, instanceOf(ReferenceGraph.class));
+    }
+
     public static class MockGraphWithoutOpen implements Graph {
         @Override
         public Vertex addVertex(final Object... keyValues) {
diff --git a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
index 2861a50..90f5987 100644
--- a/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
+++ b/gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js
@@ -35,7 +35,7 @@ class Graph {
   }
 
   toString() {
-    return 'graph[empty]';
+    return 'graph[reference]';
   }
 }
 
diff --git a/gremlin-python/src/main/jython/gremlin_python/structure/graph.py b/gremlin-python/src/main/jython/gremlin_python/structure/graph.py
index a22633c..39137df 100644
--- a/gremlin-python/src/main/jython/gremlin_python/structure/graph.py
+++ b/gremlin-python/src/main/jython/gremlin_python/structure/graph.py
@@ -34,7 +34,7 @@ class Graph(object):
         return traversal_source_class(self, TraversalStrategies.global_cache[self.__class__])
 
     def __repr__(self):
-        return "graph[empty]"
+        return "graph[reference]"
 
 
 class Element(object):
diff --git a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
index db2727a..b4cc5fc 100644
--- a/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
+++ b/gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinServerIntegrateTest.java
@@ -61,6 +61,7 @@ import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedVertex;
 import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceGraph;
 import org.apache.tinkerpop.gremlin.util.Log4jRecordingAppender;
 import org.apache.tinkerpop.gremlin.util.function.Lambda;
 import org.hamcrest.CoreMatchers;
@@ -397,7 +398,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldTimeOutRemoteTraversal() throws Exception {
-        final Graph graph = EmptyGraph.instance();
+        final Graph graph = ReferenceGraph.open();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
 
         try {
@@ -1207,7 +1208,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldSupportLambdasUsingWithRemote() throws Exception {
-        final Graph graph = EmptyGraph.instance();
+        final Graph graph = ReferenceGraph.open();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
         g.addV("person").property("age", 20).iterate();
         g.addV("person").property("age", 10).iterate();
@@ -1216,7 +1217,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldGetSideEffectKeysUsingWithRemote() throws Exception {
-        final Graph graph = EmptyGraph.instance();
+        final Graph graph = ReferenceGraph.open();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
         g.addV("person").property("age", 20).iterate();
         g.addV("person").property("age", 10).iterate();
@@ -1249,7 +1250,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldCloseSideEffectsUsingWithRemote() throws Exception {
-        final Graph graph = EmptyGraph.instance();
+        final Graph graph = ReferenceGraph.open();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
         g.addV("person").property("age", 20).iterate();
         g.addV("person").property("age", 10).iterate();
@@ -1300,7 +1301,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldBlockWhenGettingSideEffectKeysUsingWithRemote() throws Exception {
-        final Graph graph = EmptyGraph.instance();
+        final Graph graph = ReferenceGraph.open();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
         g.addV("person").property("age", 20).iterate();
         g.addV("person").property("age", 10).iterate();
@@ -1343,7 +1344,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldBlockWhenGettingSideEffectValuesUsingWithRemote() throws Exception {
-        final Graph graph = EmptyGraph.instance();
+        final Graph graph = ReferenceGraph.open();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
         g.addV("person").property("age", 20).iterate();
         g.addV("person").property("age", 10).iterate();
@@ -1386,7 +1387,7 @@ public class GremlinServerIntegrateTest extends AbstractGremlinServerIntegration
 
     @Test
     public void shouldDoNonBlockingPromiseWithRemote() throws Exception {
-        final Graph graph = EmptyGraph.instance();
+        final Graph graph = ReferenceGraph.open();
         final GraphTraversalSource g = graph.traversal().withRemote(conf);
         g.addV("person").property("age", 20).promise(Traversal::iterate).join();
         g.addV("person").property("age", 10).promise(Traversal::iterate).join();
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
index a65ccbd..7d1e0a7 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/jsr223/GremlinEnabledScriptEngineTest.java
@@ -35,12 +35,10 @@ import javax.script.SimpleBindings;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
-import java.util.Optional;
 
 import static org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngineSuite.ENGINE_TO_TEST;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.core.AnyOf.anyOf;
-import static org.hamcrest.core.CombinableMatcher.either;
 import static org.hamcrest.core.Is.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assume.assumeThat;
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 1ab83a6..0570e4c 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
@@ -33,7 +33,7 @@ import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.Transaction;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
-import org.apache.tinkerpop.gremlin.structure.util.empty.EmptyGraph;
+import org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceGraph;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -42,14 +42,11 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
-import java.util.Random;
 import java.util.Set;
 import java.util.stream.Collectors;
 
 import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.as;
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.inject;
-import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.out;
 import static org.apache.tinkerpop.gremlin.structure.Graph.Features.GraphFeatures.FEATURE_TRANSACTIONS;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -298,7 +295,7 @@ public class CoreTraversalTest extends AbstractGremlinProcessTest {
     @Test
     @LoadGraphWith(MODERN)
     public void shouldAllowEmbeddedRemoteConnectionUsage() {
-        final Graph remote = EmptyGraph.instance();
+        final Graph remote = ReferenceGraph.open();
         final GraphTraversalSource simulatedRemoteG = remote.traversal().withRemote(new EmbeddedRemoteConnection(g));
         assertEquals(6, simulatedRemoteG.V().count().next().intValue());
         assertEquals("marko", simulatedRemoteG.V().has("name", "marko").values("name").next());