Class: TaxonNameRelationship::Iczn::Invalidating::Homonym

Inherits:
TaxonNameRelationship::Iczn::Invalidating show all
Defined in:
app/models/taxon_name_relationship/iczn/invalidating/homonym.rb

Direct Known Subclasses

Primary, Secondary

Defined Under Namespace

Classes: Primary, Secondary

Constant Summary

NOMEN_URI =
'http://purl.obolibrary.org/obo/NOMEN_0000289'

Constants included from SoftValidation

SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS

Instance Attribute Summary

Attributes inherited from TaxonNameRelationship

#no_cached, #object_taxon_name_id, #project_id, #subject_taxon_name_id, #type

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from TaxonNameRelationship::Iczn::Invalidating

assignable, disjoint_subject_classes, gbif_status_of_subject, nomenclatural_priority

Methods inherited from TaxonNameRelationship::Iczn

disjoint_object_classes, disjoint_subject_classes, valid_object_ranks, valid_subject_ranks

Methods inherited from TaxonNameRelationship

assignable, collect_descendants_and_itself_to_s, collect_descendants_to_s, collect_to_s, disjoint_object_classes, disjoint_subject_classes, find_for_autocomplete, gbif_status_of_object, gbif_status_of_subject, generate_download, #is_combination?, nomen_uri, nomenclatural_priority, #nomenclature_date, #object_properties, #object_status_tag, required_taxon_name_relationships, #set_cached_names_for_taxon_names, #subject_status_tag, #sv_coordinated_taxa, #sv_fix_combination_relationship, #sv_fix_coordinated_object_taxa, #sv_fix_coordinated_subject_taxa, #sv_fix_specify_homonymy_type, #sv_fix_specify_synonymy_type, #sv_fix_subject_parent_update, #sv_fix_synonym_linked_to_valid_name, #sv_matching_type_genus, #sv_not_specific_relationship, #sv_objective_synonym_relationship, #sv_specific_relationship, #sv_synonym_linked_to_valid_name, #sv_synonym_relationship, #sv_validate_disjoint_object, #sv_validate_disjoint_relationships, #sv_validate_disjoint_subject, #sv_validate_priority, #sv_validate_required_relationships, #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

Methods included from SoftValidation

#clear_soft_validations, #fix_soft_validations, #soft_fixed?, #soft_valid?, #soft_validate, #soft_validated?, #soft_validations

Methods included from Housekeeping

#has_polymorphic_relationship?

Class Method Details

+ (Object) assignment_method



39
40
41
42
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 39

def self.assignment_method
  # bus.set_as_iczn_homonym_of(aus)
  :iczn_set_as_homonym_of
end

+ (Object) disjoint_taxon_name_relationships



7
8
9
10
11
12
13
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 7

def self.disjoint_taxon_name_relationships
  self.parent.disjoint_taxon_name_relationships +
      self.collect_descendants_to_s(TaxonNameRelationship::Iczn::Invalidating::Usage) +
      self.collect_to_s(TaxonNameRelationship::Iczn::Invalidating,
          TaxonNameRelationship::Iczn::Invalidating::Synonym::Suppression::Total)

end

+ (Object) inverse_assignment_method

as.



45
46
47
48
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 45

def self.inverse_assignment_method
  # aus.iczn_homonym = bus
  :iczn_homonym
end

Instance Method Details

- (Object) object_status



23
24
25
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 23

def object_status
  'senior homonym'
end

- (Object) object_status_connector_to_subject



35
36
37
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 35

def object_status_connector_to_subject
  ' of'
end

- (Object) subject_properties

def self.disjoint_object_classes

  self.parent.disjoint_object_classes
end


19
20
21
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 19

def subject_properties
  [ TaxonNameClassification::Iczn::Available::Invalid::Homonym ]
end

- (Object) subject_status



27
28
29
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 27

def subject_status
  'homonym'
end

- (Object) subject_status_connector_to_object



31
32
33
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 31

def subject_status_connector_to_object
  ' of'
end

- (Object) sv_add_synonym_for_homonym



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 50

def sv_add_synonym_for_homonym
  # if self.type_name =~ /TaxonNameRelationship::Iczn::Invalidating::Homonym/
    if self.subject_taxon_name.iczn_set_as_synonym_of.nil?
      unless self.subject_taxon_name.iczn_replacement_names.empty?
        self.subject_taxon_name.iczn_set_as_synonym_of = self.object_taxon_name
        begin
          TaxonNameRelationship.transaction do
            self.save
            return true
          end
        rescue
        end
      end
    end
  # end
  false
end

- (Object) sv_validate_homonym_relationships



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'app/models/taxon_name_relationship/iczn/invalidating/homonym.rb', line 68

def sv_validate_homonym_relationships
  #  if self.type_name =~ /TaxonNameRelationship::Iczn::Invalidating::Homonym/
  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')
  elsif self.subject_taxon_name.iczn_set_as_synonym_of.nil?
    if self.subject_taxon_name.iczn_replacement_names.empty?
      soft_validations.add(:type, 'Please select a nomen novum and/or valid name')
    else
      soft_validations.add(:type, 'Please select a valid name using synonym relationships',
                           fix: :sv_add_synonym_for_homonym, success_message: 'Synonym relationship was added')
    end
  end
  #  end
end