3

When querying p569 (date of birth) or a similar property, it returns dates as full month-day-year time strings, even if the statement only contains the year. If the statement only contains the year it assigns January 1st as the date. Is there a way to get it to only return the portion of the date that is actually in the statement? While its tempting just to throw out any 1-1 date after the fact, someone could just have that as a birthday. I'm trying to figure out if there is a way to get the query to either only return the part of the date that is actually in the statement, whether thats a m/d/y, m/y, or just a year. Alternatively, I'd be willing to just make a second column that shows me the original date's precision.

jmwink
  • 35
  • 3
  • 2
    yes, it's possible. You can get the time precision with `SELECT DISTINCT * WHERE { ?item p:P569/psv:P569 [ wikibase:timeValue ?birth; wikibase:timePrecision ?precision ] } limit 10` - this at least lets you know what part of the date is really known – UninformedUser Sep 23 '21 at 03:54
  • 1
    to understand the numbers: *precision – explicit value encoded in a shortint. The numbers have the following meaning: 0 - billion years, 1 - hundred million years, ..., 6 - millennium, 7 - century, 8 - decade, 9 - year, 10 - month, 11 - day, 12 - hour, 13 - minute, 14 - second.* – UninformedUser Sep 23 '21 at 03:58

0 Answers0