metanorma-bipm 2.7.2 → 2.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.
@@ -46,19 +46,22 @@ module IsoDoc
46
46
  end.join(" ")
47
47
  end
48
48
 
49
- def docid(isoxml, _out)
49
+ COMMITEE_XPATH = <<~XPATH.freeze
50
+ //bibdata/contributor[role/description = 'committee']/organization/subdivision[@type = 'Committee']
51
+ XPATH
52
+
53
+ def docid(xml, _out)
50
54
  super
51
- docid_part(isoxml, [@i18n.get["level2_ancillary"],
52
- @i18n.get["level2_ancillary_alt"]], "appendix", :appendixid)
53
- docid_part(isoxml, [@i18n.get["level3_ancillary"],
54
- @i18n.get["level3_ancillary_alt"]], "annexid", :annexid)
55
- docid_part(isoxml, [@i18n.get["level4_ancillary"],
56
- @i18n.get["level4_ancillary_alt"]], "part", :partid)
57
- docid_part(isoxml, [@i18n.get["level5_ancillary"],
58
- @i18n.get["level5_ancillary_alt"]], "subpart", :subpartid)
59
- set(:org_abbrev,
60
- isoxml.at(ns("//bibdata/ext/editorialgroup/committee"\
61
- "[@acronym = 'JCGM']")) ? "JCGM" : "BIPM")
55
+ [{ label: "level2", elem: "appendix", key: :appendixid },
56
+ { label: "level3", elem: "annexid", key: :annexid },
57
+ { label: "level4", elem: "part", key: :partid },
58
+ { label: "level5", elem: "subpart", key: :subpartid }].each do |m|
59
+ docid_part(xml, [@i18n.get["#{m[:label]}_ancillary"],
60
+ @i18n.get["#{m[:label]}_ancillary_alt"]], m[:elem],
61
+ m[:key])
62
+ end
63
+ c = xml.at(ns("#{COMMITEE_XPATH}/identifier[not(@type = 'full')][text() = 'JCGM']"))
64
+ set(:org_abbrev, c ? "JCGM" : "BIPM")
62
65
  end
63
66
 
64
67
  def docid_part(isoxml, labels, elem, key)
@@ -81,6 +84,7 @@ module IsoDoc
81
84
  def author(xml, _out)
82
85
  super
83
86
  authorizer(xml)
87
+ committee(xml)
84
88
  end
85
89
 
86
90
  def authorizer(xml)
@@ -93,6 +97,13 @@ module IsoDoc
93
97
  end
94
98
  ret.empty? or set(:authorizer, ret)
95
99
  end
100
+
101
+ def committee(xml)
102
+ t = xml.at(ns(COMMITEE_XPATH)) or return
103
+ n = t.at(ns("./name[@language = '#{@lang}']")) ||
104
+ t.at(ns("./name[not(@language)]"))
105
+ n and set(:tc, n.text)
106
+ end
96
107
  end
97
108
  end
98
109
  end
@@ -12,8 +12,9 @@ module IsoDoc
12
12
  module Bipm
13
13
  class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
14
14
  def convert1(docxml, filename, dir)
15
- @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/" \
16
- "@acronym"))&.value == "JCGM"
15
+ @jcgm = docxml.at(ns(<<~XPATH))&.text == "JCGM"
16
+ //bibdata/contributor[role/description = 'committee']/organization/subdivision[@type = 'Committee']/identifier[not(@type = 'full')]
17
+ XPATH
17
18
  @xrefs.klass.jcgm = @jcgm
18
19
  @jcgm and @iso = iso_processor(docxml)
19
20
  super
@@ -12,8 +12,9 @@ module IsoDoc
12
12
  end
13
13
 
14
14
  def parse(docxml)
15
- @jcgm = docxml.at(ns("//bibdata/ext/editorialgroup/committee/" \
16
- "@acronym"))&.value == "JCGM"
15
+ @jcgm = docxml.at(ns(<<~XPATH))&.text == "JCGM"
16
+ //bibdata/contributor[role/description = 'committee']/organization/subdivision[@type = 'Committee']/identifier[not(@type = 'full')]
17
+ XPATH
17
18
  @annexlbl =
18
19
  if @jcgm then @labels["iso_annex"]
19
20
  elsif docxml.at(ns("//bibdata/ext/structuredidentifier/appendix"))
@@ -76,12 +76,6 @@ from other documents in the same doctype</a:documentation>
76
76
  <ref name="flavor">
77
77
  <a:documentation>Flavour of Metanorma used to process this document</a:documentation>
78
78
  </ref>
79
- <optional>
80
- <ref name="editorialgroup">
81
- <a:documentation>Groups associated with the production of the standards document, typically within
82
- a standards definition organization</a:documentation>
83
- </ref>
84
- </optional>
85
79
  <zeroOrMore>
86
80
  <ref name="ics">
87
81
  <a:documentation>Classification of the document contents taken from the International Classification of Standards</a:documentation>
@@ -130,49 +124,6 @@ a standards definition organization</a:documentation>
130
124
  However we prefer not to hardcode it, given ongoing extension.</a:documentation>
131
125
  <text/>
132
126
  </define>
133
- <define name="editorialgroup">
134
- <a:documentation>A group associated with the production of the standards document, typically within
135
- a standards definition organization</a:documentation>
136
- <element name="editorialgroup">
137
- <oneOrMore>
138
- <ref name="technical-committee">
139
- <a:documentation>A technical committee associated with the production of the standards document</a:documentation>
140
- </ref>
141
- </oneOrMore>
142
- </element>
143
- </define>
144
- <define name="technical-committee">
145
- <a:documentation>Technical committee associated with the production of a standards document</a:documentation>
146
- <element name="technical-committee">
147
- <ref name="IsoWorkgroup"/>
148
- </element>
149
- </define>
150
- <define name="IsoWorkgroup">
151
- <optional>
152
- <attribute name="number">
153
- <a:documentation>Numeric identifier of the technical committee</a:documentation>
154
- </attribute>
155
- </optional>
156
- <optional>
157
- <attribute name="type">
158
- <a:documentation>Type of the technical committee, used in identifying the technical committee</a:documentation>
159
- </attribute>
160
- </optional>
161
- <optional>
162
- <attribute name="identifier">
163
- <a:documentation>Non-numeric, complete identifier of the technical committee</a:documentation>
164
- </attribute>
165
- </optional>
166
- <optional>
167
- <attribute name="prefix">
168
- <a:documentation>Disambiguating prefix added to number to form the identifier of the technical committee,
169
- typically indicating its type</a:documentation>
170
- </attribute>
171
- </optional>
172
- <text>
173
- <a:documentation>Name of the technical committee</a:documentation>
174
- </text>
175
- </define>
176
127
  <define name="ics">
177
128
  <a:documentation>Classification taken from the International Classification of Standards.
178
129
  ICS is defined by ISO here -- https://www.iso.org/publication/PUB100033.html</a:documentation>
@@ -242,6 +242,8 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
242
242
  </choice>
243
243
  </define>
244
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>
245
247
  <element name="description">
246
248
  <ref name="LocalizedMarkedUpString"/>
247
249
  </element>
@@ -443,7 +445,10 @@ real names (if the person is named with a pseudonym or user name); previous lega
443
445
  </oneOrMore>
444
446
  <zeroOrMore>
445
447
  <ref name="subdivision">
446
- <a:documentation>The subdivision of the organization directly involved with the production of the bibliographic item</a:documentation>
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>
447
452
  </ref>
448
453
  </zeroOrMore>
449
454
  <optional>
@@ -485,6 +490,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
485
490
  <a:documentation>The type of subdivision</a:documentation>
486
491
  </attribute>
487
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>
488
498
  <ref name="OrganizationType">
489
499
  <a:documentation>The subdivision, modelled recursively as an organization</a:documentation>
490
500
  </ref>
@@ -80,12 +80,12 @@ module Metanorma
80
80
  def committee_validate(xml)
81
81
  committees = Array(configuration&.committees) || return
