private static GraphTraversal<?, ?> transform(final E_Exists expression) { final OpBGP opBGP = (OpBGP) expression.getGraphPattern(); final List<Triple> triples = opBGP.getPattern().getList(); if (triples.size() != 1) throw new IllegalStateException("Unhandled EXISTS pattern"); final GraphTraversal<?, ?> traversal = TraversalBuilder.transform(triples.get(0)); final Step endStep = traversal.asAdmin().getEndStep(); final String label = (String) endStep.getLabels().iterator().next(); endStep.removeLabel(label); return traversal; }
private static GraphTraversal<?, ?> transform(final E_NotExists expression) { final OpBGP opBGP = (OpBGP) expression.getGraphPattern(); final List<Triple> triples = opBGP.getPattern().getList(); if (triples.size() != 1) throw new IllegalStateException("Unhandled NOT EXISTS pattern"); final GraphTraversal<?, ?> traversal = TraversalBuilder.transform(triples.get(0)); final Step endStep = traversal.asAdmin().getEndStep(); final String label = (String) endStep.getLabels().iterator().next(); endStep.removeLabel(label); return __.not(traversal); } }
/** * The {@code by()} can be applied to a number of different step to alter their behaviors. Modifies the previous * step with the specified key. * * @param key the key to apply * @return the traversal with a modulated step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#by-step" target="_blank">Reference Documentation - By Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> by(final String key) { this.asAdmin().getBytecode().addStep(Symbols.by, key); ((ByModulating) this.asAdmin().getEndStep()).modulateBy(key); return this; }
/** * The {@code by()} can be applied to a number of different step to alter their behaviors. Modifies the previous * step with the specified traversal. * * @param traversal the traversal to apply * @return the traversal with a modulated step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#by-step" target="_blank">Reference Documentation - By Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> by(final Traversal<?, ?> traversal) { this.asAdmin().getBytecode().addStep(Symbols.by, traversal); ((ByModulating) this.asAdmin().getEndStep()).modulateBy(traversal.asAdmin()); return this; }
/** * When used as a modifier to {@link #addE(String)} this method specifies the traversal to use for selecting the * incoming vertex of the newly added {@link Edge}. * * @param toVertex the vertex for selecting the incoming vertex * @return the traversal with the modified {@link AddEdgeStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#addedge-step" target="_blank">Reference Documentation - From Step</a> * @since 3.3.0 */ public default GraphTraversal<S, E> to(final Vertex toVertex) { this.asAdmin().getBytecode().addStep(Symbols.to, toVertex); ((FromToModulating) this.asAdmin().getEndStep()).addTo(__.constant(toVertex).asAdmin()); return this; }
/** * When used as a modifier to {@link #addE(String)} this method specifies the traversal to use for selecting the * incoming vertex of the newly added {@link Edge}. * * @param toVertex the traversal for selecting the incoming vertex * @return the traversal with the modified {@link AddEdgeStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#addedge-step" target="_blank">Reference Documentation - From Step</a> * @since 3.1.0-incubating */ public default GraphTraversal<S, E> to(final Traversal<?, Vertex> toVertex) { this.asAdmin().getBytecode().addStep(Symbols.to, toVertex); ((FromToModulating) this.asAdmin().getEndStep()).addTo(toVertex.asAdmin()); return this; }
/** * The {@code by()} can be applied to a number of different step to alter their behaviors. Modifies the previous * step with the specified function. * * @param key the key to apply traversal * @param comparator the comparator to apply typically for some {@link #order()} * @return the traversal with a modulated step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#by-step" target="_blank">Reference Documentation - By Step</a> * @since 3.0.0-incubating */ public default <V> GraphTraversal<S, E> by(final String key, final Comparator<V> comparator) { this.asAdmin().getBytecode().addStep(Symbols.by, key, comparator); ((ByModulating) this.asAdmin().getEndStep()).modulateBy(key, comparator); return this; }
/** * This step is technically a step modulator for the the {@link GraphTraversalSource#io(String)} step which * instructs the step to perform a write with its given configuration. * * @return the traversal with the {@link IoStep} modulated to write * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#io-step" target="_blank">Reference Documentation - IO Step</a> * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#write-step" target="_blank">Reference Documentation - Write Step</a> * @since 3.4.0 */ public default GraphTraversal<S,E> write() { this.asAdmin().getBytecode().addStep(Symbols.write); ((ReadWriting) this.asAdmin().getEndStep()).setMode(ReadWriting.Mode.WRITING); return this; }
/** * This step modifies {@link #choose(Function)} to specifies the available choices that might be executed. * * @param pickToken the token that would trigger this option * @param traversalOption the option as a traversal * @return the traversal with the modulated step * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#choose-step" target="_blank">Reference Documentation - Choose Step</a> * @since 3.0.0-incubating */ public default <M, E2> GraphTraversal<S, E> option(final M pickToken, final Traversal<?, E2> traversalOption) { this.asAdmin().getBytecode().addStep(Symbols.option, pickToken, traversalOption); ((TraversalOptionParent<M, E, E2>) this.asAdmin().getEndStep()).addGlobalChildOption(pickToken, (Traversal.Admin<E, E2>) traversalOption.asAdmin()); return this; }
/** * The {@code by()} can be applied to a number of different step to alter their behaviors. Modifies the previous * step with the specified function. * * @param order the comparator to apply typically for some {@link #order()} * @return the traversal with a modulated step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#by-step" target="_blank">Reference Documentation - By Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> by(final Order order) { this.asAdmin().getBytecode().addStep(Symbols.by, order); ((ByModulating) this.asAdmin().getEndStep()).modulateBy(order); return this; }
/** * The {@code by()} can be applied to a number of different step to alter their behaviors. Modifies the previous * step with the specified function. * * @param comparator the comparator to apply typically for some {@link #order()} * @return the traversal with a modulated step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#by-step" target="_blank">Reference Documentation - By Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> by(final Comparator<E> comparator) { this.asAdmin().getBytecode().addStep(Symbols.by, comparator); ((ByModulating) this.asAdmin().getEndStep()).modulateBy(comparator); return this; }
/** * The {@code by()} can be applied to a number of different step to alter their behaviors. Modifies the previous * step with the specified function. * * @param function the function to apply * @return the traversal with a modulated step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#by-step" target="_blank">Reference Documentation - By Step</a> * @since 3.0.0-incubating */ public default <V> GraphTraversal<S, E> by(final Function<V, Object> function) { this.asAdmin().getBytecode().addStep(Symbols.by, function); ((ByModulating) this.asAdmin().getEndStep()).modulateBy(function); return this; }
/** * When used as a modifier to {@link #addE(String)} this method specifies the traversal to use for selecting the * outgoing vertex of the newly added {@link Edge}. * * @param fromVertex the vertex for selecting the outgoing vertex * @return the traversal with the modified {@link AddEdgeStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#addedge-step" target="_blank">Reference Documentation - From Step</a> * @since 3.3.0 */ public default GraphTraversal<S, E> from(final Vertex fromVertex) { this.asAdmin().getBytecode().addStep(Symbols.from, fromVertex); ((FromToModulating) this.asAdmin().getEndStep()).addFrom(__.constant(fromVertex).asAdmin()); return this; }
/** * When used as a modifier to {@link #addE(String)} this method specifies the traversal to use for selecting the * outgoing vertex of the newly added {@link Edge}. * * @param fromVertex the traversal for selecting the outgoing vertex * @return the traversal with the modified {@link AddEdgeStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#addedge-step" target="_blank">Reference Documentation - From Step</a> * @since 3.1.0-incubating */ public default GraphTraversal<S, E> from(final Traversal<?, Vertex> fromVertex) { this.asAdmin().getBytecode().addStep(Symbols.from, fromVertex); ((FromToModulating) this.asAdmin().getEndStep()).addFrom(fromVertex.asAdmin()); return this; }
/** * This step is technically a step modulator for the the {@link GraphTraversalSource#io(String)} step which * instructs the step to perform a read with its given configuration. * * @return the traversal with the {@link IoStep} modulated to read * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#io-step" target="_blank">Reference Documentation - IO Step</a> * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#read-step" target="_blank">Reference Documentation - Read Step</a> * @since 3.4.0 */ public default GraphTraversal<S,E> read() { this.asAdmin().getBytecode().addStep(Symbols.read); ((ReadWriting) this.asAdmin().getEndStep()).setMode(ReadWriting.Mode.READING); return this; }
/** * The {@code by()} can be applied to a number of different step to alter their behaviors. Modifies the previous * step with the specified token of {@link T}. * * @param token the token to apply * @return the traversal with a modulated step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#by-step" target="_blank">Reference Documentation - By Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> by(final T token) { this.asAdmin().getBytecode().addStep(Symbols.by, token); ((ByModulating) this.asAdmin().getEndStep()).modulateBy(token); return this; }
/** * The {@code by()} can be applied to a number of different step to alter their behaviors. This form is essentially * an {@link #identity()} modulation. * * @return the traversal with a modulated step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#by-step" target="_blank">Reference Documentation - By Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> by() { this.asAdmin().getBytecode().addStep(Symbols.by); ((ByModulating) this.asAdmin().getEndStep()).modulateBy(); return this; }
/** * Provide {@code from()}-modulation to respective steps. * * @param fromStepLabel the step label to modulate to. * @return the traversal with the modified {@link FromToModulating} step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#from-step" target="_blank">Reference Documentation - From Step</a> * @since 3.1.0-incubating */ public default GraphTraversal<S, E> from(final String fromStepLabel) { this.asAdmin().getBytecode().addStep(Symbols.from, fromStepLabel); ((FromToModulating) this.asAdmin().getEndStep()).addFrom(fromStepLabel); return this; }
/** * This step modifies {@link #choose(Function)} to specifies the available choices that might be executed. * * @param traversalOption the option as a traversal * @return the traversal with the modulated step * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#choose-step" target="_blank">Reference Documentation - Choose Step</a> * @since 3.0.0-incubating */ public default <E2> GraphTraversal<S, E> option(final Traversal<?, E2> traversalOption) { this.asAdmin().getBytecode().addStep(Symbols.option, traversalOption); ((TraversalOptionParent<Object, E, E2>) this.asAdmin().getEndStep()).addGlobalChildOption(TraversalOptionParent.Pick.any, (Traversal.Admin<E, E2>) traversalOption.asAdmin()); return this; }
/** * Provide {@code to()}-modulation to respective steps. * * @param toStepLabel the step label to modulate to. * @return the traversal with the modified {@link FromToModulating} step. * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#to-step" target="_blank">Reference Documentation - To Step</a> * @since 3.1.0-incubating */ public default GraphTraversal<S, E> to(final String toStepLabel) { this.asAdmin().getBytecode().addStep(Symbols.to, toStepLabel); ((FromToModulating) this.asAdmin().getEndStep()).addTo(toStepLabel); return this; }