[ https://issues.apache.org/jira/browse/TINKERPOP-968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15211996#comment-15211996 ]
pieter martin commented on TINKERPOP-968: ----------------------------------------- After a discussion in hipchat it was decided that the semantics will stay as is via the {{choose}} step. i.e. The user must manually union the result if that is the desired outcome. {code} final TinkerGraph g = TinkerGraph.open(); Vertex a1 = g.addVertex(T.label, "A", "name", "a1"); Vertex b1 = g.addVertex(T.label, "B", "name", "b1"); a1.addEdge("ab", b1); GraphTraversal gt1 = g.traversal().V(a1).optional(__.out("ab", "bb")).path(); while (gt1.hasNext()) { System.out.println(gt1.next()); } {code} will return {code} [v[0], v[2]] {code} and not {code} [v[0], v[2]] [v[0]] {code} > 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)