82
82
  committees.empty? and return
83
- xml.xpath("//bibdata/ext/editorialgroup/committee").each do |c|
83
+ xml.xpath("//bibdata/contributor[role/description = 'committee']/organization/subdivision[@type = 'Committee']/name").each do |c|
84
84
  committees.include? c.text or
85
85
  @log.add("Document Attributes", nil,
86
86
  "#{c.text} is not a recognised committee")
87
87
  end
88
- xml.xpath("//bibdata/ext/editorialgroup/committee/@acronym").each do |c|
88
+ xml.xpath("//bibdata/contributor[role/description = 'committee']/organization/subdivision[@type = 'Committee']/identifier[not(@type = 'full')]").each do |c|
89
89
  committees.include? c.text or
90
90
  @log.add("Document Attributes", nil,
91
91
  "#{c.text} is not a recognised committee")
@@ -1,46 +1,50 @@
1
1
  module Metanorma
2
2
  module Bipm
3
3
  class Converter < Metanorma::Generic::Converter
4
- def metadata_committee(node, xml)
5
- node.attr("committee-en") || node.attr("committee-fr") or return
6
- xml.editorialgroup do |a|
7
- metadata_committee1(node, a)
8
- i = 2
9
- while node.attr("committee-en_#{i}") || node.attr("committee-fr_#{i}")
10
- metadata_committee2(node, a, i)
11
- i += 1
12
- end
13
- metadata_workgroup(node, a)
4
+ def contrib_committee_subdiv(xml, committee)
5
+ contributors_committees_filter_empty?(committee) and return
6
+ xml.subdivision **attr_code(type: committee[:subdivtype],
7
+ subtype: committee[:type]) do |o|
8
+ committee[:name] and o.name committee[:name]
9
+ committee[:name_en] and o.name committee[:name_en],
10
+ language: "en"
11
+ committee[:name_fr] and o.name committee[:name_fr],
12
+ language: "fr"
13
+ committee[:abbr] and o.abbreviation committee[:abbr]
14
+ committee[:ident] and o.identifier committee[:ident]
14
15
  end
15
16
  end
16
17
 
17
- def metadata_committee1(node, xml)
18
- %w(en fr).each do |lg|
19
- e = node.attr("committee-#{lg}") or next
20
- xml.committee e, **attr_code(acronym: node.attr("committee-acronym"),
21
- language: lg, script: "Latn")
22
- end
18
+ def contributors_committees_filter_empty?(committee)
19
+ (committee[:name].nil? || committee[:name].empty?) &&
20
+ (committee[:name_en].nil? || committee[:name_en].empty?) &&
21
+ (committee[:name_fr].nil? || committee[:name_fr].empty?) &&
22
+ committee[:ident].nil?
23
23
  end
24
24
 
25
- def metadata_committee2(node, xml, num)
26
- %w(en fr).each do |lg|
27
- e = node.attr("committee-#{lg}_#{num}") or next
28
- xml.committee e, **attr_code(acronym: node.attr("committee-acronym"),
29
- language: lg, script: "Latn")
30
- end
25
+ def committee_number_or_name?(node, type, suffix)
26
+ node.attr("#{type}-number#{suffix}") || node.attr("#{type}#{suffix}") ||
27
+ node.attr("#{type}-en#{suffix}") || node.attr("#{type}-fr#{suffix}")
31
28
  end
32
29
 
33
- def metadata_workgroup(node, xml)
34
- xml.workgroup(node.attr("workgroup"),
35
- **attr_code(acronym: node.attr("workgroup-acronym")))
36
- i = 2
37
- while node.attr("workgroup_#{i}")
38
- xml.workgroup(
39
- node.attr("workgroup_#{i}"),
40
- **attr_code(acronym: node.attr("workgroup-acronym_#{i}")),
41
- )
30
+ def committee_org_prep_agency(node, type, agency, agency_arr, agency_abbr)
31
+ i = 1
32
+ suffix = ""
33
+ while committee_number_or_name?(node, type, suffix)
34
+ agency_arr << (node.attr("#{type}-agency#{suffix}") || agency)
35
+ agency_abbr << node.attr("#{type}-agency-abbr#{suffix}")
42
36
  i += 1
