本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep类的典型用法代码示例。如果您正苦于以下问题:Java StartStep类的具体用法?Java StartStep怎么用?Java StartStep使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StartStep类属于org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect包,在下文中一共展示了StartStep类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertNumStep
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
private static void assertNumStep(int expectedResults, int expectedSteps, GraphTraversal traversal, Class<? extends Step>... expectedStepTypes) {
int num = 0;
while (traversal.hasNext()) {
traversal.next();
num++;
}
// System.out.println(traversal);
assertEquals(expectedResults, num);
//Verify that steps line up with what is expected after Titan's optimizations are applied
List<Step> steps = traversal.asAdmin().getSteps();
Set<Class<? extends Step>> expSteps = Sets.newHashSet(expectedStepTypes);
int numSteps = 0;
for (Step s : steps) {
// System.out.println(s.getClass());
if (s.getClass().equals(GraphStep.class) || s.getClass().equals(StartStep.class)) continue;
assertTrue(s.getClass().getName(), expSteps.contains(s.getClass()));
numSteps++;
}
assertEquals(expectedSteps, numSteps);
}
示例2: as
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
public default GraphTraversal<S, E> as(final String stepLabel, final String... stepLabels) {
if (this.asAdmin().getSteps().size() == 0) this.asAdmin().addStep(new StartStep<>(this.asAdmin()));
final Step<?, E> endStep = this.asAdmin().getEndStep();
endStep.addLabel(stepLabel);
for (final String label : stepLabels) {
endStep.addLabel(label);
}
return this;
}
示例3: getVariableLocations
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
private static Set<Scoping.Variable> getVariableLocations(final Set<Scoping.Variable> variables, final Traversal.Admin<?, ?> traversal) {
if (variables.size() == 2) return variables; // has both START and END so no need to compute further
final Step<?, ?> startStep = traversal.getStartStep();
if (StartStep.isVariableStartStep(startStep))
variables.add(Scoping.Variable.START);
else if (startStep instanceof WherePredicateStep) {
if (((WherePredicateStep) startStep).getStartKey().isPresent())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof WhereTraversalStep.WhereStartStep) {
if (!((WhereTraversalStep.WhereStartStep) startStep).getScopeKeys().isEmpty())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof MatchStep.MatchStartStep) {
if (((MatchStep.MatchStartStep) startStep).getSelectKey().isPresent())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof MatchStep) {
((MatchStep<?, ?>) startStep).getGlobalChildren().forEach(child -> TraversalHelper.getVariableLocations(variables, child));
} else if (startStep instanceof ConnectiveStep || startStep instanceof NotStep || startStep instanceof WhereTraversalStep)
((TraversalParent) startStep).getLocalChildren().forEach(child -> TraversalHelper.getVariableLocations(variables, child));
///
final Step<?, ?> endStep = traversal.getEndStep();
if (endStep instanceof WherePredicateStep) {
if (((WherePredicateStep) endStep).getStartKey().isPresent())
variables.add(Scoping.Variable.END);
} else if (endStep instanceof WhereTraversalStep.WhereEndStep) {
if (!((WhereTraversalStep.WhereEndStep) endStep).getScopeKeys().isEmpty())
variables.add(Scoping.Variable.END);
} else if (endStep instanceof MatchStep.MatchEndStep) {
if (((MatchStep.MatchEndStep) endStep).getMatchKey().isPresent())
variables.add(Scoping.Variable.END);
} else if (!endStep.getLabels().isEmpty())
variables.add(Scoping.Variable.END);
///
return variables;
}
示例4: processConjunctionMarker
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
private static void processConjunctionMarker(final Class<? extends ConnectiveStep> markerClass, final Traversal.Admin<?, ?> traversal) {
TraversalHelper.getStepsOfClass(markerClass, traversal).stream()
.filter(conjunctionStep -> conjunctionStep.getLocalChildren().isEmpty())
.findFirst().ifPresent(connectiveStep -> {
Step<?, ?> currentStep = connectiveStep.getNextStep();
final Traversal.Admin<?, ?> rightTraversal = __.start().asAdmin();
if (!connectiveStep.getLabels().isEmpty()) {
final StartStep<?> startStep = new StartStep<>(rightTraversal);
final Set<String> conjunctionLabels = ((Step<?, ?>) connectiveStep).getLabels();
conjunctionLabels.forEach(startStep::addLabel);
conjunctionLabels.forEach(label -> connectiveStep.removeLabel(label));
rightTraversal.addStep(startStep);
}
while (legalCurrentStep(currentStep)) {
final Step<?, ?> nextStep = currentStep.getNextStep();
rightTraversal.addStep(currentStep);
traversal.removeStep(currentStep);
currentStep = nextStep;
}
processConnectiveMarker(rightTraversal);
currentStep = connectiveStep.getPreviousStep();
final Traversal.Admin<?, ?> leftTraversal = __.start().asAdmin();
while (legalCurrentStep(currentStep)) {
final Step<?, ?> previousStep = currentStep.getPreviousStep();
leftTraversal.addStep(0, currentStep);
traversal.removeStep(currentStep);
currentStep = previousStep;
}
processConnectiveMarker(leftTraversal);
TraversalHelper.replaceStep(connectiveStep,
connectiveStep instanceof AndStep ?
new AndStep(traversal, leftTraversal, rightTraversal) :
new OrStep(traversal, leftTraversal, rightTraversal), traversal);
});
}
示例5: setVertexStart
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
private static <T extends Traversal.Admin<Vertex, Edge>> T setVertexStart(
Traversal.Admin<Vertex, Edge> incidentTraversal, Vertex vertex) {
incidentTraversal.addStep(0, new StartStep<>(incidentTraversal, vertex));
@SuppressWarnings("unchecked")
T t = (T) incidentTraversal;
return t;
}
示例6: as
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
/**
* A step modulator that provides a lable to the step that can be accessed later in the traversal by other steps.
*
* @param stepLabel the name of the step
* @param stepLabels additional names for the label
* @return the traversal with the modified end step
* @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#as-step" target="_blank">Reference Documentation - As Step</a>
* @since 3.0.0-incubating
*/
public default GraphTraversal<S, E> as(final String stepLabel, final String... stepLabels) {
this.asAdmin().getBytecode().addStep(Symbols.as, stepLabel, stepLabels);
if (this.asAdmin().getSteps().size() == 0) this.asAdmin().addStep(new StartStep<>(this.asAdmin()));
final Step<?, E> endStep = this.asAdmin().getEndStep();
endStep.addLabel(stepLabel);
for (final String label : stepLabels) {
endStep.addLabel(label);
}
return this;
}
示例7: getVariableLocations
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
private static Set<Scoping.Variable> getVariableLocations(final Set<Scoping.Variable> variables, final Traversal.Admin<?, ?> traversal) {
if (variables.size() == 2) return variables; // has both START and END so no need to compute further
final Step<?, ?> startStep = traversal.getStartStep();
if (StartStep.isVariableStartStep(startStep))
variables.add(Scoping.Variable.START);
else if (startStep instanceof WherePredicateStep) {
if (((WherePredicateStep) startStep).getStartKey().isPresent())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof WhereTraversalStep.WhereStartStep) {
if (!((WhereTraversalStep.WhereStartStep) startStep).getScopeKeys().isEmpty())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof MatchStep.MatchStartStep) {
if (((MatchStep.MatchStartStep) startStep).getSelectKey().isPresent())
variables.add(Scoping.Variable.START);
} else if (startStep instanceof MatchStep) {
for (final Traversal.Admin<?, ?> global : ((MatchStep<?, ?>) startStep).getGlobalChildren()) {
TraversalHelper.getVariableLocations(variables, global);
}
} else if (startStep instanceof ConnectiveStep || startStep instanceof NotStep || startStep instanceof WhereTraversalStep) {
for (final Traversal.Admin<?, ?> local : ((TraversalParent) startStep).getLocalChildren()) {
TraversalHelper.getVariableLocations(variables, local);
}
}
///
final Step<?, ?> endStep = traversal.getEndStep();
if (endStep instanceof WherePredicateStep) {
if (((WherePredicateStep) endStep).getStartKey().isPresent())
variables.add(Scoping.Variable.END);
} else if (endStep instanceof WhereTraversalStep.WhereEndStep) {
if (!((WhereTraversalStep.WhereEndStep) endStep).getScopeKeys().isEmpty())
variables.add(Scoping.Variable.END);
} else if (endStep instanceof MatchStep.MatchEndStep) {
if (((MatchStep.MatchEndStep) endStep).getMatchKey().isPresent())
variables.add(Scoping.Variable.END);
} else if (!endStep.getLabels().isEmpty())
variables.add(Scoping.Variable.END);
///
return variables;
}
示例8: processConjunctionMarker
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
private static void processConjunctionMarker(final Class<? extends ConnectiveStep> markerClass, final Traversal.Admin<?, ?> traversal) {
TraversalHelper.getStepsOfClass(markerClass, traversal).stream()
.filter(conjunctionStep -> conjunctionStep.getLocalChildren().isEmpty())
.findFirst().ifPresent(connectiveStep -> {
Step<?, ?> currentStep = connectiveStep.getNextStep();
final Traversal.Admin<?, ?> rightTraversal = __.start().asAdmin();
if (!connectiveStep.getLabels().isEmpty()) {
final StartStep<?> startStep = new StartStep<>(rightTraversal);
final Set<String> conjunctionLabels = ((Step<?, ?>) connectiveStep).getLabels();
conjunctionLabels.forEach(startStep::addLabel);
conjunctionLabels.forEach(label -> connectiveStep.removeLabel(label));
rightTraversal.addStep(startStep);
}
while (legalCurrentStep(currentStep)) {
final Step<?, ?> nextStep = currentStep.getNextStep();
rightTraversal.addStep(currentStep);
traversal.removeStep(currentStep);
currentStep = nextStep;
}
processConnectiveMarker(rightTraversal);
currentStep = connectiveStep.getPreviousStep();
final Traversal.Admin<?, ?> leftTraversal = __.start().asAdmin();
while (legalCurrentStep(currentStep)) {
final Step<?, ?> previousStep = currentStep.getPreviousStep();
leftTraversal.addStep(0, currentStep);
traversal.removeStep(currentStep);
currentStep = previousStep;
}
processConnectiveMarker(leftTraversal);
if (connectiveStep instanceof AndStep)
TraversalHelper.replaceStep((Step) connectiveStep, new AndStep(traversal, leftTraversal, rightTraversal), traversal);
else
TraversalHelper.replaceStep((Step) connectiveStep, new OrStep(traversal, leftTraversal, rightTraversal), traversal);
});
}
示例9: legalCurrentStep
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
private static boolean legalCurrentStep(final Step<?, ?> step) {
return !(step instanceof EmptyStep || step instanceof ProfileSideEffectStep || step instanceof ComputerAwareStep.EndStep || (step instanceof StartStep && !StartStep.isVariableStartStep(step)) || GraphStep.isStartStep(step));
}
示例10: legalCurrentStep
import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.StartStep; //导入依赖的package包/类
private static boolean legalCurrentStep(final Step<?, ?> step) {
return !(step instanceof EmptyStep || step instanceof ProfileSideEffectStep || step instanceof HasNextStep ||
step instanceof ComputerAwareStep.EndStep || (step instanceof StartStep && !StartStep.isVariableStartStep(step)) ||
GraphStep.isStartStep(step));
}