@@ -454,8 +454,8 @@ image:side-effect-lambda.png[width=175,float=right]
454454[gremlin-groovy,modern]
455455----
456456g.V().hasLabel('person').sideEffect(System.out.&println) <1>
457- g.V().sideEffect(outE().count().aggregate(local, "o")).
458- sideEffect(inE().count().aggregate(local, "i")).cap("o","i") <2>
457+ g.V().sideEffect(outE().count().local( aggregate("o") )).
458+ sideEffect(inE().count().local( aggregate("i") )).cap("o","i") <2>
459459----
460460
461461<1> Whatever enters `sideEffect()` is passed to the next step, but some intervening process can occur.
@@ -596,26 +596,22 @@ link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gre
596596image::aggregate-step.png[width=800]
597597
598598The `aggregate()`-step (*sideEffect*) is used to aggregate all the objects at a particular point of traversal into a
599- `Collection`. The step is uses `Scope` to help determine the aggregating behavior. For `global` scope this means that
600- the step will use link:http://en.wikipedia.org/wiki/Eager_evaluation[eager evaluation] in that no objects continue on
601- until all previous objects have been fully aggregated. The eager evaluation model is crucial in situations
602- where everything at a particular point is required for future computation. By default, when the overload of
603- `aggregate()` is called without a `Scope`, the default is `global`. An example is provided below.
599+ `Collection`. By default, the step will use link:http://en.wikipedia.org/wiki/Eager_evaluation[eager evaluation] in that
600+ no objects continue on until all previous objects have been fully aggregated. The eager evaluation model is crucial in situations
601+ where everything at a particular point is required for future computation.
604602
605603[gremlin-groovy,modern]
606604----
607605g.V(1).out('created') <1>
608606g.V(1).out('created').aggregate('x') <2>
609- g.V(1).out('created').aggregate(global, 'x') <3>
610- g.V(1).out('created').aggregate('x').in('created') <4>
611- g.V(1).out('created').aggregate('x').in('created').out('created') <5>
607+ g.V(1).out('created').aggregate('x').in('created') <3>
608+ g.V(1).out('created').aggregate('x').in('created').out('created') <4>
612609g.V(1).out('created').aggregate('x').in('created').out('created').
613- where(without('x')).values('name') <6 >
610+ where(without('x')).values('name') <5 >
614611----
615612
616613<1> What has marko created?
617614<2> Aggregate all his creations.
618- <3> Identical to the previous line.
619615<3> Who are marko's collaborators?
620616<4> What have marko's collaborators created?
621617<5> What have marko's collaborators created that he hasn't created?
@@ -635,31 +631,23 @@ g.V().out('knows').aggregate('x').by('age').cap('x') <1>
635631
636632<1> The "age" property is not <<by-step,productive>> for all vertices and therefore those values are not included in the aggregation.
637633
638- For `local` scope the aggregation will occur in a link:http://en.wikipedia.org/wiki/Lazy_evaluation[lazy] fashion.
639-
640- NOTE: Prior to 3.4.3, `local` aggregation (i.e. lazy) evaluation was handled by `store()`-step.
634+ Aggregation can be controlled to occur in a link:http://en.wikipedia.org/wiki/Lazy_evaluation[lazy] fashion by using
635+ the step inside `local()`.
641636
642637[gremlin-groovy,modern]
643638----
644- g.V().aggregate(global, 'x').limit(1).cap('x')
645- g.V().aggregate(local, 'x').limit(1).cap('x')
646- g.withoutStrategies(EarlyLimitStrategy).V().aggregate(local,'x').limit(1).cap('x')
639+ g.V().aggregate('x').limit(1).cap('x')
640+ g.V().local(aggregate('x')).limit(1).cap('x')
647641----
648642
649- It is important to note that `EarlyLimitStrategy` introduced in 3.3.5 alters the behavior of `aggregate(local)`.
650- Without that strategy (which is installed by default), there are two results in the `aggregate()` side-effect even
651- though the interval selection is for 1 object. Realize that when the second object is on its way to the `range()`
652- filter (i.e. `[0..1]`), it passes through `aggregate()` and thus, stored before filtered.
653-
654643[gremlin-groovy,modern]
655644----
656- g.E().aggregate(local, 'x').by('weight').cap('x')
645+ g.E().local( aggregate('x') ).by('weight').cap('x')
657646----
658647
659648*Additional References*
660649
661650link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#aggregate(java.lang.String)++[`aggregate(String)`],
662- link:++https://tinkerpop.apache.org/javadocs/x.y.z/core/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.html#aggregate(org.apache.tinkerpop.gremlin.process.traversal.Scope,java.lang.String)++[`aggregate(Scope,String)`]
663651
664652[[all-step]]
665653=== All Step
0 commit comments