gedcom 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +74 -0
  3. data/README.txt +129 -0
  4. data/Rakefile +13 -0
  5. data/lib/gedcom.rb +105 -0
  6. data/lib/gedcom/address_record.rb +77 -0
  7. data/lib/gedcom/adoption_record.rb +57 -0
  8. data/lib/gedcom/association_record.rb +79 -0
  9. data/lib/gedcom/cause_record.rb +45 -0
  10. data/lib/gedcom/change_date_record.rb +39 -0
  11. data/lib/gedcom/character_set_record.rb +41 -0
  12. data/lib/gedcom/citation_data_record.rb +49 -0
  13. data/lib/gedcom/citation_event_type_record.rb +42 -0
  14. data/lib/gedcom/corporate_record.rb +36 -0
  15. data/lib/gedcom/date_record.rb +206 -0
  16. data/lib/gedcom/encoded_line_record.rb +34 -0
  17. data/lib/gedcom/event_age_record.rb +36 -0
  18. data/lib/gedcom/event_record.rb +258 -0
  19. data/lib/gedcom/events_list_record.rb +61 -0
  20. data/lib/gedcom/families_individuals.rb +79 -0
  21. data/lib/gedcom/family_record.rb +89 -0
  22. data/lib/gedcom/gedcom_all.rb +41 -0
  23. data/lib/gedcom/gedcom_base.rb +337 -0
  24. data/lib/gedcom/gedcom_record.rb +44 -0
  25. data/lib/gedcom/header_data_record.rb +49 -0
  26. data/lib/gedcom/header_record.rb +75 -0
  27. data/lib/gedcom/header_source_record.rb +42 -0
  28. data/lib/gedcom/individual_attribute_record.rb +86 -0
  29. data/lib/gedcom/individual_record.rb +128 -0
  30. data/lib/gedcom/multimedia_citation_record.rb +55 -0
  31. data/lib/gedcom/multimedia_record.rb +72 -0
  32. data/lib/gedcom/name_record.rb +58 -0
  33. data/lib/gedcom/note_citation_record.rb +37 -0
  34. data/lib/gedcom/note_record.rb +61 -0
  35. data/lib/gedcom/place_record.rb +46 -0
  36. data/lib/gedcom/refn_record.rb +32 -0
  37. data/lib/gedcom/repository_caln.rb +33 -0
  38. data/lib/gedcom/repository_citation_record.rb +43 -0
  39. data/lib/gedcom/repository_record.rb +41 -0
  40. data/lib/gedcom/source_citation_record.rb +74 -0
  41. data/lib/gedcom/source_record.rb +84 -0
  42. data/lib/gedcom/source_scope_record.rb +35 -0
  43. data/lib/gedcom/submission_record.rb +53 -0
  44. data/lib/gedcom/submitter_record.rb +53 -0
  45. data/lib/gedcom/text_record.rb +31 -0
  46. data/lib/gedcom/trailer_record.rb +22 -0
  47. data/lib/gedcom/transmission.rb +103 -0
  48. data/lib/gedcom/transmission_base.rb +267 -0
  49. data/lib/parser/class_tracker.rb +33 -0
  50. data/lib/parser/ged_line.rb +99 -0
  51. data/lib/parser/gedcom_parser.rb +798 -0
  52. data/lib/parser/instruction.rb +14 -0
  53. data/lib/parser/parse_state.rb +49 -0
  54. data/test/test_gedcom.rb +7 -0
  55. data/test_data/Document.RTF +1 -0
  56. data/test_data/Document.tex +1 -0
  57. data/test_data/ImgFile.BMP +0 -0
  58. data/test_data/ImgFile.GIF +0 -0
  59. data/test_data/ImgFile.JPG +0 -0
  60. data/test_data/ImgFile.MAC +0 -0
  61. data/test_data/ImgFile.PCX +0 -0
  62. data/test_data/ImgFile.PIC +0 -0
  63. data/test_data/ImgFile.PNG +0 -0
  64. data/test_data/ImgFile.PSD +0 -0
  65. data/test_data/ImgFile.TGA +0 -0
  66. data/test_data/ImgFile.TIF +0 -0
  67. data/test_data/README.txt +1 -16
  68. data/test_data/TGC551.ged +1 -0
  69. data/test_data/TGC551LF.ged +2162 -0
  70. data/test_data/TGC55C.ged +1 -0
  71. data/test_data/TGC55CLF.ged +2202 -0
  72. data/test_data/force.wav +0 -0
  73. data/test_data/suntun.mov +0 -0
  74. data/test_data/top.mpg +0 -0
  75. metadata +140 -0
