[ https://issues.apache.org/jira/browse/TINKERPOP-1628?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16448599#comment-16448599 ]
ASF GitHub Bot commented on TINKERPOP-1628: ------------------------------------------- Github user spmallette commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/844#discussion_r183485753 --- Diff: docs/src/reference/the-traversal.asciidoc --- @@ -2338,6 +2338,22 @@ g.V(1).as("a").repeat(out().as("a")).times(2).select(last, "a") g.V(1).as("a").repeat(out().as("a")).times(2).select(all, "a") ---- +In addition to the previously shown examples, where `select()` was used to select an element based on a static key, `select()` can also accept a traversal +that emits a key. + +WARNING: Since the key used by `select(<traversal>)` cannot be determined at compile time, the `TraversalSelectStep` enables full path tracking. + +[gremlin-groovy,modern] +---- +g.withSideEffect("alias", ["marko":"okram"]).V(). <1> + values("name").sack(assign). <2> + optional(select("alias").select(sack())) <3> +---- + +<1> Inject a name alias map and start the traversal from all vertices. +<2> Select all `name` values and store them as the current traverser's sack value. +<3> Optionally select the alias for the current name from the injected map. + --- End diff -- please add the two new `select()` methods to the list of "Additional References" below. > Implement TraversalSelectStep > ----------------------------- > > Key: TINKERPOP-1628 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1628 > Project: TinkerPop > Issue Type: Improvement > Components: process > Affects Versions: 3.3.0 > Reporter: Daniel Kuppitz > Assignee: Daniel Kuppitz > Priority: Major > > It should be possible to have nested {{select()}} or rather to select dynamic > keys. > {noformat} > gremlin> aliases = ["marko":"okram"] > gremlin> g.withSideEffect("a", aliases).V().hasLabel("person"). > values("name").as("n"). > optional(select("a").select(select("n"))) > ==>okram > ==>vadas > ==>josh > ==>peter > {noformat} > I know there are more steps that could / should allow traversals, but to me > {{select()}} seems to be the most important one (perhaps because the > workaround is / can be super expensive). -- This message was sent by Atlassian JIRA (v7.6.3#76005)