Search in sources :

Example 1 with SchemaStatus

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

the class TableSerializer method readVertexLabel.

@Override
public VertexLabel readVertexLabel(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);
    IdStrategy idStrategy = schemaEnum(entry, HugeKeys.ID_STRATEGY, IdStrategy.class);
    Object properties = schemaColumn(entry, HugeKeys.PROPERTIES);
    Object primaryKeys = schemaColumn(entry, HugeKeys.PRIMARY_KEYS);
    Object nullableKeys = schemaColumn(entry, HugeKeys.NULLABLE_KEYS);
    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);
    VertexLabel vertexLabel = new VertexLabel(graph, this.toId(id), name);
    vertexLabel.idStrategy(idStrategy);
    vertexLabel.properties(this.toIdArray(properties));
    vertexLabel.primaryKeys(this.toIdArray(primaryKeys));
    vertexLabel.nullableKeys(this.toIdArray(nullableKeys));
    vertexLabel.addIndexLabels(this.toIdArray(indexLabels));
    vertexLabel.status(status);
    vertexLabel.ttl(ttl.longValue());
    vertexLabel.ttlStartTime(this.toId(ttlStartTime));
    this.readEnableLabelIndex(vertexLabel, entry);
    this.readUserdata(vertexLabel, entry);
    return vertexLabel;
}
Also used : VertexLabel(com.baidu.hugegraph.schema.VertexLabel) IdStrategy(com.baidu.hugegraph.type.define.IdStrategy) SchemaStatus(com.baidu.hugegraph.type.define.SchemaStatus)

Example 2 with SchemaStatus

use of com.baidu.hugegraph.type.define.SchemaStatus 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 3 with SchemaStatus

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

the class TableSerializer method readPropertyKey.

@Override
public PropertyKey readPropertyKey(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);
    DataType dataType = schemaEnum(entry, HugeKeys.DATA_TYPE, DataType.class);
    Cardinality cardinality = schemaEnum(entry, HugeKeys.CARDINALITY, Cardinality.class);
    AggregateType aggregateType = schemaEnum(entry, HugeKeys.AGGREGATE_TYPE, AggregateType.class);
    WriteType writeType = schemaEnumOrDefault(entry, HugeKeys.WRITE_TYPE, WriteType.class, WriteType.OLTP);
    Object properties = schemaColumn(entry, HugeKeys.PROPERTIES);
    SchemaStatus status = schemaEnum(entry, HugeKeys.STATUS, SchemaStatus.class);
    PropertyKey propertyKey = new PropertyKey(graph, this.toId(id), name);
    propertyKey.dataType(dataType);
    propertyKey.cardinality(cardinality);
    propertyKey.aggregateType(aggregateType);
    propertyKey.writeType(writeType);
    propertyKey.properties(this.toIdArray(properties));
    propertyKey.status(status);
    this.readUserdata(propertyKey, entry);
    return propertyKey;
}
Also used : Cardinality(com.baidu.hugegraph.type.define.Cardinality) WriteType(com.baidu.hugegraph.type.define.WriteType) DataType(com.baidu.hugegraph.type.define.DataType) AggregateType(com.baidu.hugegraph.type.define.AggregateType) SchemaStatus(com.baidu.hugegraph.type.define.SchemaStatus) PropertyKey(com.baidu.hugegraph.schema.PropertyKey)

Example 4 with SchemaStatus

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

the class TableSerializer method readIndexLabel.

@Override
public IndexLabel readIndexLabel(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);
    HugeType baseType = schemaEnum(entry, HugeKeys.BASE_TYPE, HugeType.class);
    Number baseValueId = schemaColumn(entry, HugeKeys.BASE_VALUE);
    IndexType indexType = schemaEnum(entry, HugeKeys.INDEX_TYPE, IndexType.class);
    Object indexFields = schemaColumn(entry, HugeKeys.FIELDS);
    SchemaStatus status = schemaEnum(entry, HugeKeys.STATUS, SchemaStatus.class);
    IndexLabel indexLabel = new IndexLabel(graph, this.toId(id), name);
    indexLabel.baseType(baseType);
    indexLabel.baseValue(this.toId(baseValueId));
    indexLabel.indexType(indexType);
    indexLabel.indexFields(this.toIdArray(indexFields));
    indexLabel.status(status);
    this.readUserdata(indexLabel, entry);
    return indexLabel;
}
Also used : IndexLabel(com.baidu.hugegraph.schema.IndexLabel) IndexType(com.baidu.hugegraph.type.define.IndexType) HugeType(com.baidu.hugegraph.type.HugeType) SchemaStatus(com.baidu.hugegraph.type.define.SchemaStatus)

Aggregations

SchemaStatus (com.baidu.hugegraph.type.define.SchemaStatus)4 EdgeLabel (com.baidu.hugegraph.schema.EdgeLabel)1 IndexLabel (com.baidu.hugegraph.schema.IndexLabel)1 PropertyKey (com.baidu.hugegraph.schema.PropertyKey)1 VertexLabel (com.baidu.hugegraph.schema.VertexLabel)1 HugeType (com.baidu.hugegraph.type.HugeType)1 AggregateType (com.baidu.hugegraph.type.define.AggregateType)1 Cardinality (com.baidu.hugegraph.type.define.Cardinality)1 DataType (com.baidu.hugegraph.type.define.DataType)1 Frequency (com.baidu.hugegraph.type.define.Frequency)1 IdStrategy (com.baidu.hugegraph.type.define.IdStrategy)1 IndexType (com.baidu.hugegraph.type.define.IndexType)1 WriteType (com.baidu.hugegraph.type.define.WriteType)1