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


Java HasStep类代码示例

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


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

示例1: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的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.filter.HasStep; //导入依赖的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

示例3: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的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

示例4: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的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

示例5: shouldRemoveStepsCorrectly

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Test
public void shouldRemoveStepsCorrectly() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    traversal.asAdmin().addStep(new IdentityStep(traversal));
    traversal.asAdmin().addStep(new HasStep(traversal));
    traversal.asAdmin().addStep(new LambdaFilterStep(traversal, traverser -> true));

    traversal.asAdmin().addStep(new PropertiesStep(traversal, PropertyType.VALUE, "marko"));
    traversal.asAdmin().removeStep(3);
    validateToyTraversal(traversal);

    traversal.asAdmin().addStep(0, new PropertiesStep(traversal, PropertyType.PROPERTY, "marko"));
    traversal.asAdmin().removeStep(0);
    validateToyTraversal(traversal);

    traversal.asAdmin().removeStep(1);
    traversal.asAdmin().addStep(1, new HasStep(traversal));
    validateToyTraversal(traversal);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:20,代码来源:TraversalHelperTest.java

示例6: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    boolean changed = true; // recursively walk child traversals trying to inline them into the current traversal line.
    while (changed) {
        changed = false;
        final Iterator<FilterStep> filterStepIterator = TraversalHelper.getStepsOfAssignableClass(FilterStep.class, traversal).iterator();
        while (!changed && filterStepIterator.hasNext()) {
            final FilterStep<?> step = filterStepIterator.next();
            changed = step instanceof HasStep && InlineFilterStrategy.processHasStep((HasStep) step, traversal) ||
                    step instanceof TraversalFilterStep && InlineFilterStrategy.processTraversalFilterStep((TraversalFilterStep) step, traversal) ||
                    step instanceof OrStep && InlineFilterStrategy.processOrStep((OrStep) step, traversal) ||
                    step instanceof AndStep && InlineFilterStrategy.processAndStep((AndStep) step, traversal);
        }
        if (!changed && traversal.getParent() instanceof EmptyStep) {
            final Iterator<MatchStep> matchStepIterator = TraversalHelper.getStepsOfClass(MatchStep.class, traversal).iterator();
            while (!changed && matchStepIterator.hasNext()) {
                if (InlineFilterStrategy.processMatchStep(matchStepIterator.next(), traversal))
                    changed = true;
            }
        }
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:23,代码来源:InlineFilterStrategy.java

示例7: apply

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

示例8: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    //Only optimize SqlgGraph. StarGraph also passes through here.
    //noinspection OptionalGetWithoutIsPresent
    if (!(traversal.getGraph().get() instanceof SqlgGraph)) {
        return;
    }
    List<HasStep> hasSteps = TraversalHelper.getStepsOfAssignableClass(HasStep.class, traversal);
    for (HasStep<?> hasStep : hasSteps) {

        SqlgHasStep sqlgHasStep = new SqlgHasStep(
                hasStep.getTraversal(),
                hasStep.getHasContainers().toArray(new HasContainer[]{})
        );
        for (String label : hasStep.getLabels()) {
            sqlgHasStep.addLabel(label);
        }
        TraversalHelper.replaceStep(
                hasStep,
                sqlgHasStep,
                hasStep.getTraversal()
        );
    }
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:25,代码来源:SqlgHasStepStrategy.java

示例9: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Override
public void apply(Traversal.Admin<?, ?> traversal) {
    if (this.selectFrom != null) {
        TraversalHelper.insertAfterStep(
                new HasStep(traversal, new HasContainer(TOPOLOGY_SELECTION_FROM, P.within(this.selectFrom))),
                traversal.getStartStep(),
                traversal
        );
    }
    if (this.selectWithout != null) {
        TraversalHelper.insertAfterStep(
                new HasStep(traversal, new HasContainer(TOPOLOGY_SELECTION_WITHOUT, P.within(this.selectWithout))),
                traversal.getStartStep(),
                traversal
        );
    }
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:18,代码来源:TopologyStrategy.java

示例10: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    TraversalHelper.getStepsOfAssignableClass(HasStep.class, traversal).stream()
            .filter(hasStep -> ((HasStep<?>) hasStep).getHasContainers().get(0).getKey().equals(T.id.getAccessor()))
            .forEach(hasStep -> ((HasStep<?>) hasStep).getHasContainers().get(0).setKey(this.idPropertyKey));

    if (traversal.getStartStep() instanceof GraphStep) {
        final GraphStep graphStep = (GraphStep) traversal.getStartStep();
        // only need to apply the custom id if ids were assigned - otherwise we want the full iterator.
        // note that it is then only necessary to replace the step if the id is a non-element.  other tests
        // in the suite validate that items in getIds() is uniform so it is ok to just test the first item
        // in the list.
        if (graphStep.getIds().length > 0 && !(graphStep.getIds()[0] instanceof Element)) {
            if (graphStep instanceof HasContainerHolder)
                ((HasContainerHolder) graphStep).addHasContainer(new HasContainer(this.idPropertyKey, P.within(Arrays.asList(graphStep.getIds()))));
            else
                TraversalHelper.insertAfterStep(new HasStep(traversal, new HasContainer(this.idPropertyKey, P.within(Arrays.asList(graphStep.getIds())))), graphStep, traversal);
            graphStep.clearIds();
        }
    }
    TraversalHelper.getStepsOfAssignableClass(IdStep.class, traversal).stream().forEach(step -> {
        TraversalHelper.replaceStep(step, new PropertiesStep(traversal, PropertyType.VALUE, idPropertyKey), traversal);
    });

    // in each case below, determine if the T.id is present and if so, replace T.id with the idPropertyKey or if
    // it is not present then shove it in there and generate an id
    traversal.getSteps().forEach(step -> {
        if (step instanceof AddVertexStep || step instanceof AddVertexStartStep || step instanceof AddEdgeStep) {
            final Parameterizing parameterizing = (Parameterizing) step;
            if (parameterizing.getParameters().contains(T.id))
                parameterizing.getParameters().rename(T.id, this.idPropertyKey);
            else if (!parameterizing.getParameters().contains(this.idPropertyKey))
                parameterizing.getParameters().set(this.idPropertyKey, idMaker.get());
        }
    });
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:37,代码来源:ElementIdStrategy.java

示例11: shouldNotFindStepOfClassInTraversal

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Test
public void shouldNotFindStepOfClassInTraversal() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));

    assertThat(TraversalHelper.hasStepOfClass(FilterStep.class, traversal), is(false));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:TraversalHelperTest.java

