relaton-iso 1.20.0 → 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/Gemfile +1 -0
- data/README.adoc +134 -130
- data/bin/console +1 -1
- data/grammars/basicdoc.rng +2110 -0
- data/grammars/biblio-standoc.rng +287 -0
- data/grammars/biblio.rng +2097 -0
- data/grammars/relaton-iso-compile.rng +11 -0
- data/grammars/relaton-iso.rng +214 -0
- data/lib/relaton/iso/bibliography.rb +206 -0
- data/lib/relaton/iso/data_fetcher.rb +227 -0
- data/lib/relaton/iso/hash_parser_v1.rb +121 -0
- data/lib/relaton/iso/hit.rb +62 -0
- data/lib/relaton/iso/hit_collection.rb +117 -0
- data/lib/relaton/iso/item_data.rb +49 -0
- data/lib/relaton/iso/model/bibdata.rb +9 -0
- data/lib/relaton/iso/model/bibitem.rb +7 -0
- data/lib/relaton/iso/model/contributor.rb +7 -0
- data/lib/relaton/iso/model/contributor_info.rb +9 -0
- data/lib/relaton/iso/model/docidentifier.rb +128 -0
- data/lib/relaton/iso/model/doctype.rb +13 -0
- data/lib/relaton/iso/model/ext.rb +47 -0
- data/lib/relaton/iso/model/iso_project_group.rb +21 -0
- data/lib/relaton/iso/model/item.rb +17 -0
- data/lib/relaton/iso/model/item_base.rb +19 -0
- data/lib/relaton/iso/model/organization.rb +9 -0
- data/lib/relaton/iso/model/project_number.rb +22 -0
- data/lib/relaton/iso/model/relation.rb +9 -0
- data/lib/relaton/iso/model/stagename.rb +14 -0
- data/lib/relaton/iso/model/structured_identifier.rb +31 -0
- data/lib/relaton/iso/processor.rb +78 -0
- data/lib/relaton/iso/queue.rb +63 -0
- data/lib/relaton/iso/scraper.rb +591 -0
- data/lib/relaton/iso/util.rb +8 -0
- data/lib/relaton/iso/version.rb +7 -0
- data/lib/relaton/iso.rb +17 -0
- data/relaton_iso.gemspec +9 -7
- metadata +76 -46
- data/bin/bundle +0 -109
- data/bin/byebug +0 -27
- data/bin/coderay +0 -27
- data/bin/gdb_wrapper +0 -29
- data/bin/htmldiff +0 -27
- data/bin/httpclient +0 -29
- data/bin/ldiff +0 -27
- data/bin/nokogiri +0 -27
- data/bin/pry +0 -27
- data/bin/pubid-nist +0 -27
- data/bin/racc +0 -27
- data/bin/rackup +0 -29
- data/bin/rake +0 -27
- data/bin/rubocop +0 -27
- data/bin/ruby-parse +0 -27
- data/bin/ruby-rewrite +0 -27
- data/bin/safe_yaml +0 -29
- data/bin/thor +0 -27
- data/lib/relaton_iso/data_fetcher.rb +0 -246
- data/lib/relaton_iso/document_identifier.rb +0 -46
- data/lib/relaton_iso/hash_converter.rb +0 -15
- data/lib/relaton_iso/hit.rb +0 -59
- data/lib/relaton_iso/hit_collection.rb +0 -100
- data/lib/relaton_iso/iso_bibliography.rb +0 -202
- data/lib/relaton_iso/processor.rb +0 -67
- data/lib/relaton_iso/queue.rb +0 -61
- data/lib/relaton_iso/scrapper.rb +0 -553
- data/lib/relaton_iso/util.rb +0 -6
- data/lib/relaton_iso/version.rb +0 -5
- data/lib/relaton_iso.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz: '
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0099beeee62c483cd83042053de24308ff48951666f886bca3e307ffeb22d4f0'
|
4
|
+
data.tar.gz: 2bc6fae2a6a93e487ba97769bc9bfe8a68db179df9901b88453fc9584bc14766
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d731b1506f27760509a8b26f80e278ad5bffc147ba8feebb97d80fdd5aec8b2cd1645850c9bc29b90cffd2b6ae8621942fe9502f21da89e043a12805d2c8ce34
|
7
|
+
data.tar.gz: 0246df7127b4db9e360d269f41fcb20430d54ccd8cc020310d6affce5d4f9b1dda6a39d19555f5e2cc503ed6b79f1fb2f1a766cb934b0cf400934dd1b633987e
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/README.adoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
=
|
1
|
+
= Relaton::Iso: retrieve ISO Standards for bibliographic use using the BibliographicItem model
|
2
2
|
|
3
3
|
image:https://img.shields.io/gem/v/relaton-iso.svg["Gem Version", link="https://rubygems.org/gems/relaton-iso"]
|
4
4
|
image:https://github.com/relaton/relaton-iso/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-iso/actions?workflow=macos"]
|
@@ -8,7 +8,7 @@ image:https://codeclimate.com/github/relaton/relaton-iso/badges/gpa.svg["Code Cl
|
|
8
8
|
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-iso.svg["Pull Requests", link="https://github.com/relaton/relaton-iso/pulls"]
|
9
9
|
image:https://img.shields.io/github/commits-since/relaton/relaton/latest.svg["Commits since latest",link="https://github.com/relaton/relaton/releases"]
|
10
10
|
|
11
|
-
|
11
|
+
Relaton::Iso is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
|
12
12
|
|
13
13
|
You can use it to retrieve metadata of ISO Standards from https://www.iso.org, and access such metadata through the `IsoBibliographicItem` object.
|
14
14
|
|
@@ -35,107 +35,98 @@ Or install it yourself as:
|
|
35
35
|
|
36
36
|
[source,ruby]
|
37
37
|
----
|
38
|
-
require '
|
38
|
+
require 'relaton/iso'
|
39
39
|
=> true
|
40
40
|
|
41
|
-
hit_collection =
|
42
|
-
=> <
|
41
|
+
hit_collection = Relaton::Iso::Bibliography.search("ISO 19115")
|
42
|
+
=> <Relaton::Iso::HitCollection:0x0000000003a9a8 @ref=ISO 19115 @fetched=false>
|
43
43
|
|
44
44
|
hit_collection.first
|
45
|
-
=>
|
45
|
+
=> #<Relaton::Iso::Hit:0x00000001398ecdc8 ...>
|
46
46
|
|
47
|
-
item = hit_collection[2].
|
48
|
-
=> #<
|
49
|
-
...
|
47
|
+
item = hit_collection[2].item
|
48
|
+
=> #<Relaton::Iso::ItemData:0x0000000139d07070 ...>
|
50
49
|
|
51
|
-
item.docidentifier
|
52
|
-
=>
|
53
|
-
...
|
50
|
+
item.docidentifier.first.to_s
|
51
|
+
=> "ISO 19115-2:2019"
|
54
52
|
|
55
|
-
item.docidentifier.
|
56
|
-
=> "urn:iso:std:iso:19115:-
|
53
|
+
item.docidentifier.find { |id| id.type == "URN" }.to_s
|
54
|
+
=> "urn:iso:std:iso:19115:-2:stage-90.93"
|
57
55
|
----
|
58
56
|
|
59
57
|
=== Fetch document by reference and year
|
60
58
|
|
61
59
|
[source,ruby]
|
62
60
|
----
|
63
|
-
item =
|
64
|
-
[relaton-iso] (ISO 19115:2003) Fetching from
|
65
|
-
[relaton-iso] (ISO 19115:2003) Found: `ISO 19115:2003`
|
66
|
-
=> #<
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
[relaton-iso] (ISO 19115:2003)
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
item.docidentifier[0].id
|
76
|
-
=> "ISO 19115:2003"
|
61
|
+
item = Relaton::Iso::Bibliography.get "ISO 19115:2003"
|
62
|
+
[relaton-iso] INFO: (ISO 19115:2003) Fetching from Relaton repository ...
|
63
|
+
[relaton-iso] INFO: (ISO 19115:2003) Found: `ISO 19115:2003`
|
64
|
+
=> #<Relaton::Iso::ItemData:0x000000013c4cdac8 ...>
|
65
|
+
|
66
|
+
item = Relaton::Iso::Bibliography.get "ISO 19115", "2003"
|
67
|
+
[relaton-iso] INFO: (ISO 19115:2003) Fetching from Relaton repository ...
|
68
|
+
[relaton-iso] INFO: (ISO 19115:2003) Found: `ISO 19115:2003`
|
69
|
+
=> #<Relaton::Iso::ItemData:0x000000013c4c5148 ...>
|
70
|
+
|
71
|
+
item.docidentifier[0].to_s
|
72
|
+
=> "ISO 19115:2003"
|
77
73
|
----
|
78
74
|
|
79
75
|
=== Fetch non-part document
|
80
76
|
|
81
77
|
[source,ruby]
|
82
78
|
----
|
83
|
-
item =
|
84
|
-
[relaton-iso] (ISO 19115) Fetching from
|
85
|
-
[relaton-iso] (ISO 19115) Found: `ISO 19115:2003`
|
86
|
-
=> #<
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
=> "ISO 19115"
|
79
|
+
item = Relaton::Iso::Bibliography.get "ISO 19115"
|
80
|
+
[relaton-iso] INFO: (ISO 19115) Fetching from Relaton repository ...
|
81
|
+
[relaton-iso] INFO: (ISO 19115) Found: `ISO 19115:2003`
|
82
|
+
=> #<Relaton::Iso::ItemData:0x000000013b6a6418 ...>
|
83
|
+
|
84
|
+
item.docidentifier[0].to_s
|
85
|
+
=> "ISO 19115"
|
91
86
|
----
|
92
87
|
|
93
88
|
=== Fetch a part document
|
94
89
|
|
95
90
|
[source,ruby]
|
96
91
|
----
|
97
|
-
item =
|
98
|
-
[relaton-iso] (ISO 19115-1) Fetching from
|
99
|
-
[relaton-iso] (ISO 19115-1) Found: `ISO 19115-1:2014`
|
100
|
-
=> #<
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
=> "ISO 19115-1"
|
92
|
+
item = Relaton::Iso::Bibliography.get "ISO 19115-1"
|
93
|
+
[relaton-iso] INFO: (ISO 19115-1) Fetching from Relaton repository ...
|
94
|
+
[relaton-iso] INFO: (ISO 19115-1) Found: `ISO 19115-1:2014`
|
95
|
+
=> #<Relaton::Iso::ItemData:0x000000013c761410 ...>
|
96
|
+
|
97
|
+
item.docidentifier[0].to_s
|
98
|
+
=> "ISO 19115-1"
|
105
99
|
----
|
106
100
|
|
107
101
|
=== Fetch all-parts document
|
108
102
|
|
109
103
|
[source,ruby]
|
110
104
|
----
|
111
|
-
item =
|
112
|
-
[relaton-iso] (ISO 19115) Fetching from
|
113
|
-
[relaton-iso] (ISO 19115) Found: `ISO 19115`
|
114
|
-
=> #<
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
[relaton-iso] (ISO 19115)
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
item.docidentifier[0].id
|
138
|
-
=> "ISO 19115 (all parts)"
|
105
|
+
item = Relaton::Iso::Bibliography.get "ISO 19115 (all parts)"
|
106
|
+
[relaton-iso] INFO: (ISO 19115 (all parts)) Fetching from Relaton repository ...
|
107
|
+
[relaton-iso] INFO: (ISO 19115 (all parts)) Found: `ISO 19115 (all parts)`
|
108
|
+
=> #<Relaton::Iso::ItemData:0x000000013bb87950 ...>
|
109
|
+
|
110
|
+
item = Relaton::Iso::Bibliography.get "ISO 19115", nil, all_parts: true
|
111
|
+
[relaton-iso] INFO: (ISO 19115 (all parts)) Fetching from Relaton repository ...
|
112
|
+
[relaton-iso] INFO: (ISO 19115 (all parts)) Found: `ISO 19115 (all parts)`
|
113
|
+
=> #<Relaton::Iso::ItemData:0x000000013c855150 ...>
|
114
|
+
|
115
|
+
item.docidentifier[0].to_s
|
116
|
+
=> "ISO 19115 (all parts)"
|
117
|
+
|
118
|
+
item = Relaton::Iso::Bibliography.get "ISO 19115-1 (all parts)"
|
119
|
+
[relaton-iso] INFO: (ISO 19115-1 (all parts)) Fetching from Relaton repository ...
|
120
|
+
[relaton-iso] INFO: (ISO 19115-1 (all parts)) Found: `ISO 19115 (all parts)`
|
121
|
+
=> #<Relaton::Iso::ItemData:0x000000013b54c590 ...>
|
122
|
+
|
123
|
+
item = Relaton::Iso::Bibliography.get "ISO 19115-1", nil, all_parts: true
|
124
|
+
[relaton-iso] INFO: (ISO 19115-1 (all parts)) Fetching from Relaton repository ...
|
125
|
+
[relaton-iso] INFO: (ISO 19115-1 (all parts)) Found: `ISO 19115 (all parts)`
|
126
|
+
=> #<Relaton::Iso::ItemData:0x000000013b54dad0 ...>
|
127
|
+
|
128
|
+
item.docidentifier[0].to_s
|
129
|
+
=> "ISO 19115 (all parts)"
|
139
130
|
----
|
140
131
|
|
141
132
|
=== Non-standard ISO/IEC documents
|
@@ -253,28 +244,26 @@ Possible options:
|
|
253
244
|
[source,ruby]
|
254
245
|
----
|
255
246
|
item.to_xml
|
256
|
-
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.
|
257
|
-
<
|
258
|
-
<title
|
259
|
-
<title type="title-main" format="text/plain" language="en" script="Latn">Metadata</title>
|
247
|
+
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.4.1">
|
248
|
+
<title language="en" script="Latn" type="title-intro" format="text/plain">Geographic information</title>
|
249
|
+
<title language="en" script="Latn" type="title-main" format="text/plain">Metadata</title>
|
260
250
|
...
|
261
251
|
</bibitem>"
|
262
252
|
|
263
253
|
item.to_xml bibdata: true
|
264
|
-
=> "<bibdata type="standard" schema-version="v1.
|
265
|
-
<
|
266
|
-
<title type="title-intro" format="text/plain" language="en" script="Latn">Geographic information</title>
|
254
|
+
=> "<bibdata type="standard" schema-version="v1.4.1">
|
255
|
+
<title language="en" script="Latn" type="title-intro" format="text/plain">Geographic information</title>
|
267
256
|
...
|
268
|
-
<ext schema-version="v1.0.
|
257
|
+
<ext schema-version="v1.0.5">
|
269
258
|
<doctype>international-standard</doctype>
|
270
259
|
...
|
271
260
|
</ext>
|
272
261
|
</bibdata>"
|
273
262
|
|
274
|
-
item.to_xml note: [{
|
275
|
-
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.
|
263
|
+
item.to_xml note: [{ content: "Note", type: "note" }]
|
264
|
+
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.4.1">
|
276
265
|
...
|
277
|
-
<note
|
266
|
+
<note type="note">Note</note>
|
278
267
|
...
|
279
268
|
</bibitem>"
|
280
269
|
----
|
@@ -283,50 +272,63 @@ item.to_xml note: [{ text: "Note", type: "note" }]
|
|
283
272
|
|
284
273
|
[source,ruby]
|
285
274
|
----
|
286
|
-
item.title
|
287
|
-
=> #<
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
275
|
+
item.title 'en'
|
276
|
+
=> [#<Relaton::Bib::Title:0x000000013e3de2f0
|
277
|
+
@content="Geographic information",
|
278
|
+
@format="text/plain",
|
279
|
+
@language="en",
|
280
|
+
@locale=nil,
|
281
|
+
@script="Latn",
|
282
|
+
@type="title-intro">,
|
283
|
+
#<Relaton::Bib::Title:0x000000013e3de250
|
284
|
+
@content="Metadata",
|
285
|
+
@format="text/plain",
|
286
|
+
@language="en",
|
287
|
+
@locale=nil,
|
288
|
+
@script="Latn",
|
289
|
+
@type="title-main">,
|
290
|
+
#<Relaton::Bib::Title:0x000000013e3de110
|
291
|
+
@content="Geographic information - Metadata",
|
292
|
+
@format="text/plain",
|
293
|
+
@language="en",
|
294
|
+
@locale=nil,
|
295
|
+
@script="Latn",
|
296
|
+
@type="main">]
|
297
|
+
|
298
|
+
item.title 'fr'
|
299
|
+
=> [#<Relaton::Bib::Title:0x000000013e3de070
|
300
|
+
@content="Information géographique",
|
301
|
+
@format="text/plain",
|
302
|
+
@language="fr",
|
303
|
+
@locale=nil,
|
304
|
+
@script="Latn",
|
305
|
+
@type="title-intro">,
|
306
|
+
#<Relaton::Bib::Title:0x000000013e3ddfd0
|
307
|
+
@content="Métadonnées",
|
308
|
+
@format="text/plain",
|
309
|
+
@language="fr",
|
310
|
+
@locale=nil,
|
311
|
+
@script="Latn",
|
312
|
+
@type="title-main">,
|
313
|
+
#<Relaton::Bib::Title:0x000000013e3dde90
|
314
|
+
@content="Information géographique - Métadonnées",
|
315
|
+
@format="text/plain",
|
316
|
+
@language="fr",
|
317
|
+
@locale=nil,
|
318
|
+
@script="Latn",
|
319
|
+
@type="main">]
|
320
|
+
|
321
|
+
item = Relaton::Iso::Bibliography.get "ISO 19115:2003"
|
319
322
|
[relaton-iso] (ISO 19115:2003) Fetching from iso.org ...
|
320
323
|
[relaton-iso] (ISO 19115:2003) Found: `ISO 19115:2003`
|
321
|
-
=> #<
|
322
|
-
|
323
|
-
item.abstract
|
324
|
-
=> #<
|
325
|
-
|
326
|
-
"
|
327
|
-
|
328
|
-
|
329
|
-
@script=["Latn"]>
|
324
|
+
=> #<Relaton::Iso::ItemData:0x000000013eefe888 ...>
|
325
|
+
|
326
|
+
item.abstract 'en'
|
327
|
+
=> [#<Relaton::Bib::LocalizedMarkedUpString:0x000000013e4790c0
|
328
|
+
@content= "ISO 19115:2003 defines the schema required for describing geographic information ...",
|
329
|
+
@language="en",
|
330
|
+
@locale=nil,
|
331
|
+
@script="Latn">]
|
330
332
|
----
|
331
333
|
|
332
334
|
=== Typed links
|
@@ -335,15 +337,17 @@ Each ISO document has `src` type link and optional `obp`, `rss`, and `pub` link
|
|
335
337
|
|
336
338
|
[source,ruby]
|
337
339
|
----
|
338
|
-
item.
|
339
|
-
=> [#<
|
340
|
-
@content
|
340
|
+
item.source
|
341
|
+
=> [#<Relaton::Bib::Uri:0x000000013ee73080
|
342
|
+
@content="https://www.iso.org/standard/26020.html",
|
341
343
|
@language=nil,
|
344
|
+
@locale=nil,
|
342
345
|
@script=nil,
|
343
346
|
@type="src">,
|
344
|
-
#<
|
345
|
-
@content
|
347
|
+
#<Relaton::Bib::Uri:0x000000013ee73030
|
348
|
+
@content="https://www.iso.org/contents/data/standard/02/60/26020.detail.rss",
|
346
349
|
@language=nil,
|
350
|
+
@locale=nil,
|
347
351
|
@script=nil,
|
348
352
|
@type="rss">]
|
349
353
|
----
|
data/bin/console
CHANGED