Page MenuHomePhabricator

Make TimeValue represent an interval always.
Open, HighPublic

Description

TimeValue has the notion of a precision interval given by the "before" and "after" fields, in the unit specified by the "precision" field (e.g. "day").

Currently, both "before" and "after" default to 0. "after" however should never be smaller than 1: the date "March 5 2010" specifies an interval starting at 00:00 that day, and ending 00:00 the next day - so, the precision should be 0, before should be 0, but after should be 1. I would even go so far as to say that setting after to 0 is never valid, no matter what the before value is.


Version: unspecified
Severity: major
Whiteboard: u=dev c=backend p=0

Details

Reference
bz65253

Related Objects

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:23 AM
bzimport set Reference to bz65253.
bzimport added a subscriber: Unknown Object (MLST).

Note that this is especially important for indexing time values for query. It's perhaps best to just make the TimeValue's getAfter method fix any value < 1 to 1.

Another question is how we should handle after=0 in API input.

I suggest to leave this as it is. Setting "after" to 0 means "unspecified". This is similar to setting month or day to 0.

"2014-05-00" means "May 2014", right? Having the day unspecified is ok in the data model. But code that does actual calculations with this value can not simply use it as it is. It will end with "30 April 2014" or fail completely. It must correct 0 to 1 in the calculation.

Same for the "after" value discussed here. I think it's useful to have an "unspecified" value. This allows user A to set a time value to "2014-00-00" and the precision to "YEAR" and that's it. User B can see what user A did and that he had not set an "after" value. If it defaults to "1" you loose this information.

Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).

I think there are two distinct meanings. First, there is an event that has a duration much less than the precision. For example, Benjamin Franklin died on April 17, 1790 in Philadelphia; our article does not give the time of death. Supposing that the editor who placed the information in Wikidata didn't have information about the time of day, the precision would be 1 day. But the event of dying presumably took much less than a day.

A different meaning would be a celebration of a legal holiday. For simplicity, suppose the holiday was a one-time event rather than recurring every year. Since it was legally defined, the beginning and end are exactly known.

How these two different meanings should be represented in Wikidata is unclear.

@Jc3s5h: DataValue precisions are intended for the first meaning you mentioned: the exact time is not know. The precision does not represent an interval or duration.

We were considering a special PropertyValueRangeSnak for representing this kind of thing. But as it turns out, people are quite happy expressing intervals be creating separate Statements for start- and end-point. Which is actually quite useful, since the (un)certainty and sources may be different for start- and end-point (e.g. when talking about wars, which different historians may give different start or end dates for).