Matt Frantz created TINKERPOP3-675:
--------------------------------------

             Summary: select(local) applied to Element
                 Key: TINKERPOP3-675
                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-675
             Project: TinkerPop 3
          Issue Type: Improvement
          Components: process
            Reporter: Matt Frantz


{{select(local)}} currently works on {{Map}}, but it could be interpreted as a 
property value selector on {{Element}}.  Sounds like [~okram] considered making 
{{Element}} a {{Map}} implementation at one point, so it must not be a terrible 
idea.  This would give it approximately the semantics of {{valueMap}} with a 
few exceptions because of {{select}}'s "collections only when necessary" 
philosophy.

Scenario: Single property name with single cardinality emits single value.
{noformat}
gremlin> g = TinkerFactory.createModern().traversal()
gremlin> g.V().has('name', 'josh').select(local, 'age')
==>32
{noformat}

Scenario: Single property name with multi cardinality emits value as collection.
{noformat}
gremlin> g = TinkerFactory.createTheCrew().traversal()
gremlin> g.V().has('name', 'marko').select(local, 'location')
==>[san diego, santa cruz, brussels, santa fe]
{noformat}

Scenario: Multiple property names with single cardinality emits Map of single 
values.
{noformat}
gremlin> g = TinkerFactory.createModern().traversal()
gremlin> g.V().has('age', gte(30)).select(local, 'name', 'age')
==>[name:josh, age:32]
==>[name:peter, age:35]
{noformat}

Scenario: Multiple property names with mixed cardinality emits Map of mixed 
single and collection values.
{noformat}
gremlin> g = TinkerFactory.createTheCrew().traversal()
gremlin> g.V().has('location', gte('d')).select(local, 'name', 'location')
==>[name:marko, location:[san diego, santa cruz, brussels, santa fe]]
==>[name:stephen, location:[centreville, dulles, purcellville]]
==>[name:matthias, location:[bremen, baltimore, oakland, seattle]]
==>[name:daniel, location:[spremberg, kaiserslautern, aachen]]
{noformat}

Scenario: No property names emits a Map with all property values with mixed 
single and collection values.
{noformat}
gremlin> g = TinkerFactory.createTheCrew().traversal()
gremlin> g.V().has('location', gte('d')).select(local)
==>[name:marko, location:[san diego, santa cruz, brussels, santa fe]]
==>[name:stephen, location:[centreville, dulles, purcellville]]
==>[name:matthias, location:[bremen, baltimore, oakland, seattle]]
==>[name:daniel, location:[spremberg, kaiserslautern, aachen]]
{noformat}




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

Reply via email to