Search in sources :

Example 1 with HugeVertexFeatures

use of com.baidu.hugegraph.structure.HugeFeatures.HugeVertexFeatures in project incubator-hugegraph by apache.

the class GraphTransaction method checkVertexLabel.

private VertexLabel checkVertexLabel(Object label, boolean verifyLabel) {
    HugeVertexFeatures features = graph().features().vertex();
    // Check Vertex label
    if (label == null && features.supportsDefaultLabel()) {
        label = features.defaultLabel();
    }
    if (label == null) {
        throw Element.Exceptions.labelCanNotBeNull();
    }
    E.checkArgument(label instanceof String || label instanceof VertexLabel, "Expect a string or a VertexLabel object " + "as the vertex label argument, but got: '%s'", label);
    // The label must be an instance of String or VertexLabel
    if (label instanceof String) {
        if (verifyLabel) {
            ElementHelper.validateLabel((String) label);
        }
        label = graph().vertexLabel((String) label);
    }
    assert (label instanceof VertexLabel);
    return (VertexLabel) label;
}
Also used : VertexLabel(com.baidu.hugegraph.schema.VertexLabel) HugeVertexFeatures(com.baidu.hugegraph.structure.HugeFeatures.HugeVertexFeatures)

Aggregations

VertexLabel (com.baidu.hugegraph.schema.VertexLabel)1 HugeVertexFeatures (com.baidu.hugegraph.structure.HugeFeatures.HugeVertexFeatures)1