tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matt Frantz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TINKERPOP3-798) [Proposal] Rename mapKeys()/mapValues() to select(keys) and select(values).
Date Tue, 04 Aug 2015 21:12:05 GMT

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

Matt Frantz commented on TINKERPOP3-798:

Nice.  What about also supporting {{select}} from {{Element}}?  We currently have {{properties}},
{{propertyMap}}, {{values}}, and {{valueMap}} which feel like {{select}}.  If we extend {{SelectEnum}},
could we consolidate the API a bit further, or do we like the efficiency of these {{Element}}-centric
g.V().values('a') -> g.V().select(values, 'a')
g.V().map(values().fold()) -> g.V().select(values)
g.V().properties('a') -> g.V().select(properties, 'a')
g.V().map(properties().fold()) -> g.V().select(properties)
g.V().valueMap() -> g.V().select(valueMap)
g.V().valueMap().select('a', 'b') -> g.V().select(valueMap, 'a', 'b')
g.V().propertyMap() -> g.V().select(propertyMap)
g.V().propertyMap().select('a, 'b') -> g.V().select(propertyMap, 'a', 'b')

> [Proposal] Rename mapKeys()/mapValues() to select(keys) and select(values).
> ---------------------------------------------------------------------------
>                 Key: TINKERPOP3-798
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-798
>             Project: TinkerPop 3
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.0.0-incubating
>            Reporter: Marko A. Rodriguez
>            Assignee: Marko A. Rodriguez
> I don't like the terms {{mapKeys()}} and {{mapValues()}}. I think we should use "select"
as the term for all projections out of a tuple. For instance, we do:
> {code}
> select('a') // get the object referenced by 'a' out of the incoming map
> select('a','b') // get the objects referenced by 'a' and 'b' out of the incoming map
> {code}
> {{select()}} can even be used in situations that people don't typically think to use
> {code}
> gremlin> g.V().has('name','Die Hard').groupCount().by('name')
> ==>[Die Hard:1]
> gremlin> g.V().has('name','Die Hard').groupCount().by('name').select('Die Hard')
> ==>1
> gremlin> g.V().hasLabel('movie').groupCount().by('name').select('Die Hard','Toy Story','Jurassic
> ==>[Die Hard:1, Toy Story:1, Jurassic Park:1]
> {code}
> However, this assumes the keys are strings as {{select()}} only takes string arguments.
> I think for all "project scenarios" the term should be "select." Thus, instead of {{mapKeys()}}
and {{mapValues()}}, we have:
> {code}
> select(keys) : Map -> Set<String>
> select(values) : Map -> Collection<Object>
> {code}
> Moreover, I don't think these should be flatMap steps like {{mapXXX()}} as you are projecting
for EACH map (similar to how {{select('a','b')}} is not a flat map of a/b entires but maps
of a/b entries).
> This type of select is different than the others as you are not projecting out a value
for an entry (row + key -> value), but a Collection value for column (map + key/value ->
collection). Regardless, it is still a projection of the incoming map (or path!). 

This message was sent by Atlassian JIRA

View raw message