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 2018/12/11 01:47:00 UTC

[tinkerpop] 01/03: Fixed SubgraphStrategy configuration and derser using that config CTR

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 09b093f1171bd5fafed0504c734dee9a18ea093b
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Mon Dec 10 20:42:53 2018 -0500

    Fixed SubgraphStrategy configuration and derser using that config CTR
---
 CHANGELOG.asciidoc                                                | 1 +
 .../process/traversal/strategy/decoration/SubgraphStrategy.java   | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index bf40d6b..864d45c 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -25,6 +25,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 
 This release also includes changes from <<release-3-2-11, 3.2.11>>.
 
+* Fixed configuration and serialization of `SubgraphStrategy` which was missing the `checkAdjacentVertices` flag.
 * Captured `TraversalInterruptionException` and converted to `TimeoutException` for `GremlinExecutor`.
 * Fixed a bug in `CoalesceStep` which squared the bulk if the step followed a `Barrier` step.
 * Fixed a bug in `GroupStep` that assigned wrong reducing bi-operators
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 467689f..aa7398b 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
@@ -78,6 +78,7 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
     private final Traversal.Admin<Vertex, ?> vertexCriterion;
     private final Traversal.Admin<Edge, ?> edgeCriterion;
     private final Traversal.Admin<VertexProperty, ?> vertexPropertyCriterion;
+    private final boolean checkAdjacentVertices;
 
     private static final Set<Class<? extends DecorationStrategy>> POSTS = Collections.singleton(ConnectiveStrategy.class);
 
@@ -86,10 +87,11 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
     private SubgraphStrategy(final Builder builder) {
 
         this.vertexCriterion = null == builder.vertexCriterion ? null : builder.vertexCriterion.asAdmin().clone();
+        this.checkAdjacentVertices = builder.checkAdjacentVertices;
 
         // if there is no vertex predicate there is no need to test either side of the edge - also this option can
         // be simply configured in the builder to not be used
-        if (null == this.vertexCriterion || !builder.checkAdjacentVertices) {
+        if (null == this.vertexCriterion || !checkAdjacentVertices) {
             this.edgeCriterion = null == builder.edgeCriterion ? null : builder.edgeCriterion.asAdmin().clone();
         } else {
             final Traversal.Admin<Edge, ?> vertexPredicate;
@@ -290,6 +292,7 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
             map.put(EDGES, this.edgeCriterion);
         if (null != this.vertexPropertyCriterion)
             map.put(VERTEX_PROPERTIES, this.vertexPropertyCriterion);
+        map.put(CHECK_ADJACENT_VERTICES, this.checkAdjacentVertices);
         return new MapConfiguration(map);
     }
 
@@ -313,6 +316,7 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
     public static final String VERTICES = "vertices";
     public static final String EDGES = "edges";
     public static final String VERTEX_PROPERTIES = "vertexProperties";
+    public static final String CHECK_ADJACENT_VERTICES = "checkAdjacentVertices";
 
     public static SubgraphStrategy create(final Configuration configuration) {
         final Builder builder = SubgraphStrategy.build();
@@ -322,6 +326,8 @@ public final class SubgraphStrategy extends AbstractTraversalStrategy<TraversalS
             builder.edges((Traversal) configuration.getProperty(EDGES));
         if (configuration.containsKey(VERTEX_PROPERTIES))
             builder.vertexProperties((Traversal) configuration.getProperty(VERTEX_PROPERTIES));
+        if (configuration.containsKey(CHECK_ADJACENT_VERTICES))
+            builder.checkAdjacentVertices(configuration.getBoolean(CHECK_ADJACENT_VERTICES));
         return builder.create();
     }