View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Milestone 6 Case Study - DY

Milestone 6 Specs

Getting Started

First, we had to figure out what GEDCOM is. Looking at simple tutorials helped, and we realized quickly that we only had to implement as small subset of what GEDCOM can do. Then we had to make sure that our design would hold for everything that we need to export, with families, marriages, children, etc. Our design worked for the most part, but we had to work around the fact that in our implementation, marriages are not families, while in GEDCOM they are. A simple fix. Also, we had to figure out what TGen is. We basically just played around with the TGen UI – make sure to look at the slides for examples, and for once, the documentation is quite good.

Making it Work

Playing with TGen presented some difficulties, but worked itself out fairly quickly. The first step was to make a grammar for a GEDCOM file with the functionality we wanted to implement. Luckily, TGen uses grammars much like Lex and Yacc, and we paid attention in 2130… Once the grammar and tokenizer were created, we had to make it into an AST parser. Basically, an AST Parser takes the input file and creates a tree with each “node” or bit of information that you specify. Then we added functionality to the AST by creating all of the node classes (makes the uml a little ugly) and specifying the actions for each node (addSibling, etc). The trickiest part was figuring out how to write the grammar to work with the AST correctly. After that, it was a matter of just going through the nodes and taking all of the attributes and creating a new Person/Family, etc. The two main groups, Families and Persons, were created, and then we parsed the linkages between them, which was a bit tricky, but TGen made it as simple as could be possible.

The Design

This design got very ugly very quickly because of the nodes required by TGen’s parser.
Uploaded Image: m5ClassDiagram.jpg
Uploaded Image: M6classdiagram.jpg

Afterthoughts

  1. TGen is your friend. Treat it nicely and it will work wonders for you.
  2. When you try to import a file that you have edited in Windows, you can run into problems. Make sure that your tokenizer ignores explicit carriage returns as whitespace.
  3. Exporting a GEDCOM file was virtually the same as exporting in normal circumstances, but we had to create some workarounds to make sure that marriages were exported as families, which was somewhat tricky.

Link to this Page