relaton-iec 1.11.0 → 1.11.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29cf9f52b83e9d40f821dbc17e7d9046a5b75daa74785eb42f86c34beb901326
4
- data.tar.gz: 826a7c557607895c288cc7fd1c533eff3e50305e7f5f53d4084ba5bdfbe94f0d
3
+ metadata.gz: 5b06795307ed2232e78986c9ff0bfcd0012a326c9938373842791492d558a344
4
+ data.tar.gz: f88a3d9ceed53b9b31974ac994479a2904c9be82e57a03728b7730c0991655fb
5
5
  SHA512:
6
- metadata.gz: a1cd3fc598455e728ebcecff28c24292da8d88540c9c482f1b0f1bcbc481ee31b82c3db4b0510cbb431c524ac8d6a20ecf85e7dbcc40afa1816836e2fa64f949
7
- data.tar.gz: ff4f56193ef6924948725a81bfc11319f059a4f3e73f8e1838c0a4ee43c7fe31ed204b085edf358c4d42f0643305a1417dbd7a124e2e033ac6586032af7b4b8b
6
+ metadata.gz: 49e1c8c651adf7df75a9befc1b75bf82d1de7194707069e20e50997656e98ac121f3526dda355fbb95593beccdcd4ce6aa1d0a9dfd220b9186871fce62d4624b
7
+ data.tar.gz: ad92bc78b02e45959df21be7060777b4a60c7497e851a8218806c557d8bf0ccfd2bed6a95c672ebfb248ce38538cfa96119f58f59d645c57fa32a98525f44c90
data/Gemfile CHANGED
@@ -1,6 +1,3 @@
1
- Encoding.default_external = Encoding::UTF_8
2
- Encoding.default_internal = Encoding::UTF_8
3
-
4
1
  source "https://rubygems.org"
5
2
 
6
3
  git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
data/grammars/biblio.rng CHANGED
@@ -527,7 +527,7 @@
527
527
  </define>
528
528
  <define name="LocalityType">
529
529
  <data type="string">
530
- <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
530
+ <param name="pattern">section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
531
531
  </data>
532
532
  </define>
533
533
  <define name="referenceFrom">
@@ -851,17 +851,46 @@
851
851
  </define>
852
852
  <define name="bplace">
853
853
  <element name="place">
854
- <optional>
855
- <attribute name="uri">
856
- <data type="anyURI"/>
857
- </attribute>
858
- </optional>
859
- <optional>
860
- <attribute name="region"/>
861
- </optional>
854
+ <choice>
855
+ <text/>
856
+ <group>
857
+ <ref name="bibliocity"/>
858
+ <zeroOrMore>
859
+ <ref name="biblioregion"/>
860
+ </zeroOrMore>
861
+ <zeroOrMore>
862
+ <ref name="bibliocountry"/>
863
+ </zeroOrMore>
864
+ </group>
865
+ </choice>
866
+ </element>
867
+ </define>
868
+ <define name="bibliocity">
869
+ <element name="city">
862
870
  <text/>
863
871
  </element>
864
872
  </define>
873
+ <define name="biblioregion">
874
+ <element name="region">
875
+ <ref name="RegionType"/>
876
+ </element>
877
+ </define>
878
+ <define name="bibliocountry">
879
+ <element name="country">
880
+ <ref name="RegionType"/>
881
+ </element>
882
+ </define>
883
+ <define name="RegionType">
884
+ <optional>
885
+ <attribute name="iso"/>
886
+ </optional>
887
+ <optional>
888
+ <attribute name="recommended">
889
+ <data type="boolean"/>
890
+ </attribute>
891
+ </optional>
892
+ <text/>
893
+ </define>
865
894
  <define name="bprice">
866
895
  <element name="price">
867
896
  <attribute name="currency"/>
@@ -0,0 +1,63 @@
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
@@ -3,6 +3,8 @@
3
3
  module RelatonIec
4
4
  # Hit.
5
5
  class Hit < RelatonBib::Hit
6
+ attr_writer :fetch
7
+
6
8
  # Parse page.
7
9
  # @return [RelatonIec::IecBibliographicItem]
8
10
  def fetch
