You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2015/06/03 02:12:22 UTC

[17/50] [abbrv] incubator-tinkerpop git commit: more tests, more fixes.... very clean.

more tests, more fixes.... very clean.


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

Branch: refs/heads/preprocessor
Commit: c19398c1d3f93e1ead67e19596c2b8875d228dda
Parents: 24c88a0
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri May 29 12:15:51 2015 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri May 29 12:15:51 2015 -0600

----------------------------------------------------------------------
 .../gremlin/neo4j/structure/Neo4jEdge.java      |  8 ++++-
 .../gremlin/neo4j/structure/Neo4jElement.java   | 12 ++-----
 .../gremlin/neo4j/structure/Neo4jGraph.java     | 23 ++-----------
 .../gremlin/neo4j/structure/Neo4jHelper.java    |  8 ++---
 .../gremlin/neo4j/structure/Neo4jProperty.java  |  7 +++-
 .../gremlin/neo4j/structure/Neo4jVertex.java    |  3 ++
 .../neo4j/structure/Neo4jVertexProperty.java    |  8 ++++-
 .../structure/trait/MultiMetaNeo4jTrait.java    | 18 ++++++----
 .../trait/NoMultiNoMetaNeo4jTrait.java          | 14 ++++----
 .../neo4j/MultiMetaNeo4jGraphProvider.java      |  1 -
 .../neo4j/NoMultiNoMetaNeo4jGraphProvider.java  |  1 -
 .../structure/NativeNeo4jStructureTest.java     | 35 ++++++++++----------
 12 files changed, 65 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/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 c2bbd6b..f0a5139 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
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.Property;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.apache.tinkerpop.gremlin.structure.util.ElementHelper;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.structure.util.wrapped.WrappedEdge;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
@@ -96,6 +97,11 @@ public final class Neo4jEdge extends Neo4jElement implements Edge, WrappedEdge<N
 
     @Override
     public <V> Iterator<Property<V>> properties(final String... propertyKeys) {
-        return (Iterator) super.properties(propertyKeys);
+        this.graph.tx().readWrite();
+        Iterable<String> keys = this.baseElement.getKeys();
+        Iterator<String> filter = IteratorUtils.filter(keys.iterator(),
+                key -> ElementHelper.keyExists(key, propertyKeys));
+        return IteratorUtils.map(filter,
+                key -> new Neo4jProperty<>(this, key, (V) this.baseElement.getProperty(key)));
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/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 9e9bdb7..7dfc9a8 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
@@ -35,7 +35,7 @@ import java.util.Set;
 public abstract class Neo4jElement implements Element, WrappedElement<Neo4jEntity> {
     protected final Neo4jGraph graph;
     protected final Neo4jEntity baseElement;
-    protected boolean removed = false;
+    public boolean removed = false;
 
     public Neo4jElement(final Neo4jEntity baseElement, final Neo4jGraph graph) {
         this.baseElement = baseElement;
@@ -99,14 +99,6 @@ public abstract class Neo4jElement implements Element, WrappedElement<Neo4jEntit
         return this.baseElement;
     }
 
-    @Override
-    public <V> Iterator<? extends Property<V>> properties(final String... propertyKeys) {
-        this.graph.tx().readWrite();
-        Iterable<String> keys = this.baseElement.getKeys();
-        Iterator<String> filter = IteratorUtils.filter(keys.iterator(),
-                key -> ElementHelper.keyExists(key, propertyKeys));
-        return IteratorUtils.map(filter,
-                key -> new Neo4jProperty<>(this, key, (V) this.baseElement.getProperty(key)));
-    }
+
 
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
index 898286d..07aa0ef 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jGraph.java
@@ -76,19 +76,15 @@ public final class Neo4jGraph implements Graph, WrappedGraph<Neo4jGraphAPI> {
     public static final String CONFIG_CONF = "gremlin.neo4j.conf";
     public static final String CONFIG_META_PROPERTIES = "gremlin.neo4j.metaProperties";
     public static final String CONFIG_MULTI_PROPERTIES = "gremlin.neo4j.multiProperties";
-    public static final String CONFIG_CHECK_ELEMENTS_IN_TRANSACTION = "gremlin.neo4j.checkElementsInTransaction";
 
     private final Neo4jTransaction neo4jTransaction = new Neo4jTransaction();
     private Neo4jGraphVariables neo4jGraphVariables;
 
-    protected boolean checkElementsInTransaction = false;
-
     protected Neo4jTrait trait;
 
     private void initialize(final Neo4jGraphAPI baseGraph, final Configuration configuration) {
         this.configuration.copy(configuration);
         this.baseGraph = baseGraph;
-        this.checkElementsInTransaction = this.configuration.getBoolean(CONFIG_CHECK_ELEMENTS_IN_TRANSACTION, false);
         boolean supportsMetaProperties = this.configuration.getBoolean(CONFIG_META_PROPERTIES, false);
         boolean supportsMultiProperties = this.configuration.getBoolean(CONFIG_MULTI_PROPERTIES, false);
         if (supportsMultiProperties != supportsMetaProperties)
@@ -151,7 +147,7 @@ public final class Neo4jGraph implements Graph, WrappedGraph<Neo4jGraphAPI> {
         if (0 == vertexIds.length) {
             final Predicate<Neo4jNode> nodePredicate = this.trait.getNodePredicate();
             return IteratorUtils.stream(this.getBaseGraph().allNodes())
-                    .filter(node -> !this.checkElementsInTransaction || !Neo4jHelper.isDeleted(node))
+                    //.filter(node -> !Neo4jHelper.isDeleted(node))
                     .filter(nodePredicate)
                     .map(node -> (Vertex) new Neo4jVertex(node, this)).iterator();
         } else {
@@ -184,7 +180,7 @@ public final class Neo4jGraph implements Graph, WrappedGraph<Neo4jGraphAPI> {
         if (0 == edgeIds.length) {
             final Predicate<Neo4jRelationship> relationshipPredicate = this.trait.getRelationshipPredicate();
             return IteratorUtils.stream(this.getBaseGraph().allRelationships())
-                    .filter(relationship -> !this.checkElementsInTransaction || !Neo4jHelper.isDeleted(relationship))
+                    //.filter(relationship -> !Neo4jHelper.isDeleted(relationship))
                     .filter(relationshipPredicate)
                     .map(relationship -> (Edge) new Neo4jEdge(relationship, this)).iterator();
         } else {
@@ -269,21 +265,6 @@ public final class Neo4jGraph implements Graph, WrappedGraph<Neo4jGraphAPI> {
     }
 
     /**
-     * Neo4j's transactions are not consistent between the graph and the graph
-     * indices. Moreover, global graph operations are not consistent. For
-     * example, if a vertex is removed and then an index is queried in the same
-     * transaction, the removed vertex can be returned. This method allows the
-     * developer to turn on/off a Neo4jGraph 'hack' that ensures transactional
-     * consistency. The default behavior for Neo4jGraph is {@code true}.
-     *
-     * @param checkElementsInTransaction check whether an element is in the transaction between
-     *                                   returning it
-     */
-    public void checkElementsInTransaction(final boolean checkElementsInTransaction) {
-        this.checkElementsInTransaction = checkElementsInTransaction;
-    }
-
-    /**
      * Execute the Cypher query and get the result set as a {@link GraphTraversal}.
      *
      * @param query the Cypher query to execute

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java
index d6679dd..524a089 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jHelper.java
@@ -50,20 +50,20 @@ public final class Neo4jHelper {
         }
     }
 
-    public static boolean isDeleted(final Neo4jRelationship relationship) {
+    /*public static boolean isDeleted(final Neo4jRelationship relationship) {
         try {
             relationship.type();
             return false;
         } catch (final IllegalStateException e) {
             return true;
         }
-    }
+    }*/
 
     public static boolean isNotFound(RuntimeException ex) {
         return ex.getClass().getSimpleName().equals("NotFoundException");
     }
 
-    public static boolean keyExistsInNeo4j(final Neo4jNode node, final String key) {
+    /*public static boolean keyExistsInNeo4j(final Neo4jNode node, final String key) {
         try {
             return node.hasProperty(key);
         } catch (IllegalStateException ex) {
@@ -75,7 +75,7 @@ public final class Neo4jHelper {
                 throw Element.Exceptions.elementAlreadyRemoved(Vertex.class, node.getId());
             throw ex;
         }
-    }
+    }*/
 
     public static Neo4jNode getVertexPropertyNode(final Neo4jVertexProperty vertexProperty) {
         return vertexProperty.vertexPropertyNode;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jProperty.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jProperty.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jProperty.java
index d283269..30aa0c1 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jProperty.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/Neo4jProperty.java
@@ -33,6 +33,7 @@ public final class Neo4jProperty<V> implements Property<V> {
     protected final String key;
     protected final Neo4jGraph graph;
     protected V value;
+    protected boolean removed = false;
 
     public Neo4jProperty(final Element element, final String key, final V value) {
         this.element = element;
@@ -50,8 +51,12 @@ public final class Neo4jProperty<V> implements Property<V> {
 
     @Override
     public void remove() {
+        if (this.removed) return;
+        this.removed = true;
         this.graph.tx().readWrite();
-        final Neo4jEntity entity = ((Neo4jElement) this.element).getBaseElement();
+        final Neo4jEntity entity = this.element instanceof Neo4jVertexProperty ?
+                ((Neo4jVertexProperty) this.element).vertexPropertyNode :
+                ((Neo4jElement) this.element).getBaseElement();
         if (entity.hasProperty(this.key)) {
             entity.removeProperty(this.key);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/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 d7bdf4f..51fae20 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
@@ -79,6 +79,9 @@ public final class Neo4jVertex extends Neo4jElement implements Vertex, WrappedVe
     @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();
         this.graph.tx().readWrite();
         return this.graph.trait.setVertexProperty(this, cardinality, key, value, keyValues);
     }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/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 12e55e1..9c85dfc 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
@@ -28,7 +28,6 @@ import org.neo4j.tinkerpop.api.Neo4jNode;
 
 import java.util.Iterator;
 import java.util.NoSuchElementException;
-import java.util.Optional;
 
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
@@ -39,6 +38,7 @@ 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) {
@@ -83,20 +83,26 @@ 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);
     }
 
     @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;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/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 6b4b2a3..fb2e8c2 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
@@ -55,14 +55,17 @@ public class MultiMetaNeo4jTrait implements Neo4jTrait {
     public static final String VERTEX_PROPERTY_PREFIX = Graph.Hidden.hide("");
     public static final String VERTEX_PROPERTY_TOKEN = Graph.Hidden.hide("vertexProperty");
 
+    private static final Predicate<Neo4jNode> NODE_PREDICATE = node -> !node.hasLabel(VERTEX_PROPERTY_LABEL);
+    private static final Predicate<Neo4jRelationship> RELATIONSHIP_PREDICATE = relationship -> !relationship.type().startsWith(VERTEX_PROPERTY_PREFIX);
+
     @Override
     public Predicate<Neo4jNode> getNodePredicate() {
-        return node -> !node.hasLabel(VERTEX_PROPERTY_LABEL);
+        return NODE_PREDICATE;
     }
 
     @Override
     public Predicate<Neo4jRelationship> getRelationshipPredicate() {
-        return relationship -> !relationship.type().startsWith(VERTEX_PROPERTY_PREFIX);
+        return RELATIONSHIP_PREDICATE;
     }
 
     @Override
@@ -89,7 +92,7 @@ public class MultiMetaNeo4jTrait implements Neo4jTrait {
     @Override
     public <V> VertexProperty<V> getVertexProperty(final Neo4jVertex vertex, final String key) {
         final Neo4jNode node = vertex.getBaseVertex();
-        if (Neo4jHelper.keyExistsInNeo4j(node, key)) {
+        if (node.hasProperty(key)) {
             if (node.getProperty(key).equals(VERTEX_PROPERTY_TOKEN)) {
                 if (node.degree(Neo4jDirection.OUTGOING, VERTEX_PROPERTY_PREFIX.concat(key)) > 1)
                     throw Vertex.Exceptions.multiplePropertiesExistForProvidedKey(key);
@@ -106,6 +109,7 @@ public class MultiMetaNeo4jTrait implements Neo4jTrait {
 
     @Override
     public <V> Iterator<VertexProperty<V>> getVertexProperties(final Neo4jVertex vertex, final String... keys) {
+        if (Neo4jHelper.isDeleted(vertex.getBaseVertex())) return Collections.emptyIterator(); // TODO: WHY?
         return IteratorUtils.stream(vertex.getBaseVertex().getKeys())
                 .filter(key -> ElementHelper.keyExists(key, keys))
                 .flatMap(key -> {
@@ -128,7 +132,7 @@ public class MultiMetaNeo4jTrait implements Neo4jTrait {
             final Neo4jNode node = vertex.getBaseVertex();
             final Neo4jGraphAPI graph = ((Neo4jGraph) vertex.graph()).getBaseGraph();
             final String prefixedKey = VERTEX_PROPERTY_PREFIX.concat(key);
-            if (Neo4jHelper.keyExistsInNeo4j(node, key)) {
+            if (node.hasProperty(key)) {
                 if (node.getProperty(key).equals(VERTEX_PROPERTY_TOKEN)) {
                     final Neo4jNode vertexPropertyNode = graph.createNode(VERTEX_PROPERTY_LABEL, key);
                     vertexPropertyNode.setProperty(T.key.getAccessor(), key);
@@ -181,14 +185,14 @@ public class MultiMetaNeo4jTrait implements Neo4jTrait {
     public void removeVertexProperty(final Neo4jVertexProperty vertexProperty) {
         final Neo4jNode vertexPropertyNode = Neo4jHelper.getVertexPropertyNode(vertexProperty);
         final Neo4jNode vertexNode = ((Neo4jVertex) vertexProperty.element()).getBaseVertex();
-        if (null != vertexPropertyNode) {
-            vertexPropertyNode.relationships(null).forEach(Neo4jRelationship::delete);
-            vertexPropertyNode.delete();
+        if (null == vertexPropertyNode) {
             if (vertexNode.degree(Neo4jDirection.OUTGOING, VERTEX_PROPERTY_PREFIX.concat(vertexProperty.key())) == 0) {
                 if (vertexNode.hasProperty(vertexProperty.key()))
                     vertexNode.removeProperty(vertexProperty.key());
             }
         } else {
+            vertexPropertyNode.relationships(null).forEach(Neo4jRelationship::delete);
+            vertexPropertyNode.delete();
             if (vertexNode.degree(Neo4jDirection.OUTGOING, VERTEX_PROPERTY_PREFIX.concat(vertexProperty.key())) == 0) {
                 if (vertexNode.hasProperty(vertexProperty.key()))
                     vertexNode.removeProperty(vertexProperty.key());

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/NoMultiNoMetaNeo4jTrait.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/NoMultiNoMetaNeo4jTrait.java b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/NoMultiNoMetaNeo4jTrait.java
index c241328..25be842 100644
--- a/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/NoMultiNoMetaNeo4jTrait.java
+++ b/neo4j-gremlin/src/main/java/org/apache/tinkerpop/gremlin/neo4j/structure/trait/NoMultiNoMetaNeo4jTrait.java
@@ -40,14 +40,16 @@ import java.util.function.Predicate;
  */
 public class NoMultiNoMetaNeo4jTrait implements Neo4jTrait {
 
+    private final static Predicate TRUE_PREDICATE = x -> true;
+
     @Override
     public Predicate<Neo4jNode> getNodePredicate() {
-        return node -> true;
+        return TRUE_PREDICATE;
     }
 
     @Override
     public Predicate<Neo4jRelationship> getRelationshipPredicate() {
-        return relationship -> true;
+        return TRUE_PREDICATE;
     }
 
     @Override
@@ -68,10 +70,7 @@ public class NoMultiNoMetaNeo4jTrait implements Neo4jTrait {
 
     @Override
     public <V> VertexProperty<V> getVertexProperty(final Neo4jVertex vertex, final String key) {
-        if (Neo4jHelper.keyExistsInNeo4j(vertex.getBaseVertex(), key)) {
-            return new Neo4jVertexProperty<>(vertex, key, (V) vertex.getBaseVertex().getProperty(key));
-        } else
-            return VertexProperty.<V>empty();
+        return vertex.getBaseVertex().hasProperty(key) ? new Neo4jVertexProperty<>(vertex, key, (V) vertex.getBaseVertex().getProperty(key)) : VertexProperty.<V>empty();
     }
 
     @Override
@@ -87,7 +86,6 @@ public class NoMultiNoMetaNeo4jTrait implements Neo4jTrait {
             throw VertexProperty.Exceptions.multiPropertiesNotSupported();
         if (keyValues.length > 0)
             throw VertexProperty.Exceptions.metaPropertiesNotSupported();
-        ElementHelper.validateProperty(key, value);
         try {
             vertex.getBaseVertex().setProperty(key, value);
             return new Neo4jVertexProperty<>(vertex, key, value);
@@ -113,7 +111,7 @@ public class NoMultiNoMetaNeo4jTrait implements Neo4jTrait {
 
     @Override
     public void removeVertexProperty(final Neo4jVertexProperty vertexProperty) {
-        if (Neo4jHelper.keyExistsInNeo4j(((Neo4jVertex) vertexProperty.element()).getBaseVertex(), vertexProperty.key()))
+        if ((((Neo4jVertex) vertexProperty.element()).getBaseVertex().hasProperty(vertexProperty.key())))
             ((Neo4jVertex) vertexProperty.element()).getBaseVertex().removeProperty(vertexProperty.key());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/MultiMetaNeo4jGraphProvider.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/MultiMetaNeo4jGraphProvider.java b/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/MultiMetaNeo4jGraphProvider.java
index a81394f..672a779 100644
--- a/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/MultiMetaNeo4jGraphProvider.java
+++ b/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/MultiMetaNeo4jGraphProvider.java
@@ -39,7 +39,6 @@ public class MultiMetaNeo4jGraphProvider extends AbstractNeo4jGraphProvider {
             put(Neo4jGraph.CONFIG_DIRECTORY, directory);
             put(Neo4jGraph.CONFIG_META_PROPERTIES, true);
             put(Neo4jGraph.CONFIG_MULTI_PROPERTIES, true);
-            put(Neo4jGraph.CONFIG_CHECK_ELEMENTS_IN_TRANSACTION, true);
         }};
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/NoMultiNoMetaNeo4jGraphProvider.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/NoMultiNoMetaNeo4jGraphProvider.java b/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/NoMultiNoMetaNeo4jGraphProvider.java
index 0e7c29f..3a1381b 100644
--- a/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/NoMultiNoMetaNeo4jGraphProvider.java
+++ b/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/NoMultiNoMetaNeo4jGraphProvider.java
@@ -42,7 +42,6 @@ public class NoMultiNoMetaNeo4jGraphProvider extends AbstractNeo4jGraphProvider
             put(Neo4jGraph.CONFIG_DIRECTORY, directory);
             put(Neo4jGraph.CONFIG_META_PROPERTIES, false);
             put(Neo4jGraph.CONFIG_MULTI_PROPERTIES, false);
-            put(Neo4jGraph.CONFIG_CHECK_ELEMENTS_IN_TRANSACTION, true);
         }};
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/c19398c1/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/structure/NativeNeo4jStructureTest.java
----------------------------------------------------------------------
diff --git a/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/structure/NativeNeo4jStructureTest.java b/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/structure/NativeNeo4jStructureTest.java
index 4e79e14..2971e19 100644
--- a/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/structure/NativeNeo4jStructureTest.java
+++ b/neo4j-gremlin/src/test/java/org/apache/tinkerpop/gremlin/neo4j/structure/NativeNeo4jStructureTest.java
@@ -23,6 +23,7 @@ package org.apache.tinkerpop.gremlin.neo4j.structure;
 
 import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
 import org.apache.tinkerpop.gremlin.FeatureRequirement;
+import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
 import org.apache.tinkerpop.gremlin.neo4j.AbstractNeo4jGremlinTest;
 import org.apache.tinkerpop.gremlin.neo4j.structure.trait.MultiMetaNeo4jTrait;
@@ -490,7 +491,7 @@ public class NativeNeo4jStructureTest extends AbstractNeo4jGremlinTest {
             // assertEquals(2, a.properties("name").count().next().intValue());
             // assertEquals(1, b.properties("name").count().next().intValue());
             // assertEquals(1, b.properties("location").count().next().intValue());
-            // assertEquals(0, g.E().count().next().intValue());
+            assertEquals(0, g.E().count().next().intValue());
 
             assertEquals(4l, this.getGraph().execute("MATCH n RETURN COUNT(n)", null).next().get("COUNT(n)"));
             assertEquals(2l, this.getGraph().execute("MATCH (n)-[r]->(m) RETURN COUNT(r)", null).next().get("COUNT(r)"));
@@ -523,13 +524,12 @@ public class NativeNeo4jStructureTest extends AbstractNeo4jGremlinTest {
         });
 
         a.property("name", "the marko");
-        tryCommit(graph, g -> {
-            assertEquals(2, g.traversal().V().count().next().intValue());
+        tryCommit(graph, graph -> {
+            assertEquals(2, g.V().count().next().intValue());
             //assertEquals(1, a.prope rties().count().next().intValue());
             //  assertEquals(1, b.properties("name").count().next().intValue());
             // assertEquals(1, b.properties("location").count().next().intValue());
-            //  assertEquals(0, g.E().count().next().intValue());
-
+            assertEquals(0, g.E().count().next().intValue());
             assertEquals(2l, this.getGraph().execute("MATCH n RETURN COUNT(n)", null).next().get("COUNT(n)"));
             assertEquals(0l, this.getGraph().execute("MATCH (n)-[r]->(m) RETURN COUNT(r)", null).next().get("COUNT(r)"));
 
@@ -541,11 +541,11 @@ public class NativeNeo4jStructureTest extends AbstractNeo4jGremlinTest {
         });
 
         a.property("name").remove();
-        tryCommit(graph, g -> {
-            assertEquals(2, g.traversal().V().count().next().intValue());
+        tryCommit(graph, graph -> {
+            assertEquals(2, g.V().count().next().intValue());
             //    assertEquals(0, a.properties().count().next().intValue());
             //   assertEquals(2, b.properties().count().next().intValue());
-            //     assertEquals(0, g.E().count().next().intValue());
+            assertEquals(0, g.E().count().next().intValue());
             assertEquals(2l, this.getGraph().execute("MATCH n RETURN COUNT(n)", null).next().get("COUNT(n)"));
             assertEquals(0l, this.getGraph().execute("MATCH (n)-[r]->(m) RETURN COUNT(r)", null).next().get("COUNT(r)"));
             assertEquals(0, IteratorUtils.count(a.getBaseVertex().getKeys()));
@@ -554,12 +554,12 @@ public class NativeNeo4jStructureTest extends AbstractNeo4jGremlinTest {
 
         graph.tx().commit();
         a.property("name", "the marko", "acl", "private");
-        tryCommit(graph, g -> {
-            assertEquals(2, g.traversal().V().count().next().intValue());
+        tryCommit(graph, graph -> {
+            assertEquals(2, g.V().count().next().intValue());
             // assertEquals(1, a.properties("name").count().next().intValue());
             // assertEquals(1, b.properties("name").count().next().intValue());
             // assertEquals(1, b.properties("location").count().next().intValue());
-            //  assertEquals(0, g.E().count().next().intValue());
+            assertEquals(0, g.E().count().next().intValue());
 
             assertEquals(3l, this.getGraph().execute("MATCH n RETURN COUNT(n)", null).next().get("COUNT(n)"));
             assertEquals(1l, this.getGraph().execute("MATCH (n)-[r]->(m) RETURN COUNT(r)", null).next().get("COUNT(r)"));
@@ -597,14 +597,13 @@ public class NativeNeo4jStructureTest extends AbstractNeo4jGremlinTest {
 
         a.property(VertexProperty.Cardinality.list, "name", "marko", "acl", "private");
         a.property(VertexProperty.Cardinality.list, "name", "okram", "acl", "public");
-        graph.tx().commit();  // TODO tx.commit() THIS IS REQUIRED: ?! Why does Neo4j not delete vertices correctly?
         a.property(VertexProperty.Cardinality.single, "name", "the marko", "acl", "private");
-        tryCommit(graph, g -> {
-            assertEquals(2, g.traversal().V().count().next().intValue());
-            // assertEquals(1, a.properties("name").count().next().intValue());
-            // assertEquals(1, b.properties("name").count().next().intValue());
-            // assertEquals(1, b.properties("location").count().next().intValue());
-            // assertEquals(0, g.E().count().next().intValue());
+        tryCommit(graph, graph -> {
+            assertEquals(2, g.V().count().next().intValue());
+             //assertEquals(1, a.properties("name").count().next().intValue());
+             //assertEquals(1, b.properties("name").count().next().intValue());
+             //assertEquals(1, b.properties("location").count().next().intValue());
+             assertEquals(0, g.E().count().next().intValue());
 
             assertEquals(3l, this.getGraph().execute("MATCH n RETURN COUNT(n)", null).next().get("COUNT(n)"));
             assertEquals(1l, this.getGraph().execute("MATCH (n)-[r]->(m) RETURN COUNT(r)", null).next().get("COUNT(r)"));