You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2017/11/01 14:38:19 UTC

[1/4] tinkerpop git commit: TINKERPOP-1821 Added tests for consistent traversal behavior around self-referencing edges

Repository: tinkerpop
Updated Branches:
  refs/heads/master e79e0ae65 -> f2436691a


TINKERPOP-1821 Added tests for consistent traversal behavior around self-referencing edges


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

Branch: refs/heads/master
Commit: 7f640f7e6d863cde1858d6bfa3ff502fd93a8663
Parents: 909cd91
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Oct 30 11:06:02 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Oct 30 11:06:02 2017 -0400

----------------------------------------------------------------------
 .../traversal/step/map/GroovyVertexTest.groovy  | 10 ++++++
 .../process/traversal/step/map/VertexTest.java  | 36 ++++++++++++++++++++
 2 files changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7f640f7e/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
index ce5fe6f..ff6275d 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyVertexTest.groovy
@@ -183,5 +183,15 @@ public abstract class GroovyVertexTest {
         public Traversal<Vertex, String> get_g_V_hasLabelXpersonX_V_hasLabelXsoftwareX_name() {
             new ScriptTraversal<>(g, "gremlin-groovy", "g.V.hasLabel('person').V.hasLabel('software').name")
         }
+
+        @Override
+        public Traversal<Vertex, Edge> get_g_V_bothEXselfX() {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V().bothE('self')")
+        }
+
+        @Override
+        public Traversal<Vertex, Vertex> get_g_V_bothXselfX() {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V().both('self')")
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7f640f7e/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 7f27338..cb39884 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
@@ -113,6 +113,10 @@ public abstract class VertexTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, String> get_g_V_hasLabelXpersonX_V_hasLabelXsoftwareX_name();
 
+    public abstract Traversal<Vertex, Edge> get_g_V_bothEXselfX();
+
+    public abstract Traversal<Vertex, Vertex> get_g_V_bothXselfX();
+
     // GRAPH VERTEX/EDGE
 
     @Test
@@ -570,6 +574,28 @@ public abstract class VertexTest extends AbstractGremlinProcessTest {
         checkResults(Arrays.asList("lop", "lop", "lop", "lop", "ripple", "ripple", "ripple", "ripple"), traversal);
     }
 
+    @Test
+    public void g_V_bothEXselfX() {
+        g.addV().as("a").addE("self").to("a").iterate();
+        final Traversal<Vertex, Edge> traversal = get_g_V_bothEXselfX();
+        printTraversalForm(traversal);
+
+        List<Edge> edges = traversal.toList();
+        assertEquals(2, edges.size());
+        assertEquals(edges.get(0), edges.get(1));
+    }
+
+    @Test
+    public void g_V_bothXselfX() {
+        g.addV().as("a").addE("self").to("a").iterate();
+        final Traversal<Vertex, Vertex> traversal = get_g_V_bothXselfX();
+        printTraversalForm(traversal);
+
+        List<Vertex> vertices = traversal.toList();
+        assertEquals(2, vertices.size());
+        assertEquals(vertices.get(0), vertices.get(1));
+    }
+
     public static class Traversals extends VertexTest {
 
         @Override
@@ -721,5 +747,15 @@ public abstract class VertexTest extends AbstractGremlinProcessTest {
         public Traversal<Vertex, String> get_g_V_hasLabelXpersonX_V_hasLabelXsoftwareX_name() {
             return g.V().hasLabel("person").V().hasLabel("software").values("name");
         }
+
+        @Override
+        public Traversal<Vertex, Edge> get_g_V_bothEXselfX() {
+            return g.V().bothE("self");
+        }
+
+        @Override
+        public Traversal<Vertex, Vertex> get_g_V_bothXselfX() {
+            return g.V().both("self");
+        }
     }
 }


[4/4] tinkerpop git commit: Merge branch 'tp32'

Posted by ok...@apache.org.
Merge branch 'tp32'


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

Branch: refs/heads/master
Commit: f2436691a7bff94da80e166c6a4245b933ede821
Parents: e79e0ae bef43d6
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Nov 1 08:38:11 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Nov 1 08:38:11 2017 -0600

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f2436691/CHANGELOG.asciidoc
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f2436691/docs/src/upgrade/release-3.2.x-incubating.asciidoc
----------------------------------------------------------------------


[3/4] tinkerpop git commit: Merge branch 'TINKERPOP-1821' into tp32

Posted by ok...@apache.org.
Merge branch 'TINKERPOP-1821' into tp32


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

Branch: refs/heads/master
Commit: bef43d6ca54284bf905883032ce168b91c910e36
Parents: f8c1307 5d68ca1
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Nov 1 08:37:31 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Nov 1 08:37:31 2017 -0600

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


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bef43d6c/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index 1d41ab9,78b8ac0..76bf96d
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -23,7 -23,7 +23,8 @@@ image::https://raw.githubusercontent.co
  [[release-3-2-7]]
  === TinkerPop 3.2.7 (Release Date: NOT OFFICIALLY RELEASED YET)
  
 +* `TraversalVertexProgram` ``profile()` now accounts for worker iteration in `GraphComputer` OLAP.
+ * 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.


[2/4] tinkerpop git commit: fixed up a self-edge test and Neo4jVertex to support repeat edges on BOTH.

Posted by ok...@apache.org.
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/master
Commit: 5d68ca17160e4977eddfdb688f93d37440897957
Parents: 7f640f7
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Oct 30 15:28:37 2017 -0600
Committer: Marko A. Rodriguez <ok...@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() {