Class LiteralImpl

    • Constructor Detail

      • LiteralImpl

        LiteralImpl​(org.eclipse.rdf4j.model.Literal literal)
    • Method Detail

      • lowerCase

        private static java.lang.String lowerCase​(java.lang.String langTag)
      • getLanguageTag

        public java.util.Optional<java.lang.String> getLanguageTag()
        Description copied from interface: Literal
        If and only if the datatype IRI is http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, the language tag for this Literal is a non-empty language tag as defined by BCP47.
        If the datatype IRI is not http://www.w3.org/1999/02/22-rdf-syntax-ns#langString, this method must return Optional.empty().

        The value space of language tags is always in lower case; although RDF implementations MAY convert all language tags to lower case, safe comparisons of language tags should be done using String.toLowerCase(Locale) with the locale Locale.ROOT.

        Implementation note: If your application requires Serializable objects, it is best not to store an Optional in a field. It is recommended to use Optional.ofNullable(Object) to create the return value for this method.

        Specified by:
        getLanguageTag in interface Literal
        Returns:
        The Optional language tag for this literal. If Optional.isPresent() returns true, the value returned by Optional.get() must be a non-empty language tag string conforming to BCP47.
        See Also:
        RDF-1.1 Literal language tag
      • hashCode

        public int hashCode()
        Description copied from interface: RDFTerm
        Calculate a hash code for this RDFTerm.

        As an RDFTerm is immutable, this method will always return the same hashCode over the lifetime of this object.

        This method MUST be implemented in conjunction with RDFTerm.equals(Object) so that two equal RDFTerm produce the same hash code.

        Specified by:
        hashCode in interface Literal
        Specified by:
        hashCode in interface RDFTerm
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        a hash code value for this RDFTerm.
        See Also:
        IRI.hashCode(), Literal.hashCode(), BlankNode.hashCode()
      • ntriplesString

        public java.lang.String ntriplesString()
        Description copied from interface: RDFTerm
        Return the term serialised as specified by the RDF-1.1 N-Triples Canonical form.
        Specified by:
        ntriplesString in interface RDFTerm
        Returns:
        The term serialised as RDF-1.1 N-Triples.
        See Also:
        RDF-1.1 N-Triples Canonical form
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object