relaton-iec 1.11.3 → 1.11.4
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/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
- metadata +2 -3
- 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: 3693023d890f701035d9decbf0d0866909163bfaebd758e8e7c8e86072815731
|
4
|
+
data.tar.gz: 3aedcf623406e1e23311a7eaddd47b9497bd8f9c575e62904f03d4e7b3062224
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a9917fe56c8a33090ab809a13327cd754c238236e4c027fa0e1939bfb7fa9cb3c27c7708bf930df662bc1737ef36abfd4e00fe79bd56315d69d17073bc5d180
|
7
|
+
data.tar.gz: 4076a2815a8428db30e264ce3f2b6224103e4f93babd29913a1b363a1084c8196e8c77c328eb24aca62afd665274b451046e7424c7beda8803d38b921a97e5af
|
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
|
@@ -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
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.11.
|
4
|
+
version: 1.11.4
|
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-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -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
|