I am a Hobby Xojo-User. I wanna import a Gedcom-File to my Program, espacially to a SQLite-Database.
Structure of the Database
Tables
Persons
- ID: Integer
- Gender: Varchar // M, F or U
- Surname: Varchar
- Givenname: Varchar
Relationships
- ID: Integer
- Husband: Integer
- Wife: Integer
Children
- ID: Integer
- PersonID: Integer
- FamilyID: Integer
- Order: Integer
PersonEvents
- ID: Integer
- PersonID: Integer
- EventType: Varchar // e.g. BIRT, DEAT, BURI, CHR
- Date: Varchar
- Description: Varchar
- Order: Integer
RelationshipEvents
- ID: Integer
- RelationshipID: Integer
- EventType: Varchar // e.g. MARR, DIV, DIVF
- Date: Varchar
- Description: Integer
- Order: Integer
I wrote a working Gedcom-Line-Parser. He splits a single Gedcomline into:
- Level As Integer
- Reference As String // optional
- Tag As String
- Value As String // optional
I load the Gedcom-File via TextInputStream (working fine). No i need to parse every Line.
Gedcom-Individual-Sample
0 @I1@ INDI
1 NAME George /Clooney/
2 GIVN George
2 SURN Clooney
1 BIRT
2 DATE 6 MAY 1961
2 PLAC Lexington, Fayette County, Kentucky, USA
You'll see, the Level-Numbers shows us a "Tree-Structure". So i thought it would be the best and simplest way to parse the File into separated Objects (PersonObj, RelationshipObj, EventObj etc.) into a JSONItem, because there its easy to get the Childs of a Node. Later on, i can simple read the Nodes, Child-Nodes to create the Database-Entries. But i don't know how to create such an Algorithm.
Can anyone help my please?