1

Is there a way in Semantic Mediawiki to store and use relative dates?

I would like to store genealogical data in Semantic Mediawiki and there is sometimes information like: »On January 10th 2021 John, son of the deceased Jack, married Mary.« Now I know that Jack died BEFORE 2021-01-10. Is there any way to store (and query) such information -- BEFORE 2021-01-10 -- in a date property, just like in GEDCOM format?

felleb
  • 23
  • 4

2 Answers2

1

To store such data, you can define Record datatype:

Property:Relative date of birth:

[[Has type::Record]]
[[Has fields::Sign;Date value]]

Property:Date value:

[[Has type::Date]]

Property:Sign:

[[Has type::Text]]
[[Allows value::Before]]
[[Allows value::Exactly]]
[[Allows value::After]]

To store data, use [[Relative date of birth::Before;January 9th, 1976]].

Querying such data is not an easy task. For an exact day, use {{#ask:[[Relative sate of birth::Exactly;January 9th,1976]]}}. To query for people born before the 9th of January 1976, you need a more complicated query, or a union of queries: {{#ask:[[Relative sate of birth::Exactly||Before;<January 9th,1976]]|?Relative date of birth.Date value=date}}.

Alexander Mashin
  • 3,892
  • 1
  • 9
  • 15
  • Am I right that for queries to work every birth date has to have that property (»property:Relative date of birth«), even exactly known dates? – felleb Jan 12 '21 at 21:38
  • This is one option. You can also annotate a scalar property for exact date of birth directly; but your `{{#ask:}}` queries will become more complex. – Alexander Mashin Jan 13 '21 at 05:53
0

I have a set of functions for "GEDdates" I store dates with two fields, one for the date in ccyymmdd format and another for a modifier. The date can be truncated if you don't have specifics: ccyy or ccyymm. The modifiers are <, >, c, - for BEF, AFT, ABT and BTW in GEDCOM. The - is followed in the modifier field by the later date such as -ccyymm. I've recently also used the Unicode character for between ≬ (≬) which is more aligned with the data type.

This data structure gives all the flexibility needed. There are code examples at GitHub

David A Stumpf
  • 753
  • 5
  • 13