Class Ivoid

java.lang.Object
uk.ac.starlink.vo.Ivoid

public class Ivoid extends Object
Represents an IVO Identifier.

For most purposes these are strings, but case handling during comparison needs some care. The relevant text in Section 2.1 of the IVOA Identifiers standard reads:

"The Registry references are, as a whole, compared case-insensitively, and must be treated case-insensitively throughout to maintain backwards compatibility with version 1 of this specification. When comparing full IVOIDs, the local part must be split off and compared preserving case, while the registry part must be compared case-insensitively."

The form of an IVOID is:

    ivo://<authority><path>[?<query>][#<fragment>]
 
where ivo://<authority><path> is known as the "registry part" and [?<query>][#<fragment>] is the "local part".

Invalid Ivoids can still be used and compared; if the text supplied at construction time does not conform to the IVO ID syntax, the registry and local parts will be null, and the equality semantics will simply be that of (case-sensitive) strings.

Since:
4 Jul 2023
Author:
Mark Taylor
See Also:
  • Constructor Details

    • Ivoid

      public Ivoid(String txt)
      Constructor. Construction will always succeed, but a valid IVO ID will have a registry part beginning "ivo://...".
      Parameters:
      txt - textual representation of IVOID
  • Method Details

    • getRegistryPart

      public String getRegistryPart()
      Returns the registry part of this IVOID. This will begin "ivo://..." for a valid IVOID, and be null otherwise.
      Returns:
      registry part, may be null for invalid IVOID text
    • getLocalPart

      public String getLocalPart()
      Returns the local part of this IVOID. This may be empty if no local part is present, or null in the case of an invalid IVOID. If present and non-empty the first character will be "#" or "?".
      Returns:
      local part, may be null for invalid IVOID text, or may be the empty string for no local part
    • matchesRegistryPart

      public boolean matchesRegistryPart(String regPart)
      Indicates whether the registry part of this Ivoid is equivalent to a supplied textual representation of another registry part.
      Parameters:
      regPart - textual representation of registry part of an IVO ID
      Returns:
      true iff this ivoid's registry part is equivalent
    • isValid

      public boolean isValid()
      Indicates whether the string represented by this Ivoid object is a valid IVO ID. The test is more or less that it starts "ivo://...", and is equivalent to testing whether getRegistryPart() returns a non-null value.
      Returns:
      true iff this object represents a valid IVO ID
    • toRegtapString

      public String toRegtapString()
      Returns the normalised form of this ivoid suitable for use (for instance ADQL equality matching) in the context of the Relational Registry. See RegTAP 1.1, section 4.3.
      Returns:
      lower-cased verson of valid IVO ID, or exact invalid text
      See Also:
    • equalsIvoid

      public boolean equalsIvoid(Ivoid other)
      Typed version of equals(java.lang.Object) method.
      Returns:
      true iff other is equivalent to this
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object