stepmod-utils 0.3.25 → 0.3.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/stepmod-annotate-all +2 -0
- data/exe/stepmod-extract-concepts +3 -3
- data/lib/stepmod/utils/concept.rb +1 -1
- data/lib/stepmod/utils/express_bibdata.rb +6 -6
- data/lib/stepmod/utils/stepmod_file_annotator.rb +1 -1
- data/lib/stepmod/utils/terms_extractor.rb +51 -10
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4bb366577c4b43d545ccbdf77ea88e46ece9f0bbefe5ca493769131e18ccaed
|
4
|
+
data.tar.gz: 9811424a834ad40699bfd1c2ed900762469407d764adbe714a5ccf47bc792ed7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38fe3f3a2292c0f4e891bcb29997165ff5550aa2c4e95d5997afda0a77b01bd037642b8f412cd84fa4b01ffd90c70a12dea7a29acb532376984259ed7522a39d
|
7
|
+
data.tar.gz: 2644087f0c877378d0d1e2fc417e74157906a0c00121f0504a0df3475d0d40de5b94a9ed542385ab3977b573e134747cb6f5bd2478d7ae41bb5a43fd9ce8622a
|
data/exe/stepmod-annotate-all
CHANGED
@@ -142,7 +142,7 @@ end
|
|
142
142
|
part_resources.each do |(_bibdata, current_part_resources)|
|
143
143
|
current_part_resources.save_to_files(output_dir)
|
144
144
|
end
|
145
|
-
log "INFO: part_resources written to
|
145
|
+
log "INFO: part_resources written to YAML files in #{output_dir}"
|
146
146
|
|
147
147
|
part_modules.sort_by do |(bibdata, _part_modules_arm, _part_modules_mim)|
|
148
148
|
bibdata.part.to_i
|
@@ -159,7 +159,7 @@ end.each do |(_bibdata, part_modules_arm, part_modules_mim)|
|
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
162
|
-
log "INFO: part_modules written to
|
162
|
+
log "INFO: part_modules written to YAML files in #{output_dir}"
|
163
163
|
|
164
164
|
resource_concepts.save_to_files(output_dir)
|
165
|
-
log "INFO: resource_concepts written to
|
165
|
+
log "INFO: resource_concepts written to YAML files in #{output_dir}"
|
@@ -17,7 +17,7 @@ module Stepmod
|
|
17
17
|
# TODO: converted_definition is not supposed to be an attribute, it is
|
18
18
|
# supposed to be a method!
|
19
19
|
class << self
|
20
|
-
def parse(definition_xml, reference_anchor:, reference_clause:, file_path:, language_code: "
|
20
|
+
def parse(definition_xml, reference_anchor:, reference_clause:, file_path:, language_code: "eng")
|
21
21
|
converted_definition = Stepmod::Utils::StepmodDefinitionConverter.convert(
|
22
22
|
definition_xml,
|
23
23
|
{
|
@@ -21,13 +21,13 @@ module Stepmod
|
|
21
21
|
if !published_info.nil?
|
22
22
|
@pubid = Pubid::Iso::Identifier.parse(published_info)
|
23
23
|
|
24
|
-
@part = pubid.part
|
25
|
-
@version = pubid.edition
|
26
|
-
@pub_year = pubid.year
|
24
|
+
@part = pubid.part&.to_s
|
25
|
+
@version = pubid.edition&.to_s
|
26
|
+
@pub_year = pubid.year&.to_s
|
27
27
|
elsif !schema.version.nil?
|
28
|
-
@part = schema.version.items.find { |i| i.name == "part" }.value
|
29
|
-
@version = schema.version.items.find { |i| i.name == "part" }.value
|
30
|
-
@pub_year = schema.version.items.find { |i| i.name == "part" }.value
|
28
|
+
@part = schema.version.items.find { |i| i.name == "part" }.value&.to_s
|
29
|
+
@version = schema.version.items.find { |i| i.name == "part" }.value&.to_s
|
30
|
+
@pub_year = schema.version.items.find { |i| i.name == "part" }.value&.to_s
|
31
31
|
else
|
32
32
|
raise "PublishedInfoNotFound"
|
33
33
|
end
|
@@ -66,29 +66,53 @@ module Stepmod
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
def published_part_numbers
|
70
|
+
docs_xml = Nokogiri::XML(File.read(@stepmod_path.join('library/docs.xml')))
|
71
|
+
docs_xml.xpath("//doc").map do |x|
|
72
|
+
x['part']
|
73
|
+
end.uniq.sort
|
74
|
+
end
|
75
|
+
|
69
76
|
def call
|
70
77
|
log "INFO: STEPmod directory set to #{stepmod_dir}."
|
71
78
|
log "INFO: Detecting paths..."
|
72
79
|
|
73
|
-
# Run `cvs status` to find out version
|
74
80
|
log "INFO: Detecting Git SHA..."
|
75
81
|
Dir.chdir(stepmod_path) do
|
76
82
|
@git_rev = `git rev-parse HEAD` || nil
|
77
83
|
end
|
78
84
|
|
85
|
+
published_part_nos = published_part_numbers
|
79
86
|
repo_index = Nokogiri::XML(File.read(@index_path)).root
|
80
87
|
|
81
88
|
files = []
|
82
89
|
|
83
90
|
# add module paths
|
84
91
|
repo_index.xpath("//module").each do |x|
|
85
|
-
|
92
|
+
unless published_part_nos.include? x['part']
|
93
|
+
log "INFO: skipping module #{x['name']} as part #{x['part']} is not published in `docs.xml`."
|
94
|
+
next
|
95
|
+
end
|
86
96
|
|
87
|
-
|
88
|
-
|
97
|
+
if x['status'] == WITHDRAWN_STATUS
|
98
|
+
log "INFO: skipping module #{x['name']} as it is withdrawn."
|
99
|
+
next
|
100
|
+
end
|
89
101
|
|
90
|
-
|
91
|
-
|
102
|
+
arm_path = @stepmod_path.join("modules/#{x['name']}/arm_annotated.exp")
|
103
|
+
mim_path = @stepmod_path.join("modules/#{x['name']}/mim_annotated.exp")
|
104
|
+
|
105
|
+
if File.exist? arm_path
|
106
|
+
files << arm_path
|
107
|
+
else
|
108
|
+
log "INFO: skipping module ARM for #{x['name']} as it does not exist at #{arm_path}."
|
109
|
+
end
|
110
|
+
|
111
|
+
if File.exist? mim_path
|
112
|
+
files << mim_path
|
113
|
+
else
|
114
|
+
log "INFO: skipping module MIM for #{x['name']} as it does not exist at #{mim_path}."
|
115
|
+
end
|
92
116
|
end
|
93
117
|
|
94
118
|
# Should ignore these because the `<resource_docs>` elements do not provide any EXPRESS schemas
|
@@ -102,10 +126,27 @@ module Stepmod
|
|
102
126
|
|
103
127
|
# add resource paths
|
104
128
|
repo_index.xpath("//resource").each do |x|
|
105
|
-
|
129
|
+
unless published_part_nos.include? x['part']
|
130
|
+
log "INFO: skipping resource #{x['name']} as part #{x['part']} is not published in `docs.xml`."
|
131
|
+
next
|
132
|
+
end
|
133
|
+
|
134
|
+
if x['status'] == WITHDRAWN_STATUS
|
135
|
+
log "INFO: skipping resource #{x['name']} as it is withdrawn."
|
136
|
+
next
|
137
|
+
end
|
106
138
|
|
107
|
-
|
108
|
-
|
139
|
+
if x["name"] == "iso13584_expressions_schema"
|
140
|
+
log "INFO: skipping resource #{x['name']} as the ISO 13584 series is out of scope."
|
141
|
+
next
|
142
|
+
end
|
143
|
+
|
144
|
+
path = @stepmod_path.join("resources/#{x['name']}/#{x['name']}_annotated.exp")
|
145
|
+
if File.exist? path
|
146
|
+
files << path
|
147
|
+
else
|
148
|
+
log "INFO: skipping resource #{x['name']} as it does not exist at #{path}."
|
149
|
+
end
|
109
150
|
end
|
110
151
|
|
111
152
|
# Should ignore these because we are skiping Clause 3 terms
|
@@ -340,7 +381,7 @@ module Stepmod
|
|
340
381
|
},
|
341
382
|
],
|
342
383
|
notes: notes,
|
343
|
-
language_code: "
|
384
|
+
language_code: "eng",
|
344
385
|
part: bibdata.part,
|
345
386
|
schema: schema,
|
346
387
|
document: document,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stepmod-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|