From 2934f6d83d7cc50788c120b2ed9ff0cbb3500978 Mon Sep 17 00:00:00 2001 From: Dmitry Dmitriev Date: Mon, 20 Mar 2017 19:11:16 -0500 Subject: [PATCH] ICNB relationships and classifications --- app/models/nomenclatural_rank.rb | 5 +- app/models/protonym.rb | 8 ++-- app/models/taxon_name.rb | 5 +- app/models/taxon_name_classification.rb | 12 ++++- .../legitimate/adopted_by_Persoon.rb | 2 +- .../legitimate/adopted_by_fries.rb | 2 +- app/models/taxon_name_classification/icnb.rb | 13 +++++ .../icnb/effectively_published.rb | 10 ++++ .../invalidly_published.rb | 15 ++++++ .../invalidly_published/nomen_nudum.rb | 14 ++++++ .../validly_published.rb | 11 +++++ .../validly_published/illegitimate.rb | 15 ++++++ .../validly_published/illegitimate/homonym.rb | 12 +++++ .../illegitimate/not_in_official_list.rb | 12 +++++ .../illegitimate/rejected.rb | 16 +++++++ .../validly_published/legitimate.rb | 15 ++++++ .../legitimate/candidatus.rb | 11 +++++ .../validly_published/legitimate/correct.rb | 15 ++++++ .../validly_published/legitimate/incorrect.rb | 15 ++++++ .../legitimate/nomen_novum.rb | 14 ++++++ .../legitimate/official_list.rb | 11 +++++ .../icnb/not_effectively_published.rb | 14 ++++++ app/models/taxon_name_relationship.rb | 9 ++-- app/models/taxon_name_relationship/icn.rb | 4 +- app/models/taxon_name_relationship/icnb.rb | 28 +++++++++++ .../taxon_name_relationship/icnb/accepting.rb | 30 ++++++++++++ .../icnb/accepting/conserved_name.rb | 39 +++++++++++++++ .../icnb/unaccepting.rb | 48 +++++++++++++++++++ .../icnb/unaccepting/homonym.rb | 40 ++++++++++++++++ .../icnb/unaccepting/misapplication.rb | 46 ++++++++++++++++++ .../icnb/unaccepting/synonym.rb | 33 +++++++++++++ .../icnb/unaccepting/synonym/objective.rb | 29 +++++++++++ .../icnb/unaccepting/synonym/subjective.rb | 29 +++++++++++ .../icnb/unaccepting/usage.rb | 17 +++++++ .../icnb/unaccepting/usage/misspelling.rb | 38 +++++++++++++++ app/models/taxon_name_relationship/iczn.rb | 4 +- config/initializers/constants/ranks.rb | 44 ++++++++++++----- .../constants/taxon_name_classifications.rb | 22 +++++++-- .../constants/taxon_name_relationships.rb | 6 ++- db/schema.rb | 2 +- 40 files changed, 682 insertions(+), 33 deletions(-) create mode 100644 app/models/taxon_name_classification/icnb.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/invalidly_published.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/invalidly_published/nomen_nudum.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/homonym.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/not_in_official_list.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/rejected.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/candidatus.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/correct.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/incorrect.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/nomen_novum.rb create mode 100644 app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/official_list.rb create mode 100644 app/models/taxon_name_classification/icnb/not_effectively_published.rb create mode 100644 app/models/taxon_name_relationship/icnb.rb create mode 100644 app/models/taxon_name_relationship/icnb/accepting.rb create mode 100644 app/models/taxon_name_relationship/icnb/accepting/conserved_name.rb create mode 100644 app/models/taxon_name_relationship/icnb/unaccepting.rb create mode 100644 app/models/taxon_name_relationship/icnb/unaccepting/homonym.rb create mode 100644 app/models/taxon_name_relationship/icnb/unaccepting/misapplication.rb create mode 100644 app/models/taxon_name_relationship/icnb/unaccepting/synonym.rb create mode 100644 app/models/taxon_name_relationship/icnb/unaccepting/synonym/objective.rb create mode 100644 app/models/taxon_name_relationship/icnb/unaccepting/synonym/subjective.rb create mode 100644 app/models/taxon_name_relationship/icnb/unaccepting/usage.rb create mode 100644 app/models/taxon_name_relationship/icnb/unaccepting/usage/misspelling.rb diff --git a/app/models/nomenclatural_rank.rb b/app/models/nomenclatural_rank.rb index 997438ee1b..92afb09ced 100644 --- a/app/models/nomenclatural_rank.rb +++ b/app/models/nomenclatural_rank.rb @@ -59,8 +59,9 @@ def self.rank_name # the name of the nomenclatural code, as a short symbol (:iczn, :icn), or nil def self.nomenclatural_code return :iczn if self.name.to_s =~ /Iczn/ + return :icnb if self.name.to_s =~ /Icnb/ return :icn if self.name.to_s =~ /Icn/ - nil + nil end # @return [NomenclaturalRank, nil] @@ -69,6 +70,8 @@ def self.nomenclatural_code_class case self.nomenclatural_code when :iczn NomenclaturalRank::Iczn + when :icnb + NomenclaturalRank::Icnb when :icn NomenclaturalRank::Icn else diff --git a/app/models/protonym.rb b/app/models/protonym.rb index af5c40523d..bb9cd013fa 100644 --- a/app/models/protonym.rb +++ b/app/models/protonym.rb @@ -64,7 +64,7 @@ class Protonym < TaxonName TaxonNameRelationship.descendants.each do |d| if d.respond_to?(:assignment_method) - if d.name.to_s =~ /TaxonNameRelationship::(Iczn|Icn|SourceClassifiedAs)/ + if d.name.to_s =~ /TaxonNameRelationship::(Iczn|Icn|Icnb|SourceClassifiedAs)/ relationship = "#{d.assignment_method}_relationship".to_sym has_one relationship, class_name: d.name.to_s, foreign_key: :subject_taxon_name_id has_one d.assignment_method.to_sym, through: relationship, source: :object_taxon_name @@ -80,7 +80,7 @@ class Protonym < TaxonName end if d.respond_to?(:inverse_assignment_method) - if d.name.to_s =~ /TaxonNameRelationship::(Iczn|Icn|SourceClassifiedAs)/ + if d.name.to_s =~ /TaxonNameRelationship::(Iczn|Icn|Icnb|SourceClassifiedAs)/ relationships = "#{d.inverse_assignment_method}_relationships".to_sym has_many relationships, -> { where("taxon_name_relationships.type LIKE '#{d.name.to_s}%'") @@ -130,7 +130,7 @@ class Protonym < TaxonName scope :that_is_valid, -> { joins('LEFT OUTER JOIN taxon_name_relationships tnr ON taxon_names.id = tnr.subject_taxon_name_id'). - where("taxon_names.id NOT IN (SELECT subject_taxon_name_id FROM taxon_name_relationships WHERE type ILIKE 'TaxonNameRelationship::Iczn::Invalidating%' OR type ILIKE 'TaxonNameRelationship::Icn::Unaccepting%')") + where("taxon_names.id NOT IN (SELECT subject_taxon_name_id FROM taxon_name_relationships WHERE type ILIKE 'TaxonNameRelationship::Iczn::Invalidating%' OR type ILIKE 'TaxonNameRelationship::Icn::Unaccepting%' OR type ILIKE 'TaxonNameRelationship::Icnb::Unaccepting%')") } # @return [Array of Strings] @@ -203,6 +203,8 @@ def get_author_and_year ay = iczn_author_and_year when :icn ay = icn_author_and_year + when :icnb + ay = icn_author_and_year else ay = ([self.author_string] + [self.year_integer]).compact.join(' ') end diff --git a/app/models/taxon_name.rb b/app/models/taxon_name.rb index 8056e0a249..263b33a383 100644 --- a/app/models/taxon_name.rb +++ b/app/models/taxon_name.rb @@ -436,7 +436,7 @@ def statuses_from_classifications end def taxon_name_classifications_for_statuses - taxon_name_classifications.with_type_array(ICZN_TAXON_NAME_CLASSIFICATION_NAMES + ICN_TAXON_NAME_CLASSIFICATION_NAMES) + taxon_name_classifications.with_type_array(ICZN_TAXON_NAME_CLASSIFICATION_NAMES + ICN_TAXON_NAME_CLASSIFICATION_NAMES + ICNB_TAXON_NAME_CLASSIFICATION_NAMES) end # @return [Array of String] @@ -877,7 +877,7 @@ def get_full_name_html eo = '' ec = '' return "#{eo}#{verbatim_name}#{ec}".gsub(' f. ', ec + ' f. ' + eo).gsub(' var. ', ec + ' var. ' + eo) if !self.verbatim_name.nil? && self.type == 'Combination' - return "#{eo}#{name}#{ec}" if self.rank_string == 'NomenclaturalRank::Iczn::GenusGroup::Supergenus' + return "#{eo}#{name}#{ec}" if self.rank_string == 'NomenclaturalRank::Iczn::GenusGroup::Supergenus' || self.rank_string == 'NomenclaturalRank::Icnb::GenusGroup::Supergenus' d = full_name_hash elements = [] @@ -1289,6 +1289,7 @@ def sv_validate_name # TODO: name these Regexp somewhere if (self.name =~ /^[a-zA-Z]*$/) || # !! should reference NOT_LATIN (nomenclatural_code == :iczn && self.name =~ /^[a-zA-Z]-[a-zA-Z]*$/) || + (nomenclatural_code == :icnb && self.name =~ /^[a-zA-Z]-[a-zA-Z]*$/) || (nomenclatural_code == :icn && self.name =~ /^[a-zA-Z]*-[a-zA-Z]*$/) || (nomenclatural_code == :icn && self.name =~ /^[a-zA-Z]*\s×\s[a-zA-Z]*$/) || (nomenclatural_code == :icn && self.name =~ /^×\s[a-zA-Z]*$/) diff --git a/app/models/taxon_name_classification.rb b/app/models/taxon_name_classification.rb index 0685a27119..94a5f5930d 100644 --- a/app/models/taxon_name_classification.rb +++ b/app/models/taxon_name_classification.rb @@ -43,6 +43,7 @@ class TaxonNameClassification < ActiveRecord::Base def nomenclature_code return :iczn if type.match(/::Iczn/) + return :icnb if type.match(/::Icnb/) return :icn if type.match(/::Icn/) return nil end @@ -223,12 +224,21 @@ def sv_not_specific_classes when 'TaxonNameClassification::Icn::EffectivelyPublished::InvalidlyPublished' soft_validations.add(:type, 'Please specify the reasons for the name being invalidly published') when 'TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished' - soft_validations.add(:type, 'Please specify if the name is legitimate or illegitimate') when 'TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate' soft_validations.add(:type, 'Please specify the reasons for the name being Legitimate') when 'TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Illegitimate' soft_validations.add(:type, 'Please specify the reasons for the name being Illegitimate') + when 'TaxonNameClassification::Icnb::EffectivelyPublished' + soft_validations.add(:type, 'Please specify if the name is validly or invalidly published') + when 'TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished' + soft_validations.add(:type, 'Please specify the reasons for the name being invalidly published') + when 'TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished' + soft_validations.add(:type, 'Please specify if the name is legitimate or illegitimate') + when 'TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate' + soft_validations.add(:type, 'Please specify the reasons for the name being Legitimate') + when 'TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Illegitimate' + soft_validations.add(:type, 'Please specify the reasons for the name being Illegitimate') end end diff --git a/app/models/taxon_name_classification/icn/effectively_published/validly_published/legitimate/adopted_by_Persoon.rb b/app/models/taxon_name_classification/icn/effectively_published/validly_published/legitimate/adopted_by_Persoon.rb index 0477797c3e..881d91c0ad 100644 --- a/app/models/taxon_name_classification/icn/effectively_published/validly_published/legitimate/adopted_by_Persoon.rb +++ b/app/models/taxon_name_classification/icn/effectively_published/validly_published/legitimate/adopted_by_Persoon.rb @@ -5,7 +5,7 @@ class TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legi def self.disjoint_taxon_name_classes self.parent.disjoint_taxon_name_classes + self.collect_to_s( TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate, - TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate::AdoptedByFries) + TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate::OfficialList) end end diff --git a/app/models/taxon_name_classification/icn/effectively_published/validly_published/legitimate/adopted_by_fries.rb b/app/models/taxon_name_classification/icn/effectively_published/validly_published/legitimate/adopted_by_fries.rb index c51c396340..4cd63f412a 100644 --- a/app/models/taxon_name_classification/icn/effectively_published/validly_published/legitimate/adopted_by_fries.rb +++ b/app/models/taxon_name_classification/icn/effectively_published/validly_published/legitimate/adopted_by_fries.rb @@ -1,4 +1,4 @@ -class TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate::AdoptedByFries < TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate +class TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate::OfficialList < TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000021' diff --git a/app/models/taxon_name_classification/icnb.rb b/app/models/taxon_name_classification/icnb.rb new file mode 100644 index 0000000000..e1c5b42cb2 --- /dev/null +++ b/app/models/taxon_name_classification/icnb.rb @@ -0,0 +1,13 @@ +class TaxonNameClassification::Icnb < TaxonNameClassification + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000110' + + def self.applicable_ranks + ICNB + end + + def self.disjoint_taxon_name_classes + ICZN_TAXON_NAME_CLASSIFICATION_NAMES + end + +end diff --git a/app/models/taxon_name_classification/icnb/effectively_published.rb b/app/models/taxon_name_classification/icnb/effectively_published.rb new file mode 100644 index 0000000000..ee4576934f --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published.rb @@ -0,0 +1,10 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished < TaxonNameClassification::Icnb + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000081' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_descendants_and_itself_to_s( + TaxonNameClassification::Icnb::NotEffectivelyPublished) + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_classification/icnb/effectively_published/invalidly_published.rb b/app/models/taxon_name_classification/icnb/effectively_published/invalidly_published.rb new file mode 100644 index 0000000000..18dd733fa3 --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/invalidly_published.rb @@ -0,0 +1,15 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished < TaxonNameClassification::Icnb::EffectivelyPublished + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000083' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + + [TaxonNameClassification::Icnb::EffectivelyPublished.to_s] + + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished) + end + + def self.gbif_status + 'invalidum' + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_classification/icnb/effectively_published/invalidly_published/nomen_nudum.rb b/app/models/taxon_name_classification/icnb/effectively_published/invalidly_published/nomen_nudum.rb new file mode 100644 index 0000000000..f09b982e4c --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/invalidly_published/nomen_nudum.rb @@ -0,0 +1,14 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished::NomenNudum < TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000090' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_to_s( + TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished) + end + + def self.gbif_status + 'nudum' + end + +end diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published.rb new file mode 100644 index 0000000000..973a648b0f --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published.rb @@ -0,0 +1,11 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished < TaxonNameClassification::Icnb::EffectivelyPublished + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000084' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + + [TaxonNameClassification::Icnb::EffectivelyPublished.to_s] + + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished) + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate.rb new file mode 100644 index 0000000000..ef14c38e8d --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate.rb @@ -0,0 +1,15 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000085' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + + [TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished.to_s] + + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate) + end + + def self.gbif_status + 'illegitimum' + end + +end diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/homonym.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/homonym.rb new file mode 100644 index 0000000000..f6290bb952 --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/homonym.rb @@ -0,0 +1,12 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::Homonym < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000091' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_to_s( + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::Rejected, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::NotInOfficialList) + end + +end diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/not_in_official_list.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/not_in_official_list.rb new file mode 100644 index 0000000000..cfab8b182d --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/not_in_official_list.rb @@ -0,0 +1,12 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::NotInOfficialList < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000105' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_to_s( + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::Rejected, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::Homonym) + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/rejected.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/rejected.rb new file mode 100644 index 0000000000..76a36cdaff --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/illegitimate/rejected.rb @@ -0,0 +1,16 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::Rejected < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000104' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_to_s( + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::NotInOfficialList, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::Homonym) + end + + def self.gbif_status + 'rejiciendum' + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate.rb new file mode 100644 index 0000000000..85f21a6807 --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate.rb @@ -0,0 +1,15 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000086' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + + [TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished.to_s] + + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate) + end + + def self.gbif_status + 'legitimate' + end + +end diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/candidatus.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/candidatus.rb new file mode 100644 index 0000000000..ad2754a251 --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/candidatus.rb @@ -0,0 +1,11 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::Candidatus < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000092' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_to_s( + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::OfficialList) + end + +end diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/correct.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/correct.rb new file mode 100644 index 0000000000..279c786df3 --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/correct.rb @@ -0,0 +1,15 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::Correct < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000087' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_to_s( + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::Incorrect) + end + + def self.gbif_status + 'valid' + end + +end diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/incorrect.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/incorrect.rb new file mode 100644 index 0000000000..d790f8836e --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/incorrect.rb @@ -0,0 +1,15 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::Incorrect < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000088' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_to_s( + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::Correct) + end + + def self.gbif_status + 'invalidum' + end + +end diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/nomen_novum.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/nomen_novum.rb new file mode 100644 index 0000000000..dcf01ad892 --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/nomen_novum.rb @@ -0,0 +1,14 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::NomenNovum < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000089' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_to_s( + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate) + end + + def self.gbif_status + 'novum' + end + +end diff --git a/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/official_list.rb b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/official_list.rb new file mode 100644 index 0000000000..7ff0040bac --- /dev/null +++ b/app/models/taxon_name_classification/icnb/effectively_published/validly_published/legitimate/official_list.rb @@ -0,0 +1,11 @@ +class TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::OfficialList < TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000103' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + self.collect_to_s( + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::Candidatus) + end + +end diff --git a/app/models/taxon_name_classification/icnb/not_effectively_published.rb b/app/models/taxon_name_classification/icnb/not_effectively_published.rb new file mode 100644 index 0000000000..68a1c6f9fa --- /dev/null +++ b/app/models/taxon_name_classification/icnb/not_effectively_published.rb @@ -0,0 +1,14 @@ +class TaxonNameClassification::Icnb::NotEffectivelyPublished < TaxonNameClassification::Icnb + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000082' + + def self.disjoint_taxon_name_classes + self.parent.disjoint_taxon_name_classes + + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Icnb::EffectivelyPublished) + end + + def self.gbif_status + 'invalidum' + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship.rb b/app/models/taxon_name_relationship.rb index 9135ee4523..21fe72a5fe 100644 --- a/app/models/taxon_name_relationship.rb +++ b/app/models/taxon_name_relationship.rb @@ -282,7 +282,7 @@ def validate_object_must_equal_subject_for_uncertain_placement def validate_subject_and_object_ranks tname = self.type_name - if tname =~ /TaxonNameRelationship::(Icn|Iczn)/ && tname != 'TaxonNameRelationship::Iczn::Validating::UncertainPlacement' + if tname =~ /TaxonNameRelationship::(Icnb|Icn|Iczn)/ && tname != 'TaxonNameRelationship::Iczn::Validating::UncertainPlacement' rank_group = self.subject_taxon_name.rank_class.parent unless rank_group == self.object_taxon_name.rank_class.parent errors.add(:object_taxon_name_id, "Rank of related taxon should be in the #{rank_group.rank_name}") @@ -479,7 +479,7 @@ def sv_specific_relationship end def sv_objective_synonym_relationship - if self.type_name =~ /TaxonNameRelationship::(Iczn::Invalidating::Synonym::Objective|Icn::Unaccepting::Synonym::Homotypic)/ + if self.type_name =~ /TaxonNameRelationship::(Iczn::Invalidating::Synonym::Objective|Icn::Unaccepting::Synonym::Homotypic|Icnb::Unaccepting::Synonym::Objective)/ s = self.subject_taxon_name o = self.object_taxon_name if (s.type_taxon_name != o.type_taxon_name ) || !s.has_same_primary_type(o) @@ -518,6 +518,9 @@ def sv_not_specific_relationship when 'TaxonNameRelationship::Icn::Unaccepting::Synonym' soft_validations.add(:type, 'Please specify if this is a homotypic or heterotypic synonym', fix: :sv_fix_specify_synonymy_type, success_message: 'Synonym updated to being homotypic or heterotypic') + when 'TaxonNameRelationship::Icnb::Unaccepting::Synonym' + soft_validations.add(:type, 'Please specify if this is a objective or subjective synonym', + fix: :sv_fix_specify_synonymy_type, success_message: 'Synonym updated to being objective or subjective') when 'TaxonNameRelationship::Iczn::Invalidating' soft_validations.add(:type, 'Please specify the reason for the name being Invalid') unless self.subject_taxon_name.classification_invalid_or_unavailable? when 'TaxonNameRelationship::Iczn::Invalidating::Homonym' @@ -683,7 +686,7 @@ def sv_validate_priority def sv_coordinated_taxa s = self.subject_taxon_name o = self.object_taxon_name - if self.type_name =~ /TaxonNameRelationship::(Iczn|Icn)/ + if self.type_name =~ /TaxonNameRelationship::(Iczn|Icnb|Icn)/ s_new = s.lowest_rank_coordinated_taxon o_new = o.lowest_rank_coordinated_taxon diff --git a/app/models/taxon_name_relationship/icn.rb b/app/models/taxon_name_relationship/icn.rb index 8f1c77b593..c73d65bc43 100644 --- a/app/models/taxon_name_relationship/icn.rb +++ b/app/models/taxon_name_relationship/icn.rb @@ -15,11 +15,11 @@ def self.valid_object_ranks end def self.disjoint_subject_classes - ICZN_TAXON_NAME_CLASSIFICATION_NAMES + ICZN_TAXON_NAME_CLASSIFICATION_NAMES + ICNB_TAXON_NAME_CLASSIFICATION_NAMES end def self.disjoint_object_classes - ICZN_TAXON_NAME_CLASSIFICATION_NAMES + + ICZN_TAXON_NAME_CLASSIFICATION_NAMES + ICNB_TAXON_NAME_CLASSIFICATION_NAMES + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Icn::NotEffectivelyPublished, TaxonNameClassification::Icn::EffectivelyPublished::InvalidlyPublished, TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Illegitimate) diff --git a/app/models/taxon_name_relationship/icnb.rb b/app/models/taxon_name_relationship/icnb.rb new file mode 100644 index 0000000000..bb7991ba7b --- /dev/null +++ b/app/models/taxon_name_relationship/icnb.rb @@ -0,0 +1,28 @@ +class TaxonNameRelationship::Icnb < TaxonNameRelationship + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000231' + + validates_uniqueness_of :subject_taxon_name_id, scope: [:type, :object_taxon_name_id] + + # left_side + def self.valid_subject_ranks + ::ICNB + end + + # right_side + def self.valid_object_ranks + ::ICNB + end + + def self.disjoint_subject_classes + ICZN_TAXON_NAME_CLASSIFICATION_NAMES + ICN_TAXON_NAME_CLASSIFICATION_NAMES + end + + def self.disjoint_object_classes + ICZN_TAXON_NAME_CLASSIFICATION_NAMES + ICN_TAXON_NAME_CLASSIFICATION_NAMES + + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Icnb::NotEffectivelyPublished, + TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate) + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship/icnb/accepting.rb b/app/models/taxon_name_relationship/icnb/accepting.rb new file mode 100644 index 0000000000..dee1bb33ea --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/accepting.rb @@ -0,0 +1,30 @@ +class TaxonNameRelationship::Icnb::Accepting < TaxonNameRelationship::Icnb + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000094' + + + def self.disjoint_taxon_name_relationships + self.parent.disjoint_taxon_name_relationships + + self.collect_descendants_and_itself_to_s(TaxonNameRelationship::Icnb::Unaccepting) + end + + def self.disjoint_subject_classes + self.parent.disjoint_subject_classes + + self.collect_descendants_to_s(TaxonNameClassification::Icnb::NotEffectivelyPublished, + TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate) + end + + def subject_properties + [ TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate ] + end + + def self.gbif_status_of_subject + 'valid' + end + + def self.gbif_status_of_object + 'invalidum' + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship/icnb/accepting/conserved_name.rb b/app/models/taxon_name_relationship/icnb/accepting/conserved_name.rb new file mode 100644 index 0000000000..47570082ed --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/accepting/conserved_name.rb @@ -0,0 +1,39 @@ +class TaxonNameRelationship::Icnb::Accepting::ConservedName < TaxonNameRelationship::Icnb::Accepting + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000095' + + def self.assignable + true + end + + def object_status + 'rejected' + end + + def subject_status + 'conserved' + end + + def self.gbif_status_of_subject + 'conservandum' + end + + def self.gbif_status_of_object + 'rejiciendum' + end + + def self.nomenclatural_priority + :reverse + end + + def self.assignment_method + # bus.set_as_icn_conserved_name_of(aus) + :icnb_set_as_conserved_name_of + end + + def self.inverse_assignment_method + # aus.icn_conserved_name = bus + :icnb_conserved_name + end + +end diff --git a/app/models/taxon_name_relationship/icnb/unaccepting.rb b/app/models/taxon_name_relationship/icnb/unaccepting.rb new file mode 100644 index 0000000000..fae0687d10 --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/unaccepting.rb @@ -0,0 +1,48 @@ +class TaxonNameRelationship::Icnb::Unaccepting < TaxonNameRelationship::Icnb + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000093' + + def self.disjoint_taxon_name_relationships + self.parent.disjoint_taxon_name_relationships + + self.collect_descendants_to_s(TaxonNameRelationship::Icnb::Accepting) + end + + def subject_properties + [ TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate ] + end + + def object_status + 'accepted name' + end + + def subject_status + 'unaccepted name' + end + + def self.gbif_status_of_subject + 'invalidum' + end + + def self.gbif_status_of_object + 'valid' + end + + def self.assignment_method + # bus.set_as_icn_unacceptable_of(aus) + :icnb_set_as_unacceptable_of + end + + def self.inverse_assignment_method + # aus.icn_unacceptable = bus + :icnb_unacceptable + end + + def self.nomenclatural_priority + :direct + end + + def self.assignable + true + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship/icnb/unaccepting/homonym.rb b/app/models/taxon_name_relationship/icnb/unaccepting/homonym.rb new file mode 100644 index 0000000000..e7220a3a44 --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/unaccepting/homonym.rb @@ -0,0 +1,40 @@ +class TaxonNameRelationship::Icnb::Unaccepting::Homonym < TaxonNameRelationship::Icnb::Unaccepting + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000097' + + def self.disjoint_taxon_name_relationships + self.parent.disjoint_taxon_name_relationships + + self.collect_to_s(TaxonNameRelationship::Icnb::Unaccepting) + + self.collect_descendants_to_s(TaxonNameRelationship::Icnb::Unaccepting::Usage) + end + + def self.disjoint_subject_classes + self.parent.disjoint_subject_classes + + self.collect_to_s(TaxonNameClassification::Icnb::NotEffectivelyPublished) + + self.collect_descendants_to_s(TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate) + end + + def subject_properties + [ TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate::Homonym ] + end + + def object_status + 'homonym' + end + + def subject_status + 'junior homonym' + end + + def self.assignment_method + # bus.set_as_icn_homonym_of(aus) + :icnb_set_as_homonym_of + end + + def self.inverse_assignment_method + # aus.icn_homonym = bus + :icnb_homonym + end + +end diff --git a/app/models/taxon_name_relationship/icnb/unaccepting/misapplication.rb b/app/models/taxon_name_relationship/icnb/unaccepting/misapplication.rb new file mode 100644 index 0000000000..e16d2e03b0 --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/unaccepting/misapplication.rb @@ -0,0 +1,46 @@ +class TaxonNameRelationship::Icnb::Unaccepting::Usage::Misapplication < TaxonNameRelationship::Icnb::Unaccepting::Usage + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000100' + + def self.disjoint_taxon_name_relationships + self.parent.disjoint_taxon_name_relationships + + self.collect_to_s(TaxonNameRelationship::Icnb::Unaccepting::Synonym, + TaxonNameRelationship::Icnb::Unaccepting::Homonym, + TaxonNameRelationship::Icnb::Unaccepting::Usage) + end + + def self.disjoint_subject_classes + self.parent.disjoint_subject_classes + + self.collect_to_s(TaxonNameClassification::Icnb::NotEffectivelyPublished) + + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate) + end + + def subject_properties + [ TaxonNameClassification::Icnb::NotEffectivelyPublished ] + end + + + def object_status + 'correct application' + end + + def subject_status + 'misapplication' + end + + def self.gbif_status_of_subject + 'ambigua' + end + + def self.assignment_method + # bus.set_as_icn_misapplication_of(aus) + :icnb_set_as_misapplication_of + end + + def self.inverse_assignment_method + # aus.icn_misapplication = bus + :icnb_misapplication + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship/icnb/unaccepting/synonym.rb b/app/models/taxon_name_relationship/icnb/unaccepting/synonym.rb new file mode 100644 index 0000000000..4c2c6a69b2 --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/unaccepting/synonym.rb @@ -0,0 +1,33 @@ +class TaxonNameRelationship::Icnb::Unaccepting::Synonym < TaxonNameRelationship::Icnb::Unaccepting + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000096' + + def self.disjoint_taxon_name_relationships + self.parent.disjoint_taxon_name_relationships + + self.collect_to_s(TaxonNameRelationship::Icnb::Unaccepting) + + self.collect_descendants_to_s(TaxonNameRelationship::Icnb::Unaccepting::Usage) + end + + def subject_properties + [ TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate ] + end + + def object_status + 'synonym' + end + + def subject_status + 'junior synonym' + end + + def self.assignment_method + # bus.set_as_icn_synonym_of(aus) + :icnb_set_as_synonym_of + end + + def self.inverse_assignment_method + # aus.icn_synonym = bus + :icnb_synonym + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship/icnb/unaccepting/synonym/objective.rb b/app/models/taxon_name_relationship/icnb/unaccepting/synonym/objective.rb new file mode 100644 index 0000000000..b06952c6e8 --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/unaccepting/synonym/objective.rb @@ -0,0 +1,29 @@ +class TaxonNameRelationship::Icnb::Unaccepting::Synonym::Objective < TaxonNameRelationship::Icnb::Unaccepting::Synonym + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000101' + + def self.disjoint_taxon_name_relationships + self.parent.disjoint_taxon_name_relationships + + self.collect_to_s(TaxonNameRelationship::Icnb::Unaccepting::Synonym, + TaxonNameRelationship::Icnb::Unaccepting::Synonym::Subjective) + end + + def object_status + 'objective senior synonym' + end + + def subject_status + 'objective synonym' + end + + def self.assignment_method + # bus.set_as_icn_homotypic_synonym_of(aus) + :icnb_set_as_objective_synonym_of + end + + def self.inverse_assignment_method + # aus.icn_homotypic_synonym = bus + :icnb_objective_synonym + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship/icnb/unaccepting/synonym/subjective.rb b/app/models/taxon_name_relationship/icnb/unaccepting/synonym/subjective.rb new file mode 100644 index 0000000000..de5b657869 --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/unaccepting/synonym/subjective.rb @@ -0,0 +1,29 @@ +class TaxonNameRelationship::Icnb::Unaccepting::Synonym::Subjective < TaxonNameRelationship::Icnb::Unaccepting::Synonym + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000102' + + def self.disjoint_taxon_name_relationships + self.parent.disjoint_taxon_name_relationships + + self.collect_to_s(TaxonNameRelationship::Icnb::Unaccepting::Synonym) + + self.collect_descendants_and_itself_to_s(TaxonNameRelationship::Icnb::Unaccepting::Synonym::Objective) + end + + def object_status + 'subjective senior synonym' + end + + def subject_status + 'subjective synonym' + end + + def self.assignment_method + # bus.set_as_icn_heterotypic_synonym_of(aus) + :icnb_set_as_subjective_synonym_of + end + + def self.inverse_assignment_method + # aus.icn_heterotypic_synonym = bus + :icnb_subjective_synonym + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship/icnb/unaccepting/usage.rb b/app/models/taxon_name_relationship/icnb/unaccepting/usage.rb new file mode 100644 index 0000000000..377bed4274 --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/unaccepting/usage.rb @@ -0,0 +1,17 @@ +class TaxonNameRelationship::Icnb::Unaccepting::Usage < TaxonNameRelationship::Icnb::Unaccepting + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000098' + + def self.disjoint_taxon_name_relationships + self.parent.disjoint_taxon_name_relationships + + self.collect_to_s(TaxonNameRelationship::Icnb::Unaccepting, + TaxonNameRelationship::Icnb::Unaccepting::Homonym) + + self.collect_descendants_and_itself_to_s(TaxonNameRelationship::Icnb::Unaccepting::Synonym) + end + + def subject_properties + [ TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished ] + end + + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship/icnb/unaccepting/usage/misspelling.rb b/app/models/taxon_name_relationship/icnb/unaccepting/usage/misspelling.rb new file mode 100644 index 0000000000..5903a9af47 --- /dev/null +++ b/app/models/taxon_name_relationship/icnb/unaccepting/usage/misspelling.rb @@ -0,0 +1,38 @@ +class TaxonNameRelationship::Icnb::Unaccepting::Usage::Misspelling < TaxonNameRelationship::Icnb::Unaccepting::Usage + + NOMEN_URI='http://purl.obolibrary.org/obo/NOMEN_0000099' + + def self.disjoint_taxon_name_relationships + self.parent.disjoint_taxon_name_relationships + end + + def self.disjoint_subject_classes + self.parent.disjoint_subject_classes + + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate) + + self.collect_to_s(TaxonNameClassification::Icnb::NotEffectivelyPublished) + end + + def object_status + 'correct spelling' + end + + def subject_status + 'misspelling' + end + + def self.gbif_status_of_subject + 'nullum' + end + + def self.assignment_method + # bus.set_as_icn_misspelling_of(aus) + :icnb_set_as_misspelling_of + end + + def self.inverse_assignment_method + # aus.icn_misspelling = bus + :icnb_misspelling + end + +end \ No newline at end of file diff --git a/app/models/taxon_name_relationship/iczn.rb b/app/models/taxon_name_relationship/iczn.rb index 6d80ce7c34..c07ee38e07 100644 --- a/app/models/taxon_name_relationship/iczn.rb +++ b/app/models/taxon_name_relationship/iczn.rb @@ -15,11 +15,11 @@ def self.valid_object_ranks end def self.disjoint_subject_classes - ICN_TAXON_NAME_CLASSIFICATION_NAMES + ICN_TAXON_NAME_CLASSIFICATION_NAMES + ICNB_TAXON_NAME_CLASSIFICATION_NAMES end def self.disjoint_object_classes - ICN_TAXON_NAME_CLASSIFICATION_NAMES + + ICN_TAXON_NAME_CLASSIFICATION_NAMES + ICNB_TAXON_NAME_CLASSIFICATION_NAMES + self.collect_descendants_and_itself_to_s(TaxonNameClassification::Iczn::Unavailable) end diff --git a/config/initializers/constants/ranks.rb b/config/initializers/constants/ranks.rb index 9ea1831a21..1ed73bbe78 100644 --- a/config/initializers/constants/ranks.rb +++ b/config/initializers/constants/ranks.rb @@ -8,23 +8,29 @@ # ICZN class names ordered in an Array ICZN = NomenclaturalRank::Iczn.ordered_ranks.collect{|r| r.to_s}.freeze +# ICZN class names ordered in an Array +ICNB = NomenclaturalRank::Icnb.ordered_ranks.collect{|r| r.to_s}.freeze + # All assignable Rank Classes -RANKS = ( ['NomenclaturalRank'] + ICN + ICZN ).freeze +RANKS = ( ['NomenclaturalRank'] + ICN + ICZN + ICNB).freeze # ICN Rank Classes in a Hash with keys being the "human" name # For example, to return the class for a plant family: # ::ICN_LOOKUP['family'] ICN_LOOKUP = ICN.inject({}){|hsh, r| hsh.merge!(r.constantize.rank_name => r)}.freeze +# ::ICNB_LOOKUP['family'] +ICNB_LOOKUP = ICNB.inject({}){|hsh, r| hsh.merge!(r.constantize.rank_name => r)}.freeze + # ICZN Rank Classes in a Hash with keys being the "human" name ICZN_LOOKUP = ICZN.inject({}){|hsh, r| hsh.merge!(r.constantize.rank_name => r)}.freeze # All ranks, with keys as class strings pointing to common usage -RANKS_LOOKUP = ICN_LOOKUP.invert.merge(ICZN_LOOKUP.invert).freeze +RANKS_LOOKUP = ICN_LOOKUP.invert.merge(ICZN_LOOKUP.invert.merge(ICNB_LOOKUP.invert)).freeze # An Array of Arrays, used in options for select # [["class (ICN)", "NomenclaturalRank::Icn::HigherClassificationGroup::ClassRank"] .. ] -RANKS_SELECT_OPTIONS = RANKS_LOOKUP.collect{|k,v| ["#{v} " + ((k.to_s =~ /Iczn/) ? '(ICZN)' : '(ICN)' ), k, {class: ((k.to_s =~ /Iczn/) ? :iczn : :icn) }] }.sort{|a, b| a[0] <=> b[0]}.freeze +RANKS_SELECT_OPTIONS = RANKS_LOOKUP.collect{|k,v| ["#{v} " + ((k.to_s =~ /Iczn/) ? '(ICZN)' : ((k.to_s =~ /Icnb/) ? '(ICNB)' : '(ICN)') ), k, {class: ((k.to_s =~ /Iczn/) ? :iczn : ((k.to_s =~ /Icnb/) ? :icnb : :icn)) }] }.sort{|a, b| a[0] <=> b[0]}.freeze # All assignable ranks for family groups, for ICZN FAMILY_RANK_NAMES_ICZN = NomenclaturalRank::Iczn::FamilyGroup.descendants.collect{|i| i.to_s}.freeze @@ -32,17 +38,22 @@ # All assignable ranks for family groups, for ICN FAMILY_RANK_NAMES_ICN = NomenclaturalRank::Icn::FamilyGroup.descendants.collect{|i| i.to_s}.freeze -# All assignable ranks for family group, for both ICN and ICZN -FAMILY_RANK_NAMES = ( FAMILY_RANK_NAMES_ICZN + FAMILY_RANK_NAMES_ICN ).freeze +# All assignable ranks for family groups, for ICNB +FAMILY_RANK_NAMES_ICNB = NomenclaturalRank::Icnb::FamilyGroup.descendants.collect{|i| i.to_s}.freeze + +# All assignable ranks for family group, for ICN, ICNB, and ICZN +FAMILY_RANK_NAMES = ( FAMILY_RANK_NAMES_ICZN + FAMILY_RANK_NAMES_ICN + FAMILY_RANK_NAMES_ICNB ).freeze # All assignable ranks for family group and above family names, for ICZN FAMILY_AND_ABOVE_RANK_NAMES_ICZN = FAMILY_RANK_NAMES_ICZN + (NomenclaturalRank::Iczn::HigherClassificationGroup.descendants).collect{|i| i.to_s}.freeze -# All assignable ranks for family group and above family names, for both ICN and ICZN +# All assignable ranks for family group and above family names, for ICN, ICNB, and ICZN FAMILY_AND_ABOVE_RANK_NAMES = FAMILY_AND_ABOVE_RANK_NAMES_ICZN + (NomenclaturalRank::Icn::HigherClassificationGroup.descendants + - NomenclaturalRank::Icn::FamilyGroup.descendants).collect{|i| i.to_s}.freeze + NomenclaturalRank::Icn::FamilyGroup.descendants).collect{|i| i.to_s} + + (NomenclaturalRank::Icnb::HigherClassificationGroup.descendants + + NomenclaturalRank::Icnb::FamilyGroup.descendants).collect{|i| i.to_s}.freeze # All assignable ranks for genus groups, for ICZN GENUS_RANK_NAMES_ICZN = NomenclaturalRank::Iczn::GenusGroup.descendants.collect{|i| i.to_s}.freeze @@ -50,25 +61,34 @@ # All assignable ranks for genus groups, for both ICN GENUS_RANK_NAMES_ICN = NomenclaturalRank::Icn::GenusGroup.descendants.collect{|i| i.to_s}.freeze +# All assignable ranks for genus groups, for both ICNB +GENUS_RANK_NAMES_ICNB = NomenclaturalRank::Icnb::GenusGroup.descendants.collect{|i| i.to_s}.freeze + # All assignable ranks for species groups, for ICZN SPECIES_RANK_NAMES_ICZN = NomenclaturalRank::Iczn::SpeciesGroup.descendants.collect{|i| i.to_s}.freeze # All assignable ranks for species groups, for both ICN SPECIES_RANK_NAMES_ICN = NomenclaturalRank::Icn::SpeciesGroup.descendants.collect{|i| i.to_s}.freeze +# All assignable ranks for species groups, for both ICNB +SPECIES_RANK_NAMES_ICNB = NomenclaturalRank::Icnb::SpeciesGroup.descendants.collect{|i| i.to_s}.freeze + # All assignable ranks for genus and species groups, for both ICZN GENUS_AND_SPECIES_RANK_NAMES_ICZN = ( GENUS_RANK_NAMES_ICZN + SPECIES_RANK_NAMES_ICZN ).freeze # All assignable ranks for genus and species groups, for both ICN GENUS_AND_SPECIES_RANK_NAMES_ICN = ( GENUS_RANK_NAMES_ICN + SPECIES_RANK_NAMES_ICN ).freeze -# All assignable ranks for genus groups, for both ICN and ICZN -GENUS_RANK_NAMES = ( GENUS_RANK_NAMES_ICZN + GENUS_RANK_NAMES_ICN ).freeze +# All assignable ranks for genus and species groups, for both ICNB +GENUS_AND_SPECIES_RANK_NAMES_ICNB = ( GENUS_RANK_NAMES_ICNB + SPECIES_RANK_NAMES_ICNB ).freeze + +# All assignable ranks for genus groups, for ICN, ICNB, and ICZN +GENUS_RANK_NAMES = ( GENUS_RANK_NAMES_ICZN + GENUS_RANK_NAMES_ICN + GENUS_RANK_NAMES_ICNB ).freeze -# All assignable ranks for species groups, for both ICN and ICZN -SPECIES_RANK_NAMES = ( SPECIES_RANK_NAMES_ICZN + SPECIES_RANK_NAMES_ICN ).freeze +# All assignable ranks for species groups, for ICN, ICNB, and ICZN +SPECIES_RANK_NAMES = ( SPECIES_RANK_NAMES_ICZN + SPECIES_RANK_NAMES_ICN + SPECIES_RANK_NAMES_ICNB ).freeze -# All assignable ranks for genus and species groups, for both ICN and ICZN +# All assignable ranks for genus and species groups, for ICN, ICNB, and ICZN GENUS_AND_SPECIES_RANK_NAMES = ( GENUS_RANK_NAMES + SPECIES_RANK_NAMES ).freeze diff --git a/config/initializers/constants/taxon_name_classifications.rb b/config/initializers/constants/taxon_name_classifications.rb index 8a12749a2e..cfc67c600e 100644 --- a/config/initializers/constants/taxon_name_classifications.rb +++ b/config/initializers/constants/taxon_name_classifications.rb @@ -12,6 +12,10 @@ # Array of all ICN TaxonNameClassifications classes, as Strings ICN_TAXON_NAME_CLASSIFICATION_NAMES = TaxonNameClassification::Icn.descendants.collect{|d| d.to_s}.freeze +# Array of all ICNB TaxonNameClassifications classes, as Strings +ICNB_TAXON_NAME_CLASSIFICATION_NAMES = TaxonNameClassification::Icnb.descendants.collect{|d| d.to_s}.freeze + + TAXON_NAME_CLASSIFICATION_GENDER_CLASSES = TaxonNameClassification::Latinized::Gender.descendants.freeze ICZN_TAXON_NAME_CLASSIFICATION_HASH = (ICZN_TAXON_NAME_CLASSIFICATION_NAMES + LATINIZED_TAXON_NAME_CLASSIFICATION_NAMES).inject({}) { @@ -22,8 +26,12 @@ |hsh, klass| hsh.merge(klass.constantize.name => klass) }.freeze +ICNB_TAXON_NAME_CLASSIFICATION_HASH = (ICNB_TAXON_NAME_CLASSIFICATION_NAMES + LATINIZED_TAXON_NAME_CLASSIFICATION_NAMES).inject({}) { + |hsh, klass| hsh.merge(klass.constantize.name => klass) +}.freeze + # Array of all TaxonNameClassifications classes, as Strings -TAXON_NAME_CLASSIFICATION_NAMES = (ICN_TAXON_NAME_CLASSIFICATION_NAMES + ICZN_TAXON_NAME_CLASSIFICATION_NAMES + LATINIZED_TAXON_NAME_CLASSIFICATION_NAMES).freeze +TAXON_NAME_CLASSIFICATION_NAMES = (ICN_TAXON_NAME_CLASSIFICATION_NAMES + ICNB_TAXON_NAME_CLASSIFICATION_NAMES + ICZN_TAXON_NAME_CLASSIFICATION_NAMES + LATINIZED_TAXON_NAME_CLASSIFICATION_NAMES).freeze # Array of all Unavailable and Invalid TaxonNameClassifications classes, as Strings TAXON_NAME_CLASS_NAMES_UNAVAILABLE_AND_INVALID = [ @@ -36,14 +44,22 @@ TaxonNameClassification::Icn::EffectivelyPublished::InvalidlyPublished, TaxonNameClassification::Icn::EffectivelyPublished::InvalidlyPublished.descendants, TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Illegitimate, - TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Illegitimate.descendants + TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Illegitimate.descendants, + TaxonNameClassification::Icnb::NotEffectivelyPublished, + TaxonNameClassification::Icnb::NotEffectivelyPublished.descendants, + TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished, + TaxonNameClassification::Icnb::EffectivelyPublished::InvalidlyPublished.descendants, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Illegitimate.descendants, ].flatten.map(&:to_s).freeze TAXON_NAME_CLASS_NAMES_VALID = [ TaxonNameClassification::Iczn::Available::Valid, TaxonNameClassification::Iczn::Available::Valid.descendants, TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate::Correct, - TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate::Correct.descendants + TaxonNameClassification::Icn::EffectivelyPublished::ValidlyPublished::Legitimate::Correct.descendants, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::Correct, + TaxonNameClassification::Icnb::EffectivelyPublished::ValidlyPublished::Legitimate::Correct.descendants ].flatten.map(&:to_s).freeze diff --git a/config/initializers/constants/taxon_name_relationships.rb b/config/initializers/constants/taxon_name_relationships.rb index ca87cec72e..2b66527ce2 100644 --- a/config/initializers/constants/taxon_name_relationships.rb +++ b/config/initializers/constants/taxon_name_relationships.rb @@ -10,6 +10,9 @@ # Array of all ICN TaxonNameRelationship classes, as Strings ICN_TAXON_NAME_RELATIONSHIP_NAMES = TaxonNameRelationship::Icn.descendants.collect{|d| d.to_s}.freeze +# Array of all ICNB TaxonNameRelationship classes, as Strings +ICNB_TAXON_NAME_RELATIONSHIP_NAMES = TaxonNameRelationship::Icnb.descendants.collect{|d| d.to_s}.freeze + # Array of all ICZN + ICN TaxonNameRelationship classes, as Strings STATUS_TAXON_NAME_RELATIONSHIP_NAMES = (ICZN_TAXON_NAME_RELATIONSHIP_NAMES + ICN_TAXON_NAME_RELATIONSHIP_NAMES).freeze @@ -19,7 +22,8 @@ # Array of all invalid TaxonNameRelationship classes, as Strings TAXON_NAME_RELATIONSHIP_NAMES_INVALID = TaxonNameRelationship. collect_descendants_and_itself_to_s(TaxonNameRelationship::Iczn::Invalidating, - TaxonNameRelationship::Icn::Unaccepting).freeze + TaxonNameRelationship::Icn::Unaccepting, + TaxonNameRelationship::Icnb::Unaccepting).freeze # TODO: check .assignable property prior to building diff --git a/db/schema.rb b/db/schema.rb index 79c9ab58ca..c116da1ece 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -16,8 +16,8 @@ # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" enable_extension "postgis" - enable_extension "fuzzystrmatch" enable_extension "hstore" + enable_extension "fuzzystrmatch" create_table "alternate_values", force: :cascade do |t| t.text "value", null: false