Interface RdfLiteral

  • All Superinterfaces:
    RdfTerm
    All Known Implementing Classes:
    LangString, Literal

    public interface RdfLiteral
    extends RdfTerm
    The RdfLiteral interface represents an immutable RDF literal.

    RDF literals are values in the RDF data model that can have an optional language tag and/or datatype. They are often used to represent strings, numbers, dates, or other literal values in RDF.

    • Method Detail

      • lexicalValue

        java.lang.String lexicalValue()
        Returns the lexical value of the literal.

        The lexical value is the actual content or value of the literal as a string.

        Returns:
        the lexical value of the literal, never null
      • datatype

        java.lang.String datatype()
        Returns the absolute IRI denoting the datatype of the literal.
        Returns:
        the datatype IRI of the literal, never null
      • language

        java.util.Optional<java.lang.String> language()
        Returns an optional language tag associated with the literal.

        If the literal is a language-tagged string (e.g. rdf:langString), this method returns the language tag; otherwise, it returns Optional.empty().

        Returns:
        an Optional containing the language tag if present, or Optional.empty() if not set
      • direction

        java.util.Optional<RdfLiteral.Direction> direction()
        Returns the direction of the literal, which can be either left-to-right (LTR) or right-to-left (RTL).
        Returns:
        an Optional containing the direction if present, or Optional.empty() if not set
      • isLiteral

        default boolean isLiteral()
        Description copied from interface: RdfTerm
        Indicates whether this term is an RDF literal.
        Specified by:
        isLiteral in interface RdfTerm
        Returns:
        true if the term is an RdfLiteral; false otherwise.