Enum Class Version

java.lang.Object
java.lang.Enum<Version>
org.incenp.obofoundry.sssom.model.Version
All Implemented Interfaces:
Serializable, Comparable<Version>, Constable

public enum Version extends Enum<Version>
Represents a version of the SSSOM specification.
  • Enum Constant Details

    • SSSOM_1_0

      public static final Version SSSOM_1_0
      SSSOM specification version 1.0.
    • SSSOM_1_1

      public static final Version SSSOM_1_1
      SSSOM specification version 1.1.
    • UNKNOWN

      public static final Version UNKNOWN
      Represents an unrecognised version of the specification (possibly, a version more recent than the latest supported by this implementation).
  • Field Details

    • LATEST

      public static final Version LATEST
      The latest version of the specification currently supported by this implementation.
  • Method Details

    • values

      public static Version[] 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 Version 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
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Version>
    • getIRI

      public String getIRI()
      Gets the IRI associated to the enum value.
      Returns:
      The IRI used to represent the enum value.
    • isCompatibleWith

      public boolean isCompatibleWith(Version target)
      Checks whether this version is compatible with the indicated version.

      For the purpose of this method, a version A is said to be compatible with another version B if an implementation compliant with B can accept data compliant with A. This is case iff: (1) both A and B have the same major version number, and (2) A’s minor version number is at most as high as B’s.

      For example, version 1.0 is compatible with version 1.1; version 1.2 is not compatible with version 1.1.

      Parameters:
      target - The version to compare to.
      Returns:
      True if this version is compatible with the target version, false otherwise.
    • enforceCompliance

      public void enforceCompliance(MappingSet ms)
      Ensures the provided mapping set is compatible with this version.

      Any slot or slot value that requires a higher version will be forcibly removed from the set.

      Parameters:
      ms - The set that must be made compliant with this version of the specification.
    • isCompliant

      public boolean isCompliant(MappingSet ms)
      Checks that the given mapping set is compatible with this version.
      Parameters:
      ms - The set whose compliance must be checked.
      Returns:
      true if the set is compatible with this version, or false if it requires a higher version.
    • getCompliantVersion

      public static Version getCompliantVersion(MappingSet ms)
      Gets the minimum version of the SSSOM specification that the given set is compliant with.
      Parameters:
      ms - The set whose compliance is to be checked.
      Returns:
      The earliest version of the SSSOM specification that defines all slots and values required by the set.
    • getHighestVersion

      public static Version getHighestVersion(Collection<Version> versions)
      Gets the most recent version of all the versions in the given collection.
      Parameters:
      versions - A collection of versions.
      Returns:
      The most recent version, or SSSOM_1_0 if the collection is empty.
    • fromString

      public static Version fromString(String v)
      Parses a string into the corresponding SSSOM version object.
      Parameters:
      v - The string to parse.
      Returns:
      The corresponding version, or UNKNOWN if the string does not match any recognised version.
    • fromIRI

      public static Version fromIRI(String iri)
      Parses an IRI into the corresponding SSSOM version object.
      Parameters:
      iri - The IRI to parse.
      Returns:
      The corresponding version, or UNKNOWN if the IRI does not match any recognised version.