Search in sources :

Example 6 with UniGraph

use of org.unipop.structure.UniGraph in project unipop by unipop-graph.

the class UniGraphCoalesceStepStrategy method apply.

@Override
public void apply(Traversal.Admin<?, ?> traversal) {
    Graph graph = traversal.getGraph().get();
    if (!(graph instanceof UniGraph)) {
        return;
    }
    UniGraph uniGraph = (UniGraph) graph;
    TraversalHelper.getStepsOfClass(CoalesceStep.class, traversal).forEach(coalesceStep -> {
        UniGraphCoalesceStep uniGraphCoalesceStep = new UniGraphCoalesceStep(coalesceStep.getTraversal(), uniGraph, coalesceStep.getLocalChildren());
        TraversalHelper.replaceStep(coalesceStep, uniGraphCoalesceStep, traversal);
    });
}
Also used : UniGraph(org.unipop.structure.UniGraph) UniGraphCoalesceStep(org.unipop.process.coalesce.UniGraphCoalesceStep) Graph(org.apache.tinkerpop.gremlin.structure.Graph) UniGraph(org.unipop.structure.UniGraph) UniGraphCoalesceStep(org.unipop.process.coalesce.UniGraphCoalesceStep) CoalesceStep(org.apache.tinkerpop.gremlin.process.traversal.step.map.CoalesceStep)

Aggregations

UniGraph (org.unipop.structure.UniGraph)6 Graph (org.apache.tinkerpop.gremlin.structure.Graph)5 Traversal (org.apache.tinkerpop.gremlin.process.traversal.Traversal)3 TraversalParent (org.apache.tinkerpop.gremlin.process.traversal.step.TraversalParent)2 RepeatStep (org.apache.tinkerpop.gremlin.process.traversal.step.branch.RepeatStep)2 TraversalStrategy (org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy)1 UnionStep (org.apache.tinkerpop.gremlin.process.traversal.step.branch.UnionStep)1 CoalesceStep (org.apache.tinkerpop.gremlin.process.traversal.step.map.CoalesceStep)1 EdgeOtherVertexStep (org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeOtherVertexStep)1 EdgeVertexStep (org.apache.tinkerpop.gremlin.process.traversal.step.map.EdgeVertexStep)1 GraphStep (org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep)1 VertexStep (org.apache.tinkerpop.gremlin.process.traversal.step.map.VertexStep)1 AbstractTraversalStrategy (org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy)1 TraversalHelper (org.apache.tinkerpop.gremlin.process.traversal.util.TraversalHelper)1 UniGraphCoalesceStep (org.unipop.process.coalesce.UniGraphCoalesceStep)1 PredicatesUtil (org.unipop.process.predicate.PredicatesUtil)1