relaton 1.6.pre1 → 1.7.3
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/docs/README.adoc +88 -1
- data/globalcache/iec/iec_60050_102_2007.xml +58 -0
- data/globalcache/iec/version +1 -0
- data/lib/relaton/config.rb +1 -1
- data/lib/relaton/db.rb +77 -17
- data/lib/relaton/db_cache.rb +14 -5
- data/lib/relaton/registry.rb +1 -1
- data/lib/relaton/version.rb +1 -1
- data/localcache/iec/iec_60050_102_2007.xml +58 -0
- data/localcache/iec/version +1 -0
- data/relaton.gemspec +15 -14
- data/spec/relaton/db_cache_spec.rb +26 -1
- data/spec/relaton/regirtry_spec.rb +7 -3
- data/spec/relaton_spec.rb +105 -5
- data/spec/vcr_cassetes/19133_2005.yml +17 -17
- data/spec/vcr_cassetes/cc_dir_10005_2019.yml +8 -8
- data/spec/vcr_cassetes/ecma_6.yml +92 -0
- data/spec/vcr_cassetes/fisp_140.yml +6 -6
- data/spec/vcr_cassetes/gb_t_20223_2006.yml +13 -9
- data/spec/vcr_cassetes/hist_cmbined_included.yml +105 -0
- data/spec/vcr_cassetes/iec_60050_102_2007.yml +281 -0
- data/spec/vcr_cassetes/iec_combined_included.yml +945 -0
- data/spec/vcr_cassetes/ieee_528_2019.yml +15 -15
- data/spec/vcr_cassetes/iho_b_11.yml +11 -11
- data/spec/vcr_cassetes/iso_111111119115_1.yml +4 -4
- data/spec/vcr_cassetes/iso_19115.yml +17 -17
- data/spec/vcr_cassetes/iso_19115_1.yml +16 -16
- data/spec/vcr_cassetes/iso_19115_1_2.yml +34 -34
- data/spec/vcr_cassetes/iso_awi_24229.yml +16 -16
- data/spec/vcr_cassetes/iso_combined_applied.yml +361 -0
- data/spec/vcr_cassetes/iso_combined_included.yml +361 -0
- data/spec/vcr_cassetes/itu_combined_included.yml +1296 -0
- data/spec/vcr_cassetes/ogc_19_025r1.yml +2207 -1905
- data/spec/vcr_cassetes/ogm_ami4ccm_1_0.yml +7 -7
- data/spec/vcr_cassetes/rfc_8341.yml +4 -4
- data/spec/vcr_cassetes/sp_800_38b.yml +6 -6
- data/spec/vcr_cassetes/un_rtade_cefact_2004_32.yml +33 -31
- data/spec/vcr_cassetes/w3c_json_ld11.yml +18 -12
- metadata +65 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f957d5a962fa3529fb21f4289ff4dc648029497ec3bf209e084b85c49a336531
|
4
|
+
data.tar.gz: 6e6ad879c1552c8396c8f365c4bdc9c088197424f695b68b0dbeec9cc272f1a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f87f3d11aae3e805fa2fe3d9875692c2004a7b7a51fc1235181f8a4a9b314cf0403e50a4134fb093edc0da2cdb42339a7fe4ee7024e25de92d7923bf5029ab35
|
7
|
+
data.tar.gz: 2684a909260936e26f9a2b987c667e61d24e96c01f326bc008deaf9358f1dc349f216c239932ee5780325057bfb192426173d1e226c031880743ff4ce0ad4d12
|
data/docs/README.adoc
CHANGED
@@ -62,6 +62,8 @@ e.g. `get("ISO 19115-1", "2014", all_parts: true)` is transformed into a referen
|
|
62
62
|
|
63
63
|
== Usage
|
64
64
|
|
65
|
+
=== Create DB
|
66
|
+
|
65
67
|
[source,ruby]
|
66
68
|
----
|
67
69
|
require "relaton"
|
@@ -93,7 +95,14 @@ db = Relaton::Db.new("globalcache", "localcache")
|
|
93
95
|
@local_db=#<Relaton::DbCache:0x007faabc8fa5c0 @dir="localcache", @ext="xml">,
|
94
96
|
@local_db_name="localcache",
|
95
97
|
...
|
98
|
+
----
|
99
|
+
|
100
|
+
=== Fetch documens
|
96
101
|
|
102
|
+
==== Fetch by references
|
103
|
+
|
104
|
+
[source,ruby]
|
105
|
+
----
|
97
106
|
x = db.fetch("IEEE 19011")
|
98
107
|
[relaton-ieee] ("IEEE 19011") fetching...
|
99
108
|
[relaton-ieee] WARNING: no match found online for IEEE 19011. The code must be exactly like it is on the standards website.
|
@@ -116,10 +125,85 @@ x = db.fetch("ISO 19115", nil, all_parts: true)
|
|
116
125
|
[relaton-iso] ("ISO 19115") found ISO 19115 (all parts)
|
117
126
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x007fb1d0ae8bf0
|
118
127
|
...
|
128
|
+
----
|
129
|
+
|
130
|
+
==== Fetch by URN
|
131
|
+
|
132
|
+
This functionality works only for IEC documents.
|
133
|
+
|
134
|
+
[source,ruby]
|
135
|
+
----
|
136
|
+
x = db.fetch "urn:iec:std:iec:60050-102:2007:::"
|
137
|
+
[relaton-iec] ("IEC 60050-102") fetching...
|
138
|
+
[relaton-iec] ("IEC 60050-102") found IEC 60050-102:2007
|
139
|
+
=> #<RelatonIec::IecBibliographicItem:0x007fbd6c3790e8
|
140
|
+
...
|
141
|
+
----
|
142
|
+
|
143
|
+
=== Fetch combined documents
|
144
|
+
|
145
|
+
This functionality works only for ISO, IEC, ITU, and NIST documents.
|
146
|
+
|
147
|
+
==== Fetch included documents
|
148
|
+
[source,ruby]
|
149
|
+
----
|
150
|
+
bib = db.fetch "ISO 19115-1 + Amd 1"
|
151
|
+
[relaton-iso] ("ISO 19115-1") fetching...
|
152
|
+
[relaton-iso] ("ISO 19115-1") found ISO 19115-1:2014
|
153
|
+
[relaton-iso] ("ISO 19115-1/Amd 1") fetching...
|
154
|
+
[relaton-iso] ("ISO 19115-1/Amd 1") found ISO 19115-1:2014/Amd 1:2018
|
155
|
+
=> #<RelatonIsoBib::IsoBibliographicItem:0x007f95a929a748
|
156
|
+
|
157
|
+
bib.docidentifier[0].id
|
158
|
+
=> "ISO 19115-1 + Amd 1"
|
159
|
+
|
160
|
+
bib.relation[0].type
|
161
|
+
=> "updates"
|
162
|
+
|
163
|
+
bib.relation[0].bibitem.docidentifier[0].id
|
164
|
+
=> "ISO 19115-1"
|
119
165
|
|
166
|
+
bib.relation[1].type
|
167
|
+
=> "derivedFrom"
|
168
|
+
|
169
|
+
bib.relation[1].bibitem.docidentifier[0].id
|
170
|
+
=> "ISO 19115-1/Amd 1:2018"
|
171
|
+
|
172
|
+
bib.docidentifier[0].id
|
173
|
+
=> "ISO 19115-1, Amd 1"
|
174
|
+
|
175
|
+
bib.relation[0].type
|
176
|
+
=> "updates"
|
177
|
+
|
178
|
+
bib.relation[0].bibitem.docidentifier[0].id
|
179
|
+
=> "ISO 19115-1"
|
180
|
+
|
181
|
+
bib.relation[1].type
|
182
|
+
=> "complements"
|
183
|
+
|
184
|
+
bib.relation[1].description
|
185
|
+
=> "amendment"
|
186
|
+
|
187
|
+
bib.relation[1].bibitem.docidentifier[0].id
|
188
|
+
=> "ISO 19115-1/Amd 1:2018"
|
189
|
+
----
|
190
|
+
|
191
|
+
==== Fetch applied documents
|
192
|
+
[source,ruby]
|
193
|
+
----
|
194
|
+
bib = db.fetch "ISO 19115-1, Amd 1"
|
195
|
+
----
|
196
|
+
|
197
|
+
=== Get document type
|
198
|
+
[source,ruby]
|
199
|
+
----
|
120
200
|
db.docid_type("CN(GB/T 1.1)")
|
121
201
|
=> ["Chinese Standard", "GB/T 1.1"]
|
202
|
+
----
|
122
203
|
|
204
|
+
=== Serializing
|
205
|
+
[source,ruby]
|
206
|
+
----
|
123
207
|
x.to_xml
|
124
208
|
=> "<bibitem id="ISO19115(allparts)" type="standard">
|
125
209
|
...
|
@@ -146,11 +230,14 @@ db.load_entry("ISO(ISO 19011)")
|
|
146
230
|
=> "<bibdata type="standard">
|
147
231
|
...
|
148
232
|
<?bibdata>"
|
233
|
+
----
|
149
234
|
|
235
|
+
=== Entry manipulation
|
236
|
+
[source,ruby]
|
237
|
+
----
|
150
238
|
db.save_entry("ISO(ISO 19011)", nil)
|
151
239
|
=> nil
|
152
240
|
|
153
241
|
db.load_entry("ISO(ISO 19011)")
|
154
242
|
=> nil
|
155
|
-
|
156
243
|
----
|
@@ -0,0 +1,58 @@
|
|
1
|
+
<bibdata type="standard">
|
2
|
+
<fetched>2021-02-03</fetched>
|
3
|
+
<title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
|
4
|
+
<title type="title-part" format="text/plain" language="en" script="Latn">Part 102: Mathematics -- General concepts and linear algebra</title>
|
5
|
+
<title type="main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV) - Part 102: Mathematics -- General concepts and linear algebra</title>
|
6
|
+
<uri type="src">https://webstore.iec.ch/publication/160</uri>
|
7
|
+
<uri type="obp">/preview/info_iec60050-102%7Bed1.0%7Db.pdf</uri>
|
8
|
+
<docidentifier type="IEC">IEC 60050-102:2007</docidentifier>
|
9
|
+
<docidentifier type="URN">urn:iec:std:iec:60050-102:2007:::en</docidentifier>
|
10
|
+
<date type="published">
|
11
|
+
<on>2007-08-27</on>
|
12
|
+
</date>
|
13
|
+
<contributor>
|
14
|
+
<role type="publisher"/>
|
15
|
+
<organization>
|
16
|
+
<name>International Electrotechnical Commission</name>
|
17
|
+
<abbreviation>IEC</abbreviation>
|
18
|
+
<uri>www.iec.ch</uri>
|
19
|
+
</organization>
|
20
|
+
</contributor>
|
21
|
+
<edition>1.0</edition>
|
22
|
+
<language>en</language>
|
23
|
+
<script>Latn</script>
|
24
|
+
<abstract format="text/plain" language="en" script="Latn">This part of IEC 60050 gives the general mathematical terminology used in the fields of electricity, electronics and telecommunications, together with basic concepts in linear algebra. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Another part will deal with functions.
|
25
|
+
It has the status of a horizontal standard in accordance with IEC Guide 108.</abstract>
|
26
|
+
<status>
|
27
|
+
<stage>60</stage>
|
28
|
+
<substage>60</substage>
|
29
|
+
</status>
|
30
|
+
<copyright>
|
31
|
+
<from>2007</from>
|
32
|
+
<owner>
|
33
|
+
<organization>
|
34
|
+
<name>International Electrotechnical Commission</name>
|
35
|
+
<abbreviation>IEC</abbreviation>
|
36
|
+
<uri>www.iec.ch</uri>
|
37
|
+
</organization>
|
38
|
+
</owner>
|
39
|
+
</copyright>
|
40
|
+
<place>Geneva</place>
|
41
|
+
<ext>
|
42
|
+
<doctype>international-standard</doctype>
|
43
|
+
<editorialgroup>
|
44
|
+
<technical-committee number="1" type="technicalCommittee">TC 1 - Terminology</technical-committee>
|
45
|
+
</editorialgroup>
|
46
|
+
<ics>
|
47
|
+
<code>01.040.07</code>
|
48
|
+
<text>Natural and applied sciences (Vocabularies)</text>
|
49
|
+
</ics>
|
50
|
+
<ics>
|
51
|
+
<code>07.020</code>
|
52
|
+
<text>Mathematics</text>
|
53
|
+
</ics>
|
54
|
+
<structuredidentifier type="IEC">
|
55
|
+
<project-number>60050</project-number>
|
56
|
+
</structuredidentifier>
|
57
|
+
</ext>
|
58
|
+
</bibdata>
|
@@ -0,0 +1 @@
|
|
1
|
+
407d6f5afdc9ae9ea7abe6e84d27f40b
|
data/lib/relaton/config.rb
CHANGED
data/lib/relaton/db.rb
CHANGED
@@ -23,26 +23,77 @@ module Relaton
|
|
23
23
|
# @param code [String] the ISO standard Code to look up (e.g. "ISO 9000")
|
24
24
|
# @param year [String] the year the standard was published (optional)
|
25
25
|
# @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
|
26
|
-
# @return [
|
26
|
+
# @return [nil, RelatonBib::BibliographicItem, RelatonIsoBib::IsoBibliographicItem,
|
27
27
|
# RelatonItu::ItuBibliographicItem, RelatonIetf::IetfBibliographicItem,
|
28
|
-
#
|
28
|
+
# RelatonIec::IecBibliographicItem, RelatonIeee::IeeeBibliographicItem,
|
29
|
+
# RelatonNist::NistBibliongraphicItem, RelatonGb::GbbibliographicItem,
|
30
|
+
# RelatonOgc::OgcBibliographicItem, RelatonCalconnect::CcBibliographicItem]
|
31
|
+
# RelatonBipm::BipmBibliographicItem, RelatonIho::IhoBibliographicItem,
|
32
|
+
# RelatonOmg::OmgBibliographicItem RelatinUn::UnBibliographicItem,
|
33
|
+
# RelatonW3c::W3cBibliographicItem
|
29
34
|
def fetch(code, year = nil, opts = {})
|
30
35
|
stdclass = standard_class(code) || return
|
31
|
-
|
36
|
+
processor = @registry.processors[stdclass]
|
37
|
+
ref = processor.respond_to?(:urn_to_code) ? processor.urn_to_code(code)&.first : code
|
38
|
+
ref ||= code
|
39
|
+
cd = combine_doc ref, year, opts, stdclass
|
40
|
+
return cd if cd
|
41
|
+
|
42
|
+
check_bibliocache(ref, year, opts, stdclass)
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param code [String]
|
46
|
+
# @param year [String, nil]
|
47
|
+
# @param stdslass [String]
|
48
|
+
# @return [nil, RelatonBib::BibliographicItem, RelatonIsoBib::IsoBibliographicItem,
|
49
|
+
# RelatonItu::ItuBibliographicItem, RelatonIetf::IetfBibliographicItem,
|
50
|
+
# RelatonIec::IecBibliographicItem, RelatonIeee::IeeeBibliographicItem,
|
51
|
+
# RelatonNist::NistBibliongraphicItem, RelatonGb::GbbibliographicItem,
|
52
|
+
# RelatonOgc::OgcBibliographicItem, RelatonCalconnect::CcBibliographicItem]
|
53
|
+
# RelatonBipm::BipmBibliographicItem, RelatonIho::IhoBibliographicItem,
|
54
|
+
# RelatonOmg::OmgBibliographicItem RelatinUn::UnBibliographicItem,
|
55
|
+
# RelatonW3c::W3cBibliographicItem
|
56
|
+
def combine_doc(code, year, opts, stdclass) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
57
|
+
if (refs = code.split " + ").size > 1
|
58
|
+
reltype = "derivedFrom"
|
59
|
+
reldesc = nil
|
60
|
+
elsif (refs = code.split ", ").size > 1
|
61
|
+
reltype = "complements"
|
62
|
+
reldesc = RelatonBib::FormattedString.new content: "amendment"
|
63
|
+
else return
|
64
|
+
end
|
65
|
+
|
66
|
+
doc = @registry.processors[stdclass].hash_to_bib docid: { id: code }
|
67
|
+
ref = refs[0]
|
68
|
+
updates = check_bibliocache(ref, year, opts, stdclass)
|
69
|
+
doc.relation << RelatonBib::DocumentRelation.new(bibitem: updates, type: "updates") if updates
|
70
|
+
refs[1..-1].each_with_object(doc) do |c, d|
|
71
|
+
bib = check_bibliocache("#{ref}/#{c}", year, opts, stdclass)
|
72
|
+
if bib
|
73
|
+
d.relation << RelatonBib::DocumentRelation.new(type: reltype, description: reldesc, bibitem: bib)
|
74
|
+
end
|
75
|
+
end
|
32
76
|
end
|
33
77
|
|
34
78
|
# @param code [String]
|
35
79
|
# @param year [String, NilClass]
|
36
80
|
# @param stdclass [Symbol, NilClass]
|
37
81
|
# @param opts [Hash]
|
82
|
+
# @return [nil, RelatonBib::BibliographicItem, RelatonIsoBib::IsoBibliographicItem,
|
83
|
+
# RelatonItu::ItuBibliographicItem, RelatonIetf::IetfBibliographicItem,
|
84
|
+
# RelatonIec::IecBibliographicItem, RelatonIeee::IeeeBibliographicItem,
|
85
|
+
# RelatonNist::NistBibliongraphicItem, RelatonGb::GbbibliographicItem,
|
86
|
+
# RelatonOgc::OgcBibliographicItem, RelatonCalconnect::CcBibliographicItem]
|
87
|
+
# RelatonBipm::BipmBibliographicItem, RelatonIho::IhoBibliographicItem,
|
88
|
+
# RelatonOmg::OmgBibliographicItem RelatinUn::UnBibliographicItem,
|
89
|
+
# RelatonW3c::W3cBibliographicItem
|
38
90
|
def fetch_std(code, year = nil, stdclass = nil, opts = {})
|
39
91
|
std = nil
|
40
92
|
@registry.processors.each do |name, processor|
|
41
93
|
std = name if processor.prefix == stdclass
|
42
94
|
end
|
43
|
-
unless std
|
44
|
-
|
45
|
-
end
|
95
|
+
std = standard_class(code) or return nil unless std
|
96
|
+
|
46
97
|
check_bibliocache(code, year, opts, std)
|
47
98
|
end
|
48
99
|
|
@@ -90,16 +141,16 @@ module Relaton
|
|
90
141
|
# @return [Symbol] standard class name
|
91
142
|
def standard_class(code)
|
92
143
|
@registry.processors.each do |name, processor|
|
93
|
-
return name if
|
144
|
+
return name if /^(urn:)?#{processor.prefix}/i.match?(code) ||
|
94
145
|
processor.defaultprefix.match(code)
|
95
146
|
end
|
96
147
|
allowed = @registry.processors.reduce([]) do |m, (_k, v)|
|
97
148
|
m << v.prefix
|
98
149
|
end
|
99
150
|
warn <<~WARN
|
100
|
-
|
101
|
-
|
102
|
-
|
151
|
+
#{code} does not have a recognised prefix: #{allowed.join(', ')}.
|
152
|
+
See https://github.com/relaton/relaton/ for instructions on prefixing and wrapping document identifiers to disambiguate them.
|
153
|
+
WARN
|
103
154
|
end
|
104
155
|
|
105
156
|
# TODO: i18n
|
@@ -130,22 +181,31 @@ module Relaton
|
|
130
181
|
# @param entry [String] XML string
|
131
182
|
# @param stdclass [Symbol]
|
132
183
|
# @param id [String] docid
|
133
|
-
# @return [
|
184
|
+
# @return [nil, RelatonBib::BibliographicItem, RelatonIsoBib::IsoBibliographicItem,
|
134
185
|
# RelatonItu::ItuBibliographicItem, RelatonIetf::IetfBibliographicItem,
|
135
|
-
#
|
136
|
-
|
137
|
-
|
186
|
+
# RelatonIec::IecBibliographicItem, RelatonIeee::IeeeBibliographicItem,
|
187
|
+
# RelatonNist::NistBibliongraphicItem, RelatonGb::GbbibliographicItem,
|
188
|
+
# RelatonOgc::OgcBibliographicItem, RelatonCalconnect::CcBibliographicItem]
|
189
|
+
# RelatonBipm::BipmBibliographicItem, RelatonIho::IhoBibliographicItem,
|
190
|
+
# RelatonOmg::OmgBibliographicItem RelatinUn::UnBibliographicItem,
|
191
|
+
# RelatonW3c::W3cBibliographicItem
|
192
|
+
def bib_retval(entry, stdclass, _id)
|
193
|
+
entry.match?(/^not_found/) ? nil : @registry.processors[stdclass].from_xml(entry)
|
138
194
|
end
|
139
195
|
|
140
196
|
# @param code [String]
|
141
197
|
# @param year [String]
|
142
198
|
# @param opts [Hash]
|
143
199
|
# @param stdclass [Symbol]
|
144
|
-
# @return [
|
200
|
+
# @return [nil, RelatonBib::BibliographicItem, RelatonIsoBib::IsoBibliographicItem,
|
145
201
|
# RelatonItu::ItuBibliographicItem, RelatonIetf::IetfBibliographicItem,
|
202
|
+
# RelatonIec::IecBibliographicItem, RelatonIeee::IeeeBibliographicItem,
|
146
203
|
# RelatonNist::NistBibliongraphicItem, RelatonGb::GbbibliographicItem,
|
147
204
|
# RelatonOgc::OgcBibliographicItem, RelatonCalconnect::CcBibliographicItem]
|
148
|
-
|
205
|
+
# RelatonBipm::BipmBibliographicItem, RelatonIho::IhoBibliographicItem,
|
206
|
+
# RelatonOmg::OmgBibliographicItem RelatinUn::UnBibliographicItem,
|
207
|
+
# RelatonW3c::W3cBibliographicItem
|
208
|
+
def check_bibliocache(code, year, opts, stdclass) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
149
209
|
id, searchcode = std_id(code, year, opts, stdclass)
|
150
210
|
yaml = @static_db[id]
|
151
211
|
return @registry.processors[stdclass].hash_to_bib YAML.safe_load(yaml) if yaml
|
@@ -176,7 +236,7 @@ module Relaton
|
|
176
236
|
# @param db [Relaton::DbCache,`NilClass]
|
177
237
|
# @param id [String] docid
|
178
238
|
# @return [String]
|
179
|
-
def new_bib_entry(code, year, opts, stdclass, **args)
|
239
|
+
def new_bib_entry(code, year, opts, stdclass, **args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
180
240
|
bib = @registry.processors[stdclass].get(code, year, opts)
|
181
241
|
bib_id = bib&.docidentifier&.first&.id
|
182
242
|
|
data/lib/relaton/db_cache.rb
CHANGED
@@ -26,7 +26,7 @@ module Relaton
|
|
26
26
|
prefix_dir = "#{@dir}/#{prefix(key)}"
|
27
27
|
FileUtils::mkdir_p prefix_dir unless Dir.exist? prefix_dir
|
28
28
|
set_version prefix_dir
|
29
|
-
|
29
|
+
file_safe_write "#{filename(key)}.#{ext(value)}", value
|
30
30
|
end
|
31
31
|
|
32
32
|
# @param value [String]
|
@@ -65,7 +65,7 @@ module Relaton
|
|
65
65
|
value = self[key]
|
66
66
|
return unless value
|
67
67
|
|
68
|
-
if value
|
68
|
+
if value.match? /^not_found/
|
69
69
|
value.match(/\d{4}-\d{2}-\d{2}/).to_s
|
70
70
|
else
|
71
71
|
doc = Nokogiri::XML value
|
@@ -106,7 +106,7 @@ module Relaton
|
|
106
106
|
def set_version(fdir)
|
107
107
|
file_version = "#{fdir}/version"
|
108
108
|
unless File.exist? file_version
|
109
|
-
|
109
|
+
file_safe_write file_version, grammar_hash(fdir)
|
110
110
|
end
|
111
111
|
self
|
112
112
|
end
|
@@ -159,7 +159,7 @@ module Relaton
|
|
159
159
|
def filename(key)
|
160
160
|
prefcode = key.downcase.match /^(?<prefix>[^\(]+)\((?<code>[^\)]+)/
|
161
161
|
fn = if prefcode
|
162
|
-
"#{prefcode[:prefix]}/#{prefcode[:code].gsub(/[-:\s\/\()]/, '_').squeeze(
|
162
|
+
"#{prefcode[:prefix]}/#{prefcode[:code].gsub(/[-:\s\/\()]/, '_').squeeze('_')}"
|
163
163
|
else
|
164
164
|
key.gsub(/[-:\s]/, "_")
|
165
165
|
end
|
@@ -189,6 +189,15 @@ module Relaton
|
|
189
189
|
key.downcase.match(/^[^\(]+(?=\()/).to_s
|
190
190
|
end
|
191
191
|
|
192
|
+
# @param file [String]
|
193
|
+
# @content [String]
|
194
|
+
def file_safe_write(file, content)
|
195
|
+
File.open file, File::RDWR | File::CREAT, encoding: "UTF-8" do |f|
|
196
|
+
Timeout.timeout(1) { f.flock File::LOCK_EX }
|
197
|
+
f.write content
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
192
201
|
class << self
|
193
202
|
private
|
194
203
|
|
@@ -209,7 +218,7 @@ module Relaton
|
|
209
218
|
# local_cache: local cache name; none created if nil; "relaton" created
|
210
219
|
# if empty global_cache: boolean to create global_cache
|
211
220
|
# flush_caches: flush caches
|
212
|
-
def init_bib_caches(opts)
|
221
|
+
def init_bib_caches(opts) # rubocop:disable Metrics/CyclomaticComplexity
|
213
222
|
globalname = global_bibliocache_name if opts[:global_cache]
|
214
223
|
localname = local_bibliocache_name(opts[:local_cache])
|
215
224
|
localname = "relaton" if localname&.empty?
|
data/lib/relaton/registry.rb
CHANGED
@@ -8,7 +8,7 @@ module Relaton
|
|
8
8
|
SUPPORTED_GEMS = %w[
|
9
9
|
relaton_gb relaton_iec relaton_ietf relaton_iso relaton_itu relaton_nist
|
10
10
|
relaton_ogc relaton_calconnect relaton_omg relaton_un relaton_w3c
|
11
|
-
relaton_ieee relaton_iho relaton_bipm
|
11
|
+
relaton_ieee relaton_iho relaton_bipm relaton_ecma
|
12
12
|
].freeze
|
13
13
|
|
14
14
|
include Singleton
|
data/lib/relaton/version.rb
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
<bibdata type="standard">
|
2
|
+
<fetched>2021-02-03</fetched>
|
3
|
+
<title type="title-main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV)</title>
|
4
|
+
<title type="title-part" format="text/plain" language="en" script="Latn">Part 102: Mathematics -- General concepts and linear algebra</title>
|
5
|
+
<title type="main" format="text/plain" language="en" script="Latn">International Electrotechnical Vocabulary (IEV) - Part 102: Mathematics -- General concepts and linear algebra</title>
|
6
|
+
<uri type="src">https://webstore.iec.ch/publication/160</uri>
|
7
|
+
<uri type="obp">/preview/info_iec60050-102%7Bed1.0%7Db.pdf</uri>
|
8
|
+
<docidentifier type="IEC">IEC 60050-102:2007</docidentifier>
|
9
|
+
<docidentifier type="URN">urn:iec:std:iec:60050-102:2007:::en</docidentifier>
|
10
|
+
<date type="published">
|
11
|
+
<on>2007-08-27</on>
|
12
|
+
</date>
|
13
|
+
<contributor>
|
14
|
+
<role type="publisher"/>
|
15
|
+
<organization>
|
16
|
+
<name>International Electrotechnical Commission</name>
|
17
|
+
<abbreviation>IEC</abbreviation>
|
18
|
+
<uri>www.iec.ch</uri>
|
19
|
+
</organization>
|
20
|
+
</contributor>
|
21
|
+
<edition>1.0</edition>
|
22
|
+
<language>en</language>
|
23
|
+
<script>Latn</script>
|
24
|
+
<abstract format="text/plain" language="en" script="Latn">This part of IEC 60050 gives the general mathematical terminology used in the fields of electricity, electronics and telecommunications, together with basic concepts in linear algebra. It maintains a clear distinction between mathematical concepts and physical concepts, even if some terms are used in both cases. Another part will deal with functions.
|
25
|
+
It has the status of a horizontal standard in accordance with IEC Guide 108.</abstract>
|
26
|
+
<status>
|
27
|
+
<stage>60</stage>
|
28
|
+
<substage>60</substage>
|
29
|
+
</status>
|
30
|
+
<copyright>
|
31
|
+
<from>2007</from>
|
32
|
+
<owner>
|
33
|
+
<organization>
|
34
|
+
<name>International Electrotechnical Commission</name>
|
35
|
+
<abbreviation>IEC</abbreviation>
|
36
|
+
<uri>www.iec.ch</uri>
|
37
|
+
</organization>
|
38
|
+
</owner>
|
39
|
+
</copyright>
|
40
|
+
<place>Geneva</place>
|
41
|
+
<ext>
|
42
|
+
<doctype>international-standard</doctype>
|
43
|
+
<editorialgroup>
|
44
|
+
<technical-committee number="1" type="technicalCommittee">TC 1 - Terminology</technical-committee>
|
45
|
+
</editorialgroup>
|
46
|
+
<ics>
|
47
|
+
<code>01.040.07</code>
|
48
|
+
<text>Natural and applied sciences (Vocabularies)</text>
|
49
|
+
</ics>
|
50
|
+
<ics>
|
51
|
+
<code>07.020</code>
|
52
|
+
<text>Mathematics</text>
|
53
|
+
</ics>
|
54
|
+
<structuredidentifier type="IEC">
|
55
|
+
<project-number>60050</project-number>
|
56
|
+
</structuredidentifier>
|
57
|
+
</ext>
|
58
|
+
</bibdata>
|