Search in sources :

Example 1 with EdgeVertexWithByStep

use of com.alibaba.maxgraph.tinkerpop.steps.EdgeVertexWithByStep in project GraphScope by alibaba.

the class TreeBuilder method travelTraversalAdmin.

private <S, E> TreeNode travelTraversalAdmin(Traversal.Admin<S, E> admin, TreeNode parent) {
    // Reuse optimizations from TinkerPop if related.
    if (!admin.isLocked()) {
        List<Step> originalStepList = admin.getSteps();
        List<Step> replaceStepList = Lists.newArrayList();
        for (Step step : originalStepList) {
            if (step instanceof EdgeVertexWithByStep && null == ((EdgeVertexWithByStep) step).getFunction()) {
                replaceStepList.add(step);
            }
        }
        for (Step step : replaceStepList) {
            TraversalHelper.replaceStep(step, ((EdgeVertexWithByStep) step).getEdgeVertexStep(), admin);
        }
        admin.getStrategies().removeStrategies(ProfileStrategy.class, MxGraphStepStrategy.class, FilterRankingStrategy.class, StandardVerificationStrategy.class, IncidentToAdjacentStrategy.class, AdjacentToIncidentStrategy.class);
        if (this.disableBarrierOptimizer) {
            admin.getStrategies().removeStrategies(RepeatUnrollStrategy.class, LazyBarrierStrategy.class);
        }
        admin.getStrategies().addStrategies(MaxGraphFilterRankingStrategy.instance());
        admin.applyStrategies();
    }
    Step step = admin.getStartStep();
    if (step.equals(EmptyStep.instance())) {
        TreeNode treeNode = travelTraversalDirectly(admin, parent);
        if (rootPathFlag) {
            UnaryTreeNode.class.cast(treeNode).setPathFlag(true);
        }
        return treeNode;
    }
    TreeNode treeNode = parent;
    while (!step.equals(EmptyStep.instance())) {
        treeNode = visitStep(step, treeNode);
        processPathFlag(treeNode, step);
        Set<String> labelList = step.getLabels();
        for (String label : labelList) {
            if (!StringUtils.startsWith(label, "~gremlin.")) {
                this.treeNodeLabelManager.addUserTreeNodeLabel(label, treeNode);
            }
        }
        step = step.getNextStep();
    }
    return treeNode;
}
Also used : EdgeVertexWithByStep(com.alibaba.maxgraph.tinkerpop.steps.EdgeVertexWithByStep) SourceTreeNode(com.alibaba.maxgraph.compiler.tree.source.SourceTreeNode) EstimateCountTreeNode(com.alibaba.maxgraph.compiler.tree.source.EstimateCountTreeNode) SourceEdgeTreeNode(com.alibaba.maxgraph.compiler.tree.source.SourceEdgeTreeNode) SourceVertexTreeNode(com.alibaba.maxgraph.compiler.tree.source.SourceVertexTreeNode) SourceCreateGraphTreeNode(com.alibaba.maxgraph.compiler.tree.source.SourceCreateGraphTreeNode) PageRankStep(com.alibaba.maxgraph.tinkerpop.steps.PageRankStep) WherePredicateStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.WherePredicateStep) SampleGlobalStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.SampleGlobalStep) DedupGlobalStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.DedupGlobalStep) ShortestPathVertexProgramStep(org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.ShortestPathVertexProgramStep) OrStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.OrStep) ShortestPathStep(com.alibaba.maxgraph.tinkerpop.steps.ShortestPathStep) UnionStep(org.apache.tinkerpop.gremlin.process.traversal.step.branch.UnionStep) OutputVineyardStep(com.alibaba.maxgraph.tinkerpop.steps.OutputVineyardStep) PeerPressureVertexProgramStep(org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PeerPressureVertexProgramStep) LambdaFilterStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.LambdaFilterStep) IsStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.IsStep) LabelPropagationStep(com.alibaba.maxgraph.tinkerpop.steps.LabelPropagationStep) SideEffectCapStep(org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SideEffectCapStep) EmptyStep(org.apache.tinkerpop.gremlin.process.traversal.step.util.EmptyStep) CustomVertexProgramStep(com.alibaba.maxgraph.tinkerpop.steps.CustomVertexProgramStep) AllPathStep(com.alibaba.maxgraph.tinkerpop.steps.AllPathStep) ConnectedComponentVertexProgramStep(org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.ConnectedComponentVertexProgramStep) LpaVertexProgramStep(com.alibaba.maxgraph.tinkerpop.steps.LpaVertexProgramStep) ComputerAwareStep(org.apache.tinkerpop.gremlin.process.traversal.step.util.ComputerAwareStep) RangeGlobalStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.RangeGlobalStep) HitsVertexProgramStep(com.alibaba.maxgraph.tinkerpop.steps.HitsVertexProgramStep) CreateGraphStep(com.alibaba.maxgraph.tinkerpop.steps.CreateGraphStep) AggregateLocalStep(org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.AggregateLocalStep) ConnectedComponentsStep(com.alibaba.maxgraph.tinkerpop.steps.ConnectedComponentsStep) EstimateCountStep(com.alibaba.maxgraph.tinkerpop.steps.EstimateCountStep) AndStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.AndStep) HitsStep(com.alibaba.maxgraph.tinkerpop.steps.HitsStep) EdgeVertexWithByStep(com.alibaba.maxgraph.tinkerpop.steps.EdgeVertexWithByStep) VertexByModulatingStep(com.alibaba.maxgraph.tinkerpop.steps.VertexByModulatingStep) MaxGraphStep(com.alibaba.maxgraph.tinkerpop.steps.MaxGraphStep) HasStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.HasStep) VertexWithByStep(com.alibaba.maxgraph.tinkerpop.steps.VertexWithByStep) PathFilterStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.PathFilterStep) FilterStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.FilterStep) ChooseStep(org.apache.tinkerpop.gremlin.process.traversal.step.branch.ChooseStep) NotStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.NotStep) RepeatStep(org.apache.tinkerpop.gremlin.process.traversal.step.branch.RepeatStep) ConnectiveStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.ConnectiveStep) TraversalVertexProgramStep(org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.TraversalVertexProgramStep) PageRankVertexProgramStep(org.apache.tinkerpop.gremlin.process.computer.traversal.step.map.PageRankVertexProgramStep) Step(org.apache.tinkerpop.gremlin.process.traversal.Step) IdentityStep(org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.IdentityStep) SubgraphStep(org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.SubgraphStep) OutputStep(com.alibaba.maxgraph.tinkerpop.steps.OutputStep) TraversalFilterStep(org.apache.tinkerpop.gremlin.process.traversal.step.filter.TraversalFilterStep) BranchStep(org.apache.tinkerpop.gremlin.process.traversal.step.branch.BranchStep)

