当前位置: 首页>>代码示例>>Java>>正文


Java Step类代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.Step的典型用法代码示例。如果您正苦于以下问题:Java Step类的具体用法?Java Step怎么用?Java Step使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Step类属于org.apache.tinkerpop.gremlin.process.traversal包,在下文中一共展示了Step类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    if (TraversalHelper.onGraphComputer(traversal))
        return;

    for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
        final TinkerGraphStep<?, ?> tinkerGraphStep = new TinkerGraphStep<>(originalGraphStep);
        TraversalHelper.replaceStep(originalGraphStep, tinkerGraphStep, traversal);
        Step<?, ?> currentStep = tinkerGraphStep.getNextStep();
        while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
            if (currentStep instanceof HasStep) {
                for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
                    if (!GraphStep.processHasContainerIds(tinkerGraphStep, hasContainer))
                        tinkerGraphStep.addHasContainer(hasContainer);
                }
                TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
                traversal.removeStep(currentStep);
            }
            currentStep = currentStep.getNextStep();
        }
    }
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:23,代码来源:TinkerGraphStepStrategy.java

示例2: apply

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    if (!(traversal.getParent() instanceof EmptyStep) || TraversalHelper.onGraphComputer(traversal))
        return;
    final List<Step> steps = traversal.getSteps();
    if (steps.size() < 2 ||
            !(steps.get(0) instanceof GraphStep) ||
            0 != ((GraphStep) steps.get(0)).getIds().length ||
            !(steps.get(steps.size() - 1) instanceof CountGlobalStep))
        return;
    for (int i = 1; i < steps.size() - 1; i++) {
        final Step current = steps.get(i);
        if (!(current instanceof MapStep ||
                current instanceof IdentityStep ||
                current instanceof NoOpBarrierStep ||
                current instanceof CollectingBarrierStep) ||
                (current instanceof TraversalParent &&
                        TraversalHelper.anyStepRecursively(s -> (s instanceof SideEffectStep || s instanceof AggregateStep), (TraversalParent) current)))
            return;
    }
    final Class<? extends Element> elementClass = ((GraphStep<?, ?>) steps.get(0)).getReturnClass();
    TraversalHelper.removeAllSteps(traversal);
    traversal.addStep(new TinkerCountGlobalStep<>(traversal, elementClass));
}
 
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:25,代码来源:TinkerGraphCountStrategy.java

示例3: apply

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
	for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
		final BitsyGraphStep<?, ?> bitsyGraphStep = new BitsyGraphStep<>(originalGraphStep);
		TraversalHelper.replaceStep(originalGraphStep, bitsyGraphStep, traversal);
		Step<?, ?> currentStep = bitsyGraphStep.getNextStep();
		while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
			if (currentStep instanceof HasStep) {
				for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
					if (!GraphStep.processHasContainerIds(bitsyGraphStep, hasContainer))
						bitsyGraphStep.addHasContainer(hasContainer);
				}
				TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
				traversal.removeStep(currentStep);
			}
			currentStep = currentStep.getNextStep();
		}
	}
}
 
开发者ID:lambdazen,项目名称:bitsy,代码行数:20,代码来源:BitsyTraversalStrategy.java

示例4: testEquality

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@Test
public void testEquality() {
    final List<Step> instances1 = this.getStepInstances();
    final List<Step> instances2 = this.getStepInstances();
    for (int i = 0; i < instances1.size(); i++) {
        final Step instance1 = instances1.get(i);
        assertEquals(instance1, instance1.clone());
        assertEquals(instance1.hashCode(), instance1.clone().hashCode());
        for (int j = 0; j < instances2.size(); j++) {
            final Step instance2 = instances2.get(j);
            if (i != j) {
                assertNotEquals(instance1, instance2);
                assertNotEquals(instance1.hashCode(), instance2.hashCode());
            } else {
                assertEquals(instance1, instance2);
                assertEquals(instance1.hashCode(), instance2.hashCode());
            }
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:StepTest.java

示例5: apply

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    for (final VertexStep originalVertexStep : TraversalHelper.getStepsOfClass(VertexStep.class, traversal)) {
        final HBaseVertexStep<?> hbaseVertexStep = new HBaseVertexStep<>(originalVertexStep);
        TraversalHelper.replaceStep(originalVertexStep, hbaseVertexStep, traversal);
        Step<?, ?> currentStep = hbaseVertexStep.getNextStep();
        while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
            if (currentStep instanceof HasStep) {
                for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
                    hbaseVertexStep.addHasContainer(hasContainer);
                }
                TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
                traversal.removeStep(currentStep);
            }
            currentStep = currentStep.getNextStep();
        }
    }
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:20,代码来源:HBaseVertexStepStrategy.java

示例6: apply

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
        final HBaseGraphStep<?, ?> hbaseGraphStep = new HBaseGraphStep<>(originalGraphStep);
        TraversalHelper.replaceStep(originalGraphStep, hbaseGraphStep, traversal);
        Step<?, ?> currentStep = hbaseGraphStep.getNextStep();
        while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
            if (currentStep instanceof HasStep) {
                for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
                    if (!GraphStep.processHasContainerIds(hbaseGraphStep, hasContainer))
                        hbaseGraphStep.addHasContainer(hasContainer);
                }
                TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
                traversal.removeStep(currentStep);
            }
            currentStep = currentStep.getNextStep();
        }
    }
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:21,代码来源:HBaseGraphStepStrategy.java