示例12: shouldFindStepOfClassInTraversal

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Test
public void shouldFindStepOfClassInTraversal() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new IdentityStep<>(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));

    assertThat(TraversalHelper.hasStepOfClass(IdentityStep.class, traversal), is(true));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:TraversalHelperTest.java

示例13: shouldNotFindStepOfAssignableClassInTraversal

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Test
public void shouldNotFindStepOfAssignableClassInTraversal() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));

    assertThat(TraversalHelper.hasStepOfAssignableClass(IdentityStep.class, traversal), is(false));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:TraversalHelperTest.java

示例14: shouldFindStepOfAssignableClassInTraversal

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Test
public void shouldFindStepOfAssignableClassInTraversal() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, new HasStep(traversal));

    assertThat(TraversalHelper.hasStepOfAssignableClass(FilterStep.class, traversal), is(true));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:TraversalHelperTest.java

示例15: shouldGetTheStepIndex

import org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep; //导入依赖的package包/类
@Test
public void shouldGetTheStepIndex() {
    final Traversal.Admin traversal = new DefaultTraversal<>(EmptyGraph.instance());
    final HasStep hasStep = new HasStep(traversal);
    traversal.asAdmin().addStep(0, new HasStep(traversal));
    traversal.asAdmin().addStep(0, hasStep);
    traversal.asAdmin().addStep(0, new HasStep(traversal));

    assertEquals(1, TraversalHelper.stepIndex(hasStep, traversal));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:11,代码来源:TraversalHelperTest.java


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