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/09/09 17:59:32 UTC

incubator-tinkerpop git commit: Deprecated Element.Exceptions.elementAlreadyRemoved given TINKERPOP3-297

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master 83cea6d96 -> 898615645


Deprecated Element.Exceptions.elementAlreadyRemoved given TINKERPOP3-297

Removed tests that enforced consistency over this standard exception.  In short it gaining consistency was very difficult given the disparity of the approach taken by the various implementations.


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

Branch: refs/heads/master
Commit: 898615645facca97f1f2184a52e31e91d9287641
Parents: 83cea6d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Sep 9 11:51:27 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Sep 9 11:51:27 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/structure/Element.java    |  5 +++
 .../tinkerpop/gremlin/structure/EdgeTest.java   | 38 -----------------
 .../gremlin/structure/VertexPropertyTest.java   | 38 -----------------
 .../tinkerpop/gremlin/structure/VertexTest.java | 45 --------------------
 .../structure/ExceptionCoverageTest.java        |  5 ++-
 .../gremlin/neo4j/structure/Neo4jEdge.java      | 14 ++----
 .../gremlin/neo4j/structure/Neo4jElement.java   |  1 -
 .../gremlin/neo4j/structure/Neo4jVertex.java    |  6 ---
 .../neo4j/structure/Neo4jVertexProperty.java    |  5 ---
 .../structure/trait/MultiMetaNeo4jTrait.java    | 18 +++-----
 .../tinkergraph/structure/TinkerEdge.java       |  6 +--
 .../tinkergraph/structure/TinkerElement.java    |  3 ++
 .../tinkergraph/structure/TinkerVertex.java     | 10 ++---
 .../structure/TinkerVertexProperty.java         |  2 +-
 .../tinkergraph/structure/TinkerGraphTest.java  | 37 ++++++++++++++++
 15 files changed, 65 insertions(+), 168 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java
index b6538b9..841e4ad 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/Element.java
@@ -145,6 +145,11 @@ public abstract interface Element {
             return new IllegalArgumentException("Label can not be a hidden key: " + label);
         }
 
+        /**
+         * @deprecated As of release 3.1.0, not replaced - this exception is no longer enforced by the test suite.
+         * @see <a href="https://issues.apache.org/jira/browse/TINKERPOP3-297">TINKERPOP3-297</a>
+         */
+        @Deprecated
         public static IllegalStateException elementAlreadyRemoved(final Class<? extends Element> clazz, final Object id) {
             return new IllegalStateException(String.format("%s with id %s was removed.", clazz.getSimpleName(), id));
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/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 2161f89..98e44dc 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
@@ -322,42 +322,4 @@ public class EdgeTest {
             assertFalse(iterator.hasNext());
         }
     }
-
-    @RunWith(Parameterized.class)
-    @ExceptionCoverage(exceptionClass = Element.Exceptions.class, methods = {
-            "elementAlreadyRemoved"
-    })
-    public static class ExceptionConsistencyWhenEdgeRemovedTest extends AbstractGremlinTest {
-
-        @Parameterized.Parameters(name = "{0}")
-        public static Iterable<Object[]> data() {
-            return Arrays.asList(new Object[][]{
-                    {"property(k)", FunctionUtils.wrapConsumer((Edge e) -> e.property("x"))},
-                    {"remove()", FunctionUtils.wrapConsumer(Edge::remove)}});
-        }
-
-        @Parameterized.Parameter(value = 0)
-        public String name;
-
-        @Parameterized.Parameter(value = 1)
-        public Consumer<Edge> functionToTest;
-
-        @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_REMOVE_VERTICES)
-        public void shouldThrowExceptionIfEdgeWasRemoved() {
-            final Vertex v1 = graph.addVertex("name", "stephen");
-            final Edge e = v1.addEdge("knows", v1, "x", "y");
-            final Object id = e.id();
-            e.remove();
-            tryCommit(graph, graph -> {
-                try {
-                    functionToTest.accept(e);
-                    fail("Should have thrown exception as the Edge was already removed");
-                } catch (Exception ex) {
-                    validateException(Element.Exceptions.elementAlreadyRemoved(Edge.class, id), ex);
-                }
-            });
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
index 49a8e6d..edb4d8f 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/VertexPropertyTest.java
@@ -469,44 +469,6 @@ public class VertexPropertyTest extends AbstractGremlinTest {
         }
     }
 
