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

Adding Edges in Batches

Updated on 2022-09-14 GMT+08:00
You can use a specific API provided by GES to add edges in batches. The sample code is as follows:
public static void addBatchEdges(GraphClient graphClient) throws ApiException 
{
    // Construct the edge information.
    Edge edge = new Edge();
    edge.setSource("46");
    edge.setTarget("38");
    edge.setLabel("rate");
    Map<String, List<Object>> properties = new HashMap<>();
    properties.put("Rating", Arrays.asList("5"));
    properties.put("Datetime", Arrays.asList("2018-01-0120:30:05"));
    edge.setProperties(properties);

    // Form the edge list.
    List<Edge> edges = new ArrayList<>();
    edges.add(edge);

    // The default option is to allow repetitive edges.
    ParallelEdgeOption parallelEdgeOption = new ParallelEdgeOption();

    // Construct a request for adding edges in batches.
    AddBatchEdgeReq addBatchEdgeReq = new AddBatchEdgeReq();
    addBatchEdgeReq.setEdges(edges);
    addBatchEdgeReq.setParallelEdge(parallelEdgeOption);

    // Execute the request for adding edges in batches.
    Map<String, Object> result = graphClient.addBatchEdge(addBatchEdgeReq);    
}
Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback