Enum Class LabelCardinality

java.lang.Object
java.lang.Enum<LabelCardinality>
org.apache.tinkerpop.gremlin.structure.LabelCardinality
All Implemented Interfaces:
Serializable, Comparable<LabelCardinality>, Constable

public enum LabelCardinality extends Enum<LabelCardinality>
Defines the label cardinality for graph elements. Each value declares its multiplicity constraints via min() and max(), and whether mutation is permitted via supportsMutation().

Providers declare their supported cardinality via Graph.Features. Validation of label operations against these constraints is handled by LabelCardinalityValidator.

Since:
4.0.0
  • Enum Constant Details

    • ONE

      public static final LabelCardinality ONE
      Exactly one label, immutable. All mutation operations throw. This is the default for TinkerGraph and provides backward compatibility with TinkerPop 3.x.
    • ONE_OR_MORE

      public static final LabelCardinality ONE_OR_MORE
      One or more labels. The element must always have at least one label. dropLabels() always throws. dropLabel(x) succeeds only if at least one label remains.
    • ZERO_OR_MORE

      public static final LabelCardinality ZERO_OR_MORE
      Zero or more labels, fully flexible. No constraints on the number of labels. Elements can have any number of labels including zero.
  • Method Details

    • values

      public static LabelCardinality[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LabelCardinality valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • min

      public int min()
      The minimum number of labels an element must have under this cardinality.
    • max

      public int max()
      The maximum number of labels an element may have under this cardinality.
    • supportsMultiLabel

      public boolean supportsMultiLabel()
      Whether this cardinality allows multiple labels on an element simultaneously.
    • supportsZeroLabels

      public boolean supportsZeroLabels()
      Whether this cardinality allows an element to have zero labels.
    • supportsMutation

      public boolean supportsMutation()
      Whether this cardinality allows label mutation (addLabel/dropLabel).