suma 0.1.16 → 0.1.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 955161f5bfcd18f46e1fcafafdc05bea5a7310eaa8899b03552e7d22f6f41795
4
- data.tar.gz: ff06abeaf766ce76d814079ef718c6deb45e1dd0cae5d89e9d03d203e3a5635d
3
+ metadata.gz: 3fa571b528df159a9d83210a7f91f03cdb57cfa497dcaa312ad831392b4ab3ae
4
+ data.tar.gz: e536b9101471873b9ba3df2f422ec13221db3941e240c8731bcba1e79e361431
5
5
  SHA512:
6
- metadata.gz: 2568587bc47fe2eb892fc7e9f8f4981aceaa06eef4b27ad54cb427e9082cc23571a2c26f8ae9380dfcd52fbb40f38a77ad0d2282e7ada54d8744e3e21edcd301
7
- data.tar.gz: 4b8505d33b3eef150aeb76f23548f5983740d1940488a0ee1c7d6e515cd249e5fa74fbdadb72543a91104ca9ce609eb0f374dd01c033db8eee2bb7585525b09f
6
+ metadata.gz: 0a759070a8972bba5f92705f9abc5bc7e23038d1c92873b35457709dfeed1e3c5a03acfd426feca37760fe849e5d173faf742e84231d97544b13f38e91cba192
7
+ data.tar.gz: cca4eeff40165f757f60311ee9db9a33802cfb1733c5de09aba15f63dce4aca1d1d38c74af1701b8ce689fac41ee994fd6b6de90f231c6a3ce1b76a026b1fce1
data/.rubocop.yml CHANGED
@@ -8,7 +8,7 @@ plugins:
8
8
  - rubocop-rspec
9
9
 
10
10
  AllCops:
11
- TargetRubyVersion: 3.0
11
+ TargetRubyVersion: 3.1
12
12
  NewCops: enable
13
13
  Exclude:
14
14
  - 'vendor/**/*'
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-07-05 22:42:28 UTC using RuboCop version 1.77.0.
3
+ # on 2025-07-17 08:10:53 UTC using RuboCop version 1.78.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -13,7 +13,30 @@ Gemspec/DuplicatedAssignment:
13
13
  Exclude:
14
14
  - 'suma.gemspec'
15
15
 
16
- # Offense count: 57
16
+ # Offense count: 1
17
+ # Configuration parameters: Severity, Include.
18
+ # Include: **/*.gemspec
19
+ Gemspec/RequiredRubyVersion:
20
+ Exclude:
21
+ - 'suma.gemspec'
22
+
23
+ # Offense count: 17
24
+ # This cop supports safe autocorrection (--autocorrect).
25
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
26
+ # SupportedStyles: with_first_argument, with_fixed_indentation
27
+ Layout/ArgumentAlignment:
28
+ Exclude:
29
+ - 'lib/suma/cli/validate_ascii.rb'
30
+
31
+ # Offense count: 1
32
+ # This cop supports safe autocorrection (--autocorrect).
33
+ # Configuration parameters: EnforcedStyle.
34
+ # SupportedStyles: normal, indented_internal_methods
35
+ Layout/IndentationConsistency:
36
+ Exclude:
37
+ - 'lib/suma/glossarist_extensions.rb'
38
+
39
+ # Offense count: 90
17
40
  # This cop supports safe autocorrection (--autocorrect).
18
41
  # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
19
42
  # URISchemes: http, https
@@ -21,10 +44,10 @@ Layout/LineLength:
21
44
  Exclude:
22
45
  - 'lib/suma/cli.rb'
23
46
  - 'lib/suma/cli/build.rb'
24
- - 'lib/suma/cli/extract_terms.rb'
25
47
  - 'lib/suma/cli/validate.rb'
26
48
  - 'lib/suma/cli/validate_ascii.rb'
27
49
  - 'lib/suma/cli/validate_links.rb'
50
+ - 'lib/suma/glossarist_extensions.rb'
28
51
  - 'lib/suma/processor.rb'
29
52
  - 'lib/suma/schema_attachment.rb'
30
53
  - 'lib/suma/schema_collection.rb'
@@ -34,6 +57,13 @@ Layout/LineLength:
34
57
  - 'spec/suma/cli/validate_ascii_spec.rb'
35
58
  - 'suma.gemspec'
36
59
 
60
+ # Offense count: 22
61
+ # This cop supports safe autocorrection (--autocorrect).
62
+ # Configuration parameters: AllowInHeredoc.
63
+ Layout/TrailingWhitespace:
64
+ Exclude:
65
+ - 'lib/suma/cli/validate_ascii.rb'
66
+
37
67
  # Offense count: 1
38
68
  # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
39
69
  Lint/DuplicateBranch:
@@ -46,33 +76,48 @@ Lint/DuplicateMethods:
46
76
  - 'lib/suma/cli/validate_ascii.rb'
47
77
  - 'lib/suma/express_schema.rb'
48
78
 
49
- # Offense count: 20
79
+ # Offense count: 2
80
+ # This cop supports unsafe autocorrection (--autocorrect-all).
81
+ Lint/NonAtomicFileOperation:
82
+ Exclude:
83
+ - 'lib/suma/glossarist_extensions.rb'
84
+
85
+ # Offense count: 1
86
+ # This cop supports safe autocorrection (--autocorrect).
87
+ # Configuration parameters: AutoCorrect, IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
88
+ Lint/UnusedBlockArgument:
89
+ Exclude:
90
+ - 'lib/suma/glossarist_extensions.rb'
91
+
92
+ # Offense count: 23
50
93
  # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
51
94
  Metrics/AbcSize:
52
95
  Exclude:
53
96
  - 'lib/suma/cli/extract_terms.rb'
54
97
  - 'lib/suma/cli/validate_ascii.rb'
55
98
  - 'lib/suma/cli/validate_links.rb'
99
+ - 'lib/suma/glossarist_extensions.rb'
56
100
  - 'lib/suma/schema_attachment.rb'
57
101
  - 'lib/suma/schema_document.rb'
58
102
  - 'lib/suma/thor_ext.rb'
59
103
 
60
- # Offense count: 1
104
+ # Offense count: 3
61
105
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
62
106
  # AllowedMethods: refine
63
107
  Metrics/BlockLength:
64
108
  Max: 64
65
109
 
66
- # Offense count: 8
110
+ # Offense count: 9
67
111
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
68
112
  Metrics/CyclomaticComplexity:
69
113
  Exclude:
70
114
  - 'lib/suma/cli/extract_terms.rb'
71
115
  - 'lib/suma/cli/validate_ascii.rb'
72
116
  - 'lib/suma/cli/validate_links.rb'
117
+ - 'lib/suma/glossarist_extensions.rb'
73
118
  - 'lib/suma/thor_ext.rb'
74
119
 
75
- # Offense count: 30
120
+ # Offense count: 36
76
121
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
77
122
  Metrics/MethodLength:
78
123
  Max: 107
@@ -82,13 +127,14 @@ Metrics/MethodLength:
82
127
  Metrics/ParameterLists:
83
128
  Max: 6
84
129
 
85
- # Offense count: 5
130
+ # Offense count: 6
86
131
  # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
87
132
  Metrics/PerceivedComplexity:
88
133
  Exclude:
89
134
  - 'lib/suma/cli/extract_terms.rb'
90
135
  - 'lib/suma/cli/validate_ascii.rb'
91
136
  - 'lib/suma/cli/validate_links.rb'
137
+ - 'lib/suma/glossarist_extensions.rb'
92
138
 
93
139
  # Offense count: 5
94
140
  # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
@@ -114,13 +160,14 @@ RSpec/ExampleLength:
114
160
  RSpec/MultipleExpectations:
115
161
  Max: 12
116
162
 
117
- # Offense count: 1
163
+ # Offense count: 2
118
164
  # This cop supports safe autocorrection (--autocorrect).
119
165
  # Configuration parameters: AutoCorrect, EnforcedStyle, AllowComments.
120
166
  # SupportedStyles: empty, nil, both
