Class TimeValue
- java.lang.Object
-
- de.digitalcollections.model.time.TimeValue
-
- All Implemented Interfaces:
org.wikidata.wdtk.datamodel.interfaces.TimeValue
,org.wikidata.wdtk.datamodel.interfaces.Value
public class TimeValue extends Object implements org.wikidata.wdtk.datamodel.interfaces.TimeValue
From interface "org.wikidata.wdtk.datamodel.interfaces.TimeValue":Time values represent points and intervals in time, and additional information about their format. Information includes a specific time point, information about its precision, and the preferred calendar model and timezone (for display). Moreover, time values can describe some uncertainty regarding the exact position in time. This is achieved by tolerance values that specify how much
before
orafter
the given time point an event might have occurred.Time points cannot describe durations (which are quantities), recurring events ("1st of May"), or time spans ( "He reigned from 1697 to 1706, i.e., during every moment of that time span" ). Intervals expressed by times always encode uncertainty ("He died in the year 546 BCE, i.e., in some moment within that interval").
The main time point of the value generally refers to the proleptic Gregorian calendar. However, if dates are imprecise (like "Jan 1512" or even "1200") then one cannot convert this reliably and Wikidata will just keep the value as entered.
"Y0K issue": Neither the Gregorian nor the Julian calendar assume a year 0, i.e., the year 1 BCE was followed by 1 CE in these calendars. See http://en.wikipedia.org/wiki/Year_zero. Wikibase internally uses the year 0. This is the same as ISO-8601, where 1 BCE is represented as "0000". However, note that XML Schema dates (1.0 and 2.0) do not have a year 0, so in their case 1BCE is represented as "-1". Understanding the difference is relevant for computing leap years, for computing temporal intervals, and for exporting data.
Timezone information is to be given in the form of a positive or negative offset with respect to UTC, measured in minutes. This information specifies the timezone that the time should be displayed in when shown to a user. The recorded time point is in UTC, so timezone can be ignored for comparing values. See
getTimezoneOffset()
.- Author:
- Markus Kroetzsch
-
-
Constructor Summary
Constructors Constructor Description TimeValue()
TimeValue(long year)
TimeValue(long year, byte month, byte day)
TimeValue(long year, byte month, byte day, byte hour, byte minute, byte second, byte precision, int beforeTolerance, int afterTolerance, int timezoneOffset, String preferredCalendarModel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
accept(org.wikidata.wdtk.datamodel.interfaces.ValueVisitor<T> valueVisitor)
int
getAfterTolerance()
int
getBeforeTolerance()
byte
getDay()
byte
getHour()
byte
getMinute()
byte
getMonth()
byte
getPrecision()
String
getPreferredCalendarModel()
org.wikidata.wdtk.datamodel.interfaces.ItemIdValue
getPreferredCalendarModelItemId()
byte
getSecond()
int
getTimezoneOffset()
long
getYear()
void
setAfterTolerance(int afterTolerance)
void
setBeforeTolerance(int beforeTolerance)
void
setDay(byte day)
void
setHour(byte hour)
void
setMinute(byte minute)
void
setMonth(byte month)
void
setPrecision(byte precision)
void
setPreferredCalendarModel(String preferredCalendarModel)
void
setSecond(byte second)
void
setTimezoneOffset(int timezoneOffset)
void
setYear(long year)
TimeValue
toGregorian()
-
-
-
Constructor Detail
-
TimeValue
public TimeValue()
-
TimeValue
public TimeValue(long year, byte month, byte day, byte hour, byte minute, byte second, byte precision, int beforeTolerance, int afterTolerance, int timezoneOffset, String preferredCalendarModel)
-
TimeValue
public TimeValue(long year)
-
TimeValue
public TimeValue(long year, byte month, byte day)
-
-
Method Detail
-
accept
public <T> T accept(org.wikidata.wdtk.datamodel.interfaces.ValueVisitor<T> valueVisitor)
- Specified by:
accept
in interfaceorg.wikidata.wdtk.datamodel.interfaces.Value
-
getAfterTolerance
public int getAfterTolerance()
- Specified by:
getAfterTolerance
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getBeforeTolerance
public int getBeforeTolerance()
- Specified by:
getBeforeTolerance
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getDay
public byte getDay()
- Specified by:
getDay
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getHour
public byte getHour()
- Specified by:
getHour
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getMinute
public byte getMinute()
- Specified by:
getMinute
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getMonth
public byte getMonth()
- Specified by:
getMonth
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getPrecision
public byte getPrecision()
- Specified by:
getPrecision
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getPreferredCalendarModel
public String getPreferredCalendarModel()
- Specified by:
getPreferredCalendarModel
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getPreferredCalendarModelItemId
public org.wikidata.wdtk.datamodel.interfaces.ItemIdValue getPreferredCalendarModelItemId()
- Specified by:
getPreferredCalendarModelItemId
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getSecond
public byte getSecond()
- Specified by:
getSecond
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getTimezoneOffset
public int getTimezoneOffset()
- Specified by:
getTimezoneOffset
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
getYear
public long getYear()
- Specified by:
getYear
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
setAfterTolerance
public void setAfterTolerance(int afterTolerance)
-
setBeforeTolerance
public void setBeforeTolerance(int beforeTolerance)
-
setDay
public void setDay(byte day)
-
setHour
public void setHour(byte hour)
-
setMinute
public void setMinute(byte minute)
-
setMonth
public void setMonth(byte month)
-
setPrecision
public void setPrecision(byte precision)
-
setPreferredCalendarModel
public void setPreferredCalendarModel(String preferredCalendarModel)
-
setSecond
public void setSecond(byte second)
-
setTimezoneOffset
public void setTimezoneOffset(int timezoneOffset)
-
setYear
public void setYear(long year)
-
toGregorian
public TimeValue toGregorian()
- Specified by:
toGregorian
in interfaceorg.wikidata.wdtk.datamodel.interfaces.TimeValue
-
-