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 2017/04/06 11:45:51 UTC

[01/50] tinkerpop git commit: Fixed bug in EvenStrategyTest for transactional Graphs [Forced Update!]

Repository: tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1577 ae8306c92 -> a007403bd (forced update)


Fixed bug in EvenStrategyTest for transactional Graphs

Can't use tryCommit() in the way that the tests where because tryCommit() is meant to be idempotent and some of the tests were passing in lambdas that mutated the graph. CTR


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

Branch: refs/heads/TINKERPOP-1577
Commit: 028cb473765b4704199e11e1d9aa4aa5ff5bfc99
Parents: e3e1dca
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 24 15:20:24 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri Mar 24 15:22:25 2017 -0400

----------------------------------------------------------------------
 .../process/traversal/step/filter/DropStep.java |   4 +-
 .../decoration/EventStrategyProcessTest.java    | 149 ++++++++++++-------
 2 files changed, 96 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/028cb473/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
index 9c4ae2f..87790eb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
@@ -47,7 +47,7 @@ public final class DropStep<S> extends FilterStep<S> implements Mutating<Event>
     protected boolean filter(Traverser.Admin<S> traverser) {
         final S s = traverser.get();
         if (s instanceof Element) {
-            final Element toRemove = ((Element) s);
+            final Element toRemove = (Element) s;
             if (callbackRegistry != null) {
                 final Event removeEvent;
                 if (s instanceof Vertex)
@@ -64,7 +64,7 @@ public final class DropStep<S> extends FilterStep<S> implements Mutating<Event>
 
             toRemove.remove();
         } else if (s instanceof Property) {
-            final Property toRemove = ((Property) s);
+            final Property toRemove = (Property) s;
             if (callbackRegistry != null) {
                 final Event.ElementPropertyEvent removeEvent;
                 if (toRemove.element() instanceof Edge)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/028cb473/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
index 76ae31c..6a20177 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
@@ -291,7 +291,6 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
 
         assertEquals(0, listener2.edgePropertyChangedEventRecorded());
         assertEquals(0, listener1.edgePropertyChangedEventRecorded());
-
     }
 
     @Test
@@ -537,16 +536,18 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final VertexProperty vp = v.property("xxx","blah");
+        final String label = vp.label();
+        final Object value = vp.value();
         final Property p = vp.property("to-drop", "dah");
         vp.property("not-dropped", "yay!");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyPropertyRemoved(final VertexProperty element, final Property property) {
-                assertEquals(vp.label(), element.label());
-                assertEquals(vp.value(), element.value());
-                assertEquals(p.value(), property.value());
-                assertEquals(p.key(), property.key());
+                assertEquals(label, element.label());
+                assertEquals(value, element.value());
+                assertEquals("dah", property.value());
+                assertEquals("to-drop", property.key());
                 triggered.set(true);
             }
         };
@@ -558,7 +559,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).properties("xxx").properties("to-drop").drop().iterate());
+        gts.V(v).properties("xxx").properties("to-drop").drop().iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertEquals(1, IteratorUtils.count(v.properties().next().properties()));
@@ -573,15 +575,17 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final VertexProperty vp = v.property("xxx","blah");
-        final Property p = vp.property("to-change", "dah");
+        final String label = vp.label();
+        final Object value = vp.value();
+        vp.property("to-change", "dah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyPropertyChanged(final VertexProperty element, final Property oldValue, final Object setValue) {
-                assertEquals(vp.label(), element.label());
-                assertEquals(vp.value(), element.value());
-                assertEquals(p.value(), oldValue.value());
-                assertEquals(p.key(), oldValue.key());
+                assertEquals(label, element.label());
+                assertEquals(value, element.value());
+                assertEquals("dah", oldValue.value());
+                assertEquals("to-change", oldValue.key());
                 assertEquals("bah", setValue);
                 triggered.set(true);
             }
@@ -594,7 +598,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).properties("xxx").property("to-change","bah").iterate());
+        gts.V(v).properties("xxx").property("to-change","bah").iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertEquals(1, IteratorUtils.count(v.properties().next().properties()));
@@ -608,13 +613,15 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final VertexProperty vp = v.property("xxx","blah");
-        final Property p = vp.property("to-change", "dah");
+        final String label = vp.label();
+        final Object value = vp.value();
+        vp.property("to-change", "dah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyPropertyChanged(final VertexProperty element, final Property oldValue, final Object setValue) {
-                assertEquals(vp.label(), element.label());
-                assertEquals(vp.value(), element.value());
+                assertEquals(label, element.label());
+                assertEquals(value, element.value());
                 assertEquals(null, oldValue.value());
                 assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
@@ -629,7 +636,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).properties("xxx").property("new","yay!").iterate());
+        gts.V(v).properties("xxx").property("new","yay!").iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertEquals(2, IteratorUtils.count(v.properties().next().properties()));
@@ -642,16 +650,19 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final Edge e = v.addEdge("self", v, "not-dropped", "yay!");
-        final Property p = e.property("to-drop", "dah");
+        final String label = e.label();
+        final Object inId = v.id();
+        final Object outId = v.id();
+        e.property("to-drop", "dah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgePropertyRemoved(final Edge element, final Property property) {
-                assertEquals(e.label(), element.label());
-                assertEquals(e.inVertex().id(), element.inVertex().id());
-                assertEquals(e.outVertex().id(), element.outVertex().id());
-                assertEquals(p.value(), property.value());
-                assertEquals(p.key(), property.key());
+                assertEquals(label, element.label());
+                assertEquals(inId, element.inVertex().id());
+                assertEquals(outId, element.outVertex().id());
+                assertEquals("dah", property.value());
+                assertEquals("to-drop", property.key());
                 triggered.set(true);
             }
         };
@@ -663,7 +674,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.E(e).properties("to-drop").drop().iterate());
+        gts.E(e).properties("to-drop").drop().iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(e.properties()));
         assertEquals("yay!", e.value("not-dropped"));
@@ -676,16 +688,19 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final Edge e = v.addEdge("self", v);
-        final Property p = e.property("to-change", "no!");
+        final String label = e.label();
+        final Object inId = v.id();
+        final Object outId = v.id();
+        e.property("to-change", "no!");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgePropertyChanged(final Edge element, final Property oldValue, final Object setValue) {
-                assertEquals(e.label(), element.label());
-                assertEquals(e.inVertex().id(), element.inVertex().id());
-                assertEquals(e.outVertex().id(), element.outVertex().id());
-                assertEquals(p.value(), oldValue.value());
-                assertEquals(p.key(), oldValue.key());
+                assertEquals(label, element.label());
+                assertEquals(inId, element.inVertex().id());
+                assertEquals(outId, element.outVertex().id());
+                assertEquals("no!", oldValue.value());
+                assertEquals("to-change", oldValue.key());
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -698,7 +713,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.E(e).property("to-change","yay!").iterate());
+        gts.E(e).property("to-change","yay!").iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(e.properties()));
         assertThat(triggered.get(), is(true));
@@ -710,14 +726,17 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final Edge e = v.addEdge("self", v);
-        final Property p = e.property("to-change", "no!");
+        final String label = e.label();
+        final Object inId = v.id();
+        final Object outId = v.id();
+        e.property("to-change", "no!");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgePropertyChanged(final Edge element, final Property oldValue, final Object setValue) {
-                assertEquals(e.label(), element.label());
-                assertEquals(e.inVertex().id(), element.inVertex().id());
-                assertEquals(e.outVertex().id(), element.outVertex().id());
+                assertEquals(label, element.label());
+                assertEquals(inId, element.inVertex().id());
+                assertEquals(outId, element.outVertex().id());
                 assertEquals(null, oldValue.value());
                 assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
@@ -732,7 +751,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.E(e).property("new","yay!").iterate());
+        gts.E(e).property("new","yay!").iterate();
+        tryCommit(graph);
 
         assertEquals(2, IteratorUtils.count(e.properties()));
         assertThat(triggered.get(), is(true));
@@ -745,13 +765,16 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final Edge e = v.addEdge("self", v, "dropped", "yay!");
+        final String label = e.label();
+        final Object inId = v.id();
+        final Object outId = v.id();
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgeRemoved(final Edge element) {
-                assertEquals(e.label(), element.label());
-                assertEquals(e.inVertex().id(), element.inVertex().id());
-                assertEquals(e.outVertex().id(), element.outVertex().id());
+                assertEquals(label, element.label());
+                assertEquals(inId, element.inVertex().id());
+                assertEquals(outId, element.outVertex().id());
                 triggered.set(true);
             }
         };
@@ -763,7 +786,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.E(e).drop().iterate());
+        gts.E(e).drop().iterate();
+        tryCommit(graph);
 
         assertVertexEdgeCounts(graph, 1, 0);
         assertThat(triggered.get(), is(true));
@@ -774,13 +798,14 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldDetachEdgeWhenAdded() {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
+        final Object id = v.id();
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgeAdded(final Edge element) {
                 assertEquals("self", element.label());
-                assertEquals(v.id(), element.inVertex().id());
-                assertEquals(v.id(), element.outVertex().id());
+                assertEquals(id, element.inVertex().id());
+                assertEquals(id, element.outVertex().id());
                 assertEquals("there", element.value("here"));
                 triggered.set(true);
             }
@@ -793,7 +818,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).as("a").addE("self").property("here", "there").from("a").to("a").iterate());
+        gts.V(v).as("a").addE("self").property("here", "there").from("a").to("a").iterate();
+        tryCommit(graph);
 
         assertVertexEdgeCounts(graph, 1, 1);
         assertThat(triggered.get(), is(true));
@@ -805,13 +831,15 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final VertexProperty vp = v.property("to-remove","blah");
+        final String label = vp.label();
+        final Object value = vp.value();
         final VertexProperty vpToKeep = v.property("to-keep","dah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyRemoved(final VertexProperty element) {
-                assertEquals(vp.label(), element.label());
-                assertEquals(vp.value(), element.value());
+                assertEquals(label, element.label());
+                assertEquals(value, element.value());
                 triggered.set(true);
             }
         };
@@ -823,7 +851,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).properties("to-remove").drop().iterate());
+        gts.V(v).properties("to-remove").drop().iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertEquals(vpToKeep.value(), v.value("to-keep"));
@@ -835,13 +864,15 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldDetachVertexPropertyWhenChanged() {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
+        final String label = v.label();
+        final Object id = v.id();
         v.property("to-change", "blah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-                assertEquals(v.label(), element.label());
-                assertEquals(v.id(), element.id());
+                assertEquals(label, element.label());
+                assertEquals(id, element.id());
                 assertEquals("to-change", oldValue.key());
                 assertEquals("blah", oldValue.value());
                 assertEquals("dah", setValue);
@@ -856,7 +887,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).property(VertexProperty.Cardinality.single, "to-change", "dah").iterate());
+        gts.V(v).property(VertexProperty.Cardinality.single, "to-change", "dah").iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertThat(triggered.get(), is(true));
@@ -867,13 +899,15 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldDetachVertexPropertyWhenNew() {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
+        final String label = v.label();
+        final Object id = v.id();
         v.property("old","blah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-                assertEquals(v.label(), element.label());
-                assertEquals(v.id(), element.id());
+                assertEquals(label, element.label());
+                assertEquals(id, element.id());
                 assertEquals("new", oldValue.key());
                 assertEquals(null, oldValue.value());
                 assertEquals("dah", setValue);
@@ -888,7 +922,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).property(VertexProperty.Cardinality.single, "new", "dah").iterate());
+        gts.V(v).property(VertexProperty.Cardinality.single, "new", "dah").iterate();
+        tryCommit(graph);
 
         assertEquals(2, IteratorUtils.count(v.properties()));
         assertThat(triggered.get(), is(true));
@@ -899,12 +934,14 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldDetachVertexWhenRemoved() {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
+        final String label = v.label();
+        final Object id = v.id();
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexRemoved(final Vertex element) {
-                assertEquals(v.id(), element.id());
-                assertEquals(v.label(), element.label());
+                assertEquals(id, element.id());
+                assertEquals(label, element.label());
                 triggered.set(true);
             }
         };
@@ -916,7 +953,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).drop().iterate());
+        gts.V(v).drop().iterate();
+        tryCommit(graph);
 
         assertVertexEdgeCounts(graph, 0, 0);
         assertThat(triggered.get(), is(true));
@@ -943,7 +981,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.addV("thing").property("here", "there").iterate());
+        gts.addV("thing").property("here", "there").iterate();
+        tryCommit(graph);
 
         assertVertexEdgeCounts(graph, 1, 0);
         assertThat(triggered.get(), is(true));


[37/50] tinkerpop git commit: removed a repeated recurssion in PathRetractionStrategy using the MARKER model of strategies.

Posted by sp...@apache.org.
removed a repeated recurssion in PathRetractionStrategy using the MARKER model of strategies.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 8e90349a43c843e44b53b87aea7d7c1d9b0ccee7
Parents: acc8d73
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Mar 28 07:46:31 2017 -0600
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:22:58 2017 -0400

----------------------------------------------------------------------
 .../optimization/PathRetractionStrategy.java    | 26 +++++++++-----------
 .../StandardVerificationStrategy.java           |  3 ++-
 2 files changed, 13 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8e90349a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
index 10e2372..304161e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
@@ -58,7 +58,9 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
     private static final PathRetractionStrategy INSTANCE = new PathRetractionStrategy(MAX_BARRIER_SIZE);
     // these strategies do strong rewrites involving path labeling and thus, should run prior to PathRetractionStrategy
     private static final Set<Class<? extends OptimizationStrategy>> PRIORS = new HashSet<>(Arrays.asList(
-            RepeatUnrollStrategy.class, MatchPredicateStrategy.class, PathProcessorStrategy.class));
+            RepeatUnrollStrategy.class,
+            MatchPredicateStrategy.class,
+            PathProcessorStrategy.class));
     private static final String MARKER = Graph.Hidden.hide("gremlin.pathRetraction");
 
     private final int standardBarrierSize;
@@ -76,9 +78,11 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
         // do not apply this strategy if there are lambdas as you can't introspect to know what path information the lambdas are using
         // do not apply this strategy if a PATH requirement step is being used (in the future, we can do PATH requirement lookhead to be more intelligent about its usage)
         // do not apply this strategy if a VertexProgramStep is present with LABELED_PATH requirements
-        if ((traversal.getParent() instanceof EmptyStep || traversal.getParent() instanceof VertexProgramStep) &&
+        if (traversal.getParent() instanceof EmptyStep &&
                 TraversalHelper.anyStepRecursively(step -> step instanceof LambdaHolder ||
-                                                   step.getRequirements().contains(TraverserRequirement.PATH),traversal)) {
+                        step.getRequirements().contains(TraverserRequirement.PATH) ||
+                        (step instanceof VertexProgramStep &&
+                                step.getRequirements().contains(TraverserRequirement.LABELED_PATH)), traversal)) {
             TraversalHelper.applyTraversalRecursively(t -> t.getEndStep().addLabel(MARKER), traversal);
         }
 
@@ -87,11 +91,6 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
             return;
         }
 
-        if (TraversalHelper.anyStepRecursively(step -> step instanceof VertexProgramStep && step.getRequirements().contains(TraverserRequirement.LABELED_PATH),
-                TraversalHelper.getRootTraversal(traversal))) {
-            return;
-        }
-
         final boolean onGraphComputer = TraversalHelper.onGraphComputer(traversal);
         final Set<String> foundLabels = new HashSet<>();
         final Set<String> keepLabels = new HashSet<>();
@@ -223,9 +222,8 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
             // if there is one more RepeatSteps in this traversal's lineage, preserve keep labels
             if (currentStep instanceof PathProcessor) {
                 ((PathProcessor) currentStep).getKeepLabels().addAll(keeperTrail);
-                if (hasRepeat) {
+                if (hasRepeat)
                     ((PathProcessor) currentStep).getKeepLabels().addAll(keepLabels);
-                }
             }
         }
     }
@@ -238,18 +236,16 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
 
     private void addLabels(final Traversal.Admin traversal, final Set<String> keepLabels) {
         for (final Object s : traversal.getSteps()) {
-            if (s instanceof PathProcessor) {
+            if (s instanceof PathProcessor)
                 addLabels((PathProcessor) s, keepLabels);
-            }
         }
     }
 
     private void addLabels(final PathProcessor s, final Set<String> keepLabels) {
-        if (s.getKeepLabels() == null) {
+        if (null == s.getKeepLabels())
             s.setKeepLabels(new HashSet<>(keepLabels));
-        } else {
+        else
             s.getKeepLabels().addAll(new HashSet<>(keepLabels));
-        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8e90349a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
index aed5372..cad3b8e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/verification/StandardVerificationStrategy.java
@@ -33,6 +33,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 import org.apache.tinkerpop.gremlin.structure.Graph;
 
 import java.util.Collections;
+import java.util.HashSet;
 import java.util.Set;
 
 /**
@@ -54,7 +55,7 @@ public final class StandardVerificationStrategy extends AbstractTraversalStrateg
         }
 
         for (final Step<?, ?> step : traversal.getSteps()) {
-            for (String label : step.getLabels()) {
+            for (String label : new HashSet<>(step.getLabels())) {
                 if (Graph.Hidden.isHidden(label))
                     step.removeLabel(label);
             }


[12/50] tinkerpop git commit: if a settings.xml exists in tinkerpop/ then copy it to .m2

Posted by sp...@apache.org.
if a settings.xml exists in tinkerpop/ then copy it to .m2


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

Branch: refs/heads/TINKERPOP-1577
Commit: ec066ca60cd5acdfff6b7a853f89bd26b2aff7aa
Parents: 7def039
Author: Robert Dale <ro...@gmail.com>
Authored: Tue Mar 28 13:23:37 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Tue Mar 28 13:23:37 2017 -0400

----------------------------------------------------------------------
 .gitignore              | 3 ++-
 docker/scripts/build.sh | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ec066ca6/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index a493d4d..a4c1cdc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,4 +14,5 @@ _bsp/
 doc/out
 docs/*.asciidoc
 ext/
-.glv
\ No newline at end of file
+.glv
+settings.xml

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ec066ca6/docker/scripts/build.sh
----------------------------------------------------------------------
diff --git a/docker/scripts/build.sh b/docker/scripts/build.sh
index 47da2b8..626c1be 100755
--- a/docker/scripts/build.sh
+++ b/docker/scripts/build.sh
@@ -63,6 +63,13 @@ if [ -d "/usr/src/tinkermem" ]; then
   cd /usr/src/tinkermem
 fi
 
+# use a custom maven settings.xml
+if [ -r "settings.xml" ]; then
+  echo "Copying settings.xml"
+  mkdir -p ~/.m2
+  cp settings.xml ~/.m2/
+fi
+
 mvn clean install process-resources ${TINKERPOP_BUILD_OPTIONS} || exit 1
 [ -z "${BUILD_JAVA_DOCS}" ] || mvn process-resources -Djavadoc || exit 1
 


[03/50] tinkerpop git commit: added hasKey() and hasValue() tests to HasTest. Removed un-tested methods in HasTest that someone wrote, but never added respective test cases for. Added more has()-examples to the 'Has Step' section of the documentation.

Posted by sp...@apache.org.
added hasKey() and hasValue() tests to HasTest. Removed un-tested methods in HasTest that someone wrote, but never added respective test cases for. Added more has()-examples to the 'Has Step' section of the documentation.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 6515a6f3a5780ee3e8fb8ecbb9e4b104653d8a14
Parents: 028cb47
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Mar 21 08:08:25 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Fri Mar 24 13:40:53 2017 -0600

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc       |  8 ++-
 .../traversal/step/filter/GroovyHasTest.groovy  | 30 +++-----
 .../process/traversal/step/filter/HasTest.java  | 74 +++++++++++---------
 3 files changed, 56 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6515a6f3/docs/src/reference/the-traversal.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-traversal.asciidoc b/docs/src/reference/the-traversal.asciidoc
index f7aee7c..32ddcc6 100644
--- a/docs/src/reference/the-traversal.asciidoc
+++ b/docs/src/reference/the-traversal.asciidoc
@@ -797,8 +797,8 @@ It is possible to filter vertices, edges, and vertex properties based on their p
   * `has(key,predicate)`: Remove the traverser if its element does not have a key value that satisfies the bi-predicate. For more information on predicates, please read <<a-note-on-predicates,A Note on Predicates>>.
   * `hasLabel(labels...)`: Remove the traverser if its element does not have any of the labels.
   * `hasId(ids...)`: Remove the traverser if its element does not have any of the ids.
-  * `hasKey(keys...)`: Remove the traverser if its property does not have any of the keys.
-  * `hasValue(values...)`: Remove the traverser if its property does not have any of the values.
+  * `hasKey(keys...)`: Remove the traverser if the property does not have all of the provided keys.
+  * `hasValue(values...)`: Remove the traverser if its property does not have all of the provided values.
   * `has(key)`: Remove the traverser if its element does not have a value for the key.
   * `hasNot(key)`: Remove the traverser if its element has a value for the key.
   * `has(key, traversal)`: Remove the traverser if its object does not yield a result through the traversal off the property value.
@@ -814,6 +814,8 @@ g.V().has('age',outside(20,30)).values('age') <2>
 g.V().has('name',within('josh','marko')).valueMap() <3>
 g.V().has('name',without('josh','marko')).valueMap() <4>
 g.V().has('name',not(within('josh','marko'))).valueMap() <5>
+g.V().properties().hasKey('age').value() <6>
+g.V().hasNot('age').values('name') <7>
 ----
 
 <1> Find all vertices whose ages are between 20 (inclusive) and 30 (exclusive).
@@ -822,6 +824,8 @@ g.V().has('name',not(within('josh','marko'))).valueMap() <5>
 the key,value pairs for those verticies.
 <4> Find all vertices whose names are not in the collection `[josh,marko]`, display all the key,value pairs for those vertices.
 <5> Same as the prior example save using `not` on `within` to yield `without`.
+<6> Find all age-properties and emit their value.
+<7> Find all vertices that do not have an age-property and emit their name.
 
 TinkerPop does not support a regular expression predicate, although specific graph databases that leverage TinkerPop
 may provide a partial match extension.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6515a6f3/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
index b5ca538..0a7729c 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/filter/GroovyHasTest.groovy
@@ -136,38 +136,28 @@ public abstract class GroovyHasTest {
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_VX1X(final Object v1Id) {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V(v1Id)", "v1Id", v1Id)
-        }
-
-        @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasIdX1X(final Object v1Id) {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.hasId(v1Id)", "v1Id", v1Id)
-        }
-
-        @Override
-        public Traversal<Vertex, Vertex> get_g_VX1_2X(final Object v1Id, final Object v2Id) {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V(v1Id, v2Id)", "v1Id", v1Id, "v2Id", v2Id)
+        public Traversal<Vertex, Vertex> get_g_V_in_hasIdXneqX1XX(final Object v1Id) {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.in.hasId(neq(v1Id))", "v1Id", v1Id)
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasIdX1_2X(final Object v1Id, final Object v2Id) {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.hasId(v1Id, v2Id)", "v1Id", v1Id, "v2Id", v2Id)
+        public Traversal<Vertex, String> get_g_V_hasLabelXpersonX_hasXage_notXlteX10X_andXnotXbetweenX11_20XXXX_andXltX29X_orXeqX35XXXX_name() {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.hasLabel('person').has('age', P.not(lte(10).and(P.not(between(11,20)))).and(lt(29).or(eq(35)))).name")
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasIdXwithinX1_2XX(final Object v1Id, final Object v2Id) {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.hasId(within(v1Id, v2Id))", "v1Id", v1Id, "v2Id", v2Id)
+        public Traversal<Vertex, Integer> get_g_V_both_properties_dedup_hasKeyXageX_value() {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.both.properties().dedup.hasKey('age').value")
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_in_hasIdXneqX1XX(final Object v1Id) {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.in.hasId(neq(v1Id))", "v1Id", v1Id)
+        public Traversal<Vertex, Integer> get_g_V_both_properties_dedup_hasKeyXageX_hasValueXgtX30XX_value() {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.both.properties().dedup.hasKey('age').hasValue(gt(30)).value")
         }
 
         @Override
-        public Traversal<Vertex, String> get_g_V_hasLabelXpersonX_hasXage_notXlteX10X_andXnotXbetweenX11_20XXXX_andXltX29X_orXeqX35XXXX_name() {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.hasLabel('person').has('age', P.not(lte(10).and(P.not(between(11,20)))).and(lt(29).or(eq(35)))).name")
+        public Traversal<Vertex, String> get_g_V_hasNotXageX_name() {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.hasNot('age').name");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6515a6f3/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
index ff4622a..d132eb1 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/HasTest.java
@@ -22,12 +22,9 @@ import org.apache.tinkerpop.gremlin.FeatureRequirement;
 import org.apache.tinkerpop.gremlin.LoadGraphWith;
 import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
-import org.apache.tinkerpop.gremlin.process.IgnoreEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
-import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.Graph;
@@ -38,7 +35,6 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 
 import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.CREW;
@@ -46,7 +42,6 @@ import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
@@ -99,19 +94,15 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Vertex> get_g_V_hasXlocationX();
 
-    public abstract Traversal<Vertex, Vertex> get_g_VX1X(final Object v1Id);
+    public abstract Traversal<Vertex, Vertex> get_g_V_in_hasIdXneqX1XX(final Object v1Id);
 
-    public abstract Traversal<Vertex, Vertex> get_g_V_hasIdX1X(final Object v1Id);
+    public abstract Traversal<Vertex, String> get_g_V_hasLabelXpersonX_hasXage_notXlteX10X_andXnotXbetweenX11_20XXXX_andXltX29X_orXeqX35XXXX_name();
 
-    public abstract Traversal<Vertex, Vertex> get_g_VX1_2X(final Object v1Id, final Object v2Id);
+    public abstract Traversal<Vertex, Integer> get_g_V_both_properties_dedup_hasKeyXageX_value();
 
-    public abstract Traversal<Vertex, Vertex> get_g_V_hasIdX1_2X(final Object v1Id, final Object v2Id);
+    public abstract Traversal<Vertex, Integer> get_g_V_both_properties_dedup_hasKeyXageX_hasValueXgtX30XX_value();
 
-    public abstract Traversal<Vertex, Vertex> get_g_V_hasIdXwithinX1_2XX(final Object v1Id, final Object v2Id);
-
-    public abstract Traversal<Vertex, Vertex> get_g_V_in_hasIdXneqX1XX(final Object v1Id);
-
-    public abstract Traversal<Vertex, String> get_g_V_hasLabelXpersonX_hasXage_notXlteX10X_andXnotXbetweenX11_20XXXX_andXltX29X_orXeqX35XXXX_name();
+    public abstract Traversal<Vertex, String> get_g_V_hasNotXageX_name();
 
     @Test
     @LoadGraphWith(MODERN)
@@ -412,6 +403,31 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
         assertFalse(traversal.hasNext());
     }
 
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_V_both_dedup_properties_hasKeyXageX_value() {
+        final Traversal<Vertex, Integer> traversal = get_g_V_both_properties_dedup_hasKeyXageX_value();
+        printTraversalForm(traversal);
+        checkResults(Arrays.asList(29, 27, 32, 35), traversal);
+    }
+
+    @Test
+    @LoadGraphWith(MODERN)
+    public void g_V_both_dedup_properties_hasKeyXageX_hasValueXgtX30XX_value() {
+        final Traversal<Vertex, Integer> traversal = get_g_V_both_properties_dedup_hasKeyXageX_hasValueXgtX30XX_value();
+        printTraversalForm(traversal);
+        checkResults(Arrays.asList(32, 35), traversal);
+    }
+
+    @Test
+    @LoadGraphWith
+    public void g_V_hasNotXageX_name() {
+        final Traversal<Vertex, String> traversal = get_g_V_hasNotXageX_name();
+        printTraversalForm(traversal);
+        checkResults(Arrays.asList("lop", "ripple"), traversal);
+    }
+
+
     public static class Traversals extends HasTest {
         @Override
         public Traversal<Edge, Edge> get_g_EX11X_outV_outE_hasXid_10X(final Object e11Id, final Object e8Id) {
@@ -519,38 +535,28 @@ public abstract class HasTest extends AbstractGremlinProcessTest {
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_VX1X(final Object v1Id) {
-            return g.V(v1Id);
-        }
-
-        @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasIdX1X(final Object v1Id) {
-            return g.V().hasId(v1Id);
-        }
-
-        @Override
-        public Traversal<Vertex, Vertex> get_g_VX1_2X(final Object v1Id, final Object v2Id) {
-            return g.V(v1Id, v2Id);
+        public Traversal<Vertex, Vertex> get_g_V_in_hasIdXneqX1XX(final Object v1Id) {
+            return g.V().in().hasId(P.neq(v1Id));
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasIdX1_2X(final Object v1Id, final Object v2Id) {
-            return g.V().hasId(v1Id, v2Id);
+        public Traversal<Vertex, String> get_g_V_hasLabelXpersonX_hasXage_notXlteX10X_andXnotXbetweenX11_20XXXX_andXltX29X_orXeqX35XXXX_name() {
+            return g.V().hasLabel("person").has("age", P.not(P.lte(10).and(P.not(P.between(11, 20)))).and(P.lt(29).or(P.eq(35)))).values("name");
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_hasIdXwithinX1_2XX(final Object v1Id, final Object v2Id) {
-            return g.V().hasId(P.within(v1Id, v2Id));
+        public Traversal<Vertex, Integer> get_g_V_both_properties_dedup_hasKeyXageX_value() {
+            return g.V().both().properties().dedup().hasKey("age").value();
         }
 
         @Override
-        public Traversal<Vertex, Vertex> get_g_V_in_hasIdXneqX1XX(final Object v1Id) {
-            return g.V().in().hasId(P.neq(v1Id));
+        public Traversal<Vertex, Integer> get_g_V_both_properties_dedup_hasKeyXageX_hasValueXgtX30XX_value() {
+            return g.V().both().properties().dedup().hasKey("age").hasValue(P.gt(30)).value();
         }
 
         @Override
-        public Traversal<Vertex, String> get_g_V_hasLabelXpersonX_hasXage_notXlteX10X_andXnotXbetweenX11_20XXXX_andXltX29X_orXeqX35XXXX_name() {
-            return g.V().hasLabel("person").has("age", P.not(P.lte(10).and(P.not(P.between(11, 20)))).and(P.lt(29).or(P.eq(35)))).values("name");
+        public Traversal<Vertex, String> get_g_V_hasNotXageX_name() {
+            return g.V().hasNot("age").values("name");
         }
     }
 }


[47/50] tinkerpop git commit: Merge branch 'tp31' into tp32

Posted by sp...@apache.org.
Merge branch 'tp31' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: 46976bb1f66eba5ee617b0c244e11599ddb4fa73
Parents: a4a646d 11903a2
Author: Robert Dale <ro...@gmail.com>
Authored: Thu Mar 30 14:31:10 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Thu Mar 30 14:31:10 2017 -0400

----------------------------------------------------------------------
 docs/src/dev/developer/development-environment.asciidoc | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/46976bb1/docs/src/dev/developer/development-environment.asciidoc
----------------------------------------------------------------------


[20/50] tinkerpop git commit: CTR fixed license locations

Posted by sp...@apache.org.
CTR fixed license locations


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

Branch: refs/heads/TINKERPOP-1577
Commit: 8141403b0c75d1a4346e52d714977ca3b0a3035a
Parents: df6661d
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Mar 29 10:49:51 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Mar 29 10:49:51 2017 -0400

----------------------------------------------------------------------
 docs/src/dev/developer/for-committers.asciidoc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8141403b/docs/src/dev/developer/for-committers.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/for-committers.asciidoc b/docs/src/dev/developer/for-committers.asciidoc
index 9c5059c..1c7c201 100644
--- a/docs/src/dev/developer/for-committers.asciidoc
+++ b/docs/src/dev/developer/for-committers.asciidoc
@@ -344,10 +344,10 @@ To get started, TinkerPop has both "source" and "binary" LICENSE/NOTICE files:
 * Source LICENSE/NOTICE relate to files packaged with the released source code distribution:
 link:https://github.com/apache/tinkerpop/blob/master/LICENSE[LICENSE] / link:https://github.com/apache/tinkerpop/blob/master/NOTICE[NOTICE]
 * Binary LICENSE/NOTICE relate to files packaged with the released binary distributions:
-** Gremlin Console link:https://github.com/apache/tinkerpop/blob/master/gremlin-console/src/main/LICENSE[LICENSE]
-/ link:https://github.com/apache/tinkerpop/blob/master/gremlin-console/src/main/NOTICE[NOTICE]
-** Gremlin Server link:https://github.com/apache/tinkerpop/blob/master/gremlin-server/src/main/LICENSE[LICENSE]
-/ link:https://github.com/apache/tinkerpop/blob/master/gremlin-server/src/main/NOTICE[NOTICE]
+** Gremlin Console link:https://github.com/apache/tinkerpop/blob/master/gremlin-console/src/main/static/LICENSE[LICENSE]
+/ link:https://github.com/apache/tinkerpop/blob/master/gremlin-console/src/main/static/NOTICE[NOTICE]
+** Gremlin Server link:https://github.com/apache/tinkerpop/blob/master/gremlin-server/src/main/static/LICENSE[LICENSE]
+/ link:https://github.com/apache/tinkerpop/blob/master/gremlin-server/src/main/static/NOTICE[NOTICE]
 
 Source LICENSE and NOTICE
 ~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -373,7 +373,7 @@ distributions, either:
 
 Apache licensed software does not need to be included in LICENSE, but if the new dependency is an Apache-approved
 license (e.g. BSD, MIT) then it should be added in the pattern already defined. A copy of the LICENSE should be
-added to the `<project>/static/licenses` directory of the code repository.
+added to the `<project>/src/main/static/licenses` directory of the code repository.
 
 To determine if changes are required to the NOTICE, first check if the bundled jar has a NOTICE file in it (typically
 found in `/META-INF` directory of the jar).


[36/50] tinkerpop git commit: added MARKER model to PathRetractionStrategy to reduce recurssive lookups of invalidating steps. Again, we really need Traversal.metdata to make this more 'pure'.

Posted by sp...@apache.org.
added MARKER model to PathRetractionStrategy to reduce recurssive lookups of invalidating steps. Again, we really need Traversal.metdata to make this more 'pure'.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 97141dab3ea3b187e1c1bd93bd12f8afa6a3b601
Parents: 3182a06
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Mar 17 13:04:58 2017 -0600
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:22:58 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                   |  3 ++-
 .../optimization/PathRetractionStrategy.java         | 15 +++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/97141dab/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 926aa18..5731497 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,7 +26,8 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-* `ProfileStrategy` now uses the marker-model to reduce recrussive lookups of `ProfileSideEffectStep`.
+* `PathRetractionStrategy` now uses the marker-model to reduce recursive lookups of invalidating steps.
+* `ProfileStrategy` now uses the marker-model to reduce recursive lookups of `ProfileSideEffectStep`.
 * `Mutating` steps now implement `Scoping` interface.
 * Fixed a step id compilation bug in `AddVertexStartStep`, `AddVertexStep`, `AddEdgeStep`, and `AddPropertyStep`.
 * De-registered metrics on Gremlin Server shutdown.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/97141dab/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
index 56f9f66..443e4e3 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
@@ -37,6 +37,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversal
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.PathUtil;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.javatuples.Pair;
 
 import java.util.ArrayList;
@@ -58,6 +59,7 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
     // these strategies do strong rewrites involving path labeling and thus, should run prior to PathRetractionStrategy
     private static final Set<Class<? extends OptimizationStrategy>> PRIORS = new HashSet<>(Arrays.asList(
             RepeatUnrollStrategy.class, MatchPredicateStrategy.class, PathProcessorStrategy.class));
+    private static final String MARKER = Graph.Hidden.hide("gremlin.pathRetraction");
 
     private final int standardBarrierSize;
 
@@ -74,11 +76,16 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
         // do not apply this strategy if there are lambdas as you can't introspect to know what path information the lambdas are using
         // do not apply this strategy if a PATH requirement step is being used (in the future, we can do PATH requirement lookhead to be more intelligent about its usage)
         // do not apply this strategy if a VertexProgramStep is present with LABELED_PATH requirements
-        if (TraversalHelper.anyStepRecursively(step -> step instanceof LambdaHolder ||
-                        step.getRequirements().contains(TraverserRequirement.PATH) ||
-                        (step instanceof VertexProgramStep && step.getRequirements().contains(TraverserRequirement.LABELED_PATH)),
-                TraversalHelper.getRootTraversal(traversal)))
+        if ((traversal.getParent() instanceof EmptyStep || traversal.getParent() instanceof VertexProgramStep) &&
+                TraversalHelper.anyStepRecursively(step -> step instanceof LambdaHolder ||
+                                                   step.getRequirements().contains(TraverserRequirement.PATH) ||
+                                                   (step instanceof VertexProgramStep && step.getRequirements().contains(TraverserRequirement.LABELED_PATH)),traversal))
+            TraversalHelper.applyTraversalRecursively(t -> t.getEndStep().addLabel(MARKER), traversal);
+
+        if (traversal.getEndStep().getLabels().contains(MARKER)) {
+            traversal.getEndStep().removeLabel(MARKER);
             return;
+        }
 
         final boolean onGraphComputer = TraversalHelper.onGraphComputer(traversal);
         final Set<String> foundLabels = new HashSet<>();


[23/50] tinkerpop git commit: Added ScopingStrategy which does a single TraversalHelper.getLabels() call and recurssively tells where() and select() steps the path labels accessed by the Traversal.

Posted by sp...@apache.org.
Added ScopingStrategy which does a single TraversalHelper.getLabels() call and recurssively tells where() and select() steps the path labels accessed by the Traversal.


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

Branch: refs/heads/TINKERPOP-1577
Commit: b49c5beec0c7ae891b8267130d97366bee0cd20a
Parents: e8011e4
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Mar 3 09:27:58 2017 -0700
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:20:43 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../process/traversal/TraversalStrategies.java  |  2 +
 .../gremlin/process/traversal/step/Scoping.java | 10 ++++
 .../step/filter/WherePredicateStep.java         | 11 +++-
 .../step/filter/WhereTraversalStep.java         | 16 ++++--
 .../traversal/step/map/SelectOneStep.java       | 21 ++++++--
 .../process/traversal/step/map/SelectStep.java  | 15 ++++--
 .../strategy/finalization/ScopingStrategy.java  | 57 ++++++++++++++++++++
 8 files changed, 121 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b49c5bee/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 7d4e74b..82cdd8d 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -44,6 +44,7 @@ TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 * Added `FromToModulating` interface for use with `to()`- and `from()`-based step modulators.
 * Added `Path.subPath()` which supports isolating a sub-path from `Path` via to/from-labels.
 * Fixed an `NullPointerException` in `GraphMLReader` that occurred when an `<edge>` didn't have an ID field and the base graph supported ID assignment.
+* Added `ScopingStrategy` which will computer and provide all `Scoping` steps with the path labels of the global `Traversal`.
 * Split `ComputerVerificationStrategy` into two strategies: `ComputerVerificationStrategy` and `ComputerFinalizationStrategy`.
 * Removed `HasTest.g_V_hasId_compilationEquality` from process test suite as it makes too many assumptions about provider compilation.
 * Deprecated `CustomizerProvider` infrastructure.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b49c5bee/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index 63ae23f..0ddae91 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimiza
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.MessagePassingReductionStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ConnectiveStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ScopingStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.AdjacentToIncidentStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.FilterRankingStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IncidentToAdjacentStrategy;
@@ -214,6 +215,7 @@ public interface TraversalStrategies extends Serializable, Cloneable {
                     RangeByIsCountStrategy.instance(),
                     PathRetractionStrategy.instance(),
                     LazyBarrierStrategy.instance(),
+                    ScopingStrategy.instance(),
                     ProfileStrategy.instance(),
                     StandardVerificationStrategy.instance());
             GRAPH_CACHE.put(Graph.class, graphStrategies);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b49c5bee/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
index 8c27405..68655e4 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
@@ -70,4 +70,14 @@ public interface Scoping {
     }
 
     public Set<String> getScopeKeys();
+
+    /**
+     * If a Scoping step can do intelligent optimizations by knowing the step labels being accessed globally, then it should implement this label.
+     * The default implementation does nothing.
+     *
+     * @param labels the step labels of the global traversal
+     */
+    public default void setPathLabels(final Set<String> labels) {
+
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b49c5bee/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
index 05637f6..b213314 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
@@ -49,6 +49,7 @@ public final class WherePredicateStep<S> extends FilterStep<S> implements Scopin
 
     protected String startKey;
     protected List<String> selectKeys;
+    private Boolean pathSelectKey = null;
     protected P<Object> predicate;
     protected final Set<String> scopeKeys = new HashSet<>();
     protected Set<String> keepLabels;
@@ -137,14 +138,22 @@ public final class WherePredicateStep<S> extends FilterStep<S> implements Scopin
 
     @Override
     public Set<TraverserRequirement> getRequirements() {
-        final Set<TraverserRequirement> requirements =
+        final Set<TraverserRequirement> requirements = null == this.pathSelectKey ?
                 TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.traversal)).stream().filter(this.scopeKeys::contains).findAny().isPresent() ?
                         TYPICAL_GLOBAL_REQUIREMENTS :
+                        TYPICAL_LOCAL_REQUIREMENTS :
+                this.pathSelectKey ?
+                        TYPICAL_GLOBAL_REQUIREMENTS :
                         TYPICAL_LOCAL_REQUIREMENTS;
         return this.getSelfAndChildRequirements(requirements.toArray(new TraverserRequirement[requirements.size()]));
     }
 
     @Override
+    public void setPathLabels(final Set<String> labels) {
+        this.pathSelectKey = labels.stream().filter(this.scopeKeys::contains).findAny().isPresent();
+    }
+
+    @Override
     public List<Traversal.Admin<S, ?>> getLocalChildren() {
         return (List) this.traversalRing.getTraversals();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b49c5bee/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
index 1dd92e2..c004d30 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
@@ -46,6 +46,7 @@ public final class WhereTraversalStep<S> extends FilterStep<S> implements Traver
 
     protected Traversal.Admin<?, ?> whereTraversal;
     protected final Set<String> scopeKeys = new HashSet<>();
+    private Boolean pathSelectKey = null;
     protected Set<String> keepLabels;
 
     public WhereTraversalStep(final Traversal.Admin traversal, final Traversal<?, ?> whereTraversal) {
@@ -134,9 +135,18 @@ public final class WhereTraversalStep<S> extends FilterStep<S> implements Traver
 
     @Override
     public Set<TraverserRequirement> getRequirements() {
-        return TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.getTraversal())).stream().filter(this.scopeKeys::contains).findAny().isPresent() ?
-                TYPICAL_GLOBAL_REQUIREMENTS :
-                TYPICAL_LOCAL_REQUIREMENTS;
+        return null == this.pathSelectKey ?
+                TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.getTraversal())).stream().filter(this.scopeKeys::contains).findAny().isPresent() ?
+                        TYPICAL_GLOBAL_REQUIREMENTS :
+                        TYPICAL_LOCAL_REQUIREMENTS :
+                this.pathSelectKey ?
+                        TYPICAL_GLOBAL_REQUIREMENTS :
+                        TYPICAL_LOCAL_REQUIREMENTS;
+    }
+
+    @Override
+    public void setPathLabels(final Set<String> labels) {
+        this.pathSelectKey = labels.stream().filter(this.scopeKeys::contains).findAny().isPresent();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b49c5bee/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
index a51a8d2..baedbcf 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
@@ -41,6 +41,7 @@ public final class SelectOneStep<S, E> extends MapStep<S, E> implements Traversa
 
     private final Pop pop;
     private final String selectKey;
+    private Boolean pathSelectKey = null;
     private Traversal.Admin<S, E> selectTraversal = null;
     private Set<String> keepLabels;
 
@@ -103,9 +104,17 @@ public final class SelectOneStep<S, E> extends MapStep<S, E> implements Traversa
 
     @Override
     public Set<TraverserRequirement> getRequirements() {
-        return this.getSelfAndChildRequirements(TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.traversal)).contains(this.selectKey) ?
-                TYPICAL_GLOBAL_REQUIREMENTS_ARRAY :
-                TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
+        if (null == this.pathSelectKey)
+            return this.getSelfAndChildRequirements(TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.traversal)).contains(this.selectKey) ?
+                    TYPICAL_GLOBAL_REQUIREMENTS_ARRAY :
+                    TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
+        else
+            return this.getSelfAndChildRequirements(this.pathSelectKey ? TYPICAL_GLOBAL_REQUIREMENTS_ARRAY : TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
+    }
+
+    @Override
+    public void setPathLabels(final Set<String> labels) {
+        this.pathSelectKey = labels.contains(this.selectKey);
     }
 
     @Override
@@ -123,12 +132,14 @@ public final class SelectOneStep<S, E> extends MapStep<S, E> implements Traversa
     }
 
     @Override
