Repository: tinkerpop
Updated Branches:
  refs/heads/TRAVIS-TEST f90ae732e -> 409fada48


foo


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

Branch: refs/heads/TRAVIS-TEST
Commit: 409fada48163604fe78736ae200be41fa17f1af0
Parents: f90ae73
Author: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Authored: Tue Mar 13 08:21:00 2018 -0700
Committer: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Committed: Tue Mar 13 08:21:00 2018 -0700

----------------------------------------------------------------------
 .../traversal/strategy/decoration/SubgraphStrategy.java | 12 +++++++++++-
 .../decoration/SubgraphStrategyProcessTest.java         |  2 +-
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/409fada4/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
index d7b5557..734f24d 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategy.java
@@ -174,6 +174,8 @@ public final class SubgraphStrategy extends 
AbstractTraversalStrategy<TraversalS
             applyCriterion(edgeStepsToInsertFilterAfter, traversal, 
this.edgeCriterion);
         }
 
+        boolean addPathRequirement = false;
+
         // turn g.V().out() to g.V().outE().inV() only if there is an edge 
predicate otherwise
         for (final VertexStep<?> step : vertexSteps) {
             if (step.returnsEdge())
@@ -182,7 +184,8 @@ public final class SubgraphStrategy extends 
AbstractTraversalStrategy<TraversalS
                 TraversalHelper.insertAfterStep(new 
TraversalFilterStep<>(traversal, (Traversal) this.vertexCriterion.clone()), 
step, traversal);
             } else {
                 final VertexStep<Edge> someEStep = new VertexStep<>(traversal, 
Edge.class, step.getDirection(), step.getEdgeLabels());
-                final Step<Edge, Vertex> someVStep = step.getDirection() == 
Direction.BOTH ?
+                final boolean requiresPathRequirement;
+                final Step<Edge, Vertex> someVStep = (requiresPathRequirement 
= step.getDirection() == Direction.BOTH) ?
                         new EdgeOtherVertexStep(traversal) :
                         new EdgeVertexStep(traversal, 
step.getDirection().opposite());
 
@@ -194,9 +197,16 @@ public final class SubgraphStrategy extends 
AbstractTraversalStrategy<TraversalS
                     TraversalHelper.insertAfterStep(new 
TraversalFilterStep<>(traversal, this.edgeCriterion.clone()), someEStep, 
traversal);
                 if (null != this.vertexCriterion)
                     TraversalHelper.insertAfterStep(new 
TraversalFilterStep<>(traversal, this.vertexCriterion.clone()), someVStep, 
traversal);
+
+                addPathRequirement |= requiresPathRequirement;
             }
         }
 
+        if (addPathRequirement) {
+            final Traversal.Admin rootTraversal = 
TraversalHelper.getRootTraversal(traversal);
+            
RequirementsStrategy.addRequirements(rootTraversal.getStrategies(), 
TraverserRequirement.PATH);
+        }
+
         // turn g.V().properties() to g.V().properties().xxx
         // turn g.V().values() to g.V().properties().xxx.value()
         if (null != this.vertexPropertyCriterion) {

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/409fada4/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
----------------------------------------------------------------------
diff --git 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
index 6dac9b0..3e6596b 100644
--- 
a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
+++ 
b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/SubgraphStrategyProcessTest.java
@@ -290,7 +290,7 @@ public class SubgraphStrategyProcessTest extends 
AbstractGremlinProcessTest {
         assertEquals(2, 
sg.withPath().V(convertToVertexId("josh")).bothE().count().next().longValue());
         assertEquals(3, 
g.V(convertToVertexId("josh")).both().count().next().longValue());
 
-final Traversal<Vertex, Long> t = 
sg.withPath().V(convertToVertexId("josh")).both().count();
+final Traversal<Vertex, Long> t = 
sg./*withPath().*/V(convertToVertexId("josh")).both().count();
 try {
         assertEquals(2, t.next().longValue());
 } catch (IllegalStateException ex) {

Reply via email to