121
167
  Style/EmptyElse:
122
168
  Exclude:
123
169
  - 'lib/suma/cli/validate_links.rb'
170
+ - 'lib/suma/glossarist_extensions.rb'
124
171
 
125
172
  # Offense count: 4
126
173
  # This cop supports safe autocorrection (--autocorrect).
@@ -129,8 +176,37 @@ Style/EmptyElse:
129
176
  Style/FormatStringToken:
130
177
  EnforcedStyle: unannotated
131
178
 
179
+ # Offense count: 2
180
+ # This cop supports unsafe autocorrection (--autocorrect-all).
181
+ # Configuration parameters: AllowedReceivers.
182
+ # AllowedReceivers: Thread.current
183
+ Style/HashEachMethods:
184
+ Exclude:
185
+ - 'lib/suma/glossarist_extensions.rb'
186
+
187
+ # Offense count: 2
188
+ # This cop supports unsafe autocorrection (--autocorrect-all).
189
+ Style/IdenticalConditionalBranches:
190
+ Exclude:
191
+ - 'lib/suma/glossarist_extensions.rb'
192
+
193
+ # Offense count: 3
194
+ # This cop supports unsafe autocorrection (--autocorrect-all).
195
+ # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
196
+ # AllowedMethods: present?, blank?, presence, try, try!
197
+ Style/SafeNavigation:
198
+ Exclude:
199
+ - 'lib/suma/glossarist_extensions.rb'
200
+
132
201
  # Offense count: 1
133
202
  # Configuration parameters: Max.
134
203
  Style/SafeNavigationChainLength:
135
204
  Exclude:
136
205
  - 'lib/suma/cli/extract_terms.rb'
206
+
207
+ # Offense count: 4
208
+ # This cop supports unsafe autocorrection (--autocorrect-all).
209
+ # Configuration parameters: Mode.
210
+ Style/StringConcatenation:
211
+ Exclude:
212
+ - 'lib/suma/cli/validate_ascii.rb'
data/README.adoc CHANGED
@@ -291,8 +291,9 @@ Replacement: AsciiMath: xx
291
291
 
292
292
  === Generate schemas command
293
293
 
294
- The `suma generate_schemas` command generates a schema manifest file containing
295
- all schemas defined in the Metanorma manifest file.
294
+ The `suma generate_schemas` command generates an EXPRESS schema manifest file
295
+ containing all schemas of documents referenced in the Metanorma manifest file,
296
+ recursively.
296
297
 
297
298
  [source,sh]
298
299
  ----
@@ -331,6 +332,10 @@ out which schemas the document includes.
331
332
 
332
333
  === Extract terms command
333
334
 
335
+ The "extract terms" command is implemented for ISO 10303-2, and could also be
336
+ used for other EXPRESS schema collections that require term extraction for
337
+ glossary or dictionary applications.
338
+
334
339
  The `suma extract_terms` command extracts terms from EXPRESS schemas and
335
340
  generates a Glossarist v2 dataset in the output directory. This command processes
336
341
  various types of STEP schemas and creates standardized terminology datasets
@@ -357,36 +362,35 @@ Options:
357
362
 
358
363
  The command supports extraction from the following EXPRESS schema types:
359
364
 
360
- * **ARM (Application Reference Model)** - Application module schemas ending with `_arm`
361
- * **MIM (Module Implementation Model)** - Application module schemas ending with `_mim`
365
+ * **ARM (application reference model)** - application module schemas ending with `_arm`
366
+ * **MIM (module implementation model)** - application module schemas ending with `_mim`
362
367
  * **Resource schemas** - General resource schemas
363
- * **BOM (Business Object Model)** - Business object model schemas ending with `_bom`
368
+ * **BOM (business object model)** - business object model schemas ending with `_bom`
369
+
370
+ NOTE: The "Long Form" EXPRESS schemas (ending with `_lf`) should be excluded
371
+ from the manifest file as they do not contain definitions of `ENTITY` objects.
364
372
 
365
- ==== Extracted terms
366
373
 
367
- The command extracts the following types of terms from EXPRESS schemas:
374
+ ==== Extracted concepts
368
375
 