-    public Set<String> getKeepLabels() { return this.keepLabels; }
+    public Set<String> getKeepLabels() {
+        return this.keepLabels;
+    }
 
     @Override
     protected Traverser.Admin<E> processNextStart() {
         final Traverser.Admin<E> traverser = super.processNextStart();
-        if(!(this.getTraversal().getParent() instanceof MatchStep)) {
+        if (!(this.getTraversal().getParent() instanceof MatchStep)) {
             PathProcessor.processTraverserPathLabels(traverser, this.keepLabels);
         }
         return traverser;

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b49c5bee/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
index 77db60f..3a96380 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
@@ -48,6 +48,7 @@ public final class SelectStep<S, E> extends MapStep<S, Map<String, E>> implement
     private TraversalRing<Object, E> traversalRing = new TraversalRing<>();
     private final Pop pop;
     private final List<String> selectKeys;
+    private Boolean pathSelectKey = null;
     private final Set<String> selectKeysSet;
     private Set<String> keepLabels;
 
@@ -120,9 +121,17 @@ public final class SelectStep<S, E> extends MapStep<S, Map<String, E>> implement
 
     @Override
     public Set<TraverserRequirement> getRequirements() {
-        return this.getSelfAndChildRequirements(TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.traversal)).stream().filter(this.selectKeys::contains).findAny().isPresent() ?
-                TYPICAL_GLOBAL_REQUIREMENTS_ARRAY :
-                TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
+        if (null == this.pathSelectKey)
+            return this.getSelfAndChildRequirements(TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.traversal)).stream().filter(this.selectKeys::contains).findAny().isPresent() ?
+                    TYPICAL_GLOBAL_REQUIREMENTS_ARRAY :
+                    TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
+        else
+            return this.getSelfAndChildRequirements(this.pathSelectKey ? TYPICAL_GLOBAL_REQUIREMENTS_ARRAY : TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
+    }
+
+    @Override
+    public void setPathLabels(final Set<String> labels) {
+        this.pathSelectKey = labels.stream().filter(this.selectKeysSet::contains).findAny().isPresent();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b49c5bee/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
new file mode 100644
index 0000000..ce66da4
--- /dev/null
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
@@ -0,0 +1,57 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+
+package org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization;
+
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
+import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
+import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+
+import java.util.Set;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public final class ScopingStrategy extends AbstractTraversalStrategy<TraversalStrategy.FinalizationStrategy> implements TraversalStrategy.FinalizationStrategy {
+
+    private static final ScopingStrategy INSTANCE = new ScopingStrategy();
+
+
+    private ScopingStrategy() {
+    }
+
+    @Override
+    public void apply(final Traversal.Admin<?, ?> traversal) {
+        // only operate on the root traversal and apply global step labels recursively
+        if (!(traversal.getParent() instanceof EmptyStep))
+            return;
+
+        final Set<String> labels = TraversalHelper.getLabels(traversal);
+        for (final Scoping scoping : TraversalHelper.getStepsOfAssignableClassRecursively(Scoping.class, traversal)) {
+            scoping.setPathLabels(labels);
+        }
+    }
+
+    public static final ScopingStrategy instance() {
+        return INSTANCE;
+    }
+}


[17/50] tinkerpop git commit: Merge branch 'TINKERPOP-1654-tp32' into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1654-tp32' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: 1b6ad3c2dc04d924a747560bded3fed8d22fa473
Parents: 0f5ca93 ad268ef
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Mar 29 10:11:40 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 10:11:40 2017 -0400

----------------------------------------------------------------------
 .../structure/io/graphson/GraphSONTypeDeserializer.java       | 2 +-
 .../gremlin/structure/io/graphson/GraphSONTypeIdResolver.java | 7 +------
 2 files changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------



[29/50] tinkerpop git commit: Wow. Can't believe we didn't do this from the start. LABELED_PATH is set if a Step is labeled. Dar. So much simpler than all the recurssion in TraversalHelper.getLabels() and having a ScopingStrategy.... @spmallette -- can y

Posted by sp...@apache.org.
Wow. Can't believe we didn't do this from the start. LABELED_PATH is set if a Step is labeled. Dar. So much simpler than all the recurssion in TraversalHelper.getLabels() and having a ScopingStrategy.... @spmallette -- can you verify that your Mutating traversal profiling is faster now.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 6294c077ff1e7a26b14749220b722d5bd124acd0
Parents: 5711ee2
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Mar 8 07:37:07 2017 -0700
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:20:44 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../process/traversal/TraversalStrategies.java  |  2 -
 .../gremlin/process/traversal/step/Scoping.java | 15 -----
 .../step/filter/WherePredicateStep.java         | 15 +----
 .../step/filter/WhereTraversalStep.java         | 14 +----
 .../traversal/step/map/SelectOneStep.java       | 13 +---
 .../process/traversal/step/map/SelectStep.java  | 13 +---
 .../strategy/finalization/ScopingStrategy.java  | 65 --------------------
 .../traversal/util/DefaultTraversal.java        |  2 +
 .../process/traversal/util/TraversalHelper.java | 18 ++++++
 .../traversal/step/filter/WhereStepTest.java    |  4 +-
 .../process/computer/GraphComputerTest.java     |  2 +
 12 files changed, 29 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 82cdd8d..6e88565 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -30,6 +30,7 @@ TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 * De-registered metrics on Gremlin Server shutdown.
 * Added "help" command option on `:remote config` for plugins that support that feature in the Gremlin Console.
 * Allowed for multiple scripts and related arguments to be passed to `gremlin.sh` via `-i` and `-e`.
+* `LABELED_PATH` requirement is now set if any step in the traversal is labeled.
 * Updated `PathRetractionStrategy` to not run if the provided traversal contains a `VertexProgramStep` that has a `LABELED_PATH` requirement.
 * Added various metrics to the `GremlinGroovyScriptEngine` around script compilation and exposed them in Gremlin Server.
 * Moved the `caffeine` dependency down to `gremlin-groovy` and out of `gremlin-server`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index 0ddae91..63ae23f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -24,7 +24,6 @@ import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimiza
 import org.apache.tinkerpop.gremlin.process.computer.traversal.strategy.optimization.MessagePassingReductionStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.ConnectiveStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ProfileStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization.ScopingStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.AdjacentToIncidentStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.FilterRankingStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.IncidentToAdjacentStrategy;
@@ -215,7 +214,6 @@ public interface TraversalStrategies extends Serializable, Cloneable {
                     RangeByIsCountStrategy.instance(),
                     PathRetractionStrategy.instance(),
                     LazyBarrierStrategy.instance(),
-                    ScopingStrategy.instance(),
                     ProfileStrategy.instance(),
                     StandardVerificationStrategy.instance());
             GRAPH_CACHE.put(Graph.class, graphStrategies);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
index fae52d7..22109bf 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
@@ -34,11 +34,6 @@ public interface Scoping {
 
     public static enum Variable {START, END}
 
-    public static final Set<TraverserRequirement> TYPICAL_LOCAL_REQUIREMENTS = EnumSet.of(TraverserRequirement.OBJECT, TraverserRequirement.SIDE_EFFECTS);
-    public static final Set<TraverserRequirement> TYPICAL_GLOBAL_REQUIREMENTS = EnumSet.of(TraverserRequirement.OBJECT, TraverserRequirement.LABELED_PATH, TraverserRequirement.SIDE_EFFECTS);
-    public static final TraverserRequirement[] TYPICAL_LOCAL_REQUIREMENTS_ARRAY = new TraverserRequirement[]{TraverserRequirement.OBJECT, TraverserRequirement.SIDE_EFFECTS};
-    public static final TraverserRequirement[] TYPICAL_GLOBAL_REQUIREMENTS_ARRAY = new TraverserRequirement[]{TraverserRequirement.OBJECT, TraverserRequirement.LABELED_PATH, TraverserRequirement.SIDE_EFFECTS};
-
     public default <S> S getScopeValue(final Pop pop, final String key, final Traverser.Admin<?> traverser) throws IllegalArgumentException {
         if (traverser.getSideEffects().exists(key))
             return traverser.getSideEffects().<S>get(key);
@@ -75,14 +70,4 @@ public interface Scoping {
      * @return the accessed labels of the scoping step
      */
     public Set<String> getScopeKeys();
-
-    /**
-     * If a Scoping step can do intelligent optimizations by knowing the step labels being accessed globally, then it should implement this label.
-     * The default implementation does nothing.
-     *
-     * @param labels the step labels of the global traversal
-     */
-    public default void setPathLabels(final Set<String> labels) {
-
-    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
index b213314..1b248af 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WherePredicateStep.java
@@ -49,7 +49,6 @@ public final class WherePredicateStep<S> extends FilterStep<S> implements Scopin
 
     protected String startKey;
     protected List<String> selectKeys;
-    private Boolean pathSelectKey = null;
     protected P<Object> predicate;
     protected final Set<String> scopeKeys = new HashSet<>();
     protected Set<String> keepLabels;
@@ -138,19 +137,7 @@ public final class WherePredicateStep<S> extends FilterStep<S> implements Scopin
 
     @Override
     public Set<TraverserRequirement> getRequirements() {
-        final Set<TraverserRequirement> requirements = null == this.pathSelectKey ?
-                TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.traversal)).stream().filter(this.scopeKeys::contains).findAny().isPresent() ?
-                        TYPICAL_GLOBAL_REQUIREMENTS :
-                        TYPICAL_LOCAL_REQUIREMENTS :
-                this.pathSelectKey ?
-                        TYPICAL_GLOBAL_REQUIREMENTS :
-                        TYPICAL_LOCAL_REQUIREMENTS;
-        return this.getSelfAndChildRequirements(requirements.toArray(new TraverserRequirement[requirements.size()]));
-    }
-
-    @Override
-    public void setPathLabels(final Set<String> labels) {
-        this.pathSelectKey = labels.stream().filter(this.scopeKeys::contains).findAny().isPresent();
+        return this.getSelfAndChildRequirements(TraverserRequirement.OBJECT, TraverserRequirement.SIDE_EFFECTS);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
index c004d30..476ce11 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereTraversalStep.java
@@ -46,7 +46,6 @@ public final class WhereTraversalStep<S> extends FilterStep<S> implements Traver
 
     protected Traversal.Admin<?, ?> whereTraversal;
     protected final Set<String> scopeKeys = new HashSet<>();
-    private Boolean pathSelectKey = null;
     protected Set<String> keepLabels;
 
     public WhereTraversalStep(final Traversal.Admin traversal, final Traversal<?, ?> whereTraversal) {
@@ -135,18 +134,7 @@ public final class WhereTraversalStep<S> extends FilterStep<S> implements Traver
 
     @Override
     public Set<TraverserRequirement> getRequirements() {
-        return null == this.pathSelectKey ?
-                TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.getTraversal())).stream().filter(this.scopeKeys::contains).findAny().isPresent() ?
-                        TYPICAL_GLOBAL_REQUIREMENTS :
-                        TYPICAL_LOCAL_REQUIREMENTS :
-                this.pathSelectKey ?
-                        TYPICAL_GLOBAL_REQUIREMENTS :
-                        TYPICAL_LOCAL_REQUIREMENTS;
-    }
-
-    @Override
-    public void setPathLabels(final Set<String> labels) {
-        this.pathSelectKey = labels.stream().filter(this.scopeKeys::contains).findAny().isPresent();
+        return this.getSelfAndChildRequirements(TraverserRequirement.OBJECT, TraverserRequirement.SIDE_EFFECTS);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
index baedbcf..34b8148 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectOneStep.java
@@ -41,7 +41,6 @@ public final class SelectOneStep<S, E> extends MapStep<S, E> implements Traversa
 
     private final Pop pop;
     private final String selectKey;
-    private Boolean pathSelectKey = null;
     private Traversal.Admin<S, E> selectTraversal = null;
     private Set<String> keepLabels;
 
@@ -104,17 +103,7 @@ public final class SelectOneStep<S, E> extends MapStep<S, E> implements Traversa
 
     @Override
     public Set<TraverserRequirement> getRequirements() {
-        if (null == this.pathSelectKey)
-            return this.getSelfAndChildRequirements(TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.traversal)).contains(this.selectKey) ?
-                    TYPICAL_GLOBAL_REQUIREMENTS_ARRAY :
-                    TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
-        else
-            return this.getSelfAndChildRequirements(this.pathSelectKey ? TYPICAL_GLOBAL_REQUIREMENTS_ARRAY : TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
-    }
-
-    @Override
-    public void setPathLabels(final Set<String> labels) {
-        this.pathSelectKey = labels.contains(this.selectKey);
+        return this.getSelfAndChildRequirements(TraverserRequirement.OBJECT, TraverserRequirement.SIDE_EFFECTS);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
index 3a96380..167fa47 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/SelectStep.java
@@ -48,7 +48,6 @@ public final class SelectStep<S, E> extends MapStep<S, Map<String, E>> implement
     private TraversalRing<Object, E> traversalRing = new TraversalRing<>();
     private final Pop pop;
     private final List<String> selectKeys;
-    private Boolean pathSelectKey = null;
     private final Set<String> selectKeysSet;
     private Set<String> keepLabels;
 
@@ -121,17 +120,7 @@ public final class SelectStep<S, E> extends MapStep<S, Map<String, E>> implement
 
     @Override
     public Set<TraverserRequirement> getRequirements() {
-        if (null == this.pathSelectKey)
-            return this.getSelfAndChildRequirements(TraversalHelper.getLabels(TraversalHelper.getRootTraversal(this.traversal)).stream().filter(this.selectKeys::contains).findAny().isPresent() ?
-                    TYPICAL_GLOBAL_REQUIREMENTS_ARRAY :
-                    TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
-        else
-            return this.getSelfAndChildRequirements(this.pathSelectKey ? TYPICAL_GLOBAL_REQUIREMENTS_ARRAY : TYPICAL_LOCAL_REQUIREMENTS_ARRAY);
-    }
-
-    @Override
-    public void setPathLabels(final Set<String> labels) {
-        this.pathSelectKey = labels.stream().filter(this.selectKeysSet::contains).findAny().isPresent();
+        return this.getSelfAndChildRequirements(TraverserRequirement.OBJECT, TraverserRequirement.SIDE_EFFECTS);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
deleted file mode 100644
index 073f45e..0000000
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization;
-
-import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
-import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
-import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
-import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
-
-import java.util.Set;
-
-/**
- * ScopingStrategy will analyze the traversal for step labels (e.g. as()) and provide {@link Scoping} steps that information.
- * This enables Scoping steps to avoid  having to generate step label data at {@link Step#getRequirements()} and thus,
- * may significantly reduce compilation times.
- *
- * @author Marko A. Rodriguez (http://markorodriguez.com)
- */
-public final class ScopingStrategy extends AbstractTraversalStrategy<TraversalStrategy.FinalizationStrategy> implements TraversalStrategy.FinalizationStrategy {
-
-    private static final ScopingStrategy INSTANCE = new ScopingStrategy();
-
-
-    private ScopingStrategy() {
-    }
-
-    @Override
-    public void apply(final Traversal.Admin<?, ?> traversal) {
-        // only operate on the root traversal and only if it contains scoping steps
-        if (!(traversal.getParent() instanceof EmptyStep) ||
-                !TraversalHelper.hasStepOfAssignableClassRecursively(Scoping.class, traversal))
-            return;
-
-        // get the labels associated with the traveral
-        final Set<String> labels = TraversalHelper.getLabels(traversal);
-        // tell all scoping steps what those labels are
-        for (final Scoping scoping : TraversalHelper.getStepsOfAssignableClassRecursively(Scoping.class, traversal)) {
-            scoping.setPathLabels(labels);
-        }
-    }
-
-    public static final ScopingStrategy instance() {
-        return INSTANCE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
index 52c3027..c0e54db 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
@@ -147,6 +147,8 @@ public class DefaultTraversal<S, E> implements Traversal.Admin<S, E> {
             for (final Step<?, ?> step : this.getSteps()) {
                 this.requirements.addAll(step.getRequirements());
             }
+            if (TraversalHelper.hasLabels(this))
+                this.requirements.add(TraverserRequirement.LABELED_PATH);
             if (!this.getSideEffects().keys().isEmpty())
                 this.requirements.add(TraverserRequirement.SIDE_EFFECTS);
             if (null != this.getSideEffects().getSackInitialValue())

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
index 567ce53..5163824 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
@@ -549,6 +549,24 @@ public final class TraversalHelper {
         return traversal;
     }
 
+    public static boolean hasLabels(final Traversal.Admin<?, ?> traversal) {
+        for (final Step<?, ?> step : traversal.getSteps()) {
+            if (!step.getLabels().isEmpty())
+                return true;
+            if (step instanceof TraversalParent) {
+                for (final Traversal.Admin<?, ?> local : ((TraversalParent) step).getLocalChildren()) {
+                    if (TraversalHelper.hasLabels(local))
+                        return true;
+                }
+                for (final Traversal.Admin<?, ?> global : ((TraversalParent) step).getGlobalChildren()) {
+                    if (TraversalHelper.hasLabels(global))
+                        return true;
+                }
+            }
+        }
+        return false;
+    }
+
     public static Set<String> getLabels(final Traversal.Admin<?, ?> traversal) {
         return TraversalHelper.getLabels(new HashSet<>(), traversal);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java
index 7f65f23..fa9adeb 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/WhereStepTest.java
@@ -56,10 +56,10 @@ public class WhereStepTest extends StepTest {
         Object[][] traversalPaths = new Object[][]{
                 {false, __.where(P.not(P.within("x"))).asAdmin()},
                 {true, __.as("x").where(P.not(P.within("x"))).asAdmin()},
-                {false, __.as("a").where(P.not(P.within("x"))).asAdmin()},
+                {true, __.as("a").where(P.not(P.within("x"))).asAdmin()},
                 {false, __.local(__.where(P.not(P.within("x")))).asAdmin()},
                 {true, __.as("x").local(__.where(P.not(P.within("x")))).asAdmin()},
-                {false, __.as("a").local(__.where(P.not(P.within("x")))).asAdmin()},
+                {false, __.local(__.where(P.not(P.within("x")))).asAdmin()},
         };
         for (final Object[] traversalPath : traversalPaths) {
             assertEquals(traversalPath[0], ((Traversal.Admin<?, ?>) traversalPath[1]).getTraverserRequirements().contains(TraverserRequirement.LABELED_PATH));

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/6294c077/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java
index 108550a..40b03fe 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java
@@ -47,6 +47,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import java.util.AbstractMap;
@@ -2381,6 +2382,7 @@ public class GraphComputerTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
+    @Ignore("Labeled paths now trigger LABELED_PATH requirements -- @dkuppitz")
     public void shouldFailWithImproperTraverserRequirements() throws Exception {
 
         final AtomicInteger counter = new AtomicInteger(0);


[33/50] tinkerpop git commit: TINKERPOP-1642 Pushed integrateChild() operations into Parameters.set()

Posted by sp...@apache.org.
TINKERPOP-1642 Pushed integrateChild() operations into Parameters.set()

There was no need to continually iterate the traversal list and doing integrateChild() over and over again for each newly added traversal. Removing those wasteful cycles and only doing that once, when the Traversal was added helped improve performance.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 181558cea654ad0f7e351755bd02d952408a0944
Parents: 12c7f01
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Mar 13 14:50:09 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:22:57 2017 -0400

----------------------------------------------------------------------
 .../process/traversal/step/map/AddEdgeStep.java | 15 +++----
 .../traversal/step/map/AddVertexStartStep.java  |  6 +--
 .../traversal/step/map/AddVertexStep.java       |  6 +--
 .../step/sideEffect/AddPropertyStep.java        |  7 +--
 .../process/traversal/step/util/Parameters.java | 19 ++------
 .../strategy/decoration/ElementIdStrategy.java  |  2 +-
 .../traversal/step/util/ParametersTest.java     | 46 ++++++++++----------
 7 files changed, 39 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/181558ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
index 3a46c0d..03a2fa7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
@@ -57,7 +57,7 @@ public final class AddEdgeStep<S> extends MapStep<S, Edge>
 
     public AddEdgeStep(final Traversal.Admin traversal, final String edgeLabel) {
         super(traversal);
-        this.parameters.set(T.label, edgeLabel);
+        this.parameters.set(this, T.label, edgeLabel);
     }
 
     @Override
@@ -77,20 +77,17 @@ public final class AddEdgeStep<S> extends MapStep<S, Edge>
 
     @Override
     public void addPropertyMutations(final Object... keyValues) {
-        this.parameters.set(keyValues);
-        this.parameters.integrateTraversals(this);
+        this.parameters.set(this, keyValues);
     }
 
     @Override
-    public void addTo(final Traversal.Admin<?, ?> toObject) {
-        this.parameters.set(TO, toObject);
-        this.parameters.integrateTraversals(this);
+    public void addTo(final Traversal.Admin<?,?> toObject) {
+        this.parameters.set(this, TO, toObject);
     }
 
     @Override
-    public void addFrom(final Traversal.Admin<?, ?> fromObject) {
-        this.parameters.set(FROM, fromObject);
-        this.parameters.integrateTraversals(this);
+    public void addFrom(final Traversal.Admin<?,?> fromObject) {
+        this.parameters.set(this, FROM, fromObject);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/181558ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
index 064fc79..7de8839 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
@@ -54,8 +54,7 @@ public final class AddVertexStartStep extends AbstractStep<Vertex, Vertex>
 
     public AddVertexStartStep(final Traversal.Admin traversal, final String label) {
         super(traversal);
-        this.parameters.set(T.label, label);
-        this.parameters.integrateTraversals(this);
+        this.parameters.set(this, T.label, label);
     }
 
     @Override
@@ -75,8 +74,7 @@ public final class AddVertexStartStep extends AbstractStep<Vertex, Vertex>
 
     @Override
     public void addPropertyMutations(final Object... keyValues) {
-        this.parameters.set(keyValues);
-        this.parameters.integrateTraversals(this);
+        this.parameters.set(this, keyValues);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/181558ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
index 69ee6e5..c35fa80 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
@@ -49,8 +49,7 @@ public final class AddVertexStep<S> extends MapStep<S, Vertex>
 
     public AddVertexStep(final Traversal.Admin traversal, final String label) {
         super(traversal);
-        this.parameters.set(T.label, label);
-        this.parameters.integrateTraversals(this);
+        this.parameters.set(this, T.label, label);
     }
 
     @Override
@@ -70,8 +69,7 @@ public final class AddVertexStep<S> extends MapStep<S, Vertex>
 
     @Override
     public void addPropertyMutations(final Object... keyValues) {
-        this.parameters.set(keyValues);
-        this.parameters.integrateTraversals(this);
+        this.parameters.set(this, keyValues);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/181558ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
index 85292b7..3de8932 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
@@ -55,10 +55,8 @@ public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
 
     public AddPropertyStep(final Traversal.Admin traversal, final VertexProperty.Cardinality cardinality, final Object keyObject, final Object valueObject) {
         super(traversal);
-        this.parameters.set(T.key, keyObject);
-        this.parameters.set(T.value, valueObject);
+        this.parameters.set(this, T.key, keyObject, T.value, valueObject);
         this.cardinality = cardinality;
-        this.parameters.integrateTraversals(this);
     }
 
     @Override
@@ -78,8 +76,7 @@ public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
 
     @Override
     public void addPropertyMutations(final Object... keyValues) {
-        this.parameters.set(keyValues);
-        this.parameters.integrateTraversals(this);
+        this.parameters.set(this, keyValues);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/181558ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index 4b38d2e..0583ed2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -55,8 +55,8 @@ public final class Parameters implements Cloneable, Serializable {
 
     /**
      * A cached list of traversals that serve as parameter values. The list is cached on calls to
-     * {@link #set(Object...)} because when the parameter map is large the cost of iterating it repeatedly on the
-     * high number of calls to {@link #getTraversals()} and {@link #integrateTraversals(TraversalParent)} is great.
+     * {@link #set(TraversalParent, Object...)} because when the parameter map is large the cost of iterating it repeatedly on the
+     * high number of calls to {@link #getTraversals()} is great.
      */
     private List<Traversal.Admin<?,?>> traversals = new ArrayList<>();
 
@@ -170,7 +170,7 @@ public final class Parameters implements Cloneable, Serializable {
     /**
      * Set parameters given key/value pairs.
      */
-    public void set(final Object... keyValues) {
+    public void set(final TraversalParent parent, final Object... keyValues) {
         Parameters.legalPropertyKeyValueArray(keyValues);
         for (int i = 0; i < keyValues.length; i = i + 2) {
             if (keyValues[i + 1] != null) {
@@ -179,6 +179,7 @@ public final class Parameters implements Cloneable, Serializable {
                 if (keyValues[i + 1] instanceof Traversal.Admin) {
                     final Traversal.Admin t = (Traversal.Admin) keyValues[i + 1];
                     addTraversal(t);
+                    if (parent != null) parent.integrateChild(t);
                 }
 
                 List<Object> values = this.parameters.get(keyValues[i]);
@@ -194,18 +195,6 @@ public final class Parameters implements Cloneable, Serializable {
     }
 
     /**
-     * Calls {@link TraversalParent#integrateChild(Traversal.Admin)} on any traversal objects in the parameter list.
-     * This method requires that {@link #set(Object...)} is called prior to this method as the it will switch the
-     * {@code traversalsPresent} flag field if a {@link Traversal.Admin} object is present and allow this method to
-     * do its work.
-     */
-    public void integrateTraversals(final TraversalParent step) {
-        for (Traversal.Admin t : traversals) {
-            step.integrateChild(t);
-        }
-    }
-
-    /**
      * Gets all the {@link Traversal.Admin} objects in the map of parameters.
      */
     public <S, E> List<Traversal.Admin<S, E>> getTraversals() {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/181558ce/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
index 32437e1..c8f9d22 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/ElementIdStrategy.java
@@ -111,7 +111,7 @@ public final class ElementIdStrategy extends AbstractTraversalStrategy<Traversal
                 if (parameterizing.getParameters().contains(T.id))
                     parameterizing.getParameters().rename(T.id, this.idPropertyKey);
                 else if (!parameterizing.getParameters().contains(this.idPropertyKey))
-                    parameterizing.getParameters().set(this.idPropertyKey, idMaker.get());
+                    parameterizing.getParameters().set(null, this.idPropertyKey, idMaker.get());
             }
         });
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/181558ce/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
index 9c96c1c..ebe40af 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
@@ -52,7 +52,7 @@ public class ParametersTest {
     @Test
     public void shouldGetKeyValues() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         final Object[] params = parameters.getKeyValues(mock(Traverser.Admin.class));
         assertEquals(6, params.length);
@@ -62,7 +62,7 @@ public class ParametersTest {
     @Test
     public void shouldGetKeyValuesIgnoringSomeKeys() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         final Object[] params = parameters.getKeyValues(mock(Traverser.Admin.class), "b");
         assertEquals(4, params.length);
@@ -72,7 +72,7 @@ public class ParametersTest {
     @Test
     public void shouldGetUsingTraverserOverload() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         assertEquals(Collections.singletonList("axe"), parameters.get(mock(Traverser.Admin.class), "a", () -> "x"));
         assertEquals(Collections.singletonList("bat"), parameters.get(mock(Traverser.Admin.class), "b", () -> "x"));
@@ -83,7 +83,7 @@ public class ParametersTest {
     @Test
     public void shouldGetMultipleUsingTraverserOverload() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
+        parameters.set(null, "a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
 
         final Map<Object,List<Object>> params = parameters.getRaw();
         assertEquals(3, params.size());
@@ -96,7 +96,7 @@ public class ParametersTest {
     @Test
     public void shouldGetRaw() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         final Map<Object,List<Object>> params = parameters.getRaw();
         assertEquals(3, params.size());
@@ -108,7 +108,7 @@ public class ParametersTest {
     @Test
     public void shouldGetRawWithMulti() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "a", "ant", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "a", "ant", "c", "cat");
 
         final Map<Object,List<Object>> params = parameters.getRaw();
         assertEquals(3, params.size());
@@ -127,7 +127,7 @@ public class ParametersTest {
     @Test
     public void shouldGetRawExcept() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         final Map<Object,List<Object>> params = parameters.getRaw("b");
         assertEquals(2, params.size());
@@ -138,7 +138,7 @@ public class ParametersTest {
     @Test
     public void shouldRemove() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         final Map<Object,List<Object>> before = parameters.getRaw();
         assertEquals(3, before.size());
@@ -157,7 +157,7 @@ public class ParametersTest {
     @Test
     public void shouldRemoveRefreshTraversalCache() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat", "c", mock(Traversal.Admin.class), "t", mock(Traversal.Admin.class));
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat", "c", mock(Traversal.Admin.class), "t", mock(Traversal.Admin.class));
 
         final Map<Object,List<Object>> before = parameters.getRaw();
         assertEquals(4, before.size());
@@ -190,7 +190,7 @@ public class ParametersTest {
     @Test
     public void shouldRename() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         parameters.rename("a", "z");
 
@@ -204,7 +204,7 @@ public class ParametersTest {
     @Test
     public void shouldContainKey() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         assertThat(parameters.contains("b"), is(true));
     }
@@ -212,7 +212,7 @@ public class ParametersTest {
     @Test
     public void shouldNotContainKey() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         assertThat(parameters.contains("z"), is(false));
     }
@@ -220,7 +220,7 @@ public class ParametersTest {
     @Test
     public void shouldGetSetMultiple() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
+        parameters.set(null, "a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
 
         final Map<Object,List<Object>> params = parameters.getRaw();
         assertEquals(3, params.size());
@@ -234,7 +234,7 @@ public class ParametersTest {
     @Test
     public void shouldGetDefault() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "b", "bat", "c", "cat");
+        parameters.set(null, "a", "axe", "b", "bat", "c", "cat");
 
         assertEquals(Collections.singletonList("axe"), parameters.get("a", () -> "x"));
         assertEquals(Collections.singletonList("bat"), parameters.get("b", () -> "x"));
@@ -245,7 +245,7 @@ public class ParametersTest {
     @Test
     public void shouldClone() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
+        parameters.set(null, "a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
 
         final Parameters parametersClone = parameters.clone();
 
@@ -259,7 +259,7 @@ public class ParametersTest {
         when(t.clone()).thenReturn(t);
 
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", t);
+        parameters.set(null, "a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", t);
 
         final Parameters parametersClone = parameters.clone();
 
@@ -270,10 +270,10 @@ public class ParametersTest {
     @Test
     public void shouldBeDifferent() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
+        parameters.set(null, "a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
 
         final Parameters parametersDifferent = new Parameters();
-        parametersDifferent.set("a", "ant", "a", "axe", "b", "bat", "b", "ball", "c", "cat");
+        parametersDifferent.set(null, "a", "ant", "a", "axe", "b", "bat", "b", "ball", "c", "cat");
 
         assertNotEquals(parameters.getRaw(), parametersDifferent.getRaw());
     }
@@ -281,29 +281,27 @@ public class ParametersTest {
     @Test
     public void shouldGetNoTraversals() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
+        parameters.set(null, "a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
         assertEquals(Collections.emptyList(), parameters.getTraversals());
     }
 
     @Test
     public void shouldGetTraversals() {
         final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", __.outE("knows"));
+        parameters.set(null, "a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", __.outE("knows"));
         assertEquals(Collections.singletonList(__.outE("knows")), parameters.getTraversals());
     }
 
     @Test
     public void shouldIntegrateTraversals() {
-        final Parameters parameters = new Parameters();
-        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", __.outE("knows"));
-
         final TraversalParent mock = mock(TraversalParent.class);
+        final Parameters parameters = new Parameters();
 
         // the mock can return nothing of consequence as the return isn't used in this case. we just need to
         // validate that the method gets called as a result of calls to set/integrateTraversals()
         when(mock.integrateChild(__.outE("knows").asAdmin())).thenReturn(null);
 
-        parameters.integrateTraversals(mock);
+        parameters.set(mock, "a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", __.outE("knows"));
 
         verify(mock).integrateChild(__.outE("knows").asAdmin());
     }


[43/50] tinkerpop git commit: Merge branch 'TINKERPOP-1625' into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1625' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: 91802ad4de93d5cb539538659858902a872825a2
Parents: 4fd8d7e 6515a6f
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Mar 29 12:30:54 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Mar 29 12:30:54 2017 -0600

----------------------------------------------------------------------
 docs/src/reference/the-traversal.asciidoc       |  8 ++-
 .../traversal/step/filter/GroovyHasTest.groovy  | 30 +++-----
 .../process/traversal/step/filter/HasTest.java  | 74 +++++++++++---------
 3 files changed, 56 insertions(+), 56 deletions(-)
----------------------------------------------------------------------



[39/50] tinkerpop git commit: Fixed 'OTLP', was fixed in tp32 - CTR

Posted by sp...@apache.org.
Fixed 'OTLP', was fixed in tp32 - CTR


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

Branch: refs/heads/TINKERPOP-1577
Commit: 4e8cb39d4264a59cc07163c4458aa25c586fb0fa
Parents: b831ae8
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Mar 29 11:49:31 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Mar 29 11:49:31 2017 -0400

----------------------------------------------------------------------
 docs/src/dev/provider/index.asciidoc          | 4 ++--
 docs/src/reference/the-graphcomputer.asciidoc | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4e8cb39d/docs/src/dev/provider/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/provider/index.asciidoc b/docs/src/dev/provider/index.asciidoc
index 3b46762..aa89020 100644
--- a/docs/src/dev/provider/index.asciidoc
+++ b/docs/src/dev/provider/index.asciidoc
@@ -52,7 +52,7 @@ Implementing Gremlin-Core
 The classes that a graph system provider should focus on implementing are itemized below. It is a good idea to study
 the link:http://tinkerpop.apache.org/docs/x.y.z/reference/#tinkergraph-gremlin[TinkerGraph] (in-memory OLTP and OLAP
 in `tinkergraph-gremlin`), link:http://tinkerpop.apache.org/docs/x.y.z/reference/#neo4j-gremlin[Neo4jGraph]
-(OTLP w/ transactions in `neo4j-gremlin`) and/or
+(OLTP w/ transactions in `neo4j-gremlin`) and/or
 link:http://tinkerpop.apache.org/docs/x.y.z/reference/#hadoop-gremlin[HadoopGraph] (OLAP in `hadoop-gremlin`)
 implementations for ideas and patterns.
 
@@ -60,7 +60,7 @@ implementations for ideas and patterns.
  .. Structure API: `Graph`, `Element`, `Vertex`, `Edge`, `Property` and `Transaction` (if transactions are supported).
  .. Process API: `TraversalStrategy` instances for optimizing Gremlin traversals to the provider's graph system (i.e. `TinkerGraphStepStrategy`).
 . Online Analytics Processing Graph Systems (*OLAP*)
- .. Everything required of OTLP is required of OLAP (but not vice versa).
+ .. Everything required of OLTP is required of OLAP (but not vice versa).
  .. GraphComputer API: `GraphComputer`, `Messenger`, `Memory`.
 
 Please consider the following implementation notes:

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4e8cb39d/docs/src/reference/the-graphcomputer.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graphcomputer.asciidoc b/docs/src/reference/the-graphcomputer.asciidoc
index fb4331a..ef859f9 100644
--- a/docs/src/reference/the-graphcomputer.asciidoc
+++ b/docs/src/reference/the-graphcomputer.asciidoc
@@ -20,7 +20,7 @@ The GraphComputer
 
 image:graphcomputer-puffers.png[width=350,float=right] TinkerPop3 provides two primary means of interacting with a
 graph: link:http://en.wikipedia.org/wiki/Online_transaction_processing[online transaction processing] (OLTP) and
-link:http://en.wikipedia.org/wiki/Online_analytical_processing[online analytical processing] (OLAP). OTLP-based
+link:http://en.wikipedia.org/wiki/Online_analytical_processing[online analytical processing] (OLAP). OLTP-based
 graph systems allow the user to query the graph in real-time. However, typically, real-time performance is only
 possible when a local traversal is enacted. A local traversal is one that starts at a particular vertex (or small set
 of vertices) and touches a small set of connected vertices (by any arbitrary path of arbitrary length). In short, OLTP
@@ -394,7 +394,7 @@ TraversalVertexProgram
 
 image:traversal-vertex-program.png[width=250,float=left] The `TraversalVertexProgram` is a "special" VertexProgram in
 that it can be executed via a `GraphTraversal` with a `ComputerTraversalEngine`. In Gremlin, it is possible to have
-the same traversal executed using either the standard OTLP-engine or the `GraphComputer` OLAP-engine. The difference
+the same traversal executed using either the standard OLTP-engine or the `GraphComputer` OLAP-engine. The difference
 being where the traversal is submitted.
 
 NOTE: This model of graph traversal in a BSP system was first implemented by the


[48/50] tinkerpop git commit: Merge branch 'TINKERPOP-1642' into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1642' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: f73d7ca75482897df0eff80a8c05ce599018e8b0
Parents: 46976bb 8ac09c8
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Thu Mar 30 13:41:52 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Thu Mar 30 13:41:52 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |   6 +
 .../process/traversal/Parameterizing.java       |   8 +
 .../traversal/dsl/graph/GraphTraversal.java     |   9 +-
 .../gremlin/process/traversal/step/Scoping.java |  24 ++-
 .../step/filter/WherePredicateStep.java         |   6 +-
 .../step/filter/WhereTraversalStep.java         |   4 +-
 .../process/traversal/step/map/AddEdgeStep.java |  26 ++-
 .../traversal/step/map/AddVertexStartStep.java  |  15 +-
 .../traversal/step/map/AddVertexStep.java       |  15 +-
 .../traversal/step/map/SelectOneStep.java       |  10 +-
 .../process/traversal/step/map/SelectStep.java  |   4 +-
 .../step/sideEffect/AddPropertyStep.java        |  16 +-
 .../process/traversal/step/util/Parameters.java | 106 +++++++---
 .../strategy/decoration/ElementIdStrategy.java  |   2 +-
 .../strategy/finalization/ProfileStrategy.java  |  39 ++--
 .../optimization/PathRetractionStrategy.java    |  30 ++-
 .../StandardVerificationStrategy.java           |   3 +-
 .../traverser/B_LP_O_S_SE_SL_Traverser.java     |   2 +-
 .../traversal/util/DefaultTraversal.java        |   2 +
 .../process/traversal/util/PathUtil.java        |  17 +-
 .../process/traversal/util/TraversalHelper.java |  40 +++-
 .../traversal/step/filter/WhereStepTest.java    |   4 +-
 .../traversal/step/util/ParametersTest.java     | 185 +++++++++++++++--
 .../process/computer/GraphComputerTest.java     | 199 +++++++++----------
 24 files changed, 510 insertions(+), 262 deletions(-)
----------------------------------------------------------------------


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


[04/50] tinkerpop git commit: Merge branch 'TINKERPOP-1652' into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1652' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: 71d0d913bed5b877d61a230aeba99082a0441f66
Parents: 028cb47 d1956ea
Author: Ted Wilmes <tw...@gmail.com>
Authored: Fri Mar 24 15:46:13 2017 -0500
Committer: Ted Wilmes <tw...@gmail.com>
Committed: Fri Mar 24 15:46:13 2017 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  3 ++-
 .../optimization/PathRetractionStrategy.java    |  7 ++++-
 .../PathRetractionStrategyTest.java             | 28 +++++++++++++++++---
 3 files changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------



[31/50] tinkerpop git commit: TINKERPOP-1642 Made Mutating steps implement Scoping.

Posted by sp...@apache.org.
TINKERPOP-1642 Made Mutating steps implement Scoping.

This simplified PathUtil.getReferencedLabels() and reduced iterations over Parameter traversals.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 1f99a5103bfaec758d657078362ac666fe47e8d2
Parents: 88a3f60
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 10 15:11:52 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:21:06 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../process/traversal/Parameterizing.java       |  8 +++++
 .../gremlin/process/traversal/step/Scoping.java | 14 +++++---
 .../process/traversal/step/map/AddEdgeStep.java | 11 +++++-
 .../traversal/step/map/AddVertexStartStep.java  |  9 ++++-
 .../traversal/step/map/AddVertexStep.java       |  9 ++++-
 .../step/sideEffect/AddPropertyStep.java        |  9 ++++-
 .../process/traversal/step/util/Parameters.java | 37 +++++++++++++++++---
 .../process/traversal/util/PathUtil.java        | 17 +--------
 9 files changed, 85 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f99a510/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 6e88565..8dd8d9a 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* `Mutating` steps now implement `Scoping` interface.
 * Fixed a step id compilation bug in `AddVertexStartStep`, `AddVertexStep`, `AddEdgeStep`, and `AddPropertyStep`.
 * De-registered metrics on Gremlin Server shutdown.
 * Added "help" command option on `:remote config` for plugins that support that feature in the Gremlin Console.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f99a510/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
index 8af80b3..9b7e088 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Parameterizing.java
@@ -21,9 +21,17 @@ package org.apache.tinkerpop.gremlin.process.traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 
 /**
+ * An interface for {@link Step} implementations that hold a {@link Parameters} object, which fold in arguments from
+ * other steps. It is typically used on mutating steps, such as {@code addV()}, where calls to {@code property(k,v)}
+ * are folded in as parameters to that add vertex step.
+ *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface Parameterizing {
 
+    /**
+     * Gets the parameters on the step.
+     */
     public Parameters getParameters();
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f99a510/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
index 22109bf..683e661 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
@@ -20,23 +20,27 @@ package org.apache.tinkerpop.gremlin.process.traversal.step;
 
 import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.Pop;
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
-import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 
-import java.util.EnumSet;
 import java.util.Map;
 import java.util.Set;
 
 /**
+ * This interface is implemented by {@link Step} implementations that access labeled path steps, side-effects or
+ * {@code Map} values by key, such as {@code select('a')} step. Note that a step like {@code project()} is non-scoping
+ * because while it creates a {@code Map} it does not introspect them.
+ *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public interface Scoping {
 
-    public static enum Variable {START, END}
+    public enum Variable {START, END}
 
     public default <S> S getScopeValue(final Pop pop, final String key, final Traverser.Admin<?> traverser) throws IllegalArgumentException {
         if (traverser.getSideEffects().exists(key))
-            return traverser.getSideEffects().<S>get(key);
+            return traverser.getSideEffects().get(key);
         ///
         final Object object = traverser.get();
         if (object instanceof Map && ((Map<String, S>) object).containsKey(key))
@@ -51,7 +55,7 @@ public interface Scoping {
 
     public default <S> S getNullableScopeValue(final Pop pop, final String key, final Traverser.Admin<?> traverser) {
         if (traverser.getSideEffects().exists(key))
-            return traverser.getSideEffects().<S>get(key);
+            return traverser.getSideEffects().get(key);
         ///
         final Object object = traverser.get();
         if (object instanceof Map && ((Map<String, S>) object).containsKey(key))

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f99a510/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
index 13efc8e..3a46c0d 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
@@ -23,6 +23,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.FromToModulating;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.CallbackRegistry;
@@ -36,6 +37,8 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.structure.util.detached.DetachedFactory;
 
+import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -43,7 +46,8 @@ import java.util.Set;
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public final class AddEdgeStep<S> extends MapStep<S, Edge> implements Mutating<Event.EdgeAddedEvent>, TraversalParent, Parameterizing, FromToModulating {
+public final class AddEdgeStep<S> extends MapStep<S, Edge>
+        implements Mutating<Event.EdgeAddedEvent>, TraversalParent, Parameterizing, Scoping, FromToModulating {
 
     private static final String FROM = Graph.Hidden.hide("from");
     private static final String TO = Graph.Hidden.hide("to");
@@ -67,6 +71,11 @@ public final class AddEdgeStep<S> extends MapStep<S, Edge> implements Mutating<E
     }
 
     @Override
+    public Set<String> getScopeKeys() {
+        return this.parameters.getReferencedLabels();
+    }
+
+    @Override
     public void addPropertyMutations(final Object... keyValues) {
         this.parameters.set(keyValues);
         this.parameters.integrateTraversals(this);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f99a510/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
index e7939dc..064fc79 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.TraverserGenerator;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
@@ -44,7 +45,8 @@ import java.util.Set;
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public final class AddVertexStartStep extends AbstractStep<Vertex, Vertex> implements Mutating<Event.VertexAddedEvent>, TraversalParent, Parameterizing {
+public final class AddVertexStartStep extends AbstractStep<Vertex, Vertex>
+        implements Mutating<Event.VertexAddedEvent>, TraversalParent, Parameterizing, Scoping {
 
     private Parameters parameters = new Parameters();
     private boolean first = true;
@@ -62,6 +64,11 @@ public final class AddVertexStartStep extends AbstractStep<Vertex, Vertex> imple
     }
 
     @Override
+    public Set<String> getScopeKeys() {
+        return this.parameters.getReferencedLabels();
+    }
+
+    @Override
     public <S, E> List<Traversal.Admin<S, E>> getLocalChildren() {
         return this.parameters.getTraversals();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f99a510/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
index 57cd616..69ee6e5 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
@@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.CallbackRegistry;
@@ -40,7 +41,8 @@ import java.util.Set;
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
-public final class AddVertexStep<S> extends MapStep<S, Vertex> implements Mutating<Event.VertexAddedEvent>, TraversalParent, Parameterizing {
+public final class AddVertexStep<S> extends MapStep<S, Vertex>
+        implements Mutating<Event.VertexAddedEvent>, TraversalParent, Parameterizing, Scoping {
 
     private Parameters parameters = new Parameters();
     private CallbackRegistry<Event.VertexAddedEvent> callbackRegistry;
@@ -57,6 +59,11 @@ public final class AddVertexStep<S> extends MapStep<S, Vertex> implements Mutati
     }
 
     @Override
+    public Set<String> getScopeKeys() {
+        return this.parameters.getReferencedLabels();
+    }
+
+    @Override
     public <S, E> List<Traversal.Admin<S, E>> getLocalChildren() {
         return this.parameters.getTraversals();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f99a510/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
index 44232f0..85292b7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
@@ -22,6 +22,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Mutating;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.CallbackRegistry;
@@ -45,7 +46,8 @@ import java.util.Set;
 /**
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
-public final class AddPropertyStep<S extends Element> extends SideEffectStep<S> implements Mutating<Event.ElementPropertyChangedEvent>, TraversalParent, Parameterizing {
+public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
+        implements Mutating<Event.ElementPropertyChangedEvent>, TraversalParent, Parameterizing, Scoping {
 
     private Parameters parameters = new Parameters();
     private final VertexProperty.Cardinality cardinality;
@@ -65,6 +67,11 @@ public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
     }
 
     @Override
+    public Set<String> getScopeKeys() {
+        return this.parameters.getReferencedLabels();
+    }
+
+    @Override
     public <S, E> List<Traversal.Admin<S, E>> getLocalChildren() {
         return this.parameters.getTraversals();
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f99a510/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index 93cf1f8..4b38d2e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -22,6 +22,7 @@ package org.apache.tinkerpop.gremlin.process.traversal.step.util;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
 import org.apache.tinkerpop.gremlin.structure.Element;
@@ -33,8 +34,10 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.function.Supplier;
 
 /**
@@ -48,6 +51,7 @@ public final class Parameters implements Cloneable, Serializable {
     private static final Object[] EMPTY_ARRAY = new Object[0];
 
     private Map<Object, List<Object>> parameters = new HashMap<>();
+    private Set<String> referencedLabels = new HashSet<>();
 
     /**
      * A cached list of traversals that serve as parameter values. The list is cached on calls to
@@ -111,14 +115,15 @@ public final class Parameters implements Cloneable, Serializable {
     public Object remove(final Object key) {
         final List<Object> o = parameters.remove(key);
 
-        // once a key is removed, it's possible that the traversal cache will need to be regenerated
+        // once a key is removed, it's possible that the traversal/label cache will need to be regenerated
         if (IteratorUtils.anyMatch(o.iterator(), p -> p instanceof Traversal.Admin)) {
             traversals.clear();
             traversals = new ArrayList<>();
             for (final List<Object> list : this.parameters.values()) {
                 for (final Object object : list) {
                     if (object instanceof Traversal.Admin) {
-                        traversals.add((Traversal.Admin) object);
+                        final Traversal.Admin t = (Traversal.Admin) object;
+                        addTraversal(t);
                     }
                 }
             }
@@ -170,9 +175,11 @@ public final class Parameters implements Cloneable, Serializable {
         for (int i = 0; i < keyValues.length; i = i + 2) {
             if (keyValues[i + 1] != null) {
                 // track the list of traversals that are present so that elsewhere in Parameters there is no need
-                // to iterate all values to not find any.
-                if (keyValues[i + 1] instanceof Traversal.Admin)
-                    traversals.add((Traversal.Admin) keyValues[i + 1]);
+                // to iterate all values to not find any. also grab available labels in traversal values
+                if (keyValues[i + 1] instanceof Traversal.Admin) {
+                    final Traversal.Admin t = (Traversal.Admin) keyValues[i + 1];
+                    addTraversal(t);
+                }
 
                 List<Object> values = this.parameters.get(keyValues[i]);
                 if (null == values) {
@@ -206,6 +213,13 @@ public final class Parameters implements Cloneable, Serializable {
         return (List<Traversal.Admin<S, E>>) (Object) traversals;
     }
 
+    /**
+     * Gets a list of all labels held in parameters that have a traversal as a value.
+     */
+    public Set<String> getReferencedLabels() {
+        return referencedLabels;
+    }
+
     public Parameters clone() {
         try {
             final Parameters clone = (Parameters) super.clone();
@@ -217,6 +231,8 @@ public final class Parameters implements Cloneable, Serializable {
                 }
                 clone.parameters.put(entry.getKey() instanceof Traversal.Admin ? ((Traversal.Admin) entry.getKey()).clone() : entry.getKey(), values);
             }
+
+            clone.referencedLabels = new HashSet<>(this.referencedLabels);
             return clone;
         } catch (final CloneNotSupportedException e) {
             throw new IllegalStateException(e.getMessage(), e);
@@ -246,4 +262,15 @@ public final class Parameters implements Cloneable, Serializable {
                 throw new IllegalArgumentException("The provided key/value array must have a String, T, or Traversal on even array indices");
         }
     }
+
+    private void addTraversal(final Traversal.Admin t) {
+        traversals.add(t);
+        for (final Object ss : t.getSteps()) {
+            if (ss instanceof Scoping) {
+                for (String label : ((Scoping) ss).getScopeKeys()) {
+                    referencedLabels.add(label);
+                }
+            }
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1f99a510/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/PathUtil.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/PathUtil.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/PathUtil.java
index ab97836..cefc62a 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/PathUtil.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/PathUtil.java
@@ -18,19 +18,17 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.util;
 
-import org.apache.tinkerpop.gremlin.process.traversal.Parameterizing;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
-import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
 import org.apache.tinkerpop.gremlin.process.traversal.step.map.MatchStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
-import org.apache.tinkerpop.gremlin.process.traversal.step.util.Parameters;
 
 import java.util.HashSet;
 import java.util.Set;
 
 /**
  * @author Ted Wilmes (http://twilmes.org)
+ * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class PathUtil {
 
@@ -50,19 +48,6 @@ public class PathUtil {
     public static Set<String> getReferencedLabels(final Step step) {
         final Set<String> referencedLabels = new HashSet<>();
 
-        if (step instanceof Parameterizing) { // TODO: we should really make the mutation steps Scoping :|
-            final Parameters parameters = ((Parameterizing) step).getParameters();
-            for (final Traversal.Admin trav : parameters.getTraversals()) {
-                for (final Object ss : trav.getSteps()) {
-                    if (ss instanceof Scoping) {
-                        for (String label : ((Scoping) ss).getScopeKeys()) {
-                            referencedLabels.add(label);
-                        }
-                    }
-                }
-            }
-        }
-
         if (step instanceof Scoping) {
             final Set<String> labels = new HashSet<>(((Scoping) step).getScopeKeys());
             if (step instanceof MatchStep) {


[46/50] tinkerpop git commit: TINKERPOP-1659 documentation

Posted by sp...@apache.org.
TINKERPOP-1659 documentation


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

Branch: refs/heads/TINKERPOP-1577
Commit: 11903a2cdf606071e348b4f395174b6a88f6ca24
Parents: beb7f74
Author: Robert Dale <ro...@gmail.com>
Authored: Thu Mar 30 14:30:59 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Thu Mar 30 14:30:59 2017 -0400

----------------------------------------------------------------------
 docs/src/dev/developer/development-environment.asciidoc | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/11903a2c/docs/src/dev/developer/development-environment.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/development-environment.asciidoc b/docs/src/dev/developer/development-environment.asciidoc
index f7ef0b7..8a237cc 100644
--- a/docs/src/dev/developer/development-environment.asciidoc
+++ b/docs/src/dev/developer/development-environment.asciidoc
@@ -85,6 +85,9 @@ TINKERPOP_DOCKER_OPTS="--tmpfs /usr/src/tinkermem:exec,mode=0755,rw,noatime,size
 TINKERPOP_DOCKER_OPTS="--sysctl net.ipv6.conf.all.disable_ipv6=1 --sysctl net.ipv6.conf.default.disable_ipv6=1"
 ----
 
+A custom maven settings.xml can be supplied, for example, to point to a local proxy. Copy the `settings.xml` to the
+`PROJECT_HOME/` directory. The Docker script will detect and copy it to the running container.
+
 If the container is used to generate the user docs, it will start a web server and show the URL that
 is used to host the HTML docs.
 


[19/50] tinkerpop git commit: TINKERPOP-1660 Fixed bad links in GLV tutorial. CTR

Posted by sp...@apache.org.
TINKERPOP-1660 Fixed bad links in GLV tutorial. CTR


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

Branch: refs/heads/TINKERPOP-1577
Commit: 661317825c117f70272b47041daf6ba6c81744ac
Parents: 49fb257
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Mar 29 10:48:08 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 10:48:26 2017 -0400

----------------------------------------------------------------------
 docs/src/tutorials/gremlin-language-variants/index.asciidoc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/66131782/docs/src/tutorials/gremlin-language-variants/index.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/tutorials/gremlin-language-variants/index.asciidoc b/docs/src/tutorials/gremlin-language-variants/index.asciidoc
index cb419d5..70a5ca7 100644
--- a/docs/src/tutorials/gremlin-language-variants/index.asciidoc
+++ b/docs/src/tutorials/gremlin-language-variants/index.asciidoc
@@ -453,9 +453,9 @@ class GraphTraversalSourceGenerator {
 ----
 
 When the above Groovy script is evaluated (e.g. in GremlinConsole), **Gremlin-Python** is born. The generated Python
-file is available at link:https://github.com/apache/tinkerpop/blob/TINKERPOP-1278/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py[graph_traversal.py].
+file is available at link:https://github.com/apache/tinkerpop/blob/x.y.z/gremlin-python/src/main/jython/gremlin_python/process/graph_traversal.py[graph_traversal.py].
 It is important to note that here is a bit more to Gremlin-Python in that there also exists Python implementations of `TraversalStrategies`, `Traversal`, `Bytecode`, etc.
-Please review the full implementation of Gremlin-Python link:https://github.com/apache/tinkerpop/tree/TINKERPOP-1278/gremlin-python/src/main/jython/gremlin_python[here].
+Please review the full implementation of Gremlin-Python link:https://github.com/apache/tinkerpop/tree/x.y.z/gremlin-python/src/main/jython/gremlin_python[here].
 
 Of particular importance is Gremlin-Python's implementation of `Bytecode`.
 


[18/50] tinkerpop git commit: added a @twilmes test case to AddEdgeTest that fails in TINKERPOP-1642. That test also exposed a small bug in all the Mutating steps where Step.setTraversal() was not defined which is necessary to ensure proper ID redefiniti

Posted by sp...@apache.org.
added a @twilmes test case to AddEdgeTest that fails in TINKERPOP-1642. That test also exposed a small bug in all the Mutating steps where Step.setTraversal() was not defined which is necessary to ensure proper ID redefinitions at compile time. CTR.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 49fb2579714144cdf9f47a82c0754b7e37e0b35f
Parents: 1b6ad3c
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Mar 29 08:39:29 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Mar 29 08:39:50 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../process/traversal/step/map/AddEdgeStep.java | 10 +++++--
 .../traversal/step/map/AddVertexStartStep.java  |  6 ++++
 .../traversal/step/map/AddVertexStep.java       |  6 ++++
 .../step/sideEffect/AddPropertyStep.java        |  8 +++++-
 .../traversal/step/map/GroovyAddEdgeTest.groovy | 15 ++++++----
 .../process/traversal/step/map/AddEdgeTest.java | 30 ++++++++++++++++++++
 7 files changed, 68 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/49fb2579/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 98237a1..7d4e74b 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Fixed a step id compilation bug in `AddVertexStartStep`, `AddVertexStep`, `AddEdgeStep`, and `AddPropertyStep`.
 * De-registered metrics on Gremlin Server shutdown.
 * Added "help" command option on `:remote config` for plugins that support that feature in the Gremlin Console.
 * Allowed for multiple scripts and related arguments to be passed to `gremlin.sh` via `-i` and `-e`.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/49fb2579/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
index 4308291..13efc8e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeStep.java
@@ -73,13 +73,13 @@ public final class AddEdgeStep<S> extends MapStep<S, Edge> implements Mutating<E
     }
 
     @Override
-    public void addTo(final Traversal.Admin<?,?> toObject) {
+    public void addTo(final Traversal.Admin<?, ?> toObject) {
         this.parameters.set(TO, toObject);
         this.parameters.integrateTraversals(this);
     }
 
     @Override
-    public void addFrom(final Traversal.Admin<?,?> fromObject) {
+    public void addFrom(final Traversal.Admin<?, ?> fromObject) {
         this.parameters.set(FROM, fromObject);
         this.parameters.integrateTraversals(this);
     }
@@ -120,6 +120,12 @@ public final class AddEdgeStep<S> extends MapStep<S, Edge> implements Mutating<E
     }
 
     @Override
+    public void setTraversal(final Traversal.Admin<?, ?> parentTraversal) {
+        super.setTraversal(parentTraversal);
+        this.parameters.getTraversals().forEach(this::integrateChild);
+    }
+
+    @Override
     public AddEdgeStep<S> clone() {
         final AddEdgeStep<S> clone = (AddEdgeStep<S>) super.clone();
         clone.parameters = this.parameters.clone();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/49fb2579/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
index 58c3ef3..e7939dc 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStartStep.java
@@ -114,6 +114,12 @@ public final class AddVertexStartStep extends AbstractStep<Vertex, Vertex> imple
     }
 
     @Override
+    public void setTraversal(final Traversal.Admin<?, ?> parentTraversal) {
+        super.setTraversal(parentTraversal);
+        this.parameters.getTraversals().forEach(this::integrateChild);
+    }
+
+    @Override
     public AddVertexStartStep clone() {
         final AddVertexStartStep clone = (AddVertexStartStep) super.clone();
         clone.parameters = this.parameters.clone();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/49fb2579/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
index 1d5e8c0..57cd616 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddVertexStep.java
@@ -99,6 +99,12 @@ public final class AddVertexStep<S> extends MapStep<S, Vertex> implements Mutati
     }
 
     @Override
+    public void setTraversal(final Traversal.Admin<?, ?> parentTraversal) {
+        super.setTraversal(parentTraversal);
+        this.parameters.getTraversals().forEach(this::integrateChild);
+    }
+
+    @Override
     public AddVertexStep<S> clone() {
         final AddVertexStep<S> clone = (AddVertexStep<S>) super.clone();
         clone.parameters = this.parameters.clone();

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/49fb2579/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
index 3ccff52..44232f0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/sideEffect/AddPropertyStep.java
@@ -105,7 +105,7 @@ public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
             else if (element instanceof VertexProperty)
                 evt = new Event.VertexPropertyPropertyChangedEvent(DetachedFactory.detach((VertexProperty) element, true),
                         newProperty ?
-                                new DetachedProperty(key, null):
+                                new DetachedProperty(key, null) :
                                 DetachedFactory.detach(currentProperty), value);
             else
                 throw new IllegalStateException(String.format("The incoming object cannot be processed by change eventing in %s:  %s", AddPropertyStep.class.getName(), element));
@@ -139,6 +139,12 @@ public final class AddPropertyStep<S extends Element> extends SideEffectStep<S>
     }
 
     @Override
+    public void setTraversal(final Traversal.Admin<?, ?> parentTraversal) {
+        super.setTraversal(parentTraversal);
+        this.parameters.getTraversals().forEach(this::integrateChild);
+    }
+
+    @Override
     public String toString() {
         return StringFactory.stepString(this, this.parameters);
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/49fb2579/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyAddEdgeTest.groovy
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyAddEdgeTest.groovy b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyAddEdgeTest.groovy
index b3d5f49..13d3e0a 100644
--- a/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyAddEdgeTest.groovy
+++ b/gremlin-groovy-test/src/main/groovy/org/apache/tinkerpop/gremlin/process/traversal/step/map/GroovyAddEdgeTest.groovy
@@ -43,17 +43,17 @@ public abstract class GroovyAddEdgeTest {
 
         @Override
         public Traversal<Vertex, Edge> get_g_V_aggregateXxX_asXaX_selectXxX_unfold_addEXexistsWithX_toXaX_propertyXtime_nowX() {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.aggregate('x').as('a').select('x').unfold.addE('existsWith').to('a').property('time', 'now')");
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.aggregate('x').as('a').select('x').unfold.addE('existsWith').to('a').property('time', 'now')")
         }
 
         @Override
         public Traversal<Vertex, Edge> get_g_V_asXaX_outXcreatedX_inXcreatedX_whereXneqXaXX_asXbX_addEXcodeveloperX_fromXaX_toXbX_propertyXyear_2009X() {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.as('a').out('created').in('created').where(neq('a')).as('b').addE('codeveloper').from('a').to('b').property('year', 2009)");
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.as('a').out('created').in('created').where(neq('a')).as('b').addE('codeveloper').from('a').to('b').property('year', 2009)")
         }
 
         @Override
         public Traversal<Vertex, Edge> get_g_V_asXaX_inXcreatedX_addEXcreatedByX_fromXaX_propertyXyear_2009X_propertyXacl_publicX() {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.as('a').in('created').addE('createdBy').from('a').property('year', 2009).property('acl', 'public')");
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.as('a').in('created').addE('createdBy').from('a').property('year', 2009).property('acl', 'public')")
         }
 
         @Override
@@ -74,12 +74,17 @@ public abstract class GroovyAddEdgeTest {
 
         @Override
         public Traversal<Vertex, Edge> get_g_V_asXaX_outXcreatedX_inXcreatedX_whereXneqXaXX_asXbX_selectXa_bX_addInEXa_codeveloper_b_year_2009X() {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.as('a').out('created').in('created').where(neq('a')).as('b').select('a','b').addInE('a', 'codeveloper', 'b', 'year', 2009)");
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.as('a').out('created').in('created').where(neq('a')).as('b').select('a','b').addInE('a', 'codeveloper', 'b', 'year', 2009)")
         }
 
         @Override
         public Traversal<Vertex, Edge> get_g_V_asXaX_inXcreatedX_addInEXcreatedBy_a_year_2009_acl_publicX() {
-            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.as('a').in('created').addInE('createdBy', 'a', 'year', 2009, 'acl', 'public')");
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.V.as('a').in('created').addInE('createdBy', 'a', 'year', 2009, 'acl', 'public')")
+        }
+
+        @Override
+        public Traversal<Vertex, Edge> get_g_addV_asXfirstX_repeatXaddEXnextX_toXaddVX_inVX_timesX5X_addEXnextX_toXselectXfirstXX() {
+            new ScriptTraversal<>(g, "gremlin-groovy", "g.addV().as('first').repeat(addE('next').to(addV()).inV).times(5).addE('next').to(select('first'))")
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/49fb2579/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java
index 4a5ab72..d418944 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/AddEdgeTest.java
@@ -24,6 +24,7 @@ import org.apache.tinkerpop.gremlin.process.AbstractGremlinProcessTest;
 import org.apache.tinkerpop.gremlin.process.GremlinProcessRunner;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
+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;
@@ -33,7 +34,13 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.Arrays;
+
 import static org.apache.tinkerpop.gremlin.LoadGraphWith.GraphData.MODERN;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.bothE;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.inE;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.outE;
+import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.select;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
@@ -54,6 +61,8 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
 
     public abstract Traversal<Vertex, Edge> get_g_V_asXaX_inXcreatedX_addEXcreatedByX_fromXaX_propertyXyear_2009X_propertyXacl_publicX();
 
+    public abstract Traversal<Vertex, Edge> get_g_addV_asXfirstX_repeatXaddEXnextX_toXaddVX_inVX_timesX5X_addEXnextX_toXselectXfirstXX();
+
     ///////
 
     @Deprecated
@@ -302,6 +311,22 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
         assertEquals(6, IteratorUtils.count(g.V()));
     }
 
+    @Test
+    @FeatureRequirement(featureClass = Graph.Features.EdgeFeatures.class, feature = Graph.Features.EdgeFeatures.FEATURE_ADD_EDGES)
+    @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_ADD_VERTICES)
+    public void g_addV_asXfirstX_repeatXaddEXnextX_toXaddVX_inVX_timesX5X_addEXnextX_toXselectXfirstXX() {
+        final Traversal<Vertex, Edge> traversal = get_g_addV_asXfirstX_repeatXaddEXnextX_toXaddVX_inVX_timesX5X_addEXnextX_toXselectXfirstXX();
+        printTraversalForm(traversal);
+        assertEquals("next", traversal.next().label());
+        assertFalse(traversal.hasNext());
+        assertEquals(6L, g.V().count().next().longValue());
+        assertEquals(6L, g.E().count().next().longValue());
+        assertEquals(Arrays.asList(2L, 2L, 2L, 2L, 2L, 2L), g.V().map(bothE().count()).toList());
+        assertEquals(Arrays.asList(1L, 1L, 1L, 1L, 1L, 1L), g.V().map(inE().count()).toList());
+        assertEquals(Arrays.asList(1L, 1L, 1L, 1L, 1L, 1L), g.V().map(outE().count()).toList());
+    }
+
+
     public static class Traversals extends AddEdgeTest {
 
         @Override
@@ -355,5 +380,10 @@ public abstract class AddEdgeTest extends AbstractGremlinProcessTest {
         public Traversal<Vertex, Edge> get_g_V_asXaX_inXcreatedX_addInEXcreatedBy_a_year_2009_acl_publicX() {
             return g.V().as("a").in("created").addInE("createdBy", "a", "year", 2009, "acl", "public");
         }
+
+        @Override
+        public Traversal<Vertex, Edge> get_g_addV_asXfirstX_repeatXaddEXnextX_toXaddVX_inVX_timesX5X_addEXnextX_toXselectXfirstXX() {
+            return g.addV().as("first").repeat(__.addE("next").to(__.addV()).inV()).times(5).addE("next").to(select("first"));
+        }
     }
 }


[14/50] tinkerpop git commit: Merge branch 'tp31' into tp32

Posted by sp...@apache.org.
Merge branch 'tp31' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: bb9e081497cc96c851ea2a39aa9c44d4ef2d82ab
Parents: 77ef86b e621f54
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Mar 29 08:14:27 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Mar 29 08:14:27 2017 -0400

----------------------------------------------------------------------
 docs/src/dev/developer/contributing.asciidoc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[05/50] tinkerpop git commit: Merge branch 'pr-582' into tp32

Posted by sp...@apache.org.
Merge branch 'pr-582' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: d19bac08fe8d6630deea0588c87e4e4802ceb80b
Parents: 71d0d91 95a97c3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Sat Mar 25 06:04:14 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Sat Mar 25 06:04:14 2017 -0400

----------------------------------------------------------------------
 docs/src/dev/provider/index.asciidoc          | 4 ++--
 docs/src/reference/the-graphcomputer.asciidoc | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------



[34/50] tinkerpop git commit: TINKERPOP-1642 Fixed up some execution problems after rebase

Posted by sp...@apache.org.
TINKERPOP-1642 Fixed up some execution problems after rebase

The logic still doesn't seem quite right but at least the tests pass and a complete build is achieved. The issue is related to new stuff added in PathRetractionStrategy on TINKERPOP-1652.


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

Branch: refs/heads/TINKERPOP-1577
Commit: acc8d7399e291a8c9a517d223dea846c1c67d7c3
Parents: 97141da
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Mar 27 14:03:26 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:22:58 2017 -0400

----------------------------------------------------------------------
 .../strategy/optimization/PathRetractionStrategy.java       | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/acc8d739/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
index 443e4e3..10e2372 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
@@ -78,15 +78,20 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
         // do not apply this strategy if a VertexProgramStep is present with LABELED_PATH requirements
         if ((traversal.getParent() instanceof EmptyStep || traversal.getParent() instanceof VertexProgramStep) &&
                 TraversalHelper.anyStepRecursively(step -> step instanceof LambdaHolder ||
-                                                   step.getRequirements().contains(TraverserRequirement.PATH) ||
-                                                   (step instanceof VertexProgramStep && step.getRequirements().contains(TraverserRequirement.LABELED_PATH)),traversal))
+                                                   step.getRequirements().contains(TraverserRequirement.PATH),traversal)) {
             TraversalHelper.applyTraversalRecursively(t -> t.getEndStep().addLabel(MARKER), traversal);
+        }
 
         if (traversal.getEndStep().getLabels().contains(MARKER)) {
             traversal.getEndStep().removeLabel(MARKER);
             return;
         }
 
+        if (TraversalHelper.anyStepRecursively(step -> step instanceof VertexProgramStep && step.getRequirements().contains(TraverserRequirement.LABELED_PATH),
+                TraversalHelper.getRootTraversal(traversal))) {
+            return;
+        }
+
         final boolean onGraphComputer = TraversalHelper.onGraphComputer(traversal);
         final Set<String> foundLabels = new HashSet<>();
         final Set<String> keepLabels = new HashSet<>();


[06/50] tinkerpop git commit: Merge branch 'TINKERPOP-1654' into TINKERPOP-1654-tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1654' into TINKERPOP-1654-tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: 7db459b0b839afe3a5a746de2878c31db4eceb96
Parents: d19bac0 2aa550e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Mar 27 07:00:30 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Mar 27 07:00:30 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc     | 1 +
 gremlin-shaded/pom.xml | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7db459b0/gremlin-shaded/pom.xml
----------------------------------------------------------------------


[41/50] tinkerpop git commit: fixed a Parameters.clone() bug introduced with the Traversal caching work in this ticket. This fixes the @twilmes AddEdgeTest case.

Posted by sp...@apache.org.
fixed a Parameters.clone() bug introduced with the Traversal caching work in this ticket. This fixes the @twilmes AddEdgeTest case.


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

Branch: refs/heads/TINKERPOP-1577
Commit: af5f3364e12aadead8025f3724559d282105bfaa
Parents: 8e90349
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Mar 29 10:07:55 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Mar 29 10:07:55 2017 -0600

----------------------------------------------------------------------
 .../process/traversal/step/util/Parameters.java | 24 ++++++++++++++------
 1 file changed, 17 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/af5f3364/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index 0583ed2..5cb6001 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -58,7 +58,7 @@ public final class Parameters implements Cloneable, Serializable {
      * {@link #set(TraversalParent, Object...)} because when the parameter map is large the cost of iterating it repeatedly on the
      * high number of calls to {@link #getTraversals()} is great.
      */
-    private List<Traversal.Admin<?,?>> traversals = new ArrayList<>();
+    private List<Traversal.Admin<?, ?>> traversals = new ArrayList<>();
 
     /**
      * Checks for existence of key in parameter set.
@@ -199,7 +199,7 @@ public final class Parameters implements Cloneable, Serializable {
      */
     public <S, E> List<Traversal.Admin<S, E>> getTraversals() {
         // stupid generics - just need to return "traversals"
-        return (List<Traversal.Admin<S, E>>) (Object) traversals;
+        return (List<Traversal.Admin<S, E>>) (Object) this.traversals;
     }
 
     /**
@@ -213,14 +213,24 @@ public final class Parameters implements Cloneable, Serializable {
         try {
             final Parameters clone = (Parameters) super.clone();
             clone.parameters = new HashMap<>();
+            clone.traversals = new ArrayList<>();
             for (final Map.Entry<Object, List<Object>> entry : this.parameters.entrySet()) {
                 final List<Object> values = new ArrayList<>();
                 for (final Object value : entry.getValue()) {
-                    values.add(value instanceof Traversal.Admin ? ((Traversal.Admin) value).clone() : value);
+                    if (value instanceof Traversal.Admin) {
+                        final Traversal.Admin<?, ?> traversalClone = ((Traversal.Admin) value).clone();
+                        clone.traversals.add(traversalClone);
+                        values.add(traversalClone);
+                    } else
+                        values.add(value);
                 }
-                clone.parameters.put(entry.getKey() instanceof Traversal.Admin ? ((Traversal.Admin) entry.getKey()).clone() : entry.getKey(), values);
+                if (entry.getKey() instanceof Traversal.Admin) {
+                    final Traversal.Admin<?, ?> traversalClone = ((Traversal.Admin) entry.getKey()).clone();
+                    clone.traversals.add(traversalClone);
+                    clone.parameters.put(traversalClone, values);
+                } else
+                    clone.parameters.put(entry.getKey(), values);
             }
-
             clone.referencedLabels = new HashSet<>(this.referencedLabels);
             return clone;
         } catch (final CloneNotSupportedException e) {
@@ -253,11 +263,11 @@ public final class Parameters implements Cloneable, Serializable {
     }
 
     private void addTraversal(final Traversal.Admin t) {
-        traversals.add(t);
+        this.traversals.add(t);
         for (final Object ss : t.getSteps()) {
             if (ss instanceof Scoping) {
                 for (String label : ((Scoping) ss).getScopeKeys()) {
-                    referencedLabels.add(label);
+                    this.referencedLabels.add(label);
                 }
             }
         }


[13/50] tinkerpop git commit: fixed broken anchor

Posted by sp...@apache.org.
fixed broken anchor


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

Branch: refs/heads/TINKERPOP-1577
Commit: e621f54560f882e70f30391cf05510b8a9bc135a
Parents: 7def039
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Mar 29 08:12:27 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Mar 29 08:12:27 2017 -0400

----------------------------------------------------------------------
 docs/src/dev/developer/contributing.asciidoc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e621f545/docs/src/dev/developer/contributing.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/contributing.asciidoc b/docs/src/dev/developer/contributing.asciidoc
index 63c40b7..847a353 100644
--- a/docs/src/dev/developer/contributing.asciidoc
+++ b/docs/src/dev/developer/contributing.asciidoc
@@ -188,14 +188,14 @@ in doubt, please ask on dev@tinkerpop.apache.org.
 `mvn clean install -DskipIntegrationTests=false -DincludeNeo4j`. Note that Hadoop must be running for the integration
 tests to execute.
 .. Docker can help simplify building and testing: `docker/build.sh -t -i -n`
-.. Please see the <<building-test,Building and Testing>> section for more building and testing options.
+.. Please see the <<building-testing,Building and Testing>> section for more building and testing options.
 . Consider whether documentation or tests need to be added or updated as part of the change, and add them as needed.
 .. Nearly all changes should include a modification to the `CHANGELOG.asciidoc` file - one more entries to
 help summarize the change.
 .. Some changes will require updates to the "upgrade documentation" - usually reserved for major new features and
 breaking changes.
 .. Docker can help simplify documentation generation: `docker/build.sh -d`
-.. Please see the <<building-test,Building and Testing>> section for more documentation generation options.
+.. Please see the <<building-testing,Building and Testing>> section for more documentation generation options.
 . Open the link:https://help.github.com/articles/using-pull-requests/[pull request] against the appropriate branch
 on the Apache TinkerPop repository.
 .. Target the pull request at the appropriate branch in TinkerPop's repository


[50/50] tinkerpop git commit: TINKERPOP-1577 Added support for building gremlin-python with python 2.x and 3.x

Posted by sp...@apache.org.
TINKERPOP-1577 Added support for building gremlin-python with python 2.x and 3.x


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

Branch: refs/heads/TINKERPOP-1577
Commit: a007403bde681da9534acc01d13cdc060c5f7e44
Parents: 95d3efc
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Mar 2 07:01:47 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu Apr 6 07:45:33 2017 -0400

----------------------------------------------------------------------
 gremlin-python/pom.xml | 58 +++++++++++++++++++++++++++++++++++++++------
 1 file changed, 51 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a007403b/gremlin-python/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-python/pom.xml b/gremlin-python/pom.xml
index 2b4a80e..4c36d2a 100644
--- a/gremlin-python/pom.xml
+++ b/gremlin-python/pom.xml
@@ -359,17 +359,28 @@
                                              specifically). note that the commands to install wheel are largely for
                                              safety in case someone is using an older version of virtualenv (which
                                              doesn't install wheel by default) -->
-                                        <copy todir="${project.build.directory}/python">
+                                        <copy todir="${project.build.directory}/python3">
+                                            <fileset dir="src/main/jython"/>
+                                        </copy>
+                                        <copy todir="${project.build.directory}/python2">
                                             <fileset dir="src/main/jython"/>
                                         </copy>
                                         <copy todir="${project.build.directory}/python-packaged">
                                             <fileset dir="src/main/jython"/>
                                         </copy>
-                                        <exec dir="${project.build.directory}/python" executable="virtualenv"
+                                        <exec dir="${project.build.directory}/python2" executable="virtualenv"
+                                              failonerror="true">
+                                            <arg line="--python=python env"/>
+                                        </exec>
+                                        <exec dir="${project.build.directory}/python2" executable="env/bin/pip"
+                                              failonerror="true">
+                                            <arg line="install wheel"/>
+                                        </exec>
+                                        <exec dir="${project.build.directory}/python3" executable="virtualenv"
                                               failonerror="true">
                                             <arg line="--python=python env"/>
                                         </exec>
-                                        <exec dir="${project.build.directory}/python" executable="env/bin/pip"
+                                        <exec dir="${project.build.directory}/python3" executable="env/bin/pip"
                                               failonerror="true">
                                             <arg line="install wheel"/>
                                         </exec>
@@ -388,14 +399,30 @@
                                 </configuration>
                             </execution>
                             <execution>
-                                <id>native-python-build</id>
+                                <id>native-python2-build</id>
                                 <phase>compile</phase>
                                 <goals>
                                     <goal>run</goal>
                                 </goals>
                                 <configuration>
                                     <target>
-                                        <exec executable="env/bin/python" dir="${project.build.directory}/python"
+                                        <exec executable="env/bin/python" dir="${project.build.directory}/python2"
+                                              failonerror="true">
+                                            <env key="PYTHONPATH" value=""/>
+                                            <arg line="setup.py build --build-lib ${project.build.outputDirectory}/Lib"/>
+                                        </exec>
+                                    </target>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>native-python3-build</id>
+                                <phase>compile</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                                <configuration>
+                                    <target>
+                                        <exec executable="env/bin/python" dir="${project.build.directory}/python3"
                                               failonerror="true">
                                             <env key="PYTHONPATH" value=""/>
                                             <arg line="setup.py build --build-lib ${project.build.outputDirectory}/Lib"/>
@@ -433,7 +460,24 @@
                             test phase doesn't have a pre/post event like integration-test does.
                             -->
                             <execution>
-                                <id>native-python-test</id>
+                                <id>native-python2-test</id>
+                                <phase>integration-test</phase>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                                <configuration>
+                                    <skip>${skipTests}</skip>
+                                    <target>
+                                        <exec executable="env/bin/python" dir="${project.build.directory}/python2"
+                                              failonerror="true">
+                                            <env key="PYTHONPATH" value=""/>
+                                            <arg line="setup.py test"/>
+                                        </exec>
+                                    </target>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>native-python3-test</id>
                                 <phase>integration-test</phase>
                                 <goals>
                                     <goal>run</goal>
@@ -441,7 +485,7 @@
                                 <configuration>
                                     <skip>${skipTests}</skip>
                                     <target>
-                                        <exec executable="env/bin/python" dir="${project.build.directory}/python"
+                                        <exec executable="env/bin/python" dir="${project.build.directory}/python3"
                                               failonerror="true">
                                             <env key="PYTHONPATH" value=""/>
                                             <arg line="setup.py test"/>


[27/50] tinkerpop git commit: TINKERPOP-1642 Minor refactoring to get rid of duplicate code

Posted by sp...@apache.org.
TINKERPOP-1642 Minor refactoring to get rid of duplicate code


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

Branch: refs/heads/TINKERPOP-1577
Commit: 88a3f60ce66ce4ff55de8ecefabfc4b22f277f62
Parents: f693cb7
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 10 13:27:01 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:20:44 2017 -0400

----------------------------------------------------------------------
 .../process/traversal/util/TraversalHelper.java  | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/88a3f60c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
index 5163824..95862d0 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
@@ -417,7 +417,7 @@ public final class TraversalHelper {
      * Determine if any step in {@link Traversal} or its children match the step given the provided {@link Predicate}.
      *
      * @param predicate the match function
-     * @param traversal th traversal to perform the action on
+     * @param traversal the traversal to perform the action on
      * @return {@code true} if there is a match and {@code false} otherwise
      */
     public static boolean anyStepRecursively(final Predicate<Step> predicate, final Traversal.Admin<?, ?> traversal) {
@@ -425,18 +425,19 @@ public final class TraversalHelper {
             if (predicate.test(step)) {
                 return true;
             }
-            if (step instanceof TraversalParent) {
-                for (final Traversal.Admin<?, ?> localChild : ((TraversalParent) step).getLocalChildren()) {
-                    if (anyStepRecursively(predicate, localChild)) return true;
-                }
-                for (final Traversal.Admin<?, ?> globalChild : ((TraversalParent) step).getGlobalChildren()) {
-                    if (anyStepRecursively(predicate, globalChild)) return true;
-                }
-            }
+
+            if (step instanceof TraversalParent) anyStepRecursively(predicate, ((TraversalParent) step));
         }
         return false;
     }
 
+    /**
+     * Determine if any child step of a {@link TraversalParent} match the step given the provided {@link Predicate}.
+     *
+     * @param predicate the match function
+     * @param step the step to perform the action on
+     * @return {@code true} if there is a match and {@code false} otherwise
+     */
     public static boolean anyStepRecursively(final Predicate<Step> predicate, final TraversalParent step) {
         for (final Traversal.Admin<?, ?> localChild : step.getLocalChildren()) {
             if (anyStepRecursively(predicate, localChild)) return true;


[42/50] tinkerpop git commit: Found an ancient bug in B_LP_O_S_SE_SL_Traverser that only reared its ugly head with how LABELED_PATH requirements are now computed. Bug fixed and optimized LABELED_PATH requirment analysis.

Posted by sp...@apache.org.
Found an ancient bug in B_LP_O_S_SE_SL_Traverser that only reared its ugly head with how LABELED_PATH requirements are now computed. Bug fixed and optimized LABELED_PATH requirment analysis.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 8ac09c8866df1bbbe23576b07bfda6820ba60c07
Parents: af5f336
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Wed Mar 29 11:41:31 2017 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Wed Mar 29 11:41:31 2017 -0600

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                          | 1 +
 .../traversal/traverser/B_LP_O_S_SE_SL_Traverser.java       | 2 +-
 .../gremlin/process/traversal/util/DefaultTraversal.java    | 2 +-
 .../gremlin/process/traversal/util/TraversalHelper.java     | 9 ++++++---
 4 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ac09c88/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 5731497..78055af 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Fixed a `NullPointerException` bug in `B_LP_O_S_SE_SL_Traverser`.
 * `PathRetractionStrategy` now uses the marker-model to reduce recursive lookups of invalidating steps.
 * `ProfileStrategy` now uses the marker-model to reduce recursive lookups of `ProfileSideEffectStep`.
 * `Mutating` steps now implement `Scoping` interface.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ac09c88/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
index fc16366..74a049c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/traverser/B_LP_O_S_SE_SL_Traverser.java
@@ -121,7 +121,7 @@ public class B_LP_O_S_SE_SL_Traverser<T> extends B_O_S_SE_SL_Traverser<T> {
                 && ((B_LP_O_S_SE_SL_Traverser) object).t.equals(this.t)
                 && ((B_LP_O_S_SE_SL_Traverser) object).future.equals(this.future)
                 && ((B_LP_O_S_SE_SL_Traverser) object).loops == this.loops
-                && (null == this.sack || null != this.sideEffects.getSackMerger())
+                && (null == this.sack || (null != this.sideEffects && null != this.sideEffects.getSackMerger())) // hmmm... serialization in OLAP destroys the transient sideEffects
                 && ((B_LP_O_S_SE_SL_Traverser) object).path.popEquals(Pop.last, this.path); // this should be Pop.all?
     }
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ac09c88/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
index c0e54db..c8f4b24 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/DefaultTraversal.java
@@ -147,7 +147,7 @@ public class DefaultTraversal<S, E> implements Traversal.Admin<S, E> {
             for (final Step<?, ?> step : this.getSteps()) {
                 this.requirements.addAll(step.getRequirements());
             }
-            if (TraversalHelper.hasLabels(this))
+            if (!this.requirements.contains(TraverserRequirement.LABELED_PATH) && TraversalHelper.hasLabels(this))
                 this.requirements.add(TraverserRequirement.LABELED_PATH);
             if (!this.getSideEffects().keys().isEmpty())
                 this.requirements.add(TraverserRequirement.SIDE_EFFECTS);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/8ac09c88/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
index 95862d0..de4e36f 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/util/TraversalHelper.java
@@ -45,6 +45,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.BulkSet;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer;
+import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
@@ -435,7 +436,7 @@ public final class TraversalHelper {
      * Determine if any child step of a {@link TraversalParent} match the step given the provided {@link Predicate}.
      *
      * @param predicate the match function
-     * @param step the step to perform the action on
+     * @param step      the step to perform the action on
      * @return {@code true} if there is a match and {@code false} otherwise
      */
     public static boolean anyStepRecursively(final Predicate<Step> predicate, final TraversalParent step) {
@@ -552,8 +553,10 @@ public final class TraversalHelper {
 
     public static boolean hasLabels(final Traversal.Admin<?, ?> traversal) {
         for (final Step<?, ?> step : traversal.getSteps()) {
-            if (!step.getLabels().isEmpty())
-                return true;
+            for (final String label : step.getLabels()) {
+                if (!Graph.Hidden.isHidden(label))
+                    return true;
+            }
             if (step instanceof TraversalParent) {
                 for (final Traversal.Admin<?, ?> local : ((TraversalParent) step).getLocalChildren()) {
                     if (TraversalHelper.hasLabels(local))


[32/50] tinkerpop git commit: Fixed VertexProgram test that verifies proper TraversalRequirements.

Posted by sp...@apache.org.
Fixed VertexProgram test that verifies proper TraversalRequirements.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 12c7f01332d1bcb07ab1dda41d4c045403975a26
Parents: 1f99a51
Author: Daniel Kuppitz <da...@hotmail.com>
Authored: Mon Mar 13 16:01:12 2017 +0100
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:21:06 2017 -0400

----------------------------------------------------------------------
 .../process/computer/GraphComputerTest.java     | 199 +++++++++----------
 1 file changed, 92 insertions(+), 107 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/12c7f013/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java
index 40b03fe..5c66673 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphComputerTest.java
@@ -36,6 +36,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.Path;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyPath;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.verification.VerificationException;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.traverser.util.TraverserSet;
@@ -47,6 +48,7 @@ import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
 import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
+import org.javatuples.Pair;
 import org.junit.Ignore;
 import org.junit.Test;
 
@@ -58,6 +60,7 @@ import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -108,9 +111,6 @@ import static org.junit.Assume.assumeNoException;
 @ExceptionCoverage(exceptionClass = Graph.Exceptions.class, methods = {
         "graphDoesNotSupportProvidedGraphComputer"
 })
-@ExceptionCoverage(exceptionClass = Path.Exceptions.class, methods = {
-        "shouldFailWithImproperTraverserRequirements"
-})
 @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
 public class GraphComputerTest extends AbstractGremlinProcessTest {
 
@@ -2351,30 +2351,26 @@ public class GraphComputerTest extends AbstractGremlinProcessTest {
     @LoadGraphWith(MODERN)
     public void shouldSucceedWithProperTraverserRequirements() throws Exception {
 
-        final AtomicInteger counter = new AtomicInteger(0);
-        final Map<String, Object> idsByName = new HashMap<>();
-        final VertexProgramQ vp = VertexProgramQ.build().from("a").property("coworkers").create();
-
-        g.V().hasLabel("person").filter(outE("created")).valueMap(true, "name").forEachRemaining((Map map) ->
-                idsByName.put((String) ((List) map.get("name")).get(0), map.get(id)));
+        final VertexProgramQ vp = VertexProgramQ.build().property("pl").create();
+        final Map<String, List<Integer>> expected = new HashMap<>();
+        expected.put("vadas", Collections.singletonList(2));
+        expected.put("lop", Arrays.asList(2, 2, 2, 3));
+        expected.put("josh", Collections.singletonList(2));
+        expected.put("ripple", Arrays.asList(2, 3));
 
         try {
-            g.V().as("a").out("created").in("created").program(vp).dedup()
-                    .valueMap("name", "coworkers").forEachRemaining((Map<String, Object> map) -> {
+            g.V().repeat(__.out()).emit().program(vp).dedup()
+                    .valueMap("name", "pl").forEachRemaining((Map<String, Object> map) -> {
 
                 final String name = (String) ((List) map.get("name")).get(0);
-                final Map<Object, Long> coworkers = (Map<Object, Long>) ((List) map.get("coworkers")).get(0);
-                assertTrue(idsByName.containsKey(name));
-                assertEquals(2, coworkers.size());
-                idsByName.keySet().stream().filter(cn -> !cn.equals(name)).forEach(cn -> {
-                    final Object cid = idsByName.get(cn);
-                    assertTrue(coworkers.containsKey(cid));
-                    assertEquals(1L, coworkers.get(cid).longValue());
-                });
-                counter.incrementAndGet();
+                final List<Integer> pathLengths = (List<Integer>) map.get("pl");
+                assertTrue(expected.containsKey(name));
+                final List<Integer> expectedPathLengths = expected.remove(name);
+                assertTrue(expectedPathLengths.containsAll(pathLengths));
+                assertTrue(pathLengths.containsAll(expectedPathLengths));
             });
 
-            assertEquals(3, counter.intValue());
+            assertTrue(expected.isEmpty());
         } catch (VerificationException ex) {
             assumeNoException(ex);
         }
@@ -2382,29 +2378,11 @@ public class GraphComputerTest extends AbstractGremlinProcessTest {
 
     @Test
     @LoadGraphWith(MODERN)
-    @Ignore("Labeled paths now trigger LABELED_PATH requirements -- @dkuppitz")
     public void shouldFailWithImproperTraverserRequirements() throws Exception {
-
-        final AtomicInteger counter = new AtomicInteger(0);
-        final Map<String, Object> idsByName = new HashMap<>();
-        final VertexProgramQ vp = VertexProgramQ.build().from("a").property("coworkers").
-                useTraverserRequirements(false).create();
-
-        g.V().hasLabel("person").filter(outE("created")).valueMap(true, "name").forEachRemaining((Map map) ->
-                idsByName.put((String) ((List) map.get("name")).get(0), map.get(id)));
-
+        final VertexProgramQ vp = VertexProgramQ.build().property("pl").useTraverserRequirements(false).create();
         try {
-            g.V().as("a").out("created").in("created").program(vp).dedup()
-                    .valueMap("name", "coworkers").forEachRemaining((Map<String, Object> map) -> {
-
-                final String name = (String) ((List) map.get("name")).get(0);
-                final Map coworkers = (Map) ((List) map.get("coworkers")).get(0);
-                assertTrue(idsByName.containsKey(name));
-                assertTrue(coworkers.isEmpty());
-                counter.incrementAndGet();
-            });
-
-            assertEquals(3, counter.intValue());
+            g.V().repeat(__.out()).emit().program(vp).dedup()
+                    .forEachRemaining((Vertex v) -> assertFalse(v.property("pl").isPresent()));
         } catch (VerificationException ex) {
             assumeNoException(ex);
         }
@@ -2413,13 +2391,16 @@ public class GraphComputerTest extends AbstractGremlinProcessTest {
     private static class VertexProgramQ implements VertexProgram<Object> {
 
         private static final String VERTEX_PROGRAM_Q_CFG_PREFIX = "gremlin.vertexProgramQ";
-        private static final String MAP_KEY_CFG_KEY = VERTEX_PROGRAM_Q_CFG_PREFIX + ".source";
         private static final String PROPERTY_CFG_KEY = VERTEX_PROGRAM_Q_CFG_PREFIX + ".property";
+        private static final String LENGTHS_KEY = VERTEX_PROGRAM_Q_CFG_PREFIX + ".lengths";
         private static final String USE_TRAVERSER_REQUIREMENTS_CFG_KEY = VERTEX_PROGRAM_Q_CFG_PREFIX + ".useTraverserRequirements";
 
+        private final static Set<MemoryComputeKey> MEMORY_COMPUTE_KEYS = Collections.singleton(
+                MemoryComputeKey.of(LENGTHS_KEY, Operator.addAll, true, true)
+        );
+
         private final Set<VertexComputeKey> elementComputeKeys;
         private Configuration configuration;
-        private String sourceKey;
         private String propertyKey;
         private Set<TraverserRequirement> traverserRequirements;
 
@@ -2427,6 +2408,43 @@ public class GraphComputerTest extends AbstractGremlinProcessTest {
             elementComputeKeys = new HashSet<>();
         }
 
+        public static Builder build() {
+            return new Builder();
+        }
+
+        static class Builder extends AbstractVertexProgramBuilder<Builder> {
+
+            private Builder() {
+                super(VertexProgramQ.class);
+            }
+
+            @SuppressWarnings("unchecked")
+            @Override
+            public VertexProgramQ create(final Graph graph) {
+                if (graph != null) {
+                    ConfigurationUtils.append(graph.configuration().subset(VERTEX_PROGRAM_Q_CFG_PREFIX), configuration);
+                }
+                return (VertexProgramQ) VertexProgram.createVertexProgram(graph, configuration);
+            }
+
+            public VertexProgramQ create() {
+                return create(null);
+            }
+
+            public Builder property(final String name) {
+                configuration.setProperty(PROPERTY_CFG_KEY, name);
+                return this;
+            }
+
+            /**
+             * This is only configurable for the purpose of testing. In a real-world VP this would be a bad pattern.
+             */
+            public Builder useTraverserRequirements(final boolean value) {
+                configuration.setProperty(USE_TRAVERSER_REQUIREMENTS_CFG_KEY, value);
+                return this;
+            }
+        }
+
         @Override
         public void storeState(final Configuration config) {
             VertexProgram.super.storeState(config);
@@ -2435,16 +2453,16 @@ public class GraphComputerTest extends AbstractGremlinProcessTest {
             }
         }
 
+
         @Override
         public void loadState(final Graph graph, final Configuration config) {
             configuration = new BaseConfiguration();
             if (config != null) {
                 ConfigurationUtils.copy(config, configuration);
             }
-            sourceKey = configuration.getString(MAP_KEY_CFG_KEY);
             propertyKey = configuration.getString(PROPERTY_CFG_KEY);
             traverserRequirements = configuration.getBoolean(USE_TRAVERSER_REQUIREMENTS_CFG_KEY, true)
-                    ? Collections.singleton(TraverserRequirement.LABELED_PATH) : Collections.emptySet();
+                    ? Collections.singleton(TraverserRequirement.PATH) : Collections.emptySet();
             elementComputeKeys.add(VertexComputeKey.of(propertyKey, false));
         }
 
@@ -2454,34 +2472,36 @@ public class GraphComputerTest extends AbstractGremlinProcessTest {
 
         @Override
         public void execute(final Vertex vertex, final Messenger messenger, final Memory memory) {
-            final Property<TraverserSet> haltedTraversers = vertex.property(TraversalVertexProgram.HALTED_TRAVERSERS);
-            if (!haltedTraversers.isPresent()) return;
-            final Iterator iterator = haltedTraversers.value().iterator();
-            if (iterator.hasNext()) {
-                List<Map.Entry<Object, Long>> list = new ArrayList<>();
-                while (iterator.hasNext()) {
-                    final Traverser t = (Traverser) iterator.next();
-                    try {
-                        final Vertex source = (Vertex) t.path(sourceKey);
-                        if (!source.id().equals(vertex.id())) {
-                            final Map.Entry<Object, Long> entry = new AbstractMap.SimpleEntry<>(source.id(), t.bulk());
-                            list.add(entry);
+            if (memory.isInitialIteration()) {
+                final Property<TraverserSet> haltedTraversers = vertex.property(TraversalVertexProgram.HALTED_TRAVERSERS);
+                if (!haltedTraversers.isPresent()) return;
+                final Iterator iterator = haltedTraversers.value().iterator();
+                if (iterator.hasNext()) {
+                    while (iterator.hasNext()) {
+                        final Traverser t = (Traverser) iterator.next();
+                        if (!(t.path() instanceof EmptyPath)) {
+                            final int pathLength = t.path().size();
+                            final List<Pair<Vertex, Integer>> memoryValue = new LinkedList<>();
+                            memoryValue.add(Pair.with(vertex, pathLength));
+                            memory.add(LENGTHS_KEY, memoryValue);
+                        }
+                    }
+                }
+            } else {
+                if (memory.exists(LENGTHS_KEY)) {
+                    final List<Pair<Vertex, Integer>> lengths = memory.get(LENGTHS_KEY);
+                    for (final Pair<Vertex, Integer> pair : lengths) {
+                        if (pair.getValue0().equals(vertex)) {
+                            vertex.property(VertexProperty.Cardinality.list, propertyKey, pair.getValue1());
                         }
-                        assertFalse(traverserRequirements.isEmpty());
-                    } catch (Exception ex) {
-                        assertTrue(traverserRequirements.isEmpty());
-                        validateException(Path.Exceptions.stepWithProvidedLabelDoesNotExist(sourceKey), ex);
                     }
                 }
-                final Map<Object, Number> map = new HashMap<>(list.size(), 1f);
-                for (Map.Entry<Object, Long> entry : list) map.put(entry.getKey(), entry.getValue());
-                vertex.property(propertyKey, map);
             }
         }
 
         @Override
         public boolean terminate(final Memory memory) {
-            return memory.isInitialIteration();
+            return !memory.isInitialIteration();
         }
 
         @Override
@@ -2494,6 +2514,11 @@ public class GraphComputerTest extends AbstractGremlinProcessTest {
             return elementComputeKeys;
         }
 
+        @Override
+        public Set<MemoryComputeKey> getMemoryComputeKeys() {
+            return MEMORY_COMPUTE_KEYS;
+        }
+
         @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException", "CloneDoesntCallSuperClone"})
         @Override
         public VertexProgram<Object> clone() {
@@ -2525,46 +2550,6 @@ public class GraphComputerTest extends AbstractGremlinProcessTest {
             };
         }
 
-        public static Builder build() {
-            return new Builder();
-        }
-
-        static class Builder extends AbstractVertexProgramBuilder<Builder> {
-
-            private Builder() {
-                super(VertexProgramQ.class);
-            }
-
-            @SuppressWarnings("unchecked")
-            @Override
-            public VertexProgramQ create(final Graph graph) {
-                if (graph != null) {
-                    ConfigurationUtils.append(graph.configuration().subset(VERTEX_PROGRAM_Q_CFG_PREFIX), configuration);
-                }
-                return (VertexProgramQ) VertexProgram.createVertexProgram(graph, configuration);
-            }
-
-            public VertexProgramQ create() {
-                return create(null);
-            }
-
-            public Builder from(final String label) {
-                configuration.setProperty(MAP_KEY_CFG_KEY, label);
-                return this;
-            }
-
-            public Builder property(final String name) {
-                configuration.setProperty(PROPERTY_CFG_KEY, name);
-                return this;
-            }
 
-            /**
-             * This is only configurable for the purpose of testing. In a real-world VP this would be a bad pattern.
-             */
-            public Builder useTraverserRequirements(final boolean value) {
-                configuration.setProperty(USE_TRAVERSER_REQUIREMENTS_CFG_KEY, value);
-                return this;
-            }
-        }
     }
-}
\ No newline at end of file
+}


[11/50] tinkerpop git commit: TINKERPOP-1654: use deserializatinoContext in `typeFromId()`.

Posted by sp...@apache.org.
TINKERPOP-1654: use deserializatinoContext in `typeFromId()`.


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

Branch: refs/heads/TINKERPOP-1577
Commit: ad268ef4f784d8de0be7650e93e6ab750e3010d5
Parents: 380646c
Author: Kevin Gallardo <ke...@datastax.com>
Authored: Tue Mar 28 10:10:14 2017 -0400
Committer: Kevin Gallardo <ke...@datastax.com>
Committed: Tue Mar 28 10:10:14 2017 -0400

----------------------------------------------------------------------
 .../gremlin/structure/io/graphson/GraphSONTypeDeserializer.java    | 2 +-
 .../gremlin/structure/io/graphson/GraphSONTypeIdResolver.java      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ad268ef4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java
index 6734506..ceddcc2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java
@@ -154,7 +154,7 @@ public class GraphSONTypeDeserializer extends TypeDeserializerBase {
 
                 if (typeName != null && valueDetected) {
                     // Type has been detected pattern detected.
-                    final JavaType typeFromId = idRes.typeFromId(null, typeName);
+                    final JavaType typeFromId = idRes.typeFromId(deserializationContext, typeName);
 
                     if (!baseType.isJavaLangObject() && !baseType.equals(typeFromId)) {
                         throw new InstantiationException(

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ad268ef4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java
index dda06e2..db2ef5c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java
@@ -97,7 +97,7 @@ public class GraphSONTypeIdResolver implements TypeIdResolver {
         return getIdToType().containsKey(s)
                 ? getIdToType().get(s)
                 // TODO: shouldn't we fail instead, if the type is not found? Or log something?
-                : TypeFactory.defaultInstance().constructType(String.class);
+                : databindContext.constructType(String.class);
     }
 
     @Override


[26/50] tinkerpop git commit: TINKERPOP-1642 Cached the Traversal list in Parameters

Posted by sp...@apache.org.
TINKERPOP-1642 Cached the Traversal list in Parameters

This leads to a pretty good boost in performance from the prior commit especially for long chained mutating traversals that add vertices and edges as there is a 3X improvement in those cases.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 3dea5bdd9b8ce2bf6d28882e38e07d93162bcb11
Parents: da02d96
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 3 06:47:56 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:20:43 2017 -0400

----------------------------------------------------------------------
 .../process/traversal/step/util/Parameters.java | 59 ++++++++++++--------
 .../traversal/step/util/ParametersTest.java     | 50 +++++++++++++++++
 2 files changed, 87 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dea5bdd/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index 67cb2f9..3f0cb7c 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -26,6 +26,7 @@ import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalUtil;
 import org.apache.tinkerpop.gremlin.structure.Element;
 import org.apache.tinkerpop.gremlin.structure.T;
+import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils;
 
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -49,9 +50,11 @@ public final class Parameters implements Cloneable, Serializable {
     private Map<Object, List<Object>> parameters = new HashMap<>();
 
     /**
-     * Determines if there are traversals present in the parameters {@code Map}.
+     * A cached list of traversals that server as parameter values. The list is cached on calls to
+     * {@link #set(Object...)} because when the parameter map is large the cost of iterating it repeatedly on the
+     * high number of calls to {@link #getTraversals()} and {@link #integrateTraversals(TraversalParent)} is great.
      */
-    private boolean traversalsPresent = false;
+    private List<Traversal.Admin> traversals = new ArrayList<>();
 
     /**
      * Checks for existence of key in parameter set.
@@ -73,6 +76,10 @@ public final class Parameters implements Cloneable, Serializable {
         this.parameters.put(newKey, this.parameters.remove(oldKey));
     }
 
+    /**
+     * Gets the list of values for a key, while resolving the values of any parameters that are {@link Traversal}
+     * objects.
+     */
     public <S, E> List<E> get(final Traverser.Admin<S> traverser, final Object key, final Supplier<E> defaultValue) {
         final List<E> values = (List<E>) this.parameters.get(key);
         if (null == values) return Collections.singletonList(defaultValue.get());
@@ -102,9 +109,28 @@ public final class Parameters implements Cloneable, Serializable {
      * @return the value of the removed key
      */
     public Object remove(final Object key) {
-        return parameters.remove(key);
+        final List<Object> o = parameters.remove(key);
+
+        // once a key is removed, it's possible that the traversal cache will need to be regenerated
+        if (IteratorUtils.anyMatch(o.iterator(), p -> p instanceof Traversal.Admin)) {
+            traversals.clear();
+            traversals = new ArrayList<>();
+            for (final List<Object> list : this.parameters.values()) {
+                for (final Object object : list) {
+                    if (object instanceof Traversal.Admin) {
+                        traversals.add((Traversal.Admin) object);
+                    }
+                }
+            }
+        }
+
+        return o;
     }
 
+    /**
+     * Gets the array of keys/values of the parameters while resolving parameter values that contain
+     * {@link Traversal} instances
+     */
     public <S> Object[] getKeyValues(final Traverser.Admin<S> traverser, final Object... exceptKeys) {
         if (this.parameters.size() == 0) return EMPTY_ARRAY;
         final List<Object> keyValues = new ArrayList<>();
@@ -143,10 +169,10 @@ public final class Parameters implements Cloneable, Serializable {
         Parameters.legalPropertyKeyValueArray(keyValues);
         for (int i = 0; i < keyValues.length; i = i + 2) {
             if (keyValues[i + 1] != null) {
-                // track whether or not traversals are present so that elsewhere in Parameters there is no need
+                // track the list of traversals that are present so that elsewhere in Parameters there is no need
                 // to iterate all values to not find any.
-                if (!traversalsPresent && keyValues[i + 1] instanceof Traversal.Admin)
-                    traversalsPresent = true;
+                if (keyValues[i + 1] instanceof Traversal.Admin)
+                    traversals.add((Traversal.Admin) keyValues[i + 1]);
 
                 List<Object> values = this.parameters.get(keyValues[i]);
                 if (null == values) {
@@ -167,14 +193,8 @@ public final class Parameters implements Cloneable, Serializable {
      * do its work.
      */
     public void integrateTraversals(final TraversalParent step) {
-        if (traversalsPresent) {
-            for (final List<Object> values : this.parameters.values()) {
-                for (final Object object : values) {
-                    if (object instanceof Traversal.Admin) {
-                        step.integrateChild((Traversal.Admin) object);
-                    }
-                }
-            }
+        for (Traversal.Admin t : traversals) {
+            step.integrateChild(t);
         }
     }
 
@@ -182,15 +202,10 @@ public final class Parameters implements Cloneable, Serializable {
      * Gets all the {@link Traversal.Admin} objects in the map of parameters.
      */
     public <S, E> List<Traversal.Admin<S, E>> getTraversals() {
-        if (!traversalsPresent) return Collections.emptyList();
-
+        // stupid generics - just need to return "traversals"
         final List<Traversal.Admin<S, E>> result = new ArrayList<>();
-        for (final List<Object> list : this.parameters.values()) {
-            for (final Object object : list) {
-                if (object instanceof Traversal.Admin) {
-                    result.add((Traversal.Admin) object);
-                }
-            }
+        for (Traversal.Admin t : traversals) {
+            result.add(t);
         }
         return result;
     }

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3dea5bdd/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
index 27b9293..9c96c1c 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.util;
 
+import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
@@ -31,6 +32,7 @@ import java.util.Map;
 import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.core.IsInstanceOf.instanceOf;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.mockito.Mockito.mock;
@@ -153,6 +155,39 @@ public class ParametersTest {
     }
 
     @Test
+    public void shouldRemoveRefreshTraversalCache() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "b", "bat", "c", "cat", "c", mock(Traversal.Admin.class), "t", mock(Traversal.Admin.class));
+
+        final Map<Object,List<Object>> before = parameters.getRaw();
+        assertEquals(4, before.size());
+        assertEquals(2, parameters.getTraversals().size());
+        assertEquals("axe", before.get("a").get(0));
+        assertEquals("bat", before.get("b").get(0));
+        assertEquals("cat", before.get("c").get(0));
+        assertThat(before.get("c").get(1), instanceOf(Traversal.Admin.class));
+        assertThat(before.get("t").get(0), instanceOf(Traversal.Admin.class));
+
+        parameters.remove("t");
+
+        final Map<Object,List<Object>> afterRemoveT = parameters.getRaw();
+        assertEquals(3, afterRemoveT.size());
+        assertEquals(1, parameters.getTraversals().size());
+        assertEquals("axe", afterRemoveT.get("a").get(0));
+        assertEquals("bat", afterRemoveT.get("b").get(0));
+        assertEquals("cat", afterRemoveT.get("c").get(0));
+        assertThat(afterRemoveT.get("c").get(1), instanceOf(Traversal.Admin.class));
+
+        parameters.remove("c");
+
+        final Map<Object,List<Object>> afterRemoveC = parameters.getRaw();
+        assertEquals(2, afterRemoveC.size());
+        assertEquals(0, parameters.getTraversals().size());
+        assertEquals("axe", afterRemoveC.get("a").get(0));
+        assertEquals("bat", afterRemoveC.get("b").get(0));
+    }
+
+    @Test
     public void shouldRename() {
         final Parameters parameters = new Parameters();
         parameters.set("a", "axe", "b", "bat", "c", "cat");
@@ -215,6 +250,21 @@ public class ParametersTest {
         final Parameters parametersClone = parameters.clone();
 
         assertEquals(parameters.getRaw(), parametersClone.getRaw());
+        assertEquals(parameters.getTraversals(), parametersClone.getTraversals());
+    }
+
+    @Test
+    public void shouldCloneWithTraversals() {
+        final Traversal.Admin t = mock(Traversal.Admin.class);
+        when(t.clone()).thenReturn(t);
+
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", t);
+
+        final Parameters parametersClone = parameters.clone();
+
+        assertEquals(parameters.getRaw(), parametersClone.getRaw());
+        assertEquals(parameters.getTraversals().size(), parametersClone.getTraversals().size());
     }
 
     @Test


[44/50] tinkerpop git commit: Merge branch 'TINKERPOP-1659' into tp31

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1659' into tp31


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

Branch: refs/heads/TINKERPOP-1577
Commit: beb7f7488227501f654a1735c29519268e5a1d34
Parents: 4e8cb39 ec066ca
Author: Robert Dale <ro...@gmail.com>
Authored: Thu Mar 30 10:12:30 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Thu Mar 30 10:12:30 2017 -0400

----------------------------------------------------------------------
 .gitignore              | 3 ++-
 docker/scripts/build.sh | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[38/50] tinkerpop git commit: Merge branch 'tp31' into tp32

Posted by sp...@apache.org.
Merge branch 'tp31' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: aa5c4eead0e2ac0047bfd64832c29bd5391d9fb1
Parents: 0fd2666 b831ae8
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Mar 29 11:43:01 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Mar 29 11:43:01 2017 -0400

----------------------------------------------------------------------
 docs/src/reference/the-graphcomputer.asciidoc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/aa5c4eea/docs/src/reference/the-graphcomputer.asciidoc
----------------------------------------------------------------------
diff --cc docs/src/reference/the-graphcomputer.asciidoc
index f449668,fb4331a..e4dff50
--- a/docs/src/reference/the-graphcomputer.asciidoc
+++ b/docs/src/reference/the-graphcomputer.asciidoc
@@@ -520,44 -474,18 +520,44 @@@ only comes into play with custom steps 
  . When evaluating traversals that rely on path information (i.e. the history of the traversal), practical
  computational limits can easily be reached due the link:http://en.wikipedia.org/wiki/Combinatorial_explosion[combinatoric explosion]
  of data. With path computing enabled, every traverser is unique and thus, must be enumerated as opposed to being
 -counted/merged. The difference being a collection of paths vs. a single 64-bit long at a single vertex. For more
 +counted/merged. The difference being a collection of paths vs. a single 64-bit long at a single vertex. In other words,
 + bulking is very unlikely with traversers that maintain path information. For more
- information on this concept, please see link:http://thinkaurelius.com/2012/11/11/faunus-provides-big-graph-data-analytics/[Faunus Provides Big Graph Data].
+ information on this concept, please see link:https://thinkaurelius.wordpress.com/2012/11/11/faunus-provides-big-graph-data-analytics/[Faunus Provides Big Graph Data].
 -. When traversals of the form `x.as('a').y.someSideEffectStep('a').z` are evaluated, the `a` object is stored in the
 -path information of the traverser and thus, such traversals (may) turn on path calculations when executed on a
 -`GraphComputer`
  . Steps that are concerned with the global ordering of traversers do not have a meaningful representation in
  OLAP. For example, what does <<order-step,`order()`>>-step mean when all traversers are being processed in parallel?
  Even if the traversers were aggregated and ordered, then at the next step they would return to being executed in
  parallel and thus, in an unpredictable order. When `order()`-like steps are executed at the end of a traversal (i.e
 -the final step), the `TraverserMapReduce` job ensures the resultant serial representation is ordered accordingly.
 -. Steps that are concerned with providing a global aggregate to the next step of computation do not have a correlate
 -in OLAP. For example, <<fold-step,`fold()`>>-step can only fold up the objects at each executing vertex. Next, even
 -if a global fold was possible, where would it go? Which vertex would be the host of the data structure? The
 -`fold()`-step only makes sense as an end-step whereby a MapReduce job can generate the proper global-to-local data
 -reduction.
 +the final step), `TraversalVertexProgram` ensures a serial representation is ordered accordingly. Moreover, it is intelligent enough
 +to maintain the ordering of `g.V().hasLabel("person").order().by("age").values("name")`. However, the OLAP traversal
 +`g.V().hasLabel("person").order().by("age").out().values("name")` will lose the original ordering as the `out()`-step
 +will rebroadcast traversers across the cluster.
 +
 +[[graph-filter]]
 +Graph Filter
 +------------
 +
 +Most OLAP jobs do not require the entire source graph to faithfully execute their `VertexProgram`. For instance, if
 +`PageRankVertexProgram` is only going to compute the centrality of people in the friendship-graph, then the following
 +`GraphFilter` can be applied.
 +
 +[source,java]
 +----
 +graph.computer().
 +  vertices(hasLabel("person")).
 +  edges(bothE("knows")).
 +  program(PageRankVertexProgram...)
 +----
 +
 +There are two methods for constructing a `GraphFilter`.
 +
 +* `vertices(Traversal<Vertex,Vertex>)`: A traversal that will be used that can only analyze a vertex and its properties.
 +If the traversal `hasNext()`, the input `Vertex` is passed to the `GraphComputer`.
 +* `edges(Traversal<Vertex,Edge>)`: A traversal that will iterate all legal edges for the source vertex.
 +
 +`GraphFilter` is a "push-down predicate" that providers can reason on to determine the most efficient way to provide
 +graph data to the `GraphComputer`.
 +
 +IMPORTANT: Apache TinkerPop provides `GraphFilterStrategy` <<traversalstrategy,traversal strategy>> which analyzes a submitted
 +OLAP traversal and, if possible, creates an appropriate `GraphFilter` automatically. For instance, `g.V().count()` would
 +yield a `GraphFilter.edges(limit(0))`. Thus, for traversal submissions, users typically do not need to be aware of creating
- graph filters explicitly. Users can use the <<explain-step,`explain()`>>-step to see the `GraphFilter` generated by `GraphFilterStrategy`.
++graph filters explicitly. Users can use the <<explain-step,`explain()`>>-step to see the `GraphFilter` generated by `GraphFilterStrategy`.


[30/50] tinkerpop git commit: TINKERPOP-1642 Removed some extra iteration in Parameters.getTraversals()

Posted by sp...@apache.org.
TINKERPOP-1642 Removed some extra iteration in Parameters.getTraversals()


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

Branch: refs/heads/TINKERPOP-1577
Commit: f693cb771d97eb98726babc6bafb2bb1b03c338a
Parents: 6294c07
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 10 12:31:38 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:20:44 2017 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/step/util/Parameters.java      | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f693cb77/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index 6640e87..93cf1f8 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -54,7 +54,7 @@ public final class Parameters implements Cloneable, Serializable {
      * {@link #set(Object...)} because when the parameter map is large the cost of iterating it repeatedly on the
      * high number of calls to {@link #getTraversals()} and {@link #integrateTraversals(TraversalParent)} is great.
      */
-    private List<Traversal.Admin> traversals = new ArrayList<>();
+    private List<Traversal.Admin<?,?>> traversals = new ArrayList<>();
 
     /**
      * Checks for existence of key in parameter set.
@@ -203,11 +203,7 @@ public final class Parameters implements Cloneable, Serializable {
      */
     public <S, E> List<Traversal.Admin<S, E>> getTraversals() {
         // stupid generics - just need to return "traversals"
-        final List<Traversal.Admin<S, E>> result = new ArrayList<>();
-        for (Traversal.Admin t : traversals) {
-            result.add(t);
-        }
-        return result;
+        return (List<Traversal.Admin<S, E>>) (Object) traversals;
     }
 
     public Parameters clone() {


[25/50] tinkerpop git commit: TINKERPOP-1642 Improved performance of addV() and chained mutating statements

Posted by sp...@apache.org.
TINKERPOP-1642 Improved performance of addV() and chained mutating statements

Added more tests for Parameters. Performance improved by about 2.5x given the benchmarks. Also long chained mutating traversals are now inserting roughly on par with single insert traversals (prior to this change they were about 25% slower).


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

Branch: refs/heads/TINKERPOP-1577
Commit: da02d96594139d3187c93ada35fd670d688ba81d
Parents: 0fd2666
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Mar 2 10:44:58 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:20:43 2017 -0400

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java     |   9 +-
 .../process/traversal/step/util/Parameters.java |  33 ++++-
 .../traversal/step/util/ParametersTest.java     | 119 ++++++++++++++++++-
 3 files changed, 146 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/da02d965/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
index bde1dea..afa23d7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
@@ -1010,7 +1010,6 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
         for (int i = 0; i < propertyKeyValues.length; i = i + 2) {
             this.property(propertyKeyValues[i], propertyKeyValues[i + 1]);
         }
-        //((AddVertexStep) this.asAdmin().getEndStep()).addPropertyMutations(propertyKeyValues);
         return (GraphTraversal<S, Vertex>) this;
     }
 
@@ -2055,11 +2054,13 @@ public interface GraphTraversal<S, E> extends Traversal<S, E> {
             this.asAdmin().getBytecode().addStep(Symbols.property, key, value, keyValues);
         else
             this.asAdmin().getBytecode().addStep(Symbols.property, cardinality, key, value, keyValues);
+
         // if it can be detected that this call to property() is related to an addV/E() then we can attempt to fold
         // the properties into that step to gain an optimization for those graphs that support such capabilities.
-        if ((this.asAdmin().getEndStep() instanceof AddVertexStep || this.asAdmin().getEndStep() instanceof AddEdgeStep
-                || this.asAdmin().getEndStep() instanceof AddVertexStartStep) && keyValues.length == 0 && null == cardinality) {
-            ((Mutating) this.asAdmin().getEndStep()).addPropertyMutations(key, value);
+        final Step endStep = this.asAdmin().getEndStep();
+        if ((endStep instanceof AddVertexStep || endStep instanceof AddEdgeStep || endStep instanceof AddVertexStartStep) &&
+                keyValues.length == 0 && null == cardinality) {
+            ((Mutating) endStep).addPropertyMutations(key, value);
         } else {
             this.asAdmin().addStep(new AddPropertyStep(this.asAdmin(), cardinality, key, value));
             ((AddPropertyStep) this.asAdmin().getEndStep()).addPropertyMutations(keyValues);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/da02d965/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index 3584c87..67cb2f9 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -49,6 +49,11 @@ public final class Parameters implements Cloneable, Serializable {
     private Map<Object, List<Object>> parameters = new HashMap<>();
 
     /**
+     * Determines if there are traversals present in the parameters {@code Map}.
+     */
+    private boolean traversalsPresent = false;
+
+    /**
      * Checks for existence of key in parameter set.
      *
      * @param key the key to check
@@ -138,6 +143,11 @@ public final class Parameters implements Cloneable, Serializable {
         Parameters.legalPropertyKeyValueArray(keyValues);
         for (int i = 0; i < keyValues.length; i = i + 2) {
             if (keyValues[i + 1] != null) {
+                // track whether or not traversals are present so that elsewhere in Parameters there is no need
+                // to iterate all values to not find any.
+                if (!traversalsPresent && keyValues[i + 1] instanceof Traversal.Admin)
+                    traversalsPresent = true;
+
                 List<Object> values = this.parameters.get(keyValues[i]);
                 if (null == values) {
                     values = new ArrayList<>();
@@ -150,18 +160,31 @@ public final class Parameters implements Cloneable, Serializable {
         }
     }
 
+    /**
+     * Calls {@link TraversalParent#integrateChild(Traversal.Admin)} on any traversal objects in the parameter list.
+     * This method requires that {@link #set(Object...)} is called prior to this method as the it will switch the
+     * {@code traversalsPresent} flag field if a {@link Traversal.Admin} object is present and allow this method to
+     * do its work.
+     */
     public void integrateTraversals(final TraversalParent step) {
-        for (final List<Object> values : this.parameters.values()) {
-            for (final Object object : values) {
-                if (object instanceof Traversal.Admin) {
-                    step.integrateChild((Traversal.Admin) object);
+        if (traversalsPresent) {
+            for (final List<Object> values : this.parameters.values()) {
+                for (final Object object : values) {
+                    if (object instanceof Traversal.Admin) {
+                        step.integrateChild((Traversal.Admin) object);
+                    }
                 }
             }
         }
     }
 
+    /**
+     * Gets all the {@link Traversal.Admin} objects in the map of parameters.
+     */
     public <S, E> List<Traversal.Admin<S, E>> getTraversals() {
-        List<Traversal.Admin<S, E>> result = new ArrayList<>();
+        if (!traversalsPresent) return Collections.emptyList();
+
+        final List<Traversal.Admin<S, E>> result = new ArrayList<>();
         for (final List<Object> list : this.parameters.values()) {
             for (final Object object : list) {
                 if (object instanceof Traversal.Admin) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/da02d965/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
index 7490dea..27b9293 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/ParametersTest.java
@@ -18,8 +18,12 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.step.util;
 
+import org.apache.tinkerpop.gremlin.process.traversal.Traverser;
+import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
+import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
 import org.junit.Test;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -28,12 +32,66 @@ import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.contains;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 /**
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class ParametersTest {
     @Test
+    public void shouldGetKeyValuesEmpty() {
+        final Parameters parameters = new Parameters();
+        assertThat(Arrays.equals(parameters.getKeyValues(mock(Traverser.Admin.class)), new Object[0]), is(true));
+    }
+
+    @Test
+    public void shouldGetKeyValues() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "b", "bat", "c", "cat");
+
+        final Object[] params = parameters.getKeyValues(mock(Traverser.Admin.class));
+        assertEquals(6, params.length);
+        assertThat(Arrays.equals(new Object[] {"a", "axe", "b", "bat", "c", "cat"}, params), is(true));
+    }
+
+    @Test
+    public void shouldGetKeyValuesIgnoringSomeKeys() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "b", "bat", "c", "cat");
+
+        final Object[] params = parameters.getKeyValues(mock(Traverser.Admin.class), "b");
+        assertEquals(4, params.length);
+        assertThat(Arrays.equals(new Object[] {"a", "axe", "c", "cat"}, params), is(true));
+    }
+
+    @Test
+    public void shouldGetUsingTraverserOverload() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "b", "bat", "c", "cat");
+
+        assertEquals(Collections.singletonList("axe"), parameters.get(mock(Traverser.Admin.class), "a", () -> "x"));
+        assertEquals(Collections.singletonList("bat"), parameters.get(mock(Traverser.Admin.class), "b", () -> "x"));
+        assertEquals(Collections.singletonList("cat"), parameters.get(mock(Traverser.Admin.class), "c", () -> "x"));
+        assertEquals(Collections.singletonList("zebra"), parameters.get(mock(Traverser.Admin.class), "z", () -> "zebra"));
+    }
+
+    @Test
+    public void shouldGetMultipleUsingTraverserOverload() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
+
+        final Map<Object,List<Object>> params = parameters.getRaw();
+        assertEquals(3, params.size());
+        assertEquals(Arrays.asList("axe", "ant"), parameters.get(mock(Traverser.Admin.class), "a", () -> "x"));
+        assertEquals(Arrays.asList("bat", "ball"), parameters.get(mock(Traverser.Admin.class), "b", () -> "x"));
+        assertEquals(Collections.singletonList("cat"), parameters.get(mock(Traverser.Admin.class), "c", () -> "x"));
+        assertEquals(Collections.singletonList("zebra"), parameters.get(mock(Traverser.Admin.class), "z", () -> "zebra"));
+    }
+
+    @Test
     public void shouldGetRaw() {
         final Parameters parameters = new Parameters();
         parameters.set("a", "axe", "b", "bat", "c", "cat");
@@ -143,11 +201,60 @@ public class ParametersTest {
         final Parameters parameters = new Parameters();
         parameters.set("a", "axe", "b", "bat", "c", "cat");
 
-        final Map<Object,List<Object>> params = parameters.getRaw();
-        assertEquals(3, params.size());
-        assertEquals("axe", params.get("a").get(0));
-        assertEquals("bat", params.get("b").get(0));
-        assertEquals("cat", params.get("c").get(0));
-        assertEquals("zebra", parameters.get("z", () -> "zebra").get(0));
+        assertEquals(Collections.singletonList("axe"), parameters.get("a", () -> "x"));
+        assertEquals(Collections.singletonList("bat"), parameters.get("b", () -> "x"));
+        assertEquals(Collections.singletonList("cat"), parameters.get("c", () -> "x"));
+        assertEquals(Collections.singletonList("zebra"), parameters.get("z", () -> "zebra"));
+    }
+
+    @Test
+    public void shouldClone() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
+
+        final Parameters parametersClone = parameters.clone();
+
+        assertEquals(parameters.getRaw(), parametersClone.getRaw());
+    }
+
+    @Test
+    public void shouldBeDifferent() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
+
+        final Parameters parametersDifferent = new Parameters();
+        parametersDifferent.set("a", "ant", "a", "axe", "b", "bat", "b", "ball", "c", "cat");
+
+        assertNotEquals(parameters.getRaw(), parametersDifferent.getRaw());
+    }
+
+    @Test
+    public void shouldGetNoTraversals() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat");
+        assertEquals(Collections.emptyList(), parameters.getTraversals());
+    }
+
+    @Test
+    public void shouldGetTraversals() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", __.outE("knows"));
+        assertEquals(Collections.singletonList(__.outE("knows")), parameters.getTraversals());
+    }
+
+    @Test
+    public void shouldIntegrateTraversals() {
+        final Parameters parameters = new Parameters();
+        parameters.set("a", "axe", "a", "ant", "b", "bat", "b", "ball", "c", "cat", "t", __.outE("knows"));
+
+        final TraversalParent mock = mock(TraversalParent.class);
+
+        // the mock can return nothing of consequence as the return isn't used in this case. we just need to
+        // validate that the method gets called as a result of calls to set/integrateTraversals()
+        when(mock.integrateChild(__.outE("knows").asAdmin())).thenReturn(null);
+
+        parameters.integrateTraversals(mock);
+
+        verify(mock).integrateChild(__.outE("knows").asAdmin());
     }
 }


[35/50] tinkerpop git commit: I made it so ProfileStrategy uses the MARKER model developed by @dkuppitz and myself to reduce recurssive lookups in strategies. Moving forward, we really need to move to a Traversal.metadata model as using labeled steps is

Posted by sp...@apache.org.
I made it so ProfileStrategy uses the MARKER model developed by @dkuppitz and myself to reduce recurssive lookups in strategies. Moving forward, we really need to move to a Traversal.metadata model as using labeled steps is a bit hackish.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 3182a06de4b39fb185b363444e59ce373536411e
Parents: 181558c
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Fri Mar 17 11:57:52 2017 -0600
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:22:58 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../strategy/finalization/ProfileStrategy.java  | 39 +++++++++-----------
 2 files changed, 19 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3182a06d/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 8dd8d9a..926aa18 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* `ProfileStrategy` now uses the marker-model to reduce recrussive lookups of `ProfileSideEffectStep`.
 * `Mutating` steps now implement `Scoping` interface.
 * Fixed a step id compilation bug in `AddVertexStartStep`, `AddVertexStep`, `AddEdgeStep`, and `AddPropertyStep`.
 * De-registered metrics on Gremlin Server shutdown.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/3182a06d/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ProfileStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ProfileStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ProfileStrategy.java
index 6d08652..b5f0b86 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ProfileStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ProfileStrategy.java
@@ -18,13 +18,16 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization;
 
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.VertexProgramStep;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.ProfileSideEffectStep;
+import org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep;
 import org.apache.tinkerpop.gremlin.process.traversal.step.util.ProfileStep;
 import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
+import org.apache.tinkerpop.gremlin.structure.Graph;
 
 import java.util.List;
 
@@ -34,34 +37,28 @@ import java.util.List;
 public final class ProfileStrategy extends AbstractTraversalStrategy<TraversalStrategy.FinalizationStrategy> implements TraversalStrategy.FinalizationStrategy {
 
     private static final ProfileStrategy INSTANCE = new ProfileStrategy();
+    private static final String MARKER = Graph.Hidden.hide("gremlin.profile");
 
     private ProfileStrategy() {
     }
 
     @Override
     public void apply(final Traversal.Admin<?, ?> traversal) {
-        if (TraversalHelper.hasStepOfAssignableClassRecursively(ProfileSideEffectStep.class, TraversalHelper.getRootTraversal(traversal).asAdmin())) {
-            prepTraversalForProfiling(traversal);
-        }
-    }
-
-    // Iterate the traversal steps and inject the .profile()-steps.
-    private void prepTraversalForProfiling(Traversal.Admin<?, ?> traversal) {
-        // Add .profile() step after every pre-existing step.
-        final List<Step> steps = traversal.getSteps();
-        final int numSteps = steps.size();
-        for (int ii = 0; ii < numSteps; ii++) {
-            // Get the original step
-            final Step step = steps.get(ii * 2);
-
-            // Do not inject profiling after ProfileSideEffectStep as this will be the last step on the root traversal.
-            if (step instanceof ProfileSideEffectStep) {
-                break;
+        if ((traversal.getParent() instanceof EmptyStep || traversal.getParent() instanceof VertexProgramStep) &&
+                TraversalHelper.hasStepOfAssignableClassRecursively(ProfileSideEffectStep.class, traversal))
+            TraversalHelper.applyTraversalRecursively(t -> t.getEndStep().addLabel(MARKER), traversal);
+        if (traversal.getEndStep().getLabels().contains(MARKER)) {
+            traversal.getEndStep().removeLabel(MARKER);
+            // Add .profile() step after every pre-existing step.
+            final List<Step> steps = traversal.getSteps();
+            final int numSteps = steps.size();
+            for (int i = 0; i < numSteps; i++) {
+                // Do not inject profiling after ProfileSideEffectStep as this will be the last step on the root traversal.
+                if (steps.get(i * 2) instanceof ProfileSideEffectStep)
+                    break;
+                // Create and inject ProfileStep
+                traversal.addStep((i * 2) + 1, new ProfileStep(traversal));
             }
-
-            // Create and inject ProfileStep
-            ProfileStep profileStep = new ProfileStep(traversal);
-            traversal.addStep((ii * 2) + 1, profileStep);
         }
     }
 


[45/50] tinkerpop git commit: Merge branch 'tp31' into tp32

Posted by sp...@apache.org.
Merge branch 'tp31' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: a4a646d680261a3e169962bbf016ef323ac8cd2d
Parents: 91802ad beb7f74
Author: Robert Dale <ro...@gmail.com>
Authored: Thu Mar 30 10:34:30 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Thu Mar 30 10:34:30 2017 -0400

----------------------------------------------------------------------
 .gitignore                                    | 1 +
 docker/scripts/build.sh                       | 7 +++++++
 docs/src/reference/the-graphcomputer.asciidoc | 1 +
 3 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a4a646d6/.gitignore
----------------------------------------------------------------------
diff --cc .gitignore
index 33fb239,a4c1cdc..ca3160b
--- a/.gitignore
+++ b/.gitignore
@@@ -14,9 -14,5 +14,10 @@@ _bsp
  doc/out
  docs/*.asciidoc
  ext/
 +benchmarks/
 +*$py.class
 +__pycache__/
 +*.py[cdo]
 +__version__.py
  .glv
+ settings.xml

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a4a646d6/docs/src/reference/the-graphcomputer.asciidoc
----------------------------------------------------------------------
diff --cc docs/src/reference/the-graphcomputer.asciidoc
index e4dff50,ef859f9..b03c891
--- a/docs/src/reference/the-graphcomputer.asciidoc
+++ b/docs/src/reference/the-graphcomputer.asciidoc
@@@ -313,8 -278,9 +313,9 @@@ public class PageRankVertexProgram impl
  
      @Override
      public String toString() {
 -        return StringFactory.vertexProgramString(this, "alpha=" + this.alpha + ",iterations=" + this.totalIterations);
 +        return StringFactory.vertexProgramString(this, "alpha=" + this.alpha + ", iterations=" + this.totalIterations);
      }
+ }
  ----
  
  <1> `PageRankVertexProgram` implements `VertexProgram<Double>` because the messages it sends are Java doubles.


[08/50] tinkerpop git commit: Fixed bug in EvenStrategyTest for transactional Graphs

Posted by sp...@apache.org.
Fixed bug in EvenStrategyTest for transactional Graphs

Can't use tryCommit() in the way that the tests where because tryCommit() is meant to be idempotent and some of the tests were passing in lambdas that mutated the graph. CTR


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

Branch: refs/heads/TINKERPOP-1577
Commit: 7def0396f7688d8240af9dc1478aca4fb5794e9d
Parents: 06bf620
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 24 15:20:24 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Mar 27 10:45:14 2017 -0400

----------------------------------------------------------------------
 .../process/traversal/step/filter/DropStep.java |   4 +-
 .../decoration/EventStrategyProcessTest.java    | 149 ++++++++++++-------
 2 files changed, 96 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7def0396/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
index 9c4ae2f..87790eb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/filter/DropStep.java
@@ -47,7 +47,7 @@ public final class DropStep<S> extends FilterStep<S> implements Mutating<Event>
     protected boolean filter(Traverser.Admin<S> traverser) {
         final S s = traverser.get();
         if (s instanceof Element) {
-            final Element toRemove = ((Element) s);
+            final Element toRemove = (Element) s;
             if (callbackRegistry != null) {
                 final Event removeEvent;
                 if (s instanceof Vertex)
@@ -64,7 +64,7 @@ public final class DropStep<S> extends FilterStep<S> implements Mutating<Event>
 
             toRemove.remove();
         } else if (s instanceof Property) {
-            final Property toRemove = ((Property) s);
+            final Property toRemove = (Property) s;
             if (callbackRegistry != null) {
                 final Event.ElementPropertyEvent removeEvent;
                 if (toRemove.element() instanceof Edge)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7def0396/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
index 76ae31c..6a20177 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyProcessTest.java
@@ -291,7 +291,6 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
 
         assertEquals(0, listener2.edgePropertyChangedEventRecorded());
         assertEquals(0, listener1.edgePropertyChangedEventRecorded());
-
     }
 
     @Test
@@ -537,16 +536,18 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final VertexProperty vp = v.property("xxx","blah");
+        final String label = vp.label();
+        final Object value = vp.value();
         final Property p = vp.property("to-drop", "dah");
         vp.property("not-dropped", "yay!");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyPropertyRemoved(final VertexProperty element, final Property property) {
-                assertEquals(vp.label(), element.label());
-                assertEquals(vp.value(), element.value());
-                assertEquals(p.value(), property.value());
-                assertEquals(p.key(), property.key());
+                assertEquals(label, element.label());
+                assertEquals(value, element.value());
+                assertEquals("dah", property.value());
+                assertEquals("to-drop", property.key());
                 triggered.set(true);
             }
         };
@@ -558,7 +559,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).properties("xxx").properties("to-drop").drop().iterate());
+        gts.V(v).properties("xxx").properties("to-drop").drop().iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertEquals(1, IteratorUtils.count(v.properties().next().properties()));
@@ -573,15 +575,17 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final VertexProperty vp = v.property("xxx","blah");
-        final Property p = vp.property("to-change", "dah");
+        final String label = vp.label();
+        final Object value = vp.value();
+        vp.property("to-change", "dah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyPropertyChanged(final VertexProperty element, final Property oldValue, final Object setValue) {
-                assertEquals(vp.label(), element.label());
-                assertEquals(vp.value(), element.value());
-                assertEquals(p.value(), oldValue.value());
-                assertEquals(p.key(), oldValue.key());
+                assertEquals(label, element.label());
+                assertEquals(value, element.value());
+                assertEquals("dah", oldValue.value());
+                assertEquals("to-change", oldValue.key());
                 assertEquals("bah", setValue);
                 triggered.set(true);
             }
@@ -594,7 +598,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).properties("xxx").property("to-change","bah").iterate());
+        gts.V(v).properties("xxx").property("to-change","bah").iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertEquals(1, IteratorUtils.count(v.properties().next().properties()));
@@ -608,13 +613,15 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final VertexProperty vp = v.property("xxx","blah");
-        final Property p = vp.property("to-change", "dah");
+        final String label = vp.label();
+        final Object value = vp.value();
+        vp.property("to-change", "dah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyPropertyChanged(final VertexProperty element, final Property oldValue, final Object setValue) {
-                assertEquals(vp.label(), element.label());
-                assertEquals(vp.value(), element.value());
+                assertEquals(label, element.label());
+                assertEquals(value, element.value());
                 assertEquals(null, oldValue.value());
                 assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
@@ -629,7 +636,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).properties("xxx").property("new","yay!").iterate());
+        gts.V(v).properties("xxx").property("new","yay!").iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertEquals(2, IteratorUtils.count(v.properties().next().properties()));
@@ -642,16 +650,19 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final Edge e = v.addEdge("self", v, "not-dropped", "yay!");
-        final Property p = e.property("to-drop", "dah");
+        final String label = e.label();
+        final Object inId = v.id();
+        final Object outId = v.id();
+        e.property("to-drop", "dah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgePropertyRemoved(final Edge element, final Property property) {
-                assertEquals(e.label(), element.label());
-                assertEquals(e.inVertex().id(), element.inVertex().id());
-                assertEquals(e.outVertex().id(), element.outVertex().id());
-                assertEquals(p.value(), property.value());
-                assertEquals(p.key(), property.key());
+                assertEquals(label, element.label());
+                assertEquals(inId, element.inVertex().id());
+                assertEquals(outId, element.outVertex().id());
+                assertEquals("dah", property.value());
+                assertEquals("to-drop", property.key());
                 triggered.set(true);
             }
         };
@@ -663,7 +674,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.E(e).properties("to-drop").drop().iterate());
+        gts.E(e).properties("to-drop").drop().iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(e.properties()));
         assertEquals("yay!", e.value("not-dropped"));
@@ -676,16 +688,19 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final Edge e = v.addEdge("self", v);
-        final Property p = e.property("to-change", "no!");
+        final String label = e.label();
+        final Object inId = v.id();
+        final Object outId = v.id();
+        e.property("to-change", "no!");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgePropertyChanged(final Edge element, final Property oldValue, final Object setValue) {
-                assertEquals(e.label(), element.label());
-                assertEquals(e.inVertex().id(), element.inVertex().id());
-                assertEquals(e.outVertex().id(), element.outVertex().id());
-                assertEquals(p.value(), oldValue.value());
-                assertEquals(p.key(), oldValue.key());
+                assertEquals(label, element.label());
+                assertEquals(inId, element.inVertex().id());
+                assertEquals(outId, element.outVertex().id());
+                assertEquals("no!", oldValue.value());
+                assertEquals("to-change", oldValue.key());
                 assertEquals("yay!", setValue);
                 triggered.set(true);
             }
@@ -698,7 +713,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.E(e).property("to-change","yay!").iterate());
+        gts.E(e).property("to-change","yay!").iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(e.properties()));
         assertThat(triggered.get(), is(true));
@@ -710,14 +726,17 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final Edge e = v.addEdge("self", v);
-        final Property p = e.property("to-change", "no!");
+        final String label = e.label();
+        final Object inId = v.id();
+        final Object outId = v.id();
+        e.property("to-change", "no!");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgePropertyChanged(final Edge element, final Property oldValue, final Object setValue) {
-                assertEquals(e.label(), element.label());
-                assertEquals(e.inVertex().id(), element.inVertex().id());
-                assertEquals(e.outVertex().id(), element.outVertex().id());
+                assertEquals(label, element.label());
+                assertEquals(inId, element.inVertex().id());
+                assertEquals(outId, element.outVertex().id());
                 assertEquals(null, oldValue.value());
                 assertEquals("new", oldValue.key());
                 assertEquals("yay!", setValue);
@@ -732,7 +751,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.E(e).property("new","yay!").iterate());
+        gts.E(e).property("new","yay!").iterate();
+        tryCommit(graph);
 
         assertEquals(2, IteratorUtils.count(e.properties()));
         assertThat(triggered.get(), is(true));
@@ -745,13 +765,16 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final Edge e = v.addEdge("self", v, "dropped", "yay!");
+        final String label = e.label();
+        final Object inId = v.id();
+        final Object outId = v.id();
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgeRemoved(final Edge element) {
-                assertEquals(e.label(), element.label());
-                assertEquals(e.inVertex().id(), element.inVertex().id());
-                assertEquals(e.outVertex().id(), element.outVertex().id());
+                assertEquals(label, element.label());
+                assertEquals(inId, element.inVertex().id());
+                assertEquals(outId, element.outVertex().id());
                 triggered.set(true);
             }
         };
@@ -763,7 +786,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.E(e).drop().iterate());
+        gts.E(e).drop().iterate();
+        tryCommit(graph);
 
         assertVertexEdgeCounts(graph, 1, 0);
         assertThat(triggered.get(), is(true));
@@ -774,13 +798,14 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldDetachEdgeWhenAdded() {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
+        final Object id = v.id();
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void edgeAdded(final Edge element) {
                 assertEquals("self", element.label());
-                assertEquals(v.id(), element.inVertex().id());
-                assertEquals(v.id(), element.outVertex().id());
+                assertEquals(id, element.inVertex().id());
+                assertEquals(id, element.outVertex().id());
                 assertEquals("there", element.value("here"));
                 triggered.set(true);
             }
@@ -793,7 +818,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).as("a").addE("self").property("here", "there").from("a").to("a").iterate());
+        gts.V(v).as("a").addE("self").property("here", "there").from("a").to("a").iterate();
+        tryCommit(graph);
 
         assertVertexEdgeCounts(graph, 1, 1);
         assertThat(triggered.get(), is(true));
@@ -805,13 +831,15 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
         final VertexProperty vp = v.property("to-remove","blah");
+        final String label = vp.label();
+        final Object value = vp.value();
         final VertexProperty vpToKeep = v.property("to-keep","dah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyRemoved(final VertexProperty element) {
-                assertEquals(vp.label(), element.label());
-                assertEquals(vp.value(), element.value());
+                assertEquals(label, element.label());
+                assertEquals(value, element.value());
                 triggered.set(true);
             }
         };
@@ -823,7 +851,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).properties("to-remove").drop().iterate());
+        gts.V(v).properties("to-remove").drop().iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertEquals(vpToKeep.value(), v.value("to-keep"));
@@ -835,13 +864,15 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldDetachVertexPropertyWhenChanged() {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
+        final String label = v.label();
+        final Object id = v.id();
         v.property("to-change", "blah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-                assertEquals(v.label(), element.label());
-                assertEquals(v.id(), element.id());
+                assertEquals(label, element.label());
+                assertEquals(id, element.id());
                 assertEquals("to-change", oldValue.key());
                 assertEquals("blah", oldValue.value());
                 assertEquals("dah", setValue);
@@ -856,7 +887,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).property(VertexProperty.Cardinality.single, "to-change", "dah").iterate());
+        gts.V(v).property(VertexProperty.Cardinality.single, "to-change", "dah").iterate();
+        tryCommit(graph);
 
         assertEquals(1, IteratorUtils.count(v.properties()));
         assertThat(triggered.get(), is(true));
@@ -867,13 +899,15 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldDetachVertexPropertyWhenNew() {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
+        final String label = v.label();
+        final Object id = v.id();
         v.property("old","blah");
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexPropertyChanged(final Vertex element, final Property oldValue, final Object setValue, final Object... vertexPropertyKeyValues) {
-                assertEquals(v.label(), element.label());
-                assertEquals(v.id(), element.id());
+                assertEquals(label, element.label());
+                assertEquals(id, element.id());
                 assertEquals("new", oldValue.key());
                 assertEquals(null, oldValue.value());
                 assertEquals("dah", setValue);
@@ -888,7 +922,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).property(VertexProperty.Cardinality.single, "new", "dah").iterate());
+        gts.V(v).property(VertexProperty.Cardinality.single, "new", "dah").iterate();
+        tryCommit(graph);
 
         assertEquals(2, IteratorUtils.count(v.properties()));
         assertThat(triggered.get(), is(true));
@@ -899,12 +934,14 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
     public void shouldDetachVertexWhenRemoved() {
         final AtomicBoolean triggered = new AtomicBoolean(false);
         final Vertex v = graph.addVertex();
+        final String label = v.label();
+        final Object id = v.id();
 
         final MutationListener listener = new AbstractMutationListener() {
             @Override
             public void vertexRemoved(final Vertex element) {
-                assertEquals(v.id(), element.id());
-                assertEquals(v.label(), element.label());
+                assertEquals(id, element.id());
+                assertEquals(label, element.label());
                 triggered.set(true);
             }
         };
@@ -916,7 +953,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.V(v).drop().iterate());
+        gts.V(v).drop().iterate();
+        tryCommit(graph);
 
         assertVertexEdgeCounts(graph, 0, 0);
         assertThat(triggered.get(), is(true));
@@ -943,7 +981,8 @@ public class EventStrategyProcessTest extends AbstractGremlinProcessTest {
         final EventStrategy eventStrategy = builder.create();
         final GraphTraversalSource gts = create(eventStrategy);
 
-        tryCommit(graph, g -> gts.addV("thing").property("here", "there").iterate());
+        gts.addV("thing").property("here", "there").iterate();
+        tryCommit(graph);
 
         assertVertexEdgeCounts(graph, 1, 0);
         assertThat(triggered.get(), is(true));


[24/50] tinkerpop git commit: TINKERPOP-1642 Minor fixes

Posted by sp...@apache.org.
TINKERPOP-1642 Minor fixes


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

Branch: refs/heads/TINKERPOP-1577
Commit: e8011e4fea81dd7d4bf187ffa011ab1912335cf3
Parents: 3dea5bd
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Mar 3 08:45:24 2017 -0500
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:20:43 2017 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/step/util/Parameters.java        | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/e8011e4f/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
index 3f0cb7c..6640e87 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/Parameters.java
@@ -50,7 +50,7 @@ public final class Parameters implements Cloneable, Serializable {
     private Map<Object, List<Object>> parameters = new HashMap<>();
 
     /**
-     * A cached list of traversals that server as parameter values. The list is cached on calls to
+     * A cached list of traversals that serve as parameter values. The list is cached on calls to
      * {@link #set(Object...)} because when the parameter map is large the cost of iterating it repeatedly on the
      * high number of calls to {@link #getTraversals()} and {@link #integrateTraversals(TraversalParent)} is great.
      */
@@ -129,10 +129,10 @@ public final class Parameters implements Cloneable, Serializable {
 
     /**
      * Gets the array of keys/values of the parameters while resolving parameter values that contain
-     * {@link Traversal} instances
+     * {@link Traversal} instances.
      */
     public <S> Object[] getKeyValues(final Traverser.Admin<S> traverser, final Object... exceptKeys) {
-        if (this.parameters.size() == 0) return EMPTY_ARRAY;
+        if (this.parameters.isEmpty()) return EMPTY_ARRAY;
         final List<Object> keyValues = new ArrayList<>();
         for (final Map.Entry<Object, List<Object>> entry : this.parameters.entrySet()) {
             if (!ArrayUtils.contains(exceptKeys, entry.getKey())) {


[16/50] tinkerpop git commit: Merge branch 'tp31' into tp32

Posted by sp...@apache.org.
Merge branch 'tp31' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: 0f5ca93b8983a8cc1d05448fe81b779cf2e776d9
Parents: bb9e081 df6661d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Mar 29 10:11:19 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 10:11:19 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc     | 1 +
 gremlin-shaded/pom.xml | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0f5ca93b/gremlin-shaded/pom.xml
----------------------------------------------------------------------


[15/50] tinkerpop git commit: Merge branch 'TINKERPOP-1654' into tp31

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1654' into tp31


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

Branch: refs/heads/TINKERPOP-1577
Commit: df6661dda78febb0f3c5a2b181b51f9fc1732d28
Parents: e621f54 c645733
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Mar 29 10:10:39 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 10:10:39 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc     | 1 +
 gremlin-shaded/pom.xml | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------



[10/50] tinkerpop git commit: TINKERPOP-1654 Bumped to Jackson 2.8.7

Posted by sp...@apache.org.
TINKERPOP-1654 Bumped to Jackson 2.8.7


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

Branch: refs/heads/TINKERPOP-1577
Commit: c64573322672c5c53a3298812189e734f11ceb69
Parents: 7def039
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu Mar 23 08:58:37 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Mar 27 14:29:38 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc     | 1 +
 gremlin-shaded/pom.xml | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c6457332/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 90b9f00..3ac081b 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.7 (Release Date: NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Bumped to Jackson 2.8.7.
 * Fixed `EventStrategy` so that newly added properties trigger events with the name of the key that was added.
 * Drop use of jitpack for the jbcrypt artifact - using the official one in Maven Central.
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/c6457332/gremlin-shaded/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-shaded/pom.xml b/gremlin-shaded/pom.xml
index f4b87d8..4f2ba98 100644
--- a/gremlin-shaded/pom.xml
+++ b/gremlin-shaded/pom.xml
@@ -50,7 +50,7 @@ limitations under the License.
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
             <!-- Update the shade plugin config whenever you change this version -->
-            <version>2.7.2</version>
+            <version>2.8.7</version>
             <optional>true</optional>
         </dependency>
     </dependencies>


[28/50] tinkerpop git commit: Add a slight optimization to ScopingStrategy that will not compute step labels if no Scoping steps are defined. Also added JavaDoc and comments accordingly.

Posted by sp...@apache.org.
Add a slight optimization to ScopingStrategy that will not compute step labels if no Scoping steps are defined. Also added JavaDoc and comments accordingly.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 5711ee26c89f02896d404b47eebe7ca75ea71e94
Parents: b49c5be
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Mon Mar 6 08:07:39 2017 -0700
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 11:20:44 2017 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/step/Scoping.java         |  5 +++++
 .../strategy/finalization/ScopingStrategy.java          | 12 ++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5711ee26/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
index 68655e4..fae52d7 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/Scoping.java
@@ -69,6 +69,11 @@ public interface Scoping {
         return null;
     }
 
+    /**
+     * Get the labels that this scoping step will access during the traversal
+     *
+     * @return the accessed labels of the scoping step
+     */
     public Set<String> getScopeKeys();
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5711ee26/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
index ce66da4..073f45e 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/finalization/ScopingStrategy.java
@@ -19,6 +19,7 @@
 
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.finalization;
 
+import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
 import org.apache.tinkerpop.gremlin.process.traversal.step.Scoping;
@@ -29,6 +30,10 @@ import org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper;
 import java.util.Set;
 
 /**
+ * ScopingStrategy will analyze the traversal for step labels (e.g. as()) and provide {@link Scoping} steps that information.
+ * This enables Scoping steps to avoid  having to generate step label data at {@link Step#getRequirements()} and thus,
+ * may significantly reduce compilation times.
+ *
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
 public final class ScopingStrategy extends AbstractTraversalStrategy<TraversalStrategy.FinalizationStrategy> implements TraversalStrategy.FinalizationStrategy {
@@ -41,11 +46,14 @@ public final class ScopingStrategy extends AbstractTraversalStrategy<TraversalSt
 
     @Override
     public void apply(final Traversal.Admin<?, ?> traversal) {
-        // only operate on the root traversal and apply global step labels recursively
-        if (!(traversal.getParent() instanceof EmptyStep))
+        // only operate on the root traversal and only if it contains scoping steps
+        if (!(traversal.getParent() instanceof EmptyStep) ||
+                !TraversalHelper.hasStepOfAssignableClassRecursively(Scoping.class, traversal))
             return;
 
+        // get the labels associated with the traveral
         final Set<String> labels = TraversalHelper.getLabels(traversal);
+        // tell all scoping steps what those labels are
         for (final Scoping scoping : TraversalHelper.getStepsOfAssignableClassRecursively(Scoping.class, traversal)) {
             scoping.setPathLabels(labels);
         }


[40/50] tinkerpop git commit: Merge branch 'TINKERPOP-1095' into tp32

Posted by sp...@apache.org.
Merge branch 'TINKERPOP-1095' into tp32

Conflicts:
	CHANGELOG.asciidoc


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

Branch: refs/heads/TINKERPOP-1577
Commit: 4fd8d7ef2fef4512ae96402ec931a50074bdaa85
Parents: aa5c4ee 48daf8d
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Mar 29 12:03:23 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Mar 29 12:03:23 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  11 +-
 .../gremlin/jsr223/GremlinScriptContext.java    | 234 +++++++++++++++++++
 .../jsr223/GremlinGroovyScriptEngine.java       |  22 ++
 3 files changed, 262 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/4fd8d7ef/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index 7d4e74b,e6216c0..417a7fe
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -30,14 -29,14 +30,15 @@@ TinkerPop 3.2.5 (Release Date: NOT OFFI
  * De-registered metrics on Gremlin Server shutdown.
  * Added "help" command option on `:remote config` for plugins that support that feature in the Gremlin Console.
  * Allowed for multiple scripts and related arguments to be passed to `gremlin.sh` via `-i` and `-e`.
 +* Updated `PathRetractionStrategy` to not run if the provided traversal contains a `VertexProgramStep` that has a `LABELED_PATH` requirement.
  * Added various metrics to the `GremlinGroovyScriptEngine` around script compilation and exposed them in Gremlin Server.
  * Moved the `caffeine` dependency down to `gremlin-groovy` and out of `gremlin-server`.
- * Improved script compilation in `GremlinGroovyScriptEngine` to use better caching, log long compile times and prevent failed compilations from recompiling on future requests.
- * Script compilation is synchronised.
- * Script compilation times are placed in to logs.
- * Failed scripts will not be recompiled.
- * Scripts that take over 5 seconds to compile are logged as a warning.
+ * Improved script compilation in `GremlinGroovyScriptEngine to use better caching, log long compile times and prevent failed compilations from recompiling on future requests.
+ * Synchronized script compilation.
+ * Logged Script compilation times.
+ * Prevented failed scripts from recompiling.
+ * Logged warnings for scripts that take "too long" to compile.
+ * Improved memory usage of the `GremlinGroovyScriptEngine`.
  * Added `cyclicPath().from().to().by()` support to `GraphTraversal`.
  * Added `simplePath().from().to().by()` support to `GraphTraversal`.
  * Added `path().from().to()` support to `GraphTraversal` so sub-paths can be isolated from the current path.


[02/50] tinkerpop git commit: Resolved CHANGELOG merge conflict and added missing backtick.

Posted by sp...@apache.org.
Resolved CHANGELOG merge conflict and added missing backtick.


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

Branch: refs/heads/TINKERPOP-1577
Commit: d1956eae3d03ee1bd6b35d3e83926b8fc7737f22
Parents: e3e1dca
Author: Ted Wilmes <tw...@gmail.com>
Authored: Fri Mar 24 14:37:23 2017 -0500
Committer: Ted Wilmes <tw...@gmail.com>
Committed: Fri Mar 24 14:37:23 2017 -0500

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  3 ++-
 .../optimization/PathRetractionStrategy.java    |  7 ++++-
 .../PathRetractionStrategyTest.java             | 28 +++++++++++++++++---
 3 files changed, 32 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d1956eae/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index ed26f7a..af41d1f 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -29,9 +29,10 @@ TinkerPop 3.2.5 (Release Date: NOT OFFICIALLY RELEASED YET)
 * De-registered metrics on Gremlin Server shutdown.
 * Added "help" command option on `:remote config` for plugins that support that feature in the Gremlin Console.
 * Allowed for multiple scripts and related arguments to be passed to `gremlin.sh` via `-i` and `-e`.
+* Updated `PathRetractionStrategy` to not run if the provided traversal contains a `VertexProgramStep` that has a `LABELED_PATH` requirement.
 * Added various metrics to the `GremlinGroovyScriptEngine` around script compilation and exposed them in Gremlin Server.
 * Moved the `caffeine` dependency down to `gremlin-groovy` and out of `gremlin-server`.
-* Improved script compilation in `GremlinGroovyScriptEngine to use better caching, log long compile times and prevent failed compilations from recompiling on future requests.
+* Improved script compilation in `GremlinGroovyScriptEngine` to use better caching, log long compile times and prevent failed compilations from recompiling on future requests.
 * Script compilation is synchronised.
 * Script compilation times are placed in to logs.
 * Failed scripts will not be recompiled.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d1956eae/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
index bd27a3e..56f9f66 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategy.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization;
 
+import org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.VertexProgramStep;
 import org.apache.tinkerpop.gremlin.process.traversal.Step;
 import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
@@ -72,7 +73,11 @@ public final class PathRetractionStrategy extends AbstractTraversalStrategy<Trav
     public void apply(final Traversal.Admin<?, ?> traversal) {
         // do not apply this strategy if there are lambdas as you can't introspect to know what path information the lambdas are using
         // do not apply this strategy if a PATH requirement step is being used (in the future, we can do PATH requirement lookhead to be more intelligent about its usage)
-        if (TraversalHelper.anyStepRecursively(step -> step instanceof LambdaHolder || step.getRequirements().contains(TraverserRequirement.PATH), TraversalHelper.getRootTraversal(traversal)))
+        // do not apply this strategy if a VertexProgramStep is present with LABELED_PATH requirements
+        if (TraversalHelper.anyStepRecursively(step -> step instanceof LambdaHolder ||
+                        step.getRequirements().contains(TraverserRequirement.PATH) ||
+                        (step instanceof VertexProgramStep && step.getRequirements().contains(TraverserRequirement.LABELED_PATH)),
+                TraversalHelper.getRootTraversal(traversal)))
             return;
 
         final boolean onGraphComputer = TraversalHelper.onGraphComputer(traversal);

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d1956eae/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java
index 2a87f47..f42a914 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/optimization/PathRetractionStrategyTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization;
 
+import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
 import org.apache.tinkerpop.gremlin.process.traversal.Order;
 import org.apache.tinkerpop.gremlin.process.traversal.P;
 import org.apache.tinkerpop.gremlin.process.traversal.Scope;
@@ -27,13 +28,17 @@ import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
 import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__;
 import org.apache.tinkerpop.gremlin.process.traversal.step.PathProcessor;
 import org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent;
+import org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement;
 import org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
+import org.mockito.internal.util.collections.Sets;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
@@ -52,6 +57,8 @@ import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.values
 import static org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__.where;
 import static org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.PathRetractionStrategy.MAX_BARRIER_SIZE;
 import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 /**
  * @author Ted Wilmes (http://twilmes.org)
@@ -75,6 +82,8 @@ public class PathRetractionStrategyTest {
     @Parameterized.Parameter(value = 2)
     public Traversal.Admin optimized;
 
+    private static final String PATH_RETRACTION_STRATEGY_DISABLED = "[]";
+
     @Test
     public void doTest() {
         for (final TraversalStrategies currentStrategies : this.strategies) {
@@ -114,6 +123,14 @@ public class PathRetractionStrategyTest {
     @Parameterized.Parameters(name = "{0}")
     public static Iterable<Object[]> generateTestParameters() {
 
+        final VertexProgram labeledPathVertexProgram = mock(VertexProgram.class);
+        final VertexProgram pathVertexProgram = mock(VertexProgram.class);
+        final VertexProgram emptyRequirementsVertexProgram = mock(VertexProgram.class);
+
+        when(labeledPathVertexProgram.getTraverserRequirements()).thenReturn(Sets.newSet(TraverserRequirement.LABELED_PATH));
+        when(pathVertexProgram.getTraverserRequirements()).thenReturn(Sets.newSet(TraverserRequirement.PATH));
+        when(emptyRequirementsVertexProgram.getTraverserRequirements()).thenReturn(Collections.EMPTY_SET);
+
         return Arrays.asList(new Object[][]{
                 {out(), "[]", null},
                 {__.V().as("a").out().as("b").where(neq("a")).out(), "[[]]", null},
@@ -126,14 +143,14 @@ public class PathRetractionStrategyTest {
                         as("a").in("created").as("b"),
                         as("b").in("knows").as("c")).select("c").out("created").where(neq("a")).values("name"),
                         "[[a, c], [a], []]", null},
-                {__.V().as("a").out().select("a").path(), "[]", null},
-                {__.V().as("a").out().select("a").map(t -> t.path().get("a")), "[]", null}, // lambda introspection is not possible
+                {__.V().as("a").out().select("a").path(), PATH_RETRACTION_STRATEGY_DISABLED, null},
+                {__.V().as("a").out().select("a").map(t -> t.path().get("a")), PATH_RETRACTION_STRATEGY_DISABLED, null}, // lambda introspection is not possible
                 {__.V().as("a").out().select("a").subgraph("b"), "[[]]", null},
                 {__.V().as("a").out().select("a").subgraph("b").select("a"), "[[a], []]", null},
                 {__.V().out().out().match(
                         as("a").in("created").as("b"),
                         as("b").in("knows").as("c")).select("c").out("created").where(neq("a")).values("name").path(),
-                        "[]", null},
+                        PATH_RETRACTION_STRATEGY_DISABLED, null},
                 {__.V().out().as("a").where(neq("a")).out().where(neq("a")).out(), "[[a], []]", null},
                 {__.V().out().as("a").where(out().select("a").values("prop").count().is(gte(1))).out().where(neq("a")), "[[[a]], []]", null},
                 {__.V().as("a").out().as("b").where(out().select("a", "b", "c").values("prop").count().is(gte(1))).out().where(neq("a")).out().select("b"),
@@ -191,6 +208,9 @@ public class PathRetractionStrategyTest {
                 {__.V().as("a").optional(bothE().dedup().as("b")).
                         choose(select("b"), select("a","b"), project("a").by(select("a"))),
                         "[[[a, b]], [[a, b]], [[a, b]], [[[a, b]]], [[a, b]]]", null},
+                {__.V().as("a").out().where(neq("a")).program(labeledPathVertexProgram), PATH_RETRACTION_STRATEGY_DISABLED, null},
+                {__.V().as("a").out().where(neq("a")).program(pathVertexProgram).select("a"), PATH_RETRACTION_STRATEGY_DISABLED, null},
+                {__.V().as("a").out().program(emptyRequirementsVertexProgram).select("a"), "[[]]", null}
         });
     }
-}
+}
\ No newline at end of file


[49/50] tinkerpop git commit: TINKERPOP-1266 Provide JVM options as a configuration to benchmarks

Posted by sp...@apache.org.
TINKERPOP-1266 Provide JVM options as a configuration to benchmarks

Also fixed up the configuration option for the location of the benchmark reports and added all configuration options to the pom.xml with their defaults. CTR


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

Branch: refs/heads/TINKERPOP-1577
Commit: 95d3efc03baf474bf6b8c36fcc85c3e3070f34e5
Parents: f73d7ca
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 4 15:48:41 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Apr 4 15:48:41 2017 -0400

----------------------------------------------------------------------
 gremlin-benchmark/pom.xml                              |  4 ++++
 .../benchmark/util/AbstractBenchmarkBase.java          | 13 +++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95d3efc0/gremlin-benchmark/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-benchmark/pom.xml b/gremlin-benchmark/pom.xml
index 17132a1..e6ed62a 100644
--- a/gremlin-benchmark/pom.xml
+++ b/gremlin-benchmark/pom.xml
@@ -95,6 +95,10 @@ limitations under the License.
                     </excludes>
                     <systemPropertyVariables>
                         <benchmarkReportDir>${project.build.directory}/reports/benchmark/</benchmarkReportDir>
+                        <jvmArgs>-server -Xms2g -Xmx2g</jvmArgs>
+                        <warmupIterations>10</warmupIterations>
+                        <measureIterations>10</measureIterations>
+                        <forks>2</forks>
                     </systemPropertyVariables>
                 </configuration>
             </plugin>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/95d3efc0/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
----------------------------------------------------------------------
diff --git a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java b/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
index 2f8bb66..f647f1a 100644
--- a/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
+++ b/gremlin-benchmark/src/main/java/org/apache/tinkerpop/benchmark/util/AbstractBenchmarkBase.java
@@ -48,10 +48,7 @@ public abstract class AbstractBenchmarkBase {
     protected static final int DEFAULT_MEASURE_ITERATIONS = 10;
     protected static final int DEFAULT_FORKS = 2;
     protected static final String DEFAULT_BENCHMARK_DIRECTORY = "./benchmarks/";
-
-    protected static final String[] JVM_ARGS = {
-            "-server", "-Xms2g", "-Xmx2g"
-    };
+    protected static final String DEFAULT_JVM_ARGS = "-server -Xms2g -Xmx2g";
 
     @Test
     public void run() throws Exception {
@@ -59,7 +56,7 @@ public abstract class AbstractBenchmarkBase {
 
         final ChainedOptionsBuilder runnerOptions = new OptionsBuilder()
                 .include(".*" + className + ".*")
-                .jvmArgs(JVM_ARGS);
+                .jvmArgs(getJvmArgs());
 
         if (getWarmupIterations() > 0) {
             runnerOptions.warmupIterations(getWarmupIterations());
@@ -104,7 +101,11 @@ public abstract class AbstractBenchmarkBase {
     }
 
     protected String getReportDir() {
-        return System.getProperty("benchmark.dir", DEFAULT_BENCHMARK_DIRECTORY);
+        return System.getProperty("benchmarkReportDir", DEFAULT_BENCHMARK_DIRECTORY);
+    }
+
+    protected String[] getJvmArgs() {
+        return System.getProperty("jvmArgs", DEFAULT_JVM_ARGS).split(" ");
     }
 
     private int getIntProperty(final String propertyName, final int defaultValue) {


[21/50] tinkerpop git commit: Merge branch 'tp31' into tp32

Posted by sp...@apache.org.
Merge branch 'tp31' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: 0fd2666abb11681e022598db2449f1368ed580d7
Parents: 6613178 8141403
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Mar 29 10:50:33 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Mar 29 10:50:33 2017 -0400

----------------------------------------------------------------------
 docs/src/dev/developer/for-committers.asciidoc | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/0fd2666a/docs/src/dev/developer/for-committers.asciidoc
----------------------------------------------------------------------


[22/50] tinkerpop git commit: Faunus love - CTR

Posted by sp...@apache.org.
Faunus love - CTR


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

Branch: refs/heads/TINKERPOP-1577
Commit: b831ae84d1f5cc768896d62c97328df32228069f
Parents: 8141403
Author: Robert Dale <ro...@gmail.com>
Authored: Wed Mar 29 11:18:21 2017 -0400
Committer: Robert Dale <ro...@gmail.com>
Committed: Wed Mar 29 11:18:21 2017 -0400

----------------------------------------------------------------------
 docs/src/reference/the-graphcomputer.asciidoc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b831ae84/docs/src/reference/the-graphcomputer.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/the-graphcomputer.asciidoc b/docs/src/reference/the-graphcomputer.asciidoc
index 9cbef01..fb4331a 100644
--- a/docs/src/reference/the-graphcomputer.asciidoc
+++ b/docs/src/reference/the-graphcomputer.asciidoc
@@ -89,7 +89,7 @@ g.V().valueMap('name',PageRankVertexProgram.PAGE_RANK)
 NOTE: This model of "vertex-centric graph computing" was made popular by Google's
 link:http://googleresearch.blogspot.com/2009/06/large-scale-graph-computing-at-google.html[Pregel] graph engine.
 In the open source world, this model is found in OLAP graph computing systems such as link:https://giraph.apache.org/[Giraph],
-link:https://hama.apache.org/[Hama], and link:http://faunus.thinkaurelius.com[Faunus]. TinkerPop3 extends the
+link:https://hama.apache.org/[Hama]. TinkerPop3 extends the
 popularized model with integrated post-processing <<mapreduce,MapReduce>> jobs over the vertex set.
 
 [[mapreduce]]
@@ -398,7 +398,7 @@ the same traversal executed using either the standard OTLP-engine or the `GraphC
 being where the traversal is submitted.
 
 NOTE: This model of graph traversal in a BSP system was first implemented by the
-link:http://faunus.thinkaurelius.com[Faunus] graph analytics engine and originally described in
+link:https://github.com/thinkaurelius/faunus/wiki[Faunus] graph analytics engine and originally described in
 link:http://markorodriguez.com/2011/04/19/local-and-distributed-traversal-engines/[Local and Distributed Traversal Engines].
 
 [gremlin-groovy,modern]
@@ -475,7 +475,7 @@ sideEffect.
 computational limits can easily be reached due the link:http://en.wikipedia.org/wiki/Combinatorial_explosion[combinatoric explosion]
 of data. With path computing enabled, every traverser is unique and thus, must be enumerated as opposed to being
 counted/merged. The difference being a collection of paths vs. a single 64-bit long at a single vertex. For more
-information on this concept, please see link:http://thinkaurelius.com/2012/11/11/faunus-provides-big-graph-data-analytics/[Faunus Provides Big Graph Data].
+information on this concept, please see link:https://thinkaurelius.wordpress.com/2012/11/11/faunus-provides-big-graph-data-analytics/[Faunus Provides Big Graph Data].
 . When traversals of the form `x.as('a').y.someSideEffectStep('a').z` are evaluated, the `a` object is stored in the
 path information of the traverser and thus, such traversals (may) turn on path calculations when executed on a
 `GraphComputer`


[09/50] tinkerpop git commit: Merge branch 'tp31' into tp32

Posted by sp...@apache.org.
Merge branch 'tp31' into tp32


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

Branch: refs/heads/TINKERPOP-1577
Commit: 77ef86b0c725860ba9cceb58de23113030d408e4
Parents: d19bac0 7def039
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Mar 27 14:27:05 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Mar 27 14:27:05 2017 -0400

----------------------------------------------------------------------

----------------------------------------------------------------------



[07/50] tinkerpop git commit: TINKERPOP-1654 Fixed compilation errors after jackson version bump

Posted by sp...@apache.org.
TINKERPOP-1654 Fixed compilation errors after jackson version bump

Jackson removed a deprecated method. Called the replacement method instead.


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

Branch: refs/heads/TINKERPOP-1577
Commit: 380646cf1df466925af8ed830fba8858cb8c49b3
Parents: 7db459b
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Mar 27 07:56:44 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Mar 27 07:56:44 2017 -0400

----------------------------------------------------------------------
 .../gremlin/structure/io/graphson/GraphSONTypeDeserializer.java | 2 +-
 .../gremlin/structure/io/graphson/GraphSONTypeIdResolver.java   | 5 -----
 2 files changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/380646cf/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java
index 9e6bd1e..6734506 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeDeserializer.java
@@ -154,7 +154,7 @@ public class GraphSONTypeDeserializer extends TypeDeserializerBase {
 
                 if (typeName != null && valueDetected) {
                     // Type has been detected pattern detected.
-                    final JavaType typeFromId = idRes.typeFromId(typeName);
+                    final JavaType typeFromId = idRes.typeFromId(null, typeName);
 
                     if (!baseType.isJavaLangObject() && !baseType.equals(typeFromId)) {
                         throw new InstantiationException(

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/380646cf/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java
index 183e11a..dda06e2 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONTypeIdResolver.java
@@ -92,11 +92,6 @@ public class GraphSONTypeIdResolver implements TypeIdResolver {
     }
 
     @Override
-    public JavaType typeFromId(final String s) {
-        return typeFromId(null, s);
-    }
-
-    @Override
     public JavaType typeFromId(final DatabindContext databindContext, final String s) {
         // Get the type from the string from the stored Map. If not found, default to deserialize as a String.
         return getIdToType().containsKey(s)