Deze pagina is nog niet beschikbaar in uw eigen taal. We werken er hard aan om meer taalversies toe te voegen. Bedankt voor uw steun.

On this page

Show all

Help Center/ Graph Engine Service/ devg/ Using the Service Plane SDK/ Updating Edge Properties in Batches

Updating Edge Properties in Batches

Updated on 2022-09-14 GMT+08:00
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);    
}
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback