Search in sources :

Example 1 with WriteRequestPb

use of com.alibaba.graphscope.proto.write.WriteRequestPb in project GraphScope by alibaba.

the class MaxGraphClient method addEdge.

public void addEdge(String label, String srcLabel, String dstLabel, Map<String, String> srcPk, Map<String, String> dstPk, Map<String, String> properties) {
    VertexRecordKey srcVertexKey = new VertexRecordKey(srcLabel, Collections.unmodifiableMap(srcPk));
    VertexRecordKey dstVertexKey = new VertexRecordKey(dstLabel, Collections.unmodifiableMap(dstPk));
    EdgeRecordKey edgeRecordKey = new EdgeRecordKey(label, srcVertexKey, dstVertexKey);
    WriteRequestPb writeRequest = WriteRequestPb.newBuilder().setWriteType(WriteTypePb.INSERT).setDataRecord(DataRecordPb.newBuilder().setEdgeRecordKey(edgeRecordKey.toProto()).putAllProperties(properties).build()).build();
    this.batchWriteBuilder.addWriteRequests(writeRequest);
}
Also used : VertexRecordKey(com.alibaba.maxgraph.sdkcommon.common.VertexRecordKey) EdgeRecordKey(com.alibaba.maxgraph.sdkcommon.common.EdgeRecordKey) WriteRequestPb(com.alibaba.graphscope.proto.write.WriteRequestPb)

Example 2 with WriteRequestPb

use of com.alibaba.graphscope.proto.write.WriteRequestPb in project GraphScope by alibaba.

the class MaxGraphClient method addVertex.

public void addVertex(String label, Map<String, String> properties) {
    VertexRecordKey vertexRecordKey = new VertexRecordKey(label);
    WriteRequestPb writeRequest = WriteRequestPb.newBuilder().setWriteType(WriteTypePb.INSERT).setDataRecord(DataRecordPb.newBuilder().setVertexRecordKey(vertexRecordKey.toProto()).putAllProperties(properties).build()).build();
    this.batchWriteBuilder.addWriteRequests(writeRequest);
}
Also used : VertexRecordKey(com.alibaba.maxgraph.sdkcommon.common.VertexRecordKey) WriteRequestPb(com.alibaba.graphscope.proto.write.WriteRequestPb)

Aggregations

WriteRequestPb (com.alibaba.graphscope.proto.write.WriteRequestPb)2 VertexRecordKey (com.alibaba.maxgraph.sdkcommon.common.VertexRecordKey)2 EdgeRecordKey (com.alibaba.maxgraph.sdkcommon.common.EdgeRecordKey)1