Help Center/
Graph Engine Service/
devg/
Using the Service Plane SDK/
Updating Vertex Properties in Batches
Updated on 2022-04-24 GMT+08:00
Updating Vertex Properties in Batches
You can use a specific API provided by GES to update vertex properties in batches. The sample code is as follows:
public static void updateBatchVertice(GraphClient graphClient) throws ApiException { // Construct the information of a single vertex property. Map<String, List<Object>> properties = new HashMap<>(); properties.put("age", Arrays.asList(20)); AddVertexReq vertex = new AddVertexReq(); vertex.setVertexId("Zhang San1"); vertex.setProperties(properties); Map<String, List<Object>> listProperties = new HashMap<>(); listProperties.put("name", Arrays.asList("teat","mathematics")); AddVertexReq vertexWithListProperty = new AddVertexReq(); vertexWithListProperty.setVertexId("Zhang San0"); vertexWithListProperty.setProperties(listProperties); Map<String, List<Object>> setProperties = new HashMap<>(); setProperties.put("name", Arrays.asList("a","d")); AddVertexReq vertexWithSetProperty = new AddVertexReq(); vertexWithSetProperty.setVertexId("Zhang San140"); vertexWithSetProperty.setProperties(setProperties); // Form the information of a batch of vertex properties. List<AddVertexReq> vertices = new ArrayList<>(); vertices.add(vertex); vertices.add(vertexWithListProperty); vertices.add(vertexWithSetProperty); // Construct a request for updating vertex properties in batches. AddBatchVertexReq updateBatchVertexReq = new AddBatchVertexReq(); updateBatchVertexReq.setVertices(vertices); // Execute the request for updating vertex properties in batches. Map<String, Object> result = graphClient.updateBatchVertex("batch-update", updateBatchVertexReq); }
Parent topic: Using the Service Plane SDK
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot