Class: BiocurationClass

Inherits:
ControlledVocabularyTerm show all
Includes:
Shared::DwcOccurrenceHooks, Shared::Tags
Defined in:
app/models/biocuration_class.rb

Overview

A BiocurationClass is used with BiocurationClassification to organize a collection according to some biological categories (attributes). Biocuration classes help to answer the question “where might I find this in the collection.”

For example, in an insect collection, this may be things like “adult”, “pupae”, “male”, “female”. More generally they could be categories like “skulls”, “furs”, or perhaps even “wet” or “dry”. It is important to note that these categorizations are for organization and curatorial purposes, they are not primary assertions that the collection object itself has the biological property “maleness”, or “adultness”. That is, in most, but not all, cases we can infer that the classification means that the collection object is a “male” or “adult”.

Constant Summary

Constants inherited from ControlledVocabularyTerm

ControlledVocabularyTerm::ALTERNATE_VALUES_FOR

Constants included from SoftValidation

SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS

Instance Attribute Summary

Attributes inherited from ControlledVocabularyTerm

#definition, #name, #project_id, #type, #uri, #uri_relation

Instance Method Summary collapse

Methods included from Shared::Tags

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

Methods inherited from ControlledVocabularyTerm

clone_from_project, #form_of_uri, #uri_relation_is_a_skos_relation

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::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 Shared::HasPapertrail

#attribute_updated, #attribute_updater

Methods included from Shared::AlternateValues

#all_values_for, #alternate_valued?

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods inherited from ApplicationRecord

transaction_with_retry

Instance Method Details

#check_dwc_occurrence_basisObject (protected)



43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'app/models/biocuration_class.rb', line 43

def check_dwc_occurrence_basis
  if saved_change_to_attribute?(:uri, from: DWC_FOSSIL_URI)
    collection_objects.each do |o|
      o.dwc_occurrence.update_attribute(:basisOfRecord, 'PreservedSpecimen')
    end
  end

  if saved_change_to_attribute?(:uri, to: DWC_FOSSIL_URI)
    collection_objects.each do |o|
      o.dwc_occurrence.update_attribute(:basisOfRecord, 'FossilSpecimen')
    end
  end
end

#dwc_occurrencesObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/models/biocuration_class.rb', line 26

def dwc_occurrences
  # Remember that classes must be tagged by a corresponding group with a URI to
  # become eligible as values for "grouped" Dwc attributes.
  if keywords.where(uri: ::DWC_ATTRIBUTE_URIS.values.flatten).any?
    ::Queries::DwcOccurrence::Filter.new(
      collection_object_query: {
        biocuration_class_id: id
      }
    ).all

  else
    DwcOccurrence.none
  end
end

#taggable_withObject



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

def taggable_with
  %w{BiocurationGroup}
end