Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement

The following examples show how to use org.apache.tinkerpop.gremlin.process.traversal.traverser.TraverserRequirement. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: tinkerpop   Source File: DefaultTraversal.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Set<TraverserRequirement> getTraverserRequirements() {
    if (null == this.requirements) {
        // if (!this.locked) this.applyStrategies();
        this.requirements = EnumSet.noneOf(TraverserRequirement.class);
        for (final Step<?, ?> step : this.getSteps()) {
            this.requirements.addAll(step.getRequirements());
        }
        if (!this.requirements.contains(TraverserRequirement.LABELED_PATH) && TraversalHelper.hasLabels(this))
            this.requirements.add(TraverserRequirement.LABELED_PATH);
        if (!this.getSideEffects().keys().isEmpty())
            this.requirements.add(TraverserRequirement.SIDE_EFFECTS);
        if (null != this.getSideEffects().getSackInitialValue())
            this.requirements.add(TraverserRequirement.SACK);
        if (this.requirements.contains(TraverserRequirement.ONE_BULK))
            this.requirements.remove(TraverserRequirement.BULK);
        this.requirements = Collections.unmodifiableSet(this.requirements);
    }
    return this.requirements;
}
 
Example 2
Source Project: tinkerpop   Source File: SparkStarBarrierInterceptor.java    License: Apache License 2.0 6 votes vote down vote up
public static boolean isLegal(final Traversal.Admin<?, ?> traversal) {
    final Step<?, ?> startStep = traversal.getStartStep();
    final Step<?, ?> endStep = traversal.getEndStep();
    // right now this is not supported because of how the SparkStarBarrierInterceptor mutates the traversal prior to local evaluation
    if (traversal.getStrategies().getStrategy(SubgraphStrategy.class).isPresent())
        return false;
    if (!startStep.getClass().equals(GraphStep.class) || ((GraphStep) startStep).returnsEdge())
        return false;
    if (!endStep.getClass().equals(CountGlobalStep.class) &&
            !endStep.getClass().equals(SumGlobalStep.class) &&
            !endStep.getClass().equals(MeanGlobalStep.class) &&
            !endStep.getClass().equals(MaxGlobalStep.class) &&
            !endStep.getClass().equals(MinGlobalStep.class) &&
            !endStep.getClass().equals(FoldStep.class) &&
            !endStep.getClass().equals(GroupStep.class) &&
            !endStep.getClass().equals(GroupCountStep.class))
        // TODO: tree()
        return false;
    if (TraversalHelper.getStepsOfAssignableClassRecursively(Scope.global, Barrier.class, traversal).size() != 1)
        return false;
    if (traversal.getTraverserRequirements().contains(TraverserRequirement.SACK))
        return false;
    return TraversalHelper.isLocalStarGraph(traversal);
}
 
Example 3
Source Project: tinkerpop   Source File: SparkSingleIterationStrategy.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    final Graph graph = traversal.getGraph().orElse(EmptyGraph.instance()); // best guess at what the graph will be as its dynamically determined
    for (final TraversalVertexProgramStep step : TraversalHelper.getStepsOfClass(TraversalVertexProgramStep.class, traversal)) {
        final Traversal.Admin<?, ?> computerTraversal = step.generateProgram(graph, EmptyMemory.instance()).getTraversal().get().clone();
        if (!computerTraversal.isLocked())
            computerTraversal.applyStrategies();
        ///
        boolean doesMessagePass = TraversalHelper.hasStepOfAssignableClassRecursively(Scope.global, MULTI_ITERATION_CLASSES, computerTraversal);
        if (!doesMessagePass) {
            for (final VertexStep vertexStep : TraversalHelper.getStepsOfAssignableClassRecursively(Scope.global, VertexStep.class, computerTraversal)) {
                if (vertexStep.returnsVertex() || !vertexStep.getDirection().equals(Direction.OUT)) { // in-edges require message pass in OLAP
                    doesMessagePass = true;
                    break;
                }
            }
        }
        if (!doesMessagePass &&
                !MessagePassingReductionStrategy.endsWithElement(computerTraversal.getEndStep()) &&
                !(computerTraversal.getTraverserRequirements().contains(TraverserRequirement.LABELED_PATH) || // TODO: remove this when dynamic detachment is available in 3.3.0
                        computerTraversal.getTraverserRequirements().contains(TraverserRequirement.PATH))) {  // TODO: remove this when dynamic detachment is available in 3.3.0
            step.setComputer(step.getComputer()
                    // if no message passing, don't partition the loaded graph
                    .configure(Constants.GREMLIN_SPARK_SKIP_PARTITIONER, true)
                    // if no message passing, don't cache the loaded graph
                    .configure(Constants.GREMLIN_SPARK_SKIP_GRAPH_CACHE, true));
        }
    }
}
 
Example 4
private static Traversal copyAndConfigureTraversal(final Traversal traversalToCopy) {
    final Traversal copy = traversalToCopy.asAdmin().clone();
    final TraversalStrategies strategies = new DefaultTraversalStrategies();
    strategies.addStrategies(StandardVerificationStrategy.instance());

    // just add a junk requirement
    RequirementsStrategy.addRequirements(strategies, TraverserRequirement.BULK);

    copy.asAdmin().setStrategies(strategies);
    return copy;
}
 
Example 5
Source Project: tinkerpop   Source File: TraversalSelectStep.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements(
            TraverserRequirement.OBJECT,
            TraverserRequirement.SIDE_EFFECTS,
            TraverserRequirement.PATH);
}
 
Example 6
Source Project: tinkerpop   Source File: RepeatStep.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    final Set<TraverserRequirement> requirements = this.getSelfAndChildRequirements(TraverserRequirement.BULK);
    if (requirements.contains(TraverserRequirement.SINGLE_LOOP))
        requirements.add(TraverserRequirement.NESTED_LOOP);
    requirements.add(TraverserRequirement.SINGLE_LOOP);
    return requirements;
}
 
Example 7
Source Project: tinkerpop   Source File: ComputerVerificationStrategy.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    if (!TraversalHelper.onGraphComputer(traversal))
        return;

    if (traversal.getParent() instanceof TraversalVertexProgramStep) {
        if (TraversalHelper.getStepsOfAssignableClassRecursively(GraphStep.class, traversal).size() > 1)
            throw new VerificationException("Mid-traversal V()/E() is currently not supported on GraphComputer", traversal);
        if (TraversalHelper.hasStepOfAssignableClassRecursively(ProfileStep.class, traversal) && TraversalHelper.getStepsOfAssignableClass(VertexProgramStep.class, TraversalHelper.getRootTraversal(traversal)).size() > 1)
            throw new VerificationException("Profiling a multi-VertexProgramStep traversal is currently not supported on GraphComputer", traversal);
    }

    // this is a problem because sideEffect.merge() is transient on the OLAP reduction
    if (TraversalHelper.getRootTraversal(traversal).getTraverserRequirements().contains(TraverserRequirement.ONE_BULK))
        throw new VerificationException("One bulk is currently not supported on GraphComputer: " + traversal, traversal);

    // you can not traverse past the local star graph with localChildren (e.g. by()-modulators).
    if (!TraversalHelper.isGlobalChild(traversal) && !TraversalHelper.isLocalStarGraph(traversal))
        throw new VerificationException("Local traversals may not traverse past the local star-graph on GraphComputer: " + traversal, traversal);

    for (final Step<?, ?> step : traversal.getSteps()) {
        if (step instanceof PathProcessor && ((PathProcessor) step).getMaxRequirement() != PathProcessor.ElementRequirement.ID)
            throw new VerificationException("It is not possible to access more than a path element's id on GraphComputer: " + step + " requires " + ((PathProcessor) step).getMaxRequirement(), traversal);

        if (UNSUPPORTED_STEPS.stream().filter(c -> c.isAssignableFrom(step.getClass())).findFirst().isPresent())
            throw new VerificationException("The following step is currently not supported on GraphComputer: " + step, traversal);
    }

    Step<?, ?> nextParentStep = traversal.getParent().asStep();
    while (!(nextParentStep instanceof EmptyStep)) {
        if (nextParentStep instanceof PathProcessor && ((PathProcessor) nextParentStep).getMaxRequirement() != PathProcessor.ElementRequirement.ID)
            throw new VerificationException("The following path processor step requires more than the element id on GraphComputer: " + nextParentStep + " requires " + ((PathProcessor) nextParentStep).getMaxRequirement(), traversal);
        nextParentStep = nextParentStep.getNextStep();
    }
}
 
Example 8
Source Project: tinkerpop   Source File: RequirementsStrategy.java    License: Apache License 2.0 5 votes vote down vote up
public static void addRequirements(final TraversalStrategies traversalStrategies, final TraverserRequirement... requirements) {
    RequirementsStrategy strategy = (RequirementsStrategy) traversalStrategies.getStrategy(RequirementsStrategy.class).orElse(null);
    if (null == strategy) {
        strategy = new RequirementsStrategy();
        traversalStrategies.addStrategies(strategy);
    } else {
        final RequirementsStrategy cloneStrategy = new RequirementsStrategy();
        cloneStrategy.requirements.addAll(strategy.requirements);
        strategy = cloneStrategy;
        traversalStrategies.addStrategies(strategy);
    }
    Collections.addAll(strategy.requirements, requirements);
}
 
Example 9
Source Project: tinkerpop   Source File: SelectOneStepTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void shouldRequirePathsAccordingly() {
    Object[][] traversalPaths = new Object[][]{
            {false, __.select("x").asAdmin()},
            {true, __.as("x").select("x").asAdmin()},
            {false, __.local(__.select("x")).asAdmin()},
            {true, __.as("x").local(__.select("x")).asAdmin()},
    };
    for (final Object[] traversalPath : traversalPaths) {
        assertEquals(traversalPath[0], ((Traversal.Admin<?, ?>) traversalPath[1]).getTraverserRequirements().contains(TraverserRequirement.LABELED_PATH));
    }
}
 
Example 10
Source Project: tinkerpop   Source File: WhereStepTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void shouldRequirePathsAccordingly() {
    Object[][] traversalPaths = new Object[][]{
            {false, __.where(P.not(P.within("x"))).asAdmin()},
            {true, __.as("x").where(P.not(P.within("x"))).asAdmin()},
            {true, __.as("a").where(P.not(P.within("x"))).asAdmin()},
            {false, __.local(__.where(P.not(P.within("x")))).asAdmin()},
            {true, __.as("x").local(__.where(P.not(P.within("x")))).asAdmin()},
            {false, __.local(__.where(P.not(P.within("x")))).asAdmin()},
    };
    for (final Object[] traversalPath : traversalPaths) {
        assertEquals(traversalPath[0], ((Traversal.Admin<?, ?>) traversalPath[1]).getTraverserRequirements().contains(TraverserRequirement.LABELED_PATH));
    }
}
 
Example 11
@Override
public Set<TraverserRequirement> getRequirements() {
    // This step requires being able to access previously visited properties in the traversal,
    // so it needs `LABELED_PATH`.
    return EnumSet.of(TraverserRequirement.LABELED_PATH);
}
 
Example 12
Source Project: tinkerpop   Source File: AbstractLambdaTraversal.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getTraverserRequirements() {
    return null == this.bypassTraversal ? REQUIREMENTS : this.bypassTraversal.getTraverserRequirements();
}
 
Example 13
Source Project: tinkerpop   Source File: BranchStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements();
}
 
Example 14
Source Project: tinkerpop   Source File: EdgeVertexStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return Collections.singleton(TraverserRequirement.OBJECT);
}
 
Example 15
Source Project: tinkerpop   Source File: MathStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements(TraverserRequirement.OBJECT, TraverserRequirement.SIDE_EFFECTS);
}
 
Example 16
Source Project: tinkerpop   Source File: SampleLocalStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return Collections.singleton(TraverserRequirement.OBJECT);
}
 
Example 17
Source Project: tinkerpop   Source File: MatchStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements(TraverserRequirement.LABELED_PATH, TraverserRequirement.SIDE_EFFECTS);
}
 
Example 18
Source Project: tinkerpop   Source File: PropertyMapStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements(TraverserRequirement.OBJECT);
}
 
Example 19
Source Project: tinkerpop   Source File: SumLocalStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return Collections.singleton(TraverserRequirement.OBJECT);
}
 
Example 20
Source Project: tinkerpop   Source File: ComputerResultStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return EnumSet.of(TraverserRequirement.OBJECT);
}
 
Example 21
Source Project: tinkerpop   Source File: GroupCountStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements(TraverserRequirement.BULK);
}
 
Example 22
Source Project: tinkerpop   Source File: NoOpBarrierStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return Collections.singleton(TraverserRequirement.BULK);
}
 
Example 23
Source Project: tinkerpop   Source File: GroupStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements(TraverserRequirement.OBJECT, TraverserRequirement.BULK);
}
 
Example 24
Source Project: tinkerpop   Source File: OrderLocalStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements(TraverserRequirement.OBJECT);
}
 
Example 25
Source Project: tinkerpop   Source File: TraversalFlatMapStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements();
}
 
Example 26
Source Project: tinkerpop   Source File: CoalesceStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return this.getSelfAndChildRequirements();
}
 
Example 27
Source Project: tinkerpop   Source File: MeanLocalStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return Collections.singleton(TraverserRequirement.OBJECT);
}
 
Example 28
Source Project: tinkerpop   Source File: GraphComputerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getTraverserRequirements() {
    return this.traverserRequirements;
}
 
Example 29
Source Project: tinkerpop   Source File: PeerPressureVertexProgramStep.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Set<TraverserRequirement> getRequirements() {
    return TraversalParent.super.getSelfAndChildRequirements();
}
 
