Skip to content

TINKERPOP-1084 Branch option tokens should be allowed to be traversals#1129

Merged
dkuppitz merged 1 commit intotp33from
TINKERPOP-1084
Jun 28, 2019
Merged

TINKERPOP-1084 Branch option tokens should be allowed to be traversals#1129
dkuppitz merged 1 commit intotp33from
TINKERPOP-1084

Conversation

@dkuppitz
Copy link
Contributor

@dkuppitz dkuppitz commented Jun 11, 2019

https://issues.apache.org/jira/browse/TINKERPOP-1084

Allow predicates and traversals to be used as options in BranchStep.

gremlin> g = TinkerFactory.createModern().traversal()
==>graphtraversalsource[tinkergraph[vertices:6 edges:6], standard]
gremlin> g.V().hasLabel("person").
......1>   project("name", "age", "comments").
......2>     by("name").
......3>     by("age").
......4>     by(branch(values("age")).
......5>          option(any, bothE().count()).
......6>          option(29, constant("almost old")).
......7>          option(__.is(32), constant("looks like josh")).
......8>          option(lt(29), constant("pretty young")).
......9>          option(lt(35), constant("younger than peter")).
.....10>          option(gte(30), constant("pretty old")).fold())
==>[name:marko,age:29,comments:[3,almost old,younger than peter]]
==>[name:vadas,age:27,comments:[1,pretty young,younger than peter]]
==>[name:josh,age:32,comments:[3,looks like josh,younger than peter,pretty old]]
==>[name:peter,age:35,comments:[1,pretty old]]

docker/build.sh -t -i passed.

I will squash the 2 commits before merging.

VOTE +1

@dkuppitz dkuppitz marked this pull request as ready for review June 12, 2019 16:49
@asfgit asfgit force-pushed the TINKERPOP-1084 branch 2 times, most recently from 277e34c to 7d202f7 Compare June 12, 2019 17:12
@spmallette
Copy link
Contributor

Nice that we didn't have to change the API on GraphTraversal to support this. A couple issues:

  1. I think some upgrade docs would be nice in this case, because this is a neat feature to call attention to.
  2. I think the test you added is fine, but the problem is that it doesn't validate operations for GLVs. I assume GLVs will work, but it would be nice to see a test added that would validate that.

@spmallette
Copy link
Contributor

VOTE +1

@dkuppitz dkuppitz merged commit 5f05bf1 into tp33 Jun 28, 2019
@spmallette spmallette deleted the TINKERPOP-1084 branch June 19, 2020 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants