Class LiteralLabel

java.lang.Object
org.apache.jena.graph.impl.LiteralLabel

public final class LiteralLabel extends Object
Represents the "contents" of a Node_Literal. These contents comprise a lexical form, an optional language tag, and optional datatype structure and a value.

Create via LiteralLabelFactory which does the checking and adjustments.

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
    Answer true iff this literal is syntactically equal to other.
    Answer the datatype of this literal, null if it is untyped.
    Answer the datatype URI of this literal, null if it untyped.
    Answer an object used to index this literal.
    Answer the lexical form of this literal.
    Answer a suitable instance of a Java class representing this literal's value.
    int
    Answer the default hash value, suitable for datatypes which have values which support hashCode() naturally: it is derived from its value if it is well-formed and otherwise from its lexical form.
    int
    Answer the hashcode of this literal, derived from its value if it's well-formed and otherwise its lexical form.
    Answer the initial text direction associated with this literal (the empty string if there's no text direction).
    boolean
    Answer true iff this is a well-formed literal (the lexical form conforms to the datatype).
    Answer the language associated with this literal (the empty string if there's no language).
    boolean
    Answer true iff this literal represents the same (abstract) value as the other one.
     
    toString(boolean quoting)
     
    toString(PrefixMapping pmap, boolean quoting)
     

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • isWellFormed

      public boolean isWellFormed()
      Answer true iff this is a well-formed literal (the lexical form conforms to the datatype). String literals (xsd:string, rdf:LangString,m rdf:dirLangString) are always well-formed.
    • toString

      public String toString(boolean quoting)
    • toString

      public String toString(PrefixMapping pmap, boolean quoting)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLexicalForm

      public String getLexicalForm()
      Answer the lexical form of this literal.
    • getIndexingValue

      public Object getIndexingValue()
      Answer an object used to index this literal. This object must provide Object.equals(java.lang.Object) and Object.hashCode() based on values, not object instance identity.
    • language

      public String language()
      Answer the language associated with this literal (the empty string if there's no language).
    • initialTextDirection

      public TextDirection initialTextDirection()
      Answer the initial text direction associated with this literal (the empty string if there's no text direction).
    • getValue

      public Object getValue() throws DatatypeFormatException
      Answer a suitable instance of a Java class representing this literal's value. May throw an exception if the literal is ill-formed.
      Throws:
      DatatypeFormatException
    • getDatatype

      public RDFDatatype getDatatype()
      Answer the datatype of this literal, null if it is untyped.
    • getDatatypeURI

      public String getDatatypeURI()
      Answer the datatype URI of this literal, null if it untyped.
    • equals

      public boolean equals(Object other)
      Answer true iff this literal is syntactically equal to other. Note: this is not sameValueAs.
      Overrides:
      equals in class Object
    • sameValueAs

      public boolean sameValueAs(LiteralLabel other)
      Answer true iff this literal represents the same (abstract) value as the other one.
    • hashCode

      public int hashCode()
      Answer the hashcode of this literal, derived from its value if it's well-formed and otherwise its lexical form.
      Overrides:
      hashCode in class Object
    • getValueHashCode

      public int getValueHashCode()
      Answer the default hash value, suitable for datatypes which have values which support hashCode() naturally: it is derived from its value if it is well-formed and otherwise from its lexical form.