[ https://issues.apache.org/jira/browse/TINKERPOP-968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15169293#comment-15169293 ]
Daniel Kuppitz commented on TINKERPOP-968: ------------------------------------------ Aren't you talking about 2 different scenarios? Only a nested {{optional()}} would be compiled to a nested {{choose()}}, no? {code} g.V().optional(out("knows")).optional(out("created")).path() // would be the same as: g.V().choose(out("knows"), out("knows"), identity()). choose(out("created"), out("created"), identity()).path() {code} and {code} g.V().optional(out("knows").optional(out("created"))).path() // would be the same as: g.V().choose(out("knows").choose(out("created"), out("created"), identity()), out("knows").choose(out("created"), out("created"), identity()), identity())).path() {code} Thus whether {{choose()}} is nested or not, would depend on how/where you use {{optional()}} > 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)