Talk:Z28750
Appearance
Latest comment: 1 month ago by GrimRob in topic Only got so far on this
Only got so far on this
I know the [! Year-specific property value of item, in English] function is not working but I put it in as a placeholder as I couldn't find anything else.
Obviously needs a function that is not language-specific GrimRob (talk) 21:24, 9 October 2025 (UTC)
- You might take a look at display Wikidata date of death (Z26726). It’s only a Test case (Z20), but it shows the way from Wikidata to a string. You can ignore the map function (Z873) calls because I suppose you’ll want to start with a single statement for each date, perhaps using best ranked statement from list (Z23680). I think you’ll also want to reduce the date to a year early on; year from calendar date (Z24948) will do this. You might go further with Gregorian year to year number (Z20160), but I’d be inclined to create a display-style function similar to display Gregorian year (Z20241) but omitting the Gregorian era (Z17813) for more recent years (see display functions for Gregorian year (Z20240)). GrounderUK (talk) 23:10, 9 October 2025 (UTC)
- Thanks. It makes sense but I am struggling to use functions like Z24948 as arguments. If I start from scratch I can enter it as the only function at the top of the stack but I don't seem to ever be able to use it in nested calls. Probably something am I missing, I am new to this. GrimRob (talk) 13:52, 10 October 2025 (UTC)
- ok I get it, it depends on the return type GrimRob (talk) 16:11, 10 October 2025 (UTC)
- got it working now, still needs to cope with the "alive" case. It needs some of the nested calls as individual functions to reduce the calls in this one. Will pick up later. GrimRob (talk) 17:49, 10 October 2025 (UTC)
- should work getting an error on the else part of Item 3, pretty sure it is right. Might re-enter it once we have got any new functions I mentioned. GrimRob (talk) 20:09, 10 October 2025 (UTC)
- Item 3 is fine but item 4 needs to be conditional on there being a date of death. GrounderUK (talk) 21:00, 10 October 2025 (UTC)
- Thanks, so obvious. Second pair of eyes very useful. Working now. GrimRob (talk) 21:10, 10 October 2025 (UTC)
- Took me a while to spot it too! GrounderUK (talk) 07:21, 11 October 2025 (UTC)
- Thanks, so obvious. Second pair of eyes very useful. Working now. GrimRob (talk) 21:10, 10 October 2025 (UTC)
- Item 3 is fine but item 4 needs to be conditional on there being a date of death. GrounderUK (talk) 21:00, 10 October 2025 (UTC)
- I propose we have a new function like year from calendar date (Z24948) but taking a Wikidata time (Z6064). It’s straightforward enough so long as its Wikidata time precision (Z6062) is better than a decade and the Wikidata calendar model (Z6063) is proleptic Gregorian calendar (Q1985727). For now, statements with dates using other models are silently dropped (see Wikifunctions:Type proposals/Julian calendar date). We could effectively do the same for imprecise years by returning void (Z24), but I’m thinking that we should also provide a “precise enough Wikidata time (Z6064)?” function. (Do you have any thoughts on this, @DMartin (WMF)? I’m just thinking of Z6064, Z6062 ↦ Z40 [ no similar functions ].) GrounderUK (talk) 09:56, 11 October 2025 (UTC)
- Yes I was going to propose combining year from calendar date (Z24948) and valid Gregorian date from Wikidata datetime (Z28133) into a new function called something like year from Wikidatatime as that would combine 3 function calls into 1: Z24948, Z28133, Wikidata datetime from Wikidata time (Z25726). I think your proposal amounts to that. GrimRob (talk) 10:38, 11 October 2025 (UTC)
- I think so, but what would you do about imprecise years? Please feel free to ignore them for the time being. You can wrap the whole composition with an if true (Z41) then … else ??? (void (Z24), or whatever) or, equivalently, use unless exception (Z20305) … unless false (Z42) when ???. GrounderUK (talk) 11:10, 11 October 2025 (UTC)
- At the moment if I try it on Jesus Christ (Q302) it returns void, which I think is correct as the year is not known. For Thomas Cromwell (Q294435) where the year is known but not the date ideally it should show the year (right now it is void). For BCE dates like Julius Caesar (Q1048) it doesn't show the dates right. I think if there is a year the function should work with that. GrimRob (talk) 11:34, 11 October 2025 (UTC)
- Yes. Please see age of a person in years (Z27758). Unless the date in Wikidata is explicitly using the proleptic Gregorian calendar model, the statement is not currently imported at all, so there’s no way to find it. This is expected to change fairly soon, but there’s no alternative approach right now. phab:T396630 GrounderUK (talk) 12:11, 11 October 2025 (UTC)
- For proleptic BCE dates, you’re jettisoning the Gregorian era (Z17813) by extracting the numeric part of the year. As in my original reply “…I’d be inclined to create a display-style function similar to display Gregorian year (Z20241) but omitting the Gregorian era (Z17813) for more recent years.” I believe it is customary to specify the era with any CE year with less than 3 digits, but I’d probably mention it even up to 499 CE. GrounderUK (talk) 12:48, 11 October 2025 (UTC)
- Thanks for your new function, I have hooked it into a new implementation which is easier on the eye than this one, and less repetition. GrimRob (talk) 16:47, 13 October 2025 (UTC)
- At the moment if I try it on Jesus Christ (Q302) it returns void, which I think is correct as the year is not known. For Thomas Cromwell (Q294435) where the year is known but not the date ideally it should show the year (right now it is void). For BCE dates like Julius Caesar (Q1048) it doesn't show the dates right. I think if there is a year the function should work with that. GrimRob (talk) 11:34, 11 October 2025 (UTC)
- I think so, but what would you do about imprecise years? Please feel free to ignore them for the time being. You can wrap the whole composition with an if true (Z41) then … else ??? (void (Z24), or whatever) or, equivalently, use unless exception (Z20305) … unless false (Z42) when ???. GrounderUK (talk) 11:10, 11 October 2025 (UTC)
- Yes I was going to propose combining year from calendar date (Z24948) and valid Gregorian date from Wikidata datetime (Z28133) into a new function called something like year from Wikidatatime as that would combine 3 function calls into 1: Z24948, Z28133, Wikidata datetime from Wikidata time (Z25726). I think your proposal amounts to that. GrimRob (talk) 10:38, 11 October 2025 (UTC)
- should work getting an error on the else part of Item 3, pretty sure it is right. Might re-enter it once we have got any new functions I mentioned. GrimRob (talk) 20:09, 10 October 2025 (UTC)
- got it working now, still needs to cope with the "alive" case. It needs some of the nested calls as individual functions to reduce the calls in this one. Will pick up later. GrimRob (talk) 17:49, 10 October 2025 (UTC)
- ok I get it, it depends on the return type GrimRob (talk) 16:11, 10 October 2025 (UTC)
- Thanks. It makes sense but I am struggling to use functions like Z24948 as arguments. If I start from scratch I can enter it as the only function at the top of the stack but I don't seem to ever be able to use it in nested calls. Probably something am I missing, I am new to this. GrimRob (talk) 13:52, 10 October 2025 (UTC)