ea 0.6.176 → 0.6.177

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: d0fdc1896a303394007bfccc2422044f9e748f82b0bd24a4fe73f9659f21467f
4
- data.tar.gz: 7dab9cbbf80d186665e53d463bcc97693bf2c8af1295092f9766c33e8bc885be
3
+ metadata.gz: 2b64a1978bc6e836dc911f991400e4b27bce6c6b172d9e061a6aa23e32bdabf0
4
+ data.tar.gz: 315822317e8802a247b4dad639a1ccc7c3647d1efcab28e70b38d87685815fcb
5
5
  SHA512:
6
- metadata.gz: 860eeb5dcd9936d3dc4cc15ba0b767f2a01b147d4617e472d89ac6095e129bcacc948a69b56e9245c495d7b694e359ebee422a52873027e8b962eca6c4d67a28
7
- data.tar.gz: 700dc1dbd56ed5d5a6a67576fbfb3b1000c1ab9304ec22541f5eadf3c4b575c1a3be3d2397495ba3df6bc7474a372e049662de26b1ff827a0113b1e59ed86dbf
6
+ metadata.gz: f1ad82a19fe4aa8904170f4b43d54f6afa206db43600599c94d0e31ec667290204075a03e460c596dfc68f71b58282a590018afd5bd14ab90a7e5436f395a36c
7
+ data.tar.gz: 9f0e6958156d45c3d8d1078c624b9264c74aea29f35b47bd59c37d03289ddbbd84900e47863e30a9eacc27ddee5649466b409cb6c8d5bc25666c3a955ba6db37
@@ -48,33 +48,27 @@ module Ea
48
48
  association_xmi_id:, cardinality:, definition:,
49
49
  gen_name:, name_ns:, type_ns:, is_src: true
50
50
  )
51
- Lutaml::Uml::GeneralAttribute.new.tap do |attr|
52
- assign_assoc_attr_basic(attr, name, type, gen_name, definition,
53
- name_ns, type_ns)
54
- attr.xmi_id = normalize_guid_to_xmi_format(type_xmi_id, "EAID")
55
- attr.association = normalize_guid_to_xmi_format(
51
+ Lutaml::Uml::GeneralAttribute.instantiate(
52
+ name: name,
53
+ type: type,
54
+ gen_name: gen_name,
55
+ definition: definition,
56
+ name_ns: name_ns,
57
+ type_ns: type_ns,
58
+ xmi_id: normalize_guid_to_xmi_format(type_xmi_id, "EAID"),
59
+ association: normalize_guid_to_xmi_format(
56
60
  association_xmi_id, "EAID"
57
- )
58
- attr.has_association = true
59
- attr.id = normalize_guid_to_xmi_src_dst_format(
61
+ ),
62
+ has_association: true,
63
+ id: normalize_guid_to_xmi_src_dst_format(
60
64
  association_xmi_id, "EAID", is_src
61
- )
62
- attr.cardinality = build_cardinality(cardinality)
63
- end
65
+ ),
66
+ cardinality: build_cardinality(cardinality)
67
+ )
64
68
  end
65
69
 
66
70
  private
67
71
 
68
- def assign_assoc_attr_basic(attr, name, type, gen_name,
69
- definition, name_ns, type_ns)
70
- attr.name = name
71
- attr.type = type
72
- attr.gen_name = gen_name
73
- attr.definition = definition
74
- attr.name_ns = name_ns
75
- attr.type_ns = type_ns
76
- end
77
-
78
72
  def build_association(ea_connector, object_id, normalized_owner_xmi_id)
79
73
  is_start = ea_connector.start_object_id == object_id
80
74
  owner_role = is_start ? ea_connector.destrole : ea_connector.sourcerole
@@ -92,34 +86,25 @@ module Ea
92
86
  def build_association_record(ea_connector, object_id, owner_xmi_id,
93
87
  owner_role, member_obj, member_role, is_start)
94
88
  cardinality_str = is_start ? ea_connector.destcard : ea_connector.sourcecard
95
-
96
- Lutaml::Uml::Association.new.tap do |assoc|
97
- assoc.xmi_id = normalize_guid_to_xmi_format(ea_connector.ea_guid,
98
- "EAID")
99
- assign_assoc_name(assoc, ea_connector)
100
- assign_association_ends(assoc, object_id, owner_xmi_id,
101
- owner_role, member_obj, member_role)
102
- assoc.member_end_type = ea_connector.connector_type&.downcase
103
- assoc.member_end_cardinality = build_cardinality(cardinality_str)
104
- end
105
- end
106
-
107
- def assign_assoc_name(assoc, ea_connector)
108
- return if ea_connector.name.nil? || ea_connector.name.empty?
109
-
110
- assoc.name = ea_connector.name
111
- end
112
-
113
- def assign_association_ends(assoc, object_id, owner_xmi_id,
114
- owner_role, member_obj, member_role)
115
- assoc.owner_end = find_object_by_id(object_id)&.name
116
- assoc.owner_end_xmi_id = owner_xmi_id
117
- assoc.owner_end_attribute_name = owner_role
118
- assoc.member_end = member_obj.name
119
- assoc.member_end_xmi_id = normalize_guid_to_xmi_format(
120
- member_obj.ea_guid, "EAID"
121
- )
122
- assoc.member_end_attribute_name = member_role
89
+ member_obj_name = member_obj.name
90
+
91
+ fields = {
92
+ xmi_id: normalize_guid_to_xmi_format(ea_connector.ea_guid,
93
+ "EAID"),
94
+ owner_end: find_object_by_id(object_id)&.name,
95
+ owner_end_xmi_id: owner_xmi_id,
96
+ owner_end_attribute_name: owner_role,
97
+ member_end: member_obj_name,
98
+ member_end_xmi_id: normalize_guid_to_xmi_format(
99
+ member_obj.ea_guid, "EAID"
100
+ ),
101
+ member_end_attribute_name: member_role,
102
+ member_end_type: ea_connector.connector_type&.downcase,
103
+ member_end_cardinality: build_cardinality(cardinality_str)
104
+ }
105
+ fields[:name] = ea_connector.name unless ea_connector.name.nil? || ea_connector.name.empty?
106
+
107
+ Lutaml::Uml::Association.instantiate(fields)
123
108
  end
124
109
 
125
110
  def resolve_member_object(ea_connector, is_start)
@@ -186,10 +171,10 @@ module Ea
186
171
  parsed = parse_cardinality(cardinality_str)
187
172
  return nil unless parsed[:min] || parsed[:max]
188
173
 
189
- Lutaml::Uml::Cardinality.new.tap do |card|
190
- card.min = parsed[:min]
191
- card.max = parsed[:max]
192
- end
174
+ Lutaml::Uml::Cardinality.instantiate(
175
+ min: parsed[:min],
176
+ max: parsed[:max]
177
+ )
193
178
  end
194
179
 
195
180
  def find_package_name(package_id)
@@ -11,36 +11,30 @@ module Ea
11
11
  def transform(ea_attribute)
12
12
  return nil if ea_attribute.nil?
13
13
 
14
- Lutaml::Uml::TopElementAttribute.new.tap do |attr|
15
- attr.name = ea_attribute.name
16
- attr.type = ea_attribute.type
17
- attr.visibility = map_visibility(ea_attribute.scope)
14
+ # XMI uses the TYPE's XMI ID, not the attribute's ID
15
+ type_xmi_id = lookup_type_xmi_id(ea_attribute.classifier)
18
16
 
19
- # XMI uses the TYPE's XMI ID, not the attribute's ID
20
- type_xmi_id = lookup_type_xmi_id(ea_attribute.classifier)
21
- attr.xmi_id = type_xmi_id || normalize_guid_to_xmi_format(
17
+ fields = {
18
+ name: ea_attribute.name,
19
+ type: ea_attribute.type,
20
+ visibility: map_visibility(ea_attribute.scope),
21
+ xmi_id: type_xmi_id || normalize_guid_to_xmi_format(
22
22
  ea_attribute.ea_guid, "EAID"
23
+ ),
24
+ id: normalize_guid_to_xmi_format(ea_attribute.ea_guid, "EAID"),
25
+ static: ea_attribute.static? ? "true" : nil,
26
+ is_derived: ea_attribute.derived == "1",
27
+ tagged_values: load_attribute_tags(ea_attribute.id)
28
+ }
29
+ if ea_attribute.lowerbound || ea_attribute.upperbound
30
+ fields[:cardinality] = build_cardinality(
31
+ ea_attribute.lowerbound,
32
+ ea_attribute.upperbound
23
33
  )
24
-
25
- attr.id = normalize_guid_to_xmi_format(ea_attribute.ea_guid, "EAID")
26
- attr.static = ea_attribute.static? ? "true" : nil
27
- attr.is_derived = ea_attribute.derived == "1"
28
-
29
- # Map cardinality if bounds are present
30
- if ea_attribute.lowerbound || ea_attribute.upperbound
31
- attr.cardinality = build_cardinality(
32
- ea_attribute.lowerbound,
33
- ea_attribute.upperbound
34
- )
35
- end
36
-
37
- # Map definition/notes
38
- attr.definition = normalize_note(ea_attribute.notes) unless
39
- ea_attribute.notes.nil? || ea_attribute.notes.empty?
40
-
41
- # Load and transform attribute tags
42
- attr.tagged_values = load_attribute_tags(ea_attribute.id)
43
34
  end
35
+ fields[:definition] = normalize_note(ea_attribute.notes) unless ea_attribute.notes.nil? || ea_attribute.notes.empty?
36
+
37
+ Lutaml::Uml::TopElementAttribute.instantiate(fields)
44
38
  end
45
39
 
46
40
  private
@@ -64,10 +58,10 @@ module Ea
64
58
  def build_cardinality(lower, upper)
65
59
  return nil if lower.nil? && upper.nil?
66
60
 
67
- Lutaml::Uml::Cardinality.new.tap do |card|
68
- card.min = lower || "0"
69
- card.max = upper || "*"
70
- end
61
+ Lutaml::Uml::Cardinality.instantiate(
62
+ min: lower || "0",
63
+ max: upper || "*"
64
+ )
71
65
  end
72
66
 
73
67
  # Load and transform attribute tags for an attribute
@@ -8,11 +8,10 @@ module Ea
8
8
  return nil if ea_object.nil?
9
9
  return nil unless transformable?(ea_object)
10
10
 
11
- Lutaml::Uml::UmlClass.new.tap do |klass|
12
- assign_basic_properties(klass, ea_object)
13
- assign_features(klass, ea_object)
14
- assign_relationships(klass, ea_object)
15
- end
11
+ fields = basic_fields(ea_object)
12
+ fields.merge!(feature_fields(ea_object))
13
+ fields.merge!(relationship_fields(ea_object))
14
+ Lutaml::Uml::UmlClass.instantiate(fields)
16
15
  end
17
16
 
18
17
  private
@@ -21,54 +20,45 @@ module Ea
21
20
  ea_object.uml_class? || ea_object.interface?
22
21
  end
23
22
 
24
- def assign_basic_properties(klass, ea_object)
25
- klass.name = ea_object.name
26
- klass.xmi_id = normalize_guid_to_xmi_format(ea_object.ea_guid, "EAID")
27
- klass.is_abstract = ea_object.abstract?
28
- klass.type = "Class"
29
- klass.visibility = map_visibility(ea_object.visibility)
30
- assign_stereotypes(klass, ea_object)
31
- assign_definition(klass, ea_object)
32
- end
33
-
34
- def assign_stereotypes(klass, ea_object)
23
+ def basic_fields(ea_object)
24
+ fields = {
25
+ name: ea_object.name,
26
+ xmi_id: normalize_guid_to_xmi_format(ea_object.ea_guid, "EAID"),
27
+ is_abstract: ea_object.abstract?,
28
+ type: "Class",
29
+ visibility: map_visibility(ea_object.visibility)
30
+ }
35
31
  stereotypes = build_stereotypes(ea_object)
36
- klass.stereotype = stereotypes unless stereotypes.empty?
37
- end
38
-
39
- def assign_definition(klass, ea_object)
40
- return if ea_object.note.nil? || ea_object.note.empty?
41
-
42
- klass.definition = normalize_note(ea_object.note)
32
+ fields[:stereotype] = stereotypes unless stereotypes.empty?
33
+ fields[:definition] = normalize_note(ea_object.note) unless ea_object.note.nil? || ea_object.note.empty?
34
+ fields
43
35
  end
44
36
 
45
- def assign_features(klass, ea_object)
46
- klass.attributes = load_all_attributes(ea_object)
47
- assign_feature_collections(klass, ea_object)
37
+ def feature_fields(ea_object)
38
+ tagged = load_tagged_values(ea_object.ea_guid)
39
+ tagged += load_object_properties(ea_object.ea_object_id)
40
+ {
41
+ attributes: load_all_attributes(ea_object),
42
+ operations: load_operations(ea_object.ea_object_id),
43
+ constraints: load_constraints(ea_object.ea_object_id),
44
+ tagged_values: tagged
45
+ }
48
46
  end
49
47
 
50
- def assign_feature_collections(klass, ea_object)
51
- klass.operations = load_operations(ea_object.ea_object_id)
52
- klass.constraints = load_constraints(ea_object.ea_object_id)
53
- klass.tagged_values = load_tagged_values(ea_object.ea_guid)
54
- klass.tagged_values.concat(
55
- load_object_properties(ea_object.ea_object_id)
56
- )
57
- end
58
-
59
- def assign_relationships(klass, ea_object)
48
+ def relationship_fields(ea_object)
60
49
  gen_builder = GeneralizationBuilder.new(database)
61
50
  assoc_builder = AssociationBuilder.new(database)
62
51
 
63
- klass.generalization = gen_builder.load_generalization(
64
- ea_object.ea_object_id
65
- )
66
- klass.association_generalization = gen_builder
67
- .load_association_generalizations(ea_object.ea_object_id)
68
-
69
- klass.associations = assoc_builder.load_class_associations(
70
- ea_object.ea_object_id, ea_object.ea_guid
71
- )
52
+ {
53
+ generalization: gen_builder.load_generalization(
54
+ ea_object.ea_object_id
55
+ ),
56
+ association_generalization: gen_builder
57
+ .load_association_generalizations(ea_object.ea_object_id),
58
+ associations: assoc_builder.load_class_associations(
59
+ ea_object.ea_object_id, ea_object.ea_guid
60
+ )
61
+ }
72
62
  end
73
63
 
74
64
  def load_all_attributes(ea_object)
@@ -27,20 +27,19 @@ module Ea
27
27
  def transform(ea_constraint)
28
28
  return nil unless ea_constraint
29
29
 
30
- Lutaml::Uml::Constraint.new.tap do |constraint|
31
- # Generate unique ID for the constraint
32
- constraint.xmi_id = "constraint_#{ea_constraint.constraint_id}" if
33
- ea_constraint.constraint_id
34
-
30
+ fields = {
35
31
  # Generate descriptive name from constraint body or use ID
36
- constraint.name = constraint_name(ea_constraint)
37
-
32
+ name: constraint_name(ea_constraint),
38
33
  # Map constraint properties
39
- constraint.body = ea_constraint.constraint
40
- constraint.type = ea_constraint.constraint_type
41
- constraint.weight = ea_constraint.weight&.to_s
42
- constraint.status = ea_constraint.status
43
- end
34
+ body: ea_constraint.constraint,
35
+ type: ea_constraint.constraint_type,
36
+ weight: ea_constraint.weight&.to_s,
37
+ status: ea_constraint.status
38
+ }
39
+ # Generate unique ID for the constraint
40
+ fields[:xmi_id] = "constraint_#{ea_constraint.constraint_id}" if ea_constraint.constraint_id
41
+
42
+ Lutaml::Uml::Constraint.instantiate(fields)
44
43
  end
45
44
 
46
45
  private
@@ -68,7 +68,7 @@ module Ea
68
68
  end
69
69
 
70
70
  def to_top_element_attribute(attr)
71
- Lutaml::Uml::TopElementAttribute.new(
71
+ Lutaml::Uml::TopElementAttribute.instantiate(
72
72
  **base_attr_hash(attr),
73
73
  is_derived: attr.is_derived == true
74
74
  )
@@ -118,12 +118,12 @@ module Ea
118
118
  parent_obj = find_object_by_id(ea_connector.end_object_id)
119
119
  return nil unless parent_obj
120
120
 
121
- Lutaml::Uml::AssociationGeneralization.new.tap do |ag|
122
- ag.id = normalize_guid_to_xmi_format(ea_connector.ea_guid, "EAID")
123
- ag.type = "uml:Generalization"
124
- ag.general = normalize_guid_to_xmi_format(parent_obj.ea_guid,
125
- "EAID")
126
- end
121
+ Lutaml::Uml::AssociationGeneralization.instantiate(
122
+ id: normalize_guid_to_xmi_format(ea_connector.ea_guid, "EAID"),
123
+ type: "uml:Generalization",
124
+ general: normalize_guid_to_xmi_format(parent_obj.ea_guid,
125
+ "EAID")
126
+ )
127
127
  end
128
128
 
129
129
  def build_generalization(object_id, current_obj)
@@ -32,11 +32,11 @@ module Ea
32
32
  return nil unless ea_property
33
33
  return nil unless ea_property.property
34
34
 
35
- Lutaml::Uml::TaggedValue.new.tap do |tag|
36
- tag.name = ea_property.property
37
- tag.value = ea_property.value || ""
38
- tag.notes = format_notes(ea_property)
39
- end
35
+ Lutaml::Uml::TaggedValue.instantiate(
36
+ name: ea_property.property,
37
+ value: ea_property.value || "",
38
+ notes: format_notes(ea_property)
39
+ )
40
40
  end
41
41
 
42
42
  private
@@ -11,22 +11,18 @@ module Ea
11
11
  def transform(ea_operation)
12
12
  return nil if ea_operation.nil?
13
13
 
14
- Lutaml::Uml::Operation.new.tap do |op|
15
- op.name = ea_operation.name
16
- op.return_type = ea_operation.type
17
- op.visibility = map_visibility(ea_operation.scope)
18
- op.xmi_id = ea_operation.ea_guid
19
-
20
- # Build parameter type string from operation parameters
21
- op.parameter_type = build_parameter_type(ea_operation)
22
-
23
- # Map definition/notes
24
- op.definition = normalize_note(ea_operation.notes) unless
25
- ea_operation.notes.nil? || ea_operation.notes.empty?
26
-
27
- # Map stereotype if present
28
- op.stereotype = [ea_operation.stereotype] if ea_operation.stereotype && !ea_operation.stereotype.empty?
29
- end
14
+ fields = {
15
+ name: ea_operation.name,
16
+ return_type: ea_operation.type,
17
+ visibility: map_visibility(ea_operation.scope),
18
+ xmi_id: ea_operation.ea_guid,
19
+ # Parameter type string built from the operation parameters
20
+ parameter_type: build_parameter_type(ea_operation)
21
+ }
22
+ fields[:definition] = normalize_note(ea_operation.notes) unless ea_operation.notes.nil? || ea_operation.notes.empty?
23
+ fields[:stereotype] = [ea_operation.stereotype] if ea_operation.stereotype && !ea_operation.stereotype.empty?
24
+
25
+ Lutaml::Uml::Operation.instantiate(fields)
30
26
  end
31
27
 
32
28
  private
@@ -26,11 +26,11 @@ module Ea
26
26
  return nil unless ea_tag
27
27
  return nil unless ea_tag.tag_name
28
28
 
29
- Lutaml::Uml::TaggedValue.new.tap do |tag|
30
- tag.name = ea_tag.tag_name
31
- tag.value = ea_tag.parsed_value || ""
32
- tag.notes = ea_tag.parsed_notes
33
- end
29
+ Lutaml::Uml::TaggedValue.instantiate(
30
+ name: ea_tag.tag_name,
31
+ value: ea_tag.parsed_value || "",
32
+ notes: ea_tag.parsed_notes
33
+ )
34
34
  end
35
35
  end
36
36
  end
@@ -67,7 +67,8 @@ module Ea
67
67
  parser: context.parser,
68
68
  uml_document: LazyDocument.new(context),
69
69
  drop_options: context.drop_options,
70
- xmi_id_index: context.xmi_id_index
70
+ xmi_id_index: context.xmi_id_index,
71
+ context: context
71
72
  )
72
73
  end
73
74
 
@@ -212,9 +213,12 @@ module Ea
212
213
  # constructed per package on demand and memoized on the
213
214
  # context's caches; the database stays the single source.
214
215
  LazyGraph = Struct.new(:parser, :uml_document, :drop_options,
215
- :xmi_id_index, keyword_init: true)
216
+ :xmi_id_index, :context, keyword_init: true)
216
217
 
