Interface IRI

All Superinterfaces:
Resource, Serializable, Value
All Known Implementing Classes:
AbstractIRI, CorruptIRI, CorruptIRIOrBNode, InternedIRI, LmdbIRI, MemIRI, NativeIRI, SimpleIRI

public interface IRI extends Resource
An Internationalized Resource Identifier (IRI). IRIs may contain characters from the Universal Character Set (Unicode/ISO 10646), including Chinese or Japanese kanji, Korean, Cyrillic characters, and so forth. It is defined by RFC 3987.

An IRI can be split into a namespace part and a local name part, which are derived from an IRI string by splitting it in two using the following algorithm:

  • Split after the first occurrence of the '#' character,
  • If this fails, split after the last occurrence of the '/' character,
  • If this fails, split after the last occurrence of the ':' character.
The last step should never fail as every legal (full) IRI contains at least one ':' character to separate the scheme from the rest of the IRI. The implementation should check this upon object creation.
Author:
Jeen Broekstra
See Also:
  • Method Details

    • isIRI

      default boolean isIRI()
      Description copied from interface: Value
      Check if the object is an instance of the given type. Typically 2x than using instanceof.

      For implementers: This default implementation is overridden in the repsective sub-interface.

      Specified by:
      isIRI in interface Value
      Returns:
      true if instance of IRI
    • getType

      default Value.Type getType()
      Specified by:
      getType in interface Value
    • getNamespace

      String getNamespace()
      Gets the namespace part of this IRI.

      The namespace is defined as per the algorithm described in the class documentation.

      Returns:
      the namespace of this IRI
    • getLocalName

      String getLocalName()
      Gets the local name part of this IRI.

      The local name is defined as per the algorithm described in the class documentation.

      Returns:
      the local name of this IRI
    • equals

      boolean equals(Object o)
      Compares this IRI to another object.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare this IRI to
      Returns:
      true, if the other object is an instance of IRI and their string values are equal; false, otherwise
    • hashCode

      int hashCode()
      Computes the hash code of this IRI.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code for this IRI computed as Value.stringValue().hashCode()