stepmod-utils 0.3.23 → 0.3.25
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/.github/workflows/test-concept-generation.yml +38 -0
- data/.gitignore +3 -0
- data/.rubocop.yml +3 -0
- data/exe/stepmod-annotate-all +27 -14
- data/exe/stepmod-extract-changes +57 -0
- data/exe/stepmod-extract-concepts +165 -0
- data/lib/stepmod/utils/change.rb +74 -0
- data/lib/stepmod/utils/change_collection.rb +50 -0
- data/lib/stepmod/utils/change_edition.rb +60 -0
- data/lib/stepmod/utils/change_edition_collection.rb +38 -0
- data/lib/stepmod/utils/changes_extractor.rb +194 -0
- data/lib/stepmod/utils/concept.rb +40 -10
- data/lib/stepmod/utils/converters/description.rb +22 -0
- data/lib/stepmod/utils/express_bibdata.rb +111 -0
- data/lib/stepmod/utils/smrl_description_converter.rb +1 -0
- data/lib/stepmod/utils/stepmod_file_annotator.rb +215 -14
- data/lib/stepmod/utils/term.rb +18 -5
- data/lib/stepmod/utils/terms_extractor.rb +253 -292
- data/lib/stepmod/utils/version.rb +1 -1
- data/stepmod-utils.gemspec +2 -1
- metadata +31 -11
- data/exe/stepmod-build-resource-docs-cache +0 -20
- data/exe/stepmod-extract-terms +0 -237
- data/exe/stepmod-find-express-files +0 -24
data/stepmod-utils.gemspec
CHANGED
@@ -33,9 +33,10 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.add_runtime_dependency "concurrent-ruby"
|
35
35
|
spec.add_runtime_dependency "expressir"
|
36
|
-
spec.add_runtime_dependency "glossarist", "~>
|
36
|
+
spec.add_runtime_dependency "glossarist", "~> 1.0.5"
|
37
37
|
spec.add_runtime_dependency "indefinite_article"
|
38
38
|
spec.add_runtime_dependency "ptools"
|
39
|
+
spec.add_runtime_dependency "pubid-iso"
|
39
40
|
spec.add_runtime_dependency "reverse_adoc", ">= 0.3.5"
|
40
41
|
spec.add_runtime_dependency "thor", ">= 0.20.3"
|
41
42
|
spec.add_development_dependency "rubocop"
|
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.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 1.0.5
|
48
48
|
type: :runtime
|
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:
|
54
|
+
version: 1.0.5
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: indefinite_article
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pubid-iso
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: reverse_adoc
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,16 +171,16 @@ email:
|
|
157
171
|
- open.source@ribose.com
|
158
172
|
executables:
|
159
173
|
- stepmod-annotate-all
|
160
|
-
- stepmod-build-resource-docs-cache
|
161
174
|
- stepmod-convert-express-description
|
162
175
|
- stepmod-convert-express-resource
|
163
|
-
- stepmod-extract-
|
164
|
-
- stepmod-
|
176
|
+
- stepmod-extract-changes
|
177
|
+
- stepmod-extract-concepts
|
165
178
|
extensions: []
|
166
179
|
extra_rdoc_files: []
|
167
180
|
files:
|
168
181
|
- ".github/workflows/rake.yml"
|
169
182
|
- ".github/workflows/release.yml"
|
183
|
+
- ".github/workflows/test-concept-generation.yml"
|
170
184
|
- ".gitignore"
|
171
185
|
- ".hound.yml"
|
172
186
|
- ".rspec"
|
@@ -179,13 +193,17 @@ files:
|
|
179
193
|
- bin/console
|
180
194
|
- bin/setup
|
181
195
|
- exe/stepmod-annotate-all
|
182
|
-
- exe/stepmod-build-resource-docs-cache
|
183
196
|
- exe/stepmod-convert-express-description
|
184
197
|
- exe/stepmod-convert-express-resource
|
185
|
-
- exe/stepmod-extract-
|
186
|
-
- exe/stepmod-
|
198
|
+
- exe/stepmod-extract-changes
|
199
|
+
- exe/stepmod-extract-concepts
|
187
200
|
- lib/stepmod/utils.rb
|
188
201
|
- lib/stepmod/utils/bibdata.rb
|
202
|
+
- lib/stepmod/utils/change.rb
|
203
|
+
- lib/stepmod/utils/change_collection.rb
|
204
|
+
- lib/stepmod/utils/change_edition.rb
|
205
|
+
- lib/stepmod/utils/change_edition_collection.rb
|
206
|
+
- lib/stepmod/utils/changes_extractor.rb
|
189
207
|
- lib/stepmod/utils/cleaner.rb
|
190
208
|
- lib/stepmod/utils/concept.rb
|
191
209
|
- lib/stepmod/utils/converters/a.rb
|
@@ -199,6 +217,7 @@ files:
|
|
199
217
|
- lib/stepmod/utils/converters/dd.rb
|
200
218
|
- lib/stepmod/utils/converters/def.rb
|
201
219
|
- lib/stepmod/utils/converters/definition.rb
|
220
|
+
- lib/stepmod/utils/converters/description.rb
|
202
221
|
- lib/stepmod/utils/converters/dl.rb
|
203
222
|
- lib/stepmod/utils/converters/drop.rb
|
204
223
|
- lib/stepmod/utils/converters/dt.rb
|
@@ -241,6 +260,7 @@ files:
|
|
241
260
|
- lib/stepmod/utils/converters/term.rb
|
242
261
|
- lib/stepmod/utils/converters/text.rb
|
243
262
|
- lib/stepmod/utils/converters/uof.rb
|
263
|
+
- lib/stepmod/utils/express_bibdata.rb
|
244
264
|
- lib/stepmod/utils/html_to_asciimath.rb
|
245
265
|
- lib/stepmod/utils/smrl_description_converter.rb
|
246
266
|
- lib/stepmod/utils/smrl_resource_converter.rb
|
@@ -270,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
290
|
- !ruby/object:Gem::Version
|
271
291
|
version: '0'
|
272
292
|
requirements: []
|
273
|
-
rubygems_version: 3.
|
293
|
+
rubygems_version: 3.3.26
|
274
294
|
signing_key:
|
275
295
|
specification_version: 4
|
276
296
|
summary: Stepmod-utils is a toolkit that works on STEPmod data.
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "nokogiri"
|
4
|
-
require "json"
|
5
|
-
|
6
|
-
stepmod_dir = ARGV.first || Dir.pwd
|
7
|
-
|
8
|
-
schemas = {}
|
9
|
-
Dir.glob(File.join(stepmod_dir,
|
10
|
-
"data/resource_docs/*/resource.xml")).each do |resource_docs_file|
|
11
|
-
match = resource_docs_file.match("data/resource_docs/([^/]+)/resource.xml")
|
12
|
-
resource_docs_dir = match.captures[0]
|
13
|
-
|
14
|
-
resource_docs = Nokogiri::XML(File.read(resource_docs_file)).root
|
15
|
-
resource_docs.xpath("schema").each do |schema|
|
16
|
-
schemas[schema["name"]] = resource_docs_dir
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
puts JSON.pretty_generate(schemas)
|
data/exe/stepmod-extract-terms
DELETED
@@ -1,237 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: UTF-8
|
3
|
-
|
4
|
-
require "pry"
|
5
|
-
# resolve bin path, ignoring symlinks
|
6
|
-
require "pathname"
|
7
|
-
bin_file = Pathname.new(__FILE__).realpath
|
8
|
-
|
9
|
-
# add self to libpath
|
10
|
-
$:.unshift File.expand_path("../../lib", bin_file)
|
11
|
-
|
12
|
-
# Fixes https://github.com/rubygems/rubygems/issues/1420
|
13
|
-
require "rubygems/specification"
|
14
|
-
|
15
|
-
module Gem
|
16
|
-
class Specification
|
17
|
-
def this; self; end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
require "bundler/setup"
|
22
|
-
require "stepmod/utils/terms_extractor"
|
23
|
-
require 'optparse'
|
24
|
-
|
25
|
-
def log(message)
|
26
|
-
puts "[stepmod-utils] #{message}"
|
27
|
-
end
|
28
|
-
|
29
|
-
options = {}
|
30
|
-
OptionParser.new do |opts|
|
31
|
-
opts.banner = "Usage: #{$0} [options]"
|
32
|
-
|
33
|
-
opts.on("-p", "--path STEPMOD_DATA_PATH", String, "Path to STEPmod data directory") do |path|
|
34
|
-
options[:stepmod_dir] = path
|
35
|
-
end
|
36
|
-
|
37
|
-
opts.on("-i", "--index INDEX_PATH", String, "Path to repository_index.xml") do |path|
|
38
|
-
unless path.nil?
|
39
|
-
options[:index_path] = Pathname.new(path).to_s
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
opts.on_tail("-h", "--help", "Show this message") do
|
44
|
-
puts opts
|
45
|
-
exit
|
46
|
-
end
|
47
|
-
end.parse!
|
48
|
-
|
49
|
-
stepmod_dir = options[:stepmod_dir]
|
50
|
-
if stepmod_dir.nil?
|
51
|
-
raise StandardError.new("STEPmod data path not set, set with the `-p` option.")
|
52
|
-
else
|
53
|
-
log "STEPmod data path: `#{stepmod_dir}`"
|
54
|
-
end
|
55
|
-
|
56
|
-
index_path = options[:index_path] || File.join(stepmod_dir, "repository_index.xml")
|
57
|
-
unless File.exists?(index_path)
|
58
|
-
raise StandardError.new("Index file not present at #{index_path}, set with the `-i` option.")
|
59
|
-
else
|
60
|
-
log "Repository index path: `#{index_path}`"
|
61
|
-
end
|
62
|
-
|
63
|
-
general_concepts,
|
64
|
-
resource_concepts,
|
65
|
-
parsed_bibliography,
|
66
|
-
part_concepts,
|
67
|
-
part_resources,
|
68
|
-
part_modules = Stepmod::Utils::TermsExtractor.call(stepmod_dir, index_path)
|
69
|
-
|
70
|
-
def part_to_title(bibdata)
|
71
|
-
case bibdata.part.to_i
|
72
|
-
when 41
|
73
|
-
"Fundamentals of product description and support"
|
74
|
-
when 42
|
75
|
-
"Geometric and topological representation"
|
76
|
-
when 43
|
77
|
-
"Foundation representation"
|
78
|
-
when 44
|
79
|
-
"Product structure, concept and configuration"
|
80
|
-
when 45
|
81
|
-
"Material and other engineering properties"
|
82
|
-
when 46
|
83
|
-
"Visual presentation"
|
84
|
-
when 47
|
85
|
-
"Shape tolerance"
|
86
|
-
when 51
|
87
|
-
"Mathematical representation"
|
88
|
-
else
|
89
|
-
bibdata.title_en
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
IMAGE_REPLACEMENTS = {
|
94
|
-
'image::eq01.gif[]' => 'stem:[H(A,B) = max {h(A, B), h(B,A)}]',
|
95
|
-
'image::eq02.gif[]' => 'stem:[max_{a in A} { min_{b in B} d(a,b) }]',
|
96
|
-
'image::vector_z_c.gif[]' => 'stem:[bar z_{c}]',
|
97
|
-
'image::one_direction_repeat_factor_expression.gif[]' => 'stem:[I + k cdot R; k = -1, 1]',
|
98
|
-
'image::two_direction_repeat_factor_expression.gif[]' => 'stem:[I + k_1 cdot R_1 + k_2 cdot R_2; k_1, k_2 = -1, 0, 1, k^2_1 + k^2_2 != 0]',
|
99
|
-
}
|
100
|
-
|
101
|
-
TEXT_REPLACEMENTS = {
|
102
|
-
' (see <module_ref linkend="ply_orientation_specification:4_entities:figure:f2"> Figure 2</module_ref>)' => '',
|
103
|
-
' (see <module_ref linkend="ply_orientation_specification:4_entities:figure:f3"> Figure 3</module_ref>)' => ''
|
104
|
-
}
|
105
|
-
|
106
|
-
def replace_content(content)
|
107
|
-
IMAGE_REPLACEMENTS.each_pair do |k, v|
|
108
|
-
content.gsub!(k, v)
|
109
|
-
end
|
110
|
-
TEXT_REPLACEMENTS.each_pair do |k, v|
|
111
|
-
content.gsub!(k, v)
|
112
|
-
end
|
113
|
-
|
114
|
-
content
|
115
|
-
end
|
116
|
-
|
117
|
-
## Skip all Clause 3 terms
|
118
|
-
# part_concepts.each do |(bibdata, current_part_concepts)|
|
119
|
-
# current_part_concepts = current_part_concepts.to_a.map do |n|
|
120
|
-
# n.localizations["en"]
|
121
|
-
# end
|
122
|
-
# fn = "03x-stepmod-#{bibdata.part}.adoc"
|
123
|
-
# File.open(fn, "w") do |file|
|
124
|
-
# file.puts("== #{part_to_title(bibdata)}\n\n")
|
125
|
-
# file.puts(replace_images(current_part_concepts.map(&:to_mn_adoc).join("\n")))
|
126
|
-
# end
|
127
|
-
# log "INFO: written to: #{fn}"
|
128
|
-
# end
|
129
|
-
|
130
|
-
# File.open("03x-stepmod.adoc", "w") do |file|
|
131
|
-
# part_concepts.sort_by do |(bibdata, current_part_concepts)|
|
132
|
-
# bibdata.part.to_i
|
133
|
-
# end.each do |(bibdata, current_part_concepts)|
|
134
|
-
# fn = "03x-stepmod-#{bibdata.part}.adoc"
|
135
|
-
# file.puts("\ninclude::#{fn}[]\n")
|
136
|
-
# end
|
137
|
-
# end
|
138
|
-
|
139
|
-
# log "INFO: written summary file to: 03x-stepmod.adoc"
|
140
|
-
|
141
|
-
part_resources.each do |(bibdata, current_part_resources)|
|
142
|
-
current_part_resources = current_part_resources.to_a.map do |n|
|
143
|
-
n.localizations["en"]
|
144
|
-
end
|
145
|
-
fn = "04x-stepmod-entities-resources-#{bibdata.part}.adoc"
|
146
|
-
File.open(fn, "w") do |file|
|
147
|
-
# file.puts("== #{part_to_title(bibdata)}\n\n")
|
148
|
-
file.puts(replace_content(current_part_resources.map(&:to_mn_adoc).join("\n")))
|
149
|
-
end
|
150
|
-
log "INFO: written to: #{fn}"
|
151
|
-
end
|
152
|
-
|
153
|
-
File.open("04x-stepmod-entities-resources.adoc", "w") do |file|
|
154
|
-
part_resources.sort_by do |(bibdata, current_part_resources)|
|
155
|
-
bibdata.part.to_i
|
156
|
-
end.each do |(bibdata, current_part_resources)|
|
157
|
-
fn = "04x-stepmod-entities-resources-#{bibdata.part}.adoc"
|
158
|
-
file.puts("\ninclude::#{fn}[]\n")
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
log "INFO: written summary file to: 04x-stepmod-entities-resources.adoc"
|
163
|
-
|
164
|
-
part_modules.sort_by do |(bibdata, part_modules_arm, part_modules_mim)|
|
165
|
-
bibdata.part.to_i
|
166
|
-
end.each do |(bibdata, part_modules_arm, part_modules_mim)|
|
167
|
-
fn = "05x-stepmod-entities-modules-#{bibdata.part}.adoc"
|
168
|
-
File.open(fn, "w") do |file|
|
169
|
-
file.puts("")
|
170
|
-
|
171
|
-
unless part_modules_arm.empty?
|
172
|
-
schema_name = part_modules_arm.first.first
|
173
|
-
concepts = part_modules_arm.first.last.to_a.map do |n|
|
174
|
-
n.localizations["en"]
|
175
|
-
end
|
176
|
-
|
177
|
-
# puts "SCHEMA NAME ARM: #{schema_name}"
|
178
|
-
file.puts("== #{schema_name}\n\n")
|
179
|
-
file.puts(concepts.map(&:to_mn_adoc).join("\n"))
|
180
|
-
end
|
181
|
-
|
182
|
-
file.puts("")
|
183
|
-
|
184
|
-
unless part_modules_mim.empty?
|
185
|
-
schema_name = part_modules_mim.first.first
|
186
|
-
|
187
|
-
# puts "SCHEMA NAME MIM: #{schema_name}"
|
188
|
-
concepts = part_modules_mim.first.last.to_a.map do |n|
|
189
|
-
n.localizations["en"]
|
190
|
-
end
|
191
|
-
file.puts("== #{schema_name}\n\n")
|
192
|
-
file.puts(replace_content(concepts.map(&:to_mn_adoc).join("\n")))
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
log "INFO: written to: #{fn}"
|
197
|
-
end
|
198
|
-
|
199
|
-
File.open("05x-stepmod-entities-modules.adoc", "w") do |file|
|
200
|
-
part_modules.sort_by do |(bibdata, part_modules_arm, part_modules_mim)|
|
201
|
-
bibdata.part.to_i
|
202
|
-
end.each do |(bibdata, part_modules_arm, part_modules_mim)|
|
203
|
-
fn = "05x-stepmod-entities-modules-#{bibdata.part}.adoc"
|
204
|
-
file.puts("\ninclude::#{fn}[]\n")
|
205
|
-
end
|
206
|
-
end
|
207
|
-
|
208
|
-
log "INFO: written summary file to: 05x-stepmod-entities-modules.adoc"
|
209
|
-
|
210
|
-
## Skipping all Clause 3 terms
|
211
|
-
# File.open("031-stepmod-general.adoc", "w") do |file|
|
212
|
-
# file.puts(
|
213
|
-
# replace_images(
|
214
|
-
# general_concepts.to_a.map do |n|
|
215
|
-
# n.localizations["en"]
|
216
|
-
# end.map(&:to_mn_adoc).join("\n")
|
217
|
-
# )
|
218
|
-
# )
|
219
|
-
# end
|
220
|
-
|
221
|
-
# log "INFO: written to: 031-stepmod-general.adoc"
|
222
|
-
|
223
|
-
File.open("041-stepmod-entities-resources.adoc", "w") do |file|
|
224
|
-
file.puts(
|
225
|
-
replace_content(
|
226
|
-
resource_concepts.to_a.map do |n|
|
227
|
-
n.localizations["en"]
|
228
|
-
end.map(&:to_mn_adoc).join("\n")
|
229
|
-
)
|
230
|
-
)
|
231
|
-
end
|
232
|
-
log "INFO: written to: 041-stepmod-entities-resources.adoc"
|
233
|
-
|
234
|
-
File.open("991-generated-bibliography.adoc", "w") do |file|
|
235
|
-
file.puts(parsed_bibliography.map(&:to_mn_adoc).sort.uniq.join("\n"))
|
236
|
-
end
|
237
|
-
log "INFO: written to: 991-generated-bibliography.adoc"
|
@@ -1,24 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "nokogiri"
|
4
|
-
|
5
|
-
stepmod_dir = ARGV.first || Dir.pwd
|
6
|
-
|
7
|
-
index = Nokogiri::XML(File.read(File.join(stepmod_dir,
|
8
|
-
"repository_index.xml"))).root
|
9
|
-
|
10
|
-
files = []
|
11
|
-
index.xpath("modules/module").each do |item|
|
12
|
-
files << "#{stepmod_dir}/data/modules/#{item['name']}/arm.exp"
|
13
|
-
files << "#{stepmod_dir}/data/modules/#{item['name']}/mim.exp"
|
14
|
-
end
|
15
|
-
index.xpath("resources/resource").each do |item|
|
16
|
-
files << "#{stepmod_dir}/data/resources/#{item['name']}/#{item['name']}.exp"
|
17
|
-
end
|
18
|
-
index.xpath("business_object_models/business_object_model").each do |item|
|
19
|
-
files << "#{stepmod_dir}/data/business_object_models/#{item['name']}/bom.exp"
|
20
|
-
files << "#{stepmod_dir}/data/business_object_models/#{item['name']}/DomainModel.exp"
|
21
|
-
end
|
22
|
-
|
23
|
-
existing_files = files.filter { |file| File.exists?(file) }
|
24
|
-
puts existing_files
|