use of com.alibaba.graphscope.groot.schema.mapper.DefaultGraphSchema in project GraphScope by alibaba.
the class GraphSchemaMapper method toGraphSchema.
public GraphSchema toGraphSchema() {
DefaultGraphSchema graphSchema = new DefaultGraphSchema();
Map<String, GraphVertex> vertexTypeMap = Maps.newHashMap();
for (SchemaElementMapper elementMapper : this.types) {
if (elementMapper instanceof VertexTypeMapper) {
GraphVertex graphVertex = ((VertexTypeMapper) elementMapper).toVertexType();
graphSchema.createVertexType(graphVertex);
vertexTypeMap.put(graphVertex.getLabel(), graphVertex);
}
}
for (SchemaElementMapper elementMapper : this.types) {
if (elementMapper instanceof EdgeTypeMapper) {
GraphEdge graphEdge = ((EdgeTypeMapper) elementMapper).toEdgeType(vertexTypeMap);
graphSchema.createEdgeType(graphEdge);
}
}
return graphSchema;
}
Aggregations