Class Literal

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.lang.String datatype  
      (package private) java.lang.String lexicalValue  
    • Constructor Summary

      Constructors 
      Constructor Description
      Literal​(java.lang.String lexicalValue, java.lang.String datatype)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String datatype()
      Returns the absolute IRI denoting the datatype of the literal.
      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).
      boolean equals​(java.lang.Object obj)
      Compares this RDF term to the specified object.
      int hashCode()
      Returns a hash code value for this RDF term.
      java.util.Optional<java.lang.String> language()
      Returns an optional language tag associated with the literal.
      java.lang.String lexicalValue()
      Returns the lexical value of the literal.
      static Literal of​(java.lang.String lexicalValue, java.lang.String datatype)  
      java.lang.String toString()
      Returns a string representation of this RDF term.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • lexicalValue

        final java.lang.String lexicalValue
      • datatype

        final java.lang.String datatype
    • Constructor Detail

      • Literal

        Literal​(java.lang.String lexicalValue,
                java.lang.String datatype)
    • Method Detail

      • of

        public static Literal of​(java.lang.String lexicalValue,
                                 java.lang.String datatype)
      • lexicalValue

        public java.lang.String lexicalValue()
        Description copied from interface: RdfLiteral
        Returns the lexical value of the literal.

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

        Specified by:
        lexicalValue in interface RdfLiteral
        Returns:
        the lexical value of the literal, never null
      • datatype

        public java.lang.String datatype()
        Description copied from interface: RdfLiteral
        Returns the absolute IRI denoting the datatype of the literal.
        Specified by:
        datatype in interface RdfLiteral
        Returns:
        the datatype IRI of the literal, never null
      • language

        public java.util.Optional<java.lang.String> language()
        Description copied from interface: RdfLiteral
        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().

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

        public java.util.Optional<RdfLiteral.Direction> direction()
        Description copied from interface: RdfLiteral
        Returns the direction of the literal, which can be either left-to-right (LTR) or right-to-left (RTL).
        Specified by:
        direction in interface RdfLiteral
        Returns:
        an Optional containing the direction if present, or Optional.empty() if not set
      • hashCode

        public int hashCode()
        Description copied from interface: RdfTerm
        Returns a hash code value for this RDF term.
        Specified by:
        hashCode in interface RdfTerm
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code consistent with RdfTerm.equals(Object).
      • equals

        public boolean equals​(java.lang.Object obj)
        Description copied from interface: RdfTerm
        Compares this RDF term to the specified object. Implementations must override this method to provide equality checks appropriate to the term type.
        Specified by:
        equals in interface RdfTerm
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the object to compare with this term.
        Returns:
        true if the specified object is equal to this term; false otherwise.
      • toString

        public java.lang.String toString()
        Description copied from interface: RdfTerm
        Returns a string representation of this RDF term.
        Specified by:
        toString in interface RdfTerm
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string describing this RDF term.