Question

I have a prolog implementation which allows me to compare time points in events using a prolog-based representation of the 13 Allen's relationships. Each event has a start point (YYYY-MM-DD) and an end point (YYYY-MM-DD) and I can check whether two events happened at the same time or one is before another, etc up to the day granularity (e.g. 1555-12-03 is before 1555-12-04). It does work ok with so called AC dates (Anno Domini), but now I have a good number of events which happened BC (before Christ). What is a best way to handle those BC events and be able to say, for instance, that the foundation of Athens (BC 1556) is before the birth of Colombus (1451).....Any idea is more than welcome.

Thanks,

I.

Was it helpful?

Solution

How are you storing your date? If it's in your own struct then include the AD or BC, and use this as a kind of negative flag, BC treating years as negative, AD treating years as positive.

OTHER TIPS

I believe he's asking whether your dates are stored in various predicates or if they're only specified in a single date predicate, e.g., a_date(12345, "12-24-2011") where the first field is an ID field. That is, do you store dates as something like

a_date(event_id,date_value)

where date_value's format is YYYY-MM-DD?

One solution: require "AD" or "BC" in the date string, with the default being "BC", and treating the absence of either as being "AD".

Another solution: Create a new date predicate, call it

a_date(even_id, date_value,flag)

where flag is either bc or ad. If flag is ad, math goes on as usual. If flag is bc, branch to new code that does the appropriate math. Existing date predicates of the form a_date(event_id, date_value) would be interpreted as a_date(event_id, date_value, "AD")

That is, in code

a_date(event_id, date_value) := a_date(event_id, date_value, "AD")

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top