/** * Modifies a {@link #repeat(Traversal)} to determine when the loop should exit. * * @param untilPredicate the predicate that determines when the loop exits * @return the traversal with the appended {@link RepeatStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#repeat-step" target="_blank">Reference Documentation - Repeat Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> until(final Predicate<Traverser<E>> untilPredicate) { this.asAdmin().getBytecode().addStep(Symbols.until, untilPredicate); return RepeatStep.addUntilToTraversal(this, (Traversal.Admin<E, ?>) __.filter(untilPredicate)); }
/** * Emit is used in conjunction with {@link #repeat(Traversal)} to determine what objects get emit from the loop. * * @param emitPredicate the emit predicate * @return the traversal with the appended {@link RepeatStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#repeat-step" target="_blank">Reference Documentation - Repeat Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> emit(final Predicate<Traverser<E>> emitPredicate) { this.asAdmin().getBytecode().addStep(Symbols.emit, emitPredicate); return RepeatStep.addEmitToTraversal(this, (Traversal.Admin<E, ?>) __.filter(emitPredicate)); }
__.filter(new TypeChecker<>(VertexProperty.class)), __.has(partitionKey, P.within(new ArrayList<>(readPartitions))), __.__()).filter(new PartitionKeyHider()); __.filter(new TypeChecker<>(Vertex.class)), __.properties(step.getPropertyKeys()).has(partitionKey, P.within(new ArrayList<>(readPartitions))).filter(new PartitionKeyHider()).value(), __.__().filter(new PartitionKeyHider()));
/** * Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else * like semantics within a traversal. * * @param choosePredicate the function used to determine the "if" portion of the if-then-else * @param trueChoice the traversal to execute in the event the {@code traversalPredicate} returns true * @param falseChoice the traversal to execute in the event the {@code traversalPredicate} returns false * @return the traversal with the appended {@link ChooseStep} * @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, E2> choose(final Predicate<E> choosePredicate, final Traversal<?, E2> trueChoice, final Traversal<?, E2> falseChoice) { this.asAdmin().getBytecode().addStep(Symbols.choose, choosePredicate, trueChoice, falseChoice); return this.asAdmin().addStep(new ChooseStep<E, E2, Boolean>(this.asAdmin(), (Traversal.Admin<E, ?>) __.filter(new PredicateTraverser<>(choosePredicate)), (Traversal.Admin<E, E2>) trueChoice, (Traversal.Admin<E, E2>) falseChoice)); }
/** * Routes the current traverser to a particular traversal branch option which allows the creation of if-then * like semantics within a traversal. * * @param choosePredicate the function used to determine the "if" portion of the if-then-else * @param trueChoice the traversal to execute in the event the {@code traversalPredicate} returns true * @return the traversal with the appended {@link ChooseStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#choose-step" target="_blank">Reference Documentation - Choose Step</a> * @since 3.2.4 */ public default <E2> GraphTraversal<S, E2> choose(final Predicate<E> choosePredicate, final Traversal<?, E2> trueChoice) { this.asAdmin().getBytecode().addStep(Symbols.choose, choosePredicate, trueChoice); return this.asAdmin().addStep(new ChooseStep<E, E2, Boolean>(this.asAdmin(), (Traversal.Admin<E, ?>) __.filter(new PredicateTraverser<>(choosePredicate)), (Traversal.Admin<E, E2>) trueChoice, (Traversal.Admin<E, E2>) __.identity())); }
/** * Modifies a {@link #repeat(Traversal)} to determine when the loop should exit. * * @param untilPredicate the predicate that determines when the loop exits * @return the traversal with the appended {@link RepeatStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#repeat-step" target="_blank">Reference Documentation - Repeat Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> until(final Predicate<Traverser<E>> untilPredicate) { this.asAdmin().getBytecode().addStep(Symbols.until, untilPredicate); return RepeatStep.addUntilToTraversal(this, (Traversal.Admin<E, ?>) __.filter(untilPredicate)); }
/** * Emit is used in conjunction with {@link #repeat(Traversal)} to determine what objects get emit from the loop. * * @param emitPredicate the emit predicate * @return the traversal with the appended {@link RepeatStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#repeat-step" target="_blank">Reference Documentation - Repeat Step</a> * @since 3.0.0-incubating */ public default GraphTraversal<S, E> emit(final Predicate<Traverser<E>> emitPredicate) { this.asAdmin().getBytecode().addStep(Symbols.emit, emitPredicate); return RepeatStep.addEmitToTraversal(this, (Traversal.Admin<E, ?>) __.filter(emitPredicate)); }
assertTrue(traversal.getTraverserGenerator() instanceof B_LP_O_P_S_SE_SL_TraverserGenerator); strategy = SubgraphStrategy.build().vertices(__.filter(__.simplePath())).create(); sg = g.withStrategies(strategy);
__.filter(new TypeChecker<>(VertexProperty.class)), __.has(partitionKey, P.within(new ArrayList<>(readPartitions))), __.__()).filter(new PartitionKeyHider()); __.filter(new TypeChecker<>(Vertex.class)), __.properties(step.getPropertyKeys()).has(partitionKey, P.within(new ArrayList<>(readPartitions))).filter(new PartitionKeyHider()).value(), __.__().filter(new PartitionKeyHider()));
/** * Routes the current traverser to a particular traversal branch option which allows the creation of if-then-else * like semantics within a traversal. * * @param choosePredicate the function used to determine the "if" portion of the if-then-else * @param trueChoice the traversal to execute in the event the {@code traversalPredicate} returns true * @param falseChoice the traversal to execute in the event the {@code traversalPredicate} returns false * @return the traversal with the appended {@link ChooseStep} * @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, E2> choose(final Predicate<E> choosePredicate, final Traversal<?, E2> trueChoice, final Traversal<?, E2> falseChoice) { this.asAdmin().getBytecode().addStep(Symbols.choose, choosePredicate, trueChoice, falseChoice); return this.asAdmin().addStep(new ChooseStep<E, E2, Boolean>(this.asAdmin(), (Traversal.Admin<E, ?>) __.filter(new PredicateTraverser<>(choosePredicate)), (Traversal.Admin<E, E2>) trueChoice, (Traversal.Admin<E, E2>) falseChoice)); }
/** * Routes the current traverser to a particular traversal branch option which allows the creation of if-then * like semantics within a traversal. * * @param choosePredicate the function used to determine the "if" portion of the if-then-else * @param trueChoice the traversal to execute in the event the {@code traversalPredicate} returns true * @return the traversal with the appended {@link ChooseStep} * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#choose-step" target="_blank">Reference Documentation - Choose Step</a> * @since 3.2.4 */ public default <E2> GraphTraversal<S, E2> choose(final Predicate<E> choosePredicate, final Traversal<?, E2> trueChoice) { this.asAdmin().getBytecode().addStep(Symbols.choose, choosePredicate, trueChoice); return this.asAdmin().addStep(new ChooseStep<E, E2, Boolean>(this.asAdmin(), (Traversal.Admin<E, ?>) __.filter(new PredicateTraverser<>(choosePredicate)), (Traversal.Admin<E, E2>) trueChoice, (Traversal.Admin<E, E2>) __.identity())); }
assertTrue(traversal.getTraverserGenerator() instanceof B_LP_O_P_S_SE_SL_TraverserGenerator); strategy = SubgraphStrategy.build().vertices(__.filter(__.simplePath())).create(); sg = g.withStrategies(strategy);