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::ROOT_NAME, TaxonName::SPECIES_EPITHET_RANKS

Constants included from SoftValidation

SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS

Instance Attribute Summary

Attributes inherited from TaxonName

#also_create_otu, #cached, #cached_author, #cached_author_year, #cached_classified_as, #cached_html, #cached_misspelling, #cached_original_combination, #cached_original_combination_html, #cached_primary_homonym, #cached_primary_homonym_alternative_spelling, #cached_secondary_homonym, #cached_secondary_homonym_alternative_spelling, #etymology, #feminine_name, #masculine_name, #name, #neuter_name, #no_cached, #parent_id, #project_id, #rank_class, #taxonomy, #type, #verbatim_author, #verbatim_name, #year_of_publication

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_html_name_and_author_year, #cached_html_original_name_and_author_year, #cached_name_and_author_year, calculated_invalid, calculated_valid, #check_for_children, #check_new_parent_class, #check_new_rank_class, #classification_invalid_or_unavailable?, #classification_unavailable?, #classification_valid?, #clear_cached, #combination_list_all, #combination_list_self, #combined_statuses, #create_otu, #descendant_protonyms, #dwc_occurrences, #first_possible_invalid_taxan_name_relationship, #first_possible_valid_taxon_name, #first_possible_valid_taxon_name_relationship, foo, #full_name, #full_name_array, #full_name_hash, #gbif_status_array, #gender_class, #gender_instance, #gender_name, #genderized_name, #get_author, #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_ambiguously_invalid?, #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, #merge_to, #minimum_invalidating_year, #minimum_years_valid, #name_in_gender, #name_is_misapplied?, #name_with_misspelling, #next_sibling, #nomeclatural_history, #nomenclature_date, #normalized_genus, #not_binominal?, not_leaves, #original_author_year, out_of_scope_combinations, #out_of_scope_combinations, #part_of_speech_class, #part_of_speech_instance, #part_of_speech_name, #previous_sibling, #rank, #rank_string, #reified_id, #related_taxon_names, #relationship_invalid?, #safe_self_and_ancestors, select_optimized, #set_cached, #set_cached_author, #set_cached_author_columns, #set_cached_author_year, #set_cached_classified_as, #set_cached_nomenclature_date, #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_parent_is_valid_name, #sv_homotypic_synonyms, #sv_incomplete_combination, #sv_missing_classifications, #sv_missing_confidence_level, #sv_missing_etymology, #sv_missing_original_publication, #sv_missing_relationships, #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_classification_minimum_invalidating_year, #taxon_name_classifications_for_statuses, #taxon_name_relationship_minimum_invalidating_year, #unavailable_or_invalid?, used_recently, used_recently_in_classifications, used_recently_in_relationships, #validate_parent_from_the_same_project, #validate_root_name_is_root, #validate_source_type, with_taxon_name_relationship, #year_integer

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 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::QueryBatchUpdate

#query_update

Methods included from SoftValidation

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

Methods included from Shared::Labels

#labeled?

Methods included from Shared::HasPapertrail

#attribute_updated, #attribute_updater

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

#dwc_occurrence_id, #identified?, #next_by_identifier, #previous_by_identifier, #reject_identifiers, #uri, #uuid

Methods included from Shared::Tags

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

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



29
30
31
32
# File 'app/models/hybrid.rb', line 29

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



24
25
26
27
# File 'app/models/hybrid.rb', line 24

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_is_validObject

Overridden here, not applicable to this class



35
36
37
# File 'app/models/hybrid.rb', line 35

def set_cached_is_valid
  true
end

#set_cached_valid_taxon_name_idObject

Overridden here, not applicable to this class



40
41
42
# File 'app/models/hybrid.rb', line 40

def set_cached_valid_taxon_name_id
  true 
end

#sv_hybrid_name_relationshipsObject (protected)



50
51
52
53
54
55
56
57
# File 'app/models/hybrid.rb', line 50

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)



46
47
48
# File 'app/models/hybrid.rb', line 46

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