-    @RunWith(Parameterized.class)
-    @ExceptionCoverage(exceptionClass = Element.Exceptions.class, methods = {
-            "elementAlreadyRemoved"
-    })
-    public static class ExceptionConsistencyWhenVertexPropertyRemovedTest extends AbstractGremlinTest {
-
-        @Parameterized.Parameters(name = "{0}")
-        public static Iterable<Object[]> data() {
-            return Arrays.asList(new Object[][]{
-                    {"property(k)", FunctionUtils.wrapConsumer((VertexProperty p) -> p.property("year"))}});
-        }
-
-        @Parameterized.Parameter(value = 0)
-        public String name;
-
-        @Parameterized.Parameter(value = 1)
-        public Consumer<VertexProperty> functionToTest;
-
-        @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_REMOVE_VERTICES)
-        @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_META_PROPERTIES)
-        public void shouldThrowExceptionIfVertexPropertyWasRemoved() {
-            final Vertex v1 = graph.addVertex();
-            final VertexProperty p = v1.property(VertexProperty.Cardinality.single, "name", "stephen", "year", "2012");
-            final Object id = p.id();
-            p.remove();
-            tryCommit(graph, g -> {
-                try {
-                    functionToTest.accept(p);
-                    fail("Should have thrown exception as the Vertex was already removed");
-                } catch (Exception ex) {
-                    validateException(Element.Exceptions.elementAlreadyRemoved(VertexProperty.class, id), ex);
-                }
-            });
-        }
-    }
-
     public static class VertexPropertyProperties extends AbstractGremlinTest {
 
         @Test

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/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 d891d14..f097e01 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
@@ -534,49 +534,4 @@ public class VertexTest {
             assertEquals(0, IteratorUtils.count(v.properties()));
         }
     }
-
-    @RunWith(Parameterized.class)
-    @ExceptionCoverage(exceptionClass = Element.Exceptions.class, methods = {
-            "elementAlreadyRemoved"
-    })
-    public static class ExceptionConsistencyWhenVertexRemovedTest extends AbstractGremlinTest {
-
-        @Parameterized.Parameters(name = "{0}")
-        public static Iterable<Object[]> data() {
-            return Arrays.asList(new Object[][]{
-                    {"property(k)", FunctionUtils.wrapConsumer((Vertex v) -> v.property("name"))},
-                    {"remove()", FunctionUtils.wrapConsumer(Vertex::remove)},
-                    {"addEdge()", FunctionUtils.wrapConsumer((Vertex v) -> v.addEdge("self", v))},
-                    {"property(k,v)", FunctionUtils.wrapConsumer((Vertex v) -> {
-                        v.property(VertexProperty.Cardinality.single, "k", "v");
-                    })},
-                    {"property(single,k,v)", FunctionUtils.wrapConsumer((Vertex v) -> {
-                        v.property(VertexProperty.Cardinality.single, "k", "v");
-                    })},
-                    {"value(k)", FunctionUtils.wrapConsumer((Vertex v) -> v.value("name"))}});
-        }
-
-        @Parameterized.Parameter(value = 0)
-        public String name;
-
-        @Parameterized.Parameter(value = 1)
-        public Consumer<Vertex> functionToTest;
-
-        @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_REMOVE_VERTICES)
-        public void shouldThrowExceptionIfVertexWasRemovedWhenCallingProperty() {
-            final Vertex v1 = graph.addVertex("name", "stephen");
-            final Object id = v1.id();
-            v1.remove();
-            tryCommit(graph, g -> {
-                try {
-                    functionToTest.accept(v1);
-                    fail("Should have thrown exception as the Vertex was already removed");
-                } catch (Exception ex) {
-                    validateException(Element.Exceptions.elementAlreadyRemoved(Vertex.class, id), ex);
-                }
-            });
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/ExceptionCoverageTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/ExceptionCoverageTest.java b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/ExceptionCoverageTest.java
index ee47666..246ff30 100644
--- a/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/ExceptionCoverageTest.java
+++ b/gremlin-test/src/test/java/org/apache/tinkerpop/gremlin/structure/ExceptionCoverageTest.java
@@ -67,7 +67,10 @@ public class ExceptionCoverageTest {
             add("org.apache.tinkerpop.gremlin.structure.Graph$Exceptions#argumentCanNotBeNull");
             add("org.apache.tinkerpop.gremlin.structure.Graph$Exceptions#traversalEngineNotSupported");
 
-            // todo: need to write consistency tests for the following items still...........
+            // deprecated exceptions
+            add("org.apache.tinkerpop.gremlin.structure.Element$Exceptions#elementAlreadyRemoved"); // as of 3.1.0
+
+            // need to write consistency tests for the following items still...........
             add("org.apache.tinkerpop.gremlin.process.computer.GraphComputer$Exceptions#supportsDirectObjects");
         }};
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jEdge.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jEdge.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jEdge.java
index 71e36eb..0ef5fcb 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jEdge.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jEdge.java
@@ -65,8 +65,6 @@ public final class Neo4jEdge extends Neo4jElement implements Edge, WrappedEdge<N
 
     @Override
     public void remove() {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Edge.class, this.getBaseEdge().getId());
