Class AbstractLiteral.TemporalAmountLiteral

java.lang.Object
org.eclipse.rdf4j.model.base.AbstractLiteral
org.eclipse.rdf4j.model.base.AbstractLiteral.TemporalAmountLiteral
All Implemented Interfaces:
Serializable, Literal, Value
Enclosing class:
AbstractLiteral

static class AbstractLiteral.TemporalAmountLiteral extends AbstractLiteral
  • Field Details

  • Constructor Details

  • Method Details

    • parseTemporalAmount

      static TemporalAmount parseTemporalAmount(CharSequence label)
    • toString

      private static String toString(TemporalAmount value)
    • getLabel

      public String getLabel()
      Description copied from interface: Literal
      Gets the label (the lexical value) of this literal.
      Returns:
      The literal's label.
    • getLanguage

      public Optional<String> getLanguage()
      Description copied from interface: Literal
      Gets the language tag for this literal, normalized to lower case.
      Returns:
      The language tag for this literal, or Optional.empty() if it doesn't have one.
    • getDatatype

      public IRI getDatatype()
      Description copied from interface: Literal
      Gets the datatype for this literal.

      If Literal.getLanguage() returns a non-empty value than this must return rdf:langString. If no datatype was assigned to this literal by the creator, then this method must return xsd:string.

      Returns:
      The datatype for this literal.
    • temporalAmountValue

      public TemporalAmount temporalAmountValue() throws DateTimeException
      Description copied from interface: Literal
      Retrieves the temporal amount value of this literal.

      A temporal amount representation can be given for literals whose label conforms to the syntax of the XML Schema 2 xsd:duration datatype.

      The adoption of the XML Schema 2 definition is a known deviation from the RDF 1.1 standard; well-formedness rules are relaxed to consider all duration components as optional and freely mixable.

      Temporal amount representations may be converted to specific java.time values like Duration using target static factory methods, for instance Duration.from(literal.temporalAmountValue()).

      Note however that java.time doesn't include dedicated classes for legal XML Schema duration values including both date and time components (for instance, P1YT23H).

      Specified by:
      temporalAmountValue in interface Literal
      Overrides:
      temporalAmountValue in class AbstractLiteral
      Returns:
      the temporal amount value of this literal
      Throws:
      DateTimeException - if this literal cannot be represented by a TemporalAmount value
      See Also:
    • getCoreDatatype

      public CoreDatatype.XSD getCoreDatatype()
      Description copied from interface: Literal
      CoreDatatype is an interface for natively supported datatypes in RDF4J. This includes, among others, the XML Schema datatypes and rdf:langString. CoreDatatypes are implemented as enums and more performant and convenient to work with than IRI-based datatypes. The constant
      invalid @link
      {@link CoreDatatype#NONE)
      } is used to represent a datatype that is not one of the supported core datatypes.
      Returns:
      The CoreDatatype or
      invalid @link
      {@link CoreDatatype#NONE)
      } if the datatype matches none of the core datatypes. This method will not return null.