Class AbstractLiteral.TemporalAmountLiteral
- java.lang.Object
-
- org.eclipse.rdf4j.model.base.AbstractLiteral
-
- org.eclipse.rdf4j.model.base.AbstractLiteral.TemporalAmountLiteral
-
- Enclosing class:
- AbstractLiteral
static class AbstractLiteral.TemporalAmountLiteral extends AbstractLiteral
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.rdf4j.model.base.AbstractLiteral
AbstractLiteral.BooleanLiteral, AbstractLiteral.CalendarLiteral, AbstractLiteral.DecimalLiteral, AbstractLiteral.IntegerLiteral, AbstractLiteral.NumberLiteral, AbstractLiteral.TaggedLiteral, AbstractLiteral.TemporalAccessorLiteral, AbstractLiteral.TemporalAmountLiteral, AbstractLiteral.TypedLiteral
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
label
private static java.util.regex.Pattern
PATTERN
private static long
serialVersionUID
private static java.util.Collection<java.time.temporal.ChronoUnit>
UNITS
private java.time.temporal.TemporalAmount
value
-
Constructor Summary
Constructors Constructor Description TemporalAmountLiteral(java.time.temporal.TemporalAmount value)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CoreDatatype.XSD
getCoreDatatype()
CoreDatatype is an interface for natively supported datatypes in RDF4J.IRI
getDatatype()
Gets the datatype for this literal.java.lang.String
getLabel()
Gets the label (the lexical value) of this literal.java.util.Optional<java.lang.String>
getLanguage()
Gets the language tag for this literal, normalized to lower case.(package private) static java.time.temporal.TemporalAmount
parseTemporalAmount(java.lang.CharSequence label)
java.time.temporal.TemporalAmount
temporalAmountValue()
Retrieves thetemporal amount
value of this literal.private static java.lang.String
toString(java.time.temporal.TemporalAmount value)
-
Methods inherited from class org.eclipse.rdf4j.model.base.AbstractLiteral
booleanValue, byteValue, calendarValue, decimalValue, doubleValue, equals, floatValue, hashCode, integerValue, intValue, longValue, reserved, reserved, shortValue, stringValue, temporalAccessorValue, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.model.Value
isBNode, isIRI, isResource, isTriple
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
UNITS
private static final java.util.Collection<java.time.temporal.ChronoUnit> UNITS
-
PATTERN
private static final java.util.regex.Pattern PATTERN
-
value
private final java.time.temporal.TemporalAmount value
-
label
private final java.lang.String label
-
-
Method Detail
-
parseTemporalAmount
static java.time.temporal.TemporalAmount parseTemporalAmount(java.lang.CharSequence label)
-
toString
private static java.lang.String toString(java.time.temporal.TemporalAmount value)
-
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 returnrdf:langString
. If no datatype was assigned to this literal by the creator, then this method must returnxsd:string
.- Returns:
- The datatype for this literal.
-
temporalAmountValue
public java.time.temporal.TemporalAmount temporalAmountValue() throws java.time.DateTimeException
Description copied from interface:Literal
Retrieves thetemporal 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 likeDuration
using target static factory methods, for instanceDuration.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 interfaceLiteral
- Overrides:
temporalAmountValue
in classAbstractLiteral
- Returns:
- the temporal amount value of this literal
- Throws:
java.time.DateTimeException
- if this literal cannot be represented by aTemporalAmount
value- See Also:
- The Java™ Tutorials – Trail: Date Time
-
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 {@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.
-
-