use of com.baidu.hugegraph.schema.VertexLabel in project incubator-hugegraph by apache.
the class StandardHugeGraph method removeVertex.
@Override
public void removeVertex(String label, Object id) {
if (label != null) {
VertexLabel vl = this.vertexLabel(label);
// It's OK even if exist adjacent edges `vl.existsLinkLabel()`
if (!vl.existsIndexLabel()) {
// Improve perf by removeVertex(id)
Id idValue = HugeVertex.getIdValue(id);
HugeVertex vertex = new HugeVertex(this, idValue, vl);
this.removeVertex(vertex);
return;
}
}
this.vertex(id).remove();
}
use of com.baidu.hugegraph.schema.VertexLabel in project incubator-hugegraph by apache.
the class StandardHugeGraph method vertexLabel.
@Override
public VertexLabel vertexLabel(String name) {
VertexLabel vl = this.schemaTransaction().getVertexLabel(name);
E.checkArgument(vl != null, "Undefined vertex label: '%s'", name);
return vl;
}
use of com.baidu.hugegraph.schema.VertexLabel in project incubator-hugegraph by apache.
the class EntityManager method queryEntity.
private Iterator<Vertex> queryEntity(String label, Map<String, Object> conditions, long limit) {
ConditionQuery query = new ConditionQuery(HugeType.VERTEX);
VertexLabel vl = this.graph().vertexLabel(label);
query.eq(HugeKeys.LABEL, vl.id());
for (Map.Entry<String, Object> entry : conditions.entrySet()) {
PropertyKey pkey = this.graph().propertyKey(entry.getKey());
query.query(Condition.eq(pkey.id(), entry.getValue()));
}
query.showHidden(true);
if (limit != NO_LIMIT) {
query.limit(limit);
}
return this.tx().queryVertices(query);
}
use of com.baidu.hugegraph.schema.VertexLabel in project incubator-hugegraph by apache.
the class BinaryScatterSerializer method readVertex.
@Override
public HugeVertex readVertex(HugeGraph graph, BackendEntry bytesEntry) {
if (bytesEntry == null) {
return null;
}
BinaryBackendEntry entry = this.convertEntry(bytesEntry);
// Parse label
final byte[] VL = this.formatSyspropName(entry.id(), HugeKeys.LABEL);
BackendColumn vl = entry.column(VL);
VertexLabel vertexLabel = VertexLabel.NONE;
if (vl != null) {
Id labelId = BytesBuffer.wrap(vl.value).readId();
vertexLabel = graph.vertexLabelOrNone(labelId);
}
// Parse id
Id id = entry.id().origin();
HugeVertex vertex = new HugeVertex(graph, id, vertexLabel);
// Parse all properties and edges of a Vertex
for (BackendColumn col : entry.columns()) {
this.parseColumn(col, vertex);
}
return vertex;
}
use of com.baidu.hugegraph.schema.VertexLabel in project incubator-hugegraph by apache.
the class BinarySerializer method parseVertex.
protected void parseVertex(byte[] value, HugeVertex vertex) {
BytesBuffer buffer = BytesBuffer.wrap(value);
// Parse vertex label
VertexLabel label = vertex.graph().vertexLabelOrNone(buffer.readId());
vertex.correctVertexLabel(label);
// Parse properties
this.parseProperties(buffer, vertex);
// Parse vertex expired time if needed
if (vertex.hasTtl()) {
this.parseExpiredTime(buffer, vertex);
}
}
Aggregations