@@ -31,7 +31,7 @@ module RelatonIec
31
31
  all_parts_item = bibitem.to_all_parts
32
32
  parts.reject { |h| h.hit[:code] == hit.hit[:code] }.each do |hi|
33
33
  isobib = RelatonIec::IecBibliographicItem.new(
34
- formattedref: RelatonBib::FormattedRef.new(content: hi.hit[:code])
34
+ formattedref: RelatonBib::FormattedRef.new(content: hi.hit[:code]),
35
35
  )
36
36
  all_parts_item.relation << RelatonBib::DocumentRelation.new(type: "partOf", bibitem: isobib)
37
37
  end
@@ -43,7 +43,15 @@ module RelatonIec
43
43
  # @param ref [String]
44
44
  # @param year [String, nil]
45
45
  # @return [Array<RelatonIec::Hit>]
46
- def hits(ref, year)
46
+ def hits(ref, year) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
47
+ file = "../data/#{ref.sub(/^IEC\s/, '').gsub(' ', '_').upcase}.yaml"
48
+ path = File.expand_path file, __dir__
49
+ if File.exist? path
50
+ hash = YAML.safe_load File.read(path, encoding: "utf-8")
51
+ hit = Hit.new({ code: ref }, self)
52
+ hit.fetch = IecBibliographicItem.from_hash hash
53
+ return [hit]
54
+ end
47
55
  from, to = nil
48
56
  if year
49
57
  from = Date.strptime year, "%Y"
@@ -3,7 +3,7 @@ module RelatonIec
3
3
  TYPES = %w[
4
4
  international-standard technical-specification technical-report
5
5
  publicly-available-specification international-workshop-agreement
6
- guide industry-technical-agreement
6
+ guide industry-technical-agreement system-reference-delivrabble
7
7
  ].freeze
8
8
 
9
9
  FUNCTION = %w[emc safety enviroment quality-assurance].freeze
@@ -25,9 +25,9 @@ module RelatonIec
25
25
  if args[:updates_document_type] &&
26
26
  !TYPES.include?(args[:updates_document_type])
27
27
  warn "[relaton-iec] WARNING: invalid updates_document_type "\
28
- "\"#{args[:updates_document_type]}\""
28
+ "\"#{args[:updates_document_type]}\""
29
29
  warn "[relaton-iec] allowed updates_document_type values are: "\
30
- "#{TYPES.join(', ')}"
30
+ "#{TYPES.join(', ')}"
31
31
  end
32
32
  @function = args.delete :function
33
33
  @updates_document_type = args.delete :updates_document_type
@@ -43,7 +43,7 @@ module RelatonIec
43
43
  # @return [RelatonIsoBib::IecBibliographicItem]
44
44
  def self.from_hash(hash)
45
45
  item_hash = ::RelatonIec::HashConverter.hash_to_bib(hash)
46
- new **item_hash
46
+ new(**item_hash)
47
47
  end
48
48
 
49
49
  # @param opts [Hash]
@@ -52,7 +52,7 @@ module RelatonIec
52
52
  # @option opts [String] :lang language
53
53
  # @return [String] XML
54
54
  def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
55
- super **opts do |b|
55
+ super(**opts) do |b|
56
56
  if opts[:bibdata]
57
57
  b.ext do
58
58
  b.doctype doctype if doctype
@@ -63,16 +63,16 @@ module RelatonIec
63
63
  structuredidentifier&.to_xml b
64
64
  b.stagename stagename if stagename
65
65
  if updates_document_type
66
- b.send("updates-document-type", updates_document_type)
66
+ b.send(:"updates-document-type", updates_document_type)
67
67
  end
68
68
  unless accessibility_color_inside.nil?
69
- b.send("accessibility-color-inside", accessibility_color_inside)
69
+ b.send(:"accessibility-color-inside", accessibility_color_inside)
70
70
  end
71
- b.send("price-code", price_code) if price_code
72
- b.send("cen-processing", cen_processing) unless cen_processing.nil?
71
+ b.send(:"price-code", price_code) if price_code
72
+ b.send(:"cen-processing", cen_processing) unless cen_processing.nil?
73
73
  b.secretary secretary if secretary
74
74
  if interest_to_committees
75
- b.send("interest-to-committees", interest_to_committees)
75
+ b.send(:"interest-to-committees", interest_to_committees)
76
76
  end
77
77
  end
78
78
  end
@@ -21,7 +21,7 @@ module RelatonIec
21
21
  # @param part [String, nil] search for packaged stndard if not nil
22
22
  # @return [RelatonIec::HitCollection]
23
23
  def search(text, year = nil, part = nil)
24
- HitCollection.new text.sub(/(^\w+)\//, '\1 '), year&.strip, part
24
+ HitCollection.new text&.sub(/(^\w+)\//, '\1 '), year&.strip, part
25
25
  rescue SocketError, OpenURI::HTTPError, OpenSSL::SSL::SSLError
26
26
  raise RelatonBib::RequestError, "Could not access http://www.iec.ch"
27
27
  end
@@ -32,8 +32,8 @@ module RelatonIec
32
32
  # reference is required
33
33
  # @return [String] Relaton XML serialisation of reference
34
34
  def get(code, year = nil, opts = {}) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
35
- opts[:all_parts] ||= code.match? /\s\(all parts\)/
36
- ref = code.sub /\s\(all parts\)/, ""
35
+ opts[:all_parts] ||= code.match?(/\s\(all parts\)/)
36
+ ref = code.sub(/\s\(all parts\)/, "")
37
37
  if year.nil?
38
38
  /^(?<code1>[^:]+):(?<year1>[^:]+)/ =~ ref
39
39
  unless code1.nil?
@@ -58,19 +58,19 @@ module RelatonIec
58
58
  def fetch_ref_err(code, year, missed_years) # rubocop:disable Metrics/MethodLength
59
59
  id = year ? "#{code}:#{year}" : code
60
60
  warn "[relaton-iec] WARNING: no match found online for #{id}. "\
61
- "The code must be exactly like it is on the standards website."
61
+ "The code must be exactly like it is on the standards website."
62
62
  unless missed_years.empty?
63
63
  warn "[relaton-iec] (There was no match for #{year}, though there "\
64
- "were matches found for #{missed_years.join(', ')}.)"
64
+ "were matches found for #{missed_years.join(', ')}.)"
65
65
  end
66
66
  if /\d-\d/.match? code
67
67
  warn "[relaton-iec] The provided document part may not exist, or "\
68
- "the document may no longer be published in parts."
68
+ "the document may no longer be published in parts."
69
69
  else
70
70
  warn "[relaton-iec] If you wanted to cite all document parts for "\
71
- "the reference, use \"#{code} (all parts)\".\nIf the document is "\
72
- "not a standard, use its document type abbreviation (TS, TR, PAS, "\
73
- "Guide)."
71
+ "the reference, use \"#{code} (all parts)\".\nIf the document "\
72
+ "is not a standard, use its document type abbreviation (TS, "\
73
+ "TR, PAS, Guide)."
74
74
  end
75
75
  nil
76
76
  end
@@ -91,10 +91,10 @@ module RelatonIec
91
91
  # @return [RelatonIec::HitCollection]
92
92
  def search_filter(ref, year) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
93
93
  %r{
94
- ^(?<code>\S+[^\d]*\s\d+((?:-\w+)+)?)
95
- (:(?<year1>\d{4}))?
96
- (?<bundle>\+[^\s\/]+)?
97
- (\/(?<corr>AMD\s\d+))?
94
+ ^(?<code>\S+[^\d]*\s\d+(?:-\w+)*(?:\s[A-Z]+)?)
95
+ (?::(?<year1>\d{4}))?
96
+ (?<bundle>\+[^\s/]+)?
97
+ (?:/(?<corr>AMD\s\d+))?
98
98
  }x =~ ref.upcase
99
99
  year ||= year1
100
100
  corr&.sub! " ", ""
@@ -106,13 +106,12 @@ module RelatonIec
106
106
  end
107
107
  result = search code if result.empty?
108
108
  code = result.text.dup
109
- code&.sub! /((?:-\w+)+)/, ""
109
+ code&.sub!(/(?:-\w+)+(?:\s[A-Z]+)?/, "")
110
110
  result.select do |i|
111
111
  %r{
112
- ^(?<code2>\S+[^\d]*\s\d+)((?:-\w+)+)?
113
- (:\d{4})?
114
- (?<bundle2>\+[^\s\/]+)?
115
- (\/(?<corr2>AMD\d+))?
112
+ ^(?<code2>\S+[^\d]*\s\d+)(?:-\w+)*(?:\s[A-Z]+)?(?::\d{4})?
113
+ (?<bundle2>\+[^\s/]+)?
114
+ (?:/(?<corr2>AMD\d+))?
116
115
  }x =~ i.hit[:code]
117
116
  code == code2 && bundle == bundle2 && corr == corr2
118
117
  end
@@ -192,8 +191,8 @@ module RelatonIec
192
191
  # @return [Array<String, nil>]
193
192
  def code_year(ref, part)
194
193
  %r{
195
- ^(?<code>\S+[^\d]*\s\d+((?:-\w+)+)?)
196
- (:(?<year>\d{4}))?
194
+ ^(?<code>\S+[^\d]*\s\d+(?:-\w+)*)
195
+ (?::(?<year>\d{4}))?
197
196
  }x =~ ref
198
197
  code.sub!(/-\d+/, "") if part
199
198
  [code, year]
@@ -17,17 +17,18 @@ module RelatonIec
17
17
 
18
18
  TYPES = {
19
19
  "ISO" => "international-standard",
20
- "TS" => "technicalSpecification",
21
- "TR" => "technicalReport",
22
- "PAS" => "publiclyAvailableSpecification",
23
- "AWI" => "appruvedWorkItem",
24
- "CD" => "committeeDraft",
25
- "FDIS" => "finalDraftInternationalStandard",
26
- "NP" => "newProposal",
27
- "DIS" => "draftInternationalStandard",
28
- "WD" => "workingDraft",
20
+ "TS" => "technical-specification",
21
+ "TR" => "technical-report",
22
+ "PAS" => "publicly-available-specification",
23
+ "AWI" => "appruved-work-item",
24
+ "CD" => "committee-draft",
25
+ "FDIS" => "final-draft-international-standard",
26
+ "NP" => "new-proposal",
27
+ "DIS" => "draft-international-standard",
28
+ "WD" => "working-draft",
29
29
  "R" => "recommendation",
30
30
  "Guide" => "guide",
31
+ "SRD" => "system-reference-delivrabble",
31
32
  }.freeze
32
33
 
33
34
  class << self
@@ -218,9 +219,10 @@ module RelatonIec
218
219
  # @param doc [Nokogiri::HTML::Document]
219
220
  # @return [String]
220
221
  def fetch_type(doc)
221
- doc.at(
222
+ type = doc.at(
222
223
  '//th[contains(., "Publication type")]/following-sibling::td/span',
223
- ).text.downcase.tr " ", "-"
224
+ ).text
225
+ TYPES[type] || type.downcase.tr(" ", "-")
224
226
  end
225
227
 
226
228
  # Fetch titles.
@@ -1,3 +1,3 @@
1
1
  module RelatonIec
2
- VERSION = "1.11.0".freeze
2
+ VERSION = "1.11.3".freeze
3
3
  end
data/relaton_iec.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
27
27
  spec.add_development_dependency "pry-byebug"
28
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rake", "~> 13.0"
29
29
  spec.add_development_dependency "rspec", "~> 3.0"
30
30
  spec.add_development_dependency "ruby-jing"
31
31
  spec.add_development_dependency "simplecov"
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.0
4
+ version: 1.11.3
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-04-10 00:00:00.000000000 Z
11
+ date: 2022-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: equivalent-xml
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '13.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '10.0'
54
+ version: '13.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -175,6 +175,7 @@ files:
175
175
  - grammars/isodoc.rng
176
176
  - grammars/isostandard.rng
177
177
  - grammars/reqt.rng
178
+ - lib/data/61360-4_DB.yaml
178
179
  - lib/relaton_iec.rb
179
180
  - lib/relaton_iec/basic_block/alignment.rb
180
181
  - lib/relaton_iec/basic_block/basic_block.rb