[ 
https://issues.apache.org/jira/browse/TINKERPOP-968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15126331#comment-15126331
 ] 

Marko A. Rodriguez commented on TINKERPOP-968:
----------------------------------------------

First, we would not do this as this is not in the conventional language scope:

{code}
g.V().hasLabel('A').out(true, 'ab').out(true, 'bc')
{code}

For your next representation:

{code}
g.V().hasLabel('A').optional(out('ab')).optional(out('bc'))
{code}

depending on the semantics of optional, it would be either of the two:

{code}
g.V().hasLabel('A').coalesce(out('ab'),identity()).coalesce(out('bc'),identity())
{code}

or

{code}
g.V().hasLabel('A').union(out('ab'),identity()).union(out('bc'),identity())
{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)

Reply via email to