更新时间:2022-06-30 GMT+08:00

批量添加点

您可以使用GES提供的接口批量添加点。示例代码如下:
public static void addBatchVertice(GraphClient graphClient) throws ApiException 
{
    // 构造点属性列表
    Map<String, List<Object>> properties = new HashMap<>();
    properties.put("movieid", Arrays.asList("180"));
    properties.put("title", Arrays.asList("testmoive"));
    properties.put("genres", Arrays.asList("Comedy"));

    // 构造单个点信息
    AddVertexReq vertex = new AddVertexReq();
    vertex.setVertexId("180");
    vertex.setLabel("movie");
    vertex.setProperties(properties);

    // 组成批量点信息
    List<AddVertexReq> vertices = new ArrayList<>();
    vertices.add(vertex);

    // 构造添加批量点请求
    AddBatchVertexReq addBatchVertexReq = new AddBatchVertexReq();
    addBatchVertexReq.setVertices(vertices);

    // 执行添加批量点请求
    Map<String, Object> result = graphClient.addBatchVertex(addBatchVertexReq);
}