use of com.baidu.hugegraph.type.define.HugeKeys in project incubator-hugegraph by apache.
the class GraphSONSchemaSerializer method writeVertexLabel.
public Map<HugeKeys, Object> writeVertexLabel(VertexLabel vertexLabel) {
HugeGraph graph = vertexLabel.graph();
assert graph != null;
Map<HugeKeys, Object> map = new LinkedHashMap<>();
map.put(HugeKeys.ID, vertexLabel.id().asLong());
map.put(HugeKeys.NAME, vertexLabel.name());
map.put(HugeKeys.ID_STRATEGY, vertexLabel.idStrategy());
map.put(HugeKeys.PRIMARY_KEYS, graph.mapPkId2Name(vertexLabel.primaryKeys()));
map.put(HugeKeys.NULLABLE_KEYS, graph.mapPkId2Name(vertexLabel.nullableKeys()));
map.put(HugeKeys.INDEX_LABELS, graph.mapIlId2Name(vertexLabel.indexLabels()));
map.put(HugeKeys.PROPERTIES, graph.mapPkId2Name(vertexLabel.properties()));
map.put(HugeKeys.STATUS, vertexLabel.status());
map.put(HugeKeys.TTL, vertexLabel.ttl());
String ttlStartTimeName = vertexLabel.ttlStartTimeName();
if (ttlStartTimeName != null) {
map.put(HugeKeys.TTL_START_TIME, ttlStartTimeName);
}
map.put(HugeKeys.ENABLE_LABEL_INDEX, vertexLabel.enableLabelIndex());
map.put(HugeKeys.USER_DATA, vertexLabel.userdata());
return map;
}
use of com.baidu.hugegraph.type.define.HugeKeys in project incubator-hugegraph by apache.
the class GraphSONSchemaSerializer method writeEdgeLabel.
public Map<HugeKeys, Object> writeEdgeLabel(EdgeLabel edgeLabel) {
HugeGraph graph = edgeLabel.graph();
assert graph != null;
Map<HugeKeys, Object> map = new LinkedHashMap<>();
map.put(HugeKeys.ID, edgeLabel.id().asLong());
map.put(HugeKeys.NAME, edgeLabel.name());
map.put(HugeKeys.SOURCE_LABEL, edgeLabel.sourceLabelName());
map.put(HugeKeys.TARGET_LABEL, edgeLabel.targetLabelName());
map.put(HugeKeys.FREQUENCY, edgeLabel.frequency());
map.put(HugeKeys.SORT_KEYS, graph.mapPkId2Name(edgeLabel.sortKeys()));
map.put(HugeKeys.NULLABLE_KEYS, graph.mapPkId2Name(edgeLabel.nullableKeys()));
map.put(HugeKeys.INDEX_LABELS, graph.mapIlId2Name(edgeLabel.indexLabels()));
map.put(HugeKeys.PROPERTIES, graph.mapPkId2Name(edgeLabel.properties()));
map.put(HugeKeys.STATUS, edgeLabel.status());
map.put(HugeKeys.TTL, edgeLabel.ttl());
String ttlStartTimeName = edgeLabel.ttlStartTimeName();
if (ttlStartTimeName != null) {
map.put(HugeKeys.TTL_START_TIME, ttlStartTimeName);
}
map.put(HugeKeys.ENABLE_LABEL_INDEX, edgeLabel.enableLabelIndex());
map.put(HugeKeys.USER_DATA, edgeLabel.userdata());
return map;
}
use of com.baidu.hugegraph.type.define.HugeKeys in project incubator-hugegraph by apache.
the class GraphSONSchemaSerializer method writePropertyKey.
public Map<HugeKeys, Object> writePropertyKey(PropertyKey propertyKey) {
HugeGraph graph = propertyKey.graph();
assert graph != null;
Map<HugeKeys, Object> map = new LinkedHashMap<>();
map.put(HugeKeys.ID, propertyKey.id().asLong());
map.put(HugeKeys.NAME, propertyKey.name());
map.put(HugeKeys.DATA_TYPE, propertyKey.dataType());
map.put(HugeKeys.CARDINALITY, propertyKey.cardinality());
map.put(HugeKeys.AGGREGATE_TYPE, propertyKey.aggregateType());
map.put(HugeKeys.WRITE_TYPE, propertyKey.writeType());
map.put(HugeKeys.PROPERTIES, graph.mapPkId2Name(propertyKey.properties()));
map.put(HugeKeys.STATUS, propertyKey.status());
map.put(HugeKeys.USER_DATA, propertyKey.userdata());
return map;
}
use of com.baidu.hugegraph.type.define.HugeKeys in project incubator-hugegraph by apache.
the class TraversalUtil method convContains2Relation.
public static Condition convContains2Relation(HugeGraph graph, HasContainer has) {
// Convert contains-key or contains-value
BiPredicate<?, ?> bp = has.getPredicate().getBiPredicate();
E.checkArgument(bp == Compare.eq, "CONTAINS query with relation " + "'%s' is not supported", bp);
HugeKeys key = token2HugeKey(has.getKey());
E.checkNotNull(key, "token key");
Object value = has.getValue();
if (keyForContainsKey(has.getKey())) {
if (value instanceof String) {
value = graph.propertyKey((String) value).id();
}
return Condition.containsKey(key, value);
} else {
assert keyForContainsValue(has.getKey());
return Condition.containsValue(key, value);
}
}
use of com.baidu.hugegraph.type.define.HugeKeys in project incubator-hugegraph by apache.
the class MysqlEntryIterator method row2Entry.
private MysqlBackendEntry row2Entry(ResultSet result) throws SQLException {
HugeType type = this.query.resultType();
MysqlBackendEntry entry = new MysqlBackendEntry(type);
ResultSetMetaData metaData = result.getMetaData();
for (int i = 1; i <= metaData.getColumnCount(); i++) {
String name = metaData.getColumnLabel(i);
HugeKeys key = MysqlTable.parseKey(name);
Object value = result.getObject(i);
if (value == null) {
assert key == HugeKeys.EXPIRED_TIME;
continue;
}
entry.column(key, value);
}
return entry;
}
Aggregations