217
218
  # Document facade answering RootDrop's reads: name + packages.
219
+ # The package facade list is memoized — renders visit it
220
+ # repeatedly and re-wrapping the tree on every read dominated
221
+ # cache-hit traversal.
218
222
  class LazyDocument
219
223
  def initialize(context)
220
224
  @context = context
@@ -225,9 +229,9 @@ module Ea
225
229
  end
226
230
 
227
231
  def packages
228
- @context.database.packages
229
- .reject { |package| parent(package) }
230
- .map { |package| LazyPackage.new(@context, package) }
232
+ @packages ||= @context.database.packages
233
+ .reject { |package| parent(package) }
234
+ .map { |package| LazyPackage.new(@context, package) }
231
235
  end
232
236
 
233
237
  private
@@ -238,7 +242,8 @@ module Ea
238
242
  end
239
243
 
240
244
  # Package facade over one t_package row: classes, enums, data
241
- # types and child packages construct on demand.
245
+ # types and child packages construct on demand and memoize —
246
+ # renders traverse the same package repeatedly.
242
247
  class LazyPackage
243
248
  def initialize(context, package)
244
249
  @context = context
@@ -262,27 +267,27 @@ module Ea
262
267
  end
263
268
 
264
269
  def classes
265
- @context.database.objects_in_package(@package.package_id)
266
- .select(&:uml_class?)
267
- .map { |row| @context.klass_for(row.ea_object_id) }
268
- .compact
270
+ @classes ||= @context.database.objects_in_package(@package.package_id)
271
+ .select(&:uml_class?)
272
+ .map { |row| @context.klass_for(row.ea_object_id) }
273
+ .compact
269
274
  end
