Help Center/
Graph Engine Service/
devg/
Using the Service Plane SDK/
Updating Edge Properties in Batches
Updated on 2022-04-24 GMT+08:00
Updating Edge Properties in Batches
You can use a specific API provided by GES to update edge properties in batches. The sample code is as follows:
public static void updateBatchEdges(GraphClient graphClient) throws ApiException { // Construct the edge information. Do not specify the index. EdgeWithIndex edgeWithoutIndex = new EdgeWithIndex(); edgeWithoutIndex.setSource("46"); edgeWithoutIndex.setTarget("37"); edgeWithoutIndex.setLabel("rate"); Map<String, List<Object>> properties = new HashMap<>(); properties.put("Rating", Arrays.asList("5")); properties.put("Datetime", Arrays.asList("2020-01-0120:30:05")); edgeWithoutIndex.setProperties(properties); // Construct the edge information. Specify the index. EdgeWithIndex edgeWithIndex = new EdgeWithIndex(); edgeWithIndex.setSource("46"); edgeWithIndex.setTarget("38"); edgeWithIndex.setIndex("0"); edgeWithIndex.setProperties(properties); // Form the edge list. List<EdgeWithIndex> edges = new ArrayList<>(); edges.add(edgeWithoutIndex); edges.add(edgeWithIndex); // Construct a request for updating edge properties in batches. UpdateBatchEdgePropertyReq updateBatchEdgeReq = new UpdateBatchEdgePropertyReq(); updateBatchEdgeReq.setEdges(edges); // Execute the request for updating edge properties in batches. Map<String, Object> result = graphClient.updateBatchEdge("batch-update", updateBatchEdgeReq); }
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