[ 
https://issues.apache.org/jira/browse/TINKERPOP3-974?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebastian Estevez updated TINKERPOP3-974:
-----------------------------------------
    Description: 
It would be very useful to be able to do something like this:

{code}
gremlin> possibleFriends = 
out('rated').inE('rated').has('stars',5).outV().groupCount().order(local).by(valueDecr).limit(local,1).mapKeys()
gremlin> g.V('u2590').map(possibleFriends)
{code}

Marko suggested the following workaround method using `; null` and `.clone()` 

{code}
gremlin> possibleFriends = 
out('rated').inE('rated').has('stars',5).outV().groupCount().order(local).by(valueDecr).limit(local,1).mapKeys();
 null
==>null
gremlin> g.V('u2590').map(possibleFriends.clone())
==>v[u4277]
gremlin> g.V('u2590').map(possibleFriends.clone())
==>v[u4277]
gremlin> g.V('u2590').map(possibleFriends.clone())
==>v[u4277]
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends
gremlin> g.V('u2590').map(possibleFriends.clone())
The traversal strategies are complete and the traversal can no longer be 
modulated
Display stack trace? [yN]
{code}

https://gist.github.com/okram/9feb6940c749ed9a3058

Having a nice way of breaking down complex gremlin into functions and using 
them later would help modularize gremlin queries and improve readability and 
maintenance.

  was:
It would be very useful to be able to do something like this:

{code}
gremlin> possibleFriends = 
out('rated').inE('rated').has('stars',5).outV().groupCount().order(local).by(valueDecr).limit(local,1).mapKeys()
gremlin> g.V('u2590').map(possibleFriends)
{code}

Marko suggested the following workaround method using `; null` and `.clone()` 

{code}
gremlin> possibleFriends = 
out('rated').inE('rated').has('stars',5).outV().groupCount().order(local).by(valueDecr).limit(local,1).mapKeys();
 null
==>null
gremlin> g.V('u2590').map(possibleFriends.clone())
==>v[u4277]
gremlin> g.V('u2590').map(possibleFriends.clone())
==>v[u4277]
gremlin> g.V('u2590').map(possibleFriends.clone())
==>v[u4277]
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends.clone()
gremlin> possibleFriends
gremlin> g.V('u2590').map(possibleFriends.clone())
The traversal strategies are complete and the traversal can no longer be 
modulated
Display stack trace? [yN]
{code}

https://gist.github.com/okram/9feb6940c749ed9a3058


> Saving headless traversals (clone Iterator Fun)
> -----------------------------------------------
>
>                 Key: TINKERPOP3-974
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP3-974
>             Project: TinkerPop 3
>          Issue Type: New Feature
>            Reporter: Sebastian Estevez
>
> It would be very useful to be able to do something like this:
> {code}
> gremlin> possibleFriends = 
> out('rated').inE('rated').has('stars',5).outV().groupCount().order(local).by(valueDecr).limit(local,1).mapKeys()
> gremlin> g.V('u2590').map(possibleFriends)
> {code}
> Marko suggested the following workaround method using `; null` and `.clone()` 
> {code}
> gremlin> possibleFriends = 
> out('rated').inE('rated').has('stars',5).outV().groupCount().order(local).by(valueDecr).limit(local,1).mapKeys();
>  null
> ==>null
> gremlin> g.V('u2590').map(possibleFriends.clone())
> ==>v[u4277]
> gremlin> g.V('u2590').map(possibleFriends.clone())
> ==>v[u4277]
> gremlin> g.V('u2590').map(possibleFriends.clone())
> ==>v[u4277]
> gremlin> possibleFriends.clone()
> gremlin> possibleFriends.clone()
> gremlin> possibleFriends.clone()
> gremlin> possibleFriends.clone()
> gremlin> possibleFriends.clone()
> gremlin> possibleFriends.clone()
> gremlin> possibleFriends
> gremlin> g.V('u2590').map(possibleFriends.clone())
> The traversal strategies are complete and the traversal can no longer be 
> modulated
> Display stack trace? [yN]
> {code}
> https://gist.github.com/okram/9feb6940c749ed9a3058
> Having a nice way of breaking down complex gremlin into functions and using 
> them later would help modularize gremlin queries and improve readability and 
> maintenance.



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

Reply via email to