Interface DatatypeHandler

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean isRecognizedDatatype​(IRI datatypeUri)
      Checks if the given datatype IRI is recognized by this `DatatypeHandler`.
      java.lang.String key()
      A unique key for this datatype handler to identify it in the
      default Literal normalizeDatatype​(java.lang.String theValue, Datatype theDatatype)
      Normalize both the datatype and the literal value if appropriate, and generate a literal with the provided value and datatype.
      boolean verifyDatatype​(java.lang.String theValue, Datatype theDatatype)
      Verifies that the datatype is valid, including a check on the structure of the literal value.
    • Method Detail

      • verifyDatatype

        boolean verifyDatatype​(@Nonnull
                               java.lang.String theValue,
                               @Nonnull
                               Datatype theDatatype)
        Verifies that the datatype is valid, including a check on the structure of the literal value.

        This method must only be called after verifying that isRecognizedDatatype(IRI) returns true for the given datatype URI.

        Parameters:
        theValue - Literal value matching the given datatype URI.
        theDatatype - A datatype that matched with isRecognizedDatatype(IRI)
        Returns:
        True if the datatype URI is recognized by this datatype handler, and it is verified to be syntactically valid. An implementation may throw InvalidLiteral exception if the datatype is not recognized
      • normalizeDatatype

        default Literal normalizeDatatype​(@Nonnull
                                          java.lang.String theValue,
                                          @Nonnull
                                          Datatype theDatatype)
        Normalize both the datatype and the literal value if appropriate, and generate a literal with the provided value and datatype. This method must only be called after verifying that isRecognizedDatatype(IRI) returns true for the given datatype URI, and verifyDatatype(String, Datatype) also returns true for the given datatype and literal value.
        Parameters:
        theValue - Required literal value to use in the normalization process and to provide the value for the resulting literal.
        theDatatype - The datatype which is to be normalized. It is available in normalized form from the result using Literal.datatype().
        Returns:
        A Literal containing the normalized literal value and datatype URI. An implementation may throw InvalidLiteral exception if the datatype is not recognized or cannot be normalized for any reason, e.g. its value is not legal for its datatype.
      • key

        java.lang.String key()
        A unique key for this datatype handler to identify it in the
        Returns:
        A unique string key.