relaton-iso 2.0.0.pre.alpha.1 → 2.0.0.pre.alpha.2
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/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/grammars/basicdoc.rng +61 -44
- data/grammars/biblio-standoc.rng +37 -56
- data/grammars/biblio.rng +60 -28
- data/grammars/relaton-iso.rng +32 -81
- data/lib/relaton/iso/data_fetcher.rb +5 -7
- data/lib/relaton/iso/hash_parser_v1.rb +65 -9
- data/lib/relaton/iso/hit.rb +3 -8
- data/lib/relaton/iso/hit_collection.rb +0 -1
- data/lib/relaton/iso/item_data.rb +14 -31
- data/lib/relaton/iso/model/docidentifier.rb +1 -1
- data/lib/relaton/iso/model/ext.rb +5 -21
- data/lib/relaton/iso/model/item.rb +2 -2
- data/lib/relaton/iso/processor.rb +7 -8
- data/lib/relaton/iso/scraper.rb +49 -20
- data/lib/relaton/iso/version.rb +1 -1
- data/lib/relaton/iso.rb +13 -0
- data/relaton_iso.gemspec +5 -4
- metadata +24 -14
- data/lib/relaton/iso/model/iso_project_group.rb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52a7ad701da999890a9e5947a408ed028c14a23c1beb268f2be990299f5c44c6
|
|
4
|
+
data.tar.gz: e80e496c6198a01d2ea9b5ed07a9511184adfc4ca6963d619af9e2de28a1a2e1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 35a4b249729a7ff7f1df79088e4cb780f0dd86c25145bea9201a16f86f3fed88ca19f65eab16df7d47179382dc53d2c6b302136eb6c63015e6c485d8dea87c93
|
|
7
|
+
data.tar.gz: 54053f7fb0344f53c69679c5c14dd1fd2452fbbbf5c9d1b8b69ed8842222e50769f633107b3ffaef5a040d87a73e047a7edd948836a4a793cbfafd565db5ed13
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/grammars/basicdoc.rng
CHANGED
|
@@ -198,14 +198,14 @@ Applicable to modify and delete</a:documentation>
|
|
|
198
198
|
</zeroOrMore>
|
|
199
199
|
</element>
|
|
200
200
|
</optional>
|
|
201
|
-
<
|
|
201
|
+
<zeroOrMore>
|
|
202
202
|
<element name="description">
|
|
203
|
-
<a:documentation>Description of the change described in this block</a:documentation>
|
|
204
|
-
<
|
|
203
|
+
<a:documentation>Description(s) of the change described in this block</a:documentation>
|
|
204
|
+
<oneOrMore>
|
|
205
205
|
<ref name="BasicBlock"/>
|
|
206
|
-
</
|
|
206
|
+
</oneOrMore>
|
|
207
207
|
</element>
|
|
208
|
-
</
|
|
208
|
+
</zeroOrMore>
|
|
209
209
|
<optional>
|
|
210
210
|
<element name="newcontent">
|
|
211
211
|
<a:documentation>New content to be added to the document; applicable to add and modify</a:documentation>
|
|
@@ -267,6 +267,10 @@ in a document (e.g. sourcecode annotations)</a:documentation>
|
|
|
267
267
|
<value>justified</value>
|
|
268
268
|
</choice>
|
|
269
269
|
</define>
|
|
270
|
+
<define name="IdRefType">
|
|
271
|
+
<a:documentation>Type of cross-references to elements. In BasicDoc, these always point to id { xsd:ID } </a:documentation>
|
|
272
|
+
<data type="IDREF"/>
|
|
273
|
+
</define>
|
|
270
274
|
<define name="RequiredId">
|
|
271
275
|
<a:documentation>Mandatory anchor of element, to be used for cross-references within the document</a:documentation>
|
|
272
276
|
<attribute name="id">
|
|
@@ -382,33 +386,7 @@ in a document (e.g. sourcecode annotations)</a:documentation>
|
|
|
382
386
|
<a:documentation>Block intended to capture reviewer comments about some text in the document</a:documentation>
|
|
383
387
|
<element name="review">
|
|
384
388
|
<ref name="RequiredId"/>
|
|
385
|
-
<
|
|
386
|
-
<a:documentation>The party who has offered the comment</a:documentation>
|
|
387
|
-
</attribute>
|
|
388
|
-
<optional>
|
|
389
|
-
<attribute name="type">
|
|
390
|
-
<a:documentation>The type of reviewer comment</a:documentation>
|
|
391
|
-
</attribute>
|
|
392
|
-
</optional>
|
|
393
|
-
<optional>
|
|
394
|
-
<attribute name="date">
|
|
395
|
-
<a:documentation>The date when the comment was made</a:documentation>
|
|
396
|
-
<data type="dateTime"/>
|
|
397
|
-
</attribute>
|
|
398
|
-
</optional>
|
|
399
|
-
<optional>
|
|
400
|
-
<attribute name="from">
|
|
401
|
-
<a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
|
|
402
|
-
If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
|
|
403
|
-
<data type="IDREF"/>
|
|
404
|
-
</attribute>
|
|
405
|
-
</optional>
|
|
406
|
-
<optional>
|
|
407
|
-
<attribute name="to">
|
|
408
|
-
<a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
|
|
409
|
-
<data type="IDREF"/>
|
|
410
|
-
</attribute>
|
|
411
|
-
</optional>
|
|
389
|
+
<ref name="ReviewAttributes"/>
|
|
412
390
|
<oneOrMore>
|
|
413
391
|
<ref name="paragraph">
|
|
414
392
|
<a:documentation>Reviewer comments content</a:documentation>
|
|
@@ -416,6 +394,35 @@ If not provided, the comment applies in the vicinity of the place it has been in
|
|
|
416
394
|
</oneOrMore>
|
|
417
395
|
</element>
|
|
418
396
|
</define>
|
|
397
|
+
<define name="ReviewAttributes">
|
|
398
|
+
<attribute name="reviewer">
|
|
399
|
+
<a:documentation>The party who has offered the comment</a:documentation>
|
|
400
|
+
</attribute>
|
|
401
|
+
<optional>
|
|
402
|
+
<attribute name="type">
|
|
403
|
+
<a:documentation>The type of reviewer comment</a:documentation>
|
|
404
|
+
</attribute>
|
|
405
|
+
</optional>
|
|
406
|
+
<optional>
|
|
407
|
+
<attribute name="date">
|
|
408
|
+
<a:documentation>The date when the comment was made</a:documentation>
|
|
409
|
+
<data type="dateTime"/>
|
|
410
|
+
</attribute>
|
|
411
|
+
</optional>
|
|
412
|
+
<optional>
|
|
413
|
+
<attribute name="from">
|
|
414
|
+
<a:documentation>Identifier for the start of the text or point in the text to which the comment applies.
|
|
415
|
+
If not provided, the comment applies in the vicinity of the place it has been inserted into the text</a:documentation>
|
|
416
|
+
<ref name="IdRefType"/>
|
|
417
|
+
</attribute>
|
|
418
|
+
</optional>
|
|
419
|
+
<optional>
|
|
420
|
+
<attribute name="to">
|
|
421
|
+
<a:documentation>Identifier for the end of the text to which the comment applies</a:documentation>
|
|
422
|
+
<ref name="IdRefType"/>
|
|
423
|
+
</attribute>
|
|
424
|
+
</optional>
|
|
425
|
+
</define>
|
|
419
426
|
<define name="NumberingAttributes">
|
|
420
427
|
<optional>
|
|
421
428
|
<attribute name="unnumbered">
|
|
@@ -857,6 +864,7 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
|
|
|
857
864
|
<define name="tr">
|
|
858
865
|
<a:documentation>Sequence of cells to be displayed as a row in a table</a:documentation>
|
|
859
866
|
<element name="tr">
|
|
867
|
+
<ref name="TrAttributes"/>
|
|
860
868
|
<oneOrMore>
|
|
861
869
|
<choice>
|
|
862
870
|
<ref name="td">
|
|
@@ -869,6 +877,9 @@ in case the table cannot be rendered accessibly (HTML 5)</a:documentation>
|
|
|
869
877
|
</oneOrMore>
|
|
870
878
|
</element>
|
|
871
879
|
</define>
|
|
880
|
+
<define name="TrAttributes">
|
|
881
|
+
<empty/>
|
|
882
|
+
</define>
|
|
872
883
|
<define name="tr-no-id">
|
|
873
884
|
<a:documentation>Sequence of cells to be displayed as a row in a table: optional ID attributes recursively (for use in Relaton, metadata)</a:documentation>
|
|
874
885
|
<element name="tr">
|
|
@@ -1280,13 +1291,13 @@ Restricted recursively to contain only other such inline elements with no identi
|
|
|
1280
1291
|
<ref name="pure_strike"/>
|
|
1281
1292
|
<ref name="pure_smallcap"/>
|
|
1282
1293
|
<ref name="br"/>
|
|
1294
|
+
<ref name="stem"/>
|
|
1283
1295
|
</choice>
|
|
1284
1296
|
</define>
|
|
1285
1297
|
<define name="NestedTextElement">
|
|
1286
1298
|
<a:documentation>Contents of TextElement tags: leaves out tags that should occur only at top level of block: bookmark image hr pagebreak</a:documentation>
|
|
1287
1299
|
<choice>
|
|
1288
1300
|
<ref name="PureTextElement"/>
|
|
1289
|
-
<ref name="stem"/>
|
|
1290
1301
|
<ref name="eref"/>
|
|
1291
1302
|
<ref name="xref"/>
|
|
1292
1303
|
<ref name="hyperlink"/>
|
|
@@ -1497,7 +1508,7 @@ Restricted recursively to contain only other such inline elements with no identi
|
|
|
1497
1508
|
<attribute name="to">
|
|
1498
1509
|
<a:documentation>A reference to an anchor element (typically a bookmark),
|
|
1499
1510
|
to indicate that the index range covers a range of locations between the current index element and the `to` anchor</a:documentation>
|
|
1500
|
-
<
|
|
1511
|
+
<ref name="IdRefType"/>
|
|
1501
1512
|
</attribute>
|
|
1502
1513
|
</optional>
|
|
1503
1514
|
<ref name="index-primary">
|
|
@@ -1655,7 +1666,7 @@ which can be bookmarks as well as block or section references</a:documentation>
|
|
|
1655
1666
|
<define name="XrefAttributes">
|
|
1656
1667
|
<attribute name="target">
|
|
1657
1668
|
<a:documentation>The identifier of a section, block or inlined element being referenced</a:documentation>
|
|
1658
|
-
<
|
|
1669
|
+
<ref name="IdRefType"/>
|
|
1659
1670
|
</attribute>
|
|
1660
1671
|
<optional>
|
|
1661
1672
|
<attribute name="type">
|
|
@@ -1694,23 +1705,29 @@ which can be bookmarks as well as block or section references</a:documentation>
|
|
|
1694
1705
|
<a:documentation>Inline reference to a paragraph or paragraphs, appearing as a footnote.
|
|
1695
1706
|
The target of a footnote is the location it is embedded in within the text</a:documentation>
|
|
1696
1707
|
<element name="fn">
|
|
1697
|
-
<
|
|
1698
|
-
|
|
1699
|
-
</attribute>
|
|
1700
|
-
<oneOrMore>
|
|
1701
|
-
<ref name="paragraph">
|
|
1702
|
-
<a:documentation>The content of the footnote</a:documentation>
|
|
1703
|
-
</ref>
|
|
1704
|
-
</oneOrMore>
|
|
1708
|
+
<ref name="FnAttributes"/>
|
|
1709
|
+
<ref name="FnBody"/>
|
|
1705
1710
|
</element>
|
|
1706
1711
|
</define>
|
|
1712
|
+
<define name="FnBody">
|
|
1713
|
+
<oneOrMore>
|
|
1714
|
+
<ref name="paragraph">
|
|
1715
|
+
<a:documentation>The content of the footnote</a:documentation>
|
|
1716
|
+
</ref>
|
|
1717
|
+
</oneOrMore>
|
|
1718
|
+
</define>
|
|
1719
|
+
<define name="FnAttributes">
|
|
1720
|
+
<attribute name="reference">
|
|
1721
|
+
<a:documentation>The number of the footnote, used to identify it visually</a:documentation>
|
|
1722
|
+
</attribute>
|
|
1723
|
+
</define>
|
|
1707
1724
|
<define name="callout">
|
|
1708
1725
|
<a:documentation>Inline reference to a paragraph or paragraphs, appearing as annotation of source code</a:documentation>
|
|
1709
1726
|
<element name="callout">
|
|
1710
1727
|
<attribute name="target">
|
|
1711
1728
|
<a:documentation>The target of the callout is understood to be the location of the callout within the source code;
|
|
1712
1729
|
the extent of the target is not expressed overtly</a:documentation>
|
|
1713
|
-
<
|
|
1730
|
+
<ref name="IdRefType"/>
|
|
1714
1731
|
</attribute>
|
|
1715
1732
|
<text>
|
|
1716
1733
|
<a:documentation>The label of the callout, used to identify its target within the source code</a:documentation>
|
data/grammars/biblio-standoc.rng
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0">
|
|
3
|
-
<!--
|
|
4
|
-
Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
|
|
5
|
-
of relaton
|
|
6
|
-
|
|
7
|
-
Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
|
|
8
|
-
(SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
|
|
9
|
-
-->
|
|
10
3
|
<include href="biblio.rng">
|
|
4
|
+
<!-- ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix -->
|
|
5
|
+
<!--
|
|
6
|
+
Add-ons to biblio.rnc for standoc model: defines the extension point BibDataExtensionType
|
|
7
|
+
of relaton
|
|
8
|
+
|
|
9
|
+
Specialisations as for biblio.rnc. Extension point can be redefined completely for a flavour of standoc
|
|
10
|
+
(SDO); but other elements in Bibdata can only be extended (more specialised vocabularies for Bibdata)
|
|
11
|
+
-->
|
|
11
12
|
<define name="BibData">
|
|
12
13
|
<a:documentation>The bibliographic description of a standardisation document</a:documentation>
|
|
13
14
|
<ref name="StandardBibliographicItem"/>
|
|
@@ -75,12 +76,6 @@ from other documents in the same doctype</a:documentation>
|
|
|
75
76
|
<ref name="flavor">
|
|
76
77
|
<a:documentation>Flavour of Metanorma used to process this document</a:documentation>
|
|
77
78
|
</ref>
|
|
78
|
-
<optional>
|
|
79
|
-
<ref name="editorialgroup">
|
|
80
|
-
<a:documentation>Groups associated with the production of the standards document, typically within
|
|
81
|
-
a standards definition organization</a:documentation>
|
|
82
|
-
</ref>
|
|
83
|
-
</optional>
|
|
84
79
|
<zeroOrMore>
|
|
85
80
|
<ref name="ics">
|
|
86
81
|
<a:documentation>Classification of the document contents taken from the International Classification of Standards</a:documentation>
|
|
@@ -91,6 +86,9 @@ a standards definition organization</a:documentation>
|
|
|
91
86
|
<a:documentation>Representation of the identifier for the standardisation document, giving its individual semantic components</a:documentation>
|
|
92
87
|
</ref>
|
|
93
88
|
</zeroOrMore>
|
|
89
|
+
<ref name="DocumentImages">
|
|
90
|
+
<a:documentation>Coverpage and other images to be rendered with document</a:documentation>
|
|
91
|
+
</ref>
|
|
94
92
|
</define>
|
|
95
93
|
<define name="doctype">
|
|
96
94
|
<a:documentation>Classification of the standardisation document</a:documentation>
|
|
@@ -126,49 +124,6 @@ a standards definition organization</a:documentation>
|
|
|
126
124
|
However we prefer not to hardcode it, given ongoing extension.</a:documentation>
|
|
127
125
|
<text/>
|
|
128
126
|
</define>
|
|
129
|
-
<define name="editorialgroup">
|
|
130
|
-
<a:documentation>A group associated with the production of the standards document, typically within
|
|
131
|
-
a standards definition organization</a:documentation>
|
|
132
|
-
<element name="editorialgroup">
|
|
133
|
-
<oneOrMore>
|
|
134
|
-
<ref name="technical-committee">
|
|
135
|
-
<a:documentation>A technical committee associated with the production of the standards document</a:documentation>
|
|
136
|
-
</ref>
|
|
137
|
-
</oneOrMore>
|
|
138
|
-
</element>
|
|
139
|
-
</define>
|
|
140
|
-
<define name="technical-committee">
|
|
141
|
-
<a:documentation>Technical committee associated with the production of a standards document</a:documentation>
|
|
142
|
-
<element name="technical-committee">
|
|
143
|
-
<ref name="IsoWorkgroup"/>
|
|
144
|
-
</element>
|
|
145
|
-
</define>
|
|
146
|
-
<define name="IsoWorkgroup">
|
|
147
|
-
<optional>
|
|
148
|
-
<attribute name="number">
|
|
149
|
-
<a:documentation>Numeric identifier of the technical committee</a:documentation>
|
|
150
|
-
</attribute>
|
|
151
|
-
</optional>
|
|
152
|
-
<optional>
|
|
153
|
-
<attribute name="type">
|
|
154
|
-
<a:documentation>Type of the technical committee, used in identifying the technical committee</a:documentation>
|
|
155
|
-
</attribute>
|
|
156
|
-
</optional>
|
|
157
|
-
<optional>
|
|
158
|
-
<attribute name="identifier">
|
|
159
|
-
<a:documentation>Non-numeric, complete identifier of the technical committee</a:documentation>
|
|
160
|
-
</attribute>
|
|
161
|
-
</optional>
|
|
162
|
-
<optional>
|
|
163
|
-
<attribute name="prefix">
|
|
164
|
-
<a:documentation>Disambiguating prefix added to number to form the identifier of the technical committee,
|
|
165
|
-
typically indicating its type</a:documentation>
|
|
166
|
-
</attribute>
|
|
167
|
-
</optional>
|
|
168
|
-
<text>
|
|
169
|
-
<a:documentation>Name of the technical committee</a:documentation>
|
|
170
|
-
</text>
|
|
171
|
-
</define>
|
|
172
127
|
<define name="ics">
|
|
173
128
|
<a:documentation>Classification taken from the International Classification of Standards.
|
|
174
129
|
ICS is defined by ISO here -- https://www.iso.org/publication/PUB100033.html</a:documentation>
|
|
@@ -268,6 +223,32 @@ and not those document components</a:documentation>
|
|
|
268
223
|
</optional>
|
|
269
224
|
</element>
|
|
270
225
|
</define>
|
|
226
|
+
<define name="DocumentImages">
|
|
227
|
+
<zeroOrMore>
|
|
228
|
+
<element name="coverpage-image">
|
|
229
|
+
<a:documentation>Images to be displayed on the coverpage of the document</a:documentation>
|
|
230
|
+
<ref name="image-no-id"/>
|
|
231
|
+
</element>
|
|
232
|
+
</zeroOrMore>
|
|
233
|
+
<zeroOrMore>
|
|
234
|
+
<element name="innercoverpage-image">
|
|
235
|
+
<a:documentation>Images to be displayed on the inner coverpage of the document</a:documentation>
|
|
236
|
+
<ref name="image-no-id"/>
|
|
237
|
+
</element>
|
|
238
|
+
</zeroOrMore>
|
|
239
|
+
<zeroOrMore>
|
|
240
|
+
<element name="tocside-image">
|
|
241
|
+
<a:documentation>Images to be displayed on the Table of Contents page of the document</a:documentation>
|
|
242
|
+
<ref name="image-no-id"/>
|
|
243
|
+
</element>
|
|
244
|
+
</zeroOrMore>
|
|
245
|
+
<zeroOrMore>
|
|
246
|
+
<element name="backpage-image">
|
|
247
|
+
<a:documentation>Images to be displayed on the backpage of the document</a:documentation>
|
|
248
|
+
<ref name="image-no-id"/>
|
|
249
|
+
</element>
|
|
250
|
+
</zeroOrMore>
|
|
251
|
+
</define>
|
|
271
252
|
<define name="StandardBibliographicItem">
|
|
272
253
|
<ref name="BibliographicItem"/>
|
|
273
254
|
<zeroOrMore>
|
data/grammars/biblio.rng
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<!--
|
|
3
|
-
instantiations of this grammar may replace leaf strings
|
|
4
|
-
with more elaborated types; e.g. title (text) replaced with
|
|
5
|
-
title-main, title-intro, title-part; type replaced with
|
|
6
|
-
enum.
|
|
7
|
-
|
|
8
|
-
some renaming at leaf nodes is permissible
|
|
9
|
-
|
|
10
|
-
obligations can change both from optional to mandatory,
|
|
11
|
-
and from mandatory to optional; optional elements may
|
|
12
|
-
be omitted; freely positioned alternatives may be replaced
|
|
13
|
-
with strict ordering
|
|
14
|
-
|
|
15
|
-
DO NOT introduce a namespace here. We do not want a distinct namespace
|
|
16
|
-
for these elements, and a distinct namespace for any grammar inheriting
|
|
17
|
-
these elements; we just want one namespace for any child grammars
|
|
18
|
-
of this.
|
|
19
|
-
-->
|
|
20
2
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
|
3
|
+
<!--
|
|
4
|
+
ALERT: we cannot have comments on root element, as they intervene with https://github.com/metanorma/metanorma/issues/437 fix
|
|
5
|
+
|
|
6
|
+
Instantiations of this grammar may replace leaf strings
|
|
7
|
+
with more elaborated types; e.g. title (text) replaced with
|
|
8
|
+
title-main, title-intro, title-part; type replaced with
|
|
9
|
+
enum.
|
|
10
|
+
|
|
11
|
+
Some renaming at leaf nodes is permissible
|
|
12
|
+
|
|
13
|
+
Obligations can change both from optional to mandatory,
|
|
14
|
+
and from mandatory to optional; optional elements may
|
|
15
|
+
be omitted; freely positioned alternatives may be replaced
|
|
16
|
+
with strict ordering
|
|
17
|
+
|
|
18
|
+
DO NOT introduce a namespace here. We do not want a distinct namespace
|
|
19
|
+
for these elements, and a distinct namespace for any grammar inheriting
|
|
20
|
+
these elements; we just want one namespace for any child grammars
|
|
21
|
+
of this.
|
|
22
|
+
-->
|
|
21
23
|
<!--
|
|
22
24
|
https://www.myintervals.com/blog/2009/05/20/iso-8601-date-validation-that-doesnt-suck/
|
|
23
25
|
iso8601date = xsd:string { pattern = "([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?" }
|
|
@@ -240,6 +242,8 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
|
|
|
240
242
|
</choice>
|
|
241
243
|
</define>
|
|
242
244
|
<define name="roledescription">
|
|
245
|
+
<a:documentation>A more detailed description of the role of the contributor
|
|
246
|
+
Some descriptions are reserved words; in particular, the editorial committee of a standard has the role description "committee"</a:documentation>
|
|
243
247
|
<element name="description">
|
|
244
248
|
<ref name="LocalizedMarkedUpString"/>
|
|
245
249
|
</element>
|
|
@@ -441,7 +445,10 @@ real names (if the person is named with a pseudonym or user name); previous lega
|
|
|
441
445
|
</oneOrMore>
|
|
442
446
|
<zeroOrMore>
|
|
443
447
|
<ref name="subdivision">
|
|
444
|
-
<a:documentation>The subdivision of the organization directly involved with the production of the bibliographic item
|
|
448
|
+
<a:documentation>The subdivision of the organization directly involved with the production of the bibliographic item.
|
|
449
|
+
Multiple subdivisions can be specified for an organization, with no implication of hierarchical
|
|
450
|
+
relation between them
|
|
451
|
+
Editorial and advisory groups are represented as consecutive subdivisions of the SDO</a:documentation>
|
|
445
452
|
</ref>
|
|
446
453
|
</zeroOrMore>
|
|
447
454
|
<optional>
|
|
@@ -459,11 +466,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
|
|
|
459
466
|
<a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
|
|
460
467
|
</ref>
|
|
461
468
|
</optional>
|
|
462
|
-
<
|
|
469
|
+
<zeroOrMore>
|
|
463
470
|
<ref name="logo">
|
|
464
471
|
<a:documentation>A logo for the organization</a:documentation>
|
|
465
472
|
</ref>
|
|
466
|
-
</
|
|
473
|
+
</zeroOrMore>
|
|
467
474
|
</define>
|
|
468
475
|
<define name="orgname">
|
|
469
476
|
<element name="name">
|
|
@@ -483,6 +490,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
|
|
|
483
490
|
<a:documentation>The type of subdivision</a:documentation>
|
|
484
491
|
</attribute>
|
|
485
492
|
</optional>
|
|
493
|
+
<optional>
|
|
494
|
+
<attribute name="subtype">
|
|
495
|
+
<a:documentation>The subtype of subdivision; e.g. different types of technical committee</a:documentation>
|
|
496
|
+
</attribute>
|
|
497
|
+
</optional>
|
|
486
498
|
<ref name="OrganizationType">
|
|
487
499
|
<a:documentation>The subdivision, modelled recursively as an organization</a:documentation>
|
|
488
500
|
</ref>
|
|
@@ -490,6 +502,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
|
|
|
490
502
|
</define>
|
|
491
503
|
<define name="logo">
|
|
492
504
|
<element name="logo">
|
|
505
|
+
<optional>
|
|
506
|
+
<attribute name="type">
|
|
507
|
+
<a:documentation>The type of logo</a:documentation>
|
|
508
|
+
</attribute>
|
|
509
|
+
</optional>
|
|
493
510
|
<ref name="image-no-id"/>
|
|
494
511
|
</element>
|
|
495
512
|
</define>
|
|
@@ -501,6 +518,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
|
|
|
501
518
|
<a:documentation>Description of what is being depicted</a:documentation>
|
|
502
519
|
</attribute>
|
|
503
520
|
</optional>
|
|
521
|
+
<optional>
|
|
522
|
+
<attribute name="type">
|
|
523
|
+
<a:documentation>Description of what kind of depiction this</a:documentation>
|
|
524
|
+
</attribute>
|
|
525
|
+
</optional>
|
|
504
526
|
<zeroOrMore>
|
|
505
527
|
<ref name="image-no-id">
|
|
506
528
|
<a:documentation>A visual depiction of the bibliographic item</a:documentation>
|
|
@@ -678,7 +700,7 @@ Examples include GRID, LEI, CrossRef, and Ringgold</a:documentation>
|
|
|
678
700
|
<define name="CitationType">
|
|
679
701
|
<attribute name="bibitemid">
|
|
680
702
|
<a:documentation>Bibliographic item that the citation applies to, referenced as the anchor of a bibliographic description</a:documentation>
|
|
681
|
-
<
|
|
703
|
+
<ref name="IdRefType"/>
|
|
682
704
|
</attribute>
|
|
683
705
|
<choice>
|
|
684
706
|
<zeroOrMore>
|
|
@@ -857,7 +879,7 @@ depending on whether the items exist as independent documents, or are parts of a
|
|
|
857
879
|
</zeroOrMore>
|
|
858
880
|
</element>
|
|
859
881
|
</define>
|
|
860
|
-
<define name="BibItemType"
|
|
882
|
+
<define name="BibItemType">
|
|
861
883
|
<a:documentation>Type of bibliographic item.
|
|
862
884
|
The value list complies with the types provided in ISO 690:2021.
|
|
863
885
|
NOTE: These values represent a strict superset to BibTeX
|
|
@@ -1224,9 +1246,9 @@ Refer to `BibliographicItem` for definitions</a:documentation>
|
|
|
1224
1246
|
<optional>
|
|
1225
1247
|
<ref name="validity"/>
|
|
1226
1248
|
</optional>
|
|
1227
|
-
<
|
|
1249
|
+
<zeroOrMore>
|
|
1228
1250
|
<ref name="depiction"/>
|
|
1229
|
-
</
|
|
1251
|
+
</zeroOrMore>
|
|
1230
1252
|
</define>
|
|
1231
1253
|
<define name="btitle">
|
|
1232
1254
|
<a:documentation>A title of a bibliographic item, associated with a type of title</a:documentation>
|
|
@@ -1241,6 +1263,11 @@ Refer to `BibliographicItem` for definitions</a:documentation>
|
|
|
1241
1263
|
</define>
|
|
1242
1264
|
<define name="formattedref">
|
|
1243
1265
|
<element name="formattedref">
|
|
1266
|
+
<optional>
|
|
1267
|
+
<attribute name="format">
|
|
1268
|
+
<a:documentation>format of formatted reference; Metanorma assumes references are formatted as Metanorma XML</a:documentation>
|
|
1269
|
+
</attribute>
|
|
1270
|
+
</optional>
|
|
1244
1271
|
<oneOrMore>
|
|
1245
1272
|
<ref name="TextElement"/>
|
|
1246
1273
|
</oneOrMore>
|
|
@@ -1279,17 +1306,17 @@ for which this claim of validity is made, if applicable</a:documentation>
|
|
|
1279
1306
|
</define>
|
|
1280
1307
|
<define name="validityBegins">
|
|
1281
1308
|
<element name="validityBegins">
|
|
1282
|
-
<ref name="
|
|
1309
|
+
<ref name="ISO8601DateTime"/>
|
|
1283
1310
|
</element>
|
|
1284
1311
|
</define>
|
|
1285
1312
|
<define name="validityEnds">
|
|
1286
1313
|
<element name="validityEnds">
|
|
1287
|
-
<ref name="
|
|
1314
|
+
<ref name="ISO8601DateTime"/>
|
|
1288
1315
|
</element>
|
|
1289
1316
|
</define>
|
|
1290
1317
|
<define name="validityRevision">
|
|
1291
1318
|
<element name="revision">
|
|
1292
|
-
<ref name="
|
|
1319
|
+
<ref name="ISO8601DateTime"/>
|
|
1293
1320
|
</element>
|
|
1294
1321
|
</define>
|
|
1295
1322
|
<define name="TypedTitleString">
|
|
@@ -1812,6 +1839,11 @@ May be used to differentiate rendering of notes in bibliographies</a:documentati
|
|
|
1812
1839
|
<a:documentation>Abstract of bibliographic item</a:documentation>
|
|
1813
1840
|
<element name="abstract">
|
|
1814
1841
|
<ref name="LocalizedStringAttributes"/>
|
|
1842
|
+
<optional>
|
|
1843
|
+
<attribute name="format">
|
|
1844
|
+
<a:documentation>What format the formatted abstract is in. In Metanorma, assumed to be Metanorma XML</a:documentation>
|
|
1845
|
+
</attribute>
|
|
1846
|
+
</optional>
|
|
1815
1847
|
<choice>
|
|
1816
1848
|
<oneOrMore>
|
|
1817
1849
|
<ref name="BasicBlockNoId">
|
data/grammars/relaton-iso.rng
CHANGED
|
@@ -1,39 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
|
2
|
+
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
|
3
3
|
<include href="biblio-standoc.rng">
|
|
4
|
-
<define name="BibDataExtensionType">
|
|
5
|
-
<optional>
|
|
6
|
-
<attribute name="schema-version"/>
|
|
7
|
-
</optional>
|
|
8
|
-
<ref name="doctype"/>
|
|
9
|
-
<optional>
|
|
10
|
-
<ref name="docsubtype"/>
|
|
11
|
-
</optional>
|
|
12
|
-
<ref name="flavor"/>
|
|
13
|
-
<optional>
|
|
14
|
-
<ref name="horizontal"/>
|
|
15
|
-
</optional>
|
|
16
|
-
<ref name="editorialgroup"/>
|
|
17
|
-
<optional>
|
|
18
|
-
<ref name="approvalgroup"/>
|
|
19
|
-
</optional>
|
|
20
|
-
<zeroOrMore>
|
|
21
|
-
<ref name="ics"/>
|
|
22
|
-
</zeroOrMore>
|
|
23
|
-
<ref name="structuredidentifier"/>
|
|
24
|
-
<optional>
|
|
25
|
-
<ref name="stagename"/>
|
|
26
|
-
</optional>
|
|
27
|
-
<optional>
|
|
28
|
-
<ref name="updates_document_type"/>
|
|
29
|
-
</optional>
|
|
30
|
-
<optional>
|
|
31
|
-
<ref name="fast_track"/>
|
|
32
|
-
</optional>
|
|
33
|
-
<optional>
|
|
34
|
-
<ref name="price-code"/>
|
|
35
|
-
</optional>
|
|
36
|
-
</define>
|
|
37
4
|
<define name="bdate">
|
|
38
5
|
<element name="date">
|
|
39
6
|
<attribute name="type">
|
|
@@ -100,42 +67,41 @@
|
|
|
100
67
|
</group>
|
|
101
68
|
</element>
|
|
102
69
|
</define>
|
|
103
|
-
<define name="editorialgroup">
|
|
104
|
-
<element name="editorialgroup">
|
|
105
|
-
<ref name="ISOProjectGroup"/>
|
|
106
|
-
</element>
|
|
107
|
-
</define>
|
|
108
70
|
</include>
|
|
109
|
-
<define name="
|
|
110
|
-
<element name="updates-document-type">
|
|
111
|
-
<ref name="DocumentType"/>
|
|
112
|
-
</element>
|
|
113
|
-
</define>
|
|
114
|
-
<define name="ISOProjectGroup">
|
|
115
|
-
<zeroOrMore>
|
|
116
|
-
<ref name="agency"/>
|
|
117
|
-
</zeroOrMore>
|
|
118
|
-
<oneOrMore>
|
|
119
|
-
<ref name="technical-committee"/>
|
|
120
|
-
</oneOrMore>
|
|
121
|
-
<zeroOrMore>
|
|
122
|
-
<ref name="subcommittee"/>
|
|
123
|
-
</zeroOrMore>
|
|
124
|
-
<zeroOrMore>
|
|
125
|
-
<ref name="workgroup"/>
|
|
126
|
-
</zeroOrMore>
|
|
71
|
+
<define name="BibDataExtensionType" combine="interleave">
|
|
127
72
|
<optional>
|
|
128
|
-
<ref name="
|
|
73
|
+
<ref name="horizontal">
|
|
74
|
+
<a:documentation>Whether the document is a horizontal standard</a:documentation>
|
|
75
|
+
</ref>
|
|
76
|
+
</optional>
|
|
77
|
+
<optional>
|
|
78
|
+
<ref name="stagename">
|
|
79
|
+
<a:documentation>Human-readable name of the stage of publication, corresponding to the numeric stage code given in `/bibdata/status/stage`</a:documentation>
|
|
80
|
+
</ref>
|
|
81
|
+
</optional>
|
|
82
|
+
<optional>
|
|
83
|
+
<ref name="updates_document_type">
|
|
84
|
+
<a:documentation>If this is an update to another document (e.g. an amendment), the `doctype` will not indicate what type of
|
|
85
|
+
document is being updated (e.g. that this is an amendment to a technical report, as opposed to an amendment to a technical standard).
|
|
86
|
+
The `updates-document-type` value indicates the document type of the document being updated; this may be needed for proper rendering, or
|
|
87
|
+
to formulate the document identifier properly</a:documentation>
|
|
88
|
+
</ref>
|
|
89
|
+
</optional>
|
|
90
|
+
<optional>
|
|
91
|
+
<ref name="fast_track">
|
|
92
|
+
<a:documentation>Whether this is a fast-track standard</a:documentation>
|
|
93
|
+
</ref>
|
|
94
|
+
</optional>
|
|
95
|
+
<optional>
|
|
96
|
+
<ref name="price-code">
|
|
97
|
+
<a:documentation>The price code of the standard, as documented in https://www.iec.ch/members_experts/tools/pdf/IEC_DATA_FEEDS.pdf
|
|
98
|
+
Used for legacy ISO documents</a:documentation>
|
|
99
|
+
</ref>
|
|
129
100
|
</optional>
|
|
130
101
|
</define>
|
|
131
|
-
<define name="
|
|
132
|
-
<element name="
|
|
133
|
-
<ref name="
|
|
134
|
-
</element>
|
|
135
|
-
</define>
|
|
136
|
-
<define name="agency">
|
|
137
|
-
<element name="agency">
|
|
138
|
-
<text/>
|
|
102
|
+
<define name="updates_document_type">
|
|
103
|
+
<element name="updates-document-type">
|
|
104
|
+
<ref name="DocumentType"/>
|
|
139
105
|
</element>
|
|
140
106
|
</define>
|
|
141
107
|
<define name="horizontal">
|
|
@@ -178,21 +144,6 @@
|
|
|
178
144
|
<data type="int"/>
|
|
179
145
|
</element>
|
|
180
146
|
</define>
|
|
181
|
-
<define name="subcommittee">
|
|
182
|
-
<element name="subcommittee">
|
|
183
|
-
<ref name="IsoWorkgroup"/>
|
|
184
|
-
</element>
|
|
185
|
-
</define>
|
|
186
|
-
<define name="workgroup">
|
|
187
|
-
<element name="workgroup">
|
|
188
|
-
<ref name="IsoWorkgroup"/>
|
|
189
|
-
</element>
|
|
190
|
-
</define>
|
|
191
|
-
<define name="secretariat">
|
|
192
|
-
<element name="secretariat">
|
|
193
|
-
<text/>
|
|
194
|
-
</element>
|
|
195
|
-
</define>
|
|
196
147
|
<define name="stagename">
|
|
197
148
|
<element name="stagename">
|
|
198
149
|
<optional>
|
|
@@ -28,7 +28,7 @@ module Relaton
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def index
|
|
31
|
-
@index ||= Relaton::Index.find_or_create :iso, file: "#{
|
|
31
|
+
@index ||= Relaton::Index.find_or_create :iso, file: "#{INDEXFILE}.yaml"
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
#
|
|
@@ -202,13 +202,11 @@ module Relaton
|
|
|
202
202
|
File.write file, serialize(doc), encoding: "UTF-8"
|
|
203
203
|
end
|
|
204
204
|
|
|
205
|
-
def to_yaml(doc)
|
|
206
|
-
Item.to_yaml doc
|
|
207
|
-
end
|
|
205
|
+
def to_yaml(doc) = doc.to_yaml
|
|
208
206
|
|
|
209
|
-
def to_xml(doc)
|
|
210
|
-
|
|
211
|
-
|
|
207
|
+
def to_xml(doc) = doc.to_xml bibxml: true
|
|
208
|
+
|
|
209
|
+
def to_bibxml(doc) = doc.to_rfcxml
|
|
212
210
|
|
|
213
211
|
#
|
|
214
212
|
# Create thread worker
|
|
@@ -11,6 +11,15 @@ module Relaton
|
|
|
11
11
|
include Bib::HashParserV1
|
|
12
12
|
extend self
|
|
13
13
|
|
|
14
|
+
PUBLISHERS = {
|
|
15
|
+
"IEC" => "International Electrotechnical Commission",
|
|
16
|
+
"ISO" => "International Organization for Standardization",
|
|
17
|
+
"IEEE" => "Institute of Electrical and Electronics Engineers",
|
|
18
|
+
"SAE" => "SAE International",
|
|
19
|
+
"CIE" => " International Commission on Illumination",
|
|
20
|
+
"ASME" => "American Society of Mechanical Engineers",
|
|
21
|
+
}.freeze
|
|
22
|
+
|
|
14
23
|
private
|
|
15
24
|
|
|
16
25
|
def ext_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
@@ -53,25 +62,72 @@ module Relaton
|
|
|
53
62
|
end
|
|
54
63
|
|
|
55
64
|
# @param ret [Hash]
|
|
56
|
-
def editorialgroup_hash_to_bib(ret)
|
|
65
|
+
def editorialgroup_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
57
66
|
eg = ret.dig(:ext, :editorialgroup) || ret[:editorialgroup]
|
|
58
67
|
return unless eg
|
|
59
68
|
|
|
60
|
-
ret[:ext]
|
|
69
|
+
ret[:ext]&.delete(:editorialgroup)
|
|
70
|
+
ret.delete(:editorialgroup)
|
|
71
|
+
ret[:contributor] ||= []
|
|
72
|
+
add_group_contributors(ret, eg, "committee")
|
|
61
73
|
end
|
|
62
74
|
|
|
63
|
-
def approvalgroup_hash_to_bib(ret)
|
|
75
|
+
def approvalgroup_hash_to_bib(ret) # rubocop:disable Metrics/AbcSize
|
|
64
76
|
ag = ret.dig(:ext, :approvalgroup) || ret[:approvalgroup]
|
|
65
77
|
return unless ag
|
|
66
78
|
|
|
67
|
-
ret[:ext]
|
|
79
|
+
ret[:ext]&.delete(:approvalgroup)
|
|
80
|
+
ret.delete(:approvalgroup)
|
|
81
|
+
ret[:contributor] ||= []
|
|
82
|
+
add_group_contributors(ret, ag, "authorizer", role_type: "authorizer")
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def add_group_contributors(ret, group, description, role_type: "author") # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
86
|
+
subdiv_types = {
|
|
87
|
+
technical_committee: "technical-committee",
|
|
88
|
+
subcommittee: "subcommittee",
|
|
89
|
+
workgroup: "workgroup",
|
|
90
|
+
}
|
|
91
|
+
subdiv_types.each do |key, subdiv_type|
|
|
92
|
+
array(group[key]).each do |wg|
|
|
93
|
+
wg[:content] ||= wg.delete(:name)
|
|
94
|
+
next unless wg[:content]
|
|
95
|
+
|
|
96
|
+
prefix = wg[:prefix] || wg[:identifier]&.split("/")&.first || extract_prefix(wg[:content])
|
|
97
|
+
publisher_name = PUBLISHERS[prefix]
|
|
98
|
+
name = if publisher_name
|
|
99
|
+
[Bib::TypedLocalizedString.new(content: publisher_name)]
|
|
100
|
+
elsif prefix
|
|
101
|
+
[Bib::TypedLocalizedString.new(content: prefix)]
|
|
102
|
+
else
|
|
103
|
+
[Bib::TypedLocalizedString.new(content: wg[:content])]
|
|
104
|
+
end
|
|
105
|
+
abbreviation = prefix ? Bib::LocalizedString.new(content: prefix) : nil
|
|
106
|
+
|
|
107
|
+
subdivision = Bib::Subdivision.new(
|
|
108
|
+
type: subdiv_type, subtype: wg[:type],
|
|
109
|
+
name: [Bib::TypedLocalizedString.new(content: wg[:content])],
|
|
110
|
+
identifier: wg[:identifier] ? [Bib::OrganizationType::Identifier.new(content: wg[:identifier])] : [],
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
role = Bib::Contributor::Role.new(
|
|
114
|
+
type: role_type,
|
|
115
|
+
description: [Bib::LocalizedMarkedUpString.new(content: description)],
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
ret[:contributor] << Bib::Contributor.new(
|
|
119
|
+
role: [role],
|
|
120
|
+
organization: Bib::Organization.new(
|
|
121
|
+
name: name, subdivision: [subdivision], abbreviation: abbreviation,
|
|
122
|
+
),
|
|
123
|
+
)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
68
126
|
end
|
|
69
127
|
|
|
70
|
-
def
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
args[:workgroup] = workgroup_hash_to_bib args[:workgroup]
|
|
74
|
-
ISOProjectGroup.new(**args)
|
|
128
|
+
def extract_prefix(content)
|
|
129
|
+
match = content&.match(%r{^([A-Z]+)/})
|
|
130
|
+
match[1] if match
|
|
75
131
|
end
|
|
76
132
|
|
|
77
133
|
# @param ret [Hash]
|
data/lib/relaton/iso/hit.rb
CHANGED
|
@@ -10,20 +10,15 @@ module Relaton
|
|
|
10
10
|
# @return [Pubid::Iso::Identifier] pubid
|
|
11
11
|
attr_writer :pubid
|
|
12
12
|
|
|
13
|
-
# Update edition for pubid when provided in Bibliographic Item
|
|
14
|
-
# def update_edition(bibliographic_item)
|
|
15
|
-
# if bibliographic_item.edition
|
|
16
|
-
# pubid.root.edition = bibliographic_item.edition.content
|
|
17
|
-
# end
|
|
18
|
-
# end
|
|
19
|
-
|
|
20
13
|
# Parse page.
|
|
21
14
|
# @return [Relaton::Iso::ItemData]
|
|
22
15
|
def item
|
|
23
16
|
@item ||= begin
|
|
24
17
|
url = "#{HitCollection::ENDPOINT}#{hit[:file]}"
|
|
25
18
|
resp = Net::HTTP.get_response URI(url)
|
|
26
|
-
Item.from_yaml resp.body
|
|
19
|
+
item = Item.from_yaml resp.body
|
|
20
|
+
item.fetched = ::Date.today.to_s
|
|
21
|
+
item
|
|
27
22
|
end
|
|
28
23
|
end
|
|
29
24
|
|
|
@@ -1,49 +1,32 @@
|
|
|
1
1
|
module Relaton
|
|
2
2
|
module Iso
|
|
3
3
|
class ItemData < Bib::ItemData
|
|
4
|
-
def deep_clone
|
|
5
|
-
Item.from_yaml Item.to_yaml(self)
|
|
6
|
-
end
|
|
7
|
-
|
|
8
4
|
def create_id(without_date: false)
|
|
9
5
|
docid = docidentifier.find(&:primary) || docidentifier.first
|
|
10
6
|
return unless docid
|
|
11
7
|
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
if docid.content.is_a?(String)
|
|
9
|
+
create_id_from_string(docid.content, without_date)
|
|
10
|
+
else
|
|
11
|
+
create_id_from_pubid(docid.content, without_date)
|
|
12
|
+
end
|
|
14
13
|
end
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
Relation.new(**args)
|
|
18
|
-
end
|
|
15
|
+
private
|
|
19
16
|
|
|
20
|
-
def
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
end
|
|
17
|
+
def create_id_from_string(content, without_date)
|
|
18
|
+
pubid = without_date ? content.sub(/:\d{4}$/, "") : content
|
|
19
|
+
self.id = pubid.gsub(/\W+/, "")
|
|
24
20
|
end
|
|
25
21
|
|
|
26
|
-
def
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
end
|
|
22
|
+
def create_id_from_pubid(content, without_date)
|
|
23
|
+
pubid = without_date ? content.exclude(:year) : content
|
|
24
|
+
self.id = pubid.to_s(with_prf: true).gsub(/\W+/, "")
|
|
30
25
|
end
|
|
31
26
|
|
|
32
|
-
def
|
|
33
|
-
|
|
34
|
-
Item.to_json(self)
|
|
35
|
-
end
|
|
27
|
+
def create_relation(**args)
|
|
28
|
+
Relation.new(**args)
|
|
36
29
|
end
|
|
37
|
-
|
|
38
|
-
# private
|
|
39
|
-
|
|
40
|
-
# def add_notes(notes)
|
|
41
|
-
# self.note ||= []
|
|
42
|
-
# Relaton.array(notes).each { |nt| note << Bib::Note.new(**nt) }
|
|
43
|
-
# result = yield
|
|
44
|
-
# Relaton.array(notes).each { note.pop }
|
|
45
|
-
# result
|
|
46
|
-
# end
|
|
47
30
|
end
|
|
48
31
|
end
|
|
49
32
|
end
|
|
@@ -1,42 +1,26 @@
|
|
|
1
1
|
require_relative "doctype"
|
|
2
|
-
require_relative "iso_project_group"
|
|
3
2
|
require_relative "stagename"
|
|
4
|
-
# require_relative "subdoctype"
|
|
5
3
|
require_relative "structured_identifier"
|
|
6
4
|
|
|
7
5
|
module Relaton
|
|
8
6
|
module Iso
|
|
9
|
-
class Ext <
|
|
10
|
-
attribute :schema_version, :
|
|
7
|
+
class Ext < Bib::Ext
|
|
8
|
+
attribute :schema_version, method: :get_schema_version
|
|
11
9
|
attribute :doctype, Doctype
|
|
12
|
-
attribute :subdoctype, :string
|
|
13
|
-
attribute :flavor, :string
|
|
14
|
-
attribute :horizontal, :boolean
|
|
15
|
-
attribute :editorialgroup, ISOProjectGroup
|
|
16
|
-
attribute :approvalgroup, ISOProjectGroup
|
|
17
|
-
attribute :ics, Bib::ICS, collection: true
|
|
18
10
|
attribute :structuredidentifier, StructuredIdentifier
|
|
11
|
+
attribute :horizontal, :boolean
|
|
19
12
|
attribute :stagename, Stagename
|
|
20
13
|
attribute :updates_document_type, :string, values: Doctype::TYPES
|
|
21
14
|
attribute :fast_track, :boolean
|
|
22
15
|
attribute :price_code, :string
|
|
23
16
|
|
|
24
|
-
def
|
|
25
|
-
|
|
26
|
-
@schema_version = Relaton.schema_versions["relaton-model-iso"]
|
|
17
|
+
def get_schema_version
|
|
18
|
+
Relaton.schema_versions["relaton-model-iso"]
|
|
27
19
|
end
|
|
28
20
|
|
|
29
21
|
xml do
|
|
30
22
|
root "ext"
|
|
31
|
-
map_attribute "schema-version", to: :schema_version
|
|
32
|
-
map_element "doctype", to: :doctype
|
|
33
|
-
map_element "subdoctype", to: :subdoctype
|
|
34
|
-
map_element "flavor", to: :flavor
|
|
35
23
|
map_element "horizontal", to: :horizontal
|
|
36
|
-
map_element "editorialgroup", to: :editorialgroup
|
|
37
|
-
map_element "approvalgroup", to: :approvalgroup
|
|
38
|
-
map_element "ics", to: :ics
|
|
39
|
-
map_element "structuredidentifier", to: :structuredidentifier
|
|
40
24
|
map_element "stagename", to: :stagename
|
|
41
25
|
map_element "updates-document-type", to: :updates_document_type
|
|
42
26
|
map_element "fast-track", to: :fast_track
|
|
@@ -9,8 +9,8 @@ module Relaton
|
|
|
9
9
|
class Item < Bib::Item
|
|
10
10
|
model ItemData
|
|
11
11
|
|
|
12
|
-
attribute :docidentifier, Docidentifier, collection: true
|
|
13
|
-
attribute :relation, Relation, collection: true
|
|
12
|
+
attribute :docidentifier, Docidentifier, collection: true, initialize_empty: true
|
|
13
|
+
attribute :relation, Relation, collection: true, initialize_empty: true
|
|
14
14
|
attribute :ext, Ext
|
|
15
15
|
end
|
|
16
16
|
end
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
require "relaton/core/processor"
|
|
2
|
+
|
|
1
3
|
module Relaton
|
|
2
4
|
module Iso
|
|
3
|
-
class Processor <
|
|
5
|
+
class Processor < Core::Processor
|
|
4
6
|
attr_reader :idtype
|
|
5
7
|
|
|
6
8
|
def initialize # rubocop:disable Lint/MissingSuper
|
|
@@ -55,23 +57,20 @@ module Relaton
|
|
|
55
57
|
# Returns hash of XML grammar
|
|
56
58
|
# @return [String]
|
|
57
59
|
def grammar_hash
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
Digest::MD5.hexdigest Relaton::Iso::VERSION + Relaton::Bib::VERSION
|
|
60
|
+
require_relative "../iso"
|
|
61
|
+
Iso.grammar_hash
|
|
61
62
|
end
|
|
62
63
|
|
|
63
64
|
# Returns number of workers
|
|
64
65
|
# @return [Integer]
|
|
65
|
-
def threads
|
|
66
|
-
3
|
|
67
|
-
end
|
|
66
|
+
def threads = 3
|
|
68
67
|
|
|
69
68
|
#
|
|
70
69
|
# Remove index file
|
|
71
70
|
#
|
|
72
71
|
def remove_index_file
|
|
73
72
|
require_relative "hit_collection"
|
|
74
|
-
|
|
73
|
+
Index.find_or_create(:iso, url: true, file: "#{INDEXFILE}.yaml").remove_file
|
|
75
74
|
end
|
|
76
75
|
end
|
|
77
76
|
end
|
data/lib/relaton/iso/scraper.rb
CHANGED
|
@@ -64,9 +64,13 @@ module Relaton
|
|
|
64
64
|
@doc, @url = get_page path
|
|
65
65
|
titles, abstract, langs = fetch_titles_abstract
|
|
66
66
|
|
|
67
|
+
contributors = fetch_contributors
|
|
68
|
+
eg_contributor = fetch_editorialgroup_contributor
|
|
69
|
+
contributors << eg_contributor if eg_contributor
|
|
70
|
+
|
|
67
71
|
ItemData.new(
|
|
68
72
|
id: id.gsub(/[^\w]/, ""),
|
|
69
|
-
fetched: Date.today.to_s,
|
|
73
|
+
# fetched: Date.today.to_s,
|
|
70
74
|
type: "standard",
|
|
71
75
|
docidentifier: fetch_relaton_docids,
|
|
72
76
|
docnumber: fetch_docnumber,
|
|
@@ -77,7 +81,7 @@ module Relaton
|
|
|
77
81
|
status: fetch_status,
|
|
78
82
|
ics: fetch_ics,
|
|
79
83
|
date: fetch_dates,
|
|
80
|
-
contributor:
|
|
84
|
+
contributor: contributors,
|
|
81
85
|
abstract: abstract,
|
|
82
86
|
copyright: fetch_copyright,
|
|
83
87
|
source: fetch_source(@url),
|
|
@@ -139,7 +143,7 @@ module Relaton
|
|
|
139
143
|
# @return [String] English reference identifier
|
|
140
144
|
#
|
|
141
145
|
def isoref
|
|
142
|
-
params = pubid.
|
|
146
|
+
params = pubid.to_h.except(:typed_stage)
|
|
143
147
|
::Pubid::Iso::Identifier.create(language: "en", **params).to_s(format: :ref_num_short)
|
|
144
148
|
end
|
|
145
149
|
|
|
@@ -535,12 +539,10 @@ module Relaton
|
|
|
535
539
|
[Bib::Copyright.new(owner: [contrib], from: from)]
|
|
536
540
|
end
|
|
537
541
|
|
|
538
|
-
def parse_ext
|
|
542
|
+
def parse_ext
|
|
539
543
|
Ext.new(
|
|
540
544
|
doctype: fetch_type,
|
|
541
545
|
flavor: "iso",
|
|
542
|
-
editorialgroup: fetch_editorialgroup,
|
|
543
|
-
approvalgroup: nil,
|
|
544
546
|
ics: fetch_ics,
|
|
545
547
|
structuredidentifier: fetch_structuredidentifier,
|
|
546
548
|
stagename: nil,
|
|
@@ -563,28 +565,55 @@ module Relaton
|
|
|
563
565
|
end
|
|
564
566
|
|
|
565
567
|
#
|
|
566
|
-
# Fetch editorialgroup.
|
|
567
|
-
#
|
|
568
|
-
# @param doc [Nokogiri::HTML::Document]
|
|
568
|
+
# Fetch editorialgroup as a contributor with subdivision.
|
|
569
569
|
#
|
|
570
|
-
# @return [
|
|
570
|
+
# @return [Relaton::Bib::Contributor, nil]
|
|
571
571
|
#
|
|
572
|
-
def
|
|
573
|
-
wg = @doc.at(
|
|
572
|
+
def fetch_editorialgroup_contributor # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
573
|
+
wg = @doc.at(
|
|
574
|
+
"//div[contains(., 'Technical Committe')]" \
|
|
575
|
+
"/following-sibling::span/a",
|
|
576
|
+
)
|
|
574
577
|
@errors[:editorialgroup] &&= wg.nil?
|
|
575
578
|
return unless wg
|
|
576
579
|
|
|
577
580
|
workgroup = wg.text.split "/"
|
|
581
|
+
prefix = workgroup[0]
|
|
578
582
|
type = workgroup[1]&.match(/^[A-Z]+/)&.to_s || "TC"
|
|
579
|
-
# {
|
|
580
|
-
# name: "International Organization for Standardization",
|
|
581
|
-
# abbreviation: "ISO",
|
|
582
|
-
# url: "www.iso.org",
|
|
583
|
-
# }
|
|
584
|
-
tc_numb = workgroup[1]&.match(/\d+/)&.to_s&.to_i
|
|
585
583
|
tc_name = wg[:title]
|
|
586
|
-
|
|
587
|
-
|
|
584
|
+
|
|
585
|
+
publisher = PUBLISHERS[prefix]
|
|
586
|
+
name = if publisher
|
|
587
|
+
[Bib::TypedLocalizedString.new(content: publisher[:name])]
|
|
588
|
+
elsif prefix
|
|
589
|
+
[Bib::TypedLocalizedString.new(content: prefix)]
|
|
590
|
+
else
|
|
591
|
+
[]
|
|
592
|
+
end
|
|
593
|
+
abbreviation = if prefix
|
|
594
|
+
Bib::LocalizedString.new(content: prefix)
|
|
595
|
+
end
|
|
596
|
+
|
|
597
|
+
subdivision = Bib::Subdivision.new(
|
|
598
|
+
type: "technical-committee",
|
|
599
|
+
subtype: type,
|
|
600
|
+
name: [Bib::TypedLocalizedString.new(content: tc_name)],
|
|
601
|
+
identifier: [Bib::OrganizationType::Identifier.new(
|
|
602
|
+
content: wg.text,
|
|
603
|
+
)],
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
role = Bib::Contributor::Role.new(
|
|
607
|
+
type: "author",
|
|
608
|
+
description: [Bib::LocalizedMarkedUpString.new(content: "committee")],
|
|
609
|
+
)
|
|
610
|
+
|
|
611
|
+
Bib::Contributor.new(
|
|
612
|
+
role: [role],
|
|
613
|
+
organization: Bib::Organization.new(
|
|
614
|
+
name: name, subdivision: [subdivision], abbreviation: abbreviation,
|
|
615
|
+
),
|
|
616
|
+
)
|
|
588
617
|
end
|
|
589
618
|
end
|
|
590
619
|
end
|
data/lib/relaton/iso/version.rb
CHANGED
data/lib/relaton/iso.rb
CHANGED
|
@@ -15,3 +15,16 @@ require_relative "iso/model/bibitem"
|
|
|
15
15
|
require_relative "iso/model/bibdata"
|
|
16
16
|
require_relative "iso/hit_collection"
|
|
17
17
|
require_relative "iso/bibliography"
|
|
18
|
+
|
|
19
|
+
module Relaton
|
|
20
|
+
module Iso
|
|
21
|
+
INDEXFILE = "index-v1"
|
|
22
|
+
|
|
23
|
+
def self.grammar_hash
|
|
24
|
+
# gem_path = File.expand_path "..", __dir__
|
|
25
|
+
# grammars_path = File.join gem_path, "grammars", "*"
|
|
26
|
+
# grammars = Dir[grammars_path].sort.map { |gp| File.read gp, encoding: "UTF-8" }.join
|
|
27
|
+
Digest::MD5.hexdigest VERSION + Bib::VERSION # grammars
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/relaton_iso.gemspec
CHANGED
|
@@ -24,11 +24,12 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.bindir = "exe"
|
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
26
26
|
spec.require_paths = ["lib"]
|
|
27
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.
|
|
27
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.2.0")
|
|
28
28
|
|
|
29
29
|
spec.add_dependency "isoics", "~> 0.1.6"
|
|
30
|
-
spec.add_dependency "
|
|
31
|
-
spec.add_dependency "
|
|
32
|
-
spec.add_dependency "relaton-
|
|
30
|
+
spec.add_dependency "openssl", "~> 3.3.2" # 3.3.0 raised an error on Ruby 3.4.7
|
|
31
|
+
spec.add_dependency "pubid-iso", "~> 1.15.0"
|
|
32
|
+
spec.add_dependency "relaton-bib", "~> 2.0.0-alpha.4"
|
|
33
|
+
spec.add_dependency "relaton-core", "~> 0.0.9"
|
|
33
34
|
spec.add_dependency "relaton-index", "~> 0.2.12"
|
|
34
35
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-iso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.0.pre.alpha.
|
|
4
|
+
version: 2.0.0.pre.alpha.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: isoics
|
|
@@ -24,48 +23,62 @@ dependencies:
|
|
|
24
23
|
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: 0.1.6
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: openssl
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: 3.3.2
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 3.3.2
|
|
27
40
|
- !ruby/object:Gem::Dependency
|
|
28
41
|
name: pubid-iso
|
|
29
42
|
requirement: !ruby/object:Gem::Requirement
|
|
30
43
|
requirements:
|
|
31
44
|
- - "~>"
|
|
32
45
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
46
|
+
version: 1.15.0
|
|
34
47
|
type: :runtime
|
|
35
48
|
prerelease: false
|
|
36
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
50
|
requirements:
|
|
38
51
|
- - "~>"
|
|
39
52
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
53
|
+
version: 1.15.0
|
|
41
54
|
- !ruby/object:Gem::Dependency
|
|
42
55
|
name: relaton-bib
|
|
43
56
|
requirement: !ruby/object:Gem::Requirement
|
|
44
57
|
requirements:
|
|
45
58
|
- - "~>"
|
|
46
59
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 2.0.0.pre.alpha.
|
|
60
|
+
version: 2.0.0.pre.alpha.4
|
|
48
61
|
type: :runtime
|
|
49
62
|
prerelease: false
|
|
50
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
64
|
requirements:
|
|
52
65
|
- - "~>"
|
|
53
66
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 2.0.0.pre.alpha.
|
|
67
|
+
version: 2.0.0.pre.alpha.4
|
|
55
68
|
- !ruby/object:Gem::Dependency
|
|
56
69
|
name: relaton-core
|
|
57
70
|
requirement: !ruby/object:Gem::Requirement
|
|
58
71
|
requirements:
|
|
59
72
|
- - "~>"
|
|
60
73
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0.0.
|
|
74
|
+
version: 0.0.9
|
|
62
75
|
type: :runtime
|
|
63
76
|
prerelease: false
|
|
64
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
78
|
requirements:
|
|
66
79
|
- - "~>"
|
|
67
80
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0.0.
|
|
81
|
+
version: 0.0.9
|
|
69
82
|
- !ruby/object:Gem::Dependency
|
|
70
83
|
name: relaton-index
|
|
71
84
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -121,7 +134,6 @@ files:
|
|
|
121
134
|
- lib/relaton/iso/model/docidentifier.rb
|
|
122
135
|
- lib/relaton/iso/model/doctype.rb
|
|
123
136
|
- lib/relaton/iso/model/ext.rb
|
|
124
|
-
- lib/relaton/iso/model/iso_project_group.rb
|
|
125
137
|
- lib/relaton/iso/model/item.rb
|
|
126
138
|
- lib/relaton/iso/model/item_base.rb
|
|
127
139
|
- lib/relaton/iso/model/organization.rb
|
|
@@ -139,7 +151,6 @@ homepage: https://github.com/relaton/relaton-iso
|
|
|
139
151
|
licenses:
|
|
140
152
|
- BSD-2-Clause
|
|
141
153
|
metadata: {}
|
|
142
|
-
post_install_message:
|
|
143
154
|
rdoc_options: []
|
|
144
155
|
require_paths:
|
|
145
156
|
- lib
|
|
@@ -147,15 +158,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
147
158
|
requirements:
|
|
148
159
|
- - ">="
|
|
149
160
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: 3.
|
|
161
|
+
version: 3.2.0
|
|
151
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
163
|
requirements:
|
|
153
164
|
- - ">="
|
|
154
165
|
- !ruby/object:Gem::Version
|
|
155
166
|
version: '0'
|
|
156
167
|
requirements: []
|
|
157
|
-
rubygems_version: 3.
|
|
158
|
-
signing_key:
|
|
168
|
+
rubygems_version: 3.6.9
|
|
159
169
|
specification_version: 4
|
|
160
170
|
summary: 'Relaton::Iso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem
|
|
161
171
|
model'
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module Relaton
|
|
2
|
-
module Iso
|
|
3
|
-
class ISOProjectGroup < Lutaml::Model::Serializable
|
|
4
|
-
attribute :agency, :string, collection: true
|
|
5
|
-
attribute :technical_committee, Bib::WorkGroup, collection: true
|
|
6
|
-
attribute :subcommittee, Bib::WorkGroup, collection: true
|
|
7
|
-
attribute :workgroup, Bib::WorkGroup, collection: true
|
|
8
|
-
attribute :secretariat, :string
|
|
9
|
-
|
|
10
|
-
xml do
|
|
11
|
-
root "editorialgroup"
|
|
12
|
-
|
|
13
|
-
map_element "agency", to: :agency
|
|
14
|
-
map_element "technical-committee", to: :technical_committee
|
|
15
|
-
map_element "subcommittee", to: :subcommittee
|
|
16
|
-
map_element "workgroup", to: :workgroup
|
|
17
|
-
map_element "secretariat", to: :secretariat
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|