369
- * **Entities** - EXPRESS entity definitions with their attributes and relationships
370
- * **Types** - EXPRESS type definitions including enumerations and select types
371
- * **Functions** - EXPRESS function definitions
372
- * **Procedures** - EXPRESS procedure definitions
373
- * **Constants** - EXPRESS constant definitions
376
+ The command extracts `ENTITY` objects from EXPRESS schemas, with the following
377
+ information:
374
378
 
375
- Each extracted term includes:
379
+ . a unique identifier in form of `{schema_name}.{entity_name}` (where `entity_name` is a slug
380
+ derived from the `ENTITY` name);
381
+ . a generated definition depending on the schema type and entity type;
382
+ . a "Note to entry" from its first coherent textual element described in Annotated EXPRESS;
383
+ . source information including: schema name and schema version;
384
+ . domain in the pattern of: `{domain_type}: {schema_name}`, where `domain_type` is one of
385
+ `application module`, `resource`, or `business object model`.
376
386
 
377
- * Unique identifier based on schema and term name
378
- * Term definition and description
379
- * Source schema information
380
- * Appropriate domain classification (application module, resource, or business object model)
381
387
 
382
388
  ==== Output format
383
389
 
384
390
  The command generates a Glossarist v2 compliant dataset with:
385
391
 
386
- * `concept/` directory containing concept definition files
387
- * `localized_concept/` directory containing localized concept files
388
- * YAML format following Glossarist v2 schema specifications
389
- * Proper cross-references and citations to source schemas
392
+ * `concept/` directory containing concept definition files in YAML
393
+ * `localized_concept/` directory containing localized concept files in YAML
390
394
 
391
395
  .To extract terms from a schema manifest file
392
396
  [example]
@@ -394,7 +398,8 @@ The command generates a Glossarist v2 compliant dataset with:
394
398
  [source,sh]
395
399
  ----
396
400
  $ bundle exec suma extract_terms schemas-smrl-all.yml glossarist_output
397
- # => generates glossarist_output/concept/*.yaml and glossarist_output/localized_concept/*.yaml
401
+ # => generates glossarist_output/concept/*.yaml and
402
+ # glossarist_output/localized_concept/*.yaml
398
403
  ----
399
404
  ====
400
405
 
@@ -408,7 +413,6 @@ $ bundle exec suma extract_terms schemas-activity-modules.yml terms_output
408
413
  ----
409
414
  ====
410
415
 
411
- The generated dataset is meant to be used for ISO 10303-2.
412
416
 
413
417
 
414
418
  == Usage: Ruby
@@ -103,6 +103,10 @@ module Suma
103
103
  language_code: language_code,
104
104
  source_ref: source_ref,
105
105
  )
106
+ localized_concept_id = get_localized_concept_identifier(
107
+ schema, entity, language_code
108
+ )
109
+ localized_concept.uuid = localized_concept_id
106
110
 
107
111
  managed_data = Glossarist::ManagedConceptData.new.tap do |data|
108
112
  data.id = get_entity_identifier(schema, entity)
@@ -111,9 +115,7 @@ module Suma
111
115
  data.localizations[language_code] = localized_concept
112
116
  # uuid is automatically set from the serialization of the object
113
117
  data.localized_concepts = {
114
- language_code => get_localized_concept_identifier(
115
- schema, entity, language_code
116
- ),
118
+ language_code => localized_concept_id,
117
119
  }
118
120
  end
119
121
 
@@ -64,8 +64,6 @@ module Suma
64
64
  def load_yaml(file_path)
65
65
  YAML.safe_load(
66
66
  File.read(file_path, encoding: "UTF-8"),
67
- permitted_classes: [Date, Time, Symbol],
68
- permitted_symbols: [],
69
67
  aliases: true,
70
68
  )
71
69
  end
data/lib/suma/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Suma
4
- VERSION = "0.1.16"
4
+ VERSION = "0.1.18"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: suma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.18
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-07-11 00:00:00.000000000 Z
11
+ date: 2025-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: expressir