tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject [2/3] tinkerpop git commit: fixed up a self-edge test and Neo4jVertex to support repeat edges on BOTH.
Date Wed, 01 Nov 2017 14:37:38 GMT
fixed up a self-edge test and Neo4jVertex to support repeat edges on BOTH.


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

Branch: refs/heads/tp32
Commit: 5d68ca17160e4977eddfdb688f93d37440897957
Parents: 7f640f7
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Mon Oct 30 15:28:37 2017 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Mon Oct 30 15:28:37 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../upgrade/release-3.2.x-incubating.asciidoc   | 10 ++++++++
 .../process/traversal/step/map/VertexTest.java  |  2 ++
 .../gremlin/neo4j/structure/Neo4jVertex.java    | 25 ++++++++++++++++----
 4 files changed, 33 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d68ca17/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 8e7657c..78b8ac0 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-2-7]]
 === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Added a test for self-edges and fixed `Neo4jVertex` to provided repeated self-edges on
`BOTH`.
 * Better respected permissions on the `plugins.txt` file and prevented writing if marked
as read-only.
 * Added getters for the lambdas held by `LambdaCollectingBarrierStep`, `LambdaFlatMapStep`
and `LambdaSideEffectStep`.
 * Fixed an old hack in `GroovyTranslator` and `PythonTranslator` where `Elements` were being
mapped to their id only.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d68ca17/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 41cff47..60fd320 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -167,6 +167,16 @@ implementations can simply add the new method and override its behavior.
The old
 
 See: link:https://issues.apache.org/jira/browse/TINKERPOP-1798[TINKERPOP-1798]
 
+=== Upgrading for Providers
+
+==== Direction.BOTH Requires Duplication of Self-Edges
+
+Prior to this release, there was no semantic check to determine whether a self-edge (e.g.
`e[1][2-self->2]`) would be returned
+twice on a `BOTH`. The semantics have been specified now in the test suite where the edge
should be returned twice as it
+is both an incoming edge and an outgoing edge.
+
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1821[TINKERPOP-1821]
+
 == TinkerPop 3.2.6
 
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d68ca17/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexTest.java
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexTest.java
index cb39884..8a57535 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/VertexTest.java
@@ -575,6 +575,7 @@ public abstract class VertexTest extends AbstractGremlinProcessTest {
     }
 
     @Test
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     public void g_V_bothEXselfX() {
         g.addV().as("a").addE("self").to("a").iterate();
         final Traversal<Vertex, Edge> traversal = get_g_V_bothEXselfX();
@@ -586,6 +587,7 @@ public abstract class VertexTest extends AbstractGremlinProcessTest {
     }
 
     @Test
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
     public void g_V_bothXselfX() {
         g.addV().as("a").addE("self").to("a").iterate();
         final Traversal<Vertex, Vertex> traversal = get_g_V_bothXselfX();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5d68ca17/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 bf56266..2bcd363 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
@@ -20,7 +20,6 @@ package org.apache.tinkerpop.gremlin.neo4j.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;
@@ -36,6 +35,10 @@ import java.util.Iterator;
 import java.util.Set;
 import java.util.TreeSet;
 
+import static org.apache.tinkerpop.gremlin.structure.Direction.BOTH;
+import static org.apache.tinkerpop.gremlin.structure.Direction.IN;
+import static org.apache.tinkerpop.gremlin.structure.Direction.OUT;
+
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
@@ -110,8 +113,14 @@ public final class Neo4jVertex extends Neo4jElement implements Vertex,
WrappedVe
         this.graph.tx().readWrite();
         return new Iterator<Vertex>() {
             final Iterator<Neo4jRelationship> relationshipIterator = IteratorUtils.filter(0
== edgeLabels.length ?
-                    getBaseVertex().relationships(Neo4jHelper.mapDirection(direction)).iterator()
:
-                    getBaseVertex().relationships(Neo4jHelper.mapDirection(direction), (edgeLabels)).iterator(),
graph.trait.getRelationshipPredicate());
+                    BOTH == direction ?
+                            IteratorUtils.concat(getBaseVertex().relationships(Neo4jHelper.mapDirection(OUT)).iterator(),
+                                    getBaseVertex().relationships(Neo4jHelper.mapDirection(IN)).iterator())
:
+                            getBaseVertex().relationships(Neo4jHelper.mapDirection(direction)).iterator()
:
+                    BOTH == direction ?
+                            IteratorUtils.concat(getBaseVertex().relationships(Neo4jHelper.mapDirection(OUT),
(edgeLabels)).iterator(),
+                                    getBaseVertex().relationships(Neo4jHelper.mapDirection(IN),
(edgeLabels)).iterator()) :
+                            getBaseVertex().relationships(Neo4jHelper.mapDirection(direction),
(edgeLabels)).iterator(), graph.trait.getRelationshipPredicate());
 
             @Override
             public boolean hasNext() {
@@ -130,8 +139,14 @@ public final class Neo4jVertex extends Neo4jElement implements Vertex,
WrappedVe
         this.graph.tx().readWrite();
         return new Iterator<Edge>() {
             final Iterator<Neo4jRelationship> relationshipIterator = IteratorUtils.filter(0
== edgeLabels.length ?
-                    getBaseVertex().relationships(Neo4jHelper.mapDirection(direction)).iterator()
:
-                    getBaseVertex().relationships(Neo4jHelper.mapDirection(direction), (edgeLabels)).iterator(),
graph.trait.getRelationshipPredicate());
+                    BOTH == direction ?
+                            IteratorUtils.concat(getBaseVertex().relationships(Neo4jHelper.mapDirection(OUT)).iterator(),
+                                    getBaseVertex().relationships(Neo4jHelper.mapDirection(IN)).iterator())
:
+                            getBaseVertex().relationships(Neo4jHelper.mapDirection(direction)).iterator()
:
+                    BOTH == direction ?
+                            IteratorUtils.concat(getBaseVertex().relationships(Neo4jHelper.mapDirection(OUT),
(edgeLabels)).iterator(),
+                                    getBaseVertex().relationships(Neo4jHelper.mapDirection(IN),
(edgeLabels)).iterator()) :
+                            getBaseVertex().relationships(Neo4jHelper.mapDirection(direction),
(edgeLabels)).iterator(), graph.trait.getRelationshipPredicate());
 
             @Override
             public boolean hasNext() {


Mime
View raw message