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


Java VertexStep类代码示例

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


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

示例1: apply

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

示例2: isLocalProperties

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
public static boolean isLocalProperties(final Traversal.Admin<?, ?> traversal) {
    for (final Step step : traversal.getSteps()) {
        if (step instanceof RepeatStep &&
                ((RepeatStep<?>) step).getGlobalChildren().stream()
                        .flatMap(t -> t.getSteps().stream())
                        .filter(s -> s instanceof VertexStep)
                        .findAny()
                        .isPresent())  // TODO: is this sufficient?
            return false;
        else if (step instanceof VertexStep) {
            return false;
        } else if (step instanceof EdgeVertexStep) {
            return false;
        } else if (step instanceof TraversalParent) {
            if (((TraversalParent) step).getLocalChildren().stream()
                    .filter(t -> !isLocalProperties(t.asAdmin()))
                    .findAny().isPresent()) return false;
        }
    }
    return true;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:22,代码来源:TraversalHelper.java

示例3: apply

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

示例4: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
@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) {
            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));
        }
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:26,代码来源:SparkSingleIterationStrategy.java

示例5: UniGraphVertexStep

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
public UniGraphVertexStep(VertexStep<E> vertexStep, UniGraph graph, ControllerManager controllerManager) {
    super(vertexStep.getTraversal(), graph);
    vertexStep.getLabels().forEach(this::addLabel);
    this.direction = vertexStep.getDirection();
    this.returnClass = vertexStep.getReturnClass();
    this.returnsVertex = vertexStep.returnsVertex();
    if (vertexStep.getEdgeLabels().length > 0) {
        this.edgeLabels = vertexStep.getEdgeLabels();
        HasContainer labelsPredicate = new HasContainer(T.label.getAccessor(), P.within(vertexStep.getEdgeLabels()));
        this.predicates = PredicatesHolderFactory.predicate(labelsPredicate);
    } else this.predicates = PredicatesHolderFactory.empty();
    this.controllers = controllerManager.getControllers(SearchVertexQuery.SearchVertexController.class);
    this.deferredVertexControllers = controllerManager.getControllers(DeferredVertexQuery.DeferredVertexController.class);
    this.stepDescriptor = new StepDescriptor(this);
    limit = -1;
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:17,代码来源:UniGraphVertexStep.java

示例6: isLocalProperties

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
public static boolean isLocalProperties(final Traversal.Admin<?, ?> traversal) {
    for (final Step step : traversal.getSteps()) {
        if (step instanceof RepeatStep) {
            for (final Traversal.Admin<?, ?> global : ((RepeatStep<?>) step).getGlobalChildren()) {
                if (TraversalHelper.hasStepOfAssignableClass(VertexStep.class, global))
                    return false;
            }
        } else if (step instanceof VertexStep) {
            return false;
        } else if (step instanceof EdgeVertexStep) {
            return false;
        } else if (step instanceof TraversalParent) {
            for (final Traversal.Admin<?, ?> local : ((TraversalParent) step).getLocalChildren()) {
                if (!TraversalHelper.isLocalProperties(local))
                    return false;
            }
        }
    }
    return true;
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:21,代码来源:TraversalHelper.java

示例7: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
    // using a hidden label marker to denote whether the traversal should not be processed by this strategy
    if ((traversal.getParent() instanceof EmptyStep || traversal.getParent() instanceof VertexProgramStep) &&
            TraversalHelper.hasStepOfAssignableClassRecursively(INVALIDATING_STEP_CLASSES, traversal))
        TraversalHelper.applyTraversalRecursively(t -> t.getStartStep().addLabel(MARKER), traversal);
    if (traversal.getStartStep().getLabels().contains(MARKER)) {
        traversal.getStartStep().removeLabel(MARKER);
        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:apache,项目名称:tinkerpop,代码行数:26,代码来源:IncidentToAdjacentStrategy.java

示例8: processesPropertyType

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
private static final char processesPropertyType(Step step) {
    while (!(step instanceof EmptyStep)) {
        if (step instanceof FilterStep || step instanceof SideEffectStep)
            step = step.getPreviousStep();
        else if (step instanceof GraphStep && ((GraphStep) step).returnsVertex())
            return 'v';
        else if (step instanceof EdgeVertexStep)
            return 'v';
        else if (step instanceof VertexStep)
            return ((VertexStep) step).returnsVertex() ? 'v' : 'p';
        else if (step instanceof PropertyMapStep || step instanceof PropertiesStep)
            return 'p';
        else
            return 'x';
    }
    return 'x';
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:18,代码来源:SubgraphStrategy.java

示例9: shouldNotRetainMarkers

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
@Test
public void shouldNotRetainMarkers() {
    final SubgraphStrategy strategy = SubgraphStrategy.build().vertices(__.<Vertex>out().hasLabel("person")).create();
    final Traversal.Admin<?, ?> t = out().inE().asAdmin();
    t.setStrategies(t.getStrategies().clone().addStrategies(strategy, StandardVerificationStrategy.instance()));
    t.applyStrategies();
    assertEquals(t.getSteps().get(0).getClass(), VertexStep.class);
    assertEquals(t.getSteps().get(1).getClass(), TraversalFilterStep.class);
    assertEquals(AndStep.class, ((TraversalFilterStep<?>) t.getSteps().get(1)).getLocalChildren().get(0).getStartStep().getClass());
    assertEquals(0, ((TraversalFilterStep<?>) t.getSteps().get(1)).getLocalChildren().get(0).getStartStep().getLabels().size());
    assertEquals(t.getSteps().get(2).getClass(), EdgeVertexStep.class);
    assertEquals(t.getSteps().get(3).getClass(), TraversalFilterStep.class);
    assertEquals(VertexStep.class, ((TraversalFilterStep<?>) t.getSteps().get(3)).getLocalChildren().get(0).getStartStep().getClass());
    assertEquals(0, ((TraversalFilterStep<?>) t.getSteps().get(3)).getLocalChildren().get(0).getStartStep().getLabels().size());
    TraversalHelper.getStepsOfAssignableClassRecursively(Step.class, t).forEach(step -> assertTrue(step.getLabels().isEmpty()));
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:17,代码来源:SubgraphStrategyTest.java

示例10: SqlgRepeatStepBarrier

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
public SqlgRepeatStepBarrier(final Traversal.Admin traversal, RepeatStep<S> repeatStep) {
    super(traversal);
    this.repeatTraversal = repeatStep.getRepeatTraversal();
    this.untilTraversal = repeatStep.getUntilTraversal();
    this.emitTraversal = repeatStep.getEmitTraversal();
    this.untilFirst = repeatStep.untilFirst;
    this.emitFirst = repeatStep.emitFirst;
    List<RepeatStep.RepeatEndStep> repeatEndSteps = TraversalHelper.getStepsOfAssignableClass(RepeatStep.RepeatEndStep.class, this.repeatTraversal);
    Preconditions.checkState(repeatEndSteps.size() == 1, "Only handling one RepeatEndStep! Found " + repeatEndSteps.size());
    TraversalHelper.replaceStep(repeatEndSteps.get(0), new SqlgRepeatStepBarrier.SqlgRepeatEndStepBarrier(this.repeatTraversal), this.repeatTraversal);
    this.optimizeUntil = this.untilTraversal != null &&
            (
                    TraversalHelper.anyStepRecursively(
                            (s) -> (s instanceof VertexStep) || (s instanceof EdgeVertexStep) || (s instanceof EdgeOtherVertexStep),
                            this.untilTraversal
                    ) ||
                            true
            );
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:20,代码来源:SqlgRepeatStepBarrier.java

示例11: doFirst

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
/**
 * EdgeOtherVertexStep can not be optimized as the direction information is lost.
 *
 * @param stepIterator
 * @param step
 * @param pathCount
 * @return
 */
@Override
protected boolean doFirst(ListIterator<Step<?, ?>> stepIterator, Step<?, ?> step, MutableInt pathCount) {
    if (!(step instanceof VertexStep || step instanceof EdgeVertexStep || step instanceof ChooseStep || step instanceof OptionalStep)) {
        return false;
    }
    if (step instanceof OptionalStep) {
        if (unoptimizableOptionalStep((OptionalStep<?>) step)) {
            return false;
        }
    }
    if (step instanceof ChooseStep) {
        if (unoptimizableChooseStep((ChooseStep<?, ?, ?>) step)) {
            return false;
        }
    }
    this.sqlgStep = constructSqlgStep(step);
    TraversalHelper.insertBeforeStep(this.sqlgStep, step, this.traversal);
    return true;
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:28,代码来源:VertexStrategy.java

示例12: isOptimizable

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
/**
 * Checks whether a given step is optimizable or not.
 *
 * @param step1 an edge-emitting step
 * @param step2 a vertex-emitting step
 * @return <code>true</code> if step1 is not labeled and emits edges and step2 emits vertices,
 * otherwise <code>false</code>
 */
private static boolean isOptimizable(final Step step1, final Step step2) {
    if (step1 instanceof VertexStep && ((VertexStep) step1).returnsEdge() && step1.getLabels().isEmpty()) {
        final Direction step1Dir = ((VertexStep) step1).getDirection();
        if (step1Dir.equals(Direction.BOTH)) {
            return step2 instanceof EdgeOtherVertexStep;
        }
        return step2 instanceof EdgeVertexStep && ((EdgeVertexStep) step2).getDirection().equals(step1Dir.opposite());
    }
    return false;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:19,代码来源:IncidentToAdjacentStrategy.java

示例13: optimizeSteps

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
/**
 * Optimizes the given edge-emitting step and the vertex-emitting step by replacing them with a single
 * vertex-emitting step.
 *
 * @param traversal the traversal that holds the given steps
 * @param step1     the edge-emitting step to replace
 * @param step2     the vertex-emitting step to replace
 */
private static void optimizeSteps(final Traversal.Admin traversal, final VertexStep step1, final Step step2) {
    final Step newStep = new VertexStep(traversal, Vertex.class, step1.getDirection(), step1.getEdgeLabels());
    for (final String label : (Iterable<String>) step2.getLabels()) {
        newStep.addLabel(label);
    }
    TraversalHelper.replaceStep(step1, newStep, traversal);
    traversal.removeStep(step2);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:17,代码来源:IncidentToAdjacentStrategy.java

示例14: reverse

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
public static <S, E> Traversal.Admin<S, E> reverse(final Traversal.Admin<S, E> traversal) {
    for (final Step step : traversal.getSteps()) {
        if (step instanceof VertexStep)
            ((VertexStep) step).reverseDirection();
        if (step instanceof EdgeVertexStep)
            ((EdgeVertexStep) step).reverseDirection();
    }
    return traversal;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:VertexProgramHelper.java

示例15: shouldAddFilterAfterEdge

import org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep; //导入依赖的package包/类
@Test
public void shouldAddFilterAfterEdge() {
    final SubgraphStrategy strategy = SubgraphStrategy.build().edgeCriterion(__.identity()).create();
    final Traversal t = __.inE();
    strategy.apply(t.asAdmin());
    final VertexStep vertexStep = (VertexStep) t.asAdmin().getStartStep();
    assertEquals(TraversalFilterStep.class, vertexStep.getNextStep().getClass());
    final TraversalFilterStep h = (TraversalFilterStep) t.asAdmin().getEndStep();
    assertEquals(1, h.getLocalChildren().size());
    assertThat(((DefaultGraphTraversal) h.getLocalChildren().get(0)).getEndStep(), CoreMatchers.instanceOf(IdentityStep.class));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:12,代码来源:SubgraphStrategyTest.java


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