当前位置: 首页>>代码示例>>Java>>正文


Java Order.incr方法代码示例

本文整理汇总了Java中org.apache.tinkerpop.gremlin.process.traversal.Order.incr方法的典型用法代码示例。如果您正苦于以下问题:Java Order.incr方法的具体用法?Java Order.incr怎么用?Java Order.incr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.tinkerpop.gremlin.process.traversal.Order的用法示例。


在下文中一共展示了Order.incr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeVCIndex

import org.apache.tinkerpop.gremlin.process.traversal.Order; //导入方法依赖的package包/类
/**
 * Create vertex-centric index
 *
 * {
 *     "name": "indexName",
 *     "edge": "edgeLebel",
 *     "propertyKeys": [ "propertyKey1", "propertyKey2" ],
 *     "order": "incr|decr",
 *     "direction": "BOTH|IN|OUT"
 * }
 */
void makeVCIndex(JanusGraphManagement mgmt, JsonNode node) {
    if (!node.has("name")) {
        log.info("missing 'name' property, not able to create an index");
        return;
    }

    if (!node.has("edge")) {
        log.info("vertex-centric index needs 'edge' property to specify a edge label");
        return;
    }

    String edgeName = node.get("edge").asText();
    EdgeLabel elabel = mgmt.getEdgeLabel(edgeName);

    if (elabel == null) {
        log.info("edge: " + edgeName + " doesn't exist");
        return;
    }

    String name = node.get("name").asText();
    if (mgmt.containsRelationIndex(elabel, name)) {
        log.info("index: " + name + " exists");
        return;
    }

    if (!node.has("propertyKeys")) {
        log.info("missing 'propertyKeys property, not able to create an index");
        return;
    }

    JsonNode properties = node.findValue("propertyKeys");
    if (properties == null || properties.size() == 0) {
        log.info("index: " + name + " needs 'propertyKeys' properties");
        return;
    }

    Direction dir = node.has("direction") ? Direction.valueOf(node.get("direction").asText()) : Direction.BOTH;
    Order order = node.has("order") ? Order.valueOf(node.get("order").asText()) : Order.incr;

    PropertyKey[] keys = new PropertyKey[properties.size()];
    int counter = 0;
    for (JsonNode property : properties) {
        PropertyKey key = mgmt.getPropertyKey(property.asText());
        if (key == null) {
            log.info("propertyKey:${property.asText()} doesn't exist, can't create ${name} vertex-centric index");
            return;
        }
        keys[counter++] = mgmt.getPropertyKey(property.asText());
    }

    mgmt.buildEdgeIndex(elabel, name, dir, order, keys);

    log.info("vertex-centric index: ${name} creation is done");
}
 
开发者ID:tedhtchang,项目名称:JanusGraphBench,代码行数:66,代码来源:SchemaLoader.java

示例2: toOrder

import org.apache.tinkerpop.gremlin.process.traversal.Order; //导入方法依赖的package包/类
@Override
public Order toOrder() {
  return Order.incr;
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:5,代码来源:SortParameter.java


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