示例7: processNextStart

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@Override
protected Traverser.Admin<E> processNextStart() {
    while (true) {
        if (this.iterator.hasNext()) {
            return this.isStart ? this.getTraversal().getTraverserGenerator().generate(this.iterator.next(), (Step) this, 1l) : this.head.split(this.iterator.next(), this);
        } else {
            if (this.isStart) {
                if (this.done)
                    throw FastNoSuchElementException.instance();
                else {
                    this.done = true;
                    this.iterator = null == this.iteratorSupplier ? EmptyIterator.instance() : this.iteratorSupplier.get();
                }
            } else {
                this.head = this.starts.next();
                this.iterator = null == this.iteratorSupplier ? EmptyIterator.instance() : this.iteratorSupplier.get();
            }
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:GraphStep.java

示例8: recursiveTestTraversals

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
private void recursiveTestTraversals(final Traversal.Admin<?, ?> traversal, final TraversalSideEffects sideEffects, final Set aValue, final int bValue) {
    assertTrue(traversal.getSideEffects() == sideEffects);
    assertEquals(sideEffects.keys().size(), traversal.getSideEffects().keys().size());
    assertEquals(bValue, traversal.getSideEffects().<Integer>get("b").intValue());
    assertEquals(aValue.size(), traversal.getSideEffects().<Set>get("a").size());
    assertFalse(aValue.stream().filter(k -> !traversal.getSideEffects().<Set>get("a").contains(k)).findAny().isPresent());
    assertFalse(traversal.getSideEffects().exists("c"));
    for (final Step<?, ?> step : traversal.getSteps()) {
        assertTrue(step.getTraversal().getSideEffects() == sideEffects);
        assertEquals(sideEffects.keys().size(), step.getTraversal().getSideEffects().keys().size());
        assertEquals(bValue, step.getTraversal().getSideEffects().<Integer>get("b").intValue());
        assertEquals(aValue.size(), step.getTraversal().getSideEffects().<Set>get("a").size());
        assertFalse(aValue.stream().filter(k -> !step.getTraversal().getSideEffects().<Set>get("a").contains(k)).findAny().isPresent());
        assertFalse(step.getTraversal().getSideEffects().exists("c"));
        if (step instanceof TraversalParent) {
            ((TraversalParent) step).getGlobalChildren().forEach(t -> this.recursiveTestTraversals(t, sideEffects, aValue, bValue));
            ((TraversalParent) step).getLocalChildren().forEach(t -> this.recursiveTestTraversals(t, sideEffects, aValue, bValue));
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:DefaultTraversalTest.java

示例9: shouldAlterTraversalToIncludeIdWhereNecessary

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@Test
public void shouldAlterTraversalToIncludeIdWhereNecessary() {
    final ElementIdStrategy strategy = ElementIdStrategy.build().create();
    strategy.apply(traversal.asAdmin());

    final Step step = (Step) traversal.asAdmin().getSteps().get(expectedInsertedSteps);
    if (step instanceof AddVertexStep)
        assertTrue(((AddVertexStep) step).getParameters().contains(strategy.getIdPropertyKey()));
    else if (step instanceof AddVertexStartStep)
        assertTrue(((AddVertexStartStep) step).getParameters().contains(strategy.getIdPropertyKey()));
    else if (step instanceof AddEdgeStep)
        assertTrue(((AddEdgeStep) step).getParameters().contains(strategy.getIdPropertyKey()));
    else if (step instanceof PropertiesStep)
        assertEquals(strategy.getIdPropertyKey(), ((PropertiesStep) step).getPropertyKeys()[0]);
    else
        fail("Check test definition - the expectedInsertedSteps should be the index of the step to trigger the ID substitution");
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:ElementIdStrategyTraverseTest.java

示例10: determineStartLabelForHasPullOut

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
private String determineStartLabelForHasPullOut(final MatchStep<?, ?> matchStep) {
    if (!(matchStep.getTraversal().getParent() instanceof EmptyStep))
        return null;
    else {
        final String startLabel = MatchStep.Helper.computeStartLabel(matchStep.getGlobalChildren());
        Step<?, ?> previousStep = matchStep.getPreviousStep();
        if (previousStep.getLabels().contains(startLabel))
            return startLabel;
        while (!(previousStep instanceof EmptyStep)) {
            if (!previousStep.getLabels().isEmpty())
                return null;
            previousStep = previousStep.getPreviousStep();
        }
        return startLabel;
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:MatchPredicateStrategy.java

示例11: prepTraversalForProfiling

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
private void prepTraversalForProfiling(Traversal.Admin<?, ?> traversal) {
    // Add .profile() step after every pre-existing step.
    final List<Step> steps = traversal.getSteps();
    final int numSteps = steps.size();
    for (int ii = 0; ii < numSteps; ii++) {
        // Get the original step
        final Step step = steps.get(ii * 2);

        // Do not inject profiling after ProfileSideEffectStep as this will be the last step on the root traversal.
        if (step instanceof ProfileSideEffectStep) {
            break;
        }

        // Create and inject ProfileStep
        ProfileStep profileStep = new ProfileStep(traversal);
        traversal.addStep((ii * 2) + 1, profileStep);
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:ProfileStrategy.java

示例12: apply

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    if (TraversalHelper.hasStepOfAssignableClassRecursively(INVALIDATING_STEP_CLASSES, TraversalHelper.getRootTraversal(traversal)))
        return;
    final Collection<Pair<VertexStep, Step>> stepsToReplace = new ArrayList<>();
    Step prev = null;
    for (final Step curr : traversal.getSteps()) {
        if (isOptimizable(prev, curr)) {
            stepsToReplace.add(Pair.with((VertexStep) prev, curr));
        }
        prev = curr;
    }
    if (!stepsToReplace.isEmpty()) {
        for (final Pair<VertexStep, Step> pair : stepsToReplace) {
            optimizeSteps(traversal, pair.getValue0(), pair.getValue1());
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:IncidentToAdjacentStrategy.java

示例13: getKeepLabels

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
private List<Object> getKeepLabels(final Traversal.Admin<?, ?> traversal) {
    List<Object> keepLabels = new ArrayList<>();
    for (Step step : traversal.getSteps()) {
        if (step instanceof PathProcessor) {
            final Set<String> keepers = ((PathProcessor) step).getKeepLabels();
            if (keepers != null)
                keepLabels.add(keepers);
        }
        if (step instanceof TraversalParent) {
            final TraversalParent parent = (TraversalParent) step;
            final List<Traversal.Admin<?, ?>> children = new ArrayList<>();
            children.addAll(parent.getGlobalChildren());
            children.addAll(parent.getLocalChildren());
            for (final Traversal.Admin<?, ?> child : children) {
                final List<Object> childLabels = getKeepLabels(child);
                if (childLabels.size() > 0) {
                    keepLabels.add(childLabels);
                }
            }
        }
    }
    return keepLabels;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:24,代码来源:PathRetractionStrategyTest.java

示例14: apply

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    TraversalHelper.getStepsOfClass(GraphStep.class, traversal).forEach(originalGraphStep -> {
        final Neo4jGraphStep<?, ?> neo4jGraphStep = new Neo4jGraphStep<>(originalGraphStep);
        TraversalHelper.replaceStep(originalGraphStep, (Step) neo4jGraphStep, traversal);
        Step<?, ?> currentStep = neo4jGraphStep.getNextStep();
        while (currentStep instanceof HasContainerHolder) {
            ((HasContainerHolder) currentStep).getHasContainers().forEach(hasContainer -> {
                if (!GraphStep.processHasContainerIds(neo4jGraphStep, hasContainer))
                    neo4jGraphStep.addHasContainer(hasContainer);
            });
            currentStep.getLabels().forEach(neo4jGraphStep::addLabel);
            traversal.removeStep(currentStep);
            currentStep = currentStep.getNextStep();
        }
    });
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:Neo4jGraphStepStrategy.java

示例15: getStepsOfAssignableClassRecursively

import org.apache.tinkerpop.gremlin.process.traversal.Step; //导入依赖的package包/类
public static <S> List<S> getStepsOfAssignableClassRecursively(final Scope scope, final Class<S> stepClass, final Traversal.Admin<?, ?> traversal) {
    final List<S> list = new ArrayList<>();
    for (final Step<?, ?> step : traversal.getSteps()) {
        if (stepClass.isAssignableFrom(step.getClass()))
            list.add((S) step);
        if (step instanceof TraversalParent) {
            if (null == scope || Scope.local.equals(scope)) {
                for (final Traversal.Admin<?, ?> localChild : ((TraversalParent) step).getLocalChildren()) {
                    list.addAll(TraversalHelper.getStepsOfAssignableClassRecursively(stepClass, localChild));
                }
            }
            if (null == scope || Scope.global.equals(scope)) {
                for (final Traversal.Admin<?, ?> globalChild : ((TraversalParent) step).getGlobalChildren()) {
                    list.addAll(TraversalHelper.getStepsOfAssignableClassRecursively(stepClass, globalChild));
                }
            }
        }
    }
    return list;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:TraversalHelper.java


注:本文中的org.apache.tinkerpop.gremlin.process.traversal.Step类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。