本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep类的典型用法代码示例。如果您正苦于以下问题:Java AbstractStep类的具体用法?Java AbstractStep怎么用?Java AbstractStep使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractStep类属于org.apache.tinkerpop.gremlin.process.traversal.step.util包,在下文中一共展示了AbstractStep类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doFirst
import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep; //导入依赖的package包/类
@Override
protected boolean doFirst(ListIterator<Step<?, ?>> stepIterator, Step<?, ?> step, MutableInt pathCount) {
this.currentReplacedStep = ReplacedStep.from(
this.sqlgGraph.getTopology(),
(AbstractStep<?, ?>) step,
pathCount.getValue()
);
handleHasSteps(stepIterator, pathCount.getValue());
handleOrderGlobalSteps(stepIterator, pathCount);
handleRangeGlobalSteps(stepIterator, pathCount);
handleConnectiveSteps(stepIterator);
this.sqlgStep = constructSqlgStep(step);
this.currentTreeNodeNode = this.sqlgStep.addReplacedStep(this.currentReplacedStep);
replaceStepInTraversal(step, this.sqlgStep);
if (this.sqlgStep instanceof SqlgGraphStep && ((SqlgGraphStep) this.sqlgStep).getIds().length > 0) {
addHasContainerForIds((SqlgGraphStep) this.sqlgStep);
}
if (this.currentReplacedStep.getLabels().isEmpty()) {
boolean precedesPathStep = precedesPathOrTreeStep(this.traversal);
if (precedesPathStep) {
this.currentReplacedStep.addLabel(pathCount.getValue() + BaseStrategy.PATH_LABEL_SUFFIX + BaseStrategy.SQLG_PATH_FAKE_LABEL);
}
}
pathCount.increment();
return true;
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:27,代码来源:GraphStrategy.java
示例2: from
import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep; //导入依赖的package包/类
public static <S, E> ReplacedStep from(Topology topology, AbstractStep<S, E> step, int pathCount) {
ReplacedStep replacedStep = new ReplacedStep<>();
replacedStep.step = step;
replacedStep.labels = step.getLabels().stream().map(l -> pathCount + BaseStrategy.PATH_LABEL_SUFFIX + l).collect(Collectors.toSet());
replacedStep.topology = topology;
replacedStep.fake = false;
return replacedStep;
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:9,代码来源:ReplacedStep.java
示例3: handleVertexStep
import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep; //导入依赖的package包/类
private void handleVertexStep(ListIterator<Step<?, ?>> stepIterator, AbstractStep<?, ?> step, MutableInt pathCount) {
this.currentReplacedStep = ReplacedStep.from(
this.sqlgGraph.getTopology(),
step,
pathCount.getValue()
);
//Important to add the replacedStep before collecting the additional steps.
//In particular the orderGlobalStep needs to the currentStepDepth setted.
ReplacedStepTree.TreeNode treeNodeNode = this.sqlgStep.addReplacedStep(this.currentReplacedStep);
handleHasSteps(stepIterator, pathCount.getValue());
handleOrderGlobalSteps(stepIterator, pathCount);
handleRangeGlobalSteps(stepIterator, pathCount);
handleConnectiveSteps(stepIterator);
//if called from ChooseStep then the VertexStep is nested inside the ChooseStep and not one of the traversal's direct steps.
int index = TraversalHelper.stepIndex(step, this.traversal);
if (index != -1) {
this.traversal.removeStep(step);
}
if (this.currentReplacedStep.getLabels().isEmpty()) {
boolean precedesPathStep = precedesPathOrTreeStep(this.traversal);
if (precedesPathStep) {
this.currentReplacedStep.addLabel(pathCount.getValue() + BaseStrategy.PATH_LABEL_SUFFIX + BaseStrategy.SQLG_PATH_FAKE_LABEL);
}
}
pathCount.increment();
this.currentTreeNodeNode = treeNodeNode;
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:28,代码来源:BaseStrategy.java
示例4: getStep
import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep; //导入依赖的package包/类
public AbstractStep<S, E> getStep() {
return step;
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:4,代码来源:ReplacedStep.java
示例5: handleStep
import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep; //导入依赖的package包/类
/**
* sqlgStep is either a {@link SqlgGraphStep} or {@link SqlgVertexStep}.
*
* @return false if optimization must be terminated.
*/
protected boolean handleStep(ListIterator<Step<?, ?>> stepIterator, MutableInt pathCount) {
Step<?, ?> step = stepIterator.next();
if (step instanceof GraphStep) {
doFirst(stepIterator, step, pathCount);
} else if (this.sqlgStep == null) {
boolean keepGoing = doFirst(stepIterator, step, pathCount);
stepIterator.previous();
if (!keepGoing) {
return false;
}
} else {
if (step instanceof VertexStep || step instanceof EdgeVertexStep || step instanceof EdgeOtherVertexStep) {
handleVertexStep(stepIterator, (AbstractStep<?, ?>) step, pathCount);
} else if (step instanceof RepeatStep) {
if (!unoptimizableRepeatStep()) {
handleRepeatStep((RepeatStep<?>) step, pathCount);
} else {
this.currentReplacedStep.addLabel((pathCount) + BaseStrategy.PATH_LABEL_SUFFIX + BaseStrategy.SQLG_PATH_FAKE_LABEL);
return false;
}
} else if (step instanceof OptionalStep) {
if (!unoptimizableOptionalStep((OptionalStep<?>) step)) {
this.optionalStepStack.clear();
handleOptionalStep(1, (OptionalStep<?>) step, this.traversal, pathCount);
this.optionalStepStack.clear();
//after choose steps the optimization starts over in VertexStrategy
this.reset = true;
} else {
return false;
}
} else if (step instanceof ChooseStep) {
if (!unoptimizableChooseStep((ChooseStep<?, ?, ?>) step)) {
this.chooseStepStack.clear();
handleChooseStep(1, (ChooseStep<?, ?, ?>) step, this.traversal, pathCount);
this.chooseStepStack.clear();
//after choose steps the optimization starts over
this.reset = true;
} else {
return false;
}
} else if (step instanceof OrderGlobalStep) {
stepIterator.previous();
handleOrderGlobalSteps(stepIterator, pathCount);
handleRangeGlobalSteps(stepIterator, pathCount);
} else if (step instanceof RangeGlobalStep) {
handleRangeGlobalSteps(stepIterator, pathCount);
} else if (step instanceof SelectStep || (step instanceof SelectOneStep)) {
handleOrderGlobalSteps(stepIterator, pathCount);
handleRangeGlobalSteps(stepIterator, pathCount);
if (stepIterator.hasNext() && stepIterator.next() instanceof SelectOneStep) {
return false;
}
} else if (step instanceof DropStep && (!this.sqlgGraph.getSqlDialect().isMariaDb())) {
Traversal.Admin<?, ?> root = TraversalHelper.getRootTraversal(this.traversal);
final Optional<EventStrategy> eventStrategyOptional = root.getStrategies().getStrategy(EventStrategy.class);
if (eventStrategyOptional.isPresent()) {
//Do nothing, it will go via the SqlgDropStepBarrier.
} else {
//MariaDB does not support target and source together.
//Table 'E_ab' is specified twice, both as a target for 'DELETE' and as a separate source for data
//This has been fixed in 10.3.1, waiting for it to land in the repo.
handleDropStep((DropStep) step);
}
return false;
} else if (step instanceof DropStep && this.sqlgGraph.getSqlDialect().isMariaDb()) {
return false;
} else {
throw new IllegalStateException("Unhandled step " + step.getClass().getName());
}
}
return true;
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:79,代码来源:BaseStrategy.java
示例6: handleOptionalStep
import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep; //导入依赖的package包/类
private void handleOptionalStep(int optionalStepNestedCount, OptionalStep<?> optionalStep, Traversal.Admin<?, ?> traversal, MutableInt pathCount) {
//The currentTreeNode here is the node that will need the left join in the sql generation
this.optionalStepStack.add(this.currentTreeNodeNode);
Preconditions.checkState(this.optionalStepStack.size() == optionalStepNestedCount);
Traversal.Admin<?, ?> optionalTraversal = optionalStep.getLocalChildren().get(0);
ReplacedStep<?, ?> previousReplacedStep = this.sqlgStep.getReplacedSteps().get(this.sqlgStep.getReplacedSteps().size() - 1);
previousReplacedStep.setLeftJoin(true);
List<Step<?, ?>> optionalTraversalSteps = new ArrayList(optionalTraversal.getSteps());
ListIterator<Step<?, ?>> optionalStepsIterator = optionalTraversalSteps.listIterator();
while (optionalStepsIterator.hasNext()) {
Step internalOptionalStep = optionalStepsIterator.next();
if (internalOptionalStep instanceof VertexStep || internalOptionalStep instanceof EdgeVertexStep || internalOptionalStep instanceof EdgeOtherVertexStep) {
handleVertexStep(optionalStepsIterator, (AbstractStep<?, ?>) internalOptionalStep, pathCount);
//if the chooseStepStack size is greater than the chooseStepNestedCount then it means the just executed
//handleVertexStep is after nested chooseSteps.
//This means that this VertexStep applies to the nested chooseSteps where the chooseStep was not chosen.
//I.e. there was no results for the chooseSteps traversal.
for (int i = optionalStepNestedCount; i < this.chooseStepStack.size(); i++) {
ReplacedStepTree.TreeNode treeNode = this.chooseStepStack.get(i);
this.currentReplacedStep.markAsJoinToLeftJoin();
treeNode.addReplacedStep(this.currentReplacedStep);
}
} else if (internalOptionalStep instanceof OptionalStep) {
handleOptionalStep(optionalStepNestedCount + 1, (OptionalStep) internalOptionalStep, traversal, pathCount);
} else if (internalOptionalStep instanceof ComputerAwareStep.EndStep) {
break;
} else if (internalOptionalStep instanceof HasStep) {
handleHasSteps(optionalStepsIterator, pathCount.getValue());
} else {
throw new IllegalStateException("Unhandled step nested in OptionalStep " + internalOptionalStep.getClass().getName());
}
}
//the chooseStep might be a ChooseStep nested inside another ChooseStep.
//In that case it will not be a direct step of the traversal.
if (traversal.getSteps().contains(optionalStep)) {
traversal.removeStep(optionalStep);
}
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:42,代码来源:BaseStrategy.java
示例7: handleChooseStep
import org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep; //导入依赖的package包/类
private void handleChooseStep(int chooseStepNestedCount, ChooseStep<?, ?, ?> chooseStep, Traversal.Admin<?, ?> traversal, MutableInt pathCount) {
//The currentTreeNode here is the node that will need the left join in the sql generation
this.chooseStepStack.add(this.currentTreeNodeNode);
Preconditions.checkState(this.chooseStepStack.size() == chooseStepNestedCount);
List<? extends Traversal.Admin<?, ?>> globalChildren = chooseStep.getGlobalChildren();
Preconditions.checkState(globalChildren.size() == 2, "ChooseStep's globalChildren must have size 2, one for true and one for false");
ReplacedStep<?, ?> previousReplacedStep = this.sqlgStep.getReplacedSteps().get(this.sqlgStep.getReplacedSteps().size() - 1);
previousReplacedStep.setLeftJoin(true);
Traversal.Admin<?, ?> trueTraversal;
Traversal.Admin<?, ?> a = globalChildren.get(0);
Traversal.Admin<?, ?> b = globalChildren.get(1);
if (a.getSteps().stream().anyMatch(s -> s instanceof IdentityStep<?>)) {
trueTraversal = b;
} else {
trueTraversal = a;
}
List<Step<?, ?>> trueTraversalSteps = new ArrayList(trueTraversal.getSteps());
ListIterator<Step<?, ?>> trueTraversalStepsIterator = trueTraversalSteps.listIterator();
while (trueTraversalStepsIterator.hasNext()) {
Step internalChooseStep = trueTraversalStepsIterator.next();
if (internalChooseStep instanceof VertexStep || internalChooseStep instanceof EdgeVertexStep || internalChooseStep instanceof EdgeOtherVertexStep) {
handleVertexStep(trueTraversalStepsIterator, (AbstractStep<?, ?>) internalChooseStep, pathCount);
//if the chooseStepStack size is greater than the chooseStepNestedCount then it means the just executed
//handleVertexStep is after nested chooseSteps.
//This means that this VertexStep applies to the nested chooseSteps where the chooseStep was not chosen.
//I.e. there was no results for the chooseSteps traversal.
for (int i = chooseStepNestedCount; i < this.chooseStepStack.size(); i++) {
ReplacedStepTree.TreeNode treeNode = this.chooseStepStack.get(i);
this.currentReplacedStep.markAsJoinToLeftJoin();
treeNode.addReplacedStep(this.currentReplacedStep);
}
} else if (internalChooseStep instanceof ChooseStep) {
handleChooseStep(chooseStepNestedCount + 1, (ChooseStep) internalChooseStep, traversal, pathCount);
} else if (internalChooseStep instanceof ComputerAwareStep.EndStep) {
break;
} else {
throw new IllegalStateException("Unhandled step nested in ChooseStep " + internalChooseStep.getClass().getName());
}
}
//the chooseStep might be a ChooseStep nested inside another ChooseStep.
//In that case it will not be a direct step of the traversal.
if (traversal.getSteps().contains(chooseStep)) {
traversal.removeStep(chooseStep);
}
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:47,代码来源:BaseStrategy.java
注:本文中的org.apache.tinkerpop.gremlin.process.traversal.step.util.AbstractStep类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论