Refine search
/** * Merges the results of an arbitrary number of traversals. * * @param unionTraversals the traversals to merge * @return the traversal with the appended {@link UnionStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#union-step" target="_blank">Reference Documentation - Union Step</a> * @since 3.0.0-incubating */ public default <E2> GraphTraversal<S, E2> union(final Traversal<?, E2>... unionTraversals) { this.asAdmin().getBytecode().addStep(Symbols.union, unionTraversals); return this.asAdmin().addStep(new UnionStep<>(this.asAdmin(), Arrays.copyOf(unionTraversals, unionTraversals.length, Traversal.Admin[].class))); }
/** * Map a {@link Traverser} referencing an object of type <code>E</code> to an object of type <code>E2</code>. * * @param function the lambda expression that does the functional mapping * @return the traversal with an appended {@link LambdaMapStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#general-steps" target="_blank">Reference Documentation - General Steps</a> * @since 3.0.0-incubating */ public default <E2> GraphTraversal<S, E2> map(final Function<Traverser<E>, E2> function) { this.asAdmin().getBytecode().addStep(Symbols.map, function); return this.asAdmin().addStep(new LambdaMapStep<>(this.asAdmin(), function)); }
/** * Map a {@link Traverser} referencing an object of type <code>E</code> to an object of type <code>E2</code>. * * @param mapTraversal the traversal expression that does the functional mapping * @return the traversal with an appended {@link LambdaMapStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#general-steps" target="_blank">Reference Documentation - General Steps</a> * @since 3.0.0-incubating */ public default <E2> GraphTraversal<S, E2> map(final Traversal<?, E2> mapTraversal) { this.asAdmin().getBytecode().addStep(Symbols.map, mapTraversal); return this.asAdmin().addStep(new TraversalMapStep<>(this.asAdmin(), mapTraversal)); }
/** * Map any object to a fixed <code>E</code> value. * * @return the traversal with an appended {@link ConstantStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#constant-step" target="_blank">Reference Documentation - Constant Step</a> * @since 3.0.0-incubating */ public default <E2> GraphTraversal<S, E2> constant(final E2 e) { this.asAdmin().getBytecode().addStep(Symbols.constant, e); return this.asAdmin().addStep(new ConstantStep<E, E2>(this.asAdmin(), e)); }
/** * Map the {@link Vertex} to its outgoing adjacent vertices given the edge labels. * * @param edgeLabels the edge labels to traverse * @return the traversal with an appended {@link VertexStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#vertex-steps" target="_blank">Reference Documentation - Vertex Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, Vertex> out(final String... edgeLabels) { this.asAdmin().getBytecode().addStep(Symbols.out, edgeLabels); return this.asAdmin().addStep(new VertexStep<>(this.asAdmin(), Vertex.class, Direction.OUT, edgeLabels)); }
/** * Determines the largest value in the stream. * * @return the traversal with an appended {@link MaxGlobalStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#max-step" target="_blank">Reference Documentation - Max Step</a> * @since 3.0.0-incubating */ public default <E2 extends Comparable> GraphTraversal<S, E2> max() { this.asAdmin().getBytecode().addStep(Symbols.max); return this.asAdmin().addStep(new MaxGlobalStep<>(this.asAdmin())); }
/** * Aggregates the emanating paths into a {@link Tree} data structure. * * @return the traversal with an appended {@link TreeStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#tree-step" target="_blank">Reference Documentation - Tree Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, Tree> tree() { this.asAdmin().getBytecode().addStep(Symbols.tree); return this.asAdmin().addStep(new TreeStep<>(this.asAdmin())); }
/** * Remove all duplicates in the traversal stream up to this point. * * @param dedupLabels if labels are provided, then the scoped object's labels determine de-duplication. No labels implies current object. * @return the traversal with an appended {@link DedupGlobalStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#dedup-step" target="_blank">Reference Documentation - Dedup Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> dedup(final String... dedupLabels) { this.asAdmin().getBytecode().addStep(Symbols.dedup, dedupLabels); return this.asAdmin().addStep(new DedupGlobalStep<>(this.asAdmin(), dedupLabels)); }
/** * Executes a Connected Component algorithm over the graph. * * @return the traversal with the appended {@link ConnectedComponentVertexProgram} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#connectedcomponent-step" target="_blank">Reference Documentation - ConnectedComponent Step</a> * @since 3.4.0 */ public default GraphTraversal<S, E> connectedComponent() { this.asAdmin().getBytecode().addStep(Symbols.connectedComponent); return this.asAdmin().addStep((Step<E, E>) new ConnectedComponentVertexProgramStep(this.asAdmin())); }
/** * Map the {@link Vertex} to its incoming incident edges given the edge labels. * * @param edgeLabels the edge labels to traverse * @return the traversal with an appended {@link VertexStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#vertex-steps" target="_blank">Reference Documentation - Vertex Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, Edge> inE(final String... edgeLabels) { this.asAdmin().getBytecode().addStep(Symbols.inE, edgeLabels); return this.asAdmin().addStep(new VertexStep<>(this.asAdmin(), Edge.class, Direction.IN, edgeLabels)); }
/** * Map the {@link Vertex} to its incident edges given the edge labels. * * @param edgeLabels the edge labels to traverse * @return the traversal with an appended {@link VertexStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#vertex-steps" target="_blank">Reference Documentation - Vertex Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, Edge> bothE(final String... edgeLabels) { this.asAdmin().getBytecode().addStep(Symbols.bothE, edgeLabels); return this.asAdmin().addStep(new VertexStep<>(this.asAdmin(), Edge.class, Direction.BOTH, edgeLabels)); }
/** * Map the {@link Edge} to its incident vertices. * * @return the traversal with an appended {@link EdgeVertexStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#vertex-steps" target="_blank">Reference Documentation - Vertex Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, Vertex> bothV() { this.asAdmin().getBytecode().addStep(Symbols.bothV); return this.asAdmin().addStep(new EdgeVertexStep(this.asAdmin(), Direction.BOTH)); }
/** * Map the {@link Edge} to the incident vertex that was not just traversed from in the path history. * * @return the traversal with an appended {@link EdgeOtherVertexStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#vertex-steps" target="_blank">Reference Documentation - Vertex Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, Vertex> otherV() { this.asAdmin().getBytecode().addStep(Symbols.otherV); return this.asAdmin().addStep(new EdgeOtherVertexStep(this.asAdmin())); }
/** * Map the {@link Property} to its {@link Property#value}. * * @return the traversal with an appended {@link PropertyValueStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#value-step" target="_blank">Reference Documentation - Value Step</a> * @since 3.0.0-incubating */ public default <E2> GraphTraversal<S, E2> value() { this.asAdmin().getBytecode().addStep(Symbols.value); return this.asAdmin().addStep(new PropertyValueStep<>(this.asAdmin())); }
/** * Organize objects in the stream into a {@code Map}. Calls to {@code group()} are typically accompanied with * {@link #by()} modulators which help specify how the grouping should occur. * * @return the traversal with an appended {@link GroupStep}. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#group-step" target="_blank">Reference Documentation - Group Step</a> * @since 3.1.0-incubating */ public default <K, V> GraphTraversal<S, Map<K, V>> group() { this.asAdmin().getBytecode().addStep(Symbols.group); return this.asAdmin().addStep(new GroupStep<>(this.asAdmin())); }
/** * Map the {@link Traverser} to a {@link Double} according to the mathematical expression provided in the argument. * * @param expression the mathematical expression with variables refering to scope variables. * @return the traversal with the {@link MathStep} added. * @since 3.3.1 */ public default GraphTraversal<S, Double> math(final String expression) { this.asAdmin().getBytecode().addStep(Symbols.math, expression); return this.asAdmin().addStep(new MathStep<>(this.asAdmin(), expression)); }
/** * Provides a way to add arbitrary objects to a traversal stream. * * @param injections the objects to add to the stream * @return the traversal with an appended {@link InjectStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#inject-step" target="_blank">Reference Documentation - Inject Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> inject(final E... injections) { this.asAdmin().getBytecode().addStep(Symbols.inject, injections); return this.asAdmin().addStep(new InjectStep<>(this.asAdmin(), injections)); }
/** * Filters out the first {@code n} objects in the traversal. * * @param skip the number of objects to skip * @return the traversal with an appended {@link RangeGlobalStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#skip-step" target="_blank">Reference Documentation - Skip Step</a> * @since 3.3.0 */ public default GraphTraversal<S, E> skip(final long skip) { this.asAdmin().getBytecode().addStep(Symbols.skip, skip); return this.asAdmin().addStep(new RangeGlobalStep<>(this.asAdmin(), skip, -1)); }
/** * Eagerly collects objects up to this step into a side-effect. * * @param sideEffectKey the name of the side-effect key that will hold the aggregated objects * @return the traversal with an appended {@link AggregateStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#aggregate-step" target="_blank">Reference Documentation - Aggregate Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> aggregate(final String sideEffectKey) { this.asAdmin().getBytecode().addStep(Symbols.aggregate, sideEffectKey); return this.asAdmin().addStep(new AggregateStep<>(this.asAdmin(), sideEffectKey)); }
/** * Lazily aggregates objects in the stream into a side-effect collection. * * @param sideEffectKey the name of the side-effect key that will hold the aggregate * @return the traversal with an appended {@link StoreStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#store-step" target="_blank">Reference Documentation - Store Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> store(final String sideEffectKey) { this.asAdmin().getBytecode().addStep(Symbols.store, sideEffectKey); return this.asAdmin().addStep(new StoreStep<>(this.asAdmin(), sideEffectKey)); }