270
275
 
271
276
  def enums
272
- @context.database.objects_in_package(@package.package_id)
273
- .select(&:enumeration?)
274
- .filter_map { |row| @context.enum_for(row.ea_object_id) }
277
+ @enums ||= @context.database.objects_in_package(@package.package_id)
278
+ .select(&:enumeration?)
279
+ .filter_map { |row| @context.enum_for(row.ea_object_id) }
275
280
  end
276
281
 
277
282
  def data_types
278
- @context.database.objects_in_package(@package.package_id)
279
- .select(&:data_type?)
280
- .filter_map { |row| @context.data_type_for(row.ea_object_id) }
283
+ @data_types ||= @context.database.objects_in_package(@package.package_id)
284
+ .select(&:data_type?)
285
+ .filter_map { |row| @context.data_type_for(row.ea_object_id) }
281
286
  end
282
287
 
283
288
  def packages
284
- @context.database.child_packages_for(@package.package_id)
285
- .map { |row| LazyPackage.new(@context, row) }
289
+ @packages ||= @context.database.child_packages_for(@package.package_id)
290
+ .map { |row| LazyPackage.new(@context, row) }
286
291
  end
287
292
 
288
293
  def diagrams
data/lib/ea/version.rb CHANGED
@@ -4,5 +4,5 @@ module Ea
4
4
  # Gem release version. Extracted to its own file so the
5
5
  # `gem-release` tool's `gem bump` can find and update it via the
6
6
  # standard `lib/<gem>/version.rb` convention.
7
- VERSION = "0.6.176".freeze
7
+ VERSION = "0.6.177".freeze
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.176
4
+ version: 0.6.177
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-11-30 00:00:00.000000000 Z
11
+ date: 2026-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model