[
https://issues.apache.org/jira/browse/TINKERPOP3-968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15031374#comment-15031374
]
pieter martin commented on TINKERPOP3-968:
------------------------------------------
The {{RepeatStep}} can already lift arbitrary trees.
{{g.V().hasLabel('A').emit().repeat(out())}}
Part of the reason for this ticket is to be able to specify the subgraphs/trees
to return accurately and arguably in an easier to read manner.
Not using the RepeatStep I'd would prefer to write the {{optional}} idea as,
{noformat}
g.V().hasLabel('A').optional(out('ab')).optional(out('bc')).toList();
{noformat}
or
{noformat}
g.V().hasLabel('A').optional(out('ab').out('bc')).toList();
{noformat}
Are the semantics of {{optional}} that any and all nested {{VertexStep}} become
optional?
Are the two examples above equivalent?
Is the {{optional}} idea equivalent to the boolean {{out(true, 'ab')}} idea?
BTW, following on specifying the traversal accurately I should have written my
own example as,
{noformat}
g.V().hasLabel('A').out(true, 'ab').out(true, 'bc').toList();
{noformat}
> Add first class support for an optional traversal
> -------------------------------------------------
>
> Key: TINKERPOP3-968
> URL: https://issues.apache.org/jira/browse/TINKERPOP3-968
> Project: TinkerPop 3
> 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)