pubid 0.1.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4593d133b8317644f3550f821ed29640ab1fc5ec241c0c1b8a5db119ea1b9c6
4
- data.tar.gz: b1ce4684350169c833c8825aa84a3966b51c90585efe7636678402f0d52580af
3
+ metadata.gz: fd93e44539bfdf58b577341e38c5a802723b0058e55feca77941ac8c3ff7eb63
4
+ data.tar.gz: 961315e34b66f01bace40aa7b154c391a2d880d98a9ba563f3aeee93d1fc8d23
5
5
  SHA512:
6
- metadata.gz: df2d32af3143b32af3d6d5f992ed0c01ca3e3ecc60ab0e5fa55884f81f0dff678f42a0f6fa1ffe0cf8b3dbe755748c7ca32f72bdd4ba1c43c19b8d26b130fa9a
7
- data.tar.gz: 80ed5a22574564137f015f06479f4d7b7c345b571b3656bf8d51adc797858f89963bda4162248e4eb6ec51dcffaa98bc4356f0e7bbbbd383790d3b7724c5d04d
6
+ metadata.gz: 3ab7e206004ae2113c0c4153644ba772e58b213f7417fb79f32abfedd155348dfbc988d16a65cca8ffecc45f80da8b7b517fcc25e29415e4f651226875e4b58e
7
+ data.tar.gz: d45a4e3994cd2b2d84895b5bcddb9fed669eda9e4463243c164a86cb20077ce9e0ce846f6dd9751eacb0cc16fdb8240c63bee7a1eb8dbcc776b2a0b6918b7bbf
data/README.adoc CHANGED
@@ -1,8 +1,82 @@
1
- = PubID
1
+ = Publication identifiers library
2
2
 
3
3
  image:https://badge.fury.io/rb/pubid.svg["Gem Version", link="https://badge.fury.io/rb/pubid"]
4
4
 
5
- == Purpose
5
+ Pubid is a comprehensive framework for building and working with publication identifiers. It provides a robust API for creating, modifying, parsing, exporting, and verifying document identifiers, which are crucial for various document management systems and standards compliance
6
6
 
7
- This gem include all pubid-* gems for compatibility testing.
7
+ This gem includes all pubid-* gems for compatibility testing and allows parsing all identifiers from one gem.
8
8
 
