if (vstep.returnsEdge() && (direction==Direction.BOTH || direction.equals(vstep.getDirection().opposite()))) {
if (vertexStep.returnsEdge() && (direction == Direction.BOTH || direction.equals(vertexStep.getDirection().opposite()))) {
final VertexStep step = (VertexStep) this.edgeFilter.getStartStep(); final Map<String, Legal> map = this.edgeLegality.get(step.getDirection()); if (step.returnsEdge()) { if (step.getEdgeLabels().length == 0) map.put(null, 1 == this.edgeFilter.getSteps().size() ? Legal.YES : Legal.MAYBE); final VertexStep vertexStep = (VertexStep) union.getStartStep(); final Map<String, Legal> map = this.edgeLegality.get(vertexStep.getDirection()); if (vertexStep.returnsEdge()) { if (vertexStep.getEdgeLabels().length == 0) map.put(null, 2 == union.getSteps().size() ? Legal.YES : Legal.MAYBE);
TraversalHelper.getStepsOfAssignableClassRecursively(VertexStep.class, traversal).forEach(step -> { final Direction direction = step.getDirection().equals(Direction.IN) && step.returnsEdge() ? Direction.BOTH : step.getDirection();
/** * 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 EdgeOtherVertexStep || (step2 instanceof EdgeVertexStep && ((EdgeVertexStep) step2).getDirection().equals(step1Dir.opposite())); } return false; }
return true; } else if (step.getPreviousStep() instanceof VertexStep && ((VertexStep) step.getPreviousStep()).returnsEdge() && 0 == ((VertexStep) step.getPreviousStep()).getEdgeLabels().length) { final VertexStep<Edge> previousStep = (VertexStep<Edge>) step.getPreviousStep();
!(step instanceof VertexStep && ((VertexStep) step).returnsEdge()) || (step instanceof GraphStep && (i > 0 || ((GraphStep) step).getIds().length >= BIG_START_SIZE ||
if (step.returnsEdge()) continue; if (null != this.vertexCriterion && null == edgeCriterion) {
final VertexStep step = (VertexStep) this.edgeFilter.getStartStep(); final Map<String, Legal> map = this.edgeLegality.get(step.getDirection()); if (step.returnsEdge()) { if (step.getEdgeLabels().length == 0) map.put(null, 1 == this.edgeFilter.getSteps().size() ? Legal.YES : Legal.MAYBE); final VertexStep vertexStep = (VertexStep) union.getStartStep(); final Map<String, Legal> map = this.edgeLegality.get(vertexStep.getDirection()); if (vertexStep.returnsEdge()) { if (vertexStep.getEdgeLabels().length == 0) map.put(null, 2 == union.getSteps().size() ? Legal.YES : Legal.MAYBE);
TraversalHelper.getStepsOfAssignableClassRecursively(VertexStep.class, traversal).forEach(step -> { final Direction direction = step.getDirection().equals(Direction.IN) && step.returnsEdge() ? Direction.BOTH : step.getDirection();
/** * 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 EdgeOtherVertexStep || (step2 instanceof EdgeVertexStep && ((EdgeVertexStep) step2).getDirection().equals(step1Dir.opposite())); } return false; }
if (vstep.returnsEdge() && (direction==Direction.BOTH || direction.equals(vstep.getDirection().opposite()))) {
return true; } else if (step.getPreviousStep() instanceof VertexStep && ((VertexStep) step.getPreviousStep()).returnsEdge() && 0 == ((VertexStep) step.getPreviousStep()).getEdgeLabels().length) { final VertexStep<Edge> previousStep = (VertexStep<Edge>) step.getPreviousStep();
UniGraphVertexStep uniGraphVertexStep = new UniGraphVertexStep<>(vertexStep, uniGraph, uniGraph.getControllerManager()); TraversalHelper.replaceStep(vertexStep, uniGraphVertexStep, traversal); if (vertexStep.returnsEdge()) PredicatesUtil.collectPredicates(uniGraphVertexStep, traversal); UniGraphVertexStep uniGraphVertexStep = new UniGraphVertexStep<>(vertexStep, uniGraph, uniGraph.getControllerManager()); TraversalHelper.replaceStep(vertexStep, uniGraphVertexStep, child); if (vertexStep.returnsEdge()) PredicatesUtil.collectPredicates(uniGraphVertexStep, child); UniGraphVertexStep uniGraphVertexStep = new UniGraphVertexStep<>(vertexStep, uniGraph, uniGraph.getControllerManager()); TraversalHelper.replaceStep(vertexStep, uniGraphVertexStep, child); if (vertexStep.returnsEdge()) PredicatesUtil.collectPredicates(uniGraphVertexStep, child); UniGraphVertexStep uniGraphVertexStep = new UniGraphVertexStep<>(vertexStep, uniGraph, uniGraph.getControllerManager()); TraversalHelper.replaceStep(vertexStep, uniGraphVertexStep, child1); if (vertexStep.returnsEdge()) PredicatesUtil.collectPredicates(uniGraphVertexStep, child1); UniGraphVertexStep uniGraphVertexStep = new UniGraphVertexStep<>(vertexStep, uniGraph, uniGraph.getControllerManager()); TraversalHelper.replaceStep(vertexStep, uniGraphVertexStep, child1); if (vertexStep.returnsEdge()) PredicatesUtil.collectPredicates(uniGraphVertexStep, child1);
!(step instanceof VertexStep && ((VertexStep) step).returnsEdge()) || (step instanceof GraphStep && (i > 0 || ((GraphStep) step).getIds().length >= BIG_START_SIZE ||
if (step.returnsEdge()) continue; if (null != this.vertexCriterion && null == edgeCriterion) {