ea 0.6.189 → 0.6.190

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: 9e4c030e2fdce29d91848b615e828cd1ac060948bf3301fe50ccbb2cbbb45af4
4
- data.tar.gz: 302c590406bf21890afe5830d5aadaa47437919fde2f4fbc5a42cdc080f4ee0a
3
+ metadata.gz: afc3ee749c4dcfcf5fe79103bc8c371828e4221ca7ec3abefbc3382906912445
4
+ data.tar.gz: 6ce3a238ce208d2941fc7bae6ae36b59ec04745401938d7fe3073f44994c6c14
5
5
  SHA512:
6
- metadata.gz: eb4b201972bd6131d20746043b43fd60fb0da97a87c5b6caefb1d28b3bd43f502d754ab266a2bb3efdfbcc5b4f29c2014c5375025653f37cc2238c22612e38cf
7
- data.tar.gz: 8acf7d0b74ed03d6def7bd19ed42873dfa41c8a2b69036d40bafb54f0110d465a3b8f14aedcfe881bace4a6befddf3d0a9163fc7d7b95389263ed28ae59ab29f
6
+ metadata.gz: 5b581e021a44fded77e00ac2de4fc418455adaefbb53f0dcb25aab0ba283368a684205ef5071782607c2fc8ea9ee1f1037aae60c27e568efd6e9d95d70ac0a6d
7
+ data.tar.gz: 23363447e1fcdf9a7f715ac72c815c20165a22b65fcc1f408f428826dbb0e3c17b5a014a53eb80a6b8b2ad6ce901263a397356eebf1db59884039374b0eb0033
@@ -69,18 +69,23 @@ module Ea
69
69
 
70
70
  private
71
71
 
72
+ # The role a class lists for an association is the one at the far
73
+ # end — its own property, named by the connector's destination role
74
+ # when the class is the source — as the data type route lists it
75
+ # and as the XMI reader reads it off the classifier's property.
76
+ # A connector without that role is not listed.
72
77
  def build_association(ea_connector, object_id, normalized_owner_xmi_id)
73
78
  is_start = ea_connector.start_object_id == object_id
74
- owner_role = is_start ? ea_connector.destrole : ea_connector.sourcerole
75
- return nil if owner_role.nil? || owner_role.empty?
79
+ member_role = is_start ? ea_connector.destrole : ea_connector.sourcerole
80
+ return nil if member_role.nil? || member_role.empty?
76
81
 
82
+ owner_role = is_start ? ea_connector.sourcerole : ea_connector.destrole
77
83
  member_obj = resolve_member_object(ea_connector, is_start)
78
84
  return nil unless member_obj
79
85
 
80
- member_role = resolve_member_role(ea_connector, is_start, member_obj)
81
-
82
- build_association_record(ea_connector, object_id, normalized_owner_xmi_id,
83
- owner_role, member_obj, member_role, is_start)
86
+ build_association_record(ea_connector, object_id,
87
+ normalized_owner_xmi_id, owner_role,
88
+ member_obj, member_role, is_start)
84
89
  end
85
90
 
86
91
  def build_association_record(ea_connector, object_id, owner_xmi_id,
@@ -103,6 +108,8 @@ module Ea
103
108
  member_end_cardinality: build_cardinality(cardinality_str)
104
109
  }
105
110
  fields[:name] = ea_connector.name unless ea_connector.name.nil? || ea_connector.name.empty?
111
+ fields[:definition] = normalize_note(ea_connector.notes) unless
112
+ ea_connector.notes.nil? || ea_connector.notes.empty?
106
113
 
107
114
  Lutaml::Uml::Association.instantiate(fields)
108
115
  end
@@ -112,11 +119,6 @@ module Ea
112
119
  find_object_by_id(peer_id)
113
120
  end
114
121
 
115
- def resolve_member_role(ea_connector, is_start, member_obj)
116
- role = is_start ? ea_connector.sourcerole : ea_connector.destrole
117
- role.nil? || role.empty? ? member_obj.name : role
118
- end
119
-
120
122
  def build_end_attribute(ea_connector, obj, obj_pkg_name)
121
123
  return nil if ea_connector.destrole.nil? || ea_connector.destrole.empty?
122
124
 
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.189".freeze
7
+ VERSION = "0.6.190".freeze
8
8
  end
data/lib/ea/xmi/parser.rb CHANGED
@@ -83,11 +83,12 @@ module Ea
83
83
  return nil unless node
84
84
 
85
85
  documentation = node.documentation
