Class: Source_record

Inherits:
GEDCOMBase show all
Defined in:
lib/gedcom/source_record.rb

Overview

Internal representation of the GEDCOM SOUR record type Both inline and references to Level 0 Source_records are referenced via the Source_citation_record class.

SOURCE_RECORD:= 0 @<XREF:SOUR>@ SOUR 0:M +1 DATA 0:1 +2 EVEN <EVENTS_RECORDED> 0:M +3 DATE <DATE_PERIOD> 0:1 +3 PLAC <SOURCE_JURISDICTION_PLACE> 0:1 +2 AGNC <RESPONSIBLE_AGENCY> 0:1 +2 <<NOTE_STRUCTURE>> 0:M +1 AUTH <SOURCE_ORIGINATOR> 0:1 +2 [CONT|CONC] <SOURCE_ORIGINATOR> 0:M +1 TITL <SOURCE_DESCRIPTIVE_TITLE> 0:1 +2 [CONT|CONC] <SOURCE_DESCRIPTIVE_TITLE> 0:M +1 ABBR <SOURCE_FILED_BY_ENTRY> 0:1 +1 PUBL <SOURCE_PUBLICATION_FACTS> 0:1 +2 [CONT|CONC] <SOURCE_PUBLICATION_FACTS> 0:M +1 TEXT <TEXT_FROM_SOURCE> 0:1 +2 [CONT|CONC] <TEXT_FROM_SOURCE> 0:M +1 <<SOURCE_REPOSITORY_CITATION>> 0:1 +1 <<MULTIMEDIA_LINK>> 0:M +1 <<NOTE_STRUCTURE>> 0:M +1 REFN <USER_REFERENCE_NUMBER> 0:M +2 TYPE <USER_REFERENCE_TYPE> 0:1 +1 RIN <AUTOMATED_RECORD_ID> 0:1 +1 <<CHANGE_DATE>> 0:1

Source records are used to provide a bibliographic description of the source cited. (See the <<SOURCE_CITATION>> structure, page 32, which contains the pointer to this source record.)#

Systems not using level 0 source records, inline SOUR records combining SOURCE_RECORDS with SOURCE_CITATIONs. We create both a Source_record object and a Source_citation_record object, as if the transmission had used both. n SOUR <SOURCE_DESCRIPTION> 1:1 +1 [ CONC | CONT ] <SOURCE_DESCRIPTION> 0:M +1 TEXT <TEXT_FROM_SOURCE> 0:M +2 [CONC | CONT ] <TEXT_FROM_SOURCE> 0:M +1 <<NOTE_STRUCTURE>> 0:M

The attributes are all arrays representing the +1 level of the SOURCE_RECORD. * Those ending in ref are GEDCOM XREF index keys * Those ending in record are array of classes of that type. * The remainder are arrays of attributes that could be present in the SOUR records.

Instance Attribute Summary collapse

Attributes inherited from GEDCOMBase

#restriction

Instance Method Summary collapse

Methods inherited from GEDCOMBase

#changed, #changed?, #created?, #find, #initialize, #locked?, no_tabs, #private?, #save, tabs, #to_db, #to_s, #to_s_ordered, #to_s_r, #token_to_s, #xref_check

Constructor Details

This class inherits a constructor from GEDCOMBase

Instance Attribute Details

#authorObject

Returns the value of attribute author.



48
49
50
# File 'lib/gedcom/source_record.rb', line 48

def author
  @author
end

#automated_record_idObject

Returns the value of attribute automated_record_id.



50
51
52
# File 'lib/gedcom/source_record.rb', line 50

def automated_record_id
  @automated_record_id
end

#change_date_recordObject

Returns the value of attribute change_date_record.



50
51
52
# File 'lib/gedcom/source_record.rb', line 50

def change_date_record
  @change_date_record
end

#multimedia_citation_recordObject

Returns the value of attribute multimedia_citation_record.



49
50
51
# File 'lib/gedcom/source_record.rb', line 49

def multimedia_citation_record
  @multimedia_citation_record
end

#note_citation_recordObject

Returns the value of attribute note_citation_record.



49
50
51
# File 'lib/gedcom/source_record.rb', line 49

def note_citation_record
  @note_citation_record
end

#publication_detailsObject

Returns the value of attribute publication_details.



48
49
50
# File 'lib/gedcom/source_record.rb', line 48

def publication_details
  @publication_details
end

#refn_recordObject

Returns the value of attribute refn_record.



50
51
52
# File 'lib/gedcom/source_record.rb', line 50

def refn_record
  @refn_record
end

#repository_citation_recordObject

Returns the value of attribute repository_citation_record.



49
50
51
# File 'lib/gedcom/source_record.rb', line 49

def repository_citation_record
  @repository_citation_record
end

#short_titleObject

Returns the value of attribute short_title.



48
49
50
# File 'lib/gedcom/source_record.rb', line 48

def short_title
  @short_title
end

#source_refObject

Returns the value of attribute source_ref.



48
49
50
# File 'lib/gedcom/source_record.rb', line 48

def source_ref
  @source_ref
end

#source_scope_recordObject

Returns the value of attribute source_scope_record.



48
49
50
# File 'lib/gedcom/source_record.rb', line 48

def source_scope_record
  @source_scope_record
end

#text_recordObject

Returns the value of attribute text_record.



49
50
51
# File 'lib/gedcom/source_record.rb', line 49

def text_record
  @text_record
end

#titleObject

Returns the value of attribute title.



48
49
50
# File 'lib/gedcom/source_record.rb', line 48

def title
  @title
end

Instance Method Details

#to_gedcom(level = 0) ⇒ Object

to_gedcom sets up the state engine arrays @this_level and @sub_level, which drive the parent class to_gedcom method generating GEDCOM output. There are two types of SOUR record, inline and reference, so this is done dynamically in to_gedcom rather than the initialize method. Probably should be two classes, rather than this conditional.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/gedcom/source_record.rb', line 57

def to_gedcom(level=0)
  if @source_ref != nil
    @this_level = [ [:xref, "SOUR", :source_ref] ]
    @sub_level =  [ #level + 1
                    [:print, "ABBR", :short_title],
                    [:cont, "TITL", :title],
                    [:cont, "AUTH", :author],
                    [:cont, "PUBL", :publication_details],
                    [:walk, nil,  :repository_citation_record],
                    [:walk, nil, :text_record],
                    [:walk, nil, :multimedia_citation_record],
                    [:walk, nil, :source_scope_record],
                    [:walk, nil, :note_citation_record],
                    [:walk, nil, :refn_record],
                    [:print, "RIN", :automated_record_id],
                    [:walk,  nil, :change_date_record],
                  ]
  else
    @this_level = [ [:cont, "SOUR", :title] ]
    @sub_level =  [ #level + 1
                    [:walk, nil, :text_record],
                    [:walk, nil, :note_citation_record] ,
                  ] 
  end
  super(level)
end