Problem:
range, difference-within-range and contemporary constraints, which use RangeCheckerHelper to operate time values and make their decisions, show false positives rooted in a too simplistic, incomplete or ambiguous management of time values by Wikibase. Wikibase stores a more precise value than corresponds to the precision set by the user (e.g., the user types "1555" and sets a precision of decades, but Wikibase stores and will provide the original value, "1555", whose last digit is arbitrary), so identically rendered values behave differently. The arbitrariness of the value stored by Wikibase, the naivety of WikibaseQualityConstraints, or the inability of both to manage and communicate time ranges rather than exact time values affect the decisions of the three constraint types, whose behaviours are sometimes perceived as random or inconsistent.
Example:
- https://www.wikidata.org/wiki/Q1648588#Q1648588$1BFE45B1-8226-475E-B56F-BABCB28959A7 <- this date of death triggers a constraint violation even though it shouldn't. The date of birth is interpreted as 1600 (16th century with century precision) and the date of death as 7 December 1541.
- https://www.wikidata.org/wiki/Q1225697#Q1225697$35E240FC-F826-455C-BCEB-F09A53F9EAC8 <- this date of death triggers a constraint violation even though it shouldn't. The date of birth is -0350-00-00T00:00:00Z and the date of death is -0400-01-01T00:00:00Z, so the date if death is earlier than the date of birth even though that is not what the data necessarily implies.
BDD
GIVEN
AND
WHEN
AND
THEN
AND
Acceptance criteria:
- The digits of a Wikibase time value that exceed the precision are irrelevant and do not affect any behaviour. Ideally, these digits are not stored.
- A time value (range) violates a constraint if (and only if) each and every one of the more precise time values (ranges) contained in it does. If a time value (range) does not violate a constraint, no less precise value (range) containing it can do so.
- Two consecutive time values (ranges) with the same precision intersect, as their minimum difference is 0: 1880-01-01T00:00:00.0000… - 1879-12-31T23:59:59.9999… = 0.
- Two non-consecutive time values with the same precision never intersect, as their minimum difference is > 0.
- In case of doubt or ambiguity, the most permissive decision should be made.
Notes:
- Useful previous work: https://github.com/wmde/Time/pull/140
Open questions: