Class: Hybrid

Inherits:
TaxonName show all
Defined in:
app/models/hybrid.rb

Overview

A hybrid taxon, defined by adding relationships to this anonymous node.

If only one name is asserted to be a hybrid (i.e. without reference to multiple names) then this can be indicated by creating a Protonym and applying the status of Hybrid.

Constant Summary

Constants inherited from TaxonName

TaxonName::ALTERNATE_VALUES_FOR, TaxonName::COMBINATION_ELEMENTS, TaxonName::NOMEN_VALID, TaxonName::NOT_LATIN, TaxonName::NO_CACHED_MESSAGE, TaxonName::SPECIES_EPITHET_RANKS

Constants included from SoftValidation

SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS

Instance Attribute Summary

Attributes inherited from TaxonName

#also_create_otu, #cached_classified_as, #foo, #no_cached

Instance Method Summary collapse

Methods inherited from TaxonName

#all_taxon_name_relationships, #ancestor_at_rank, #ancestor_hash, #ancestor_protonyms, #ancestors_through_parents, #author_string, #cached_author, #cached_html_name_and_author_year, #cached_name_and_author_year, #cached_year, #check_for_children, #check_new_parent_class, #check_new_rank_class, #classification_invalid_or_unavailable?, #classification_valid?, #clear_cached, #combination_list_all, #combination_list_self, #combined_statuses, #create_otu, #descendant_protonyms, #descendants_at_rank, #first_possible_valid_taxon_name, #first_possible_valid_taxon_name_relationship, foo, #full_name_array, #full_name_hash, #gbif_status_array, #gender_class, #gender_instance, #gender_name, #genderized_name, #get_author_and_year, #get_cached_classified_as, #get_cached_misspelling, #get_genus_species, #get_original_combination, #get_original_combination_html, #get_valid_taxon_name, #icn_author_and_year, #iczn_author_and_year, #is_candidatus?, #is_combination?, #is_fossil?, #is_genus_or_species_rank?, #is_hybrid?, #is_italicized?, #is_protonym?, #is_valid?, #list_of_invalid_taxon_names, #matrix_row_item, #name_in_gender, #name_is_misapplied?, #name_with_misspelling, #next_sibling, #nomenclature_date, #normalized_genus, #not_binomial?, not_leaves, #original_author_year, out_of_scope_combinations, #out_of_scope_combinations, parent, #parent_is_set?, #part_of_speech_class, #part_of_speech_instance, #part_of_speech_name, #previous_sibling, #rank, #rank_class, #rank_class=, #rank_string, #reified_id, #related_taxon_names, #relationship_invalid?, #safe_self_and_ancestors, select_optimized, #set_cached, #set_cached_author_year, #set_cached_classified_as, #set_cached_warnings, sort_by_rank, #statuses_from_classifications, #statuses_from_relationships, #sv_cached_names, #sv_combination_duplicates, #sv_conflicting_subordinate_taxa, #sv_fix_cached_names, #sv_fix_missing_author, #sv_fix_missing_year, #sv_fix_parent_is_valid_name, #sv_homotypic_synonyms, #sv_incomplete_combination, #sv_missing_author, #sv_missing_classifications, #sv_missing_confidence_level, #sv_missing_etymology, #sv_missing_original_publication, #sv_missing_relationships, #sv_missing_year, #sv_not_synonym_of_self, #sv_parent_is_valid_name, #sv_parent_priority, #sv_potential_homonyms, #sv_primary_types, #sv_single_sub_taxon, #sv_species_gender_agreement, #sv_two_unresolved_alternative_synonyms, #sv_type_placement, #sv_validate_coordinated_names, #sv_validate_name, #sv_validate_parent_rank, #synonyms, #taxon_name_classifications_for_statuses, #unavailable_or_invalid?, used_recently, used_recently_in_classifications, used_recently_in_relationships, #validate_one_root_per_project, #validate_parent_from_the_same_project, #validate_parent_is_set, #validate_source_type, with_taxon_name_relationship, #year_integer

Methods included from TaxonName::MatrixHooks

#coordinate_observation_matrix_row_items, #in_scope_observation_matrix_row_items, #out_of_scope_observation_matrix_row_items