37
+ suffix = "_#{i}"
43
38
  end
39
+ [agency_arr, agency_abbr]
40
+ end
41
+
42
+ def extract_org_attrs_complex(node, opts, source, suffix)
43
+ ident = node.attr("#{source}-acronym#{suffix}")
44
+ ret = super.merge(name_en: node.attr("#{source}-en#{suffix}"),
45
+ name_fr: node.attr("#{source}-fr#{suffix}"))
46
+ ident and ret[:ident] = ident
47
+ ret
44
48
  end
45
49
 
46
50
  def metadata_relations(node, xml)
@@ -1,6 +1,6 @@
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" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
3
- <!-- VERSION v2.1.0 -->
3
+ <!-- VERSION v2.1.1 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -2233,6 +2233,11 @@ used in document amendments</a:documentation>
2233
2233
  <ref name="RequiredId"/>
2234
2234
  <ref name="NumberingAttributes"/>
2235
2235
  <ref name="BlockAttributes"/>
2236
+ <optional>
2237
+ <attribute name="type">
2238
+ <a:documentation>Semantic classification of note</a:documentation>
2239
+ </attribute>
2240
+ </optional>
2236
2241
  <oneOrMore>
2237
2242
  <choice>
2238
2243
  <a:documentation>Content of the term note</a:documentation>
@@ -17,16 +17,6 @@
17
17
  <value>policy</value>
18
18
  </choice>
19
19
  </define>
20
- <define name="editorialgroup">
21
- <element name="editorialgroup">
22
- <oneOrMore>
23
- <ref name="committee"/>
24
- </oneOrMore>
25
- <zeroOrMore>
26
- <ref name="workgroup"/>
27
- </zeroOrMore>
28
- </element>
29
- </define>
30
20
  <define name="structuredidentifier">
31
21
  <element name="structuredidentifier">
32
22
  <element name="docnumber">
@@ -91,41 +81,6 @@
91
81
  </choice>
92
82
  </element>
93
83
  </define>
94
- <define name="committee">
95
- <element name="committee">
96
- <attribute name="acronym">
97
- <choice>
98
- <value>CGPM</value>
99
- <value>CIPM</value>
100
- <value>BIPM</value>
101
- <value>CCAUV</value>
102
- <value>CCEM</value>
103
- <value>CCL</value>
104
- <value>CCM</value>
105
- <value>CCPR</value>
106
- <value>CCQM</value>
107
- <value>CCRI</value>
108
- <value>CCT</value>
109
- <value>CCTF</value>
110
- <value>CCU</value>
111
- <value>CCL-CCTF-WGFS</value>
112
- <value>JCGM</value>
113
- <value>JCRB</value>
114
- <value>JCTLM</value>
115
- <value>INetQI</value>
116
- </choice>
117
- </attribute>
118
- <ref name="LocalizedString"/>
119
- </element>
120
- </define>
121
- <define name="workgroup">
122
- <element name="workgroup">
123
- <optional>
124
- <attribute name="acronym"/>
125
- </optional>
126
- <text/>
127
- </element>
128
- </define>
129
84
  <define name="meeting-note">
130
85
  <element name="meeting-note">
131
86
  <text/>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Bipm
3
- VERSION = "2.7.2".freeze
3
+ VERSION = "2.7.3".freeze
4
4
  end
5
5
  end
data/metanorma.yml CHANGED
@@ -97,6 +97,9 @@ committees:
97
97
  - Comité commun pour la traçabilité en médecine de laboratoire
98
98
  - INetQI
99
99
  - International Network on Quality Infrastructure
100
+ committee_types:
101
+ - committee
102
+ - workgroup
100
103
  metadata_extensions:
101
104
  structuredidentifier:
102
105
  docnumber:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.2
4
+ version: 2.7.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: 2025-08-04 00:00:00.000000000 Z
11
+ date: 2025-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic