[ 
https://issues.apache.org/jira/browse/TINKERPOP-1541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15642272#comment-15642272
 ] 

Robert Dale commented on TINKERPOP-1541:
----------------------------------------

I would have expected a later label to overwrite any previous label of the same 
name, not add to a list. Other than this seeming to be a really odd thing to 
do, I was curious enough to do some digging.

[Select Step|http://tinkerpop.apache.org/docs/current/reference/#select-step] 
doesn't really seem to document this behavior other than this:
{quote}
NOTE: When executing a traversal with select() on a standard traversal engine 
(i.e. OLTP), select() will do its best to avoid calculating the path history 
and instead, will rely on a global data structure for storing the currently 
selected object.
{quote}

I'm not sure what the correct interpretation is. My interpretation is that only 
the 'current' object is selected minus path, or effectively, the last 
assignment overwrites any previous assignment.  But it could also include the 
path history. It sounds a little wishy-washy so that leaves me wondering two 
things: 1) what exactly is the path information, and 2) how do I know when I'm 
going to get what? That is, when will I get the current object (and of what?) 
or the path or is the current object the path??

Let's use examples.
{noformat}
gremlin> g.V().as('a').select('a').as('a').select('a')
==>[v[0],v[0]]
{noformat}

Above, it looks like we have a path. The first element is the first 'a' and the 
second is the second 'a'. Pretty simple.

{noformat}
gremlin> g.V().as('a').select('a').as('a').select('a').as('a').select('a')
==>[v[0],v[0],[v[0],v[0]]]
{noformat}

Above, again we have the first element is the first 'a' and the second is the 
second 'a'.  But where it gets more interesting is the third element.  This is 
the path result from the second step. So I think this reinforces the idea that 
if using the same label repeatedly, you are in fact building a path of paths. 
However, if it should be selecting the 'current object', and it can be a path, 
then I might expect to see only 
{noformat}
[v[0],v[0]]
{noformat}

The other question might be is this just marking steps along a path instead of 
building a path?  If so, then should this query be equivalent?
{noformat}
gremlin> 
g.V().as('a').select('a').as('b').select('b').as('c').select('c').select('a','b','c')
==>[a:v[0],b:v[0],c:v[0]]
{noformat}

So similarly I might expect:
{noformat}
gremlin> g.V().as('a').select('a').as('a').select('a').as('a').select('a')
==>[v[0],v[0],v[0]]
{noformat}

But if you're saying what I think you're saying, then what you're really saying 
is that while select is building path under the covers, it's not accessible and 
instead you get only the current object, which is not a path.  Thus, 
{noformat}
gremlin> g.V().as('a').select('a').as('a').select('a').as('a').select('a')
==>v[0]
{noformat}

Sorry, didn't answer your question. Haven't had much sleep.  HTH.  :)





> Should repeated objects be returned for the same label?
> -------------------------------------------------------
>
>                 Key: TINKERPOP-1541
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1541
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.2.3
>            Reporter: Marko A. Rodriguez
>              Labels: breaking
>
> Check this out:
> {code}
> gremlin> g.V().as('a').select('a').as('a').select('a')
> ==>[v[1],v[1]]
> ==>[v[2],v[2]]
> ==>[v[3],v[3]]
> ==>[v[4],v[4]]
> ==>[v[5],v[5]]
> ==>[v[6],v[6]]
> {code}
> Shouldn't we just return the uniques? This is a big decision as this can 
> cause massive rippling breakage for users :).



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

Reply via email to