• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OrderGlobalStep类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep的典型用法代码示例。如果您正苦于以下问题:Java OrderGlobalStep类的具体用法?Java OrderGlobalStep怎么用?Java OrderGlobalStep使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OrderGlobalStep类属于org.apache.tinkerpop.gremlin.process.traversal.step.map包,在下文中一共展示了OrderGlobalStep类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getStepRank

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
/**
 * Ranks the given step. Steps with lower ranks can be moved in front of steps with higher ranks. 0 means that
 * the step has no rank and thus is not exchangeable with its neighbors.
 *
 * @param step
 * @return The rank of the given step.
 */
private static int getStepRank(final Step step) {
    if (step instanceof IsStep) {
        return 1;
    } else if (step instanceof HasStep) {
        return 2;
    } else if (step instanceof WherePredicateStep) {
        return 3;
    } else if (step instanceof SimplePathStep || step instanceof CyclicPathStep) {
        return 4;
    } else if (step instanceof TraversalFilterStep) {
        return 5;
    } else if (step instanceof WhereTraversalStep) {
        return 6;
    } else if (step instanceof OrStep) {
        return 7;
    } else if (step instanceof AndStep) {
        return 8;
    } else if (step instanceof DedupGlobalStep) {
        return 9;
    } else if (step instanceof OrderGlobalStep) {
        return 10;
    }
    return 0;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:32,代码来源:FilterRankingStrategy.java


示例2: apply

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
@Override
public void apply(Traversal.Admin<?, ?> traversal) {
    TraversalHelper.getStepsOfAssignableClass(OrderGlobalStep.class, traversal).forEach(orderGlobalStep -> {
        List<Pair<Traversal.Admin, Comparator>> comparators = orderGlobalStep.getComparators();
        List<Pair<String, Order>> collect = comparators.stream()
                .filter(pair -> pair.getValue0() instanceof ElementValueTraversal)
                .filter(pair -> pair.getValue1() instanceof Order)
                .map(pair -> Pair.with(((ElementValueTraversal) pair.getValue0()).getPropertyKey(),
                        ((Order) pair.getValue1())))
                .collect(Collectors.toList());
        Collection<Orderable> orderableStepOf = getOrderableStepOf(orderGlobalStep, traversal);
        if (orderableStepOf != null && orderableStepOf.size() == 1) {
            Orderable step = orderableStepOf.iterator().next();
            step.setOrders(collect);
            Step nextStep = orderGlobalStep.getNextStep();
            if (nextStep instanceof RangeGlobalStep){
                if (step instanceof ReceivesPredicatesHolder) {
                    RangeGlobalStep rangeGlobalStep = (RangeGlobalStep) nextStep;
                    int limit = rangeGlobalStep.getHighRange() > Integer.MAX_VALUE ? -1 : (int) rangeGlobalStep.getHighRange();
                    ((ReceivesPredicatesHolder) step).setLimit(limit);
                }
            }
        }
    });
}
 
开发者ID:unipop-graph,项目名称:unipop,代码行数:26,代码来源:UniGraphOrderStrategy.java


示例3: walkReplacedSteps

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的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


示例4: verifyIncidentTraversal

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
private static void verifyIncidentTraversal(FulgoraElementTraversal<Vertex,Edge> traversal) {
    //First step must be TitanVertexStep
    List<Step> steps = traversal.getSteps();
    Step<Vertex,?> startStep = steps.get(0);
    Preconditions.checkArgument(startStep instanceof TitanVertexStep &&
            TitanTraversalUtil.isEdgeReturnStep((TitanVertexStep) startStep),"Expected first step to be an edge step but found: %s",startStep);
    Optional<Step> violatingStep = steps.stream().filter(s -> !(s instanceof TitanVertexStep ||
            s instanceof OrderGlobalStep || s instanceof OrderLocalStep ||
                    s instanceof IdentityStep || s instanceof FilterStep)).findAny();
    if (violatingStep.isPresent()) throw new IllegalArgumentException("Encountered unsupported step in incident traversal: " + violatingStep.get());
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:12,代码来源:FulgoraUtil.java


示例5: validTitanOrder

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
public static boolean validTitanOrder(OrderGlobalStep ostep, Traversal rootTraversal,
                                      boolean isVertexOrder) {
    for (Comparator comp : (List<Comparator>) ostep.getComparators()) {
        if (!(comp instanceof ElementValueComparator)) return false;
        ElementValueComparator evc = (ElementValueComparator) comp;
        if (!(evc.getValueComparator() instanceof Order)) return false;

        TitanTransaction tx = TitanTraversalUtil.getTx(rootTraversal.asAdmin());
        String key = evc.getPropertyKey();
        PropertyKey pkey = tx.getPropertyKey(key);
        if (pkey == null || !(Comparable.class.isAssignableFrom(pkey.dataType()))) return false;
        if (isVertexOrder && pkey.cardinality() != Cardinality.SINGLE) return false;
    }
    return true;
}
 
开发者ID:graben1437,项目名称:titan1withtp3.1,代码行数:16,代码来源:HasStepFolder.java


示例6: getStepRank

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
/**
 * Ranks the given step. Steps with lower ranks can be moved in front of steps with higher ranks. 0 means that
 * the step has no rank and thus is not exchangeable with its neighbors.
 *
 * @param step the step to get a ranking for
 * @return The rank of the given step.
 */
private static int getStepRank(final Step step) {
    final int rank;
    if (!(step instanceof FilterStep || step instanceof OrderGlobalStep))
        return 0;
    else if (step instanceof IsStep || step instanceof ClassFilterStep)
        rank = 1;
    else if (step instanceof HasStep)
        rank = 2;
    else if (step instanceof WherePredicateStep && ((WherePredicateStep) step).getLocalChildren().isEmpty())
        rank = 3;
    else if (step instanceof TraversalFilterStep || step instanceof NotStep)
        rank = 4;
    else if (step instanceof WhereTraversalStep)
        rank = 5;
    else if (step instanceof OrStep)
        rank = 6;
    else if (step instanceof AndStep)
        rank = 7;
    else if (step instanceof WherePredicateStep) // has by()-modulation
        rank = 8;
    else if (step instanceof DedupGlobalStep)
        rank = 9;
    else if (step instanceof OrderGlobalStep)
        rank = 10;
    else
        return 0;
    ////////////
    if (step instanceof TraversalParent)
        return getMaxStepRank((TraversalParent) step, rank);
    else
        return rank;
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:40,代码来源:FilterRankingStrategy.java


示例7: testOptionalWithOrder2

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
@Test
public void testOptionalWithOrder2() {
    Vertex a1 = this.sqlgGraph.addVertex(T.label, "A", "order", 13);
    Vertex a2 = this.sqlgGraph.addVertex(T.label, "A", "order", 12);
    Vertex a3 = this.sqlgGraph.addVertex(T.label, "A", "order", 11);
    Vertex b1 = this.sqlgGraph.addVertex(T.label, "B", "order", 3);
    Vertex b2 = this.sqlgGraph.addVertex(T.label, "B", "order", 2);
    Vertex b3 = this.sqlgGraph.addVertex(T.label, "B", "order", 1);
    a1.addEdge("ab", b1);
    a1.addEdge("ab", b2);
    a1.addEdge("ab", b3);
    this.sqlgGraph.tx().commit();

    DefaultGraphTraversal<Vertex, Vertex> traversal = (DefaultGraphTraversal<Vertex, Vertex>) this.sqlgGraph.traversal()
            .V().hasLabel("A").as("a")
            .local(
                    __.optional(
                            __.outE().as("e").otherV().as("v")
                    )
            ).order().by("order");
    Assert.assertEquals(4, traversal.getSteps().size());
    List<Vertex> vertices = traversal.toList();
    Assert.assertEquals(4, traversal.getSteps().size());

    Assert.assertTrue(traversal.getSteps().get(0) instanceof SqlgGraphStep);
    Assert.assertTrue(traversal.getSteps().get(1) instanceof IdentityStep);
    Assert.assertTrue(traversal.getSteps().get(2) instanceof SqlgLocalStepBarrier);
    Assert.assertTrue(traversal.getSteps().get(3) instanceof OrderGlobalStep);
    SqlgLocalStepBarrier<?, ?> localStep = (SqlgLocalStepBarrier<?, ?>) traversal.getSteps().get(2);
    List<SqlgVertexStep> sqlgVertexSteps = TraversalHelper.getStepsOfAssignableClassRecursively(SqlgVertexStep.class, localStep.getLocalChildren().get(0));
    Assert.assertEquals(1, sqlgVertexSteps.size());

    Assert.assertEquals(5, vertices.size());
    Assert.assertEquals(b3, vertices.get(0));
    Assert.assertEquals(b2, vertices.get(1));
    Assert.assertEquals(b1, vertices.get(2));
    Assert.assertEquals(a3, vertices.get(3));
    Assert.assertEquals(a2, vertices.get(4));
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:40,代码来源:TestLocalVertexStepOptionalWithOrder.java


示例8: testOptionalWithOrder2

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
@Test
public void testOptionalWithOrder2() {
    Vertex a1 = this.sqlgGraph.addVertex(T.label, "A", "order", 13);
    Vertex a2 = this.sqlgGraph.addVertex(T.label, "A", "order", 12);
    Vertex a3 = this.sqlgGraph.addVertex(T.label, "A", "order", 11);
    Vertex b1 = this.sqlgGraph.addVertex(T.label, "B", "order", 3);
    Vertex b2 = this.sqlgGraph.addVertex(T.label, "B", "order", 2);
    Vertex b3 = this.sqlgGraph.addVertex(T.label, "B", "order", 1);
    a1.addEdge("ab", b1);
    a1.addEdge("ab", b2);
    a1.addEdge("ab", b3);
    this.sqlgGraph.tx().commit();

    DefaultGraphTraversal<Vertex, Vertex> traversal = (DefaultGraphTraversal<Vertex, Vertex>) this.sqlgGraph.traversal()
            .V().hasLabel("A").as("a")
            .optional(
                    __.outE().as("e").otherV().as("v")
            ).order().by("order");
    Assert.assertEquals(4, traversal.getSteps().size());
    List<Vertex> vertices = traversal.toList();
    Assert.assertEquals(3, traversal.getSteps().size());

    assertStep(traversal.getSteps().get(0), true, false, false, true);

    Assert.assertTrue(traversal.getSteps().get(1) instanceof IdentityStep);
    Assert.assertTrue(traversal.getSteps().get(2) instanceof OrderGlobalStep);
    Assert.assertEquals(5, vertices.size());
    Assert.assertEquals(b3, vertices.get(0));
    Assert.assertEquals(b2, vertices.get(1));
    Assert.assertEquals(b1, vertices.get(2));
    Assert.assertEquals(a3, vertices.get(3));
    Assert.assertEquals(a2, vertices.get(4));
}
 
开发者ID:pietermartin,项目名称:sqlg,代码行数:34,代码来源:TestOptionalWithOrder.java


示例9: doTest

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
@Test
public void doTest() {
    traversal.asAdmin().setParent(new TraversalVertexProgramStep(EmptyTraversal.instance(), EmptyTraversal.instance())); // trick it
    applyOrderLimitStrategyStrategy(traversal);
    assertEquals(limit, TraversalHelper.getFirstStepOfAssignableClass(OrderGlobalStep.class, traversal.asAdmin()).get().getLimit());
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:7,代码来源:OrderLimitStrategyTest.java


示例10: order

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
/**
 * Order either the {@link Scope#local} object (e.g. a list, map, etc.) or the entire {@link Scope#global} traversal stream.
 *
 * @param scope whether the ordering is the current local object or the entire global stream.
 * @return the traversal with an appended {@link OrderGlobalStep} or {@link OrderLocalStep}.
 */
public default GraphTraversal<S, E> order(final Scope scope) {
    return this.asAdmin().addStep(scope.equals(Scope.global) ? new OrderGlobalStep<>(this.asAdmin()) : new OrderLocalStep<>(this.asAdmin()));
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:10,代码来源:GraphTraversal.java


示例11: order

import org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep; //导入依赖的package包/类
/**
 * Order all the objects in the traversal up to this point and then emit them one-by-one in their ordered sequence.
 *
 * @return the traversal with an appended {@link OrderGlobalStep}.
 * @see <a href="http://tinkerpop.apache.org/docs/${project.version}/reference/#order-step" target="_blank">Reference Documentation - Order Step</a>
 * @since 3.0.0-incubating
 */
public default GraphTraversal<S, E> order() {
    this.asAdmin().getBytecode().addStep(Symbols.order);
    return this.asAdmin().addStep(new OrderGlobalStep<>(this.asAdmin()));
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:12,代码来源:GraphTraversal.java



注:本文中的org.apache.tinkerpop.gremlin.process.traversal.step.map.OrderGlobalStep类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WakeLockManager类代码示例发布时间:2022-05-22
下一篇:
Java R类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap