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

Stephen Mallette commented on TINKERPOP-2674:
---------------------------------------------

As kelvin mentioned, this behavior is expected - to demonstrate I removed 
{{simplePath()}} and added {{path()}} to show the output:

{code}
gremlin> g.V().
......1>   has('[avm]Design', 'uuid', 'SRC_UUID').as('r0').
......2>   select('r0').
......3>   repeat(__.in('inside')).
......4>     emit().
......5>     until(__.in('inside').count().is(0)).path()  
==>[v[0],v[0],v[4]]
==>[v[0],v[0],v[4],v[7]]
==>[v[0],v[0],v[4],v[13]]
==>[v[0],v[0],v[4],v[7],v[10]]
==>[v[0],v[0],v[4],v[13],v[16]]
{code}

You immediately hit a "simple path" at the {{select('r0')}}. If you really 
wanted that kind of traversal you would need to tell {[simplePath()}} where you 
wanted to evaluate the path from:

{code}
gremlin> g.V().
......1>   has('[avm]Design', 'uuid', 'SRC_UUID').as('r0').
......2>   select('r0').as('a').
......3>   repeat(__.in('inside').simplePath().from('a')).
......4>     emit().
......5>     until(__.in('inside').count().is(0))
==>v[4]
==>v[7]
==>v[13]
==>v[10]
==>v[16]
{code}

> `as('a')` step followed by `select('a')` not behaving as expected
> -----------------------------------------------------------------
>
>                 Key: TINKERPOP-2674
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2674
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: tinkergraph
>    Affects Versions: 3.5.1
>            Reporter: Fredrick Eisele
>            Priority: Major
>
> The inclusion of the `select()` step changes the result when it should not.
> Steps to replicate.
> Given a graph:
> {code:groovy}
> g.addV('[avm]Design').as('root').
>         property('VertexLabel','[avm]Design').
>         property('uuid','SRC_UUID').
>         property('[]Name', 'Axe').
>         addV('[]RootContainer').as('rc').
>         property('VertexLabel','[]RootContainer').
>         property('[]Name','Axe').
>         addV('[]Property').as('p1').
>         property('VertexLabel','[]Property').
>         property('[]XPosition','56').
>         addV('[]Value').as('v1').
>         property('VertexLabel','[]Value').
>         property('[]stuff','12').
>         addV('[]Property').as('p2').
>         property('VertexLabel','[]Property').
>         property('[]XPosition','80').
>         addV('[]Value').as('v2').
>         property('VertexLabel','[]Value').
>         property('[]stuff','90').
>         addE('inside').from('rc').to('root').
>         addE('inside').from('p1').to('rc').
>         addE('inside').from('v1').to('p1').
>         addE('inside').from('p2').to('rc').
>         addE('inside').from('v2').to('p2').
>         iterate()
> {code}
> The following two queries {color:#FF0000}*incorrectly*{color} produce 
> different results.
> This first query produces a list of all the vertices with the exception of 
> 'r0'.
> {code:groovy}
> g.V().
>   has('[avm]Design', 'uuid', 'SRC_UUID').as('r0').
>   repeat(__.in('inside').simplePath()).
>     emit().
>     until(__.in('inside').count().is(0)).
>   toList()
> {code}
> The addition of the `select('r0')` step in this query causes no vertices to 
> be returned.
> {code:groovy}
> g.V().
>   has('[avm]Design', 'uuid', 'SRC_UUID').as('r0').
>   select('r0').
>   repeat(__.in('inside').simplePath()).
>     emit().
>     until(__.in('inside').count().is(0)).
>   toList()
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to