9
+ == Current use cases
10
+ The current use cases, as listed below, are what we have needed until now and have discovered through use of pubid to pubid-*, metanorma-*, and relaton-* projects. Work on pubid is not complete and will be expanding during the ongoing integration process.
11
+
12
+ - building identifiers from scratch
13
+ - modifiying identifiers (e.g. basing an amendment identifier on a base identifier)
14
+ - parsing string identifiers
15
+ - exporting/importing to different formats or styles (hash, yaml, URN, etc.)
16
+ - verification of compliance for the identifier's representation standard (NIST PubID 1.0 for NIST, RFC 5141 for ISO URN), or using commonly found patterns
17
+ - verifying that a provided identifier is correct
18
+ - comparing two provided identifiers (with the option to exclude specified attributes)
19
+ - converting legacy identifiers to updated format
20
+
21
+ == Purpose and Usage Guidelines
22
+
23
+ The pubid library is intended to be used wherever operations on publication identifiers are required. It acts as an intermediary between users and publication identifiers, streamlining the processes of creation, modification, comparison, and attribute access. By centralizing these operations in pubid-core, we ensure that any updates to identifier standards are seamlessly integrated across all related projects in an ecosystem.
24
+
25
+ It is crucial to use the pubid library for all operations with identifiers to ensure that updates in identifier standards are consistently reflected in these operations, and are driven by a data representation of the identifier, rather than the identifier string. For example, if an identifier like `ISO/R 657/IV` is updated to `ISO/R 657-4:1969` by a standards body, and pubid acts on that update, the library will automatically recognize this change. Hence, comparing:
26
+ [source,ruby]
27
+ ----
28
+ Pubid::Registry.parse("ISO/R 657/IV") == Pubid::Registry.parse("ISO/R 657-4:1969")
29
+ => true
30
+ ----
31
+ or accessing the year:
32
+ [source,ruby]
33
+ ----
34
+ Pubid::Registry.parse("ISO/R 657/IV").year
35
+ => 1969
36
+ ----
37
+ will yield the updated results.
38
+
39
+ Moreover, changes in how identifiers are compared may cause some identifiers to become equal or unequal based on the latest updates. Thus, to reflect these changes accurately, the pubid library should be used for all publication identifier operations.
40
+
41
+ === Information model
42
+
43
+ Technical documents in general, and standards specifically, are routinely identified and cited by document identifier, rather than by author, title, and/or publication date, as is routine practice for other bibliographic types. These document identifiers are usually somewhat arbitrary, containing a number identifying the current document as one in a sequence of documents.
44
+
45
+ However, technical document identifiers typically also contain representation of at least some of the bibliographic information about the document. This is why bibliographic citation of technical document (particularly in other technical documents) is often restricted to just the document identifier and the title: the identifier is felt in such communities to convey all the relevant bibliographic information needed to make sense of the standard. (The expectations on what information is needed is different from other bibliographic types within their communities: authorship for example is typically corporate, dates are assumed by default to be the latest availabe edition, and the place of publication and publisher are identiified with the organisation publishing the document.)
46
+
47
+ Pubid uses semantic representation of the bibliographic information used to generate an identifier for an organisation. That is why the format of the identifier can be updated without changing the underlying semantics it encodes. Each organisation that Pubid supports has its own semantics, but there are recurring semantic fields that Pubid uses, which drive what the identifiers look like, and which correspond to bibliographic information. (The Relaton bibliographic model equivalent is linked after each definition.)
48
+
49
+ * The `publisher` is the organisation responsible for the document. Standards-defining organisations, in particular, are identified by established acronyms, such as _ISO_, _IEC_, _NIST_, which are usually prefixed to the document identifier; that prefix takes the place of a publisher field. The choice of publisher determines the flavour of Pubid that is used. (Relaton: https://www.relaton.org/model/creator/[Creator, type: Publisher])
50
+ * Technical documents are often published by multiple organisations. Such co-publication is indicated through using the acronyms of all organisations involved in the prefix; publishers after the first are indicated as `copublisher`. For example, the prefix _ISO/IEC/IEEE_ indicates that the document is copublished by all three organisations; ISO will be treated as the primary publisher by Pubid. (Relaton: https://www.relaton.org/model/creator/[Creator, type: Publisher])
51
+ * Technical documents are almost always numbered in a sequence; that `number` is used along with the publisher to identify the document uniquely. (Relaton: https://www.relaton.org/model/series/[Series number])
52
+ * Technical documents may consist of different parts, which can be referenced individually. The `part` number for the document is used in addition to the number in that case. (Relaton: https://www.relaton.org/model/citation/[Citation, type: Part])
53
+ * In special circumstances, multiple subsequent versions of a document can appear with the same number; this applies for example to multiple drafts. These subsequent versions can be indicated as `iteration`. (Relaton: https://www.relaton.org/model/edition/[Edition: Version])
54
+ * Often there is different numbering used for different types of technical document; for example, technical reports, technical notes, and standards have different number sequences in ISO. For that reason, the document `type` may be required in addition to the number. For inclusion in an identifier the organisation will typically have a standardised abbreviation for each of the document types. (Relaton: https://www.relaton.org/model/series/[Series], though Relaton for standards organisations treats these for convenience as subtypes of document, the document https://www.relaton.org/model/bibtype/[type] being `standard`)
55
+ * In some cases, different numbering is used not for different types of document, but different defined `series`. If that is the case, the organisation will typically have a standardised abbreviation for the series as well. (Relaton: https://www.relaton.org/model/series/[Series])
56
+ * Some organisations publish standards in multiple languages. In that case, the document `language` can also be provided, to indicate a particular language version.
57
+ * Technical documents are often cited undated; in that case, the latest version of the document is usually assumed. If a specific edition of a document needs to be specified in the edition, this can be done by supplying an `edition` number, the `year` of publication, or both, depending on the organisation. (Relaton: https://www.relaton.org/model/edition/[Edition], https://www.relaton.org/model/production/#date[Date])
58
+ * Unlike other documents, technical documents are often circulated and cited in draft version before they are officially published. If this is routinely done, the organisation may provide for means to specify that a document is a `draft`, or the `stage` or `status` which the document has reached in the authoring process. If stages are used in citing documents, the organisation will typically have standard abbreviations for those stages, which will be used in the identifier. (Relaton: https://www.relaton.org/model/edition/[Edition])
59
+ * Just as documents can be bibliographically related to other documents, document identifiers can be based on other document identifiers. This is done in Pubid by specifying two Pubid identifiers, with the first treated as an attribute of the second. The first common case of derived identifiers is when one document is a supplement of another (e.g. an appendix, a corrigendum); this is encoded in Pubid by specifying a `base` Pubid identifier, as an attribute of the derived document, with its own distinct `number`, `type` (e.g. _Appendix_), and `year`. The second case is when a document published by one organisation is `adopted` for use by another organisation: this often is indicated in document identifiers simply by prefixing the adopting organisation's acronym to the original identifier (e.g. _BS ISO 639_). (Relaton: https://www.relaton.org/model/relations/#derived-relations[Relations: `updates`, `adoptedFrom`])
60
+
61
+ === Usage
62
+
63
+ `Pubid::Registry#parse` resolves the pubid class related to the identifier (`Pubid::Iso::Identifier` for "ISO" identifiers) and returns an object with the parsed identifier
64
+
65
+ [source,ruby]
66
+ ----
67
+ require "pubid"
68
+
69
+ pubid = Pubid::Registry.parse("ISO/IEC 13213")
70
+ pubid.class
71
+ => Pubid::Iso::Identifier::Base
72
+ pubid.publisher
73
+ => "ISO"
74
+ pubid.copublisher
75
+ => "IEC"
76
+ pubid.number
77
+ => 13213
78
+ pubid.to_s
79
+ => "ISO/IEC 13213"
80
+ ----
81
+
82
+ You can find usage examples in the https://github.com/metanorma/pubid-core[pubid-core] repository. For more specific usage guides, refer to repositories related to specific identifier providers, such as https://github.com/metanorma/pubid-iso[pubid-iso] for ISO identifiers and https://github.com/metanorma/pubid-ccsds[pubid-ccsds] for CCSDS identifier)
@@ -0,0 +1,30 @@
1
+ module Pubid
2
+ class Registry
3
+ class << self
4
+ def parse(*args)
5
+ modules = [Pubid::Iso,
6
+ Pubid::Ieee,
7
+ Pubid::Nist,
8
+ Pubid::Iec,
9
+ Pubid::Cen,
10
+ Pubid::Bsi,
11
+ Pubid::Ccsds,
12
+ Pubid::Itu,
13
+ Pubid::Jis]
14
+ modules.each do |mod|
15
+ module_identifier = Kernel.const_get("#{mod}::Identifier")
16
+ return module_identifier.parse(*args) if module_identifier.parseable?(*args)
17
+ end
18
+
19
+ # Go through each module to try to parse unknown prefix
20
+ modules.each do |mod|
21
+ return Kernel.const_get("#{mod}::Identifier").parse(*args)
22
+ rescue Pubid::Core::Errors::ParseError
23
+ next
24
+ end
25
+
26
+ raise Pubid::Core::Errors::ParseError, "cannot find module to parse #{args}"
27
+ end
28
+ end
29
+ end
30
+ end
data/lib/pubid/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pubid
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "1.15.0".freeze
3
3
  end
data/lib/pubid.rb ADDED
@@ -0,0 +1,15 @@
1
+ module Pubid
2
+ end
3
+
4
+ require_relative "pubid/registry"
5
+
6
+ require "pubid-core"
7
+ require "pubid-iso"
8
+ require "pubid-ieee"
9
+ require "pubid-nist"
10
+ require "pubid-iec"
11
+ require "pubid-cen"
12
+ require "pubid-bsi"
13
+ require "pubid-ccsds"
14
+ require "pubid-itu"
15
+ require "pubid-jis"
metadata CHANGED
@@ -1,183 +1,183 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pubid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-01 00:00:00.000000000 Z
11
+ date: 2025-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rake
14
+ name: pubid-bsi
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '13.0'
20
- type: :development
19
+ version: 1.15.0
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '13.0'
26
+ version: 1.15.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec
28
+ name: pubid-ccsds
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '3.0'
34
- type: :development
33
+ version: 1.15.0
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '3.0'
40
+ version: 1.15.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: pubid-core
42
+ name: pubid-cen
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.12.2
47
+ version: 1.15.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.12.2
54
+ version: 1.15.0
55
55
  - !ruby/object:Gem::Dependency
56
- name: pubid-nist
56
+ name: pubid-core
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.2.6
61
+ version: 1.15.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.2.6
68
+ version: 1.15.0
69
69
  - !ruby/object:Gem::Dependency
70
- name: pubid-iso
70
+ name: pubid-etsi
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.7.0
75
+ version: 1.15.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.7.0
82
+ version: 1.15.0
83
83
  - !ruby/object:Gem::Dependency
84
- name: pubid-ieee
84
+ name: pubid-iec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 0.2.1
89
+ version: 1.15.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 0.2.1
96
+ version: 1.15.0
97
97
  - !ruby/object:Gem::Dependency
98
- name: pubid-cen
98
+ name: pubid-ieee
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 0.2.3
103
+ version: 1.15.0
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 0.2.3
110
+ version: 1.15.0
111
111
  - !ruby/object:Gem::Dependency
112
- name: pubid-iec
112
+ name: pubid-iso
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.3.1
117
+ version: 1.15.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: 0.3.1
124
+ version: 1.15.0
125
125
  - !ruby/object:Gem::Dependency
126
- name: pubid-ccsds
126
+ name: pubid-itu
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
129
+ - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 0.1.3
131
+ version: 1.15.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - "~>"
136
+ - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 0.1.3
138
+ version: 1.15.0
139
139
  - !ruby/object:Gem::Dependency
140
- name: pubid-itu
140
+ name: pubid-jis
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - "~>"
143
+ - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 0.1.0
145
+ version: 1.15.0
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - "~>"
150
+ - - '='
151
151
  - !ruby/object:Gem::Version
152
- version: 0.1.0
152
+ version: 1.15.0
153
153
  - !ruby/object:Gem::Dependency
154
- name: pubid-jis
154
+ name: pubid-nist
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - '='
158
158
  - !ruby/object:Gem::Version
159
- version: 0.3.2
159
+ version: 1.15.0
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - '='
165
165
  - !ruby/object:Gem::Version
166
- version: 0.3.2
166
+ version: 1.15.0
167
167
  - !ruby/object:Gem::Dependency
168
- name: pubid-bsi
168
+ name: pubid-plateau
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
- - - "~>"
171
+ - - '='
172
172
  - !ruby/object:Gem::Version
173
- version: 0.3.2
173
+ version: 1.15.0
174
174
  type: :runtime
175
175
  prerelease: false
176
176
  version_requirements: !ruby/object:Gem::Requirement
177
177
  requirements:
178
- - - "~>"
178
+ - - '='
179
179
  - !ruby/object:Gem::Version
180
- version: 0.3.2
180
+ version: 1.15.0
181
181
  description: Gem including all pubid-* gems.
182
182
  email:
183
183
  - open.source@ribose.com
@@ -189,12 +189,14 @@ extra_rdoc_files:
189
189
  files:
190
190
  - LICENSE.txt
191
191
  - README.adoc
192
+ - lib/pubid.rb
193
+ - lib/pubid/registry.rb
192
194
  - lib/pubid/version.rb
193
195
  homepage: https://github.com/metanorma/pubid
194
196
  licenses:
195
197
  - BSD-2-Clause
196
198
  metadata: {}
197
- post_install_message:
199
+ post_install_message:
198
200
  rdoc_options: []
199
201
  require_paths:
200
202
  - lib
@@ -209,8 +211,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
211
  - !ruby/object:Gem::Version
210
212
  version: '0'
211
213
  requirements: []
212
- rubygems_version: 3.3.26
213
- signing_key:
214
+ rubygems_version: 3.5.22
215
+ signing_key:
214
216
  specification_version: 4
215
217
  summary: Gem including all pubid-* gems.
216
218
  test_files: []