Aggregations

EstimateCountTreeNode (com.alibaba.maxgraph.compiler.tree.source.EstimateCountTreeNode)1 SourceCreateGraphTreeNode (com.alibaba.maxgraph.compiler.tree.source.SourceCreateGraphTreeNode)1 SourceEdgeTreeNode (com.alibaba.maxgraph.compiler.tree.source.SourceEdgeTreeNode)1 SourceTreeNode (com.alibaba.maxgraph.compiler.tree.source.SourceTreeNode)1 SourceVertexTreeNode (com.alibaba.maxgraph.compiler.tree.source.SourceVertexTreeNode)1 AllPathStep (com.alibaba.maxgraph.tinkerpop.steps.AllPathStep)1 ConnectedComponentsStep (com.alibaba.maxgraph.tinkerpop.steps.ConnectedComponentsStep)1 CreateGraphStep (com.alibaba.maxgraph.tinkerpop.steps.CreateGraphStep)1 CustomVertexProgramStep (com.alibaba.maxgraph.tinkerpop.steps.CustomVertexProgramStep)1 EdgeVertexWithByStep (com.alibaba.maxgraph.tinkerpop.steps.EdgeVertexWithByStep)1 EstimateCountStep (com.alibaba.maxgraph.tinkerpop.steps.EstimateCountStep)1 HitsStep (com.alibaba.maxgraph.tinkerpop.steps.HitsStep)1 HitsVertexProgramStep (com.alibaba.maxgraph.tinkerpop.steps.HitsVertexProgramStep)1 LabelPropagationStep (com.alibaba.maxgraph.tinkerpop.steps.LabelPropagationStep)1 LpaVertexProgramStep (com.alibaba.maxgraph.tinkerpop.steps.LpaVertexProgramStep)1 MaxGraphStep (com.alibaba.maxgraph.tinkerpop.steps.MaxGraphStep)1 OutputStep (com.alibaba.maxgraph.tinkerpop.steps.OutputStep)1 OutputVineyardStep (com.alibaba.maxgraph.tinkerpop.steps.OutputVineyardStep)1 PageRankStep (com.alibaba.maxgraph.tinkerpop.steps.PageRankStep)1 ShortestPathStep (com.alibaba.maxgraph.tinkerpop.steps.ShortestPathStep)1