public static GremlinPipeline optimizePipelineForQuery(final GremlinPipeline pipeline, final Pipe pipe) { if (!optimizePipelineForGraphQuery(pipeline, pipe)) if (!optimizePipelineForVertexQuery(pipeline, pipe)) pipeline.addPipe(pipe); return pipeline; }
public double getNodeInDegree(Vertex vertex) { GremlinPipeline<String, Vertex> pipe = new GremlinPipeline<String, Vertex>(vertex).in(SIMILAR); return (double) pipe.count(); }
/** * Add a BothEdgesPipe to the end of the Pipeline. * Emit both incoming and outgoing edges for the incoming vertex. * * @param labels the edge labels to traverse * @return the extended Pipeline */ public GremlinPipeline<S, Edge> bothE(final String... labels) { return this.bothE(Integer.MAX_VALUE, labels); }
protected Pipe getQueryPipe() { return new GremlinPipeline().has(Constants.ENTITY_TEXT_PROPERTY_KEY). hasNot(Constants.ENTITY_TYPE_PROPERTY_KEY, "Taxonomy"); } }
@Override public int getNodeCount() { long nodeCount = new GremlinPipeline<Object, Object>(titanGraph).V().count(); return (int) nodeCount; }
/** * Start a gremlin pipeline * * @param starts * @return Start a gremlin pipeline at an element */ public <E> GremlinPipeline<C, E> gremlin(Object starts) { return new GremlinPipeline<C, E>(starts); }
/** * Check if the element has a property with provided key. * * @param key the property key to check * @return the extended Pipeline */ public GremlinPipeline<S, ? extends Element> has(final String key) { return this.has(key, Tokens.T.neq, null); }
/** * Add an OutPipe to the end of the Pipeline. * Emit the adjacent outgoing vertices of the incoming vertex. * * @param labels the edge labels to traverse * @return the extended Pipeline */ public GremlinPipeline<S, Vertex> out(final String... labels) { return this.out(Integer.MAX_VALUE, labels); }
/** * Add a InPipe to the end of the Pipeline. * Emit the adjacent incoming vertices for the incoming vertex. * * @param labels the edge labels to traverse * @return the extended Pipeline */ public GremlinPipeline<S, Vertex> in(final String... labels) { return this.in(Integer.MAX_VALUE, labels); }
/** * Add an arbitrary Pipe to the end of the pipeline. * * @param pipe The provided pipe. * @param <T> the object type emitted by the provided pipe. * @return the extended Pipeline */ public <T> GremlinPipeline<S, T> step(final Pipe<E, T> pipe) { return this.add(pipe); }
/** * Add a BothPipe to the end of the Pipeline. * Emit both the incoming and outgoing adjacent vertices for the incoming vertex. * * @param labels the edge labels to traverse * @return the extended Pipeline */ public GremlinPipeline<S, Vertex> both(final String... labels) { return this.both(Integer.MAX_VALUE, labels); }
/** * Add an OutEdgesPipe to the end of the Pipeline. * Emit the outgoing edges for the incoming vertex. * * @param labels the edge labels to traverse * @return the extended Pipeline */ public GremlinPipeline<S, Edge> outE(final String... labels) { return this.outE(Integer.MAX_VALUE, labels); }
@Override public List<E> next(int number) { current = null; return super.next(number); }
/** * Add an arbitrary pipe to the GremlinPipeline * * @param pipe the pipe to add to the pipeline * @param <T> the type of the end of the pipe * @return the extended Pipeline */ public <T> GremlinPipeline<S, T> add(final Pipe<?, T> pipe) { this.addPipe(pipe); return (GremlinPipeline<S, T>) this; }
/** * Add an InEdgesPipe to the end of the Pipeline. * Emit the incoming edges for the incoming vertex. * * @param labels the edge labels to traverse * @return the extended Pipeline */ public GremlinPipeline<S, Edge> inE(final String... labels) { return this.inE(Integer.MAX_VALUE, labels); }
/** * Enable path calculations within the Pipeline. * This is typically done automatically and in rare occasions needs to be called. * * @return the Pipeline with path calculations enabled */ public GremlinPipeline<S, E> enablePath() { this.enablePath(true); return this; }
/** * Start a gremlin pipeline * * @param starts * @return Start a gremlin pipeline at an element */ public <E> GremlinPipeline<C, E> gremlin(Object starts) { return new GremlinPipeline<C, E>(starts); }
/** * Add an IdFilterPipe, LabelFilterPipe, or PropertyFilterPipe to the end of the Pipeline. * If the incoming element has the provided key/value as check with .equals(), then let the element pass. * If the key is id or label, then use respect id or label filtering. * * @param key the property key to check * @param value the object to filter on (in an OR manner) * @return the extended Pipeline */ public GremlinPipeline<S, ? extends Element> has(final String key, final Object value) { return this.has(key, Tokens.T.eq, value); }
/** * Check if the element does not have a property with provided key. * * @param key the property key to check * @return the extended Pipeline */ public GremlinPipeline<S, ? extends Element> hasNot(final String key) { return this.has(key, Tokens.T.eq, null); }
/** * Add an IdFilterPipe, LabelFilterPipe, or PropertyFilterPipe to the end of the Pipeline. * If the incoming element has the provided key/value as check with .equals(), then filter the element. * If the key is id or label, then use respect id or label filtering. * * @param key the property key to check * @param value the objects to filter on (in an OR manner) * @return the extended Pipeline */ public GremlinPipeline<S, ? extends Element> hasNot(final String key, final Object value) { return this.has(key, Tokens.T.neq, value); }