This is an automated email from the ASF dual-hosted git repository.
spmallette pushed a commit to branch TINKERPOP-2112
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
The following commit(s) were added to refs/heads/TINKERPOP-2112 by this push:
new 4a13bda f
4a13bda is described below
commit 4a13bda017a2432e11d394d7493958146bb864dc
Author: Stephen Mallette <[email protected]>
AuthorDate: Tue Mar 12 08:44:13 2019 -0400
f
---
.../gremlin/process/traversal/dsl/graph/GraphTraversal.java | 13 +++++++------
.../traversal/strategy/decoration/EventStrategyTest.java | 2 +-
2 files changed, 8 insertions(+), 7 deletions(-)
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 eedbdbc..e27c97c 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
@@ -2092,6 +2092,7 @@ public interface GraphTraversal<S, E> extends
Traversal<S, E> {
endStep = endStep.getPreviousStep();
}
+ // edge properties can always be folded as there is no
cardinality/metaproperties. for a vertex mutation,
// it's possible to fold the property() into the Mutating step if
there are no metaproperties (i.e. keyValues)
// and if (1) the key is an instance of T OR OR (3) the key is a
string and the cardinality of the key can be
// determined from the graph to be single. EmptyGraph assumes list
cardinality as its default which means that
@@ -2105,12 +2106,12 @@ public interface GraphTraversal<S, E> extends
Traversal<S, E> {
//
// you could end up with whatever the cardinality is for the key which
might seem "wrong" if you were explicit
// about the specification of "single".
- if ((endStep instanceof AddVertexStep || endStep instanceof
AddEdgeStep ||
- endStep instanceof AddVertexStartStep || endStep instanceof
AddEdgeStartStep) &&
- keyValues.length == 0 &&
- (key instanceof T || (key instanceof String &&
- (null == cardinality &&
asAdmin().getGraph().orElse(EmptyGraph.instance()).
-
features().vertex().getCardinality((String) key) ==
VertexProperty.Cardinality.single)))) {
+ if ((endStep instanceof AddEdgeStep || endStep instanceof
AddEdgeStartStep) ||
+ ((endStep instanceof AddVertexStep || endStep instanceof
AddVertexStartStep) &&
+ keyValues.length == 0 &&
+ (key instanceof T || (key instanceof String &&
+ (null == cardinality &&
asAdmin().getGraph().orElse(EmptyGraph.instance()).
+
features().vertex().getCardinality((String) key) ==
VertexProperty.Cardinality.single))))) {
((Mutating) endStep).addPropertyMutations(key, value);
} else {
final AddPropertyStep<Element> addPropertyStep = new
AddPropertyStep<>(this.asAdmin(), cardinality, key, value);
diff --git
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyTest.java
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyTest.java
index 27d9b7e..8016c2a 100644
---
a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyTest.java
+++
b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/strategy/decoration/EventStrategyTest.java
@@ -48,7 +48,7 @@ public class EventStrategyTest {
{"addE(test).to(x)", new
DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").to("x"), 1},
{"addE(test).to(x).property(this,that)", new
DefaultGraphTraversal<>(EmptyGraph.instance()).addE("test").to("x").property("this",
"that"), 1},
{"addV()", new
DefaultGraphTraversal<>(EmptyGraph.instance()).addV(), 1},
- {"addV().property(k,v)", new
DefaultGraphTraversal<>(EmptyGraph.instance()).addV().property("test", "that"),
1},
+ {"addV().property(k,v)", new
DefaultGraphTraversal<>(EmptyGraph.instance()).addV().property("test", "that"),
2},
{"properties().drop()", new
DefaultGraphTraversal<>(EmptyGraph.instance()).properties().drop(), 1},
{"properties(k).drop()", new
DefaultGraphTraversal<>(EmptyGraph.instance()).properties("test").drop(), 1},
{"out().drop()", new
DefaultGraphTraversal<>(EmptyGraph.instance()).out().drop(), 1},