Hi David,
>> One has a patch attached, but I couldn't assign the jira to myself.
>
> Please submit a pull request.
I was looking at the traversal.asciidoc you attached to the ticket. You did the
following:
********************************
********************************
[[cap-step]]
Cap Step
~~~~~~~~
The `cap()`-step retrieves the value of the indicated step (indicated via the
step label) for output and not the traveral objects flowing through the
previous step.
[gremlin-groovy,modern]
----
gremlin> g.V().repeat(hasLabel('person').groupCount('m')).times(10)
<1>
==>v[1]
==>v[2]
==>v[4]
==>v[6]
gremlin> g.V().repeat(hasLabel('person').groupCount('m')).times(10).cap('m')
<2>
==>[v[1]:10, v[2]:10, v[4]:10, v[6]:10]
----
<1> For each vertex that is labeled as a person, include it in a group count,
and do this 10 times. But output each vertex that is a person.
<2> Output the groupCount results from the groupCount operation labeled 'm',
rather than the traversal objects representing the person vertexes.
********************************
********************************
Note [gremlin-groovy,modern] is analyzed by docs/preprocessor/preprocess.sh.
This is Daniel Kuppitz' work that goes through the docs and processes the code
fragments using GremlinScriptEngine, then writes the output to the docs. Thus,
your contribution should be:
********************************
********************************
[[cap-step]]
Cap Step
~~~~~~~~
The `cap()`-step retrieves the value of the indicated step (indicated via the
step label) for output and not the traveral objects flowing through the
previous step.
[gremlin-groovy,modern]
----
g.V().repeat(hasLabel('person').groupCount('m')).times(10) <1>
g.V().repeat(hasLabel('person').groupCount('m')).times(10).cap('m') <2>
----
<1> For each vertex that is labeled as a person, include it in a group count,
and do this 10 times. But output each vertex that is a person.
<2> Output the groupCount results from the groupCount operation labeled 'm',
rather than the traversal objects representing the person vertexes.
********************************
********************************
Then, before you push the doc update, you should build locally and make sure
everything looks good (in the README):
docs/preprocessor/preprocess.sh && mvn process-resources -Dasciidoc
If all is good, pull request!
Next, note that cap() is about sideEffects, not about step labels. Thus, I
would make your intro sentence read:
The `cap()`-step (*barrier*) iterates the traversal up to itself and
emits the sideEffect referenced by the provided key. If multiple keys are
provided, then a `Map<String,Object>` of sideEffects is emitted.
Finally, your example is sorta weird (apologies) as you don't "walk" in your
repeat(). Also, I would keep it simple and not have too many complex steps
involved (e.g. repeat()).
g.V().groupCount('a').by(label).groupCount('b').by(bothE().count()).cap('a')
g.V().groupCount('a').by(label).groupCount('b').by(bothE().count()).cap('a','b')
… this way people see both single parameter and multi-parameter cap() usages.
HTH,
Marko.
http://markorodriguez.com