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

Marko A. Rodriguez commented on TINKERPOP3-754:
-----------------------------------------------

The example you provide is:

{code}
g.V().match(
      __.as("v").outE().count().as("outDegree"),
      __.as("v").inE().count().as("inDegree")).
   select("v").by(valueMap()).merge("outDegree","inDegree")
{code}

You don't need {{merge()}} if you do:

{code}
gremlin> g.V().match(
      __.as("v").outE().count().as("outDegree"),
      __.as("v").inE().count().as("inDegree")).
   select("v","outDegree","inDegree").by(valueMap()).by().by()
==>[v:[name:[marko], age:[29]], outDegree:3, inDegree:0]
==>[v:[name:[vadas], age:[27]], outDegree:0, inDegree:1]
==>[v:[name:[lop], lang:[java]], outDegree:0, inDegree:3]
==>[v:[name:[josh], age:[32]], outDegree:2, inDegree:1]
==>[v:[name:[ripple], lang:[java]], outDegree:0, inDegree:1]
==>[v:[name:[peter], age:[35]], outDegree:1, inDegree:0]
{code}

Is this not good because "v" has the the valueMap as a nested map?


> MergeStep
> ---------
>
>                 Key: TINKERPOP3-754
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-754
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>            Reporter: Daniel Kuppitz
>            Assignee: Marko A. Rodriguez
>
> Given the traversal in https://issues.apache.org/jira/browse/TINKERPOP3-753 I 
> thought it would be nice to have a step that lets us modify a {{sideEffect}} 
> map - basically {{store()}} for maps. For example:
> {code}
> g.V().match(
>       __.as("v").outE().count().as("outDegree"),
>       __.as("v").inE().count().as("inDegree")).
>    select("v").by(valueMap()).merge("outDegree","inDegree")
> {code}
> **Expected result:**
> {noformat}
> ==>[name=[marko], age=[29], inDegree=0, outDegree=3]
> ==>[name=[vadas], age=[27], inDegree=1, outDegree=0]
> ==>[name=[lop], lang=[java], inDegree=3, outDegree=0]
> ==>[name=[josh], age=[32], inDegree=1, outDegree=2]
> ==>[name=[ripple], lang=[java], inDegree=1, outDegree=0]
> ==>[name=[peter], age=[35], inDegree=0, outDegree=1]
> {noformat}
> Instead of {{.merge(keys...)}} we could also make it {{.merge(mapKey, 
> keys...)}} (which is probably better as it allows more flexible traversals).
> [~okram] already mentioned that {{merge()}} might not be the best name (and I 
> agree), so both - the name and the functionality - are still open for 
> discussions.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to