@@ -0,0 +1,44 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #Internal representation of the GEDCOM GEDC record type in a HEAD record.
4
+ #
5
+ #=HEADER:=
6
+ # n HEAD {1:1}
7
+ # ...
8
+ # +1 GEDC {1:1}
9
+ # +2 VERS <VERSION_NUMBER> {1:1}
10
+ # +2 FORM <GEDCOM_FORM> {1:1}
11
+ # ...
12
+ #
13
+ #==VERSION_NUMBER:=
14
+ # An identifier that represents the version level
15
+ # changed by the creators of the product.
16
+ #
17
+ #==GEDCOM_FORM:= {Size=14:20}
18
+ # [ LINEAGE-LINKED ]
19
+ # The GEDCOM form used to construct this transmission. There maybe other forms used such as
20
+ # CommSoft's "EVENT_LINEAGE_LINKED" but these specifications define only the LINEAGELINKED
21
+ # Form. Systems will use this value to specify GEDCOM compatible with these
22
+ # specifications.
23
+ #
24
+ #The attributes are all arrays for the level +1 tags/records.
25
+ #* Those ending in _ref are GEDCOM XREF index keys
26
+ #* Those ending in _record are array of classes of that type.
27
+ #* The remainder are arrays of attributes that could be present in this record.
28
+ class Gedcom_record < GEDCOMBase
29
+ attr_accessor :version, :encoding_format
30
+ attr_accessor :note_citation_record
31
+
32
+ ClassTracker << :Gedcom_record
33
+
34
+ #new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
35
+ def initialize(*a)
36
+ super(*a)
37
+ @this_level = [ [:nodata, "GEDC", nil] ]
38
+ @sub_level = [ #level + 1
39
+ [ :print, "VERS", :version],
40
+ [ :print, "FORM", :encoding_format],
41
+ [ :walk, nil, :note_citation_record],
42
+ ]
43
+ end
44
+ end
@@ -0,0 +1,49 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #Internal representation of the GEDCOM DATA in a SOUR record in a level 0 HEAD record type
4
+ #This is not the same record type as DATA tags in level 0 SOUR record.
5
+ #
6
+ #=HEADER:=
7
+ # n HEAD {1:1}
8
+ # +1 SOUR <APPROVED_SYSTEM_ID> {1:1}
9
+ # ...
10
+ # +2 DATA <NAME_OF_SOURCE_DATA> {0:1}
11
+ # +3 DATE <PUBLICATION_DATE> {0:1}
12
+ # +3 COPR <COPYRIGHT_SOURCE_DATA> {0:1}
13
+ # ...
14
+ # ...
15
+ #==NAME_OF_SOURCE_DATA:= {Size=1:90}
16
+ # The name of the electronic data source that was used to obtain the data in this transmission. For
17
+ # example, the data may have been obtained from a CD-ROM disc that was named "U.S. 1880
18
+ # CENSUS CD-ROM vol. 13."
19
+ #
20
+ #==PUBLICATION_DATE:= {Size=10:11}
21
+ # <DATE_EXACT>:= <DAY> <MONTH> <YEAR_GREG> {Size=10:11}
22
+ # The date this source was published or created.
23
+ #
24
+ #==COPYRIGHT_SOURCE_DATA:= {Size=1:90}
25
+ # A copyright statement required by the owner of data from which this information was down- loaded.
26
+ # For example, when a GEDCOM down-load is requested from the Ancestral File, this would be the
27
+ # copyright statement to indicate that the data came from a copyrighted source.
28
+ #
29
+ #The attributes are all arrays for the level +1 tags/records.
30
+ #* Those ending in _ref are GEDCOM XREF index keys
31
+ #* Those ending in _record are array of classes of that type.
32
+ #* The remainder are arrays of attributes that could be present in this record.
33
+ class Header_data_record < GEDCOMBase
34
+ attr_accessor :data_source, :date, :copyright
35
+ attr_accessor :note_citation_record
36
+
37
+ ClassTracker << :Header_data_record
38
+
39
+ #new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
40
+ def initialize(*a)
41
+ super(*a)
42
+ @this_level = [ [:print, "DATA", :data_source] ]
43
+ @sub_level = [ #level + 1
44
+ [:print, "DATE", :date],
45
+ [:print, "COPR", :copyright],
46
+ [:walk, nil, :note_citation_record],
47
+ ]
48
+ end
49
+ end
@@ -0,0 +1,75 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #Internal representation of the GEDCOM level 0 HEAD record type
4
+ #
5
+ #=HEADER:=
6
+ # n HEAD {1:1}
7
+ # +1 SOUR <APPROVED_SYSTEM_ID> {1:1}
8
+ # +2 VERS <VERSION_NUMBER> {0:1}
9
+ # +2 NAME <NAME_OF_PRODUCT> {0:1}
10
+ # +2 CORP <NAME_OF_BUSINESS> {0:1}
11
+ # +3 <<ADDRESS_STRUCTURE>> {0:1}
12
+ # +2 DATA <NAME_OF_SOURCE_DATA> {0:1}
13
+ # +3 DATE <PUBLICATION_DATE> {0:1}
14
+ # +3 COPR <COPYRIGHT_SOURCE_DATA> {0:1}
15
+ # +1 DEST <RECEIVING_SYSTEM_NAME> {0:1} (See NOTE below)
16
+ # +1 DATE <TRANSMISSION_DATE> {0:1}
17
+ # +2 TIME <TIME_VALUE> {0:1}
18
+ # +1 SUBM @XREF:SUBM@ {1:1}
19
+ # +1 SUBN @XREF:SUBN@ {0:1}
20
+ # +1 FILE <FILE_NAME> {0:1}
21
+ # +1 COPR <COPYRIGHT_GEDCOM_FILE> {0:1}
22
+ # +1 GEDC {1:1}
23
+ # +2 VERS <VERSION_NUMBER> {1:1}
24
+ # +2 FORM <GEDCOM_FORM> {1:1}
25
+ # +1 CHAR <CHARACTER_SET> {1:1}
26
+ # +2 VERS <VERSION_NUMBER> {0:1}
27
+ # +1 LANG <LANGUAGE_OF_TEXT> {0:1}
28
+ # +1 PLAC {0:1}
29
+ # +2 FORM <PLACE_HIERARCHY> {1:1}
30
+ # +1 NOTE <GEDCOM_CONTENT_DESCRIPTION> {0:1}
31
+ # +2 [CONT|CONC] <GEDCOM_CONTENT_DESCRIPTION> {0:M}
32
+ # NOTE::
33
+ # Submissions to the Family History Department for Ancestral File submission or for clearing temple ordinances must use a
34
+ # DESTination of ANSTFILE or TempleReady.
35
+ #
36
+ # The header structure provides information about the entire transmission. The SOURce system name
37
+ # identifies which system sent the data. The DESTination system name identifies the intended receiving
38
+ # system.
39
+ #
40
+ # Additional GEDCOM standards will be produced in the future to reflect GEDCOM expansion and
41
+ # maturity. This requires the reading program to make sure it can read the GEDC.VERS and the
42
+ # GEDC.FORM values to insure proper readability. The CHAR tag is required. All character codes
43
+ # greater than 0x7F must be converted to ANSEL.
44
+ #
45
+ #The attributes are all arrays for the level +1 tags/records.
46
+ #* Those ending in _ref are GEDCOM XREF index keys
47
+ #* Those ending in _record are array of classes of that type.
48
+ #* The remainder are arrays of attributes that could be present in this record.
49
+ class Header_record < GEDCOMBase
50
+ attr_accessor :header_source_record, :destination, :date_record, :submitter_ref, :submission_ref
51
+ attr_accessor :file_name, :copyright, :gedcom_record, :character_set_record, :language_id
52
+ attr_accessor :place_record, :note_citation_record
53
+
54
+ ClassTracker << :Header_record
55
+
56
+ #new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
57
+ def initialize(*a)
58
+ super(*a)
59
+ @this_level = [ [:nodata, "HEAD", nil] ]
60
+ @sub_level = [ #level + 1
61
+ [:walk, nil,:header_source_record],
62
+ [:print, "DEST", :destination],
63
+ [:walk, nil, :date_record],
64
+ [:xref, "SUBM", :submitter_ref],
65
+ [:xref, "SUBN", :submission_ref],
66
+ [:print, "FILE", :file_name],
67
+ [:print, "COPR", :copyright],
68
+ [:walk, nil, :gedcom_record],
69
+ [:walk, nil, :character_set_record],
70
+ [:print, "LANG", :language_id],
71
+ [:walk, nil, :place_record],
72
+ [:walk, nil, :note_citation_record],
73
+ ]
74
+ end
75
+ end
@@ -0,0 +1,42 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #Internal representation of the GEDCOM SOUR record in a level 0 HEAD record.
4
+ #These SOUR records are not the same as level 0 SOUR records.
5
+ #
6
+ #=HEADER:=
7
+ # 0 HEAD {1:1}
8
+ # 1 SOUR <APPROVED_SYSTEM_ID> {1:1}
9
+ # +1 VERS <VERSION_NUMBER> {0:1}
10
+ # +1 NAME <NAME_OF_PRODUCT> {0:1}
11
+ # +1 CORP <NAME_OF_BUSINESS> {0:1}
12
+ # +2 <<ADDRESS_STRUCTURE>> {0:1}
13
+ # +1 DATA <NAME_OF_SOURCE_DATA> {0:1}
14
+ # +2 DATE <PUBLICATION_DATE> {0:1}
15
+ # +2 COPR <COPYRIGHT_SOURCE_DATA> {0:1}
16
+ # ...
17
+ #
18
+ # The SOURce system name identifies which system sent the data.
19
+ #
20
+ #The attributes are all arrays for the level +1 tags/records.
21
+ #* Those ending in _ref are GEDCOM XREF index keys
22
+ #* Those ending in _record are array of classes of that type.
23
+ #* The remainder are arrays of attributes that could be present in this record.
24
+ class Header_source_record < GEDCOMBase
25
+ attr_accessor :approved_system_id, :version, :name, :corporate_record, :header_data_record
26
+ attr_accessor :note_citation_record
27
+
28
+ ClassTracker << :Header_source_record
29
+
30
+ #new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
31
+ def initialize(*a)
32
+ super(*a)
33
+ @this_level = [ [:print, "SOUR", :approved_system_id] ]
34
+ @sub_level = [ #level + 1
35
+ [:print, "VERS", :version],
36
+ [:print, "NAME", :name],
37
+ [:walk, nil, :corporate_record],
38
+ [:walk, nil, :header_data_record],
39
+ [:walk, nil, :note_citation_record],
40
+ ]
41
+ end
42
+ end
@@ -0,0 +1,86 @@
1
+ require 'gedcom_base.rb'
2
+ require 'event_record.rb'
3
+
4
+ #Internal representation of the GEDCOM Individual_Attribute_Structure.
5
+ #Individual_attribute_record subclasses Event_record, as they share the same class attributes as events.
6
+ #
7
+ #=INDIVIDUAL_ATTRIBUTE_STRUCTURE:= {0:M} Note that this structure can occur many times an Individual_record.
8
+ # n SEX <SEX_VALUE> {0:1}
9
+ # +1 <<EVENT_DETAIL>> {0:1}
10
+ # n CAST <CASTE_NAME> {1:1}
11
+ # +1 <<EVENT_DETAIL>> {0:1}
12
+ # n DSCR <PHYSICAL_DESCRIPTION> {1:1}
13
+ # +1 <<EVENT_DETAIL>> {0:1}
14
+ # n EDUC <SCHOLASTIC_ACHIEVEMENT> {1:1}
15
+ # +1 <<EVENT_DETAIL>> {0:1}
16
+ # n IDNO <NATIONAL_ID_NUMBER> {1:1}
17
+ # +1 <<EVENT_DETAIL>> {0:1}
18
+ # n NATI <NATIONAL_OR_TRIBAL_ORIGIN> {1:1}
19
+ # +1 <<EVENT_DETAIL>> {0:1}
20
+ # n NCHI <COUNT_OF_CHILDREN> {1:1}
21
+ # +1 <<EVENT_DETAIL>> {0:1}
22
+ # n NMR <COUNT_OF_MARRIAGES> {1:1}
23
+ # +1 <<EVENT_DETAIL>> {0:1}
24
+ # n OCCU <OCCUPATION> {1:1}
25
+ # +1 <<EVENT_DETAIL>> {0:1}
26
+ # n PROP <POSSESSIONS> {1:1}
27
+ # +1 <<EVENT_DETAIL>> {0:1}
28
+ # n RELI <RELIGIOUS_AFFILIATION> {1:1}
29
+ # +1 <<EVENT_DETAIL>> {0:1}
30
+ # n RESI {1:1}
31
+ # +1 <<EVENT_DETAIL>> {0:1}
32
+ # n SSN <SOCIAL_SECURITY_NUMBER> {0:1}
33
+ # +1 <<EVENT_DETAIL>> {0:1}
34
+ # n TITL <NOBILITY_TYPE_TITLE> {1:1}
35
+ # +1 <<EVENT_DETAIL>> {0:1}
36
+ #
37
+ # Note:: The usage of IDNO requires that the subordinate TYPE tag be used to define what kind of
38
+ # number is assigned to IDNO.
39
+ #
40
+ # Also Note that SEX has been added here, and removed from the Individual_record. This allows SEX
41
+ # To be included multiple times, and have associated events (e.g. a sex change). I also do not check
42
+ # That the SEX_VALUE is M,F or U. to allow for the XXY, XXXY and X and other genetic anomolies
43
+ # associated with gender that might need to be recorded. None of this affects reading GEDCOM files,
44
+ # and will not affect the writing of them if you don't add an event, or use non-standard SEX_VALUEs.
45
+ #
46
+ #The attributes are all arrays for the level +1 tags/records.
47
+ #* Those ending in _ref are GEDCOM XREF index keys
48
+ #* Those ending in _record are array of classes of that type.
49
+ #* The remainder are arrays of attributes that could be present in this record.
50
+ class Individual_attribute_record < Event_record
51
+
52
+ ClassTracker << :Individual_attribute_record
53
+
54
+ def attr_type=(value)
55
+ @event_type = value
56
+ end
57
+ def attr_type
58
+ @event_type
59
+ end
60
+ def value=(value)
61
+ @event_status = value
62
+ end
63
+ def value
64
+ @event_status
65
+ end
66
+
67
+ def event_tag(tag)
68
+ case tag
69
+ when "SEX" then tag
70
+ when "CAST" then tag
71
+ when "DSCR" then tag
72
+ when "EDUC" then tag
73
+ when "IDNO" then tag
74
+ when "NATI" then tag
75
+ when "NCHI" then tag
76
+ when "NMR" then tag
77
+ when "OCCU" then tag
78
+ when "PROP" then tag
79
+ when "RELI" then tag
80
+ when "RESI" then tag
81
+ when "SSN" then tag
82
+ when "TITL" then tag
83
+ else super(tag)
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,128 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #Internal representation of the GEDCOM level 0 INDI record type
4
+ #
5
+ #=INDIVIDUAL_RECORD:=
6
+ # n @XREF:INDI@ INDI {1:1}
7
+ # +1 RESN <RESTRICTION_NOTICE> {0:1}
8
+ # +1 <<PERSONAL_NAME_STRUCTURE>> {0:M}
9
+ # +1 <<INDIVIDUAL_EVENT_STRUCTURE>> {0:M}
10
+ # +1 <<INDIVIDUAL_ATTRIBUTE_STRUCTURE>> {0:M}
11
+ # +1 <<LDS_INDIVIDUAL_ORDINANCE>> {0:M}
12
+ # +1 <<CHILD_TO_FAMILY_LINK>> {0:M}
13
+ # +1 <<SPOUSE_TO_FAMILY_LINK>> {0:M}
14
+ # +1 SUBM @<XREF:SUBM>@ {0:M}
15
+ # +1 <<ASSOCIATION_STRUCTURE>> {0:M}
16
+ # +1 ALIA @<XREF:INDI>@ {0:M}
17
+ # +1 ANCI @<XREF:SUBM>@ {0:M}
18
+ # +1 DESI @<XREF:SUBM>@ {0:M}
19
+ # +1 <<SOURCE_CITATION>> {0:M}
20
+ # +1 <<MULTIMEDIA_LINK>> {0:M}
21
+ # +1 <<NOTE_STRUCTURE>> {0:M}
22
+ # +1 RFN <PERMANENT_RECORD_FILE_NUMBER> {0:1}
23
+ # +1 AFN <ANCESTRAL_FILE_NUMBER> {0:1}
24
+ # +1 REFN <USER_REFERENCE_NUMBER> {0:M}
25
+ # +2 TYPE <USER_REFERENCE_TYPE> {0:1}
26
+ # +1 RIN <AUTOMATED_RECORD_ID> {0:1}
27
+ # +1 <<CHANGE_DATE>> {0:1}
28
+ #
29
+ # The individual record is a compilation of facts, known or discovered, about an individual. Sometimes
30
+ # these facts are from different sources. This form allows documentation of the source where each of
31
+ # the facts were discovered.
32
+ #
33
+ # The normal lineage links are shown through the use of pointers from the individual to a family
34
+ # through either the FAMC tag or the FAMS tag. The FAMC tag provides a pointer to a family where
35
+ # this person is a child. The FAMS tag provides a pointer to a family where this person is a spouse or
36
+ # parent. The <<CHILD_TO_FAMILY_LINK>> (see page 27) structure contains a FAMC pointer
37
+ # which is required to show any child to parent linkage for pedigree navigation. The
38
+ # <<CHILD_TO_FAMILY_LINK>> structure also indicates whether the pedigree link represents a
39
+ # birth lineage, an adoption lineage, or a sealing lineage.
40
+ #
41
+ # Linkage between a child and the family they belonged to at the time of an event can also optionally
42
+ # be shown by a FAMC pointer subordinate to the appropriate event. For example, a FAMC pointer
43
+ # subordinate to an adoption event would show which family adopted this individual. Biological parent
44
+ # or parents can be indicated by a FAMC pointer subordinate to the birth event. The FAMC tag can
45
+ # also optionally be used subordinate to an ADOPtion, or BIRTh event to differentiate which set of
46
+ # parents were related by adoption, sealing, or birth.
47
+ #
48
+ # I removed SEX from INDI and added it to the Individual_attribute_record class.
49
+ #
50
+ # Other associations or relationships are represented by the ASSOciation tag. The person's relation
51
+ # or association is the person being pointed to. The association or relationship is stated by the value
52
+ # on the subordinate RELA line. For example:
53
+ # 0 @I1@ INDI
54
+ # 1 NAME Fred/Jones/
55
+ # 1 ASSO @I2@
56
+ # 2 RELA Godfather
57
+ #
58
+ #The attributes are all arrays for the level +1 tags/records.
59
+ #* Those ending in _ref are GEDCOM XREF index keys
60
+ #* Those ending in _record are array of classes of that type.
61
+ #* The remainder are arrays of attributes that could be present in this record.
62
+ class Individual_record < GEDCOMBase
63
+ attr_accessor :individual_ref, :restriction, :name_record, :event_record, :individual_attribute_record, :alias_ref
64
+ attr_accessor :families_individuals, :association_record, :submitter_ref, :ancestor_interest_ref, :descendant_interest_ref
65
+ attr_accessor :source_citation_record, :multimedia_citation_record, :note_citation_record
66
+ attr_accessor :registered_ref_id, :lds_ancestral_file_no, :refn_record, :automated_record_id, :change_date_record
67
+
68
+ ClassTracker << :Individual_record
69
+
70
+ #new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
71
+ def initialize(*a)
72
+ super(*a)
73
+ @this_level = [ [:xref, "INDI", :individual_ref] ]
74
+ @sub_level = [ #level 1
75
+ [:print, "RESN", :restriction],
76
+ [:walk, nil, :name_record],
77
+ [:walk, nil, :individual_attribute_record],
78
+ [:walk, nil, :event_record],
79
+ [:walk, nil, :families_individuals],
80
+ [:walk, nil, :association_record],
81
+ [:xref, "ALIA", :alias_ref],
82
+ [:xref, "ANCI", :ancestor_interest_ref],
83
+ [:xref, "DESI", :descendant_interest_ref],
84
+ [:xref, "SUBM", :submitter_ref],
85
+ [:walk, nil, :multimedia_citation_record ],
86
+ [:walk, nil, :source_citation_record ],
87
+ [:walk, nil, :note_citation_record ],
88
+ [:print, "RFN", :registered_ref_id],
89
+ [:print, "AFN", :lds_ancestral_file_no],
90
+ [:walk, nil, :refn_record ],
91
+ [:walk, nil, :change_date_record],
92
+ [:print, "RIN", :automated_record_id ],
93
+ ]
94
+ end
95
+
96
+ def id
97
+ #temporary
98
+ @individual_ref
99
+ end
100
+
101
+ def parents_family
102
+ parents_family = []
103
+ @families_individuals.each { |m| parents_family << m.parents_family_ref if m.relationship_type == "FAMC"}
104
+ parent_family
105
+ end
106
+
107
+ def spouses
108
+ spouses = []
109
+ @families_individuals.each { |m| spouses << m.own_family if m.relationship_type == "FAMS"}
110
+ spouses
111
+ end
112
+
113
+ def birth
114
+ if @event_record != nil
115
+ @event_record.each { |e| if e.is_event('BIRT') then return e end }
116
+ else
117
+ nil
118
+ end
119
+ end
120
+
121
+ def death
122
+ if @event_record != nil
123
+ @event_record.each { |e| if e.is_event('DEAT') then return e end }
124
+ else
125
+ nil
126
+ end
127
+ end
128
+ end
@@ -0,0 +1,55 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #Internal representation of a reference to the GEDCOM level 0 OBJE record type
4
+ #GEDCOM has both inline OBJE records and references to level 0 OBJE records.
5
+ #both are stored stored in a Multimedia_record class and both get referenced through this class.
6
+ #
7
+ #=MULTIMEDIA_LINK:=
8
+ # n OBJE @<XREF:OBJE>@ {1:1}
9
+ #
10
+ # This structure provides two options in handling the GEDCOM multimedia interface. The first
11
+ # alternative (embedded) includes all of the data, including the multimedia object, within the
12
+ # transmission file. The embedded method includes pointers to GEDCOM records that contain
13
+ # encoded image or sound objects. Each record represents a multimedia object or object fragment. An
14
+ # object fragment is created by breaking the multimedia files into several multimedia object records of
15
+ # 32K or less. These fragments are tied together by chaining from one multimedia object fragment to
16
+ # the next in sequence. This procedure will help manage the size of a multimedia GEDCOM record so
17
+ # that existing systems which are not expecting large multimedia records may discard the records
18
+ # without crashing due to the size of the record. Systems which handle embedded multimedia can
19
+ # reconstitute the multimedia fragments by decoding the object fragments and concatenating them to
20
+ # the assigned multimedia file.
21
+ #
22
+ # This second method allows the GEDCOM context to be connected to an external multimedia file.
23
+ # GEDCOM defines this in the MULTIMEDIA_LINK definition, but I have put it into the Multimedia_record.
24
+ # as the attributes are the same, except BLOB becomes FILE. A Multimedia_citation_record is also created
25
+ # to make all references to Multimedia records consistent.
26
+ #
27
+ # This process is only managed by GEDCOM in the sense that the appropriate file name is included in
28
+ # the GEDCOM file in context, but the maintenance and transfer of the multimedia files are external to
29
+ # GEDCOM. The parser can just treat this as a comment and doesn't check for the file being present.
30
+ #
31
+ #The attributes are all arrays for the level +1 tags/records.
32
+ #* Those ending in _ref are GEDCOM XREF index keys
33
+ #* Those ending in _record are array of classes of that type.
34
+ #* The remainder are arrays of attributes that could be present in this record.
35
+ class Multimedia_citation_record < GEDCOMBase
36
+ attr_accessor :multimedia_ref, :multimedia_record
37
+ attr_accessor :note_citation_record
38
+
39
+ ClassTracker << :Multimedia_citation_record
40
+
41
+ def to_gedcom(level=0)
42
+ if @multimedia_ref != nil
43
+ @this_level = [ [:xref, "OBJE", :multimedia_ref] ]
44
+ @sub_level = [#level 1
45
+ [:walk, nil, :note_citation_record ],
46
+ ]
47
+ else
48
+ @this_level = [ [:walk, nil, :multimedia_record] ]
49
+ @sub_level = [#level 1
50
+ ]
51
+ end
52
+ super(level)
53
+ end
54
+ end
55
+