Help talk:Property constraints portal/Range

From Wikidata
Jump to navigation Jump to search

special parameter “now” in constraint statements[edit]

In {{Constraint:Range}}, you can specify an endpoint of a time range as “now” instead of a date. How do we do this in constraint statements if the appropriate qualifier is minimum date (property constraint) (P2310), datatype “point in time”, which doesn’t let us enter “now”? I assume we could interpret unknown value Help as “now” (in a very pedantic sense, the correct value for “now” is unknown at the time the statement is entered), but that feels like an ugly hack.

@Ivan A. Krestinin: does Module:Constraints support this? I couldn’t find anything for this case in the code, but I only had a quick glance, so I might have missed it. --Lucas Werkmeister (WMDE) (talk) 21:43, 19 May 2017 (UTC)

Adding another property pair would make it more complicated… I’d prefer unknown value Help. I don’t think we’ll need another kind of “special value” where the item would be more flexible. --Lucas Werkmeister (WMDE) (talk) 11:42, 16 June 2017 (UTC)
@Ivan A. Krestinin: Is it okay if I add support for unknown value Help as “now” to the extension? It’s a hack, but I don’t think this parameter is worth adding two more properties (minimum / maximum value), because I don’t think there are any other special values where we would need an item. --Lucas Werkmeister (WMDE) (talk) 09:29, 30 June 2017 (UTC)
Lets use unknown value Help as "now" for now. :) We can switch to another approach in the future. — Ivan A. Krestinin (talk) 19:15, 4 July 2017 (UTC)
Thanks, I’ve updated the documentation and implemented this. --Lucas Werkmeister (WMDE) (talk) 11:45, 5 July 2017 (UTC)

Permitting open ranges[edit]

I noticed that a lot of range constraints on Wikidata only have one meaningful endpoint: for example, many constraints specify a minimum of 0, and some arbitrary large number as maximum, to express the constraint “this value should be positive”. I think that in constraint statements, we should allow people to explicitly specify such ranges by putting no value Help as the minimum/maximum quantity/date parameter. @Ivan A. Krestinin:: do you agree? --Lucas Werkmeister (WMDE) (talk) 10:31, 21 May 2017 (UTC)

  • My migration code will not add the qualifier at all. Is there some reason to require both qualifiers? — Ivan A. Krestinin (talk) 10:45, 21 May 2017 (UTC)
Well, currently all Range and Diff within range constraints have both parameters (at least in the version of the constraints we imported a week ago), so I don’t think the migration behavior matters that much. But the constraints extension will currently give you an error if one of the parameters is missing.
I think it’s better to require an explicit no value Help minimum/maximum, because a missing qualifier might just be an accident. --Lucas Werkmeister (WMDE) (talk) 11:21, 21 May 2017 (UTC)
Ok, lets require both qualifiers. This is non-significant detail. — Ivan A. Krestinin (talk) 12:57, 21 May 2017 (UTC)

“now” ranges for the following day[edit]

@Lucas Werkmeister (WMDE): I'm importing some paintings and got a constraint violation on no label (Q50102989): "range constraint. The value for retrieved (25 February 2018) should be in the past, but not before 2001." Why am I getting this constraint violation? I bet it has something to do with timezones because on my laptop it's now 25 Februari and check out my signature -> Multichill (talk) 23:57, 24 February 2018 (UTC)

@Multichill: yeah, we always check that constraint against the current time in UTC… perhaps we need to allow for up to -12/+14 hours of deviation (UTC-12:00 and UTC+14:00 are the latest and earliest currently existing timezones). --Lucas Werkmeister (WMDE) (talk) 11:19, 26 February 2018 (UTC)