86
- if documentation.is_a?(::Xmi::Sparx::Element::Documentation)
87
- documentation&.value
88
- else
89
- documentation
90
- end
86
+ value = if documentation.is_a?(::Xmi::Sparx::Element::Documentation)
87
+ documentation&.value
88
+ else
89
+ documentation
90
+ end
91
+ Ea::Rules::NoteText.normalize(value)
91
92
  end
92
93
 
93
94
  def get_package_name(package)
@@ -518,14 +519,31 @@ module Ea
518
519
  link_owner = link_member == "start" ? "end" : "start"
519
520
 
520
521
  member_end, member_end_type, member_end_cardinality,
521
- member_end_attribute_name, member_end_xmi_id =
522
+ connector_end_name, member_end_xmi_id =
522
523
  serialize_member_type(xmi_id, assoc, link_member)
523
524
 
524
525
  owner_end = serialize_owned_type(xmi_id, assoc, link_owner)
526
+ bounds = member_end_cardinality.to_h.values.compact
527
+ if bounds.empty?
528
+ member_end_cardinality = uml_end_cardinality(assoc.id,
529
+ member_end_xmi_id)
530
+ end
525
531
  doc_node = link_member == "start" ? "source" : "target"
526
- definition = fetch_definition_node_value(assoc.id, doc_node)
527
-
528
- owner_end_attribute_name = find_owner_attribute_name(xmi_id, assoc.id)
532
+ # An end's own note, else the connector's: EA writes the note
533
+ # users edit on the connector.
534
+ definition = fetch_definition_node_value(assoc.id, doc_node) ||
535
+ lookup_assoc_def(assoc.id)
536
+
537
+ # EA records a role as the owning classifier's property whose type
538
+ # is the far end: the member-end role is the owner's property for
539
+ # the association, the owner-end role the member's other one. A
540
+ # connector end's own name is its element's name, which stands in
541
+ # only where the model lists no property.
542
+ member_role = find_owner_attribute_name(xmi_id, assoc.id)
543
+ member_end_attribute_name = member_role || connector_end_name
544
+ owner_end_attribute_name =
545
+ role_attributes_for(member_end_xmi_id, assoc.id)
546
+ .find { |name| name != member_role }
529
547
 
530
548
  return nil unless member_end &&
531
549
  ((member_end_type != "aggregation") ||
@@ -917,12 +935,44 @@ module Ea
917
935
  [cardinality, oa_name]
918
936
  end
919
937
 
938
+ # The first of a classifier's properties that are ends of one
939
+ # association.
920
940
  def find_owner_attribute_name(owner_xmi_id, assoc_id)
941
+ role_attributes_for(owner_xmi_id, assoc_id).first
942
+ end
943
+
944
+ # The bounds on the UML association's end that points at the member
945
+ # element, for an export that carries them there and not on the
946
+ # connector end.
947
+ def uml_end_cardinality(assoc_id, member_xmi_id)
948
+ element = find_packaged_element_by_id(assoc_id)
949
+ return nil unless element&.owned_end
950
+
951
+ end_node = element.owned_end.find do |owned_end|
952
+ owned_end.uml_type&.idref == member_xmi_id
953
+ end
954
+ return nil unless end_node
955
+
956
+ cardinality_min_max_value(bound_text(end_node.lower_value),
957
+ bound_text(end_node.upper_value))
958
+ end
959
+
960
+ # A literal bound as text; an absent one is nil, as a connector
961
+ # end without a multiplicity reads.
962
+ def bound_text(value_spec)
963
+ text = value_spec&.value.to_s
964
+ text.empty? ? nil : text
965
+ end
966
+
967
+ # A classifier's properties that are ends of one association, in
968
+ # document order.
969
+ def role_attributes_for(owner_xmi_id, assoc_id)
921
970
  owner_node = find_packaged_element_by_id(owner_xmi_id)
922
- return nil unless owner_node&.owned_attribute
971
+ return [] unless owner_node&.owned_attribute
923
972
 
924
- owned_attr = owner_node.owned_attribute.find { |oa| oa.association == assoc_id }
925
- owned_attr&.name
973
+ owner_node.owned_attribute.filter_map do |owned_attr|
974
+ owned_attr.name if owned_attr.association == assoc_id
975
+ end
926
976
  end
927
977
 
928
978
  # --- Connector lookup index ---
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.189
4
+ version: 0.6.190
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-12-05 00:00:00.000000000 Z
11
+ date: 2026-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model