[ https://issues.apache.org/jira/browse/TINKERPOP-968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15136418#comment-15136418 ]
pieter martin commented on TINKERPOP-968: ----------------------------------------- Turns out for the example above the {{optional}} (that I envisage) as {{coalesce(traversal, identity)}} is not equivalent. {code} g.V().hasLabel('A').coalesce(out('ab'),identity()).coalesce(out('bc'),identity()).path() {code} returns {code} [v[0], v[4], v[8]] [v[0], v[6], v[6]] [v[2], v[2], v[2]] {code} Instead I am expecting, {code} [v[0], v[4], v[8]] [v[0], v[6]] [v[2]] {code} The identity() being passed along is not behaving optionally but rather coalescy. Thoughts? > Add first class support for an optional traversal > ------------------------------------------------- > > Key: TINKERPOP-968 > URL: https://issues.apache.org/jira/browse/TINKERPOP-968 > Project: TinkerPop > Issue Type: Improvement > Components: process > Affects Versions: 3.1.0-incubating > Reporter: pieter martin > > Both SparQL and Cypher use the "Optional" keyword to indicate an optional > traversal. SQL uses the "left join". > Gremlin has no first class support for an optional traversal. It can be > achieved with the choose step but it is verbose, unintuitive and not what the > choose step is intended for. > The benefits of optional traversals are many. In particular it makes it > trivial to load complete subgraphs/trees with one easy to read intuitive > gremlin statement. -- This message was sent by Atlassian JIRA (v6.3.4#6332)