gedcom 0.9.2 → 0.9.3

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.
data/History.txt CHANGED
@@ -7,5 +7,7 @@
7
7
  Required adding IndividualRecord.child? and IndividualRecord.spouse? for tests.
8
8
  Fixed bug in IndividualRecord.spouses and IndividualRecord.parents_family as neither worked and were used by tests.
9
9
  * Removed 'require chart.rb' which was left in production code by mistake
10
+ * Added in the GEDCOM 5.5.1 Draft changes. Most changes are alternatives to the 5.5 standard, but the Multimedia record
11
+ File and Format structure is different, so these are now classes, rather than attributes.
10
12
 
11
13
 
data/Manifest.txt CHANGED
@@ -47,6 +47,14 @@ lib/gedcom/trailer_record.rb
47
47
  lib/gedcom/transmission.rb
48
48
  lib/gedcom/transmission_base.rb
49
49
  lib/gedcom/xref.rb
50
+ lib/gedcom/multimedia_file_record.rb
51
+ lib/gedcom/multimedia_format_record.rb
52
+ lib/gedcom/placename_map_record.rb
53
+ lib/gedcom/placename_phonetic_record.rb
54
+ lib/gedcom/placename_romanized_record.rb
55
+ lib/gedcom/name_phonetic_record.rb
56
+ lib/gedcom/name_romanized_record.rb
57
+ lib/gedcom/copyright_record.rb
50
58
  lib/gedcom.rb
51
59
  lib/parser/class_tracker.rb
52
60
  lib/parser/ged_line.rb
data/lib/gedcom.rb CHANGED
@@ -64,7 +64,7 @@ require 'gedcom_parser.rb'
64
64
  #require 'chart.rb'
65
65
 
66
66
  class Gedcom
67
- VERSION = '0.9.2'
67
+ VERSION = '0.9.3'
68
68
  attr_accessor :transmissions
69
69
 
70
70
  def initialize(transmission = nil)
@@ -52,6 +52,26 @@ require 'gedcom_base.rb'
52
52
  #* Those ending in _ref are GEDCOM XREF index keys
53
53
  #* Those ending in _record are array of classes of that type.
54
54
  #* The remainder are arrays of attributes that could be present in this record.
55
+ #
56
+ # GEDCOM 5.5.1 Draft adds (at same level as ADDR)
57
+ # I have not included these in the Address_record, but include them in the parent
58
+ # records that include ADDRESS_STRUCTURE. This is functionally equivalent, as they are not
59
+ # sub-records of ADDR, but at the same level.
60
+ #
61
+ # n EMAIL <ADDRESS_EMAIL> {0:3}
62
+ # n FAX <ADDRESS_FAX> {0:3}
63
+ # n WWW <ADDRESS_WEB_PAGE> {0:3}
64
+ #
65
+ #==ADDRESS_EMAIL:= {SIZE=5:120}
66
+ # An electronic address that can be used for contact such as an email address.
67
+ #
68
+ #== ADDRESS_FAX:= {SIZE=5:60}
69
+ # A FAX telephone number appropriate for sending data facsimiles.
70
+ #
71
+ #==ADDRESS_WEB_PAGE:= {SIZE=5:120}
72
+ # The world wide web page address.
73
+ #
74
+
55
75
  class Address_record < GEDCOMBase
56
76
  attr_accessor :address, :address_line1, :address_line2, :city, :state, :post_code, :country, :address_type
57
77
  attr_accessor :note_citation_record
@@ -0,0 +1,45 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #Copyright_record was introduced in 0.9.3 to allow CONT and CONC tags after the COPR record.
4
+ #Gedcom 5.5
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
+ # ...
16
+ #GEDCOM 5.5.1
17
+ #=HEADER:=
18
+ # n HEAD {1:1}
19
+ # +1 SOUR <APPROVED_SYSTEM_ID> {1:1}
20
+ # +2 VERS <VERSION_NUMBER> {0:1}
21
+ # +2 NAME <NAME_OF_PRODUCT> {0:1}
22
+ # +2 CORP <NAME_OF_BUSINESS> {0:1}
23
+ # +3 <<ADDRESS_STRUCTURE>> {0:1}
24
+ # +2 DATA <NAME_OF_SOURCE_DATA> {0:1}
25
+ # +3 DATE <PUBLICATION_DATE> {0:1}
26
+ # +3 COPR <COPYRIGHT_SOURCE_DATA> {0:1}
27
+ # +4 [CONT|CONC]<COPYRIGHT_SOURCE_DATA> {0:M}
28
+ # ...
29
+
30
+ class Copyright_record < GEDCOMBase
31
+ attr_accessor :copyright
32
+ attr_accessor :note_citation_record
33
+
34
+ ClassTracker << :Copyright_record
35
+
36
+ #new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
37
+ def initialize(*a)
38
+ super(*a)
39
+ @this_level = [ [:cont, "COPR", :copyright] ]
40
+ @sub_level = [ #level + 1
41
+ [:walk, nil, :note_citation_record], #to allow for user defined subtags
42
+ ]
43
+ end
44
+
45
+ end
@@ -17,8 +17,28 @@ require 'gedcom_base.rb'
17
17
  #* Those ending in _ref are GEDCOM XREF index keys
18
18
  #* Those ending in _record are array of classes of that type.
19
19
  #* The remainder are arrays of attributes that could be present in this record.
20
+ #
21
+ # GEDCOM 5.5.1 Draft adds (at same level as ADDR)
22
+ # I have not included these in the Address_record, but include them in the parent
23
+ # records that include ADDRESS_STRUCTURE. This is functionally equivalent, as they are not
24
+ # sub-records of ADDR, but at the same level.
25
+ #
26
+ # n EMAIL <ADDRESS_EMAIL> {0:3}
27
+ # n FAX <ADDRESS_FAX> {0:3}
28
+ # n WWW <ADDRESS_WEB_PAGE> {0:3}
29
+ #
30
+ #==ADDRESS_EMAIL:= {SIZE=5:120}
31
+ # An electronic address that can be used for contact such as an email address.
32
+ #
33
+ #== ADDRESS_FAX:= {SIZE=5:60}
34
+ # A FAX telephone number appropriate for sending data facsimiles.
35
+ #
36
+ #==ADDRESS_WEB_PAGE:= {SIZE=5:120}
37
+ # The world wide web page address.
38
+ #
20
39
  class Corporate_record < GEDCOMBase
21
40
  attr_accessor :company_name, :phonenumber, :address_record
41
+ attr_accessor :address_email, :address_fax, :address_web_page #GEDCOM 5.5.1 Draft
22
42
  attr_accessor :note_citation_record
23
43
 
24
44
  ClassTracker << :Corporate_record
@@ -29,6 +49,9 @@ class Corporate_record < GEDCOMBase
29
49
  @this_level = [ [:print, "CORP", :company_name] ]
30
50
  @sub_level = [ #level + 1
31
51
  [:print, "PHON", :phonenumber],
52
+ [:print, "EMAIL", :address_email],
53
+ [:print, "WWW", :address_web_page],
54
+ [:print, "FAX", :address_fax],
32
55
  [:walk, nil, :address_record],
33
56
  [:walk, nil, :note_citation_record],
34
57
  ]
@@ -147,7 +147,7 @@ require 'gedcom_base.rb'
147
147
  #
148
148
  # The following are equivalent and interchangeable:
149
149
  # Short form Long Form
150
- # ---------— ---------—-
150
+ # ---------- -----------
151
151
  # 1852 BET 1 JAN 1852 AND 31 DEC 1852
152
152
  # 1852 BET 1 JAN 1852 AND DEC 1852
153
153
  # 1852 BET JAN 1852 AND 31 DEC 1852
