public static boolean isLocalStarGraph(final Traversal.Admin<?, ?> traversal) { return 'x' != isLocalStarGraph(traversal, 'v'); }
public static boolean isLegal(final Traversal.Admin<?, ?> traversal) { final Step<?, ?> startStep = traversal.getStartStep(); final Step<?, ?> endStep = traversal.getEndStep(); // right now this is not supported because of how the SparkStarBarrierInterceptor mutates the traversal prior to local evaluation if (traversal.getStrategies().toList().stream().filter(strategy -> strategy instanceof SubgraphStrategy).findAny().isPresent()) return false; if (!startStep.getClass().equals(GraphStep.class) || ((GraphStep) startStep).returnsEdge()) return false; if (!endStep.getClass().equals(CountGlobalStep.class) && !endStep.getClass().equals(SumGlobalStep.class) && !endStep.getClass().equals(MeanGlobalStep.class) && !endStep.getClass().equals(MaxGlobalStep.class) && !endStep.getClass().equals(MinGlobalStep.class) && !endStep.getClass().equals(FoldStep.class) && !endStep.getClass().equals(GroupStep.class) && !endStep.getClass().equals(GroupCountStep.class)) // TODO: tree() return false; if (TraversalHelper.getStepsOfAssignableClassRecursively(Scope.global, Barrier.class, traversal).size() != 1) return false; if (traversal.getTraverserRequirements().contains(TraverserRequirement.SACK)) return false; return TraversalHelper.isLocalStarGraph(traversal); } }
Set<Character> states = new HashSet<>(); for (final Traversal.Admin<?, ?> local : ((TraversalParent) step).getLocalChildren()) { final char s = isLocalStarGraph(local, currState); if ('x' == s) return 'x'; states.add(s); final char s = isLocalStarGraph(local, currState); if ('x' == s) return 'x'; states.add(s);
if (!TraversalHelper.isLocalStarGraph(edgeFilter.asAdmin())) throw GraphComputer.Exceptions.edgeFilterAccessesAdjacentVertices(edgeFilter); this.edgeFilter = edgeFilter.asAdmin().clone();
@Override public void apply(final Traversal.Admin<?, ?> traversal) { if (!TraversalHelper.onGraphComputer(traversal)) return; 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); } // 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: " + traversal, traversal); // you can not traverse past the local star graph with localChildren (e.g. by()-modulators). if (!TraversalHelper.isGlobalChild(traversal) && !TraversalHelper.isLocalStarGraph(traversal)) throw new VerificationException("Local traversals may not traverse past the local star-graph on GraphComputer: " + traversal, traversal); for (final Step<?, ?> step : traversal.getSteps()) { 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(); } }
!(computerTraversal.getStartStep().getNextStep() instanceof Barrier) && TraversalHelper.hasStepOfAssignableClassRecursively(Arrays.asList(VertexStep.class, EdgeVertexStep.class), computerTraversal) && TraversalHelper.isLocalStarGraph(computerTraversal)) { final Step barrier = (Step) TraversalHelper.getFirstStepOfAssignableClass(Barrier.class, computerTraversal).orElse(null); if (MessagePassingReductionStrategy.insertElementId(barrier)) // out().count() -> out().id().count()
public static boolean isLocalStarGraph(final Traversal.Admin<?, ?> traversal) { return 'x' != isLocalStarGraph(traversal, 'v'); }
public static boolean isLegal(final Traversal.Admin<?, ?> traversal) { final Step<?, ?> startStep = traversal.getStartStep(); final Step<?, ?> endStep = traversal.getEndStep(); // right now this is not supported because of how the SparkStarBarrierInterceptor mutates the traversal prior to local evaluation if (traversal.getStrategies().toList().stream().filter(strategy -> strategy instanceof SubgraphStrategy).findAny().isPresent()) return false; if (!startStep.getClass().equals(GraphStep.class) || ((GraphStep) startStep).returnsEdge()) return false; if (!endStep.getClass().equals(CountGlobalStep.class) && !endStep.getClass().equals(SumGlobalStep.class) && !endStep.getClass().equals(MeanGlobalStep.class) && !endStep.getClass().equals(MaxGlobalStep.class) && !endStep.getClass().equals(MinGlobalStep.class) && !endStep.getClass().equals(FoldStep.class) && !endStep.getClass().equals(GroupStep.class) && !endStep.getClass().equals(GroupCountStep.class)) // TODO: tree() return false; if (TraversalHelper.getStepsOfAssignableClassRecursively(Scope.global, Barrier.class, traversal).size() != 1) return false; if (traversal.getTraverserRequirements().contains(TraverserRequirement.SACK)) return false; return TraversalHelper.isLocalStarGraph(traversal); } }
Set<Character> states = new HashSet<>(); for (final Traversal.Admin<?, ?> local : ((TraversalParent) step).getLocalChildren()) { final char s = isLocalStarGraph(local, currState); if ('x' == s) return 'x'; states.add(s); final char s = isLocalStarGraph(local, currState); if ('x' == s) return 'x'; states.add(s);
if (!TraversalHelper.isLocalStarGraph(edgeFilter.asAdmin())) throw GraphComputer.Exceptions.edgeFilterAccessesAdjacentVertices(edgeFilter); this.edgeFilter = edgeFilter.asAdmin().clone();
@Override public void apply(final Traversal.Admin<?, ?> traversal) { if (!TraversalHelper.onGraphComputer(traversal)) return; 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); } // 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: " + traversal, traversal); // you can not traverse past the local star graph with localChildren (e.g. by()-modulators). if (!TraversalHelper.isGlobalChild(traversal) && !TraversalHelper.isLocalStarGraph(traversal)) throw new VerificationException("Local traversals may not traverse past the local star-graph on GraphComputer: " + traversal, traversal); for (final Step<?, ?> step : traversal.getSteps()) { 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(); } }
!(computerTraversal.getStartStep().getNextStep() instanceof Barrier) && TraversalHelper.hasStepOfAssignableClassRecursively(Arrays.asList(VertexStep.class, EdgeVertexStep.class), computerTraversal) && TraversalHelper.isLocalStarGraph(computerTraversal)) { final Step barrier = (Step) TraversalHelper.getFirstStepOfAssignableClass(Barrier.class, computerTraversal).orElse(null); if (MessagePassingReductionStrategy.insertElementId(barrier)) // out().count() -> out().id().count()