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


Java GraphComputing类代码示例

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


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

示例1: apply

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

    for (final Step<?, ?> step : traversal.getSteps()) {
        if (step instanceof GraphComputing)
            ((GraphComputing) step).onGraphComputer();
    }
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:11,代码来源:ComputerFinalizationStrategy.java

示例2: apply

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

    if (!TraversalHelper.onGraphComputer(traversal))
        return;

    final boolean globalChild = TraversalHelper.isGlobalChild(traversal);

    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);
    }

    for (final Step<?, ?> step : traversal.getSteps()) {

        // only global children are graph computing
        if (globalChild && step instanceof GraphComputing)
            ((GraphComputing) step).onGraphComputer();

        // you can not traverse past the local star graph with localChildren (e.g. by()-modulators).
        if (step instanceof TraversalParent) {
            final Optional<Traversal.Admin<Object, Object>> traversalOptional = ((TraversalParent) step).getLocalChildren().stream()
                    .filter(t -> !TraversalHelper.isLocalStarGraph(t.asAdmin()))
                    .findAny();
            if (traversalOptional.isPresent())
                throw new VerificationException("Local traversals may not traverse past the local star-graph on GraphComputer: " + traversalOptional.get(), traversal);
        }

        // collecting barriers and dedup global use can only operate on the element and its properties (no incidences)
        if (step instanceof CollectingBarrierStep && step instanceof TraversalParent) {
            if (((TraversalParent) step).getLocalChildren().stream().filter(t -> !TraversalHelper.isLocalProperties(t)).findAny().isPresent())
                throw new VerificationException("The following barrier step can not process the incident edges of a vertex on GraphComputer: " + step, 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: " + step, traversal);

        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();
    }
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:56,代码来源:ComputerVerificationStrategy.java


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