relaton-iec 1.11.3 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -24
- data/grammars/biblio.rng +142 -44
- data/grammars/iec.rng +1 -0
- data/grammars/isodoc.rng +103 -0
- data/grammars/isostandard.rng +32 -12
- data/lib/relaton_iec/hit_collection.rb +28 -13
- data/lib/relaton_iec/iec_bibliography.rb +30 -20
- data/lib/relaton_iec/scrapper.rb +5 -3
- data/lib/relaton_iec/version.rb +1 -1
- data/relaton_iec.gemspec +1 -1
- metadata +4 -5
- data/lib/data/61360-4_DB.yaml +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: acd143216a12370fdd9471a6159cee9f2636a8062e17997aaf1f7f4da074f188
|
4
|
+
data.tar.gz: 1ecf0b68f27d2bb1eceb7b476b7f168509c16238bbb2a2fed36869dffd5cb433
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d906a6c6ff0782d7e4c9b44130ba7676ad1faba5dd992d1efc7af05dfe9f776a491be6e6969c6ae92c3916ea0dbe3ce17b608dfc37ee976f1e56a42778f4e9f4
|
7
|
+
data.tar.gz: 86c1b9b11e37943ed291385b6cfd9af467575ff1aa95f409186f364593aa6e029f6c6084fad6fd206ddce7938578a25b6b613ea2349ad345b6d5b081678543ca
|
data/.github/workflows/rake.yml
CHANGED
@@ -10,27 +10,4 @@ on:
|
|
10
10
|
|
11
11
|
jobs:
|
12
12
|
rake:
|
13
|
-
|
14
|
-
runs-on: ${{ matrix.os }}
|
15
|
-
continue-on-error: ${{ matrix.experimental }}
|
16
|
-
strategy:
|
17
|
-
fail-fast: false
|
18
|
-
matrix:
|
19
|
-
ruby: [ '3.0', '2.7', '2.6', '2.5' ]
|
20
|
-
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
|
-
experimental: [ false ]
|
22
|
-
steps:
|
23
|
-
- uses: actions/checkout@v2
|
24
|
-
with:
|
25
|
-
submodules: true
|
26
|
-
|
27
|
-
# https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
|
28
|
-
- if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
|
29
|
-
run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
|
30
|
-
|
31
|
-
- uses: ruby/setup-ruby@v1
|
32
|
-
with:
|
33
|
-
ruby-version: ${{ matrix.ruby }}
|
34
|
-
bundler-cache: true
|
35
|
-
|
36
|
-
- run: bundle exec rake
|
13
|
+
uses: relaton/support/.github/workflows/rake.yml@master
|
data/grammars/biblio.rng
CHANGED
@@ -225,9 +225,9 @@
|
|
225
225
|
<zeroOrMore>
|
226
226
|
<ref name="forename"/>
|
227
227
|
</zeroOrMore>
|
228
|
-
<
|
229
|
-
<ref name="
|
230
|
-
</
|
228
|
+
<optional>
|
229
|
+
<ref name="formatted-initials"/>
|
230
|
+
</optional>
|
231
231
|
<ref name="surname"/>
|
232
232
|
<zeroOrMore>
|
233
233
|
<ref name="addition"/>
|
@@ -247,8 +247,8 @@
|
|
247
247
|
<ref name="LocalizedString"/>
|
248
248
|
</element>
|
249
249
|
</define>
|
250
|
-
<define name="
|
251
|
-
<element name="
|
250
|
+
<define name="formatted-initials">
|
251
|
+
<element name="formatted-initials">
|
252
252
|
<ref name="LocalizedString"/>
|
253
253
|
</element>
|
254
254
|
</define>
|
@@ -264,6 +264,9 @@
|
|
264
264
|
</define>
|
265
265
|
<define name="forename">
|
266
266
|
<element name="forename">
|
267
|
+
<optional>
|
268
|
+
<attribute name="initial"/>
|
269
|
+
</optional>
|
267
270
|
<ref name="LocalizedString"/>
|
268
271
|
</element>
|
269
272
|
</define>
|
@@ -614,12 +617,103 @@
|
|
614
617
|
<optional>
|
615
618
|
<ref name="fetched"/>
|
616
619
|
</optional>
|
617
|
-
<
|
618
|
-
<oneOrMore>
|
619
|
-
<ref name="btitle"/>
|
620
|
-
</oneOrMore>
|
620
|
+
<optional>
|
621
621
|
<ref name="formattedref"/>
|
622
|
-
</
|
622
|
+
</optional>
|
623
|
+
<oneOrMore>
|
624
|
+
<ref name="btitle"/>
|
625
|
+
</oneOrMore>
|
626
|
+
<zeroOrMore>
|
627
|
+
<ref name="bsource"/>
|
628
|
+
</zeroOrMore>
|
629
|
+
<oneOrMore>
|
630
|
+
<ref name="docidentifier"/>
|
631
|
+
</oneOrMore>
|
632
|
+
<optional>
|
633
|
+
<ref name="docnumber"/>
|
634
|
+
</optional>
|
635
|
+
<zeroOrMore>
|
636
|
+
<ref name="bdate"/>
|
637
|
+
</zeroOrMore>
|
638
|
+
<zeroOrMore>
|
639
|
+
<ref name="contributor"/>
|
640
|
+
</zeroOrMore>
|
641
|
+
<optional>
|
642
|
+
<ref name="edition"/>
|
643
|
+
</optional>
|
644
|
+
<zeroOrMore>
|
645
|
+
<ref name="version"/>
|
646
|
+
</zeroOrMore>
|
647
|
+
<zeroOrMore>
|
648
|
+
<ref name="biblionote"/>
|
649
|
+
</zeroOrMore>
|
650
|
+
<zeroOrMore>
|
651
|
+
<ref name="language"/>
|
652
|
+
</zeroOrMore>
|
653
|
+
<zeroOrMore>
|
654
|
+
<ref name="script"/>
|
655
|
+
</zeroOrMore>
|
656
|
+
<zeroOrMore>
|
657
|
+
<ref name="bibabstract"/>
|
658
|
+
</zeroOrMore>
|
659
|
+
<optional>
|
660
|
+
<ref name="status"/>
|
661
|
+
</optional>
|
662
|
+
<zeroOrMore>
|
663
|
+
<ref name="copyright"/>
|
664
|
+
</zeroOrMore>
|
665
|
+
<zeroOrMore>
|
666
|
+
<ref name="docrelation"/>
|
667
|
+
</zeroOrMore>
|
668
|
+
<zeroOrMore>
|
669
|
+
<ref name="series"/>
|
670
|
+
</zeroOrMore>
|
671
|
+
<optional>
|
672
|
+
<ref name="medium"/>
|
673
|
+
</optional>
|
674
|
+
<zeroOrMore>
|
675
|
+
<ref name="bplace"/>
|
676
|
+
</zeroOrMore>
|
677
|
+
<zeroOrMore>
|
678
|
+
<ref name="bprice"/>
|
679
|
+
</zeroOrMore>
|
680
|
+
<zeroOrMore>
|
681
|
+
<ref name="extent"/>
|
682
|
+
</zeroOrMore>
|
683
|
+
<optional>
|
684
|
+
<ref name="bibliographic_size"/>
|
685
|
+
</optional>
|
686
|
+
<zeroOrMore>
|
687
|
+
<ref name="accesslocation"/>
|
688
|
+
</zeroOrMore>
|
689
|
+
<zeroOrMore>
|
690
|
+
<ref name="license"/>
|
691
|
+
</zeroOrMore>
|
692
|
+
<zeroOrMore>
|
693
|
+
<ref name="bclassification"/>
|
694
|
+
</zeroOrMore>
|
695
|
+
<zeroOrMore>
|
696
|
+
<ref name="bkeyword"/>
|
697
|
+
</zeroOrMore>
|
698
|
+
<optional>
|
699
|
+
<ref name="validity"/>
|
700
|
+
</optional>
|
701
|
+
</define>
|
702
|
+
<define name="ReducedBibliographicItem">
|
703
|
+
<optional>
|
704
|
+
<attribute name="type">
|
705
|
+
<ref name="BibItemType"/>
|
706
|
+
</attribute>
|
707
|
+
</optional>
|
708
|
+
<optional>
|
709
|
+
<ref name="fetched"/>
|
710
|
+
</optional>
|
711
|
+
<optional>
|
712
|
+
<ref name="formattedref"/>
|
713
|
+
</optional>
|
714
|
+
<zeroOrMore>
|
715
|
+
<ref name="btitle"/>
|
716
|
+
</zeroOrMore>
|
623
717
|
<zeroOrMore>
|
624
718
|
<ref name="bsource"/>
|
625
719
|
</zeroOrMore>
|
@@ -638,9 +732,9 @@
|
|
638
732
|
<optional>
|
639
733
|
<ref name="edition"/>
|
640
734
|
</optional>
|
641
|
-
<
|
735
|
+
<zeroOrMore>
|
642
736
|
<ref name="version"/>
|
643
|
-
</
|
737
|
+
</zeroOrMore>
|
644
738
|
<zeroOrMore>
|
645
739
|
<ref name="biblionote"/>
|
646
740
|
</zeroOrMore>
|
@@ -833,6 +927,12 @@
|
|
833
927
|
<data type="boolean"/>
|
834
928
|
</attribute>
|
835
929
|
</optional>
|
930
|
+
<optional>
|
931
|
+
<attribute name="language"/>
|
932
|
+
</optional>
|
933
|
+
<optional>
|
934
|
+
<attribute name="script"/>
|
935
|
+
</optional>
|
836
936
|
<text/>
|
837
937
|
</element>
|
838
938
|
</define>
|
@@ -986,36 +1086,34 @@
|
|
986
1086
|
<ref name="SeriesType"/>
|
987
1087
|
</attribute>
|
988
1088
|
</optional>
|
989
|
-
<
|
1089
|
+
<optional>
|
990
1090
|
<ref name="formattedref"/>
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
</group>
|
1018
|
-
</choice>
|
1091
|
+
</optional>
|
1092
|
+
<ref name="btitle"/>
|
1093
|
+
<optional>
|
1094
|
+
<ref name="bplace"/>
|
1095
|
+
</optional>
|
1096
|
+
<optional>
|
1097
|
+
<ref name="seriesorganization"/>
|
1098
|
+
</optional>
|
1099
|
+
<optional>
|
1100
|
+
<ref name="abbreviation"/>
|
1101
|
+
</optional>
|
1102
|
+
<optional>
|
1103
|
+
<ref name="seriesfrom"/>
|
1104
|
+
</optional>
|
1105
|
+
<optional>
|
1106
|
+
<ref name="seriesto"/>
|
1107
|
+
</optional>
|
1108
|
+
<optional>
|
1109
|
+
<ref name="seriesnumber"/>
|
1110
|
+
</optional>
|
1111
|
+
<optional>
|
1112
|
+
<ref name="seriespartnumber"/>
|
1113
|
+
</optional>
|
1114
|
+
<optional>
|
1115
|
+
<ref name="seriesrun"/>
|
1116
|
+
</optional>
|
1019
1117
|
</element>
|
1020
1118
|
</define>
|
1021
1119
|
<define name="SeriesType">
|
@@ -1174,7 +1272,7 @@
|
|
1174
1272
|
</element>
|
1175
1273
|
</optional>
|
1176
1274
|
<element name="bibitem">
|
1177
|
-
<ref name="
|
1275
|
+
<ref name="ReducedBibliographicItem"/>
|
1178
1276
|
</element>
|
1179
1277
|
<choice>
|
1180
1278
|
<zeroOrMore>
|
@@ -1199,9 +1297,9 @@
|
|
1199
1297
|
<optional>
|
1200
1298
|
<ref name="revision-date"/>
|
1201
1299
|
</optional>
|
1202
|
-
<
|
1300
|
+
<optional>
|
1203
1301
|
<ref name="draft"/>
|
1204
|
-
</
|
1302
|
+
</optional>
|
1205
1303
|
</element>
|
1206
1304
|
</define>
|
1207
1305
|
<define name="vedition">
|
data/grammars/iec.rng
CHANGED
data/grammars/isodoc.rng
CHANGED
@@ -32,6 +32,54 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="admonition">
|
36
|
+
<element name="admonition">
|
37
|
+
<attribute name="type">
|
38
|
+
<ref name="AdmonitionType"/>
|
39
|
+
</attribute>
|
40
|
+
<optional>
|
41
|
+
<attribute name="class"/>
|
42
|
+
</optional>
|
43
|
+
<attribute name="id">
|
44
|
+
<data type="ID"/>
|
45
|
+
</attribute>
|
46
|
+
<optional>
|
47
|
+
<attribute name="uri">
|
48
|
+
<data type="anyURI"/>
|
49
|
+
</attribute>
|
50
|
+
</optional>
|
51
|
+
<optional>
|
52
|
+
<attribute name="coverpage">
|
53
|
+
<data type="boolean"/>
|
54
|
+
</attribute>
|
55
|
+
</optional>
|
56
|
+
<optional>
|
57
|
+
<attribute name="notag">
|
58
|
+
<data type="boolean"/>
|
59
|
+
</attribute>
|
60
|
+
</optional>
|
61
|
+
<optional>
|
62
|
+
<ref name="tname"/>
|
63
|
+
</optional>
|
64
|
+
<zeroOrMore>
|
65
|
+
<ref name="paragraph-with-footnote"/>
|
66
|
+
</zeroOrMore>
|
67
|
+
<zeroOrMore>
|
68
|
+
<ref name="note"/>
|
69
|
+
</zeroOrMore>
|
70
|
+
</element>
|
71
|
+
</define>
|
72
|
+
<define name="AdmonitionType">
|
73
|
+
<choice>
|
74
|
+
<value>warning</value>
|
75
|
+
<value>note</value>
|
76
|
+
<value>tip</value>
|
77
|
+
<value>important</value>
|
78
|
+
<value>caution</value>
|
79
|
+
<value>statement</value>
|
80
|
+
<value>editorial</value>
|
81
|
+
</choice>
|
82
|
+
</define>
|
35
83
|
<define name="index">
|
36
84
|
<element name="index">
|
37
85
|
<optional>
|
@@ -79,6 +127,11 @@
|
|
79
127
|
<data type="boolean"/>
|
80
128
|
</attribute>
|
81
129
|
</optional>
|
130
|
+
<optional>
|
131
|
+
<attribute name="suppress_identifier">
|
132
|
+
<data type="boolean"/>
|
133
|
+
</attribute>
|
134
|
+
</optional>
|
82
135
|
<ref name="BibliographicItem"/>
|
83
136
|
</element>
|
84
137
|
</define>
|
@@ -245,6 +298,9 @@
|
|
245
298
|
<ref name="MultilingualRenderingType"/>
|
246
299
|
</attribute>
|
247
300
|
</optional>
|
301
|
+
<optional>
|
302
|
+
<ref name="tname"/>
|
303
|
+
</optional>
|
248
304
|
<oneOrMore>
|
249
305
|
<ref name="ul_li"/>
|
250
306
|
</oneOrMore>
|
@@ -287,6 +343,9 @@
|
|
287
343
|
</choice>
|
288
344
|
</attribute>
|
289
345
|
</optional>
|
346
|
+
<optional>
|
347
|
+
<ref name="tname"/>
|
348
|
+
</optional>
|
290
349
|
<oneOrMore>
|
291
350
|
<ref name="li"/>
|
292
351
|
</oneOrMore>
|
@@ -323,6 +382,9 @@
|
|
323
382
|
<ref name="MultilingualRenderingType"/>
|
324
383
|
</attribute>
|
325
384
|
</optional>
|
385
|
+
<optional>
|
386
|
+
<ref name="tname"/>
|
387
|
+
</optional>
|
326
388
|
<oneOrMore>
|
327
389
|
<ref name="dt"/>
|
328
390
|
<ref name="dd"/>
|
@@ -657,6 +719,9 @@
|
|
657
719
|
<optional>
|
658
720
|
<attribute name="tag"/>
|
659
721
|
</optional>
|
722
|
+
<optional>
|
723
|
+
<attribute name="type"/>
|
724
|
+
</optional>
|
660
725
|
<optional>
|
661
726
|
<attribute name="multilingual-rendering">
|
662
727
|
<ref name="MultilingualRenderingType"/>
|
@@ -692,6 +757,9 @@
|
|
692
757
|
<optional>
|
693
758
|
<attribute name="tag"/>
|
694
759
|
</optional>
|
760
|
+
<optional>
|
761
|
+
<attribute name="type"/>
|
762
|
+
</optional>
|
695
763
|
<optional>
|
696
764
|
<attribute name="multilingual-rendering">
|
697
765
|
<ref name="MultilingualRenderingType"/>
|
@@ -851,6 +919,16 @@
|
|
851
919
|
<ref name="MultilingualRenderingType"/>
|
852
920
|
</attribute>
|
853
921
|
</optional>
|
922
|
+
<optional>
|
923
|
+
<attribute name="coverpage">
|
924
|
+
<data type="boolean"/>
|
925
|
+
</attribute>
|
926
|
+
</optional>
|
927
|
+
<optional>
|
928
|
+
<attribute name="notag">
|
929
|
+
<data type="boolean"/>
|
930
|
+
</attribute>
|
931
|
+
</optional>
|
854
932
|
<oneOrMore>
|
855
933
|
<choice>
|
856
934
|
<ref name="paragraph"/>
|
@@ -1178,6 +1256,7 @@
|
|
1178
1256
|
<ref name="concept"/>
|
1179
1257
|
<ref name="add"/>
|
1180
1258
|
<ref name="del"/>
|
1259
|
+
<ref name="span"/>
|
1181
1260
|
</choice>
|
1182
1261
|
</define>
|
1183
1262
|
<define name="add">
|
@@ -1204,6 +1283,19 @@
|
|
1204
1283
|
</choice>
|
1205
1284
|
</element>
|
1206
1285
|
</define>
|
1286
|
+
<define name="span">
|
1287
|
+
<element name="span">
|
1288
|
+
<optional>
|
1289
|
+
<attribute name="class"/>
|
1290
|
+
</optional>
|
1291
|
+
<optional>
|
1292
|
+
<attribute name="style"/>
|
1293
|
+
</optional>
|
1294
|
+
<oneOrMore>
|
1295
|
+
<ref name="TextElement"/>
|
1296
|
+
</oneOrMore>
|
1297
|
+
</element>
|
1298
|
+
</define>
|
1207
1299
|
<define name="concept">
|
1208
1300
|
<element name="concept">
|
1209
1301
|
<optional>
|
@@ -1994,6 +2086,7 @@
|
|
1994
2086
|
<value>compare</value>
|
1995
2087
|
<value>contrast</value>
|
1996
2088
|
<value>see</value>
|
2089
|
+
<value>seealso</value>
|
1997
2090
|
</choice>
|
1998
2091
|
</define>
|
1999
2092
|
<define name="deprecates">
|
@@ -2416,6 +2509,16 @@
|
|
2416
2509
|
<text/>
|
2417
2510
|
</element>
|
2418
2511
|
</optional>
|
2512
|
+
<optional>
|
2513
|
+
<element name="amendment">
|
2514
|
+
<text/>
|
2515
|
+
</element>
|
2516
|
+
</optional>
|
2517
|
+
<optional>
|
2518
|
+
<element name="corrigendum">
|
2519
|
+
<text/>
|
2520
|
+
</element>
|
2521
|
+
</optional>
|
2419
2522
|
<optional>
|
2420
2523
|
<element name="language">
|
2421
2524
|
<text/>
|
data/grammars/isostandard.rng
CHANGED
@@ -45,6 +45,9 @@
|
|
45
45
|
<ref name="horizontal"/>
|
46
46
|
</optional>
|
47
47
|
<ref name="editorialgroup"/>
|
48
|
+
<optional>
|
49
|
+
<ref name="approvalgroup"/>
|
50
|
+
</optional>
|
48
51
|
<zeroOrMore>
|
49
52
|
<ref name="ics"/>
|
50
53
|
</zeroOrMore>
|
@@ -249,6 +252,7 @@
|
|
249
252
|
<value>warning</value>
|
250
253
|
<value>important</value>
|
251
254
|
<value>safety precautions</value>
|
255
|
+
<value>editorial</value>
|
252
256
|
</choice>
|
253
257
|
</define>
|
254
258
|
<define name="preface">
|
@@ -308,18 +312,7 @@
|
|
308
312
|
</define>
|
309
313
|
<define name="editorialgroup">
|
310
314
|
<element name="editorialgroup">
|
311
|
-
<
|
312
|
-
<ref name="technical-committee"/>
|
313
|
-
</oneOrMore>
|
314
|
-
<zeroOrMore>
|
315
|
-
<ref name="subcommittee"/>
|
316
|
-
</zeroOrMore>
|
317
|
-
<zeroOrMore>
|
318
|
-
<ref name="workgroup"/>
|
319
|
-
</zeroOrMore>
|
320
|
-
<optional>
|
321
|
-
<ref name="secretariat"/>
|
322
|
-
</optional>
|
315
|
+
<ref name="ISOProjectGroup"/>
|
323
316
|
</element>
|
324
317
|
</define>
|
325
318
|
<define name="Content-Section">
|
@@ -367,6 +360,33 @@
|
|
367
360
|
</define>
|
368
361
|
</include>
|
369
362
|
<!-- end overrides -->
|
363
|
+
<define name="ISOProjectGroup">
|
364
|
+
<zeroOrMore>
|
365
|
+
<ref name="agency"/>
|
366
|
+
</zeroOrMore>
|
367
|
+
<oneOrMore>
|
368
|
+
<ref name="technical-committee"/>
|
369
|
+
</oneOrMore>
|
370
|
+
<zeroOrMore>
|
371
|
+
<ref name="subcommittee"/>
|
372
|
+
</zeroOrMore>
|
373
|
+
<zeroOrMore>
|
374
|
+
<ref name="workgroup"/>
|
375
|
+
</zeroOrMore>
|
376
|
+
<optional>
|
377
|
+
<ref name="secretariat"/>
|
378
|
+
</optional>
|
379
|
+
</define>
|
380
|
+
<define name="approvalgroup">
|
381
|
+
<element name="approvalgroup">
|
382
|
+
<ref name="ISOProjectGroup"/>
|
383
|
+
</element>
|
384
|
+
</define>
|
385
|
+
<define name="agency">
|
386
|
+
<element name="agency">
|
387
|
+
<text/>
|
388
|
+
</element>
|
389
|
+
</define>
|
370
390
|
<!--
|
371
391
|
We display the Normative References between scope and terms; but to keep the
|
372
392
|
grammar simple, we keep the references together
|
@@ -32,6 +32,7 @@ module RelatonIec
|
|
32
32
|
parts.reject { |h| h.hit[:code] == hit.hit[:code] }.each do |hi|
|
33
33
|
isobib = RelatonIec::IecBibliographicItem.new(
|
34
34
|
formattedref: RelatonBib::FormattedRef.new(content: hi.hit[:code]),
|
35
|
+
docid: [RelatonBib::DocumentIdentifier.new(id: hi.hit[:code], type: "IEC", primary: true)],
|
35
36
|
)
|
36
37
|
all_parts_item.relation << RelatonBib::DocumentRelation.new(type: "partOf", bibitem: isobib)
|
37
38
|
end
|
@@ -44,20 +45,34 @@ module RelatonIec
|
|
44
45
|
# @param year [String, nil]
|
45
46
|
# @return [Array<RelatonIec::Hit>]
|
46
47
|
def hits(ref, year) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
if /61360-4\sDB|ISO[\s\/]IEC\sDIR/.match?(ref)
|
49
|
+
fetch_from_gh ref
|
50
|
+
else
|
51
|
+
from, to = nil
|
52
|
+
if year
|
53
|
+
from = Date.strptime year, "%Y"
|
54
|
+
to = from.next_year.prev_day
|
55
|
+
end
|
56
|
+
get_results ref, from, to
|
54
57
|
end
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
# file = "../data/#{ref.sub(/^IEC\s/, '').gsub(/[\s\/]/, '_').upcase}.yaml"
|
59
|
+
# path = File.expand_path file, __dir__
|
60
|
+
# if File.exist? path
|
61
|
+
# hash = YAML.safe_load File.read(path, encoding: "utf-8")
|
62
|
+
# hit = Hit.new({ code: ref }, self)
|
63
|
+
# hit.fetch = IecBibliographicItem.from_hash hash
|
64
|
+
# return [hit]
|
65
|
+
# end
|
66
|
+
end
|
67
|
+
|
68
|
+
def fetch_from_gh(ref)
|
69
|
+
file = ref.sub(/^IEC\s/, "").gsub(/[\s\/]/, "_").upcase
|
70
|
+
url = "https://raw.githubusercontent.com/relaton/relaton-data-iec/main/data/#{file}.yaml"
|
71
|
+
resp = Net::HTTP.get URI(url)
|
72
|
+
hash = YAML.safe_load resp
|
73
|
+
hit = Hit.new({ code: ref }, self)
|
74
|
+
hit.fetch = IecBibliographicItem.from_hash hash
|
75
|
+
[hit]
|
61
76
|
end
|
62
77
|
|
63
78
|
# @param ref [String]
|
@@ -90,33 +90,43 @@ module RelatonIec
|
|
90
90
|
# @param year [String, nil]
|
91
91
|
# @return [RelatonIec::HitCollection]
|
92
92
|
def search_filter(ref, year) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
(?<bundle>\+[^\s/]+)?
|
97
|
-
(?:/(?<corr>AMD\s\d+))?
|
98
|
-
}x =~ ref.upcase
|
99
|
-
year ||= year1
|
100
|
-
corr&.sub! " ", ""
|
93
|
+
rp1 = ref_parts ref.upcase
|
94
|
+
year ||= rp1[:year]
|
95
|
+
corr = rp1[:corr]&.sub " ", ""
|
101
96
|
warn "[relaton-iec] (\"#{ref}\") fetching..."
|
102
|
-
result = search(code, year)
|
103
|
-
|
97
|
+
result = search(rp1[:code], year)
|
98
|
+
code = result.text.dup
|
99
|
+
if result.empty? && /(?<=\d-)(?<part>[\w-]+)/ =~ rp1[:code]
|
104
100
|
# try to search packaged standard
|
105
|
-
result = search code, year, part
|
101
|
+
result = search rp1[:code], year, part
|
102
|
+
pkg_std = result.any?
|
103
|
+
end
|
104
|
+
result = search rp1[:code] if result.empty?
|
105
|
+
if pkg_std
|
106
|
+
code.sub!(/(?<=\d-)#{part}/, part[0])
|
107
|
+
else
|
108
|
+
code.sub!(/-[-\d]+/, "")
|
106
109
|
end
|
107
|
-
result = search code if result.empty?
|
108
|
-
code = result.text.dup
|
109
|
-
code&.sub!(/(?:-\w+)+(?:\s[A-Z]+)?/, "")
|
110
110
|
result.select do |i|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
111
|
+
rp2 = ref_parts i.hit[:code]
|
112
|
+
code2 = if pkg_std
|
113
|
+
rp2[:code].sub(/(?<=\d-\d)\d+/, "")
|
114
|
+
else
|
115
|
+
rp2[:code].sub(/-[-\d]+/, "")
|
116
|
+
end
|
117
|
+
code == code2 && rp1[:bundle] == rp2[:bundle] && corr == rp2[:corr]
|
117
118
|
end
|
118
119
|
end
|
119
120
|
|
121
|
+
def ref_parts(ref)
|
122
|
+
%r{
|
123
|
+
^(?<code>[^\d]+(?:\d+(?:-\w+)*)?(?:\s?[A-Z]+)?(?:\sSUP)?)
|
124
|
+
(?::(?<year>\d{4}))?
|
125
|
+
(?<bundle>\+[^\s/]+)?
|
126
|
+
(?:/(?<corr>AMD\s?\d+))?
|
127
|
+
}x.match ref
|
128
|
+
end
|
129
|
+
|
120
130
|
def iev(code = "IEC 60050")
|
121
131
|
RelatonIsoBib::XMLParser.from_xml(<<~"XML")
|
122
132
|
<bibitem>
|
data/lib/relaton_iec/scrapper.rb
CHANGED
@@ -195,10 +195,12 @@ module RelatonIec
|
|
195
195
|
when "withdrawn" then "obsoletes"
|
196
196
|
else r_type
|
197
197
|
end
|
198
|
-
|
199
|
-
|
198
|
+
ref = r.at("FULL_NAME").text
|
199
|
+
fref = RelatonBib::FormattedRef.new content: ref, format: "text/plain"
|
200
|
+
bibitem = IecBibliographicItem.new(
|
201
|
+
formattedref: fref,
|
202
|
+
docid: [RelatonBib::DocumentIdentifier.new(id: ref, type: "IEC", primary: true)],
|
200
203
|
)
|
201
|
-
bibitem = IecBibliographicItem.new(formattedref: fref)
|
202
204
|
{ type: type, bibitem: bibitem }
|
203
205
|
end
|
204
206
|
end
|
data/lib/relaton_iec/version.rb
CHANGED
data/relaton_iec.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.13.0
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
152
|
+
version: 1.13.0
|
153
153
|
description: 'RelatonIec: retrieve IEC Standards for bibliographic use using the IecBibliographicItem
|
154
154
|
model'
|
155
155
|
email:
|
@@ -175,7 +175,6 @@ files:
|
|
175
175
|
- grammars/isodoc.rng
|
176
176
|
- grammars/isostandard.rng
|
177
177
|
- grammars/reqt.rng
|
178
|
-
- lib/data/61360-4_DB.yaml
|
179
178
|
- lib/relaton_iec.rb
|
180
179
|
- lib/relaton_iec/basic_block/alignment.rb
|
181
180
|
- lib/relaton_iec/basic_block/basic_block.rb
|
data/lib/data/61360-4_DB.yaml
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
id: IEC61360-4DB
|
2
|
-
title:
|
3
|
-
- type: title-intro
|
4
|
-
content: IEC/SC 3D
|
5
|
-
langage:
|
6
|
-
- en
|
7
|
-
script:
|
8
|
-
- Latn
|
9
|
-
format: text/plain
|
10
|
-
- type: title-main
|
11
|
-
content: Common Data Dictionary (CDD - V2.0015.0001)
|
12
|
-
langage:
|
13
|
-
- en
|
14
|
-
script:
|
15
|
-
- Latn
|
16
|
-
format: text/plain
|
17
|
-
- type: main
|
18
|
-
content: IEC/SC 3D - Common Data Dictionary (CDD - V2.0015.0001)
|
19
|
-
langage:
|
20
|
-
- en
|
21
|
-
script:
|
22
|
-
- Latn
|
23
|
-
format: text/plain
|
24
|
-
link:
|
25
|
-
- content: https://cdd.iec.ch
|
26
|
-
type: src
|
27
|
-
type: standard
|
28
|
-
docid:
|
29
|
-
- id: IEC 61360-4 DB
|
30
|
-
type: IEC
|
31
|
-
primary: true
|
32
|
-
contributor:
|
33
|
-
- organization:
|
34
|
-
name:
|
35
|
-
- International Electrotechnical Commission
|
36
|
-
abbreviation: IEC
|
37
|
-
url: www.iec.ch
|
38
|
-
role:
|
39
|
-
- publisher
|
40
|
-
edition: V2.0015.0001
|
41
|
-
language:
|
42
|
-
- en
|
43
|
-
script:
|
44
|
-
- Latn
|
45
|
-
abstract:
|
46
|
-
- content: |
|
47
|
-
Business processes in all domains and especially in electric/ electronic industries are increasingly being conducted electronically;
|
48
|
-
a situation which applies to internal processes as well as to the interaction with external partners.
|
49
|
-
To support the necessary information transfer the use of common concepts based on information/classification models is inevitable.
|
50
|
-
|
51
|
-
Concepts specified on a global basis support error-free information sharing. In addition, the dictionaries of concepts may be used as
|
52
|
-
reference collections for setting up master data repositories for product data that serve as company internal information backbones.
|
53
|
-
Thus, costly interpretation and conversion errors may be minimized.
|
54
|
-
|
55
|
-
From the market side, pressure is increasingly being exerted to supply product data in electronic form using commonly agreed concepts
|
56
|
-
and as this pressure grows, it will have a considerable impact on all business processes. For this reason, a seamless exchange of
|
57
|
-
product data, i.e., an exchange that is free from media discontinuities requires a unified, joint approach both for exchanging product
|
58
|
-
data internally within a company or for exchanging product data with suppliers or customers.
|
59
|
-
language:
|
60
|
-
- en
|
61
|
-
script:
|
62
|
-
- Latn
|
63
|
-
format: text/plain
|