Search in sources :

Example 1 with Frequency

use of com.baidu.hugegraph.type.define.Frequency in project incubator-hugegraph by apache.

the class TableSerializer method readEdgeLabel.

@Override
public EdgeLabel readEdgeLabel(HugeGraph graph, BackendEntry backendEntry) {
    if (backendEntry == null) {
        return null;
    }
    TableBackendEntry entry = this.convertEntry(backendEntry);
    Number id = schemaColumn(entry, HugeKeys.ID);
    String name = schemaColumn(entry, HugeKeys.NAME);
    Frequency frequency = schemaEnum(entry, HugeKeys.FREQUENCY, Frequency.class);
    Number sourceLabel = schemaColumn(entry, HugeKeys.SOURCE_LABEL);
    Number targetLabel = schemaColumn(entry, HugeKeys.TARGET_LABEL);
    Object sortKeys = schemaColumn(entry, HugeKeys.SORT_KEYS);
    Object nullableKeys = schemaColumn(entry, HugeKeys.NULLABLE_KEYS);
    Object properties = schemaColumn(entry, HugeKeys.PROPERTIES);
    Object indexLabels = schemaColumn(entry, HugeKeys.INDEX_LABELS);
    SchemaStatus status = schemaEnum(entry, HugeKeys.STATUS, SchemaStatus.class);
    Number ttl = schemaColumn(entry, HugeKeys.TTL);
    Number ttlStartTime = schemaColumn(entry, HugeKeys.TTL_START_TIME);
    EdgeLabel edgeLabel = new EdgeLabel(graph, this.toId(id), name);
    edgeLabel.frequency(frequency);
    edgeLabel.sourceLabel(this.toId(sourceLabel));
    edgeLabel.targetLabel(this.toId(targetLabel));
    edgeLabel.properties(this.toIdArray(properties));
    edgeLabel.sortKeys(this.toIdArray(sortKeys));
    edgeLabel.nullableKeys(this.toIdArray(nullableKeys));
    edgeLabel.addIndexLabels(this.toIdArray(indexLabels));
    edgeLabel.status(status);
    edgeLabel.ttl(ttl.longValue());
    edgeLabel.ttlStartTime(this.toId(ttlStartTime));
    this.readEnableLabelIndex(edgeLabel, entry);
    this.readUserdata(edgeLabel, entry);
    return edgeLabel;
}
Also used : EdgeLabel(com.baidu.hugegraph.schema.EdgeLabel) Frequency(com.baidu.hugegraph.type.define.Frequency) SchemaStatus(com.baidu.hugegraph.type.define.SchemaStatus)

Example 2 with Frequency

use of com.baidu.hugegraph.type.define.Frequency in project incubator-hugegraph by apache.

the class TextSerializer method readEdgeLabel.

@Override
public EdgeLabel readEdgeLabel(HugeGraph graph, BackendEntry backendEntry) {
    if (backendEntry == null) {
        return null;
    }
    TextBackendEntry entry = this.convertEntry(backendEntry);
    Id id = readId(entry.id());
    String name = JsonUtil.fromJson(entry.column(HugeKeys.NAME), String.class);
    String sourceLabel = entry.column(HugeKeys.SOURCE_LABEL);
    String targetLabel = entry.column(HugeKeys.TARGET_LABEL);
    String frequency = entry.column(HugeKeys.FREQUENCY);
    String sortKeys = entry.column(HugeKeys.SORT_KEYS);
    String nullablekeys = entry.column(HugeKeys.NULLABLE_KEYS);
    String properties = entry.column(HugeKeys.PROPERTIES);
    String indexLabels = entry.column(HugeKeys.INDEX_LABELS);
    String enableLabelIndex = entry.column(HugeKeys.ENABLE_LABEL_INDEX);
    String status = entry.column(HugeKeys.STATUS);
    String ttl = entry.column(HugeKeys.TTL);
    String ttlStartTime = entry.column(HugeKeys.TTL_START_TIME);
    EdgeLabel edgeLabel = new EdgeLabel(graph, id, name);
    edgeLabel.sourceLabel(readId(sourceLabel));
    edgeLabel.targetLabel(readId(targetLabel));
    edgeLabel.frequency(JsonUtil.fromJson(frequency, Frequency.class));
    edgeLabel.properties(readIds(properties));
    edgeLabel.sortKeys(readIds(sortKeys));
    edgeLabel.nullableKeys(readIds(nullablekeys));
    edgeLabel.addIndexLabels(readIds(indexLabels));
    edgeLabel.enableLabelIndex(JsonUtil.fromJson(enableLabelIndex, Boolean.class));
    readUserdata(edgeLabel, entry);
    edgeLabel.status(JsonUtil.fromJson(status, SchemaStatus.class));
    edgeLabel.ttl(JsonUtil.fromJson(ttl, Long.class));
    edgeLabel.ttlStartTime(readId(ttlStartTime));
    return edgeLabel;
}
Also used : EdgeLabel(com.baidu.hugegraph.schema.EdgeLabel) Frequency(com.baidu.hugegraph.type.define.Frequency) Id(com.baidu.hugegraph.backend.id.Id) EdgeId(com.baidu.hugegraph.backend.id.EdgeId) SchemaStatus(com.baidu.hugegraph.type.define.SchemaStatus)

Aggregations

EdgeLabel (com.baidu.hugegraph.schema.EdgeLabel)2 Frequency (com.baidu.hugegraph.type.define.Frequency)2 SchemaStatus (com.baidu.hugegraph.type.define.SchemaStatus)2 EdgeId (com.baidu.hugegraph.backend.id.EdgeId)1 Id (com.baidu.hugegraph.backend.id.Id)1