Examples of VertexQueryPipe


Examples of com.tinkerpop.pipes.transform.VertexQueryPipe

                pipeline.addPipe(pipe);
        return pipeline;
    }

    public static boolean optimizePipelineForVertexQuery(final GremlinPipeline pipeline, final Pipe pipe) {
        VertexQueryPipe queryPipe = null;
        for (int i = pipeline.size() - 1; i > 0; i--) {
            final Pipe temp = pipeline.get(i);
            if (temp instanceof VertexQueryPipe) {
                queryPipe = (VertexQueryPipe) temp;
                break;
            } else if (!(temp instanceof IdentityPipe))
                break;
        }

        if (null != queryPipe) {
            if (pipe instanceof EdgesVerticesPipe) {
                if (queryPipe.getResultElementClass().equals(Vertex.class))
                    return false;
                queryPipe.setResultingElementClass(Vertex.class);
            } else if (pipe instanceof VerticesVerticesPipe) {
                if (queryPipe.getResultElementClass().equals(Vertex.class))
                    return false;
                queryPipe.setDirection(((VerticesVerticesPipe) pipe).getDirection());
                queryPipe.setLabels(((VerticesVerticesPipe) pipe).getLabels());
                queryPipe.setBranchFactor(((VerticesVerticesPipe) pipe).getBranchFactor());
            } else if (pipe instanceof VerticesEdgesPipe) {
                if (queryPipe.getResultElementClass().equals(Vertex.class))
                    return false;
                queryPipe.setResultingElementClass(Edge.class);
                queryPipe.setDirection(((VerticesEdgesPipe) pipe).getDirection());
                queryPipe.setLabels(((VerticesEdgesPipe) pipe).getLabels());
                queryPipe.setBranchFactor(((VerticesEdgesPipe) pipe).getBranchFactor());
            } else if (pipe instanceof PropertyFilterPipe) {
                if (queryPipe.getResultElementClass().equals(Vertex.class))
                    return false;
                final PropertyFilterPipe temp = (PropertyFilterPipe) pipe;
                queryPipe.addHasContainer(new QueryPipe.HasContainer(temp.getKey(), temp.getPredicate(), temp.getValue()));
            } else if (pipe instanceof IntervalFilterPipe) {
                if (queryPipe.getResultElementClass().equals(Vertex.class))
                    return false;
                final IntervalFilterPipe temp = (IntervalFilterPipe) pipe;
                queryPipe.addIntervalContainer(new QueryPipe.IntervalContainer(temp.getKey(), temp.getStartValue(), temp.getEndValue()));
            } else if (pipe instanceof RangeFilterPipe) {
                queryPipe.setLowRange(((RangeFilterPipe) pipe).getLowRange());
                queryPipe.setHighRange(((RangeFilterPipe) pipe).getHighRange());
            }
            pipeline.addPipe(new IdentityPipe());
            return true;
        } else {
            return false;
View Full Code Here

Examples of com.tinkerpop.pipes.transform.VertexQueryPipe

     * @param labels       the edge labels to traverse
     * @return the extended Pipeline
     */
    public GremlinPipeline<S, Edge> bothE(final int branchFactor, final String... labels) {
        return this.doQueryOptimization ?
                this.add(new VertexQueryPipe(Edge.class, Direction.BOTH, null, null, branchFactor, 0, Integer.MAX_VALUE, labels)) :
                this.add(new BothEdgesPipe(branchFactor, labels));
    }
View Full Code Here

Examples of com.tinkerpop.pipes.transform.VertexQueryPipe

     * @param labels       the edge labels to traverse
     * @return the extended Pipeline
     */
    public GremlinPipeline<S, Vertex> both(final int branchFactor, final String... labels) {
        return this.doQueryOptimization ?
                this.add(new VertexQueryPipe(Vertex.class, Direction.BOTH, null, null, branchFactor, 0, Integer.MAX_VALUE, labels)) :
                this.add(new BothPipe(branchFactor, labels));
    }
View Full Code Here

Examples of com.tinkerpop.pipes.transform.VertexQueryPipe

     * @param labels       the edge labels to traverse
     * @return the extended Pipeline
     */
    public GremlinPipeline<S, Edge> inE(final int branchFactor, final String... labels) {
        return this.doQueryOptimization ?
                this.add(new VertexQueryPipe(Edge.class, Direction.IN, null, null, branchFactor, 0, Integer.MAX_VALUE, labels)) :
                this.add(new InEdgesPipe(branchFactor, labels));
    }
View Full Code Here

Examples of com.tinkerpop.pipes.transform.VertexQueryPipe

     * @param labels       the edge labels to traverse
     * @return the extended Pipeline
     */
    public GremlinPipeline<S, Vertex> in(final int branchFactor, final String... labels) {
        return this.doQueryOptimization ?
                this.add(new VertexQueryPipe(Vertex.class, Direction.IN, null, null, branchFactor, 0, Integer.MAX_VALUE, labels)) :
                this.add(new InPipe(branchFactor, labels));
    }
View Full Code Here

Examples of com.tinkerpop.pipes.transform.VertexQueryPipe

     * @param labels       the edge labels to traverse
     * @return the extended Pipeline
     */
    public GremlinPipeline<S, Edge> outE(final int branchFactor, final String... labels) {
        return this.doQueryOptimization ?
                this.add(new VertexQueryPipe(Edge.class, Direction.OUT, null, null, branchFactor, 0, Integer.MAX_VALUE, labels)) :
                this.add(new OutEdgesPipe(branchFactor, labels));
    }
View Full Code Here

Examples of com.tinkerpop.pipes.transform.VertexQueryPipe

     * @param labels       the edge labels to traverse
     * @return the extended Pipeline
     */
    public GremlinPipeline<S, Vertex> out(final int branchFactor, final String... labels) {
        return this.doQueryOptimization ?
                this.add(new VertexQueryPipe(Vertex.class, Direction.OUT, null, null, branchFactor, 0, Integer.MAX_VALUE, labels)) :
                this.add(new OutPipe(branchFactor, labels));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.