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

ASF GitHub Bot commented on TINKERPOP-1508:
-------------------------------------------

Github user okram commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/472#discussion_r85862272
  
    --- Diff: 
gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/traversal/step/branch/ChooseStepTest.java
 ---
    @@ -38,7 +42,10 @@
             return Arrays.asList(
                     __.choose(values("name")).option("marko", 
out()).option(none, in()),
                     __.choose(values("name")).option("marko", 
in()).option(none, out()),
    -                __.choose(values("name")).option("josh", 
out()).option(none, in())
    +                __.choose(values("name")).option("josh", 
out()).option(none, in()),
    +                __.choose(out("knows").is(P.gt(0)), out("knows"), 
out("knows")),
    +                __.choose(out("knows").is(P.gt(0)), out("knows"), 
out("created")),
    +                __.choose(out("knows").is(P.gt(0)), out("knows"))
    --- End diff --
    
    Yea, I meant `count()`. I can add it before merge.


> Add choose(predicate,trueTraversal)
> -----------------------------------
>
>                 Key: TINKERPOP-1508
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1508
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: process
>    Affects Versions: 3.2.2
>            Reporter: Marko A. Rodriguez
>
> {{choose()}} supports 
> {{choose(predicateTraversal,trueTraversal,falseTraversal)}}.
> I have lots of code that does this:
> {code}
> choose(blah(), bloop(), identity())
> {code}
> That is, if the predicate traversal doesn't hold, I simply want the incoming 
> traverser to be emitted -- {{identity()}}. This is sort of like 
> {{optional()}}, but the predicate is something different from the branch. It 
> would be nice to be able to simply say:
> {code}
> choose(blah(),bloop())
> {code}
> ...where its understood that a "false" means {{identity()}}.



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

Reply via email to