Example 30
Source Project: tinkerpop   Source File: PathRetractionStrategyTest.java    License: Apache License 2.0 4 votes vote down vote up
@Parameterized.Parameters(name = "{0}")
    public static Iterable<Object[]> generateTestParameters() {

        final VertexProgram labeledPathVertexProgram = mock(VertexProgram.class);
        final VertexProgram pathVertexProgram = mock(VertexProgram.class);
        final VertexProgram emptyRequirementsVertexProgram = mock(VertexProgram.class);

        when(labeledPathVertexProgram.getTraverserRequirements()).thenReturn(Sets.newSet(TraverserRequirement.LABELED_PATH));
        when(pathVertexProgram.getTraverserRequirements()).thenReturn(Sets.newSet(TraverserRequirement.PATH));
        when(emptyRequirementsVertexProgram.getTraverserRequirements()).thenReturn(Collections.EMPTY_SET);

        return Arrays.asList(new Object[][]{
                {out(), "[]", null},
                {__.V().as("a").out().as("b").where(neq("a")).out(), "[[]]", null},
                {__.V().as("a").out().where(out().where(neq("a"))).out(), "[[[]]]", null},
                {__.V().as("a").out().where(neq("a")).out().select("a"), "[[a], []]", null},
                {__.V().as("a").out().as("b").where(neq("a")).out().select("a", "b").out().select("b"), "[[a, b], [b], []]", null},
                {__.V().match(as("a").out().as("b")), "[[a, b]]", null},
                {__.V().match(as("a").out().as("b")).select("a"), "[[a], []]", null},
                {__.V().out().out().match(
                        as("a").in("created").as("b"),
                        as("b").in("knows").as("c")).select("c").out("created").where(neq("a")).values("name"),
                        "[[a, c], [a], []]", null},
                {__.V().as("a").out().select("a").path(), PATH_RETRACTION_STRATEGY_DISABLED, null},
                {__.V().as("a").out().select("a").map(t -> t.path().get("a")), PATH_RETRACTION_STRATEGY_DISABLED, null}, // lambda introspection is not possible
                {__.V().as("a").out().select("a").subgraph("b"), "[[]]", null},
                {__.V().as("a").out().select("a").subgraph("b").select("a"), "[[a], []]", null},
                {__.V().out().out().match(
                        as("a").in("created").as("b"),
                        as("b").in("knows").as("c")).select("c").out("created").where(neq("a")).values("name").path(),
                        PATH_RETRACTION_STRATEGY_DISABLED, null},
                {__.V().out().as("a").where(neq("a")).out().where(neq("a")).out(), "[[a], []]", null},
                {__.V().out().as("a").where(out().select("a").values("prop").count().is(gte(1))).out().where(neq("a")), "[[[a]], []]", null},
                {__.V().as("a").out().as("b").where(out().select("a", "b", "c").values("prop").count().is(gte(1))).out().where(neq("a")).out().select("b"),
                        "[[[a, b]], [b], []]", null},
                {__.outE().inV().group().by(__.inE().outV().groupCount().by(__.both().count().is(P.gt(2)))), "[]", null},
                {__.V().as("a").repeat(out().where(neq("a"))).emit().select("a").values("test"), "[[[a]], []]", null},
                // given the way this test harness is structured, I have to manual test for RepeatUnrollStrategy (and it works) TODO: add more test parameters
                // {__.V().as("a").repeat(__.out().where(neq("a"))).times(3).select("a").values("test"), Arrays.asList(Collections.singleton("a"), Collections.singleton("a"), Collections.singleton("a"), Collections.emptySet())}
                {__.V().as("a").out().as("b").select("a").out().out(), "[[]]", __.V().as("a").out().as("b").select("a").barrier(MAX_BARRIER_SIZE).out().out()},
                {__.V().as("a").out().as("b").select("a").count(), "[[]]", __.V().as("a").out().as("b").select("a").count()},
                {__.V().as("a").out().as("b").select("a").barrier().count(), "[[]]", __.V().as("a").out().as("b").select("a").barrier().count()},
                {__.V().as("a").out().as("b").dedup("a", "b").out(), "[[]]", __.V().as("a").out().as("b").dedup("a", "b").out()},
                {__.V().as("a").out().as("b").match(as("a").out().as("b")), "[[a, b]]", __.V().as("a").out().as("b").match(as("a").out().as("b"))},
                {__.V().as("a").out().as("b").match(as("a").out().as("b")).select("a"), "[[a], []]", __.V().as("a").out().as("b").match(as("a").out().as("b")).select("a")},
                {__.V().as("a").out().as("b").match(as("a").out().as("b")).select("a").out().dedup("a"), "[[a], [a], []]", __.V().as("a").out().as("b").match(as("a").out().as("b")).select("a").barrier(MAX_BARRIER_SIZE).out().dedup("a")},
                {__.V().as("a").out().as("b").where(P.gt("a")).out().out(), "[[]]", __.V().as("a").out().as("b").where(P.gt("a")).barrier(MAX_BARRIER_SIZE).out().out()},
                {__.V().as("a").out().as("b").where(P.gt("a")).count(), "[[]]", __.V().as("a").out().as("b").where(P.gt("a")).count()},
                {__.V().as("a").out().as("b").select("a").as("c").where(P.gt("b")).out(), "[[b], []]", __.V().as("a").out().as("b").select("a").as("c").barrier(MAX_BARRIER_SIZE).where(P.gt("b")).barrier(MAX_BARRIER_SIZE).out()},
                {__.V().select("c").map(select("c").map(select("c"))).select("c"), "[[c], [[c], [[c]]], []]", null},
                {__.V().select("c").map(select("c").map(select("c"))).select("b"), "[[b, c], [[b, c], [[b]]], []]", null},
                {__.V().as("a").out().as("b").select("a").select("b").union(
                        as("c").out().as("d", "e").select("c", "e").out().select("c"),
                        as("c").out().as("d", "e").select("c", "e").out().select("c")).
                        out().select("c"),
                        "[[b, c, e], [c, e], [[c, e], [c, e]], [[c, e], [c, e]], []]", null},
                {__.V().as("a").out().as("b").select("a").select("b").
                        local(as("c").out().as("d", "e").select("c", "e").out().select("c")).
                        out().select("c"),
                        "[[b, c, e], [c, e], [[c], [c]], []]", null},
                // TODO: same as above but note how path() makes things react
//                {__.V().as("a").out().as("b").select("a").select("b").path().local(as("c").out().as("d", "e").select("c", "e").out().select("c")).out().select("c"),
//                        "[[[c, e], [c, e]]]", null},
                {__.V().as("a").out().as("b").select("a").select("b").repeat(out().as("c").select("b", "c").out().select("c")).out().select("c").out().select("b"),
                        "[[b, c], [b, c], [[b, c], [b, c]], [b], []]", null},
                {__.V().as("a").out().as("b").select("a").select("b").repeat(out().as("c").select("b")).out().select("c").out().select("b"),
                        "[[b, c], [b, c], [[b, c]], [b], []]", null},
                {__.V().as("a").out().as("b").select("a").select("b").repeat(out().as("c").select("b")),
                        "[[b], [b], [[b]]]", null},
                {__.V().select("a").map(select("c").map(select("b"))).select("c"),
                        "[[b, c], [[b, c], [[c]]], []]", null},
                {__.V().select("a").map(select("b").repeat(select("c"))).select("a"),
                        "[[a, b, c], [[a, c], [[a, c]]], []]", null},
                {__.V().select("c").map(select("c").map(select("c"))).select("c"), "[[c], [[c], [[c]]], []]", null},
                {__.V().select("c").map(select("c").map(select("c"))).select("b"), "[[b, c], [[b, c], [[b]]], []]", null},
                {__.V().select("a").map(select("c").map(select("b"))).select("c"),
                        "[[b, c], [[b, c], [[c]]], []]", null},
                {__.V().select("a").map(select("b").repeat(select("c"))).select("a"),
                        "[[a, b, c], [[a, c], [[a, c]]], []]", null},
                {__.V().out("created").project("a", "b").by("name").by(__.in("created").count()).order().by(select("b")).select("a"), "[[[a]], []]", null},
                {__.order().by("weight", Order.desc).store("w").by("weight").filter(values("weight").as("cw").
                        select("w").by(limit(Scope.local, 1)).as("mw").where("cw", eq("mw"))).project("from", "to", "weight").by(__.outV()).by(__.inV()).by("weight"),
                        "[[[cw, mw], []]]", null},
                {__.V().limit(1).as("z").out().repeat(store("seen").out().where(without("seen"))).until(where(eq("z"))),
                        "[[[z, seen]], [[z, seen]]]", null},
                {__.V().as("a").optional(bothE().dedup().as("b")).
                        choose(select("b"), select("a","b"), project("a").by(select("a"))),
                        "[[[a, b]], [[a, b]], [[[a, b]]], [[a, b]]]", null},
                {__.V().as("a").out().where(neq("a")).program(labeledPathVertexProgram), PATH_RETRACTION_STRATEGY_DISABLED, null},
                {__.V().as("a").out().where(neq("a")).program(pathVertexProgram).select("a"), PATH_RETRACTION_STRATEGY_DISABLED, null},
                {__.V().as("a").out().program(emptyRequirementsVertexProgram).select("a"), "[[]]", null},
                {__.V().as("a").out().as("b").where(__.as("b").in().count().is(eq(3)).or().where(
                        __.as("b").out("created").and().as("b").has(T.label, "person"))).select("a", "b"),
                        "[[a, b], [[[a, b]]], []]", null}
        });
    }