gedcom 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +74 -0
- data/README.txt +129 -0
- data/Rakefile +13 -0
- data/lib/gedcom.rb +105 -0
- data/lib/gedcom/address_record.rb +77 -0
- data/lib/gedcom/adoption_record.rb +57 -0
- data/lib/gedcom/association_record.rb +79 -0
- data/lib/gedcom/cause_record.rb +45 -0
- data/lib/gedcom/change_date_record.rb +39 -0
- data/lib/gedcom/character_set_record.rb +41 -0
- data/lib/gedcom/citation_data_record.rb +49 -0
- data/lib/gedcom/citation_event_type_record.rb +42 -0
- data/lib/gedcom/corporate_record.rb +36 -0
- data/lib/gedcom/date_record.rb +206 -0
- data/lib/gedcom/encoded_line_record.rb +34 -0
- data/lib/gedcom/event_age_record.rb +36 -0
- data/lib/gedcom/event_record.rb +258 -0
- data/lib/gedcom/events_list_record.rb +61 -0
- data/lib/gedcom/families_individuals.rb +79 -0
- data/lib/gedcom/family_record.rb +89 -0
- data/lib/gedcom/gedcom_all.rb +41 -0
- data/lib/gedcom/gedcom_base.rb +337 -0
- data/lib/gedcom/gedcom_record.rb +44 -0
- data/lib/gedcom/header_data_record.rb +49 -0
- data/lib/gedcom/header_record.rb +75 -0
- data/lib/gedcom/header_source_record.rb +42 -0
- data/lib/gedcom/individual_attribute_record.rb +86 -0
- data/lib/gedcom/individual_record.rb +128 -0
- data/lib/gedcom/multimedia_citation_record.rb +55 -0
- data/lib/gedcom/multimedia_record.rb +72 -0
- data/lib/gedcom/name_record.rb +58 -0
- data/lib/gedcom/note_citation_record.rb +37 -0
- data/lib/gedcom/note_record.rb +61 -0
- data/lib/gedcom/place_record.rb +46 -0
- data/lib/gedcom/refn_record.rb +32 -0
- data/lib/gedcom/repository_caln.rb +33 -0
- data/lib/gedcom/repository_citation_record.rb +43 -0
- data/lib/gedcom/repository_record.rb +41 -0
- data/lib/gedcom/source_citation_record.rb +74 -0
- data/lib/gedcom/source_record.rb +84 -0
- data/lib/gedcom/source_scope_record.rb +35 -0
- data/lib/gedcom/submission_record.rb +53 -0
- data/lib/gedcom/submitter_record.rb +53 -0
- data/lib/gedcom/text_record.rb +31 -0
- data/lib/gedcom/trailer_record.rb +22 -0
- data/lib/gedcom/transmission.rb +103 -0
- data/lib/gedcom/transmission_base.rb +267 -0
- data/lib/parser/class_tracker.rb +33 -0
- data/lib/parser/ged_line.rb +99 -0
- data/lib/parser/gedcom_parser.rb +798 -0
- data/lib/parser/instruction.rb +14 -0
- data/lib/parser/parse_state.rb +49 -0
- data/test/test_gedcom.rb +7 -0
- data/test_data/Document.RTF +1 -0
- data/test_data/Document.tex +1 -0
- data/test_data/ImgFile.BMP +0 -0
- data/test_data/ImgFile.GIF +0 -0
- data/test_data/ImgFile.JPG +0 -0
- data/test_data/ImgFile.MAC +0 -0
- data/test_data/ImgFile.PCX +0 -0
- data/test_data/ImgFile.PIC +0 -0
- data/test_data/ImgFile.PNG +0 -0
- data/test_data/ImgFile.PSD +0 -0
- data/test_data/ImgFile.TGA +0 -0
- data/test_data/ImgFile.TIF +0 -0
- data/test_data/README.txt +1 -16
- data/test_data/TGC551.ged +1 -0
- data/test_data/TGC551LF.ged +2162 -0
- data/test_data/TGC55C.ged +1 -0
- data/test_data/TGC55CLF.ged +2202 -0
- data/test_data/force.wav +0 -0
- data/test_data/suntun.mov +0 -0
- data/test_data/top.mpg +0 -0
- metadata +140 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Internal representation of the GEDCOM OBJE record type
|
4
|
+
#GEDCOM has both inline OBJE records and references to level 0 OBJE records.
|
5
|
+
#both are stored here and referenced through a Multimedia_citation_record class.
|
6
|
+
#
|
7
|
+
#=MULTIMEDIA_RECORD:=
|
8
|
+
# 0 @XREF:OBJE@ OBJE {0:M}
|
9
|
+
# +1 FORM <MULTIMEDIA_FORMAT> {1:1}
|
10
|
+
# +1 TITL <DESCRIPTIVE_TITLE> {0:1}
|
11
|
+
# +1 <<NOTE_STRUCTURE>> {0:M}
|
12
|
+
# +1 BLOB {1:1}
|
13
|
+
# +2 CONT <ENCODED_MULTIMEDIA_LINE> {1:M}
|
14
|
+
# +1 OBJE @<XREF:OBJE>@ {0:1} (chain to continued object)
|
15
|
+
# +1 REFN <USER_REFERENCE_NUMBER> {0:M}
|
16
|
+
# +2 TYPE <USER_REFERENCE_TYPE> {0:1}
|
17
|
+
# +1 RIN <AUTOMATED_RECORD_ID> {0:1}
|
18
|
+
# +1 <<CHANGE_DATE>> {0:1}
|
19
|
+
#
|
20
|
+
# Large whole multimedia objects embedded in a GEDCOM file would break some systems. For this
|
21
|
+
# purpose, large multimedia files should be divided into smaller multimedia records by using the
|
22
|
+
# subordinate OBJE tag to chain to the next <MULTIMEDIA_RECORD> fragment. This will allow
|
23
|
+
# GEDCOM records to be maintained below the 32K limit for use in systems with limited resources.
|
24
|
+
#
|
25
|
+
# n OBJE {1:1} is a reference to an external file, rather than inline.
|
26
|
+
# +1 FORM <MULTIMEDIA_FORMAT> {1:1}
|
27
|
+
# +1 TITL <DESCRIPTIVE_TITLE> {0:1}
|
28
|
+
# +1 FILE <MULTIMEDIA_FILE_REFERENCE> {1:1}
|
29
|
+
# +1 <<NOTE_STRUCTURE>> {0:M}
|
30
|
+
#
|
31
|
+
# This second method allows the GEDCOM context to be connected to an external multimedia file.
|
32
|
+
# GEDCOM defines this in the MULTIMEDIA_LINK definition, but I have put it into the Multimedia_record.
|
33
|
+
# as the attributes are the same, except BLOB becomes FILE. A Multimedia_citation_record is also created
|
34
|
+
# to make all references to Multimedia records consistent.
|
35
|
+
#
|
36
|
+
# This process is only managed by GEDCOM in the sense that the appropriate file name is included in
|
37
|
+
# the GEDCOM file in context, but the maintenance and transfer of the multimedia files are external to
|
38
|
+
# GEDCOM. The parser can just treat this as a comment and doesn't check for the file being present.
|
39
|
+
#
|
40
|
+
#The attributes are all arrays for the level +1 tags/records.
|
41
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
42
|
+
#* Those ending in _record are array of classes of that type.
|
43
|
+
#* The remainder are arrays of attributes that could be present in this record.
|
44
|
+
class Multimedia_record < GEDCOMBase
|
45
|
+
attr_accessor :multimedia_ref, :format, :title, :encoded_line_record, :next_multimedia_ref, :filename
|
46
|
+
attr_accessor :refn_record, :automated_record_id, :note_citation_record, :change_date_record
|
47
|
+
|
48
|
+
ClassTracker << :Multimedia_record
|
49
|
+
|
50
|
+
def to_gedcom(level=0)
|
51
|
+
|
52
|
+
if @multimedia_ref != nil
|
53
|
+
@this_level = [ [:xref, "OBJE", :multimedia_ref]]
|
54
|
+
else
|
55
|
+
@this_level = [ [:nodata, "OBJE", nil] ]
|
56
|
+
end
|
57
|
+
|
58
|
+
@sub_level = [#level 1
|
59
|
+
[:print, "TITL", :title ],
|
60
|
+
[:print, "FORM", :format ],
|
61
|
+
[:walk, nil, :encoded_line_record ],
|
62
|
+
[:xref, nil, :next_multimedia_ref ],
|
63
|
+
[:print, "FILE", :filename ],
|
64
|
+
[:walk, nil, :note_citation_record ],
|
65
|
+
[:walk, nil, :refn_record ],
|
66
|
+
[:print, "RIN", :automated_record_id ],
|
67
|
+
[:walk, nil, :change_date_record ],
|
68
|
+
]
|
69
|
+
|
70
|
+
super(level)
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
require 'individual_attribute_record.rb'
|
3
|
+
|
4
|
+
#Internal representation of the GEDCOM NAME record as described under PERSONAL_NAME_STRUCTURE
|
5
|
+
#This sub-classes Individual_attribute_record, which in turn sub-classes Event_record. This may
|
6
|
+
#seem odd, but they share most class attributes and event records can be attached to most attributes.
|
7
|
+
#
|
8
|
+
#=PERSONAL_NAME_STRUCTURE:=
|
9
|
+
# n NAME <NAME_PERSONAL> {1:1}
|
10
|
+
# +1 NPFX <NAME_PIECE_PREFIX> {0:1}
|
11
|
+
# +1 GIVN <NAME_PIECE_GIVEN> {0:1}
|
12
|
+
# +1 NICK <NAME_PIECE_NICKNAME> {0:1}
|
13
|
+
# +1 SPFX <NAME_PIECE_SURNAME_PREFIX {0:1}
|
14
|
+
# +1 SURN <NAME_PIECE_SURNAME> {0:1}
|
15
|
+
# +1 NSFX <NAME_PIECE_SUFFIX> {0:1}
|
16
|
+
# +1 <<SOURCE_CITATION>> {0:M}
|
17
|
+
# +1 <<NOTE_STRUCTURE>> {0:M}
|
18
|
+
#
|
19
|
+
# The name value is formed in the manner the name is normally spoken, with the given name and family
|
20
|
+
# name (surname) separated by slashes (/). (See <NAME_PERSONAL>, page 45.) Based on the
|
21
|
+
# dynamic nature or unknown compositions of naming conventions, it is difficult to provide more
|
22
|
+
# detailed name piece structure to handle every case. The NPFX, GIVN, NICK, SPFX, SURN, and
|
23
|
+
# NSFX tags are provided optionally for systems that cannot operate effectively with less structured
|
24
|
+
# information. For current future compatibility, all systems must construct their names based on the
|
25
|
+
# <NAME_PERSONAL> structure. Those using the optional name pieces should assume that few
|
26
|
+
# systems will process them, and most will not provide the name pieces. Future GEDCOM releases
|
27
|
+
# (6.0 and later) will likely apply a very different strategy to resolve this problem, possibly using a
|
28
|
+
# sophisticated parser and a name-knowledge database.
|
29
|
+
#
|
30
|
+
#The attributes are all arrays for the level +1 tags/records.
|
31
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
32
|
+
#* Those ending in _record are array of classes of that type.
|
33
|
+
#* The remainder are arrays of attributes that could be present in this record.
|
34
|
+
class Name_record < Individual_attribute_record
|
35
|
+
attr_accessor :prefix, :given, :nickname, :surname_prefix, :surname, :suffix
|
36
|
+
ClassTracker << :Name_record
|
37
|
+
|
38
|
+
def initialize(*a)
|
39
|
+
super(*a)
|
40
|
+
@sub_level = [
|
41
|
+
[:print, "NPFX", :prefix ],
|
42
|
+
[:print, "GIVN", :given ],
|
43
|
+
[:print, "NICK", :nickname ],
|
44
|
+
[:print, "SPFX", :surname_prefix ],
|
45
|
+
[:print, "SURN", :surname ],
|
46
|
+
[:print, "NSFX", :suffix ],
|
47
|
+
] + @sub_level
|
48
|
+
end
|
49
|
+
|
50
|
+
def event_tag(tag)
|
51
|
+
case tag
|
52
|
+
when "NAME" then tag
|
53
|
+
else super(tag)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Internal representation of a reference to a GEDCOM NOTE_STRUCTURE, or reference to a Level 0 NOTE.
|
4
|
+
#NOTE types can be inline, references to Level 0 NOTEs, or used to store user defined tags.
|
5
|
+
#All NOTES are stored in the Note_record closs and referenced through this class.
|
6
|
+
#
|
7
|
+
#=NOTE_STRUCTURE:=
|
8
|
+
# n NOTE @<XREF:NOTE>@ {1:1}
|
9
|
+
# +1 <<SOURCE_CITATION>> {0:M}
|
10
|
+
#
|
11
|
+
# The inline NOTE, also described as a NOTE_STRUCTURE in the GEDCOM standard, is stored in a Note_record.
|
12
|
+
#
|
13
|
+
#The attributes are all arrays for the level +1 tags/records.
|
14
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
15
|
+
#* Those ending in _record are array of classes of that type.
|
16
|
+
#* The remainder are arrays of attributes that could be present in this record.
|
17
|
+
class Note_citation_record < GEDCOMBase
|
18
|
+
attr_accessor :note_ref, :note_record, :source_citation_record
|
19
|
+
|
20
|
+
ClassTracker << :Note_citation_record
|
21
|
+
|
22
|
+
def to_gedcom(level=0)
|
23
|
+
if @note_ref != nil
|
24
|
+
@this_level = [ [:xref, "NOTE", :note_ref] ]
|
25
|
+
@sub_level = [#level 1
|
26
|
+
[:walk, nil, :source_citation_record ],
|
27
|
+
[:walk, nil, :note_record]
|
28
|
+
]
|
29
|
+
else
|
30
|
+
@this_level = [ [:walk, nil, :note_record] ]
|
31
|
+
@sub_level = [#level 1
|
32
|
+
]
|
33
|
+
end
|
34
|
+
super(level)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Internal representation of the GEDCOM NOTE record type
|
4
|
+
#Both inline and level 0 NOTEs are stored here and both are referenced through the Note_citation_record class.
|
5
|
+
#NOTES are also used to store user defined tags, so can appear in places the GEDCOM standard doesn't specify NOTEs.
|
6
|
+
#
|
7
|
+
#=NOTE_RECORD:=
|
8
|
+
# 0 @<XREF:NOTE>@ NOTE <SUBMITTER_TEXT> {0:M}
|
9
|
+
# +1 [ CONC | CONT] <SUBMITTER_TEXT> {0:M}
|
10
|
+
# +1 <<SOURCE_CITATION>> {0:M}
|
11
|
+
# +1 REFN <USER_REFERENCE_NUMBER> {0:M}
|
12
|
+
# +2 TYPE <USER_REFERENCE_TYPE> {0:1}
|
13
|
+
# +1 RIN <AUTOMATED_RECORD_ID> {0:1}
|
14
|
+
# +1 <<CHANGE_DATE>> {0:1}
|
15
|
+
#
|
16
|
+
# I also recognise notes in this record, so I can handle user tags as notes.
|
17
|
+
# +1 <<NOTE_STRUCTURE>> {0:M}
|
18
|
+
#
|
19
|
+
#=NOTE_STRUCTURE:= (The inline NOTE, defined in NOTE_STRUCTURE is also stored here)
|
20
|
+
# n NOTE [SUBMITTER_TEXT> | <NULL>] {1:1} p.51
|
21
|
+
# +1 [ CONC | CONT ] <SUBMITTER_TEXT> {0:M}
|
22
|
+
# +1 <<SOURCE_CITATION>> {0:M}
|
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 the NOTE records.
|
28
|
+
class Note_record < GEDCOMBase
|
29
|
+
attr_accessor :note_ref, :note, :source_citation_record
|
30
|
+
attr_accessor :restriction, :refn_record, :automated_record_id, :change_date_record
|
31
|
+
attr_accessor :note_citation_record
|
32
|
+
|
33
|
+
ClassTracker << :Note_record
|
34
|
+
|
35
|
+
def to_gedcom(level=0)
|
36
|
+
if @note_ref != nil
|
37
|
+
@this_level = [ [:xref, "NOTE", :note_ref] ]
|
38
|
+
@sub_level = [ #level + 1
|
39
|
+
[:conc, "CONC", :note],
|
40
|
+
[:print, "RESN", :restriction ],
|
41
|
+
[:walk, nil, :source_citation_record ],
|
42
|
+
[:walk, nil, :note_citation_record ],
|
43
|
+
[:walk, nil, :refn_record ],
|
44
|
+
[:print, "RIN", :automated_record_id ],
|
45
|
+
[:walk, nil, :change_date_record],
|
46
|
+
]
|
47
|
+
else
|
48
|
+
@this_level = [ [:cont, "NOTE", :note] ]
|
49
|
+
@sub_level = [ #level + 1
|
50
|
+
[:print, "RESN", :restriction ],
|
51
|
+
[:walk, nil, :source_citation_record ],
|
52
|
+
[:walk, nil, :note_citation_record ],
|
53
|
+
[:walk, nil, :refn_record ],
|
54
|
+
[:print, "RIN", :automated_record_id ],
|
55
|
+
[:walk, nil, :change_date_record],
|
56
|
+
]
|
57
|
+
end
|
58
|
+
super(level)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Internal representation of the GEDCOM PLAC record type. Sub-record of HEAD and EVENT
|
4
|
+
#
|
5
|
+
#=PLACE_STRUCTURE:=
|
6
|
+
# n PLAC <PLACE_VALUE> {1:1}
|
7
|
+
# +1 FORM <PLACE_HIERARCHY> {0:1}
|
8
|
+
# +1 <<SOURCE_CITATION>> {0:M}
|
9
|
+
# +1 <<NOTE_STRUCTURE>> {0:M}
|
10
|
+
#
|
11
|
+
#==PLACE_VALUE:= {Size=1:120}
|
12
|
+
#
|
13
|
+
# <TEXT> | <TEXT>, <PLACE_VALUE>
|
14
|
+
#
|
15
|
+
# The jurisdictional name of the place where the event took place. Jurisdictions are separated by
|
16
|
+
# commas, for example, "Cove, Cache, Utah, USA." If the actual jurisdictional names of these places
|
17
|
+
# have been identified, they can be shown using a PLAC.FORM structure either in the HEADER or in
|
18
|
+
# the event structure. (See <PLACE_HIERARCHY>, page 47.)
|
19
|
+
#
|
20
|
+
#The attributes are all arrays for the level +1 tags/records.
|
21
|
+
#* Those ending in _record are array of classes of that type.
|
22
|
+
#* The remainder are arrays of attributes that could be present in the PLAC records.
|
23
|
+
class Place_record < GEDCOMBase
|
24
|
+
attr_accessor :place_value, :place_hierachy, :source_citation_record, :note_citation_record
|
25
|
+
|
26
|
+
ClassTracker << :Place_record
|
27
|
+
|
28
|
+
def to_gedcom(level=0)
|
29
|
+
if @place_value != nil
|
30
|
+
@this_level = [ [:print, "PLAC", :place_value] ]
|
31
|
+
@sub_level = [ #level + 1
|
32
|
+
[:print, "FORM", :place_hierachy],
|
33
|
+
[:walk, nil, :source_citation_record],
|
34
|
+
[:walk, nil, :note_citation_record],
|
35
|
+
]
|
36
|
+
else
|
37
|
+
@this_level = [ [:nodata, "PLAC", nil] ]
|
38
|
+
@sub_level = [ #level + 1
|
39
|
+
[:print, "FORM", :place_hierachy],
|
40
|
+
[:walk, nil, :source_citation_record],
|
41
|
+
[:walk, nil, :note_citation_record],
|
42
|
+
]
|
43
|
+
end
|
44
|
+
super(level)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Internal representation of the GEDCOM REFN record type. A sub-record of the level 0 INDI,FAM,OBJE,NOTE,REPO,SOUR records.
|
4
|
+
#
|
5
|
+
#=REFN {REFERENCE}:=
|
6
|
+
#
|
7
|
+
# n REFN <USER_REFERENCE_NUMBER> {0:M}
|
8
|
+
# +1 TYPE <USER_REFERENCE_TYPE> {0:1}
|
9
|
+
#
|
10
|
+
# A description or number used to identify an item for filing, storage, or other reference purposes.
|
11
|
+
#
|
12
|
+
#The attributes are all arrays for the level +1 tags/records.
|
13
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
14
|
+
#* Those ending in _record are array of classes of that type.
|
15
|
+
#* The remainder are arrays of attributes that could be present in the REFN records.
|
16
|
+
class Refn_record < GEDCOMBase
|
17
|
+
attr_accessor :ref_type, :user_reference_number
|
18
|
+
attr_accessor :note_citation_record
|
19
|
+
|
20
|
+
ClassTracker << :Refn_record
|
21
|
+
|
22
|
+
#new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
|
23
|
+
def initialize(*a)
|
24
|
+
super(*a)
|
25
|
+
@this_level = [ [:print, "REFN", :user_reference_number] ]
|
26
|
+
@sub_level = [ #level + 1
|
27
|
+
[:print, "TYPE", :ref_type],
|
28
|
+
[:walk, nil, :note_citation_record],
|
29
|
+
]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Internal representation of the GEDCOM CALN record type, a sub-record of Repository_citation_record.
|
4
|
+
#
|
5
|
+
#=SOURCE_CALL_NUMBER:=
|
6
|
+
# -1 REPO @XREF:REPO@ {1:1} Parent record
|
7
|
+
# ...
|
8
|
+
# n CALN <SOURCE_CALL_NUMBER> {0:M} ** CALN record **
|
9
|
+
# +1 MEDI <SOURCE_MEDIA_TYPE> {0:1}
|
10
|
+
#
|
11
|
+
# The number used by a repository to identify the specific items in its collections.
|
12
|
+
#
|
13
|
+
#The attributes are all arrays for the level +1 tags/records.
|
14
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
15
|
+
#* Those ending in _record are array of classes of that type.
|
16
|
+
#* The remainder are arrays of attributes that could be present in the CALN records.
|
17
|
+
class Repository_caln < GEDCOMBase
|
18
|
+
attr_accessor :media_type, :call_number
|
19
|
+
attr_accessor :note_citation_record
|
20
|
+
|
21
|
+
ClassTracker << :Repository_caln
|
22
|
+
|
23
|
+
#new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
|
24
|
+
def initialize(*a)
|
25
|
+
super(*a)
|
26
|
+
@this_level = [ [:print, "CALN", :call_number] ]
|
27
|
+
@sub_level = [ #level + 1
|
28
|
+
[:print, "MEDI", :media_type],
|
29
|
+
[:walk, nil, :note_citation_record],
|
30
|
+
]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Internal representation of a reference to the GEDCOM REPO citation record type
|
4
|
+
#The actual REPO record is stored in the Repository_record class.
|
5
|
+
#
|
6
|
+
#=SOURCE_REPOSITORY_CITATION:=
|
7
|
+
#
|
8
|
+
# n REPO @XREF:REPO@ {1:1}
|
9
|
+
# +1 <<NOTE_STRUCTURE>> {0:M}
|
10
|
+
# +1 CALN <SOURCE_CALL_NUMBER> {0:M}
|
11
|
+
# +2 MEDI <SOURCE_MEDIA_TYPE> {0:1}
|
12
|
+
#
|
13
|
+
# This structure is used within a source record to point to a name and address record of the holder of the
|
14
|
+
# source document. Formal and informal repository name and addresses are stored in the
|
15
|
+
# REPOSITORY_RECORD. Informal repositories include owner's of an unpublished work or of a rare
|
16
|
+
# published source, or a keeper of personal collections. An example would be the owner of a family Bible
|
17
|
+
# containing unpublished family genealogical entries. More formal repositories, such as the Family History
|
18
|
+
# Library, should show a call number of the source at that repository. The call number of that source
|
19
|
+
# should be recorded using a subordinate CALN tag. Systems which do not structure a repository name
|
20
|
+
# and address interface should store the information about where the source record is stored in the
|
21
|
+
# <<NOTE_STRUCTURE>> of this structure.
|
22
|
+
#
|
23
|
+
#The attributes are all arrays for the +1 level tags/records.
|
24
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
25
|
+
#* Those ending in _record are array of classes of that type.
|
26
|
+
#* The remainder are arrays of attributes that could be present in the REPO records.
|
27
|
+
#
|
28
|
+
class Repository_citation_record < GEDCOMBase
|
29
|
+
attr_accessor :repository_ref, :note_citation_record, :repository_caln
|
30
|
+
|
31
|
+
ClassTracker << :Repository_citation_record
|
32
|
+
|
33
|
+
#new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
|
34
|
+
def initialize(*a)
|
35
|
+
super(*a)
|
36
|
+
@this_level = [ [:xref, "REPO", :repository_ref] ]
|
37
|
+
@sub_level = [ #level + 1
|
38
|
+
[:walk, nil, :repository_caln],
|
39
|
+
[:walk, nil, :note_citation_record],
|
40
|
+
]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Internal representation of the GEDCOM REPO record type
|
4
|
+
#This class is referenced through the Repository_citation_record class.
|
5
|
+
#
|
6
|
+
#=REPOSITORY_RECORD:=
|
7
|
+
# 0 @<XREF:REPO>@ REPO {0:M}
|
8
|
+
# +1 NAME <NAME_OF_REPOSITORY> {0:1}
|
9
|
+
# +1 <<ADDRESS_STRUCTURE>> {0:1}
|
10
|
+
# +1 <<NOTE_STRUCTURE>> {0:M}
|
11
|
+
# +1 REFN <USER_REFERENCE_NUMBER> {0:M}
|
12
|
+
# +2 TYPE <USER_REFERENCE_TYPE> {0:1}
|
13
|
+
# +1 RIN <AUTOMATED_RECORD_ID> {0:1}
|
14
|
+
# +1 <<CHANGE_DATE>> {0:1}
|
15
|
+
#
|
16
|
+
#The attributes are all arrays for the +1 level 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 the REPO records.
|
20
|
+
class Repository_record < GEDCOMBase
|
21
|
+
attr_accessor :repository_ref, :repository_name, :phonenumber, :address_record, :note_citation_record
|
22
|
+
attr_accessor :refn_record, :automated_record_id, :change_date_record
|
23
|
+
|
24
|
+
ClassTracker << :Repository_record
|
25
|
+
|
26
|
+
#new sets up the state engine arrays @this_level and @sub_level, which drive the to_gedcom method generating GEDCOM output.
|
27
|
+
def initialize(*a)
|
28
|
+
super(*a)
|
29
|
+
@this_level = [ [:xref, "REPO", :repository_ref]]
|
30
|
+
@sub_level = [#level 1
|
31
|
+
[:print, "NAME", :repository_name ],
|
32
|
+
[:print, "PHON", :phonenumber ],
|
33
|
+
[:walk, nil, :address_record ],
|
34
|
+
[:walk, nil, :note_citation_record ],
|
35
|
+
[:walk, nil, :refn_record ],
|
36
|
+
[:print, "RIN", :automated_record_id ],
|
37
|
+
[:walk, nil, :change_date_record ],
|
38
|
+
]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'gedcom_base.rb'
|
2
|
+
|
3
|
+
#Internal representation of a reference to the GEDCOM SOUR record type.
|
4
|
+
#Both inline SOUR records and references to a Level 0 SOUR records are referenced via this class.
|
5
|
+
#We store inline SOUR records in Source_record objects, not Source_citation_record objects.
|
6
|
+
#
|
7
|
+
#=SOURCE_CITATION:= (within another record, referencing a SOURCE_RECORD)
|
8
|
+
# n SOUR @<XREF:SOUR>@ {1:1} (pointer to source record)
|
9
|
+
# +1 PAGE <WHERE_WITHIN_SOURCE> {0:1}
|
10
|
+
# +1 EVEN <EVENT_TYPE_CITED_FROM> {0:1}
|
11
|
+
# +2 ROLE <ROLE_IN_EVENT> {0:1}
|
12
|
+
# +1 DATA {0:1}
|
13
|
+
# +2 DATE <ENTRY_RECORDING_DATE> {0:1}
|
14
|
+
# +2 TEXT <TEXT_FROM_SOURCE> {0:M}
|
15
|
+
# +3 [ CONC | CONT ] <TEXT_FROM_SOURCE> {0:M}
|
16
|
+
# +1 QUAY <CERTAINTY_ASSESSMENT> {0:1}
|
17
|
+
# +1 <<MULTIMEDIA_LINK>> {0:M}
|
18
|
+
# +1 <<NOTE_STRUCTURE>> {0:M}
|
19
|
+
#
|
20
|
+
# The data provided in the <<SOURCE_CITATION>> structure is source-related information specific
|
21
|
+
# to the data being cited. (See GEDCOM examples starting on page 57.) Systems that do not use
|
22
|
+
# SOURCE_RECORDS must use the second SOURce citation structure option. When systems which
|
23
|
+
# support SOURCE_RECORD structures encounter source citations which do not contain pointers to
|
24
|
+
# source records, that system will need to create a SOURCE_RECORD and store the
|
25
|
+
# <SOURCE_DESCRIPTION> information found in the non-structured source citation in either the
|
26
|
+
# title area of that SOURCE_RECORD, or if the title field is not large enough, place a "(See Notes)"
|
27
|
+
# text in the title area, and place the unstructured source description in the source record's note field.
|
28
|
+
#
|
29
|
+
# The information intended to be placed in the citation structure includes:
|
30
|
+
# * A pointer to the SOURCE_RECORD, which contains a more general description of the source.
|
31
|
+
# * Information, such as a page number, on how to find the cited data within the source.
|
32
|
+
# * Actual text from the source that was used in making assertions, for example a date phrase as
|
33
|
+
# actually recorded or an applicable sentence from a letter, would be appropriate.
|
34
|
+
# * Data that allows an assessment of the relative value of one source over another for making the
|
35
|
+
# recorded assertions (primary or secondary source, etc.). Data needed for this assessment is how
|
36
|
+
# much time from the asserted fact and when the source event was recorded, what type of event
|
37
|
+
# was cited, and what was the role of this person in the cited event.
|
38
|
+
# - Date when the entry was recorded in source document, ".SOUR.DATA.DATE."
|
39
|
+
# - Event that initiated the recording, ".SOUR.EVEN."
|
40
|
+
# - Role of this person in the event, ".SOUR.EVEN.ROLE".
|
41
|
+
#
|
42
|
+
#The attributes are all arrays representing all the +1 TAGS/Records.
|
43
|
+
#* Those ending in _ref are GEDCOM XREF index keys
|
44
|
+
#* Those ending in _record are array of classes of that type.
|
45
|
+
#* The remainder are arrays of attributes that could be present in the SOUR records.
|
46
|
+
#
|
47
|
+
class Source_citation_record < GEDCOMBase
|
48
|
+
attr_accessor :source_ref, :source_record, :page, :citation_event_type_record, :citation_data_record, :quality
|
49
|
+
attr_accessor :note_citation_record, :multimedia_citation_record
|
50
|
+
|
51
|
+
ClassTracker << :Source_citation_record
|
52
|
+
|
53
|
+
#to_gedcom sets up the state engine arrays @this_level and @sub_level, which drive the parent class to_gedcom method generating GEDCOM output.
|
54
|
+
#There are two types of SOUR record, inline and reference, so this is done dynamically in to_gedcom rather than the initialize method.
|
55
|
+
#Probably should be two classes, rather than this conditional.
|
56
|
+
def to_gedcom(level=0)
|
57
|
+
if(@source_ref != nil)
|
58
|
+
@this_level = [ [:xref, "SOUR", :source_ref] ]
|
59
|
+
@sub_level = [ #level + 1
|
60
|
+
[:print, "PAGE", :page],
|
61
|
+
[:walk, nil, :citation_event_type_record],
|
62
|
+
[:walk, nil, :citation_data_record],
|
63
|
+
[:print, "QUAY", :quality],
|
64
|
+
[:walk, nil, :multimedia_citation_record],
|
65
|
+
[:walk, nil, :note_citation_record],
|
66
|
+
]
|
67
|
+
elsif @source_record != nil
|
68
|
+
@this_level = [ [:walk, nil, :source_record] ]
|
69
|
+
@sub_level = []
|
70
|
+
end
|
71
|
+
super(level)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|