Class: Identifier::Global::Uri::ChecklistBank
Overview
For example https://api.checklistbank.org/dataset/9802/taxon/1000027.
This has properties that blur into Namespace, we could think of Datasets as Namespaces.
It is also somewhat hybrid conceptually in that while Global it doesn't have the same rigour as in definition, broadness, etc.
!! Neither of dataset_id and taxon_id need be integers.
Constant Summary
collapse
- API_ROOT =
'https://api.checklistbank.org'
- VALID_ROOTS =
%w{
https://www.checklistbank.org
http://api.checklistbank.org
} + [API_ROOT]
SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS
Instance Attribute Summary collapse
#relation
Instance Method Summary
collapse
#uri_attribute, #valid_uri
#build_cached, #dwc_occurrences, #is_global?, #sv_resolves?
#clear_soft_validations, #fix_for, #fix_soft_validations, #soft_fixed?, #soft_valid?, #soft_validate, #soft_validated?, #soft_validations, #soft_validators
Instance Attribute Details
#dataset_id ⇒ Object
28
29
30
|
# File 'app/models/identifier/global/uri/checklist_bank.rb', line 28
def dataset_id
@dataset_id || identifier&.split('/')&.fetch(4, nil)
end
|
#taxon_id ⇒ Object
32
33
34
|
# File 'app/models/identifier/global/uri/checklist_bank.rb', line 32
def taxon_id
@taxon_id || identifier&.split('/')&.fetch(6, nil)
end
|
Instance Method Details
24
25
26
|
# File 'app/models/identifier/global/uri/checklist_bank.rb', line 24
def api_format
[API_ROOT, 'dataset', dataset_id , 'taxon', taxon_id ].join('/')
end
|
42
43
44
|
# File 'app/models/identifier/global/uri/checklist_bank.rb', line 42
def path_format
errors.add(:identifier) unless identifier.match(/dataset\/.+\/taxon\/.+$/)
end
|
46
47
48
|
# File 'app/models/identifier/global/uri/checklist_bank.rb', line 46
def references_a_known_form
errors.add(:identifier, "Must start with one of #{VALID_ROOTS.join(', ')}.") if !(identifier =~ /^#{VALID_ROOTS.join('|')}/)
end
|
#set_identifier ⇒ Object
38
39
40
|
# File 'app/models/identifier/global/uri/checklist_bank.rb', line 38
def set_identifier
self.identifier = [API_ROOT, 'dataset', @dataset_id, 'taxon', @taxon_id].join('/')
end
|
#used_on_taxon_name_or_otu ⇒ Object
50
51
52
53
54
|
# File 'app/models/identifier/global/uri/checklist_bank.rb', line 50
def used_on_taxon_name_or_otu
if !%w{TaxonName Otu}.include?(identifier_object_type)
errors.add(:identifier_object_type, 'ChecklistBank identifiers may only be used on TaxonNames or Otus')
end
end
|