@@ -208,17 +208,13 @@ class Date_record < GEDCOMBase
208
208
  #GEDCOM says that this should be the most vaild record. If you need all the dates, use date_value,
209
209
  #which will give you an array of DATE values.
210
210
  def date
211
- if @date_value
212
- @date_value.first
213
- else
214
- ''
215
- end
211
+ @date_value ? @date_value.first : ''
216
212
  end
217
213
 
218
214
  #If you want just one date, then this returns the first TIME record (probably the only one).
219
215
  #GEDCOM says that this should be the most vaild record. If you need all the dates, use date_value,
220
216
  #which will give you an array of TIME values.
221
217
  def time
222
- @time_value.first
218
+ @time_value != nil ? @time_value.first : ''
223
219
  end
224
220
  end
@@ -134,7 +134,7 @@ require 'gedcom_base.rb'
134
134
  # change its basic process. The form of using the TYPE tag with defined event tags has not been used
135
135
  # by very many products. The MARR tag could be subordinated with a TYPE tag and
136
136
  # EVENT_DESCRIPTOR value of Common Law. Other possible descriptor values might include
137
- # "Childbirthunmarried," "Common Law," or "Tribal Custom," for example. The event descriptor
137
+ # "Childbirth-unmarried," "Common Law," or "Tribal Custom," for example. The event descriptor
138
138
  # should use the same word or phrase and in the same language, when possible, as was used by the
139
139
  # recorder of the event. Systems that display data from the GEDCOM form should be able to display the
140
140
  # descriptor value in their screen or printed output.
@@ -153,6 +153,25 @@ require 'gedcom_base.rb'
153
153
  #* Those ending in _ref are GEDCOM XREF index keys
154
154
  #* Those ending in _record are array of classes of that type.
155
155
  #* The remainder are arrays of attributes that could be present in this record.
156
+ #
157
+ # GEDCOM 5.5.1 Draft adds (at same level as ADDR)
158
+ # I have not included these in the Address_record, but include them in the parent
159
+ # records that include ADDRESS_STRUCTURE. This is functionally equivalent, as they are not
160
+ # sub-records of ADDR, but at the same level.
161
+ #
162
+ # n EMAIL <ADDRESS_EMAIL> {0:3}
163
+ # n FAX <ADDRESS_FAX> {0:3}
164
+ # n WWW <ADDRESS_WEB_PAGE> {0:3}
165
+ #
166
+ #==ADDRESS_EMAIL:= {SIZE=5:120}
167
+ # An electronic address that can be used for contact such as an email address.
168
+ #
169
+ #== ADDRESS_FAX:= {SIZE=5:60}
170
+ # A FAX telephone number appropriate for sending data facsimiles.
171
+ #
172
+ #==ADDRESS_WEB_PAGE:= {SIZE=5:120}
173
+ # The world wide web page address.
174
+ #
156
175
  class Event_record < GEDCOMBase
157
176
  attr_accessor :restriction #not standard at the event level, but we might want this in DB.
158
177
  attr_accessor :event_type, :event_descriptor
@@ -160,6 +179,7 @@ class Event_record < GEDCOMBase
160
179
  attr_accessor :agency, :cause_record, :source_citation_record, :submitter_ref
161
180
  attr_accessor :multimedia_citation_record, :note_citation_record, :event_age_record, :adoption_record
162
181
  attr_accessor :lds_temp_code, :lds_date_status, :lds_slgc_family_ref
182
+ attr_accessor :address_email, :address_fax, :address_web_page, :religion #GEDCOM 5.5.1 Draft
163
183
 
164
184
  ClassTracker << :Event_record
165
185
 
@@ -175,6 +195,9 @@ class Event_record < GEDCOMBase
175
195
  [:walk, nil, :place_record],
176
196
  [:walk, nil, :address_record],
177
197
  [:print, "PHON", :phonenumber],
