Class: Pubid::Oiml::Identifiers::Bulletin
- Inherits:
-
SingleIdentifier
- Object
- Identifier
- Pubid::Oiml::Identifier
- SingleIdentifier
- Pubid::Oiml::Identifiers::Bulletin
- Defined in:
- lib/pubid/oiml/identifiers/bulletin.rb
Overview
OIML Bulletin issues and articles. Carries no code — the locator is the (year, issue, sequence) tuple drawn from the issue's place in the periodical hierarchy.
Two input forms are accepted, both referring to the same article:
structured: "OIML Bulletin 2026-02-11"
citation: "OIML Bulletin LXVII(2) 20260211"
The structured form is the dataset's primary docid (sortable,
deterministic). The citation form is what OIML prints on the article
page (Citation: AUTHOR YEAR OIML Bulletin VOLUME(ISSUE) ARTID).
Volume tracks year deterministically: 1960 = I, year - 1959 = volume. The 8-digit article id is YYYYNNSS — the same three values concatenated, so the citation form is decoded entirely from the article id; the roman volume and parenthesised issue are redundant display.
Shapes in relaton-data-oiml:
"OIML Bulletin" (periodical)
"OIML Bulletin 1960" (volume / year)
"OIML Bulletin 1960-03" (issue)
"OIML Bulletin 1960-03-01" (article, structured)
"OIML Bulletin LXVII(2) 20260211" (article, citation)
Constant Summary collapse
- BASE_YEAR_OFFSET =
OIML Bulletin volume I was issued in 1960. Volume N corresponds to year (N + BASE_YEAR_OFFSET). Used to translate between the year carried in the structured form and the roman volume in citations.
1959- ROMAN_TABLE =
[ [1000, "M"], [900, "CM"], [500, "D"], [400, "CD"], [100, "C"], [90, "XC"], [50, "L"], [40, "XL"], [10, "X"], [9, "IX"], [5, "V"], [4, "IV"], [1, "I"] ].freeze
Constants inherited from Pubid::Oiml::Identifier
Pubid::Oiml::Identifier::OIML_TYPE_MAP
Instance Attribute Summary
Attributes inherited from SingleIdentifier
Class Method Summary collapse
-
.to_roman(number) ⇒ Object
Convert a positive integer to its roman-numeral representation.
Instance Method Summary collapse
-
#article_id ⇒ Object
8-digit oiml.org article id ("20260211").
- #type_string ⇒ Object
-
#volume_arabic ⇒ Object
Volume as an arabic string ("67"), derived from the year.
-
#volume_roman ⇒ Object
Volume as a roman-numeral string ("LXVII"), derived from the year.
Methods inherited from SingleIdentifier
#code_for, #edition_portion, #emit_kv, #number_from_kv, #number_to_kv, #part_from_kv, #part_to_kv, #space_suffix_from_kv, #space_suffix_to_kv, #subpart_from_kv, #subpart_to_kv, #suffix_from_kv, #suffix_to_kv, #to_s, #type, #year_from_kv, #year_to_kv
Methods inherited from Pubid::Oiml::Identifier
Class Method Details
.to_roman(number) ⇒ Object
Convert a positive integer to its roman-numeral representation.
Used to render the citation form. The dataset already stores the
roman volume verbatim in extent.locality, so this conversion is
only needed when rendering from the structured form.
82 83 84 85 86 87 88 89 |
# File 'lib/pubid/oiml/identifiers/bulletin.rb', line 82 def to_roman(number) raise ArgumentError, "volume must be > 0" unless number.positive? ROMAN_TABLE.each_with_object(+"") do |(value, sym), result| quotient, number = number.divmod(value) result << (sym * quotient) end.freeze end |
Instance Method Details
#article_id ⇒ Object
8-digit oiml.org article id ("20260211"). Composed by concatenating year + issue + sequence. nil unless all three are present.
71 72 73 74 75 |
# File 'lib/pubid/oiml/identifiers/bulletin.rb', line 71 def article_id return nil unless date&.year && issue && sequence "#{date.year}#{issue}#{sequence}" end |
#type_string ⇒ Object
48 49 50 |
# File 'lib/pubid/oiml/identifiers/bulletin.rb', line 48 def type_string "Bulletin" end |
#volume_arabic ⇒ Object
Volume as an arabic string ("67"), derived from the year. nil when the year is absent (bare periodical reference).
54 55 56 57 58 |
# File 'lib/pubid/oiml/identifiers/bulletin.rb', line 54 def volume_arabic return nil unless date&.year (date.year.to_i - BASE_YEAR_OFFSET).to_s end |
#volume_roman ⇒ Object
Volume as a roman-numeral string ("LXVII"), derived from the year. nil when the year is absent.
62 63 64 65 66 67 |
# File 'lib/pubid/oiml/identifiers/bulletin.rb', line 62 def volume_roman number = volume_arabic&.to_i return nil unless number&.positive? self.class.to_roman(number) end |