Search in sources :

Example 11 with GraphProperty

use of com.alibaba.maxgraph.compiler.api.schema.GraphProperty 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)11 EdgeRelation (com.alibaba.maxgraph.compiler.api.schema.EdgeRelation)3 GraphVertex (com.alibaba.maxgraph.compiler.api.schema.GraphVertex)3 GraphElement (com.alibaba.maxgraph.compiler.api.schema.GraphElement)2 PrimaryKeyConstraint (com.alibaba.maxgraph.compiler.api.schema.PrimaryKeyConstraint)2 PropertyValue (com.alibaba.maxgraph.sdkcommon.schema.PropertyValue)2 HashMap (java.util.HashMap)2 JSONArray (com.alibaba.fastjson.JSONArray)1 JSONObject (com.alibaba.fastjson.JSONObject)1 PropertyDefNotFoundException (com.alibaba.maxgraph.compiler.api.exception.PropertyDefNotFoundException)1 DataType (com.alibaba.maxgraph.compiler.api.schema.DataType)1 GraphEdge (com.alibaba.maxgraph.compiler.api.schema.GraphEdge)1 GraphSchema (com.alibaba.maxgraph.compiler.api.schema.GraphSchema)1 LogicalSourceVertex (com.alibaba.maxgraph.compiler.logical.LogicalSourceVertex)1 LogicalSubQueryPlan (com.alibaba.maxgraph.compiler.logical.LogicalSubQueryPlan)1 VertexIdManager (com.alibaba.maxgraph.compiler.logical.VertexIdManager)1 ProcessorSourceFunction (com.alibaba.maxgraph.compiler.logical.function.ProcessorSourceFunction)1 TreeNodeLabelManager (com.alibaba.maxgraph.compiler.tree.TreeNodeLabelManager)1 MaxGraphException (com.alibaba.maxgraph.sdkcommon.exception.MaxGraphException)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1