/** * Add a GraphQueryPipe to the end of the Pipeline. * If optimizations are enabled, then the the next steps can fold into a GraphQueryPipe compilation. * * @return the extended Pipeline */ public GremlinPipeline<S, Vertex> V() { return this.add(new GraphQueryPipe<Vertex>(Vertex.class)); }
/** * Add an IdPipe to the end of the Pipeline. * Emit the id of the incoming element. * * @return the extended Pipeline */ public GremlinPipeline<S, Object> id() { return this.add(new IdPipe()); }
/** * Add an AggregatePipe to the end of the Pipeline. * The objects prior to aggregate are greedily collected into the provided collection. * * @param aggregate the collection to aggregate results into * @return the extended Pipeline */ public GremlinPipeline<S, E> aggregate(final Collection<E> aggregate) { return this.add(new AggregatePipe<E>(aggregate)); }
/** * Add a LinkPipe to the end of the Pipeline. * Emit the incoming vertex, but have other vertex provide an incoming and outgoing edge to incoming vertex. * * @param label the edge label * @param other the other vertex * @return the extended Pipeline */ public GremlinPipeline<S, Vertex> linkBoth(final String label, final Vertex other) { return this.add(new LinkPipe(Direction.BOTH, label, other)); }
/** * Add a GraphQueryPipe to the end of the Pipeline. * If optimizations are enabled, then the the next steps can fold into a GraphQueryPipe compilation. * * @return the extended Pipeline */ public GremlinPipeline<S, Edge> E() { return this.add(new GraphQueryPipe<Edge>(Edge.class)); }
/** * Add a BothVerticesPipe to the end of the Pipeline. * Emit both the tail and head vertices of the incoming edge. * * @return the extended Pipeline */ public GremlinPipeline<S, Vertex> bothV() { return this.add(new BothVerticesPipe()); }
/** * Add a RandomFilterPipe to the end of the Pipeline. * A biased coin toss determines if the object is emitted or not. * * @param bias the bias of the random coin * @return the extended Pipeline */ public GremlinPipeline<S, E> random(final Double bias) { return this.add(new RandomFilterPipe<E>(bias)); }
/** * Add a GraphQueryPipe to the end of the Pipeline. * If optimizations are enabled, then the the next steps can fold into a GraphQueryPipe compilation. * * @param key they key that all the emitted vertices should be checked on * @param value the value that all the emitted vertices should have for the key * @return the extended Pipeline */ public GremlinPipeline<S, Vertex> V(final String key, final Object value) { return this.add(new GraphQueryPipe(Vertex.class)).has(key, value); }
/** * Add a FunctionPipe to the end of the pipeline. * The provide provided PipeFunction emits whatever is defined by the function. * This serves as an arbitrary step computation. * * @param function the function of the FunctionPipe * @return the extended Pipeline */ public GremlinPipeline<S, ?> step(final PipeFunction function) { return this.add(new FunctionPipe(FluentUtility.prepareFunction(this.asMap, function))); }
/** * Add a StorePipe to the end of the Pipeline. * Lazily store the object returned by the function over the incoming object into the provided collection. * * @param storage the collection to store results into * @param storageFunction the function to run over each object prior to insertion into the storage collection * @return the extended Pipeline */ public GremlinPipeline<S, E> store(final Collection storage, final PipeFunction<E, ?> storageFunction) { return this.add(new StorePipe<E>(storage, FluentUtility.prepareFunction(this.asMap, storageFunction))); }
/** * Add a TreePipe to the end of the Pipeline * This step maintains an internal tree representation of the paths that have flowed through the step. * * @param tree an embedded Map data structure to store the tree representation in * @param branchFunctions functions to apply to each path object in a round robin fashion * @return the extended Pipeline */ public GremlinPipeline<S, E> tree(final Tree tree, final PipeFunction... branchFunctions) { return this.add(new TreePipe<E>(tree, FluentUtility.prepareFunctions(this.asMap, branchFunctions))); }
/** * Add a TreePipe to the end of the Pipeline * This step maintains an internal tree representation of the paths that have flowed through the step. * * @param branchFunctions functions to apply to each path object in a round robin fashion * @return the extended Pipeline */ public GremlinPipeline<S, E> tree(final PipeFunction... branchFunctions) { return this.add(new TreePipe<E>(FluentUtility.prepareFunctions(this.asMap, branchFunctions))); }
/** * Add an OrderPipe to the end of the Pipeline. * This step will sort the objects in the stream in a default Comparable order. * * @param order if the stream is composed of comparable objects, then increment or decrement can be specified * @return the extended Pipeline */ public GremlinPipeline<S, E> order(Tokens.T order) { return this.add(new OrderPipe(Tokens.mapOrder(order))); }
/** * Add an OrderPipe to the end of the Pipeline. * This step will sort the objects in the stream according to a comparator defined in the provided function. * * @param compareFunction a comparator function of two objects of type E * @return the extended Pipeline */ public GremlinPipeline<S, E> order(final PipeFunction<Pair<E, E>, Integer> compareFunction) { return this.add(new OrderPipe(FluentUtility.prepareFunction(this.asMap, compareFunction))); }
/** * Add a GraphQueryPipe to the end of the Pipeline. * If optimizations are enabled, then the the next steps can fold into a GraphQueryPipe compilation. * * @param key they key that all the emitted edges should be checked on * @param value the value that all the emitted edges should have for the key * @return the extended Pipeline */ public GremlinPipeline<S, Edge> E(final String key, final Object value) { return this.add(new GraphQueryPipe(Edge.class)).has(key, value); }
/** * Add an AggregatePipe to the end of the Pipeline. * The results of the function evaluated on the objects prior to the aggregate are greedily collected into the provided collection. * * @param aggregate the collection to aggregate results into * @param aggregateFunction the function to run over each object prior to insertion into the aggregate * @return the extended Pipeline */ public GremlinPipeline<S, E> aggregate(final Collection aggregate, final PipeFunction<E, ?> aggregateFunction) { return this.add(new AggregatePipe<E>(aggregate, FluentUtility.prepareFunction(this.asMap, aggregateFunction))); }
/** * Add a PathPipe to the end of the Pipeline. * This will emit the path that has been seen thus far. * If path functions are provided, then they are evaluated in a round robin fashion on the objects of the path. * * @param pathFunctions the path function of the PathPipe * @return the extended Pipeline */ public GremlinPipeline<S, List> path(final PipeFunction... pathFunctions) { return this.add(new PathPipe<Object>(FluentUtility.prepareFunctions(this.asMap, pathFunctions))); }
/** * Add an ExhaustMergePipe to the end of the pipeline. * The one-step previous MetaPipe in the pipeline's pipes are used as the internal pipes. * The pipes' emitted objects are merged where the first pipe's objects are exhausted, then the second, etc. * * @return the extended Pipeline */ public GremlinPipeline<S, ?> exhaustMerge() { return this.add(new ExhaustMergePipe(((MetaPipe) FluentUtility.getPreviousPipe(this)).getPipes())); }
/** * Add a SelectPipe to the end of the Pipeline. * The objects of the named steps (via as) previous in the pipeline are emitted as a Row object. * A Row object extends ArrayList and simply provides named columns and some helper methods. * If column functions are provided, then they are evaluated in a round robin fashion on the objects of the Row. * * @param columnFunctions the functions to apply to the column objects prior to filling the Row * @return the extended Pipeline */ public GremlinPipeline<S, Row> select(final PipeFunction... columnFunctions) { return this.add(new SelectPipe(null, FluentUtility.getAsPipes(this), FluentUtility.prepareFunctions(this.asMap, columnFunctions))); }
/** * Add an OptionalPipe to the end of the Pipeline. * The section of pipeline back to the partition step is evaluated. * * @param namedStep the name of the step previous to optional back to * @return the extended Pipeline */ public GremlinPipeline<S, ?> optional(final String namedStep) { return this.add(new OptionalPipe(new Pipeline(FluentUtility.removePreviousPipes(this, namedStep)))); }