198
+ [:print, "EMAIL", :address_email],
199
+ [:print, "WWW", :address_web_page],
200
+ [:print, "FAX", :address_fax],
178
201
  [:print, "AGE", :age],
179
202
  [:walk, nil, :event_age_record],
180
203
  [:print, "AGNC", :agency],
@@ -184,6 +207,7 @@ class Event_record < GEDCOMBase
184
207
  [:xref, "SUBM", :submitter_ref],
185
208
  [:walk, nil, :adoption_record],
186
209
  [:xref, "FAMC", :lds_slgc_family_ref],
210
+ [:print, "RELI", :religion], #GEDCOM 5.5.1
187
211
  ]
188
212
  end
189
213
 
@@ -44,6 +44,7 @@ class Families_individuals < GEDCOMBase
44
44
  attr_accessor :relationship_type, :parents_family_ref, :family_ref, :pedigree
45
45
  attr_accessor :note_citation_record
46
46
  attr_accessor :source_citation_record #Only for FAMS (where did I get this idea from ?)
47
+ attr_accessor :child_linkage_status #GEDCOM 5.5.1
47
48
 
48
49
  ClassTracker << :Families_individuals
49
50
 
@@ -53,6 +54,7 @@ class Families_individuals < GEDCOMBase
53
54
  ]
54
55
  @sub_level = [ #level 1
55
56
  [:print, "PEDI", :pedigree ], #Only for FAMC
57
+ [:print, "STAT", :pedigree ], #Only for FAMC
56
58
  [:walk, nil, :source_citation_record ], #Only for FAMS (where did I get this idea from ?)
57
59
  [:walk, nil, :note_citation_record ]
58
60
  ]
@@ -1,5 +1,7 @@
1
+ #Included by transmission.
1
2
  require 'address_record.rb'
2
3
  require 'adoption_record.rb'
4
+ require 'association_record.rb'
3
5
  require 'cause_record.rb'
4
6
  require 'change_date_record.rb'
5
7
  require 'character_set_record.rb'
@@ -8,19 +10,19 @@ require 'citation_event_type_record.rb'
8
10
  require 'corporate_record.rb'
9
11
  require 'date_record.rb'
10
12
  require 'encoded_line_record.rb'
13
+ require 'events_list_record.rb'
11
14
  require 'event_age_record.rb'
12
15
  require 'event_record.rb'
13
- require 'events_list_record.rb'
14
16
  require 'families_individuals.rb'
15
17
  require 'family_record.rb'
16
18
  require 'gedcom_base.rb'
17
19
  require 'gedcom_record.rb'
20
+ require 'ged_string.rb'
18
21
  require 'header_data_record.rb'
19
22
  require 'header_record.rb'
20
23
  require 'header_source_record.rb'
21
24
  require 'individual_attribute_record.rb'
22
25
  require 'individual_record.rb'
23
- require 'association_record.rb'
24
26
  require 'multimedia_citation_record.rb'
25
27
  require 'multimedia_record.rb'
26
28
  require 'name_record.rb'
@@ -40,4 +42,12 @@ require 'text_record.rb'
40
42
  require 'trailer_record.rb'
41
43
  require 'transmission_base.rb'
42
44
  require 'xref.rb'
43
- require 'ged_string.rb'
45
+ #After 5.5.1
46
+ require 'multimedia_file_record.rb'
47
+ require 'multimedia_format_record.rb'
48
+ require 'placename_map_record.rb'
49
+ require 'placename_phonetic_record.rb'
50
+ require 'placename_romanized_record.rb'
51
+ require 'name_phonetic_record.rb'
52
+ require 'name_romanized_record.rb'
53
+ require 'copyright_record.rb'
@@ -275,6 +275,10 @@ class GEDCOMBase
275
275
  #validate that the record referenced by the XREF actually exists in this transmission.
276
276
  #Genearte a warning if it does not. It does not stop the processing of this line.
277
277
  def xref_check( level, tag, xref )
278
+ if xref.class != Xref
279
+ print "#{level+1} XREF_CHECK ****************#{level}, #{tag}. #{xref.class} != Xref?\n"
280
+ return
281
+ end
278
282
  if @transmission != nil && @transmission.find(xref.index, xref.xref_value) == nil
279
283
  #Warning message that reference points to an unknown target.
280
284
  print "#{level+1} NOTE ****************#{level}, #{tag} Key not found: #{xref.index} #{xref.xref_value}\n"
@@ -31,7 +31,7 @@ require 'gedcom_base.rb'
31
31
  #* Those ending in _record are array of classes of that type.
32
32
  #* The remainder are arrays of attributes that could be present in this record.
33
33
  class Header_data_record < GEDCOMBase
34
- attr_accessor :data_source, :date, :copyright
34
+ attr_accessor :data_source, :date, :copyright_record
35
35
  attr_accessor :note_citation_record
36
36
 
37
37
  ClassTracker << :Header_data_record
@@ -42,8 +42,14 @@ class Header_data_record < GEDCOMBase
42
42
  @this_level = [ [:print, "DATA", :data_source] ]
43
43
  @sub_level = [ #level + 1
44
44
  [:print, "DATE", :date],
45
- [:print, "COPR", :copyright],
45
+ #[:print, "COPR", :copyright], #GEDCOM5.5
46
+ [:walk, nil, :copyright_record], #GEDCOM5.5.1 "COPR"
46
47
  [:walk, nil, :note_citation_record],
47
48
  ]
48
49
  end
50
+
51
+ def copyright
52
+ copyright_record != nil ? copyright_record.first.copyright : nil
53
+ end
54
+
49
55
  end
@@ -71,5 +71,6 @@ class Header_record < GEDCOMBase
71
71
  [:walk, nil, :place_record],
72
72
  [:walk, nil, :note_citation_record],
73
73
  ]
74
- end
74
+ end
75
+
75
76
  end
@@ -103,6 +103,7 @@ class Individual_attribute_record < Event_record
103
103
  when "RESI" then tag
104
104
  when "SSN" then tag
105
105
  when "TITL" then tag
106
+ when "FACT" then tag #GEDCOM 5.5.1
106
107
  else super(tag)
107
108
  end
108
109
  end
@@ -6,6 +6,11 @@ require 'gedcom_base.rb'
6
6
  #
7
7
  #=MULTIMEDIA_LINK:=
8
8
  # n OBJE @<XREF:OBJE>@ {1:1}
9
+ #| n OBJE
10
+ # +1 FILE <MULTIMEDIA_FILE_REFN>
11
+ # +2 FORM <MULTIMEDIA_FORMAT>
12
+ # +3 MEDI <SOURCE_MEDIA_TYPE>
13
+ # +1 TITL <DESCRIPTIVE_TITLE>
9
14
  #
10
15
  # This structure provides two options in handling the GEDCOM multimedia interface. The first
11
16
  # alternative (embedded) includes all of the data, including the multimedia object, within the
@@ -41,12 +46,12 @@ class Multimedia_citation_record < GEDCOMBase
41
46
  def to_gedcom(level=0)
42
47
  if @multimedia_ref != nil
43
48
  @this_level = [ [:xref, "OBJE", :multimedia_ref] ]
44
- @sub_level = [#level 1
49
+ @sub_level = [#level +1
45
50
  [:walk, nil, :note_citation_record ],
46
51
  ]
47
52
  else
48
53
  @this_level = [ [:walk, nil, :multimedia_record] ]
49
- @sub_level = [#level 1
54
+ @sub_level = [#level +1
50
55
  ]
51
56
  end
52
57
  super(level)
@@ -0,0 +1,80 @@
1
+ require 'gedcom_base.rb'
2
+
3
+ #
4
+ #=GEDCOM 5.5.1
5
+ #=MULTIMEDIA_LINK:=
6
+ # n OBJE <XREF> {1:1} is a reference to level 0 multimedia record.
7
+ # |
8
+ # n OBJE {1:1} is inline reference to an external file, rather than multimedia record.
9
+ # +1 FILE <MULTIMEDIA_FILE_REFN> {1:M} Now 1:M in 5.5.1, was 1:1 in 5.5
10
+ # +2 FORM <MULTIMEDIA_FORMAT> {1:1} Was as level 1 in GEDCOM 5.5
11
+ # +3 MEDI <SOURCE_MEDIA_TYPE> {0:1} New in 5.5.1
12
+ # +1 TITL <DESCRIPTIVE_TITLE> {0:1}
13
+ #
14
+ # No blobs in 5.5.1
15
+ #
16
+ #The attributes are all arrays for the level +1 tags/records.
17
+ #* Those ending in _ref are GEDCOM XREF index keys
18
+ #* Those ending in _record are array of classes of that type.
19
+ #* The remainder are arrays of attributes that could be present in this record.
20
+
21
+ class Multimedia_file_record < GEDCOMBase
22
+ attr_accessor :multimedia_format_record, :filename
23
+ #attr_accessor :title #Level above in the link version
24
+ attr_accessor :note_citation_record #for user defined tags
25
+
26
+ ClassTracker << :Multimedia_file_record
27
+
28
+ def to_gedcom(level=0)
29
+
30
+ @this_level = [ [:print, "FILE", :filename]]
31
+ @sub_level = [#level 1
32
+ #[:print, "TITL", :title ], #For OBJE record version
33
+ [:walk, nil, :multimedia_format_record ], # "FORM"
34
+ [:walk, nil, :note_citation_record ], #for user defined tags
35
+ ]
36
+
37
+ super(level)
38
+ end
39
+
40
+
41
+ end
42
+
43
+ #=GEDCOM 5.5.1
44
+ #Almost the same structure inline in OBJE record.
45
+ # Note TITL subordinate to FILE, rather than at same level.
46
+ # TYPE used, where MEDI used in Link version.
47
+ #=MULTIMEDIA_RECORD:=
48
+ # 0 @XREF:OBJE@ OBJE {0:M}
49
+ # +1 FILE <MULTIMEDIA_FILE_REFN> {1:M} New in 5.5.1
50
+ # +2 FORM <MULTIMEDIA_FORMAT> {1:1} Was as level 1 in GEDCOM 5.5
51
+ # +3 TYPE <SOURCE_MEDIA_TYPE> {0:1} New in 5.5.1
52
+ # +2 TITL <DESCRIPTIVE_TITLE> {0:1} Was as level 1 in GEDCOM 5.5
53
+ # ....
54
+ #
55
+ #The attributes are all arrays for the level +1 tags/records.
56
+ #* Those ending in _ref are GEDCOM XREF index keys
57
+ #* Those ending in _record are array of classes of that type.
58
+ #* The remainder are arrays of attributes that could be present in this record.
59
+
60
+ class Multimedia_obje_file_record < GEDCOMBase
61
+ attr_accessor :multimedia_obje_format_record, :filename
62
+ attr_accessor :title #Level above in the link version
63
+ attr_accessor :note_citation_record #for user defined tags
64
+
65
+ ClassTracker << :Multimedia_obje_file_record
66
+
67
+ def to_gedcom(level=0)
68
+
69
+ @this_level = [ [:print, "FILE", :filename]]
70
+ @sub_level = [#level 1
71
+ [:print, "TITL", :title ], #For OBJE record version
72
+ [:walk, nil, :multimedia_obje_format_record ], # "FORM"
73
+ [:walk, nil, :note_citation_record ], #for user defined tags
74
+ ]
75
+
76
+ super(level)
77
+ end
78
+
79
+
80
+ end