Class: TaxonNameRelationship::Iczn::Invalidating::Homonym
Defined Under Namespace
Classes: Primary, Secondary
Constant Summary
collapse
- NOMEN_URI =
'http://purl.obolibrary.org/obo/NOMEN_0000289'.freeze
SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS
Instance Attribute Summary
#no_cached, #object_taxon_name_id, #project_id, #subject_taxon_name_id, #type
Class Method Summary
collapse
Instance Method Summary
collapse
assignable, disjoint_subject_classes, gbif_status_of_subject, nomenclatural_priority, #similar_homonym_string
disjoint_subject_classes, valid_object_ranks, valid_subject_ranks
assignable, collect_descendants_and_itself_to_s, collect_descendants_to_s, collect_to_s, disjoint_subject_classes, #dwc_occurrences, gbif_status_of_object, gbif_status_of_subject, #is_combination?, #is_invalidating?, nomen_uri, nomenclatural_priority, #nomenclature_date, #object_properties, #object_status_tag, parent, required_taxon_name_relationships, #set_cached_names_for_taxon_names, #subject_and_object_in_same_project, #subject_invalid_statuses, #subject_status_tag, #sv_coordinated_taxa, #sv_coordinated_taxa_object, #sv_fix_combination_relationship, #sv_fix_coordinated_object_taxa, #sv_fix_coordinated_subject_taxa, #sv_fix_objective_synonym_relationship, #sv_fix_subject_parent_update, #sv_objective_synonym_relationship, #sv_synonym_linked_to_valid_name, #sv_validate_disjoint_object, #sv_validate_disjoint_relationships, #sv_validate_disjoint_subject, #sv_validate_required_relationships, #sv_validate_seniority, #type_class, #type_class=, #type_name, valid_object_ranks, valid_subject_ranks, #validate_object_and_subject_both_protonyms, #validate_object_must_equal_subject_for_uncertain_placement, #validate_rank_group, #validate_subject_and_object_are_not_identical, #validate_subject_and_object_ranks, #validate_subject_and_object_share_code, #validate_type, #validate_uniqueness_of_typification_object
#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar
#clear_soft_validations, #fix_for, #fix_soft_validations, #soft_fixed?, #soft_valid?, #soft_validate, #soft_validated?, #soft_validations, #soft_validators
#concatenated_notes_string, #reject_notes
#cited?, #mark_citations_for_destruction, #nomenclature_date, #origin_citation_source_id, #reject_citations, #requires_citation?, #sources_by_topic_id
#has_polymorphic_relationship?
transaction_with_retry
Class Method Details
.assignment_method ⇒ Object
63
64
65
66
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 63
def self.assignment_method
:iczn_set_as_homonym_of
end
|
.disjoint_object_classes ⇒ Object
38
39
40
41
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 38
def self.disjoint_object_classes
self.parent.disjoint_object_classes +
self.collect_descendants_and_itself_to_s(TaxonNameClassification::Iczn::Unavailable)
end
|
.disjoint_taxon_name_relationships ⇒ Object
soft_validate(:sv_not_specific_relationship,
set: :not_specific_relationship,
fix: :sv_fix_not_specific_relationship,
name: 'Not specific homonym relationship',
description: 'Check if homonymy could be defined as primary or secondary.' )
.inverse_assignment_method ⇒ Object
69
70
71
72
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 69
def self.inverse_assignment_method
:iczn_homonym
end
|
Instance Method Details
#object_status ⇒ Object
47
48
49
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 47
def object_status
'senior homonym'
end
|
#object_status_connector_to_subject ⇒ Object
59
60
61
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 59
def object_status_connector_to_subject
' of'
end
|
#subject_properties ⇒ Object
#subject_status ⇒ Object
51
52
53
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 51
def subject_status
'homonym'
end
|
#subject_status_connector_to_object ⇒ Object
55
56
57
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 55
def subject_status_connector_to_object
' of'
end
|
#sv_fix_add_synonym_for_homonym ⇒ Object
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 139
def sv_fix_add_synonym_for_homonym
if subject_taxon_name.iczn_set_as_synonym_of.nil?
unless subject_taxon_name.iczn_replacement_names.empty?
subject_taxon_name.iczn_set_as_synonym_of = object_taxon_name
begin
TaxonNameRelationship.transaction do
self.save
return true
end
rescue
end
end
end
false
end
|
#sv_fix_not_specific_relationship ⇒ Object
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 112
def sv_fix_not_specific_relationship
subject_original_genus = self.subject_taxon_name.original_genus
object_original_genus = self.object_taxon_name.original_genus
subject_genus = self.subject_taxon_name.ancestor_at_rank('genus')
object_genus = self.object_taxon_name.ancestor_at_rank('genus')
new_relationship_name = nil
if subject_original_genus == object_original_genus && !subject_original_genus.nil?
new_relationship_name = 'TaxonNameRelationship::Iczn::Invalidating::Homonym::Primary'
elsif subject_genus != object_genus && !subject_genus.nil?
new_relationship_name = 'TaxonNameRelationship::Iczn::Invalidating::Homonym::Secondary'
end
if new_relationship_name && self.type_name != new_relationship_name
self.type = new_relationship_name
self.save
return true
end
false
end
|
#sv_missing_nomen_novum ⇒ Object
80
81
82
83
84
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 80
def sv_missing_nomen_novum
if self.subject_taxon_name.iczn_set_as_synonym_of.nil? && self.subject_taxon_name.iczn_replacement_names.empty?
soft_validations.add(:type, 'Please select a replacement or substitute name')
end
end
|
#sv_missing_replacement_name ⇒ Object
86
87
88
89
90
91
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 86
def sv_missing_replacement_name
if self.subject_taxon_name.iczn_set_as_synonym_of.nil? && !self.subject_taxon_name.iczn_replacement_names.empty?
soft_validations.add(:type, 'Please select a valid name using synonym relationships',
success_message: 'Synonym relationship was added')
end
end
|
#sv_not_specific_relationship ⇒ Object
103
104
105
106
107
108
109
110
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 103
def sv_not_specific_relationship
if self.subject_taxon_name.is_species_rank?
soft_validations.add(
:type, 'Please specify if this is a primary or secondary homonym',
success_message: 'Homonym updated to being primary or secondary',
failure_message: 'Failed to update the homonym relationship')
end
end
|
#sv_specific_relationship ⇒ Object
93
94
95
96
97
98
99
100
101
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 93
def sv_specific_relationship
s = subject_taxon_name
o = object_taxon_name
if (s.cached_primary_homonym_alternative_spelling != o.cached_primary_homonym_alternative_spelling)
if (s.cached_secondary_homonym_alternative_spelling.blank? && o.cached_secondary_homonym_alternative_spelling.blank?) || (s.cached_secondary_homonym_alternative_spelling != o.cached_secondary_homonym_alternative_spelling)
soft_validations.add(:type, "#{subject_taxon_name.cached_html_name_and_author_year} and #{object_taxon_name.cached_html_name_and_author_year} are not similar enough to be homonyms")
end
end
end
|
#sv_synonym_relationship ⇒ Object
155
156
157
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 155
def sv_synonym_relationship
true
end
|
#sv_validate_priority ⇒ Object
131
132
133
134
135
136
137
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 131
def sv_validate_priority
date1 = self.subject_taxon_name.cached_nomenclature_date
date2 = self.object_taxon_name.cached_nomenclature_date
if !!date1 && !!date2 && date2 > date1 && subject_invalid_statuses.empty?
soft_validations.add(:type, "#{self.subject_status.capitalize} #{self.subject_taxon_name.cached_html_name_and_author_year} should not be older than #{self.object_status} #{self.object_taxon_name.cached_html_name_and_author_year}")
end
end
|
#sv_validate_total_suppression ⇒ Object
74
75
76
77
78
|
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 74
def sv_validate_total_suppression
if !self.object_taxon_name.iczn_set_as_total_suppression_of.nil?
soft_validations.add(:type, 'Taxon should not be treated as homonym, since the related taxon is totally suppressed')
end
end
|