更新时间:2022-06-30 GMT+08:00
批量更新点属性
您可以使用GES提供的接口批量更新点属性。示例代码如下:
public static void updateBatchVertice(GraphClient graphClient) throws ApiException { // 构造单个点属性信息 Map<String, List<Object>> properties = new HashMap<>(); properties.put("年龄", Arrays.asList(20)); AddVertexReq vertex = new AddVertexReq(); vertex.setVertexId("张三1"); vertex.setProperties(properties); Map<String, List<Object>> listProperties = new HashMap<>(); listProperties.put("名称", Arrays.asList("测试","数学")); AddVertexReq vertexWithListProperty = new AddVertexReq(); vertexWithListProperty.setVertexId("张三0"); vertexWithListProperty.setProperties(listProperties); Map<String, List<Object>> setProperties = new HashMap<>(); setProperties.put("name", Arrays.asList("a","d")); AddVertexReq vertexWithSetProperty = new AddVertexReq(); vertexWithSetProperty.setVertexId("张三140"); vertexWithSetProperty.setProperties(setProperties); // 组成批量点属性信息 List<AddVertexReq> vertices = new ArrayList<>(); vertices.add(vertex); vertices.add(vertexWithListProperty); vertices.add(vertexWithSetProperty); // 构造更新批量点属性请求 AddBatchVertexReq updateBatchVertexReq = new AddBatchVertexReq(); updateBatchVertexReq.setVertices(vertices); // 执行更新批量点属性请求 Map<String, Object> result = graphClient.updateBatchVertex("batch-update", updateBatchVertexReq); }
父主题: 使用业务面SDK