[
https://issues.apache.org/jira/browse/TINKERPOP3-754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14606325#comment-14606325
]
Matt Frantz commented on TINKERPOP3-754:
----------------------------------------
If we feel that {{select()}} with no keys may be evil (as discussed in
TINKERPOP3-753), then it may follow that {{valueMap()}} with no keys is evil.
If you're willing to specify the keys, and you don't want heterogeneous maps,
then the current example motivating the proposed {{merge}} step could simply be
a {{select}}.
{noformat}
g.V().match(
__.as("v").outE().count().as("outDegree"),
__.as("v").inE().count().as("inDegree")).
select("v").by(valueMap()).select("name", "outDegree","inDegree")
{noformat}
There is no way to {{select}} an optional key, so we can't easily get the "age"
and "lang" keys.
> 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)