-        this.removed = true;
         this.graph.tx().readWrite();
         try {
             this.baseElement.delete();
@@ -108,14 +106,10 @@ public final class Neo4jEdge extends Neo4jElement implements Edge, WrappedEdge<N
     @Override
     public <V> Property<V> property(final String key) {
         this.graph.tx().readWrite();
-        try {
-            if (this.baseElement.hasProperty(key))
-                return new Neo4jProperty<>(this, key, (V) this.baseElement.getProperty(key));
-            else
-                return Property.empty();
-        } catch (final IllegalStateException e) {
-            throw Element.Exceptions.elementAlreadyRemoved(this.getClass(), this.id());
-        }
+        if (this.baseElement.hasProperty(key))
+            return new Neo4jProperty<>(this, key, (V) this.baseElement.getProperty(key));
+        else
+            return Property.empty();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jElement.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jElement.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jElement.java
index 83345e3..d92775a 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jElement.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jElement.java
@@ -34,7 +34,6 @@ import java.util.Set;
 public abstract class Neo4jElement implements Element, WrappedElement<Neo4jEntity> {
     protected final Neo4jGraph graph;
     protected final Neo4jEntity baseElement;
-    public boolean removed = false;
 
     public Neo4jElement(final Neo4jEntity baseElement, final Neo4jGraph graph) {
         this.baseElement = baseElement;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java
index 51fae20..bf56266 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertex.java
@@ -50,7 +50,6 @@ public final class Neo4jVertex extends Neo4jElement implements Vertex, WrappedVe
     @Override
     public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) {
         if (null == inVertex) throw Graph.Exceptions.argumentCanNotBeNull("inVertex");
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.id());
         ElementHelper.validateLabel(label);
         ElementHelper.legalPropertyKeyValueArray(keyValues);
         if (ElementHelper.getIdValue(keyValues).isPresent())
@@ -70,15 +69,12 @@ public final class Neo4jVertex extends Neo4jElement implements Vertex, WrappedVe
 
     @Override
     public void remove() {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.id());
-        this.removed = true;
         this.graph.tx().readWrite();
         this.graph.trait.removeVertex(this);
     }
 
     @Override
     public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.id());
         ElementHelper.validateProperty(key, value);
         if (ElementHelper.getIdValue(keyValues).isPresent())
             throw Vertex.Exceptions.userSuppliedIdsNotSupported();
@@ -88,14 +84,12 @@ public final class Neo4jVertex extends Neo4jElement implements Vertex, WrappedVe
 
     @Override
     public <V> VertexProperty<V> property(final String key) {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.id());
         this.graph.tx().readWrite();
         return this.graph.trait.getVertexProperty(this, key);
     }
 
     @Override
     public <V> Iterator<VertexProperty<V>> properties(final String... propertyKeys) {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.id());
         this.graph.tx().readWrite();
         return this.graph.trait.getVertexProperties(this, propertyKeys);
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java
index b33081a..108aec2 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jVertexProperty.java
@@ -43,7 +43,6 @@ public final class Neo4jVertexProperty<V> implements VertexProperty<V> {
     protected final String key;
     protected final V value;
     protected Neo4jNode vertexPropertyNode;
-    protected boolean removed = false;
 
     public Neo4jVertexProperty(final Neo4jVertex vertex, final String key, final V value) {
         this.vertex = vertex;
@@ -94,14 +93,12 @@ public final class Neo4jVertexProperty<V> implements VertexProperty<V> {
 
     @Override
     public <U> Iterator<Property<U>> properties(final String... propertyKeys) {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(VertexProperty.class, this.id());
         this.vertex.graph.tx().readWrite();
         return this.vertex.graph.trait.getProperties(this, propertyKeys);
     }
 
     @Override
     public <U> Property<U> property(final String key, final U value) {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(VertexProperty.class, this.id());
         this.vertex.graph.tx().readWrite();
         ElementHelper.validateProperty(key, value);
         return this.vertex.graph.trait.setProperty(this, key, value);
@@ -109,8 +106,6 @@ public final class Neo4jVertexProperty<V> implements VertexProperty<V> {
 
     @Override
     public void remove() {
-        if (this.removed) return;
-        this.removed = true;
         this.vertex.graph.tx().readWrite();
         this.vertex.graph.trait.removeVertexProperty(this);
         this.vertexPropertyNode= null;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/MultiMetaNeo4jTrait.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/MultiMetaNeo4jTrait.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/MultiMetaNeo4jTrait.java
index 1fe4274..a4ad12b 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/MultiMetaNeo4jTrait.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/MultiMetaNeo4jTrait.java
@@ -233,19 +233,11 @@ public final class MultiMetaNeo4jTrait implements Neo4jTrait {
 
     @Override
     public <V> Property<V> getProperty(final Neo4jVertexProperty vertexProperty, final String key) {
-        try {
-            final Neo4jNode vertexPropertyNode = Neo4jHelper.getVertexPropertyNode(vertexProperty);
-            if (null != vertexPropertyNode && vertexPropertyNode.hasProperty(key))
-                return new Neo4jProperty<>(vertexProperty, key, (V) vertexPropertyNode.getProperty(key));
-            else
-                return Property.empty();
-        } catch (IllegalStateException ex) {
-            throw Element.Exceptions.elementAlreadyRemoved(vertexProperty.getClass(), vertexProperty.id());
-        } catch (RuntimeException ex) {
-            if (Neo4jHelper.isNotFound(ex))
-                throw Element.Exceptions.elementAlreadyRemoved(vertexProperty.getClass(), vertexProperty.id());
-            throw ex;
-        }
+        final Neo4jNode vertexPropertyNode = Neo4jHelper.getVertexPropertyNode(vertexProperty);
+        if (null != vertexPropertyNode && vertexPropertyNode.hasProperty(key))
+            return new Neo4jProperty<>(vertexProperty, key, (V) vertexPropertyNode.getProperty(key));
+        else
+            return Property.empty();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerEdge.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerEdge.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerEdge.java
index 4ea19bc..bcfe485 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerEdge.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerEdge.java
@@ -21,7 +21,6 @@ package org.apache.tinkerpop.gremlin.tinkergraph.structure;
 import org.apache.tinkerpop.gremlin.structure.T;
 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.Property;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
@@ -54,6 +53,7 @@ public final class TinkerEdge extends TinkerElement implements Edge {
 
     @Override
     public <V> Property<V> property(final String key, final V value) {
+        if (this.removed) throw elementAlreadyRemoved(Edge.class, id);
         ElementHelper.validateProperty(key, value);
         final Property oldProperty = super.property(key);
         final Property<V> newProperty = new TinkerProperty<>(this, key, value);
@@ -66,7 +66,6 @@ public final class TinkerEdge extends TinkerElement implements Edge {
 
     @Override
     public <V> Property<V> property(final String key) {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(this.getClass(), this.id);
         return null == this.properties ? Property.<V>empty() : this.properties.getOrDefault(key, Property.<V>empty());
     }
 
@@ -77,8 +76,6 @@ public final class TinkerEdge extends TinkerElement implements Edge {
 
     @Override
     public void remove() {
-        if (this.removed)
-            throw Element.Exceptions.elementAlreadyRemoved(Edge.class, this.id);
         final TinkerVertex outVertex = (TinkerVertex) this.outVertex;
         final TinkerVertex inVertex = (TinkerVertex) this.inVertex;
 
@@ -117,6 +114,7 @@ public final class TinkerEdge extends TinkerElement implements Edge {
 
     @Override
     public Iterator<Vertex> vertices(final Direction direction) {
+        if (removed) return Collections.emptyIterator();
         switch (direction) {
             case OUT:
                 return IteratorUtils.of(this.outVertex);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerElement.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerElement.java b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerElement.java
index fcdb09d..a2ee75b 100644
--- a/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerElement.java
+++ b/tinkergraph-gremlin/src/main/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerElement.java
@@ -56,4 +56,7 @@ public abstract class TinkerElement implements Element {
         return ElementHelper.areEqual(this, object);
     }
 
+    protected static IllegalStateException elementAlreadyRemoved(final Class<? extends Element> clazz, final Object id) {
+        return new IllegalStateException(String.format("%s with id %s was removed.", clazz.getSimpleName(), id));
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/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 ca3a35b..877d338 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
@@ -20,7 +20,6 @@ package org.apache.tinkerpop.gremlin.tinkergraph.structure;
 
 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;
@@ -60,8 +59,7 @@ public final class TinkerVertex extends TinkerElement implements Vertex {
 
     @Override
     public <V> VertexProperty<V> property(final String key) {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.id);
-
+        if (this.removed) return VertexProperty.empty();
         if (TinkerHelper.inComputerMode(this.graph)) {
             final List<VertexProperty> list = (List) this.graph.graphComputerView.getProperty(this, key);
             if (list.size() == 0)
@@ -84,7 +82,7 @@ public final class TinkerVertex extends TinkerElement implements Vertex {
 
     @Override
     public <V> VertexProperty<V> property(final VertexProperty.Cardinality cardinality, final String key, final V value, final Object... keyValues) {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.id);
+        if (this.removed) throw elementAlreadyRemoved(Vertex.class, id);
         ElementHelper.legalPropertyKeyValueArray(keyValues);
         ElementHelper.validateProperty(key, value);
         final Optional<Object> optionalId = ElementHelper.getIdValue(keyValues);
@@ -123,13 +121,12 @@ public final class TinkerVertex extends TinkerElement implements Vertex {
     @Override
     public Edge addEdge(final String label, final Vertex vertex, final Object... keyValues) {
         if (null == vertex) throw Graph.Exceptions.argumentCanNotBeNull("vertex");
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.id);
+        if (this.removed) throw elementAlreadyRemoved(Vertex.class, this.id);
         return TinkerHelper.addEdge(this.graph, this, (TinkerVertex) vertex, label, keyValues);
     }
 
     @Override
     public void remove() {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, this.id);
         final List<Edge> edges = new ArrayList<>();
         this.edges(Direction.BOTH).forEachRemaining(edges::add);
         edges.stream().filter(edge -> !((TinkerEdge) edge).removed).forEach(Edge::remove);
@@ -156,6 +153,7 @@ public final class TinkerVertex extends TinkerElement implements Vertex {
 
     @Override
     public <V> Iterator<VertexProperty<V>> properties(final String... propertyKeys) {
+        if (this.removed) return Collections.emptyIterator();
         if (TinkerHelper.inComputerMode((TinkerGraph) graph()))
             return (Iterator) ((TinkerGraph) graph()).graphComputerView.getProperties(TinkerVertex.this).stream().filter(p -> ElementHelper.keyExists(p.key(), propertyKeys)).iterator();
         else {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/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 922710c..3ca871a 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
@@ -111,12 +111,12 @@ public class TinkerVertexProperty<V> extends TinkerElement implements VertexProp
 
     @Override
     public <U> Property<U> property(final String key) {
-        if (this.removed) throw Element.Exceptions.elementAlreadyRemoved(this.getClass(), this.id);
         return null == this.properties ? Property.<U>empty() : this.properties.getOrDefault(key, Property.<U>empty());
     }
 
     @Override
     public <U> Property<U> property(final String key, final U value) {
+        if (this.removed) throw elementAlreadyRemoved(VertexProperty.class, id);
         final Property<U> property = new TinkerProperty<>(this, key, value);
         if (this.properties == null) this.properties = new HashMap<>();
         this.properties.put(key, property);

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/89861564/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
----------------------------------------------------------------------
diff --git a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
index 3e3b2dc..0d49ba2 100644
--- a/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
+++ b/tinkergraph-gremlin/src/test/java/org/apache/tinkerpop/gremlin/tinkergraph/structure/TinkerGraphTest.java
@@ -28,10 +28,12 @@ import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.io.IoCore;
 import org.apache.tinkerpop.gremlin.structure.io.IoTest;
 import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLIo;
 import org.apache.tinkerpop.gremlin.util.TimeUtil;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -45,6 +47,7 @@ import java.util.function.Supplier;
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.*;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -441,4 +444,38 @@ public class TinkerGraphTest {
             }
         }
     }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotModifyAVertexThatWasRemoved() {
+        final TinkerGraph graph = TinkerGraph.open();
+        final Vertex v = graph.addVertex();
+        v.property("name", "stephen");
+
+        assertEquals("stephen", v.value("name"));
+        v.remove();
+
+        v.property("status", 1);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotAddEdgeToAVertexThatWasRemoved() {
+        final TinkerGraph graph = TinkerGraph.open();
+        final Vertex v = graph.addVertex();
+        v.property("name", "stephen");
+
+        assertEquals("stephen", v.value("name"));
+        v.remove();
+        v.addEdge("self", v);
+    }
+
+    @Test(expected = IllegalStateException.class)
+    public void shouldNotReadValueOfPropertyOnVertexThatWasRemoved() {
+        final TinkerGraph graph = TinkerGraph.open();
+        final Vertex v = graph.addVertex();
+        v.property("name", "stephen");
+
+        assertEquals("stephen", v.value("name"));
+        v.remove();
+        v.value("name");
+    }
 }