com.alibaba.graphscope.groot.sdk.schema.Vertex Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of groot-client Show documentation
Show all versions of groot-client Show documentation
The Java client of Groot, a persistence storage engine
package com.alibaba.graphscope.groot.sdk.schema;
import com.alibaba.graphscope.proto.groot.DataRecordPb;
import com.alibaba.graphscope.proto.groot.VertexRecordKeyPb;
import com.alibaba.graphscope.proto.groot.WriteRequestPb;
import com.alibaba.graphscope.proto.groot.WriteTypePb;
import java.util.Map;
public class Vertex {
public String label;
public Map properties;
public Vertex(String label) {
this(label, null);
}
public Vertex(String label, Map properties) {
this.label = label;
this.properties = properties;
}
public String getLabel() {
return label;
}
public Map getProperties() {
return properties;
}
public VertexRecordKeyPb toVertexRecordKey(String label) {
VertexRecordKeyPb.Builder builder = VertexRecordKeyPb.newBuilder().setLabel(label);
// builder.putAllPkProperties(properties);
return builder.build();
}
public DataRecordPb toDataRecord() {
DataRecordPb.Builder builder =
DataRecordPb.newBuilder().setVertexRecordKey(toVertexRecordKey(label));
if (properties != null) {
builder.putAllProperties(properties);
}
return builder.build();
}
public WriteRequestPb toWriteRequest(WriteTypePb writeType) {
return WriteRequestPb.newBuilder()
.setWriteType(writeType)
.setDataRecord(toDataRecord())
.build();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy