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;
}
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;
}
Aggregations