relaton 1.20.2 → 2.0.0.pre.alpha.1
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 +4 -4
- data/.rubocop.yml +1 -1
- data/CLAUDE.md +4 -2
- data/Rakefile +1 -1
- data/bin/rspec +1 -2
- data/docs/README.adoc +93 -86
- data/lib/relaton/config.rb +2 -3
- data/lib/relaton/db.rb +57 -39
- data/lib/relaton/db_cache.rb +3 -2
- data/lib/relaton/registry.rb +23 -30
- data/lib/relaton/util.rb +2 -1
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/workers_pool.rb +1 -1
- data/lib/relaton.rb +6 -7
- data/relaton.gemspec +31 -31
- data/spec/relaton/db_cache_spec.rb +1 -1
- data/spec/relaton/db_spec.rb +84 -46
- data/spec/relaton/registry_spec.rb +43 -41
- data/spec/relaton/util_spec.rb +1 -0
- data/spec/relaton_spec.rb +345 -163
- data/spec/vcr_cassetes/3gpp_tr_00_01u_umts_3_0_0.yml +12595 -13226
- data/spec/vcr_cassetes/api_relaton_org.yml +7 -7
- data/spec/vcr_cassetes/api_relaton_org_unavailable.yml +76 -78
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +48 -42
- data/spec/vcr_cassetes/cie_001_1980.yml +302 -262
- data/spec/vcr_cassetes/cipm_meeting_43.yml +1380 -1370
- data/spec/vcr_cassetes/doi_10_6028_nist_ir_8245.yml +3 -3
- data/spec/vcr_cassetes/ecma_6.yml +182 -238
- data/spec/vcr_cassetes/en_10160_1999.yml +13083 -13122
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +9 -9
- data/spec/vcr_cassetes/ieee_528_2019.yml +2633 -2411
- data/spec/vcr_cassetes/iso_19115_1.yml +13692 -13957
- data/spec/vcr_cassetes/iso_19115_1_2.yml +235 -244
- data/spec/vcr_cassetes/iso_19115_1_std.yml +13690 -13955
- data/spec/vcr_cassetes/iso_19115_all_parts.yml +161 -168
- data/spec/vcr_cassetes/iso_19133_2005.yml +83 -79
- data/spec/vcr_cassetes/iso_combined_applied.yml +239 -238
- data/spec/vcr_cassetes/iso_combined_included.yml +240 -239
- data/spec/vcr_cassetes/iso_dis.yml +87 -88
- data/spec/vcr_cassetes/ogc_19_025r1.yml +248 -243
- data/spec/vcr_cassetes/omg_ami4ccm_1_0.yml +268 -1513
- data/spec/vcr_cassetes/rfc_8341.yml +1090 -1086
- metadata +62 -80
- data/lib/relaton/processor.rb +0 -46
- data/spec/relaton/processor_spec.rb +0 -113
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 72340d2ac1023cae6be18414bf12e0aab5ffdf24d2385d2025bd91785d99f933
|
|
4
|
+
data.tar.gz: e995b4afd240b028524f1c174a28780aab74a9a20eab9b19ae4a288cee38ae16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: caa95533b83a97042cac9886ea93b4149b73a6d57e4f47b88b297d0a2a08d0f1d884be7092feab7d9daaf3f870578e6be3dd41e26c1c4ec2ad60814b8eaa9105
|
|
7
|
+
data.tar.gz: dd627fbe5b2bf14d06805aa04ae7a5dd5a60cbb67ba6c93e71fb44151e736a30976bccff5cbcf11fd7a0665dffa4f6767a84e26dc3eac57ac22a61d02db7fc95
|
data/.rubocop.yml
CHANGED
data/CLAUDE.md
CHANGED
|
@@ -27,7 +27,7 @@ Relaton is a Ruby gem that fetches, caches, and manages bibliographic references
|
|
|
27
27
|
|
|
28
28
|
### Plugin Registry Pattern
|
|
29
29
|
|
|
30
|
-
**Relaton::Registry** (singleton) auto-discovers and manages backend processor gems (relaton-iso, relaton-iec, relaton-ietf, etc.). Each processor implements the **Relaton::Processor** interface (`get`, `from_xml`, `
|
|
30
|
+
**Relaton::Registry** (singleton) auto-discovers and manages backend processor gems (relaton-iso, relaton-iec, relaton-ietf, etc.). Each processor implements the **Relaton::Processor** interface (`get`, `from_xml`, `from_yaml`, `grammar_hash`, `prefix`, `defaultprefix`). The registry routes reference codes to the correct processor by matching prefixes (e.g., "ISO 19115" → `:relaton_iso`).
|
|
31
31
|
|
|
32
32
|
### Db (lib/relaton/db.rb) — Main Public API
|
|
33
33
|
|
|
@@ -36,6 +36,8 @@ Relaton is a Ruby gem that fetches, caches, and manages bibliographic references
|
|
|
36
36
|
2. Handles combined references (`+` for derivedFrom, `,` for amendments) in `combine_doc`
|
|
37
37
|
3. Delegates to `check_bibliocache` which manages the dual-cache lookup and network fetch flow
|
|
38
38
|
|
|
39
|
+
`Relaton::Db#fetch_all(text, edition, year)` searches cached entries, filtering by text content (via `match_xml_text?`), edition, and/or year. Returns an array of deserialized bibliographic items from both local and global caches.
|
|
40
|
+
|
|
39
41
|
The dual-cache strategy uses a **global cache** (`~/.relaton/cache`) and an optional **local cache** (project-level). `check_bibliocache` checks local first, falls back to global, and syncs between them.
|
|
40
42
|
|
|
41
43
|
### DbCache (lib/relaton/db_cache.rb) — File-based Storage
|
|
@@ -64,5 +66,5 @@ Thread pool for `fetch_async`. Default 10 threads per processor, overridable via
|
|
|
64
66
|
|
|
65
67
|
## Style
|
|
66
68
|
|
|
67
|
-
- RuboCop config inherits from [Ribose OSS guides](https://github.com/riboseinc/oss-guides), target Ruby 3.
|
|
69
|
+
- RuboCop config inherits from [Ribose OSS guides](https://github.com/riboseinc/oss-guides), target Ruby 3.2
|
|
68
70
|
- Thread safety via `@semaphore` (Mutex) around cache reads/writes in Db
|
data/Rakefile
CHANGED
data/bin/rspec
CHANGED
data/docs/README.adoc
CHANGED
|
@@ -29,6 +29,7 @@ Relaton imports bibliographic entries from:
|
|
|
29
29
|
* CIE through the techstreet.com website, via the https://github.com/relaton/relaton-cie[relaton-cie] gem
|
|
30
30
|
* DOI through the api.crossref.org website, via the https://github.com/relaton/relaton-doi[relaton-doi] gem
|
|
31
31
|
* ECMA through the ecma-international.org website, via the https://github.com/relaton/relaton-ecma[relaton-ecma] gem
|
|
32
|
+
* ETSI through the etsi.org website, via the https://github.com/relaton/relaton-etsi[relaton-etsi] gem
|
|
32
33
|
* GB (Chinese national standards) through the GB websites, via the https://github.com/relaton/relaton-gb[relaton-gb] gem
|
|
33
34
|
* IANA through the https://github.com/ietf-tools/iana-registries[iana-registries] dataset, via the https://github.com/relaton/relaton-iana[relaton-iana] gem
|
|
34
35
|
* IEC through the iec.ch website, via the https://github.com/relaton/relaton-iec[relaton-iec] gem
|
|
@@ -37,11 +38,13 @@ Relaton imports bibliographic entries from:
|
|
|
37
38
|
* IHO through the iho.int website, via the https://github.com/relaton/relaton-iho[relaton-iho] gem
|
|
38
39
|
* ISO through the iso.org website, via the https://github.com/relaton/relaton-iso[relaton-iso] gem
|
|
39
40
|
* ITU through the itu.int website, via the https://github.com/relaton/relaton-itu[relaton-itu] gem
|
|
40
|
-
*
|
|
41
|
-
*
|
|
41
|
+
* ISBN through the openlibrary.org website, via the https://github.com/relaton/relaton-isbn[relaton-isbn] gem
|
|
42
|
+
* JIS through the webdesk.jsa.or.jp website, via the https://github.com/relaton/relaton-jis[relaton-jis] gem
|
|
43
|
+
* NIST standards through the nist.gov website, via the https://github.com/relaton/relaton-nist[relaton-nist] gem
|
|
42
44
|
* OASIS through the www.oasis-open.org/standards website, via the https://github.com/relaton/relaton-oasis[relaton-oasis] gem
|
|
43
|
-
* OGC through the https://github.com/opengeospatial/NamingAuthority[dataset], via the https://
|
|
45
|
+
* OGC through the https://github.com/opengeospatial/NamingAuthority[dataset], via the https://github.com/relaton/relaton-ogc[relaton-ogc] gem
|
|
44
46
|
* OMG through the omg.org/spec website, via the https://github.com/relaton/relaton-omg[relaton-omg] gem
|
|
47
|
+
* Plateau through the www.mlit.go.jp website, via the https://github.com/relaton/relaton-plateau[relaton-plateau] gem
|
|
45
48
|
* UN through the documents.un.org website, via the https://github.com/relaton/relaton-un[relaton-un] gem
|
|
46
49
|
* W3C through the w3c.org website, via the https://github.com/relaton/relaton-w3c[relaton-w3c] gem
|
|
47
50
|
* XSF through the xmpp.org website, via the https://github.com/relaton/relaton-xsf[relaton-xsf] gem
|
|
@@ -82,7 +85,6 @@ e.g. `get("ISO 19115-1", "2014", all_parts: true)` is transformed into a referen
|
|
|
82
85
|
|
|
83
86
|
=== Configuration
|
|
84
87
|
|
|
85
|
-
* `logger` - `Logger` instance. By default, the logger is `Logger.new($stderr)` with `Logger::WARN` level.
|
|
86
88
|
* `use_api` - `true` if it needs to use an online cache, `false` if not. The default value is `true`.
|
|
87
89
|
* `api_host` - URL of an online cache. The default value is https://api.relaton.org.
|
|
88
90
|
|
|
@@ -92,12 +94,20 @@ require "relaton"
|
|
|
92
94
|
=> true
|
|
93
95
|
|
|
94
96
|
Relaton.configure do |conf|
|
|
95
|
-
conf.logger.level = Logger::DEBUG
|
|
96
97
|
conf.use_api = true
|
|
97
98
|
conf.api_host = "https://api.relaton.org"
|
|
98
99
|
end
|
|
99
100
|
----
|
|
100
101
|
|
|
102
|
+
Logger configuration is managed through the `relaton-logger` gem via `Relaton.logger_pool`:
|
|
103
|
+
|
|
104
|
+
[source,ruby]
|
|
105
|
+
----
|
|
106
|
+
require "relaton"
|
|
107
|
+
|
|
108
|
+
Relaton.logger_pool[:default] = Relaton::Logger::Log.new($stderr, levels: [:debug, :info, :warn, :error, :fatal])
|
|
109
|
+
----
|
|
110
|
+
|
|
101
111
|
=== Create DB
|
|
102
112
|
|
|
103
113
|
`Relaton::Db#new(globalcache, localcache)` creates new DB. Returns Relaton::Db instance.
|
|
@@ -109,29 +119,17 @@ end
|
|
|
109
119
|
----
|
|
110
120
|
# Do not cache any entries retrieved
|
|
111
121
|
db = Relaton::Db.new(nil, nil)
|
|
112
|
-
=> #<Relaton::Db:
|
|
113
|
-
@db=nil,
|
|
114
|
-
@db_name=nil,
|
|
115
|
-
@local_db=nil,
|
|
116
|
-
@local_db_name=nil,
|
|
122
|
+
=> #<Relaton::Db:0x0000000127622a50
|
|
117
123
|
...
|
|
118
124
|
|
|
119
125
|
# Use only the global cache for any entries retrieved
|
|
120
126
|
db = Relaton::Db.new("globalcache", nil)
|
|
121
|
-
=> #<Relaton::Db:
|
|
122
|
-
@db=#<Relaton::DbCache:0x007faabc0e7ab8 @dir="globalcache", @ext="xml">,
|
|
123
|
-
@db_name="globalcache",
|
|
124
|
-
@local_db=nil,
|
|
125
|
-
@local_db_name=nil,
|
|
127
|
+
=> #<Relaton::Db:0x00000001277cd120
|
|
126
128
|
...
|
|
127
129
|
|
|
128
130
|
# Use both a local and a global cache
|
|
129
131
|
db = Relaton::Db.new("globalcache", "localcache")
|
|
130
|
-
=> #<Relaton::Db:
|
|
131
|
-
@db=#<Relaton::DbCache:0x007faabc900060 @dir="globalcache", @ext="xml">,
|
|
132
|
-
@db_name="globalcache",
|
|
133
|
-
@local_db=#<Relaton::DbCache:0x007faabc8fa5c0 @dir="localcache", @ext="xml">,
|
|
134
|
-
@local_db_name="localcache",
|
|
132
|
+
=> #<Relaton::Db:0x0000000127aaf6e0
|
|
135
133
|
...
|
|
136
134
|
----
|
|
137
135
|
|
|
@@ -157,7 +155,7 @@ db.mv("new_local_dir", type: :local)
|
|
|
157
155
|
|
|
158
156
|
`Relaton::Db#clear` removes all entries form DB
|
|
159
157
|
|
|
160
|
-
=== Fetch
|
|
158
|
+
=== Fetch documents
|
|
161
159
|
|
|
162
160
|
==== Fetch document by references
|
|
163
161
|
|
|
@@ -169,11 +167,11 @@ There are 3 fetching methods:
|
|
|
169
167
|
|
|
170
168
|
Arguments:
|
|
171
169
|
|
|
172
|
-
* `reference` - (String) reference to
|
|
173
|
-
* `year` - (String or nil) year to filter
|
|
174
|
-
* `options` - (Hash) hash of options.
|
|
170
|
+
* `reference` - (String) reference to fetch document
|
|
171
|
+
* `year` - (String or nil) year to filter result (optional)
|
|
172
|
+
* `options` - (Hash) hash of options. Allowed options:
|
|
175
173
|
- `:all_parts` - (Boolean) should be `true` if all-parts reference is required
|
|
176
|
-
- `:
|
|
174
|
+
- `:keep_year` - (Boolean) should be `true` if undated reference should return an actual reference with the year
|
|
177
175
|
- `:retries` - (Number) number of network retries. Default 1
|
|
178
176
|
- `:no_cache` - (Boolean) should be `true` if cache should be ignored
|
|
179
177
|
- `:publication_date_after` - (String) filter for documents published on or after this date (inclusive, `"YYYY-MM-DD"`)
|
|
@@ -187,34 +185,34 @@ x = db.fetch("IEEE 19011")
|
|
|
187
185
|
=> nil
|
|
188
186
|
|
|
189
187
|
x = db.fetch("ISO 19011")
|
|
190
|
-
[relaton-iso] (ISO 19011)
|
|
191
|
-
[relaton-iso] (ISO 19011)
|
|
192
|
-
=> #<
|
|
188
|
+
[relaton-iso] INFO: (ISO 19011) Fetching from Relaton repository ...
|
|
189
|
+
[relaton-iso] INFO: (ISO 19011) Found: `ISO 19011:2018`
|
|
190
|
+
=> #<Relaton::Iso::ItemData:0x0000000128631e00
|
|
193
191
|
...
|
|
194
192
|
|
|
195
193
|
x = db.fetch("ISO 19011", "2011", retries: 3)
|
|
196
|
-
[relaton-iso] (ISO 19011)
|
|
197
|
-
[relaton-iso] (ISO 19011)
|
|
198
|
-
=> #<
|
|
194
|
+
[relaton-iso] INFO: (ISO 19011:2011) Fetching from Relaton repository ...
|
|
195
|
+
[relaton-iso] INFO: (ISO 19011:2011) Found: `ISO 19011:2011`
|
|
196
|
+
=> #<Relaton::Iso::ItemData:0x000000013af95020
|
|
199
197
|
...
|
|
200
198
|
|
|
201
199
|
x = db.fetch("ISO 19115", nil, all_parts: true)
|
|
202
|
-
[relaton-iso] (ISO 19115)
|
|
203
|
-
[relaton-iso] (ISO 19115)
|
|
204
|
-
=> #<
|
|
200
|
+
[relaton-iso] INFO: (ISO 19115 (all parts)) Fetching from Relaton repository ...
|
|
201
|
+
[relaton-iso] INFO: (ISO 19115 (all parts)) Found: `ISO 19115 (all parts)`
|
|
202
|
+
=> #<Relaton::Iso::ItemData:0x00000001276f7f98
|
|
205
203
|
...
|
|
206
204
|
|
|
207
|
-
#
|
|
205
|
+
# Fetching from local cache
|
|
208
206
|
|
|
209
207
|
x = db.fetch("ISO 19011")
|
|
210
|
-
=> #<
|
|
208
|
+
=> #<Relaton::Db:0x00000001390b0b00
|
|
211
209
|
...
|
|
212
210
|
|
|
213
211
|
x = db.fetch_db("ISO 5749")
|
|
214
212
|
=> nil
|
|
215
213
|
|
|
216
214
|
# Fetching asynchronously
|
|
217
|
-
# RELATON_FETCH_PARALLEL environment variable can be used to
|
|
215
|
+
# RELATON_FETCH_PARALLEL environment variable can be used to override default number of parallel fetches
|
|
218
216
|
|
|
219
217
|
# prepare queue for results
|
|
220
218
|
results = Queue.new
|
|
@@ -246,13 +244,26 @@ When a date filter is used, the cache is checked first for an existing entry who
|
|
|
246
244
|
[source,ruby]
|
|
247
245
|
----
|
|
248
246
|
# Fetch documents published on or after 2018-01-01
|
|
249
|
-
x = db.fetch("
|
|
247
|
+
x = db.fetch("IEC 80000-6", nil, publication_date_after: Date.parse("2018-01-01"))
|
|
248
|
+
[relaton-iec] INFO: (IEC 80000-6) Fetching from Relaton repository ...
|
|
249
|
+
[relaton-iec] INFO: (IEC 80000-6) Found: `IEC 80000-6:2022`
|
|
250
|
+
=> #<Relaton::Iec::ItemData:0x000000013f311920
|
|
251
|
+
...
|
|
250
252
|
|
|
251
253
|
# Fetch documents published before 2020-01-01
|
|
252
|
-
x = db.fetch("
|
|
254
|
+
x = db.fetch("IEC 80000-6", nil, publication_date_before: Date.parse("2020-01-01"))
|
|
255
|
+
[relaton-iec] INFO: (IEC 80000-6) Fetching from Relaton repository ...
|
|
256
|
+
[relaton-iec] INFO: (IEC 80000-6) Found: `IEC 80000-6:2008`
|
|
257
|
+
=> #<Relaton::Iec::ItemData:0x00000001282b5290
|
|
258
|
+
...
|
|
253
259
|
|
|
254
260
|
# Fetch documents published within a range
|
|
255
|
-
x = db.fetch("
|
|
261
|
+
x = db.fetch("IEC 80000-6", nil, publication_date_after: Date.parse("2018-01-01"), publication_date_before: Date.parse("2020-01-01"))
|
|
262
|
+
[relaton-iec] INFO: (IEC 80000-6) Fetching from Relaton repository ...
|
|
263
|
+
[relaton-iec] INFO: (IEC 80000-6) Not found.
|
|
264
|
+
[relaton-iec] INFO: (IEC 80000-6) TIP: No match for type, but matches exist: `IEC 80000-6:2008`, `IEC 80000-6:2022`.
|
|
265
|
+
[relaton-iec] INFO: (IEC 80000-6) TIP: No match for type, but matches exist: `IEC 80000-6:2008`, `IEC 80000-6:2022`.
|
|
266
|
+
=> nil
|
|
256
267
|
----
|
|
257
268
|
|
|
258
269
|
==== Fetch by URN
|
|
@@ -262,9 +273,9 @@ This functionality works only for IEC documents.
|
|
|
262
273
|
[source,ruby]
|
|
263
274
|
----
|
|
264
275
|
x = db.fetch "urn:iec:std:iec:60050-102:2007:::"
|
|
265
|
-
[relaton-iec] (IEC 60050-102)
|
|
266
|
-
[relaton-iec] (IEC 60050-102)
|
|
267
|
-
=> #<
|
|
276
|
+
[relaton-iec] INFO: (IEC 60050-102:2007) Fetching from Relaton repository ...
|
|
277
|
+
[relaton-iec] INFO: (IEC 60050-102:2007) Found: `IEC 60050-102:2007`
|
|
278
|
+
=> #<Relaton::Iec::ItemData:0x0000000130e37a98
|
|
268
279
|
...
|
|
269
280
|
----
|
|
270
281
|
|
|
@@ -276,56 +287,52 @@ This functionality works only for ISO, IEC, ITU, and NIST documents.
|
|
|
276
287
|
[source,ruby]
|
|
277
288
|
----
|
|
278
289
|
bib = db.fetch "ISO 19115-1 + Amd 1"
|
|
279
|
-
[relaton-iso] (ISO 19115-1)
|
|
280
|
-
[relaton-iso] (ISO 19115-1)
|
|
281
|
-
[relaton-iso] (ISO 19115-1/Amd 1)
|
|
282
|
-
[relaton-iso] (ISO 19115-1/Amd 1)
|
|
283
|
-
=> #<
|
|
290
|
+
[relaton-iso] INFO: (ISO 19115-1) Fetching from Relaton repository ...
|
|
291
|
+
[relaton-iso] INFO: (ISO 19115-1) Found: `ISO 19115-1:2014`
|
|
292
|
+
[relaton-iso] INFO: (ISO 19115-1/Amd 1) Fetching from Relaton repository ...
|
|
293
|
+
[relaton-iso] INFO: (ISO 19115-1/Amd 1) Found: `ISO 19115-1:2014/Amd 1:2018`
|
|
294
|
+
=> #<Relaton::Iso::ItemData:0x000000012782e4c0
|
|
295
|
+
...
|
|
284
296
|
|
|
285
|
-
bib.docidentifier[0].
|
|
297
|
+
bib.docidentifier[0].content.to_s
|
|
286
298
|
=> "ISO 19115-1 + Amd 1"
|
|
287
299
|
|
|
288
300
|
bib.relation[0].type
|
|
289
301
|
=> "updates"
|
|
290
302
|
|
|
291
|
-
bib.relation[0].bibitem.docidentifier[0].
|
|
303
|
+
bib.relation[0].bibitem.docidentifier[0].content.to_s
|
|
292
304
|
=> "ISO 19115-1"
|
|
293
305
|
|
|
294
306
|
bib.relation[1].type
|
|
295
307
|
=> "derivedFrom"
|
|
296
308
|
|
|
297
|
-
bib.relation[1].bibitem.docidentifier[0].
|
|
298
|
-
=> "ISO 19115-1/Amd 1
|
|
309
|
+
bib.relation[1].bibitem.docidentifier[0].content.to_s
|
|
310
|
+
=> "ISO 19115-1/Amd 1"
|
|
311
|
+
----
|
|
312
|
+
|
|
313
|
+
==== Fetch applied documents
|
|
314
|
+
[source,ruby]
|
|
315
|
+
----
|
|
316
|
+
bib = db.fetch "ISO 19115-1, Amd 1"
|
|
317
|
+
=> #<Relaton::Iso::ItemData:0x00000001265d5f08
|
|
299
318
|
|
|
300
|
-
bib.docidentifier[0].
|
|
319
|
+
bib.docidentifier[0].content.to_s
|
|
301
320
|
=> "ISO 19115-1, Amd 1"
|
|
302
321
|
|
|
303
322
|
bib.relation[0].type
|
|
304
323
|
=> "updates"
|
|
305
324
|
|
|
306
|
-
bib.relation[0].bibitem.docidentifier[0].
|
|
325
|
+
bib.relation[0].bibitem.docidentifier[0].content.to_s
|
|
307
326
|
=> "ISO 19115-1"
|
|
308
327
|
|
|
309
328
|
bib.relation[1].type
|
|
310
329
|
=> "complements"
|
|
311
330
|
|
|
312
|
-
bib.relation[1].description
|
|
331
|
+
bib.relation[1].description.content
|
|
313
332
|
=> "amendment"
|
|
314
333
|
|
|
315
|
-
bib.relation[1].bibitem.docidentifier[0].
|
|
316
|
-
=> "ISO 19115-1/Amd 1
|
|
317
|
-
----
|
|
318
|
-
|
|
319
|
-
==== Fetch applied documents
|
|
320
|
-
[source,ruby]
|
|
321
|
-
----
|
|
322
|
-
bib = db.fetch "ISO 19115-1, Amd 1"
|
|
323
|
-
=> ["Chinese Standard", "GB/T 1.1"]
|
|
324
|
-
[relaton-iso] (ISO 19115-1) fetching...
|
|
325
|
-
[relaton-iso] (ISO 19115-1) found ISO `19115-1:2014`
|
|
326
|
-
[relaton-iso] (ISO 19115-1/Amd 1) fetching...
|
|
327
|
-
[relaton-iso] (ISO 19115-1/Amd 1) found ISO `19115-1:2014/Amd 1:2018`
|
|
328
|
-
=> #<RelatonIsoBib::IsoBibliographicItem:0x007fb09b36d1b8
|
|
334
|
+
bib.relation[1].bibitem.docidentifier[0].content.to_s
|
|
335
|
+
=> "ISO 19115-1/Amd 1"
|
|
329
336
|
...
|
|
330
337
|
----
|
|
331
338
|
|
|
@@ -339,28 +346,28 @@ bib = db.fetch "ISO 19115-1, Amd 1"
|
|
|
339
346
|
|
|
340
347
|
[source,ruby]
|
|
341
348
|
----
|
|
342
|
-
# query for all entries in a
|
|
349
|
+
# query for all entries in a cache
|
|
343
350
|
|
|
344
351
|
items = db.fetch_all
|
|
345
|
-
=> [#<
|
|
352
|
+
=> [#<Relaton::Iso::ItemData:0x00000001265d5c88
|
|
346
353
|
...
|
|
347
354
|
|
|
348
355
|
items.size
|
|
349
356
|
=> 6
|
|
350
357
|
|
|
351
|
-
# query for all entries in a
|
|
358
|
+
# query for all entries in a cache for a certain string
|
|
352
359
|
|
|
353
360
|
items = db.fetch_all("mathematical terminology")
|
|
354
|
-
=> [
|
|
361
|
+
=> [<Relaton::Iec::ItemData:0x0000000125dabd50
|
|
355
362
|
...
|
|
356
363
|
|
|
357
364
|
items.size
|
|
358
365
|
=> 1
|
|
359
366
|
|
|
360
|
-
items[0].docidentifier[0].
|
|
367
|
+
items[0].docidentifier[0].content.to_s
|
|
361
368
|
=> "IEC 60050-102:2007"
|
|
362
369
|
|
|
363
|
-
# query for all entries in a
|
|
370
|
+
# query for all entries in a cache for a certain string and edition
|
|
364
371
|
|
|
365
372
|
items = db.fetch_all("system", edition: "2")
|
|
366
373
|
=> [#<RelatonIsoBib::IsoBibliographicItem:0x007ffebe2d1be8
|
|
@@ -372,17 +379,17 @@ items.size
|
|
|
372
379
|
items[0].docidentifier[0].id
|
|
373
380
|
=> "ISO 19011:2011"
|
|
374
381
|
|
|
375
|
-
# query for all entries in a
|
|
382
|
+
# query for all entries in a cache for a certain string and year
|
|
376
383
|
|
|
377
|
-
items = db.fetch_all("
|
|
378
|
-
=> [#<
|
|
384
|
+
items = db.fetch_all("Electromagnetism", edition: "2")
|
|
385
|
+
=> [#<Relaton::Iec::ItemData:0x0000000123a93e80
|
|
379
386
|
...
|
|
380
387
|
|
|
381
388
|
items.size
|
|
382
389
|
=> 1
|
|
383
390
|
|
|
384
|
-
items[0].docidentifier[0].
|
|
385
|
-
=> "
|
|
391
|
+
items[0].docidentifier[0].content.to_s
|
|
392
|
+
=> "IEC 80000-6:2022"
|
|
386
393
|
----
|
|
387
394
|
|
|
388
395
|
=== Get document type
|
|
@@ -396,29 +403,29 @@ db.docid_type("CN(GB/T 1.1)")
|
|
|
396
403
|
[source,ruby]
|
|
397
404
|
----
|
|
398
405
|
x.to_xml
|
|
399
|
-
=> "<bibitem id="
|
|
406
|
+
=> "<bibitem id="IEC600501022007" type="standard" schema-version="v1.4.1">
|
|
400
407
|
...
|
|
401
408
|
</bibitem>"
|
|
402
409
|
|
|
403
410
|
db.to_xml
|
|
404
411
|
=> "<?xml version"1.0" encoding="UTF-8"?>
|
|
405
412
|
<documents>
|
|
406
|
-
<bibdata type="standard">
|
|
413
|
+
<bibdata type="standard" schema-version="v1.4.1">
|
|
407
414
|
...
|
|
408
415
|
</bibdata>
|
|
409
|
-
<bibdata type="standard">
|
|
416
|
+
<bibdata type="standard" schema-version="v1.4.1">
|
|
410
417
|
...
|
|
411
418
|
</bibdata>
|
|
412
419
|
...
|
|
413
420
|
</documents"
|
|
414
421
|
|
|
415
422
|
x.to_xml bibdata: true
|
|
416
|
-
=> "<bibdata type="standard">
|
|
423
|
+
=> "<bibdata type="standard" schema-version="v1.4.1">
|
|
417
424
|
...
|
|
418
425
|
</bibdata>"
|
|
419
426
|
|
|
420
427
|
db.load_entry("ISO(ISO 19011)")
|
|
421
|
-
=> "<bibdata type="standard">
|
|
428
|
+
=> "<bibdata type="standard" schema-version="v1.4.1">
|
|
422
429
|
...
|
|
423
430
|
</bibdata>"
|
|
424
431
|
----
|
|
@@ -427,7 +434,7 @@ db.load_entry("ISO(ISO 19011)")
|
|
|
427
434
|
[source,ruby]
|
|
428
435
|
----
|
|
429
436
|
db.save_entry("ISO(ISO 19011)", nil)
|
|
430
|
-
=>
|
|
437
|
+
=> true
|
|
431
438
|
|
|
432
439
|
db.load_entry("ISO(ISO 19011)")
|
|
433
440
|
=> nil
|
data/lib/relaton/config.rb
CHANGED
|
@@ -8,10 +8,9 @@ module Relaton
|
|
|
8
8
|
@configuration ||= self::Configuration.new
|
|
9
9
|
end
|
|
10
10
|
end
|
|
11
|
-
extend Config
|
|
12
|
-
|
|
13
|
-
class Configuration # < RelatonBib::Configuration
|
|
14
11
|
|
|
12
|
+
# < RelatonBib::Configuration
|
|
13
|
+
class Configuration
|
|
15
14
|
attr_accessor :use_api, :api_host
|
|
16
15
|
|
|
17
16
|
def initialize
|