University of Washington, Bothell
CSS 482: Expert Systems
Fall 2010
In-Class Exercises (week 4)

In homework 2, you implemented a simple expert system to infer additional family relationships based on a given, basic set. In these exercises, you will refresh your Java memory and familiarize yourself with a Java library that reads genealogy information from a standard file format, GEDCOM 4.0 format. 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).

You will eventually want to convert the necessary individual information from a GEDCOM file into Jess Fact objects. In these exercises, we will work on part of this, leaving integration and the details to homework.

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 the testjed program so that you have a class with useful methods that can be called from Jess. In particular, you will want a method (perhaps just the constructor) that creates a GEDCOM object and connects it to a file, a method that allows you to query the next node tag, and some methods that return information from that node. This should allow you to be able to walk through the file contents, extract the information you need, and use that information to assert facts.
  4. Verify that your approach works by writing Jess code that uses your new class to implement the same functionality as testjed. Basically, what you should have is the main loop from testjed rewritten in Jess, with major hunks of the testjed code now being performed by method calls to your new class.