Class AbstractLiteral.TemporalAccessorLiteral

    • Field Detail

      • FIELDS

        private static final java.time.temporal.ChronoField[] FIELDS
      • LOCAL_TIME_FORMATTER

        private static final java.time.format.DateTimeFormatter LOCAL_TIME_FORMATTER
      • OFFSET_TIME_FORMATTER

        private static final java.time.format.DateTimeFormatter OFFSET_TIME_FORMATTER
      • LOCAL_DATE_FORMATTER

        private static final java.time.format.DateTimeFormatter LOCAL_DATE_FORMATTER
      • OFFSET_DATE_FORMATTER

        private static final java.time.format.DateTimeFormatter OFFSET_DATE_FORMATTER
      • DATETIME_FORMATTER

        private static final java.time.format.DateTimeFormatter DATETIME_FORMATTER
      • DASH_FORMATTER

        private static final java.time.format.DateTimeFormatter DASH_FORMATTER
      • DATATYPES

        private static final java.util.Map<java.lang.Integer,​CoreDatatype.XSD> DATATYPES
      • FORMATTERS

        private static final java.util.Map<CoreDatatype.XSD,​java.time.format.DateTimeFormatter> FORMATTERS
      • value

        private final java.time.temporal.TemporalAccessor value
      • label

        private final java.lang.String label
    • Constructor Detail

      • TemporalAccessorLiteral

        TemporalAccessorLiteral​(java.time.temporal.TemporalAccessor value)
    • Method Detail

      • parseTemporalAccessor

        static java.time.temporal.TemporalAccessor parseTemporalAccessor​(java.lang.String label)
                                                                  throws java.time.DateTimeException
        Throws:
        java.time.DateTimeException
      • datatypes

        private static java.util.Map<java.lang.Integer,​CoreDatatype.XSD> datatypes()
      • formatters

        private static java.util.Map<CoreDatatype.XSD,​java.time.format.DateTimeFormatter> formatters()
      • formatter

        private static java.time.format.DateTimeFormatter formatter​(java.lang.String label)
      • key

        private static int key​(java.time.temporal.TemporalAccessor value)
      • key

        private static int key​(java.time.temporal.ChronoField... fields)
      • key

        private static int key​(java.util.function.Predicate<java.time.temporal.ChronoField> include,
                               java.time.temporal.ChronoField... fields)
      • getLabel

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

        public java.util.Optional<java.lang.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.
      • temporalAccessorValue

        public java.time.temporal.TemporalAccessor temporalAccessorValue()
        Description copied from interface: Literal
        Retrieves the temporal accessor value of this literal.

        A temporal accessor representation can be given for literals whose label conforms to the syntax of the following XML Schema 1.1 date/time datatypes:

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

        Note however that java.time doesn't include dedicated classes for some legal XML Schema date/time values, like offset dates (for instance, 2020-11-16+01:00) and xsd:gDay (for instance, ---16).

        Specified by:
        temporalAccessorValue in interface Literal
        Overrides:
        temporalAccessorValue in class AbstractLiteral
        Returns:
        the temporal accessor value of this literal
        See Also:
        The Java™ Tutorials – Trail: Date Time
      • getCoreDatatype

        public CoreDatatype 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 {@link CoreDatatype#NONE)} is used to represent a datatype that is not one of the supported core datatypes.
        Returns:
        The CoreDatatype or {@link CoreDatatype#NONE)} if the datatype matches none of the core datatypes. This method will not return null.