[
https://issues.apache.org/jira/browse/TINKERPOP-2430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17206097#comment-17206097
]
ASF GitHub Bot commented on TINKERPOP-2430:
-------------------------------------------
spmallette commented on a change in pull request #1336:
URL: https://github.com/apache/tinkerpop/pull/1336#discussion_r498754923
##########
File path: docs/src/recipes/looping.asciidoc
##########
@@ -0,0 +1,88 @@
+////
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements. See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+////
+[[looping]]
+== Looping
+One common use case when working with Gremlin is to perform complex looping
statements using the `repeat()` step. While many of the common patterns for
looping within traversals are discussed in the documentation there are several
more complex patterns that include additional steps which are also commonly
used. This section attempts to demonstrate how to use some of these more
complex measurements.
+
+image:tree-lca.png[width=230,float=right] The following examples will use this
graph depicted here:
+
+[gremlin-groovy]
+----
+g.addV().property(id, 'A').as('a').
+ addV().property(id, 'B').as('b').
+ addV().property(id, 'C').as('c').
+ addV().property(id, 'D').as('d').
+ addV().property(id, 'E').as('e').
+ addV().property(id, 'F').as('f').
+ addV().property(id, 'G').as('g').
+ addE('hasParent').from('a').to('b').
+ addE('hasParent').from('b').to('c').
+ addE('hasParent').from('d').to('c').
+ addE('hasParent').from('c').to('e').
+ addE('hasParent').from('e').to('f').
+ addE('hasParent').from('g').to('f').iterate()
+----
+
+=== Conditional Looping with Max Depth
+
+One common situation encountered when writing `repeat()` loop is the need to
exit the loop when either a specific condition is met or a maximum depth is
reached. Given that graph above the following traversal demonstrates how to
accomplish this type of complex exit condition. In this example the traversal
will start at vertex A and loop through all outgoing edges until it reaches
vertex C or it until it has completed 3 loops.
Review comment:
"or it until it has completed 3 loops"
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Looping Recipies
> ----------------
>
> Key: TINKERPOP-2430
> URL: https://issues.apache.org/jira/browse/TINKERPOP-2430
> Project: TinkerPop
> Issue Type: Improvement
> Components: documentation
> Reporter: Dave Bechberger
> Priority: Minor
>
> Create documentation recipes for common looping patterns including:
> Conditional Looping with Max Depth
> Emitting the Loop Depth
--
This message was sent by Atlassian Jira
(v8.3.4#803005)