Methods included from Shared::MatrixHooks::Dynamic

#dynamic_add_to_matrix_column_items, #dynamic_add_to_matrix_row_items, #dynamic_cleanup_in_scope_column_items, #dynamic_cleanup_in_scope_row_items, #dynamic_cleanup_out_of_scope_column_items, #dynamic_cleanup_out_of_scope_row_items, #dynamic_column_items_in, #dynamic_column_items_out, #dynamic_inspect_matrices, #dynamic_remove_from_matrix_column_items, #dynamic_remove_from_matrix_row_items, #dynamic_row_items_in, #dynamic_row_items_out, #dynamic_syncronize_matrices, #dynamic_update_matrix_column_items?, #dynamic_update_matrix_row_items?, #in_scope_observation_matrix_column_items, #in_scope_observation_matrix_row_items, #out_of_scope_observation_matrix_column_items, #out_of_scope_observation_matrix_row_items, #prepare_matrix_items

Methods included from Shared::MatrixHooks::Member

#member_add_matrix_columns, #member_add_matrix_rows, #member_add_to_matrix_items, #member_of_new_matrix_column_items, #member_of_new_matrix_row_items, #member_of_old_matrix_column_items, #member_of_old_matrix_row_items, #member_remove_from_matrix_items, #member_remove_matrix_columns, #member_remove_matrix_rows, #member_syncronize_matrices, #member_update_matrix_items?

Methods included from Shared::IsData

#errors_excepting, #full_error_messages_excepting, #identical, #is_community?, #is_destroyable?, #is_editable?, #is_in_use?, #is_in_users_projects?, #metamorphosize, #similar

Methods included from SoftValidation

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

Methods included from Shared::AlternateValues

#all_values_for, #alternate_valued?

Methods included from Shared::Confidences

#reject_confidences

Methods included from Shared::Citations

#cited?, #mark_citations_for_destruction, #nomenclature_date, #origin_citation_source_id, #reject_citations, #requires_citation?, #sources_by_topic_id

Methods included from Shared::Depictions

#has_depictions?, #image_array=, #reject_depictions, #reject_images

Methods included from Shared::Notes

#concatenated_notes_string, #reject_notes

Methods included from Shared::Identifiers

#identified?, #next_by_identifier, #previous_by_identifier, #reject_identifiers

Methods included from Shared::Tags

#reject_tags, #tag_with, #tagged?, #tagged_with?

Methods included from Shared::HasRoles

#has_roles?

Methods included from Shared::DataAttributes

#import_attributes, #internal_attributes, #keyword_value_hash, #reject_data_attributes

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Method Details

#get_full_nameObject



26
27
28
29
# File 'app/models/hybrid.rb', line 26

def get_full_name
  hr = hybrid_relationships.reload
  hr.empty? ? '[HYBRID TAXA NOT SELECTED]' : hr.collect{|i| i.subject_taxon_name.cached}.sort.join(' x ')
end

#get_full_name_html(name = nil) ⇒ Object

TODO: get rid of bogus params signature call



21
22
23
24
# File 'app/models/hybrid.rb', line 21

def get_full_name_html(name = nil)
  hr = hybrid_relationships.reload
  hr.empty? ? '[HYBRID TAXA NOT SELECTED]' : hr.collect{|i| i.subject_taxon_name.cached_html}.sort.join(' × ')
end

#set_cached_valid_taxon_name_idObject

Overridden here, not applicable to this class



32
33
34
# File 'app/models/hybrid.rb', line 32

def set_cached_valid_taxon_name_id
  true 
end

#sv_hybrid_name_relationshipsObject (protected)



42
43
44
45
46
47
48
49
# File 'app/models/hybrid.rb', line 42

def sv_hybrid_name_relationships
  case hybrid_relationships.count
  when 0
    soft_validations.add(:base, 'Hybrid is not linked to non hybrid taxa')
  when 1
    soft_validations.add(:base, 'Hybrid should be linked to at least two non hybrid taxa')
  end
end

#validate_rank_class_classObject (protected)



38
39
40
# File 'app/models/hybrid.rb', line 38

def validate_rank_class_class
  errors.add(:rank_class, 'It is not an ICN rank') unless ICN.include?(rank_string)
end