Search in sources :

Example 1 with PrimaryKeyConstraint

use of com.alibaba.maxgraph.compiler.api.schema.PrimaryKeyConstraint in project GraphScope by alibaba.

the class VertexTypeMapper method parseFromVertexType.

public static VertexTypeMapper parseFromVertexType(GraphVertex graphVertex) {
    VertexTypeMapper vertexTypeMapper = new VertexTypeMapper();
    vertexTypeMapper.setId(graphVertex.getLabelId());
    vertexTypeMapper.setLabel(graphVertex.getLabel());
    vertexTypeMapper.setType(TypeEnum.VERTEX.toString());
    PrimaryKeyConstraint primaryKeyConstraint = graphVertex.getPrimaryKeyConstraint();
    VertexIndexMapper vertexIndexMapper = new VertexIndexMapper();
    vertexIndexMapper.setName("primary_key");
    vertexIndexMapper.setIndexType("PRIMARY_KEY");
    vertexIndexMapper.setPropertyNames(primaryKeyConstraint.getPrimaryKeyList());
    vertexTypeMapper.setIndexes(Lists.newArrayList(vertexIndexMapper));
    List<GraphPropertyMapper> propertyMapperList = Lists.newArrayList();
    for (GraphProperty graphProperty : graphVertex.getPropertyList()) {
        propertyMapperList.add(GraphPropertyMapper.parseFromGrapyProperty(graphProperty));
    }
    vertexTypeMapper.setPropertyDefList(propertyMapperList);
    vertexTypeMapper.setVersionId(graphVertex.getVersionId());
    vertexTypeMapper.setTableId(graphVertex.getTableId());
    return vertexTypeMapper;
}
Also used : GraphProperty(com.alibaba.maxgraph.compiler.api.schema.GraphProperty) PrimaryKeyConstraint(com.alibaba.maxgraph.compiler.api.schema.PrimaryKeyConstraint)

Example 2 with PrimaryKeyConstraint

use of com.alibaba.maxgraph.compiler.api.schema.PrimaryKeyConstraint in project GraphScope by alibaba.

the class VertexTypeMapper method parseFromVertexType.

public static VertexTypeMapper parseFromVertexType(GraphVertex graphVertex) {
    VertexTypeMapper vertexTypeMapper = new VertexTypeMapper();
    vertexTypeMapper.setId(graphVertex.getLabelId());
    vertexTypeMapper.setLabel(graphVertex.getLabel());
    vertexTypeMapper.setType(TypeEnum.VERTEX.toString());
    PrimaryKeyConstraint primaryKeyConstraint = graphVertex.getPrimaryKeyConstraint();
    VertexIndexMapper vertexIndexMapper = new VertexIndexMapper();
    vertexIndexMapper.setName("primary_key");
    vertexIndexMapper.setIndexType("PRIMARY_KEY");
    vertexIndexMapper.setPropertyNames(primaryKeyConstraint.getPrimaryKeyList());
    vertexTypeMapper.setIndexes(Lists.newArrayList(vertexIndexMapper));
    List<GraphPropertyMapper> propertyMapperList = Lists.newArrayList();
    for (GraphProperty graphProperty : graphVertex.getPropertyList()) {
        propertyMapperList.add(GraphPropertyMapper.parseFromGrapyProperty(graphProperty));
    }
    vertexTypeMapper.setPropertyDefList(propertyMapperList);
    vertexTypeMapper.setVersionId(graphVertex.getVersionId());
    vertexTypeMapper.setTableId(graphVertex.getTableId());
    return vertexTypeMapper;
}
Also used : GraphProperty(com.alibaba.maxgraph.compiler.api.schema.GraphProperty) PrimaryKeyConstraint(com.alibaba.maxgraph.compiler.api.schema.PrimaryKeyConstraint)

Aggregations

GraphProperty (com.alibaba.maxgraph.compiler.api.schema.GraphProperty)2 PrimaryKeyConstraint (com.alibaba.maxgraph.compiler.api.schema.PrimaryKeyConstraint)2