[ 
https://issues.apache.org/jira/browse/TINKERPOP-3056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17817067#comment-17817067
 ] 

ASF GitHub Bot commented on TINKERPOP-3056:
-------------------------------------------

vkagamlyk commented on code in PR #2487:
URL: https://github.com/apache/tinkerpop/pull/2487#discussion_r1488216500


##########
gremlin-test/src/main/resources/org/apache/tinkerpop/gremlin/test/features/map/MergeEdge.feature:
##########
@@ -841,3 +841,45 @@ Feature: Step - mergeE()
       """
     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"
+
+  Scenario: 
g_V_mergeEXlabel_knows_out_marko_in_vadasX_optionXonMatch_sideEffectXpropertyXweight_0XX_constantXemptyXX
+    Given the empty graph
+    And the graph initializer of
+      """
+      g.addV("person").property("name", "marko").as("a").
+        addV("person").property("name", "vadas").as("b").
+        addE("knows").property("weight", 1).from("a").to("b")
+      """
+    And using the parameter xx1 defined as "m[{\"t[label]\": \"knows\", 
\"D[OUT]\":\"v[marko]\", \"D[IN]\":\"v[vadas]\"}]"
+    And the traversal of
+      """
+      g.V().mergeE(xx1).
+              option(Merge.onMatch, __.sideEffect(__.property("weight", 
0)).constant([:]))
+      """
+    When iterated to list
+    Then the result should have a count of 2
+    And the graph should return 2 for count of "g.V()"
+    And the graph should return 0 for count of 
"g.E().hasLabel(\"knows\").has(\"weight\",1)"
+    And the graph should return 1 for count of 
"g.E().hasLabel(\"knows\").has(\"weight\",0)"
+    And the graph should return 0 for count of 
"g.V().hasLabel(\"knows\").has(\"weight\")"
+
+  Scenario: 
g_mergeEXlabel_knows_out_marko_in_vadasX_optionXonMatch_sideEffectXpropertyXweight_0XX_constantXemptyXX
+    Given the empty graph
+    And the graph initializer of
+      """
+      g.addV("person").property("name", "marko").as("a").
+        addV("person").property("name", "vadas").as("b").
+        addE("knows").property("weight", 1).from("a").to("b")
+      """
+    And using the parameter xx1 defined as "m[{\"t[label]\": \"knows\", 
\"D[OUT]\":\"v[marko]\", \"D[IN]\":\"v[vadas]\"}]"
+    And the traversal of
+      """
+      g.mergeE(xx1).
+          option(Merge.onMatch, __.sideEffect(__.property("weight", 
0)).constant([:]))
+      """
+    When iterated to list
+    Then the result should have a count of 1
+    And the graph should return 2 for count of "g.V()"
+    And the graph should return 0 for count of 
"g.E().hasLabel(\"knows\").has(\"weight\",1)"
+    And the graph should return 1 for count of 
"g.E().hasLabel(\"knows\").has(\"weight\",0)"
+    And the graph should return 0 for count of 
"g.V().hasLabel(\"knows\").has(\"weight\")"

Review Comment:
   ```suggestion
       And the graph should return 0 for count of "g.V().has(\"weight\")"
   ```





> mergeE is updating vertices in certain conditions
> -------------------------------------------------
>
>                 Key: TINKERPOP-3056
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-3056
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.6.6
>            Reporter: Stephen Mallette
>            Priority: Blocker
>
> {code}
> gremlin> g.addV('mytestlabel').property(id, 'testA').property('timestamp', 
> 1).as('a').
> ......1>   addV('mytestlabel').property(id, 'testA2').property('timestamp', 
> 1).as('a2').
> ......2>   addE('mytestlabel').from('a').to('a2').property('timestamp', 
> 2).valueMap(true)
> ==>[id:2,label:mytestlabel,timestamp:2]
> gremlin> g.V().mergeE([(T.label):'mytestlabel', (Direction.from): 'testA', 
> (Direction.to):'testA2']).
> ......1> option(onMatch, sideEffect(property(single, 'timestamp', 
> 4).property(single, 'edgelabel', 'exists')).
> ......2> constant([:])).valueMap(true)
> ==>[id:2,label:mytestlabel,timestamp:2]
> ==>[id:2,label:mytestlabel,timestamp:2]
> gremlin> g.V().valueMap(true)
> ==>[id:testA2,label:mytestlabel,edgelabel:[exists],timestamp:[4]]
> ==>[id:testA,label:mytestlabel,edgelabel:[exists],timestamp:[4]]
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to