Class: Identifier::Global::Doi

Inherits:
Identifier::Global show all
Defined in:
app/models/identifier/global/doi.rb

Overview

Digital Object Identifier

per  http://www.doi.org/doi_handbook/2_Numbering.html

Section 2.2 on 1/31/2014

The DOI syntax shall be made up of a DOI prefix and a DOI suffix separated by a forward slash.
There is no defined limit on the length of the DOI name, or of the DOI prefix or DOI suffix.
The DOI name is case-insensitive and can incorporate any printable characters from the legal graphic characters
  of Unicode. Further constraints on character use (e.g. use of language-specific alphanumeric characters) can
  be defined for an application by the ISO 26324 Registration Authority.
The combination of a unique DOI prefix (assigned to a particular DOI registrant) and a unique DOI suffix
  (provided by that registrant for a specific object) is unique, and so allows the de-centralized allocation of
  DOI names.
The DOI name is an opaque string for the purposes of the DOI system. No definitive information may be inferred
  from the specific character string of a DOI name. In particular, the inclusion in a DOI name of any registrant
  code allocated to a specific registrant does not provide evidence of the ownership of rights or current management
  responsibility of any intellectual property in the referent. Such information may be asserted in the associated
  metadata.

Section 2.2.2

General
  The DOI prefix shall be composed of a directory indicator followed by a registrant code. These two components
    shall be separated by a full stop (period).

Directory indicator

  The directory indicator shall be "10". The directory indicator distinguishes the entire set of character strings
    (prefix and suffix) as digital object identifiers within the resolution system.

Registrant code

  The second element of the DOI prefix shall be the registrant code. The registrant code is a unique string assigned
     to a registrant.

Constant Summary collapse

DOI_MATCH =
/^(doi:|http(s)?:\/\/(dx\.)?doi\.org\/)/i

Constants included from SoftValidation

SoftValidation::ANCESTORS_WITH_SOFT_VALIDATIONS

Constants included from Shared::DualAnnotator

Shared::DualAnnotator::ALWAYS_COMMUNITY

Instance Attribute Summary

Attributes inherited from Identifier::Global

#relation

Attributes inherited from Identifier

#cached, #cached_numeric_identifier, #identifier, #identifier_object_id, #namespace_id, #project_id, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Identifier::Global

#build_cached, #dwc_occurrences, #is_global?, #sv_resolves?

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 inherited from Identifier

#build_cached, #build_cached_numeric_identifier, #is_global?, #is_local?, prototype_identifier, #set_cached, #type_name

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

#labeled?

Methods included from Housekeeping

#has_polymorphic_relationship?

Methods included from Shared::PolymorphicAnnotator

#annotated_object_is_persisted?

Methods inherited from ApplicationRecord

transaction_with_retry

Class Method Details

.preface_doi(raw) ⇒ Object (protected)



49
50
51
52
53
54
55
# File 'app/models/identifier/global/doi.rb', line 49

def self.preface_doi(raw)
  return raw if raw.blank?
  raw.strip!
  return raw if raw.start_with?('http') # already a URL?
  # probably a raw DOI
  'https://doi.org/' + raw
end

Instance Method Details

#handle_prefixesObject (protected)

permit and remove various preambles: ‘doi:’, ‘dx.doi.org/’, ‘doi.org/’



43
44
45
46
47
# File 'app/models/identifier/global/doi.rb', line 43

def handle_prefixes
  return identifier if identifier.blank?
  identifier.strip!
  identifier.gsub!(DOI_MATCH, '') if identifier
end