stepmod-utils 0.3.21 → 0.3.23
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/exe/stepmod-annotate-all +1 -1
- data/exe/stepmod-extract-terms +14 -6
- data/lib/stepmod/utils/concept.rb +2 -2
- data/lib/stepmod/utils/converters/express_figure.rb +25 -0
- data/lib/stepmod/utils/converters/express_table.rb +25 -0
- data/lib/stepmod/utils/converters/figure.rb +19 -1
- data/lib/stepmod/utils/converters/module_ref.rb +55 -17
- data/lib/stepmod/utils/converters/module_ref_express_description.rb +44 -2
- data/lib/stepmod/utils/converters/table.rb +14 -1
- data/lib/stepmod/utils/smrl_description_converter.rb +1 -0
- data/lib/stepmod/utils/smrl_resource_converter.rb +2 -1
- data/lib/stepmod/utils/stepmod_definition_converter.rb +1 -0
- data/lib/stepmod/utils/stepmod_file_annotator.rb +42 -6
- data/lib/stepmod/utils/terms_extractor.rb +22 -30
- data/lib/stepmod/utils/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96740d6528de476007a4f312fa8889887e77a27d4a693924531813188a3cd60b
|
4
|
+
data.tar.gz: 867240182ffe77c721fe7ffa8ee53b77383db9954cffa9c4de723e652ec90780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e5b71123d326d72e7f6f64269238e2c0db08cec4033794a1a104088d8ae3c0b7e9b005b2551bb2541b06d676fb6959120a7bd1aac30c3cc63068e581206d8c3
|
7
|
+
data.tar.gz: 9aba582cd94d7c7b85fd9bc8ad2e718c0bf23f6609a86de46393c55a85bda496fecbe9f8c847fd073a5aa1ca351148917520a490d695769fde21d118428fbe98
|
data/exe/stepmod-annotate-all
CHANGED
@@ -13,7 +13,7 @@ resource_docs_cache_file = `mktemp`
|
|
13
13
|
# annotate each file
|
14
14
|
files = `"#{File.join(__dir__,
|
15
15
|
"stepmod-find-express-files")}" "#{stepmod_dir}"`.strip.split("\n")
|
16
|
-
MAX_THREADS = [2, Concurrent.processor_count].max * 2
|
16
|
+
MAX_THREADS = 1 #[2, Concurrent.processor_count].max * 2
|
17
17
|
MAX_QUEUE_SIZE = MAX_THREADS * 4
|
18
18
|
# https://github.com/ruby-concurrency/concurrent-ruby/blob/master/docs-source/thread_pools.md
|
19
19
|
pool = Concurrent::ThreadPoolExecutor.new(
|
data/exe/stepmod-extract-terms
CHANGED
@@ -94,14 +94,22 @@ IMAGE_REPLACEMENTS = {
|
|
94
94
|
'image::eq01.gif[]' => 'stem:[H(A,B) = max {h(A, B), h(B,A)}]',
|
95
95
|
'image::eq02.gif[]' => 'stem:[max_{a in A} { min_{b in B} d(a,b) }]',
|
96
96
|
'image::vector_z_c.gif[]' => 'stem:[bar z_{c}]',
|
97
|
-
'image::one_direction_repeat_factor_expression.gif[]' => 'stem:[I + k cdot R;
|
98
|
-
'image::two_direction_repeat_factor_expression.gif[]' => 'stem:[I + k_1 cdot R_1 + k_2 cdot R_2;
|
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
99
|
}
|
100
100
|
|
101
|
-
|
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)
|
102
107
|
IMAGE_REPLACEMENTS.each_pair do |k, v|
|
103
108
|
content.gsub!(k, v)
|
104
109
|
end
|
110
|
+
TEXT_REPLACEMENTS.each_pair do |k, v|
|
111
|
+
content.gsub!(k, v)
|
112
|
+
end
|
105
113
|
|
106
114
|
content
|
107
115
|
end
|
@@ -137,7 +145,7 @@ part_resources.each do |(bibdata, current_part_resources)|
|
|
137
145
|
fn = "04x-stepmod-entities-resources-#{bibdata.part}.adoc"
|
138
146
|
File.open(fn, "w") do |file|
|
139
147
|
# file.puts("== #{part_to_title(bibdata)}\n\n")
|
140
|
-
file.puts(
|
148
|
+
file.puts(replace_content(current_part_resources.map(&:to_mn_adoc).join("\n")))
|
141
149
|
end
|
142
150
|
log "INFO: written to: #{fn}"
|
143
151
|
end
|
@@ -181,7 +189,7 @@ end.each do |(bibdata, part_modules_arm, part_modules_mim)|
|
|
181
189
|
n.localizations["en"]
|
182
190
|
end
|
183
191
|
file.puts("== #{schema_name}\n\n")
|
184
|
-
file.puts(
|
192
|
+
file.puts(replace_content(concepts.map(&:to_mn_adoc).join("\n")))
|
185
193
|
end
|
186
194
|
end
|
187
195
|
|
@@ -214,7 +222,7 @@ log "INFO: written summary file to: 05x-stepmod-entities-modules.adoc"
|
|
214
222
|
|
215
223
|
File.open("041-stepmod-entities-resources.adoc", "w") do |file|
|
216
224
|
file.puts(
|
217
|
-
|
225
|
+
replace_content(
|
218
226
|
resource_concepts.to_a.map do |n|
|
219
227
|
n.localizations["en"]
|
220
228
|
end.map(&:to_mn_adoc).join("\n")
|
@@ -17,7 +17,7 @@ module Stepmod
|
|
17
17
|
converted_definition = Stepmod::Utils::StepmodDefinitionConverter.convert(
|
18
18
|
definition_xml,
|
19
19
|
{
|
20
|
-
# We don't want examples and
|
20
|
+
# We don't want examples, notes, figures and tables
|
21
21
|
no_notes_examples: true,
|
22
22
|
reference_anchor: reference_anchor,
|
23
23
|
},
|
@@ -87,7 +87,7 @@ module Stepmod
|
|
87
87
|
.convert(
|
88
88
|
Nokogiri::XML(wrapper).root,
|
89
89
|
{
|
90
|
-
# We don't want examples and
|
90
|
+
# We don't want examples, notes, figures and tables
|
91
91
|
no_notes_examples: true,
|
92
92
|
reference_anchor: reference_anchor,
|
93
93
|
},
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "./figure"
|
3
|
+
|
4
|
+
module Stepmod
|
5
|
+
module Utils
|
6
|
+
module Converters
|
7
|
+
class ExpressFigure < Stepmod::Utils::Converters::Figure
|
8
|
+
|
9
|
+
# def self.pattern(state, id)
|
10
|
+
# "figure-exp-#{id}"
|
11
|
+
# end
|
12
|
+
|
13
|
+
def convert(node, state = {})
|
14
|
+
<<~TEMPLATE
|
15
|
+
(*"#{state[:schema_and_entity]}.__figure"
|
16
|
+
#{super(node, state.merge(no_notes_examples: nil)).strip}
|
17
|
+
*)
|
18
|
+
TEMPLATE
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
ReverseAdoc::Converters.register :express_figure, ExpressFigure.new
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "./table"
|
3
|
+
|
4
|
+
module Stepmod
|
5
|
+
module Utils
|
6
|
+
module Converters
|
7
|
+
class ExpressTable < Stepmod::Utils::Converters::Table
|
8
|
+
|
9
|
+
# def self.pattern(id)
|
10
|
+
# "table-exp-#{id}"
|
11
|
+
# end
|
12
|
+
|
13
|
+
def convert(node, state = {})
|
14
|
+
<<~TEMPLATE
|
15
|
+
(*"#{state[:schema_and_entity]}.__table"
|
16
|
+
#{super(node, state.merge(no_notes_examples: nil)).strip}
|
17
|
+
*)
|
18
|
+
TEMPLATE
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
ReverseAdoc::Converters.register :express_table, ExpressTable.new
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -6,13 +6,31 @@ module Stepmod
|
|
6
6
|
module Utils
|
7
7
|
module Converters
|
8
8
|
class Figure < ReverseAdoc::Converters::Figure
|
9
|
+
|
10
|
+
def self.pattern(state, id)
|
11
|
+
if state[:schema_and_entity].nil?
|
12
|
+
raise StandardError.new("[figure]: no state given, #{id}")
|
13
|
+
end
|
14
|
+
|
15
|
+
schema = state[:schema_and_entity].split(".").first
|
16
|
+
"figure-#{schema}-#{id}"
|
17
|
+
end
|
18
|
+
|
9
19
|
def convert(node, state = {})
|
10
20
|
# If we want to skip this node
|
11
21
|
return "" if state[:no_notes_examples]
|
12
22
|
|
13
|
-
|
23
|
+
# Set ID to "figure-id" in case of conflicts
|
24
|
+
node['id'] = if node['id']
|
25
|
+
self.class.pattern(state, node['id'])
|
26
|
+
else
|
27
|
+
self.class.pattern(state, node['number'])
|
28
|
+
end
|
29
|
+
|
30
|
+
super(node, state)
|
14
31
|
end
|
15
32
|
end
|
33
|
+
|
16
34
|
# This replaces the converter
|
17
35
|
ReverseAdoc::Converters.register :figure, Figure.new
|
18
36
|
end
|
@@ -5,31 +5,69 @@ module Stepmod
|
|
5
5
|
module Converters
|
6
6
|
class ModuleRef < ReverseAdoc::Converters::Base
|
7
7
|
def convert(node, _state = {})
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
link_end = node["linkend"].to_s.split(":")
|
9
|
+
ref_id = link_end.last
|
10
|
+
parts = link_end.last.split(".")
|
11
|
+
text = node.text.gsub(/\s/, " ").squeeze(" ").strip
|
12
|
+
schema = link_end.first
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
if _state[:schema_and_entity].nil?
|
15
|
+
# puts "[module_ref] setting node state #{link_end.inspect}"
|
16
|
+
_state[:schema_and_entity] = schema
|
17
|
+
end
|
18
|
+
|
19
|
+
result = case link_end[1]
|
20
|
+
when "1_scope", "introduction"
|
21
|
+
# When we see this:
|
22
|
+
# <module_ref linkend="functional_usage_view:1_scope">Functional usage view</module_ref>
|
23
|
+
# <module_ref linkend="part_definition_relationship:introduction"> Part definition relationship</module_ref>
|
24
|
+
# We convert into:
|
25
|
+
# <<express:functional_usage_view>>
|
26
|
+
# <<express:part_definition_relationship>>
|
27
|
+
|
28
|
+
"<<express:#{schema}>>"
|
29
|
+
|
30
|
+
when "3_definition"
|
31
|
+
# #23:
|
32
|
+
# When we see this:
|
33
|
+
# <module_ref linkend="product_as_individual:3_definition">individual products</module_ref>
|
34
|
+
# We convert to this:
|
35
|
+
# {{individual products}}
|
14
36
|
|
15
|
-
|
37
|
+
"{{#{text}}}"
|
16
38
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
"
|
39
|
+
when "4_types"
|
40
|
+
# When we see this:
|
41
|
+
# <module_ref linkend="activity_method_assignment:4_types">activity_method_item</module_ref>
|
42
|
+
# We convert to this:
|
43
|
+
# <<express:activity_method_assignment.activity_method_item>>
|
44
|
+
"<<express:#{[schema, text].join('.')},#{text}>>"
|
45
|
+
when "4_entities", "f_usage_guide"
|
46
|
+
case link_end[2]
|
47
|
+
when "figure"
|
48
|
+
# When we see this:
|
49
|
+
# <module_ref linkend="assembly_module_design:4_entities:figure:pudv">Figure 1</module_ref>
|
50
|
+
# We convert to this:
|
51
|
+
# <<figure-pudv,Figure 1>>
|
52
|
+
"<<#{Figure.pattern(_state,ref_id)},#{text}>>"
|
53
|
+
when "table"
|
54
|
+
# When we see this:
|
55
|
+
# <module_ref linkend="independent_property_definition:4_entities:table:T1">Table 1</module_ref>
|
56
|
+
# We convert to this:
|
57
|
+
# <<table-T1,Table 1>>
|
58
|
+
"<<#{Table.pattern(_state,ref_id)},#{text}>>"
|
59
|
+
end
|
60
|
+
else
|
61
|
+
puts "[module_ref]: encountered unknown <module_ref> tag, #{link_end.join(":")}"
|
62
|
+
raise StandardError.new("[module_ref]: encountered unknown <module_ref> tag, #{link_end.join(":")}")
|
23
63
|
end
|
64
|
+
|
65
|
+
# puts "[module_ref] #{result}"
|
66
|
+
result
|
24
67
|
end
|
25
68
|
|
26
69
|
private
|
27
70
|
|
28
|
-
def normalized_ref(ref)
|
29
|
-
return unless ref || ref.empty?
|
30
|
-
|
31
|
-
ref.squeeze(" ").strip
|
32
|
-
end
|
33
71
|
end
|
34
72
|
ReverseAdoc::Converters.register :module_ref, ModuleRef.new
|
35
73
|
end
|
@@ -1,10 +1,52 @@
|
|
1
|
+
|
2
|
+
require "stepmod/utils/converters/figure"
|
3
|
+
require "stepmod/utils/converters/table"
|
4
|
+
|
1
5
|
module Stepmod
|
2
6
|
module Utils
|
3
7
|
module Converters
|
4
8
|
class ModuleRefExpressDescription < ReverseAdoc::Converters::Base
|
5
9
|
def convert(node, _state = {})
|
6
|
-
|
7
|
-
|
10
|
+
link_end = node["linkend"].to_s.split(":")
|
11
|
+
ref_id = link_end.last
|
12
|
+
parts = link_end.last.split(".")
|
13
|
+
text = node.text.gsub(/\s/, " ").squeeze(" ").strip
|
14
|
+
|
15
|
+
# puts "linkend #{node["linkend"]}"
|
16
|
+
|
17
|
+
result = case link_end[1]
|
18
|
+
when "1_scope", "introduction"
|
19
|
+
# When we see this:
|
20
|
+
# <module_ref linkend="functional_usage_view:1_scope">Functional usage view</module_ref>
|
21
|
+
# <module_ref linkend="part_definition_relationship:introduction"> Part definition relationship</module_ref>
|
22
|
+
# We convert into:
|
23
|
+
# <<express:functional_usage_view>>
|
24
|
+
# <<express:part_definition_relationship>>
|
25
|
+
|
26
|
+
"<<express:#{link_end.first}>>"
|
27
|
+
|
28
|
+
when "3_definition"
|
29
|
+
# #23:
|
30
|
+
# When we see this:
|
31
|
+
# <module_ref linkend="product_as_individual:3_definition">individual products</module_ref>
|
32
|
+
# We convert to this:
|
33
|
+
# {{individual products}}
|
34
|
+
|
35
|
+
"{{#{text}}}"
|
36
|
+
|
37
|
+
when "4_types"
|
38
|
+
# ISO 10303-2 does not contain TYPEs, ignore
|
39
|
+
""
|
40
|
+
when "4_entities", "f_usage_guide"
|
41
|
+
# ISO 10303-2 does not contain figures and tables, ignore
|
42
|
+
""
|
43
|
+
else
|
44
|
+
puts "[module_ref_express_description]: encountered unknown <module_ref> tag, #{link_end.join(":")}"
|
45
|
+
raise StandardError.new("[module_ref_express_description]: encountered unknown <module_ref> tag, #{link_end.join(":")}")
|
46
|
+
end
|
47
|
+
|
48
|
+
# puts "[module_ref] #{result}"
|
49
|
+
result
|
8
50
|
end
|
9
51
|
end
|
10
52
|
ReverseAdoc::Converters.register :module_ref,
|
@@ -4,9 +4,22 @@ module Stepmod
|
|
4
4
|
module Utils
|
5
5
|
module Converters
|
6
6
|
class Table < ReverseAdoc::Converters::Base
|
7
|
+
|
8
|
+
def self.pattern(state, id)
|
9
|
+
if state[:schema_and_entity].nil?
|
10
|
+
raise StandardError.new("[table]: no state given, #{id}")
|
11
|
+
end
|
12
|
+
|
13
|
+
schema = state[:schema_and_entity].split(".").first
|
14
|
+
"table-#{schema}-#{id}"
|
15
|
+
end
|
16
|
+
|
7
17
|
def convert(node, state = {})
|
18
|
+
# If we want to skip this node
|
19
|
+
return "" if state[:no_notes_examples]
|
20
|
+
|
8
21
|
id = node["id"]
|
9
|
-
anchor = id ? "[[
|
22
|
+
anchor = id ? "[[table-#{self.class.pattern(state, id)}]]\n" : ""
|
10
23
|
title = node["caption"].to_s
|
11
24
|
title = ".#{title}\n" unless title.empty?
|
12
25
|
attrs = style(node)
|
@@ -15,6 +15,7 @@ require "stepmod/utils/converters/ext_descriptions"
|
|
15
15
|
require "stepmod/utils/converters/head"
|
16
16
|
require "stepmod/utils/converters/hr"
|
17
17
|
require "stepmod/utils/converters/ignore"
|
18
|
+
require "stepmod/utils/converters/module_ref_express_description"
|
18
19
|
require "stepmod/utils/converters/note"
|
19
20
|
require "stepmod/utils/converters/p"
|
20
21
|
require "stepmod/utils/converters/pass_through"
|
@@ -15,6 +15,7 @@ require "stepmod/utils/converters/dt"
|
|
15
15
|
require "stepmod/utils/converters/drop"
|
16
16
|
require "stepmod/utils/converters/example"
|
17
17
|
require "stepmod/utils/converters/express_g"
|
18
|
+
require "stepmod/utils/converters/figure"
|
18
19
|
require "stepmod/utils/converters/fund_cons"
|
19
20
|
require "stepmod/utils/converters/eqn"
|
20
21
|
require "stepmod/utils/converters/head"
|
@@ -25,6 +26,7 @@ require "stepmod/utils/converters/note"
|
|
25
26
|
require "stepmod/utils/converters/ol"
|
26
27
|
require "stepmod/utils/converters/p"
|
27
28
|
require "stepmod/utils/converters/pass_through"
|
29
|
+
require "stepmod/utils/converters/module_ref"
|
28
30
|
require "stepmod/utils/converters/q"
|
29
31
|
require "stepmod/utils/converters/resource"
|
30
32
|
require "stepmod/utils/converters/schema_diag"
|
@@ -36,7 +38,6 @@ require "stepmod/utils/converters/table"
|
|
36
38
|
require "stepmod/utils/converters/text"
|
37
39
|
require "stepmod/utils/cleaner"
|
38
40
|
|
39
|
-
require "reverse_adoc/converters/figure"
|
40
41
|
require "reverse_adoc/converters/img"
|
41
42
|
require "reverse_adoc/converters/li"
|
42
43
|
require "reverse_adoc/converters/tr"
|
@@ -17,6 +17,7 @@ require "stepmod/utils/converters/term"
|
|
17
17
|
require "stepmod/utils/converters/synonym"
|
18
18
|
require "stepmod/utils/converters/uof"
|
19
19
|
require "stepmod/utils/converters/figure"
|
20
|
+
require "stepmod/utils/converters/table"
|
20
21
|
require "stepmod/utils/cleaner"
|
21
22
|
|
22
23
|
require "reverse_adoc/converters/a"
|
@@ -3,6 +3,8 @@ require "stepmod/utils/smrl_description_converter"
|
|
3
3
|
require "stepmod/utils/smrl_resource_converter"
|
4
4
|
require "stepmod/utils/converters/express_note"
|
5
5
|
require "stepmod/utils/converters/express_example"
|
6
|
+
require "stepmod/utils/converters/express_figure"
|
7
|
+
require "stepmod/utils/converters/express_table"
|
6
8
|
|
7
9
|
module Stepmod
|
8
10
|
module Utils
|
@@ -59,6 +61,9 @@ module Stepmod
|
|
59
61
|
end
|
60
62
|
|
61
63
|
output_express
|
64
|
+
rescue StandardError => e
|
65
|
+
puts "[ERROR]!!! #{e.message}"
|
66
|
+
puts e.backtrace
|
62
67
|
end
|
63
68
|
|
64
69
|
private
|
@@ -68,16 +73,28 @@ module Stepmod
|
|
68
73
|
wrapper = "<ext_descriptions>#{description}</ext_descriptions>"
|
69
74
|
notes = description.xpath("note")
|
70
75
|
examples = description.xpath("example")
|
76
|
+
figures = description.xpath("figure")
|
77
|
+
tables = description.xpath("table")
|
71
78
|
|
72
79
|
converted_description = <<~DESCRIPTION
|
73
80
|
|
74
81
|
#{Stepmod::Utils::SmrlDescriptionConverter.convert(wrapper, no_notes_examples: true)}
|
75
82
|
DESCRIPTION
|
76
83
|
|
77
|
-
|
78
|
-
|
84
|
+
if description["linkend"].nil?
|
85
|
+
raise StandardError.new("[stepmod-file-annotator] ERROR: no linkend for #{descriptions_file}!")
|
86
|
+
end
|
87
|
+
|
88
|
+
converted_figures = figures.map do |figure|
|
89
|
+
Stepmod::Utils::Converters::ExpressFigure
|
79
90
|
.new
|
80
|
-
.convert(
|
91
|
+
.convert(figure, schema_and_entity: description["linkend"])
|
92
|
+
end.join
|
93
|
+
|
94
|
+
converted_tables = tables.map do |table|
|
95
|
+
Stepmod::Utils::Converters::ExpressTable
|
96
|
+
.new
|
97
|
+
.convert(table, schema_and_entity: description["linkend"])
|
81
98
|
end.join
|
82
99
|
|
83
100
|
converted_notes = notes.map do |note|
|
@@ -86,20 +103,39 @@ module Stepmod
|
|
86
103
|
.convert(note, schema_and_entity: description["linkend"])
|
87
104
|
end.join
|
88
105
|
|
89
|
-
|
106
|
+
converted_examples = examples.map do |example|
|
107
|
+
Stepmod::Utils::Converters::ExpressExample
|
108
|
+
.new
|
109
|
+
.convert(example, schema_and_entity: description["linkend"])
|
110
|
+
end.join
|
111
|
+
|
112
|
+
[
|
113
|
+
converted_description,
|
114
|
+
converted_figures,
|
115
|
+
converted_tables,
|
116
|
+
converted_examples,
|
117
|
+
converted_notes,
|
118
|
+
].join("")
|
90
119
|
end
|
91
120
|
end
|
92
121
|
|
93
122
|
def convert_from_resource_file(resource_docs_dir, stepmod_dir, linked, descriptions_file)
|
94
123
|
resource_docs_file = File.join(stepmod_dir, "data/resource_docs",
|
95
124
|
resource_docs_dir, "resource.xml")
|
96
|
-
puts(resource_docs_file)
|
125
|
+
# puts(resource_docs_file)
|
97
126
|
resource_docs = Nokogiri::XML(File.read(resource_docs_file)).root
|
98
127
|
schema = resource_docs.xpath("schema[@name='#{linked}']")
|
99
128
|
|
100
129
|
Dir.chdir(File.dirname(descriptions_file)) do
|
101
130
|
wrapper = "<resource>#{schema}</resource>"
|
102
|
-
|
131
|
+
|
132
|
+
"\n" + Stepmod::Utils::SmrlResourceConverter.convert(
|
133
|
+
wrapper,
|
134
|
+
{
|
135
|
+
no_notes_examples: false,
|
136
|
+
schema_and_entity: linked
|
137
|
+
}
|
138
|
+
)
|
103
139
|
end
|
104
140
|
end
|
105
141
|
end
|
@@ -476,44 +476,36 @@ module Stepmod
|
|
476
476
|
entity_id.downcase.gsub(/_/, " ")
|
477
477
|
end
|
478
478
|
|
479
|
+
# No longer used
|
480
|
+
# def entity_ref(entity_id)
|
481
|
+
# if entity_id == entity_name_to_text(entity_id)
|
482
|
+
# "{{#{entity_id}}}"
|
483
|
+
# else
|
484
|
+
# "{{#{entity_id},#{entity_name_to_text(entity_id)}}}"
|
485
|
+
# end
|
486
|
+
# end
|
487
|
+
|
479
488
|
# rubocop:disable Layout/LineLength
|
480
489
|
def generate_entity_definition(entity, domain, old_definition)
|
481
490
|
return "" if entity.nil?
|
482
491
|
|
483
492
|
# See: metanorma/iso-10303-2#90
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
entity_ref = if entity.id == entity_name_to_text(entity.id)
|
488
|
-
"{{#{entity.id}}}"
|
489
|
-
else
|
490
|
-
"{{#{entity.id},#{entity_name_to_text(entity.id)}}}"
|
491
|
-
end
|
492
|
-
|
493
|
-
if entity.subtype_of.size.zero?
|
494
|
-
"#{domain_type[1]} that represents the " + entity_ref + " entity"
|
495
|
-
else
|
496
|
-
entity_subtypes = entity.subtype_of.map do |e|
|
497
|
-
"{{#{e.id},#{entity_name_to_text(e.id)}}}"
|
498
|
-
end
|
499
|
-
"#{domain_type[1]} that is a type of " +
|
500
|
-
"#{entity_subtypes.join(' and ')} that represents the " +
|
501
|
-
entity_ref + " entity"
|
502
|
-
end
|
503
|
-
|
493
|
+
entity_type = if domain_type = domain.match(/\A(application object):/)
|
494
|
+
"{{#{domain_type[1]}}}"
|
504
495
|
else
|
496
|
+
"{{entity data type}}"
|
497
|
+
end
|
505
498
|
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
end
|
513
|
-
"entity data type that is a type of " +
|
514
|
-
"#{entity_subtypes.join(' and ')} that represents the " +
|
515
|
-
"{{#{entity.id}}} entity"
|
499
|
+
entity_text = if entity.subtype_of.size.zero?
|
500
|
+
"#{entity_type} " +
|
501
|
+
"that represents the " + entity_name_to_text(entity.id) + " {{entity}}"
|
502
|
+
else
|
503
|
+
entity_subtypes = entity.subtype_of.map do |e|
|
504
|
+
"{{#{e.id}}}"
|
516
505
|
end
|
506
|
+
"#{entity_type} that is a type of " +
|
507
|
+
"#{entity_subtypes.join(' and ')} " +
|
508
|
+
"that represents the " + entity_name_to_text(entity.id) + " {{entity}}"
|
517
509
|
end
|
518
510
|
|
519
511
|
definition = <<~DEFINITION
|
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.23
|
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-09-
|
11
|
+
date: 2022-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -207,10 +207,12 @@ files:
|
|
207
207
|
- lib/stepmod/utils/converters/eqn.rb
|
208
208
|
- lib/stepmod/utils/converters/example.rb
|
209
209
|
- lib/stepmod/utils/converters/express_example.rb
|
210
|
+
- lib/stepmod/utils/converters/express_figure.rb
|
210
211
|
- lib/stepmod/utils/converters/express_g.rb
|
211
212
|
- lib/stepmod/utils/converters/express_note.rb
|
212
213
|
- lib/stepmod/utils/converters/express_ref.rb
|
213
214
|
- lib/stepmod/utils/converters/express_ref_express_description.rb
|
215
|
+
- lib/stepmod/utils/converters/express_table.rb
|
214
216
|
- lib/stepmod/utils/converters/ext_description.rb
|
215
217
|
- lib/stepmod/utils/converters/ext_descriptions.rb
|
216
218
|
- lib/stepmod/utils/converters/figure.rb
|