Skip to content
James Hogan edited this page Sep 6, 2013 · 3 revisions

Welcome to the chron wiki!

Chron is a tool for resolving chronological constraints in genealogies and chronologies of historical documents such as the Bible.

Overview of how it works and what it can do?

A Chron database is a Prolog module which fundamentally defines events and the timing constraints between them, although usually at a higher level than that. All time periods break down to time domains, which is usually a single range of possible time. CLPFD (Constraint Logic Programming over Finite Domains) can then be used to apply all the constraints to the times of the events to calculate relative to some epoch the possible range of dates for each and every event in the database.

Rules are defined in the chron modules which allow higher level concepts to be dealt with in the database. For example relationships between people can be described (which are broken down internally into constraints between events in people's lives and the beginning and end of periods), and time intervals can be described in various more complex ways including larger units, years (as often used for ages, e.g. if I say I'm 26 years old, I actually mean my age is in the interval [26 years..27 years)), or using a calendar interface (which generates more precise constraints between events using the same calendar even if the exact epoch or structure of the calendar is largely unknown).

The resulting data can be presented in various ways

  • textually: the print_db(Epoch) command prints the time periods of all events and periods textually.
  • interactive timeline (in progress): the plan is to view the data on an interactive timeline (using Qt), since fixed images can get very large.
  • gnuclad timeline: gnuclad is a program for drawing trees on a timeline. It can be used to generate an SVG timeline showing a family tree based on the relationship and time data derived from the database.
  • DOT ancestry graph: graphviz can read a DOT file describing a graph and generate an image of the graph. It can be used to generate a family tree based on the relationship data in the chron database.
  • DOT constraint graph: graphviz can be used to generate a graph of constraints between events in the database. This is mostly useful for interest/debugging purposes as the resulting graph can be large and highly complex.

Database structure

Chron databases must be prolog modules. Therefore it must start with something like this:

:- module('my_database', []).

They should then load the Chron module in such a way as to allow facts defined in it's module namespace to be visible to Chron. This is done by including chron(database):

:- include(chron(database)).

It can then start defining chron facts and rules. See the list of predicates the database can define in the import_ns_predicates/1 definition near the top of src/chron.pl (and others such as src/dwelling.pl and src/calendar.pl). For example event/1 can be used to define an event:

event(some_event).

Periods of time can also be defined similarly with period/1:

period(some_period).

This implies event(begin(some_period)) and event(end(some_period)) (i.e. that both begin(some_period) and end(some_period) are events. It also automatically implies that the time of begin(some_period) <= the time of end(some_period).

man/1, woman/1, and person/1 can be used to define a man, woman, or general person of unspecified gender:

man(john).

This implies person(john), period(lifetime(john)) (i.e. that lifetime(john) is a period of time with a begin() and end()). It also allows birth(john) and death(john) to be used to refer to begin(lifetime(john)) and end(lifetime(john)) respectively.

Constraints are usually accompanied by a description of the source that implies that constraint. The source is carried through as the constraint is broken down into lower level constraints, which should allow different levels of trust to be placed on different constraints in the case of a contradiction. Sources can be arbitrary prolog terms, or a list of Sources. An example constraint is person_lifetime/3 which specifies the length of a person's life:

person_lifetime(john, time(70, year), some_book([chapter(5), page(50)]).

Is is often useful to be able to specify ranges of time. One way of doing this is:

person_lifetime(john, time(Years, year), some_book([chapter(5), page(50)]) :-
    Years in 70..75.

Although another way would be to constrain death(john) using other constraints.

Clone this wiki locally