University of Washington, Bothell
CSS 482: Expert Systems
Winter 2009
Jess in Java Laboratory Project: A Genealogy System

In the warm-up to expert system 2, you augmented a simple expert system to infer additional family relationships based on a given, basic set. In this lab, you will write a Java program that reads genealogy information about individuals, creates Fact objects in Jess, and then uses Jess to infer relationships.

Your Java program will read genealogy data in GEDCOM 4.0 format, a standard format used for such data on the web. You can use the GEDCOM Java class to parse such files. GEDCOM files contain information about individuals and families. You will only need to extract information about individuals from the file. More specifically, the GEDCOM class reads each GEDCOM record and produces a tree-structured set of nodes (i.e., the whole GEDCOM file is a forest). To extract family relationships, all we really need to do is extract individual names, individual keys (unique identifiers), individual sexes, and the two types of family keys:

  1. the family in which an individual appears as child (the “FAMC” tag: you can use this to identify parents and siblings; parents will have this family as their “FAMS” tag)
  2. and the family in which an individual appears as a spouse (the “FAMS” tag: you can use this to match spouses, as they will share the same “FAMS” tag).

Your program will convert the necessary individual information from a GEDCOM file into Jess Fact objects, inserting them into the Rete engine working memory. You will augment your expert system 2 warmup with rules that will infer basic relationships (only those that were given as input in the warmup) from individual facts. Your resulting program should output the family relationships as in the warmup.

Specifically, do the following things:

  1. Download the GEDCOM.java and testjed.java software from the course web (the latter program demonstrates use of the GEDCOM class and can be used as the skeleton of your program). You can get an example genealogy file from the course web, too.
  2. Verify that you can compile and run the testged program; it should indicate that there are 57 individuals and 36 families in the example genealogy file.
  3. Modify your Jess expert system warmup code so that it will work with deftemplates that contain only the information that will be extracted from a GEDCOM file. Verify that this works by hard-coding a small set of individuals from the example genealogy file.
  4. Integrate your Jess program into your Java program. Some boilerplate code to assist you with this is here. Section 10 of the Jess 7.1 manual is most pertinent here. After you create the Rete engine, have it read the Jess code using Rete.eval(). For each individual read from the genealogy file, create a Fact object, populate its slots with appropriate values using Fact.setSlotValue(), and use Rete.assertFact() to enter it into Jess’ working memory. Once all individuals have been so entered, you can use Rete.run() to run your Jess code.
  5. Once you’ve got your program working, print it and its output (make sure your name is on the printout) and hand it in.
  6. Think a bit about what the code would look like if you needed to write the functionality provided by Jess in this program from scratch using Java.