本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep类的典型用法代码示例。如果您正苦于以下问题:Java GraphStep类的具体用法?Java GraphStep怎么用?Java GraphStep使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphStep类属于org.apache.tinkerpop.gremlin.process.traversal.step.map包,在下文中一共展示了GraphStep类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
if (TraversalHelper.onGraphComputer(traversal))
return;
for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
final TinkerGraphStep<?, ?> tinkerGraphStep = new TinkerGraphStep<>(originalGraphStep);
TraversalHelper.replaceStep(originalGraphStep, tinkerGraphStep, traversal);
Step<?, ?> currentStep = tinkerGraphStep.getNextStep();
while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
if (currentStep instanceof HasStep) {
for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
if (!GraphStep.processHasContainerIds(tinkerGraphStep, hasContainer))
tinkerGraphStep.addHasContainer(hasContainer);
}
TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
traversal.removeStep(currentStep);
}
currentStep = currentStep.getNextStep();
}
}
}
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:23,代码来源:TinkerGraphStepStrategy.java
示例2: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
if (!(traversal.getParent() instanceof EmptyStep) || TraversalHelper.onGraphComputer(traversal))
return;
final List<Step> steps = traversal.getSteps();
if (steps.size() < 2 ||
!(steps.get(0) instanceof GraphStep) ||
0 != ((GraphStep) steps.get(0)).getIds().length ||
!(steps.get(steps.size() - 1) instanceof CountGlobalStep))
return;
for (int i = 1; i < steps.size() - 1; i++) {
final Step current = steps.get(i);
if (!(current instanceof MapStep ||
current instanceof IdentityStep ||
current instanceof NoOpBarrierStep ||
current instanceof CollectingBarrierStep) ||
(current instanceof TraversalParent &&
TraversalHelper.anyStepRecursively(s -> (s instanceof SideEffectStep || s instanceof AggregateStep), (TraversalParent) current)))
return;
}
final Class<? extends Element> elementClass = ((GraphStep<?, ?>) steps.get(0)).getReturnClass();
TraversalHelper.removeAllSteps(traversal);
traversal.addStep(new TinkerCountGlobalStep<>(traversal, elementClass));
}
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:25,代码来源:TinkerGraphCountStrategy.java
示例3: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
final BitsyGraphStep<?, ?> bitsyGraphStep = new BitsyGraphStep<>(originalGraphStep);
TraversalHelper.replaceStep(originalGraphStep, bitsyGraphStep, traversal);
Step<?, ?> currentStep = bitsyGraphStep.getNextStep();
while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
if (currentStep instanceof HasStep) {
for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
if (!GraphStep.processHasContainerIds(bitsyGraphStep, hasContainer))
bitsyGraphStep.addHasContainer(hasContainer);
}
TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
traversal.removeStep(currentStep);
}
currentStep = currentStep.getNextStep();
}
}
}
开发者ID:lambdazen,项目名称:bitsy,代码行数:20,代码来源:BitsyTraversalStrategy.java
示例4: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
final HBaseGraphStep<?, ?> hbaseGraphStep = new HBaseGraphStep<>(originalGraphStep);
TraversalHelper.replaceStep(originalGraphStep, hbaseGraphStep, traversal);
Step<?, ?> currentStep = hbaseGraphStep.getNextStep();
while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
if (currentStep instanceof HasStep) {
for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
if (!GraphStep.processHasContainerIds(hbaseGraphStep, hasContainer))
hbaseGraphStep.addHasContainer(hasContainer);
}
TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
traversal.removeStep(currentStep);
}
currentStep = currentStep.getNextStep();
}
}
}
开发者ID:rayokota,项目名称:hgraphdb,代码行数:21,代码来源:HBaseGraphStepStrategy.java
示例5: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
if (TraversalHelper.onGraphComputer(traversal))
return;
TraversalHelper.getStepsOfClass(GraphStep.class, traversal).forEach(originalGraphStep -> {
final TinkerGraphStep<?, ?> tinkerGraphStep = new TinkerGraphStep<>(originalGraphStep);
TraversalHelper.replaceStep(originalGraphStep, (Step) tinkerGraphStep, traversal);
Step<?, ?> currentStep = tinkerGraphStep.getNextStep();
while (currentStep instanceof HasContainerHolder) {
((HasContainerHolder) currentStep).getHasContainers().forEach(hasContainer -> {
if (!GraphStep.processHasContainerIds(tinkerGraphStep, hasContainer))
tinkerGraphStep.addHasContainer(hasContainer);
});
currentStep.getLabels().forEach(tinkerGraphStep::addLabel);
traversal.removeStep(currentStep);
currentStep = currentStep.getNextStep();
}
});
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:21,代码来源:TinkerGraphStepStrategy.java
示例6: isLegal
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
public static boolean isLegal(final Traversal.Admin<?, ?> traversal) {
final Step<?, ?> startStep = traversal.getStartStep();
final Step<?, ?> endStep = traversal.getEndStep();
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);
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:22,代码来源:SparkStarBarrierInterceptor.java
示例7: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
TraversalHelper.getStepsOfClass(GraphStep.class, traversal).forEach(originalGraphStep -> {
final Neo4jGraphStep<?, ?> neo4jGraphStep = new Neo4jGraphStep<>(originalGraphStep);
TraversalHelper.replaceStep(originalGraphStep, (Step) neo4jGraphStep, traversal);
Step<?, ?> currentStep = neo4jGraphStep.getNextStep();
while (currentStep instanceof HasContainerHolder) {
((HasContainerHolder) currentStep).getHasContainers().forEach(hasContainer -> {
if (!GraphStep.processHasContainerIds(neo4jGraphStep, hasContainer))
neo4jGraphStep.addHasContainer(hasContainer);
});
currentStep.getLabels().forEach(neo4jGraphStep::addLabel);
traversal.removeStep(currentStep);
currentStep = currentStep.getNextStep();
}
});
}
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:18,代码来源:Neo4jGraphStepStrategy.java
示例8: assertNumStep
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的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);
}
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:23,代码来源:TitanGraphTest.java
示例9: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@Override
public void apply(Traversal.Admin<?, ?> traversal) {
if(TraversalHelper.onGraphComputer(traversal)) return;
Graph graph = traversal.getGraph().get();
if(!(graph instanceof UniGraph)) {
return;
}
UniGraph uniGraph = (UniGraph) graph;
TraversalHelper.getStepsOfClass(GraphStep.class, traversal).forEach(graphStep -> {
final UniGraphStartStep<?,?> uniGraphStartStep = new UniGraphStartStep<>(graphStep, uniGraph.getControllerManager());
TraversalHelper.replaceStep(graphStep, (Step) uniGraphStartStep, traversal);
PredicatesUtil.collectPredicates(uniGraphStartStep, traversal);
});
}
开发者ID:unipop-graph,项目名称:unipop,代码行数:19,代码来源:UniGraphStartStepStrategy.java
示例10: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
final Step<?, ?> startStep = traversal.getStartStep();
// only apply once
if (startStep instanceof GraphStep && !(startStep instanceof OrientGraphStep)) {
final GraphStep<?, ?> originalGraphStep = (GraphStep) startStep;
final OrientGraphStep<?, ?> orientGraphStep = new OrientGraphStep<>(originalGraphStep);
TraversalHelper.replaceStep(startStep, (Step) orientGraphStep, traversal);
Step<?, ?> currentStep = orientGraphStep.getNextStep();
while (currentStep instanceof HasContainerHolder) {
((HasContainerHolder) currentStep).getHasContainers().forEach(orientGraphStep::addHasContainer);
currentStep.getLabels().forEach(orientGraphStep::addLabel);
traversal.removeStep(currentStep);
currentStep = currentStep.getNextStep();
}
}
}
开发者ID:orientechnologies,项目名称:orientdb-gremlin,代码行数:19,代码来源:OrientGraphStepStrategy.java
示例11: processesPropertyType
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
private static final char processesPropertyType(Step step) {
while (!(step instanceof EmptyStep)) {
if (step instanceof FilterStep || step instanceof SideEffectStep)
step = step.getPreviousStep();
else if (step instanceof GraphStep && ((GraphStep) step).returnsVertex())
return 'v';
else if (step instanceof EdgeVertexStep)
return 'v';
else if (step instanceof VertexStep)
return ((VertexStep) step).returnsVertex() ? 'v' : 'p';
else if (step instanceof PropertyMapStep || step instanceof PropertiesStep)
return 'p';
else
return 'x';
}
return 'x';
}
开发者ID:apache,项目名称:tinkerpop,代码行数:18,代码来源:SubgraphStrategy.java
示例12: isLegal
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
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);
}
开发者ID:apache,项目名称:tinkerpop,代码行数:25,代码来源:SparkStarBarrierInterceptor.java
示例13: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
for (final GraphStep originalGraphStep : TraversalHelper.getStepsOfClass(GraphStep.class, traversal)) {
final Neo4jGraphStep<?, ?> neo4jGraphStep = new Neo4jGraphStep<>(originalGraphStep);
TraversalHelper.replaceStep(originalGraphStep, neo4jGraphStep, traversal);
Step<?, ?> currentStep = neo4jGraphStep.getNextStep();
while (currentStep instanceof HasStep || currentStep instanceof NoOpBarrierStep) {
if (currentStep instanceof HasStep) {
for (final HasContainer hasContainer : ((HasContainerHolder) currentStep).getHasContainers()) {
if (!GraphStep.processHasContainerIds(neo4jGraphStep, hasContainer))
neo4jGraphStep.addHasContainer(hasContainer);
}
TraversalHelper.copyLabels(currentStep, currentStep.getPreviousStep(), false);
traversal.removeStep(currentStep);
}
currentStep = currentStep.getNextStep();
}
}
}
开发者ID:apache,项目名称:tinkerpop,代码行数:20,代码来源:Neo4jGraphStepStrategy.java
示例14: walkReplacedSteps
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
void walkReplacedSteps(Set<SchemaTableTree> schemaTableTrees) {
//The tree only has one linear path from root to the deepest leaf node.
//This represents the regular path where each ReplacedStep goes one step deeper down the graph.
//First build the SchemaTableTrees for this path.
//The other nodes in this ReplacedStepTree are nodes that need to join onto the left join nodes coming from optional steps.
List<ReplacedStep<?, ?>> replacedSteps = linearPathToLeafNode();
for (ReplacedStep<?, ?> replacedStep : replacedSteps) {
//skip the graph step
if (replacedStep.getStep() instanceof GraphStep) {
continue;
}
if (!(replacedStep.getStep() instanceof OrderGlobalStep) && !(replacedStep.getStep() instanceof RangeGlobalStep)) {
//This schemaTableTree represents the tree nodes as build up to this depth. Each replacedStep goes a level further
schemaTableTrees = replacedStep.calculatePathForStep(schemaTableTrees);
}
}
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:20,代码来源:ReplacedStepTree.java
示例15: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
void apply() {
final Step<?, ?> startStep = traversal.getStartStep();
if (!(startStep instanceof GraphStep)) {
return;
}
final GraphStep originalGraphStep = (GraphStep) startStep;
if (this.sqlgGraph.features().supportsBatchMode() && this.sqlgGraph.tx().isInNormalBatchMode()) {
this.sqlgGraph.tx().flush();
}
if (originalGraphStep.getIds().length > 0) {
Object id = originalGraphStep.getIds()[0];
if (id != null) {
Class clazz = id.getClass();
if (!Stream.of(originalGraphStep.getIds()).allMatch(i -> clazz.isAssignableFrom(i.getClass())))
throw Graph.Exceptions.idArgsMustBeEitherIdOrElement();
}
}
if (this.canNotBeOptimized()) {
this.logger.debug("gremlin not optimized due to path or tree step. " + this.traversal.toString() + "\nPath to gremlin:\n" + ExceptionUtils.getStackTrace(new Throwable()));
return;
}
combineSteps();
}
开发者ID:pietermartin,项目名称:sqlg,代码行数:27,代码来源:GraphStrategy.java
示例16: TinkerGraphStep
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
public TinkerGraphStep(final GraphStep<S, E> originalGraphStep) {
super(originalGraphStep.getTraversal(), originalGraphStep.getReturnClass(), originalGraphStep.isStartStep(), originalGraphStep.getIds());
originalGraphStep.getLabels().forEach(this::addLabel);
// we used to only setIteratorSupplier() if there were no ids OR the first id was instanceof Element,
// but that allowed the filter in g.V(v).has('k','v') to be ignored. this created problems for
// PartitionStrategy which wants to prevent someone from passing "v" from one TraversalSource to
// another TraversalSource using a different partition
this.setIteratorSupplier(() -> (Iterator<E>) (Vertex.class.isAssignableFrom(this.returnClass) ? this.vertices() : this.edges()));
}
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:11,代码来源:TinkerGraphStep.java
示例17: g_V
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
private static GraphTraversal.Admin<?, ?> g_V(final Object... hasKeyValues) {
final GraphTraversal.Admin<?, ?> traversal = new DefaultGraphTraversal<>();
final TinkerGraphStep<Vertex, Vertex> graphStep = new TinkerGraphStep<>(new GraphStep<>(traversal, Vertex.class, true));
for (int i = 0; i < hasKeyValues.length; i = i + 2) {
graphStep.addHasContainer(new HasContainer((String) hasKeyValues[i], (P) hasKeyValues[i + 1]));
}
return traversal.addStep(graphStep);
}
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:9,代码来源:TinkerGraphStepStrategyTest.java
示例18: V
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
private static GraphStep<?, ?> V(final Object... hasKeyValues) {
final TinkerGraphStep<Vertex, Vertex> graphStep = new TinkerGraphStep<>(new GraphStep<>(EmptyTraversal.instance(), Vertex.class, true));
for (int i = 0; i < hasKeyValues.length; i = i + 2) {
graphStep.addHasContainer(new HasContainer((String) hasKeyValues[i], (P) hasKeyValues[i + 1]));
}
return graphStep;
}
开发者ID:ShiftLeftSecurity,项目名称:tinkergraph-gremlin,代码行数:8,代码来源:TinkerGraphStepStrategyTest.java
示例19: apply
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
@Override
public void apply(Traversal.Admin<?, ?> traversal) {
// Retrieve all graph (`V()`) steps - this is the step the strategy should replace
List<GraphStep> graphSteps = TraversalHelper.getStepsOfAssignableClass(GraphStep.class, traversal);
for (GraphStep graphStep : graphSteps) {
// For each graph step, confirm it follows this pattern:
// `V().filter(__.properties(a).where(P.eq(b)))`
if (!(graphStep.getNextStep() instanceof TraversalFilterStep)) continue;
TraversalFilterStep<Vertex> filterStep = (TraversalFilterStep<Vertex>) graphStep.getNextStep();
// Retrieve the filter steps e.g. `__.properties(a).where(P.eq(b))`
List<Step> steps = stepsFromFilterStep(filterStep);
if (steps.size() < 2) continue;
Step propertiesStep = steps.get(0); // This is `properties(a)`
Step whereStep = steps.get(1); // This is `filter(__.where(P.eq(b)))`
// Get the property key `a`
if (!(propertiesStep instanceof PropertiesStep)) continue;
Optional<String> propertyKey = propertyFromPropertiesStep((PropertiesStep<Vertex>) propertiesStep);
if (!propertyKey.isPresent()) continue;
// Get the step label `b`
if (!(whereStep instanceof WherePredicateStep)) continue;
Optional<String> label = labelFromWhereEqPredicate((WherePredicateStep<Vertex>) whereStep);
if (!label.isPresent()) continue;
executeStrategy(traversal, graphStep, filterStep, propertyKey.get(), label.get());
}
}
开发者ID:graknlabs,项目名称:grakn,代码行数:34,代码来源:JanusPreviousPropertyStepStrategy.java
示例20: executeStrategy
import org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep; //导入依赖的package包/类
/**
* Replace the {@code graphStep} and {@code filterStep} with a new {@link JanusPreviousPropertyStep} in the given
* {@code traversal}.
*/
private void executeStrategy(
Traversal.Admin<?, ?> traversal, GraphStep<?, ?> graphStep, TraversalFilterStep<Vertex> filterStep,
String propertyKey, String label) {
JanusPreviousPropertyStep newStep = new JanusPreviousPropertyStep(traversal, propertyKey, label);
traversal.removeStep(filterStep);
TraversalHelper.replaceStep(graphStep, newStep, traversal);
}
开发者ID:graknlabs,项目名称:grakn,代码行数:13,代码来源:JanusPreviousPropertyStepStrategy.java
注:本文中的org.apache.tinkerpop.gremlin.process.traversal.step.map.GraphStep类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论