本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal类的典型用法代码示例。如果您正苦于以下问题:Java IdentityTraversal类的具体用法?Java IdentityTraversal怎么用?Java IdentityTraversal使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IdentityTraversal类属于org.apache.tinkerpop.gremlin.process.traversal.lambda包,在下文中一共展示了IdentityTraversal类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMaxRequirement
import org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal; //导入依赖的package包/类
public default ElementRequirement getMaxRequirement() {
ElementRequirement max = ElementRequirement.ID;
if (this instanceof TraversalParent) {
for (final Traversal.Admin<Object, Object> traversal : ((TraversalParent) this).getLocalChildren()) {
if (traversal instanceof IdentityTraversal) {
if (max.compareTo(ElementRequirement.ID) < 0)
max = ElementRequirement.ID;
} else if (traversal instanceof TokenTraversal && ((TokenTraversal) traversal).getToken().equals(T.id)) {
if (max.compareTo(ElementRequirement.ID) < 0)
max = ElementRequirement.ID;
} else if (traversal instanceof TokenTraversal && ((TokenTraversal) traversal).getToken().equals(T.label)) {
if (max.compareTo(ElementRequirement.LABEL) < 0)
max = ElementRequirement.LABEL;
} else if (traversal instanceof ElementValueTraversal) {
if (max.compareTo(ElementRequirement.PROPERTIES) < 0)
max = ElementRequirement.PROPERTIES;
} else {
max = ElementRequirement.EDGES;
}
}
}
return max;
}
示例2: convertValueTraversal
import org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal; //导入依赖的package包/类
public static <S, E> Traversal.Admin<S, E> convertValueTraversal(final Traversal.Admin<S, E> valueTraversal) {
if (valueTraversal instanceof ElementValueTraversal ||
valueTraversal instanceof TokenTraversal ||
valueTraversal instanceof IdentityTraversal ||
valueTraversal.getStartStep() instanceof LambdaMapStep && ((LambdaMapStep) valueTraversal.getStartStep()).getMapFunction() instanceof FunctionTraverser) {
return (Traversal.Admin<S, E>) __.map(valueTraversal).fold();
} else {
return valueTraversal;
}
}
示例3: ChainedComparator
import org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal; //导入依赖的package包/类
public ChainedComparator(final boolean traversers, final List<Pair<Traversal.Admin<S, C>, Comparator<C>>> comparators) {
this.traversers = traversers;
if (comparators.isEmpty())
this.comparators.add(new Pair<>(new IdentityTraversal(), (Comparator) Order.incr));
else
this.comparators.addAll(comparators);
this.isShuffle = (Comparator) (this.comparators.get(this.comparators.size() - 1).getValue1()) == Order.shuffle;
if (!this.isShuffle)
this.comparators.removeAll(this.comparators.stream().filter(pair -> (Comparator) pair.getValue1() == Order.shuffle).collect(Collectors.toList()));
}
示例4: generateTestParameters
import org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal; //导入依赖的package包/类
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> generateTestParameters() {
return Arrays.asList(new Traversal[][]{
// select("a")
{__.select("a"), __.select("a")},
{__.select("a").by(), __.select("a").by()},
{__.select("a").by(__.outE().count()), __.select("a").map(__.outE().count())},
{__.select("a").by("name"), __.select("a").map(new ElementValueTraversal<>("name"))},
{__.select("a").out(), __.select("a").out()},
{__.select(Pop.all, "a").by(__.values("name")), __.select(Pop.all, "a").by(__.values("name"))},
{__.select(Pop.last, "a").by(__.values("name")), __.select(Pop.last, "a").map(__.values("name"))},
{__.select(Pop.first, "a").by(__.values("name")), __.select(Pop.first, "a").map(__.values("name"))},
// select("a","b")
{__.select("a", "b"), __.select("a", "b")},
{__.select("a", "b").by(), __.select("a", "b").by()},
{__.select("a", "b", "c").by(), __.select("a", "b", "c").by()},
{__.select("a", "b").by().by("age"), __.select("b").map(new ElementValueTraversal<>("age")).as("b").select("a").map(new IdentityTraversal<>()).as("a").select(Pop.last, "a", "b")},
{__.select("a", "b").by("name").by("age"), __.select("b").map(new ElementValueTraversal<>("age")).as("b").select("a").map(new ElementValueTraversal<>("name")).as("a").select(Pop.last, "a", "b")},
{__.select("a", "b", "c").by("name").by(__.outE().count()), __.select("c").map(new ElementValueTraversal<>("name")).as("c").select("b").map(__.outE().count()).as("b").select("a").map(new ElementValueTraversal<>("name")).as("a").select(Pop.last, "a", "b", "c")},
{__.select(Pop.first, "a", "b").by("name").by("age"), __.select(Pop.first, "b").map(new ElementValueTraversal<>("age")).as("b").select(Pop.first, "a").map(new ElementValueTraversal<>("name")).as("a").select(Pop.last, "a", "b")},
{__.select(Pop.last, "a", "b").by("name").by("age"), __.select(Pop.last, "b").map(new ElementValueTraversal<>("age")).as("b").select(Pop.last, "a").map(new ElementValueTraversal<>("name")).as("a").select(Pop.last, "a", "b")},
{__.select(Pop.all, "a", "b").by("name").by("age"), __.select(Pop.all, "a", "b").by("name").by("age")},
// where(as("a")...)
{__.where(__.out("knows")), __.where(__.out("knows"))},
//{__.where(__.as("a").out("knows")), __.select(Pop.last, "a").where(__.out("knows"))},
//{__.where(__.as("a").out("knows").as("b")), __.select(Pop.last, "a").where(__.out("knows").as("b"))}, // todo: need to be able to drop path labels for this to work
{__.where("a", P.eq("b")), __.where("a", P.eq("b"))}
});
}
示例5: convertValueTraversal
import org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal; //导入依赖的package包/类
public static <S, E> Traversal.Admin<S, E> convertValueTraversal(final Traversal.Admin<S, E> valueTraversal) {
if (valueTraversal instanceof ElementValueTraversal ||
valueTraversal instanceof TokenTraversal ||
valueTraversal instanceof IdentityTraversal ||
valueTraversal.getStartStep() instanceof LambdaMapStep && ((LambdaMapStep) valueTraversal.getStartStep()).getMapFunction() instanceof FunctionTraverser) {
return (Traversal.Admin<S, E>) __.map(valueTraversal).fold();
} else
return valueTraversal;
}
示例6: generateTestParameters
import org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal; //导入依赖的package包/类
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> generateTestParameters() {
return Arrays.asList(new Object[][]{
// select("a")
{__.select("a"), __.select("a"), Collections.emptyList()},
{__.select("a").by(), __.select("a").by(), Collections.emptyList()},
{__.select("a").by(__.outE().count()), __.select("a").map(__.outE().count()), Collections.emptyList()},
{__.select("a").by("name"), __.select("a").map(new ElementValueTraversal<>("name")), Collections.emptyList()},
{__.select("a").out(), __.select("a").out(), Collections.emptyList()},
{__.select(Pop.all, "a").by(__.values("name")), __.select(Pop.all, "a").by(__.values("name")), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
{__.select(Pop.last, "a").by(__.values("name")), __.select(Pop.last, "a").map(__.values("name")), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
{__.select(Pop.first, "a").by(__.values("name")), __.select(Pop.first, "a").map(__.values("name")), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
// select("a","b")
{__.select("a", "b"), __.select("a", "b"), Collections.emptyList()},
{__.select("a", "b").by(), __.select("a", "b").by(), Collections.emptyList()},
{__.select("a", "b", "c").by(), __.select("a", "b", "c").by(), Collections.emptyList()},
{__.select("a", "b").by().by("age"), __.select("b").map(new ElementValueTraversal<>("age")).as("b").select("a").map(new IdentityTraversal<>()).as("a").select(Pop.last, "a", "b"), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
{__.select("a", "b").by("name").by("age"), __.select("b").map(new ElementValueTraversal<>("age")).as("b").select("a").map(new ElementValueTraversal<>("name")).as("a").select(Pop.last, "a", "b"), Collections.emptyList()},
{__.select("a", "b", "c").by("name").by(__.outE().count()), __.select("c").map(new ElementValueTraversal<>("name")).as("c").select("b").map(__.outE().count()).as("b").select("a").map(new ElementValueTraversal<>("name")).as("a").select(Pop.last, "a", "b", "c"), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
{__.select(Pop.first, "a", "b").by("name").by("age"), __.select(Pop.first, "b").map(new ElementValueTraversal<>("age")).as("b").select(Pop.first, "a").map(new ElementValueTraversal<>("name")).as("a").select(Pop.last, "a", "b"), Collections.emptyList()},
{__.select(Pop.last, "a", "b").by("name").by("age"), __.select(Pop.last, "b").map(new ElementValueTraversal<>("age")).as("b").select(Pop.last, "a").map(new ElementValueTraversal<>("name")).as("a").select(Pop.last, "a", "b"), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
{__.select(Pop.all, "a", "b").by("name").by("age"), __.select(Pop.all, "a", "b").by("name").by("age"), Collections.emptyList()},
{__.select(Pop.mixed, "a", "b").by("name").by("age"), __.select(Pop.mixed, "a", "b").by("name").by("age"), Collections.emptyList()},
// where(as("a")...)
{__.where(__.out("knows")), __.where(__.outE("knows")), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
{__.where(__.as("a").out("knows")), __.identity().as("xyz").select(Pop.last, "a").filter(__.out("knows")).select(Pop.last, "xyz"), Collections.emptyList()},
{__.where(__.as("a").has("age", P.gt(10))), __.identity().as("xyz").select(Pop.last, "a").has("age", P.gt(10)).select(Pop.last, "xyz"), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
{__.select("b").where(__.as("a").has("age", P.gt(10))), __.select("b").as("xyz").select(Pop.last, "a").has("age", P.gt(10)).select(Pop.last, "xyz"), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
{__.where(__.as("a").out("knows").as("b")), __.identity().as("xyz").select(Pop.last, "a").where(__.out("knows").as("b")).select(Pop.last, "xyz"), Collections.emptyList()},
{__.where("a", P.eq("b")), __.where("a", P.eq("b")), Collections.emptyList()},
{__.as("a").out().where(__.as("a").has("age", P.gt(10))).in(), __.as("a").out().as("xyz").select(Pop.last, "a").has("age", P.gt(10)).select(Pop.last, "xyz").in(), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
{__.as("a").out().where(__.as("a").has("age", P.gt(10))).in().path(), __.as("a").out().where(__.as("a").has("age", P.gt(10))).in().path(), TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()},
});
}
示例7: getComparators
import org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal; //导入依赖的package包/类
@Override
public List<Pair<Traversal.Admin<S, C>, Comparator<C>>> getComparators() {
return this.comparators.isEmpty() ? Collections.singletonList(new Pair<>(new IdentityTraversal(), (Comparator) Order.incr)) : Collections.unmodifiableList(this.comparators);
}
示例8: modulateBy
import org.apache.tinkerpop.gremlin.process.traversal.lambda.IdentityTraversal; //导入依赖的package包/类
public default void modulateBy() throws UnsupportedOperationException {
this.modulateBy(new IdentityTraversal());
}