本文整理汇总了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");
}
示例2: toOrder
import org.apache.tinkerpop.gremlin.process.traversal.Order; //导入方法依赖的package包/类
@Override
public Order toOrder() {
return Order.incr;
}