This is an automated email from the ASF dual-hosted git repository. valentyn pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tinkerpop.git
commit eeaf6b14155a8bbbfcfbd2135b7dd0833be5af36 Merge: d454934391 7fbc3b9c6d Author: Valentyn Kahamlyk <[email protected]> AuthorDate: Thu Jul 27 16:55:40 2023 -0700 resolve merge conflicts CHANGELOG.asciidoc | 3 ++- .../gremlin/process/traversal/step/map/MergeEdgeStep.java | 5 +++++ .../process/traversal/step/map/MergeVertexStep.java | 8 ++++++-- .../tinkerpop/gremlin/test/features/map/MergeEdge.feature | 15 +++++++++++++++ .../gremlin/test/features/map/MergeVertex.feature | 13 ++++++++++++- 5 files changed, 40 insertions(+), 4 deletions(-) diff --cc gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MergeVertexStep.java index ed1e26a34a,a976775a99..1b7ba4bafc --- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MergeVertexStep.java +++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/MergeVertexStep.java @@@ -28,9 -28,8 +28,8 @@@ import java.util.stream.Stream 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.GraphTraversal; +import org.apache.tinkerpop.gremlin.process.traversal.lambda.CardinalityValueTraversal; - import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AddPropertyStep; + import org.apache.tinkerpop.gremlin.process.traversal.lambda.ConstantTraversal; import org.apache.tinkerpop.gremlin.process.traversal.step.util.event.Event; import org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.EventStrategy; import org.apache.tinkerpop.gremlin.structure.Graph; diff --cc gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeVertex.feature index 9a7dd5609f,fec2f9a637..5c454ce851 --- a/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeVertex.feature +++ b/gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeVertex.feature @@@ -828,131 -828,13 +828,142 @@@ Feature: Step - mergeV( When iterated to list Then the traversal will raise an error with message containing text of "Property key can not be a hidden key: ~label" + @MultiMetaProperties + Scenario: g_mergeVXname_markoX_optionXonMatch_age_listX33XX + Given the empty graph + And the graph initializer of + """ + g.addV("person").property("name", "marko").property(Cardinality.list, "age", 29).property(Cardinality.list, "age", 31).property(Cardinality.list, "age", 32) + """ + And the traversal of + """ + g.mergeV([name: "marko"]). + option(Merge.onMatch, [age: Cardinality.list(33)]) + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\", 33)" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\")" + And the graph should return 4 for count of "g.V().has(\"person\",\"name\",\"marko\").properties(\"age\")" + + @MultiMetaProperties + Scenario: g_mergeVXname_markoX_optionXonMatch_age_setX33XX + Given the empty graph + And the graph initializer of + """ + g.addV("person").property("name", "marko").property(Cardinality.list, "age", 29).property(Cardinality.list, "age", 31).property(Cardinality.list, "age", 32) + """ + And the traversal of + """ + g.mergeV([name: "marko"]). + option(Merge.onMatch, [age: Cardinality.set(33)]) + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\", 33)" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\")" + And the graph should return 4 for count of "g.V().has(\"person\",\"name\",\"marko\").properties(\"age\")" + + @MultiMetaProperties + Scenario: g_mergeVXname_markoX_optionXonMatch_age_setX31XX + Given the empty graph + And the graph initializer of + """ + g.addV("person").property("name", "marko").property(Cardinality.list, "age", 29).property(Cardinality.list, "age", 31).property(Cardinality.list, "age", 32) + """ + And the traversal of + """ + g.mergeV([name: "marko"]). + option(Merge.onMatch, [age: Cardinality.set(31)]) + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\", 31)" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\")" + And the graph should return 3 for count of "g.V().has(\"person\",\"name\",\"marko\").properties(\"age\")" + + @MultiMetaProperties + Scenario: g_mergeVXname_markoX_optionXonMatch_age_singleX33XX + Given the empty graph + And the graph initializer of + """ + g.addV("person").property("name", "marko").property(Cardinality.list, "age", 29).property(Cardinality.list, "age", 31).property(Cardinality.list, "age", 32) + """ + And the traversal of + """ + g.mergeV([name: "marko"]). + option(Merge.onMatch, [age: Cardinality.single(33)]) + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\", 33)" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\")" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").properties(\"age\")" + + @MultiMetaProperties + Scenario: g_mergeVXname_markoX_optionXonMatch_age_33_singleX + Given the empty graph + And the graph initializer of + """ + g.addV("person").property("name", "marko").property(Cardinality.list, "age", 29).property(Cardinality.list, "age", 31).property(Cardinality.list, "age", 32) + """ + And the traversal of + """ + g.mergeV([name: "marko"]). + option(Merge.onMatch, [age: 33], Cardinality.single) + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\", 33)" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").has(\"age\")" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"marko\").properties(\"age\")" + + @MultiMetaProperties + Scenario: g_mergeVXname_markoX_optionXonMatch_name_allen_age_setX31X_singleX + Given the empty graph + And the graph initializer of + """ + g.addV("person").property("name", "marko").property(Cardinality.list, "age", 29).property(Cardinality.list, "age", 31).property(Cardinality.list, "age", 32) + """ + And the traversal of + """ + g.mergeV([name: "marko"]). + option(Merge.onMatch, [name: "allen", age: Cardinality.set(31)], single) + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 0 for count of "g.V().has(\"person\",\"name\",\"marko\")" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").has(\"age\", 31)" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").has(\"age\")" + And the graph should return 3 for count of "g.V().has(\"person\",\"name\",\"allen\").properties(\"age\")" + + @MultiMetaProperties + Scenario: g_mergeVXname_markoX_optionXonMatch_name_allen_age_singleX31X_singleX + Given the empty graph + And the graph initializer of + """ + g.addV("person").property("name", "marko").property(Cardinality.list, "age", 29).property(Cardinality.list, "age", 31).property(Cardinality.list, "age", 32) + """ + And the traversal of + """ + g.mergeV([name: "marko"]). + option(Merge.onMatch, [name: "allen", age: Cardinality.single(31)], single) + """ + When iterated to list + Then the result should have a count of 1 + And the graph should return 0 for count of "g.V().has(\"person\",\"name\",\"marko\")" + And the graph should return 0 for count of "g.V().has(\"person\",\"name\",\"allen\").has(\"age\", 33)" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").has(\"age\", 31)" + And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").has(\"age\")" - And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").properties(\"age\")" ++ And the graph should return 1 for count of "g.V().has(\"person\",\"name\",\"allen\").properties(\"age\")" ++ + # cannot use hidden namespace for label key for onMatch + Scenario: g_mergeV_hidden_label_key_onMatch_matched_prohibited + Given the empty graph + And using the parameter xx1 defined as "m[{\"~label\":\"vertex\"}]" + And the traversal of + """ + g.mergeV([:]).option(Merge.onMatch, xx1) + """ + When iterated to list - Then the traversal will raise an error with message containing text of "Property key can not be a hidden key: ~label" ++ Then the traversal will raise an error with message containing text of "Property key can not be a hidden key: ~label"
