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 2016/08/12 14:23:04 UTC
[1/8] tinkerpop git commit: TINKERPOP-1397 Fix StarGraph.addEdge
Repository: tinkerpop
Updated Branches:
refs/heads/master cc0c06f41 -> 1799fa461
TINKERPOP-1397 Fix StarGraph.addEdge
For self-loops, StarGraph.addEdge used to put a single StarOutEdge
into both its inEdges and outEdges maps, potentially causing problems
in applyGraphFilter.
This change makes StarGraph.addEdge put the appropriate type of edge
(Star(Out/In)Edge) in the associated map. The IDs for each edge
instance are kept in agreement.
This change is @okram's, who suggested it in PR #372. I merely
reviewed it and added a couple of comments.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/0022b7f6
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/0022b7f6
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/0022b7f6
Branch: refs/heads/master
Commit: 0022b7f6be25eb7d3c778b137beb6e8a7d2784ca
Parents: 4571061
Author: Dan LaRocque <da...@hopcount.org>
Authored: Wed Aug 10 18:52:13 2016 -0400
Committer: Dan LaRocque <da...@hopcount.org>
Committed: Wed Aug 10 19:10:39 2016 -0400
----------------------------------------------------------------------
.../gremlin/structure/util/star/StarGraph.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0022b7f6/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
index f516630..2089c42 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
@@ -37,6 +37,7 @@ import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -290,14 +291,16 @@ public final class StarGraph implements Graph, Serializable {
public Edge addEdge(final String label, final Vertex inVertex, final Object... keyValues) {
final Edge edge = this.addOutEdge(label, inVertex, keyValues);
if (inVertex.equals(this)) {
- if(null == this.inEdges)
- this.inEdges = new HashMap<>();
- List<Edge> inE = this.inEdges.get(label);
- if (null == inE) {
- inE = new ArrayList<>();
- this.inEdges.put(label, inE);
+ if (ElementHelper.getIdValue(keyValues).isPresent()) {
+ // reuse edge ID from method params
+ this.addInEdge(label, this, keyValues);
+ } else {
+ // copy edge ID that we just allocated with addOutEdge
+ final Object[] keyValuesWithId = Arrays.copyOf(keyValues, keyValues.length + 2);
+ keyValuesWithId[keyValuesWithId.length - 2] = T.id;
+ keyValuesWithId[keyValuesWithId.length - 1] = edge.id();
+ this.addInEdge(label, this, keyValuesWithId);
}
- inE.add(edge);
}
return edge;
}
[6/8] tinkerpop git commit: Merge branch 'tp31'
Posted by ok...@apache.org.
Merge branch 'tp31'
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/bf225b8c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/bf225b8c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/bf225b8c
Branch: refs/heads/master
Commit: bf225b8cc6a75e1a7781cb41bb2dd9f368b1ae70
Parents: cc0c06f 4443dcf
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Aug 12 08:14:10 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Aug 12 08:14:10 2016 -0600
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../gremlin/structure/util/star/StarGraph.java | 17 ++++++++++-------
2 files changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bf225b8c/CHANGELOG.asciidoc
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/bf225b8c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
----------------------------------------------------------------------
diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
index 73c7ca7,2089c42..90c02ff
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
@@@ -38,9 -37,9 +38,10 @@@ import org.apache.tinkerpop.gremlin.uti
import java.io.Serializable;
import java.util.ArrayList;
+ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
[3/8] tinkerpop git commit: Merge branch 'TINKERPOP-1397-tp31' into
TINKERPOP-1397
Posted by ok...@apache.org.
Merge branch 'TINKERPOP-1397-tp31' into TINKERPOP-1397
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b4aaa69b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b4aaa69b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b4aaa69b
Branch: refs/heads/master
Commit: b4aaa69b9c10a61c7ab2f7476c90e4728ef032e8
Parents: 7842c4e 0022b7f
Author: Dan LaRocque <da...@hopcount.org>
Authored: Wed Aug 10 19:24:10 2016 -0400
Committer: Dan LaRocque <da...@hopcount.org>
Committed: Wed Aug 10 19:24:10 2016 -0400
----------------------------------------------------------------------
.../gremlin/structure/util/star/StarGraph.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b4aaa69b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
----------------------------------------------------------------------
diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
index 73c7ca7,2089c42..90c02ff
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraph.java
@@@ -38,9 -37,9 +38,10 @@@ import org.apache.tinkerpop.gremlin.uti
import java.io.Serializable;
import java.util.ArrayList;
+ import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
[4/8] tinkerpop git commit: Merge branch 'TINKERPOP-1397-tp31' of
https://github.com/dalaro/incubator-tinkerpop into tp31
Posted by ok...@apache.org.
Merge branch 'TINKERPOP-1397-tp31' of https://github.com/dalaro/incubator-tinkerpop into tp31
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/2720b97d
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/2720b97d
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/2720b97d
Branch: refs/heads/master
Commit: 2720b97d62d827cf82ffad93715dfa261e34d8d8
Parents: 6d29394 0022b7f
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Aug 12 08:06:23 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Aug 12 08:06:23 2016 -0600
----------------------------------------------------------------------
.../gremlin/structure/util/star/StarGraph.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
[5/8] tinkerpop git commit: updated CHANGELOG.
Posted by ok...@apache.org.
updated CHANGELOG.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/4443dcf6
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/4443dcf6
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/4443dcf6
Branch: refs/heads/master
Commit: 4443dcf613096a96b3c426f6c391781dffdf0e0f
Parents: 2720b97
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Aug 12 08:14:00 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Aug 12 08:14:00 2016 -0600
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4443dcf6/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index fefffb0..201d1ae 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.1.4 (NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Fixed a bug in `StarGraph` around self-edges.
* Fixed a potential leak of a `ReferenceCounted` resource in Gremlin Server.
* Renamed distributions to make the prefix "apache-tinkerpop-" as opposed to just "apache-".
* Fixed a problem (previously thought resolved on 3.1.3) causing Gremlin Server to lock up when parallel requests were submitted on the same session if those parallel requests included a script that blocked indefinitely.
[7/8] tinkerpop git commit: Merge branch 'TINKERPOP-1397' of
https://github.com/dalaro/incubator-tinkerpop
Posted by ok...@apache.org.
Merge branch 'TINKERPOP-1397' of https://github.com/dalaro/incubator-tinkerpop
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/9f74b714
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/9f74b714
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/9f74b714
Branch: refs/heads/master
Commit: 9f74b7147a3287b57e0df93f30f93f10cd94de9f
Parents: bf225b8 b4aaa69
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Aug 12 08:14:30 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Aug 12 08:14:30 2016 -0600
----------------------------------------------------------------------
.../structure/util/star/StarGraphTest.java | 34 ++++++++++++++++++++
1 file changed, 34 insertions(+)
----------------------------------------------------------------------
[8/8] tinkerpop git commit: overroad tp31 GroovyTailTest edits on
master. CTR.
Posted by ok...@apache.org.
overroad tp31 GroovyTailTest edits on master. CTR.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1799fa46
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1799fa46
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1799fa46
Branch: refs/heads/master
Commit: 1799fa461c5cbfc8089e7553d33fd02a5d98307e
Parents: 9f74b71
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Aug 12 08:22:57 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Aug 12 08:22:57 2016 -0600
----------------------------------------------------------------------
.../gremlin/process/traversal/step/filter/GroovyTailTest.groovy | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1799fa46/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyTailTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyTailTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyTailTest.groovy
index c562233..4bc2321 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyTailTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyTailTest.groovy
@@ -56,7 +56,7 @@ public abstract class GroovyTailTest {
@Override
public Traversal<Vertex, Long> get_g_V_repeatXin_outX_timesX3X_tailX7X_count() {
- TraversalScriptHelper.compute("g.V.repeat(__.in().out()).times(3).tail(7).count()",g)
+ new ScriptTraversal<>(g, "gremlin-groovy", "g.V.repeat(__.in().out()).times(3).tail(7).count()")
}
@Override
[2/8] tinkerpop git commit: TINKERPOP-1397 Add StarGraph bothE
filtering test
Posted by ok...@apache.org.
TINKERPOP-1397 Add StarGraph bothE filtering test
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7842c4e7
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7842c4e7
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7842c4e7
Branch: refs/heads/master
Commit: 7842c4e7e2e3c2b33fc1bca7a8a80e165080bc59
Parents: fc79de8
Author: Dan LaRocque <da...@hopcount.org>
Authored: Wed Aug 10 18:59:54 2016 -0400
Committer: Dan LaRocque <da...@hopcount.org>
Committed: Wed Aug 10 19:21:56 2016 -0400
----------------------------------------------------------------------
.../structure/util/star/StarGraphTest.java | 34 ++++++++++++++++++++
1 file changed, 34 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7842c4e7/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java
index 034afad..c49dab0 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/util/star/StarGraphTest.java
@@ -23,6 +23,8 @@ import org.apache.tinkerpop.gremlin.AbstractGremlinTest;
import org.apache.tinkerpop.gremlin.FeatureRequirement;
import org.apache.tinkerpop.gremlin.LoadGraphWith;
import org.apache.tinkerpop.gremlin.TestHelper;
+import org.apache.tinkerpop.gremlin.process.computer.GraphFilter;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -246,6 +248,38 @@ public class StarGraphTest extends AbstractGremlinTest {
TestHelper.validateEdgeEquality(e1, v1.edges(Direction.IN).next());
}
+ @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_ADD_PROPERTY)
+ @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+ @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_PROPERTY)
+ public void shouldHandleBothEdgesGraphFilterOnSelfLoop() {
+ assertEquals(0l, IteratorUtils.count(graph.vertices()));
+ assertEquals(0l, IteratorUtils.count(graph.edges()));
+
+ // these vertex label, edge label, and property names/values were copied from existing tests
+ StarGraph starGraph = StarGraph.open();
+ Vertex vertex = starGraph.addVertex(T.label, "person", "name", "furnace");
+ Edge edge = vertex.addEdge("self", vertex);
+ edge.property("acl", "private");
+
+ // traversing a self-loop should yield the edge once for inE/outE
+ // and the edge twice for bothE (one edge emitted two times, not two edges)
+ assertEquals(1L, IteratorUtils.count(starGraph.traversal().V().inE()));
+ assertEquals(1L, IteratorUtils.count(starGraph.traversal().V().outE()));
+ assertEquals(2L, IteratorUtils.count(starGraph.traversal().V().bothE()));
+
+ // Try a filter that retains BOTH
+ GraphFilter graphFilter = new GraphFilter();
+ graphFilter.setEdgeFilter(__.bothE("self"));
+ starGraph = starGraph.applyGraphFilter(graphFilter).get();
+
+ // Retest traversal counts after filtering
+ assertEquals(1L, IteratorUtils.count(starGraph.traversal().V().inE()));
+ assertEquals(1L, IteratorUtils.count(starGraph.traversal().V().outE()));
+ assertEquals(2L, IteratorUtils.count(starGraph.traversal().V().bothE()));
+ }
+
private Pair<StarGraph, Integer> serializeDeserialize(final StarGraph starGraph) {
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();