[
https://issues.apache.org/jira/browse/TINKERPOP3-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14606416#comment-14606416
]
Daniel Kuppitz commented on TINKERPOP3-754:
-------------------------------------------
Ok, [~mhfrantz]'s suggestion looks good. If you know your schema then it's also
not a big deal to include the optional fields, if you really want to:
{code}
gremlin> g.V().match(
gremlin> __.as("v").outE().count().as("outD"),
gremlin> __.as("v").inE().count().as("inD")
gremlin> ).select("v").by(valueMap()).choose(select("age"),
gremlin> select("name","age","outD","inD"),
gremlin> select("name","lang","outD","inD"))
==>[name:[marko], age:[29], outD:3, inD:0]
==>[name:[vadas], age:[27], outD:0, inD:1]
==>[name:[lop], lang:[java], outD:0, inD:3]
==>[name:[josh], age:[32], outD:2, inD:1]
==>[name:[ripple], lang:[java], outD:0, inD:1]
==>[name:[peter], age:[35], outD:1, inD:0]
{code}
But I also like how software vertices are filtered out if you do:
{code}
g.V().match(
__.as("v").outE().count().as("outD"),
__.as("v").inE().count().as("inD")
).select("v").by(valueMap()).select("name","age","outD","inD")
{code}
So, I guess {{.select()}} is going to be our {{.merge()}} step.
> 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)