suma 0.3.0 → 0.4.0

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.
@@ -64,7 +64,9 @@ module Suma
64
64
 
65
65
  raise Error, "Schema must have an associated file" unless schema.file
66
66
 
67
- collection = build_managed_concept_collection(schema)
67
+ classification = TermClassification.for_schema(id: schema.id,
68
+ path: schema.file)
69
+ collection = build_managed_concept_collection(schema, classification)
68
70
  output_data(collection)
69
71
  collection
70
72
  end
@@ -86,7 +88,7 @@ module Suma
86
88
  end
87
89
  end
88
90
 
89
- def build_managed_concept_collection(schema)
91
+ def build_managed_concept_collection(schema, classification)
90
92
  source_ref = get_source_ref(schema)
91
93
  section_ref = get_section_ref(schema)
92
94
 
@@ -102,6 +104,7 @@ module Suma
102
104
  entity: entity,
103
105
  source_ref: source_ref,
104
106
  uuid: localized_concept_id,
107
+ classification: classification,
105
108
  )
106
109
 
107
110
  managed_data = Glossarist::V3::ManagedConceptData.new.tap do |data|
@@ -126,12 +129,13 @@ module Suma
126
129
  end
127
130
  end
128
131
 
129
- def build_localized_concept(schema:, entity:, source_ref:, uuid:)
130
- schema_domain = get_domain(schema)
132
+ def build_localized_concept(schema:, entity:, source_ref:, uuid:,
133
+ classification:)
134
+ schema_domain = classification.domain_for(schema.id)
131
135
 
132
136
  localized_concept_data = Glossarist::V3::ConceptData.new.tap do |data|
133
137
  data.terms = get_entity_terms(entity)
134
- data.definition = get_entity_definitions(entity, schema)
138
+ data.definition = get_entity_definitions(entity, schema, classification)
135
139
  data.language_code = @language_code
136
140
  data.domain = schema_domain
137
141
  data.sources = [source_ref] if source_ref
@@ -200,16 +204,6 @@ module Suma
200
204
  localities
201
205
  end
202
206
 
203
- def get_domain(schema)
204
- prefix = if schema.id.end_with?("_arm", "_mim")
205
- "application module"
206
- else
207
- "resource"
208
- end
209
-
210
- "#{prefix}: #{schema.id}"
211
- end
212
-
213
207
  def get_entity_terms(entity)
214
208
  [
215
209
  Glossarist::Designation::Base.new(
@@ -220,11 +214,8 @@ module Suma
220
214
  ]
221
215
  end
222
216
 
223
- def get_entity_definitions(entity, schema)
224
- schema_type = extract_file_type(schema.file)
225
- get_domain(schema)
226
-
227
- definition = generate_entity_definition(entity, schema, schema_type)
217
+ def get_entity_definitions(entity, schema, classification)
218
+ definition = generate_entity_definition(entity, schema, classification)
228
219
  [Glossarist::V3::DetailedDefinition.new(content: definition)]
229
220
  end
230
221
 
@@ -308,17 +299,6 @@ module Suma
308
299
  end
309
300
  end
310
301
 
311
- def extract_file_type(filename)
312
- match = filename.match(/(arm|mim|bom)_annotated\.exp$/)
313
- return "resource" unless match
314
-
315
- {
316
- "arm" => "module_arm",
317
- "mim" => "module_mim",
318
- "bom" => "business_object_model",
319
- }[match.captures[0]] || "resource"
320
- end
321
-
322
302
  def starts_with_list?(content)
323
303
  return false if content.nil? || content.empty?
324
304
 
@@ -420,22 +400,13 @@ module Suma
420
400
  entity_id.downcase.gsub("_", " ")
421
401
  end
422
402
 
423
- def generate_entity_definition(entity, schema, schema_type)
403
+ def generate_entity_definition(entity, schema, classification)
424
404
  return "" if entity.nil?
425
405
 
426
- entity_type = case schema_type
427
- when "module_arm"
428
- urn_mention(term_urn("general.application_object"),
429
- "application object")
430
- when "module_mim"
431
- urn_mention(term_urn("express-language.entity_data_type"),
432
- "entity data type")
433
- when "resource", "business_object_model"
434
- urn_mention(term_urn("express-language.entity_data_type"),
435
- "entity data type")
436
- else
437
- raise Error, "[suma] encountered unsupported schema_type"
438
- end
406
+ entity_type = urn_mention(
407
+ term_urn(classification.entity_term),
408
+ classification.entity_display,
409
+ )
439
410
 
440
411
  entity_ref = urn_mention(term_urn("express-language.entity"), "entity")
441
412
 
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.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/suma.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "expressir"
4
4
  require "lutaml/model"
5
+ require "fileutils"
5
6
 
6
7
  module Suma
7
8
  autoload :VERSION, "suma/version"
@@ -10,7 +11,9 @@ module Suma
10
11
  autoload :CollectionConfig, "suma/collection_config"
11
12
  autoload :CollectionManifest, "suma/collection_manifest"
12
13
  autoload :EengineConverter, "suma/eengine_converter"
14
+ autoload :ExpressReformatter, "suma/express_reformatter"
13
15
  autoload :ExpressSchema, "suma/express_schema"
16
+ autoload :LinkValidation, "suma/link_validation"
14
17
  autoload :LinkValidator, "suma/link_validator"
15
18
  autoload :ManifestTraverser, "suma/manifest_traverser"
16
19
  autoload :RegisterManifestGenerator, "suma/register_manifest_generator"
@@ -26,6 +29,7 @@ module Suma
26
29
  autoload :SchemaTemplate, "suma/schema_template"
27
30
  autoload :SiteConfig, "suma/site_config"
28
31
  autoload :SvgQuality, "suma/svg_quality"
32
+ autoload :TermClassification, "suma/term_classification"
29
33
  autoload :TermExtractor, "suma/term_extractor"
30
34
  autoload :ThorExt, "suma/thor_ext"
31
35
  autoload :Urn, "suma/urn"
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-03 00:00:00.000000000 Z
11
+ date: 2026-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: expressir
@@ -206,11 +206,13 @@ files:
206
206
  - lib/suma/eengine/errors.rb
207
207
  - lib/suma/eengine/wrapper.rb
208
208
  - lib/suma/eengine_converter.rb
209
+ - lib/suma/express_reformatter.rb
209
210
  - lib/suma/express_schema.rb
210
211
  - lib/suma/jsdai.rb
211
212
  - lib/suma/jsdai/figure.rb
212
213
  - lib/suma/jsdai/figure_image.rb
213
214
  - lib/suma/jsdai/figure_xml.rb
215
+ - lib/suma/link_validation.rb
214
216
  - lib/suma/link_validator.rb
215
217
  - lib/suma/manifest_traverser.rb
216
218
  - lib/suma/processor.rb
@@ -235,6 +237,8 @@ files:
235
237
  - lib/suma/svg_quality/formatters/terminal_formatter.rb
236
238
  - lib/suma/svg_quality/formatters/yaml_formatter.rb
237
239
  - lib/suma/svg_quality/report.rb
240
+ - lib/suma/svg_quality/scanner.rb
241
+ - lib/suma/term_classification.rb
238
242
  - lib/suma/term_extractor.rb
239
243
  - lib/suma/thor_ext.rb
240
244
  - lib/suma/urn.rb