lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.7.0 vs lib/dwc-archive/classification_normalizer.rb in dwc-archive-0.7.1
- old
+ new
@@ -16,11 +16,11 @@
@vernacular_names = []
end
end
- class SynonymNormalized < Struct.new(:name, :canonical_name, :status);end
+ class SynonymNormalized < Struct.new(:id, :name, :canonical_name, :status);end
class VernacularNormalized < Struct.new(:name, :language, :locality);end
class ClassificationNormalizer
attr_reader :error_names, :tree, :normalized_data
@@ -77,10 +77,11 @@
def add_synonym_from_core(taxon_id, row)
@synonyms[row[@core_fields[:id]]] = taxon_id
taxon = @normalized_data[row[taxon_id]] ? @normalized_data[row[taxon_id]] : @normalized_data[row[taxon_id]] = DarwinCore::TaxonNormalized.new
synonym = SynonymNormalized.new(
+ row[@core_fields[:id]],
row[@core_fields[:scientificname]],
row[@core_fields[:canonicalname]],
@core_fields[:taxonomicstatus] ? row[@core_fields[:taxonomicstatus]] : nil)
taxon.synonyms << synonym
add_name_string(synonym.name)
@@ -209,9 +210,10 @@
ext, fields = *extension
ext.read do |rows|
rows[0].each do |r|
set_scientific_name(r, fields)
synonym = SynonymNormalized.new(
+ nil,
r[fields[:scientificname]],
r[fields[:canonicalname]],
fields[:taxonomicstatus] ? r[fields[:taxonomicstatus]] : nil)
@normalized_data[r[fields[:id]]].synonyms << synonym
add_name_string(synonym.name)