lutaml 0.9.6 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a28dfbb8000b5253d9d608012982cd3a2452f19eac1323cf034a198b87fdc384
4
- data.tar.gz: 4290b8b705eb7c39c76fe7189581186d41bdaa46cf1c0f2999adb14d6b422103
3
+ metadata.gz: 7d1677e27d1216994f6619acc558721d9b2d6107dd30fd6776232965d6d1d219
4
+ data.tar.gz: e8999116cdee14d6316f9bedaa781893ae2d27b88f93aef514fdda435e8d29b6
5
5
  SHA512:
6
- metadata.gz: 1a08b0cb64f7aa47270690672a51e66214bbb0f5b23824a3b5b96f669b1a78fd5d9219afaa527ea1e5777f59803738b08a756cf77bf81408399871203fd48359
7
- data.tar.gz: 7ad597883806052a6b487008b3202406b824f636e75bb98df640d025bc69662117b2de626ce492f268ac8489707a22954650976bfbbd3f68ddb45e0ed469b1fb
6
+ metadata.gz: 37c0d7fb4a3676a45fc8ebbab3bfab3e993ad84e005a8a7d642a1af66c3600271d1a03b723a2b7ff8462a96a75605c5bce06425393047c9fcdcd16c38c1b603f
7
+ data.tar.gz: e287823e6e238754223823ccabaebe31f13332b26efb67ac97d1c3f103cdf512f5a7be9276653f826983fe87e991b221772115b1c3d0bb09bb5745db1f2b0dd2
@@ -1,3 +1,3 @@
1
1
  module Lutaml
2
- VERSION = "0.9.6".freeze
2
+ VERSION = "0.9.8".freeze
3
3
  end
@@ -337,12 +337,28 @@ module Lutaml
337
337
  source_or_target = :target
338
338
  end
339
339
 
340
- member_end = lookup_entity_name(xmi_id) ||
341
- connector_name_by_source_or_target(xmi_id, source_or_target)
342
-
340
+ member_end = member_end_name(xmi_id, source_or_target, link.name)
343
341
  [member_end, xmi_id]
344
342
  end
345
343
 
344
+ # @param xmi_id [String]
345
+ # @param source_or_target [Symbol]
346
+ # @return [String]
347
+ def member_end_name(xmi_id, source_or_target, link_name)
348
+ connector_label = connector_labels(xmi_id, source_or_target)
349
+ entity_name = lookup_entity_name(xmi_id)
350
+ connector_name = connector_name_by_source_or_target(
351
+ xmi_id, source_or_target
352
+ )
353
+
354
+ case link_name
355
+ when "Aggregation"
356
+ connector_label || entity_name || connector_name
357
+ else
358
+ entity_name || connector_name
359
+ end
360
+ end
361
+
346
362
  # @param owner_xmi_id [String]
347
363
  # @param link [Shale::Mapper]
348
364
  # @param link_member_name [String]
@@ -402,8 +418,7 @@ module Lutaml
402
418
  source_or_target = :target
403
419
  end
404
420
 
405
- member_end = lookup_entity_name(xmi_id) ||
406
- connector_name_by_source_or_target(xmi_id, source_or_target)
421
+ member_end = member_end_name(xmi_id, source_or_target, link.name)
407
422
 
408
423
  member_end_cardinality, _member_end_attribute_name =
409
424
  fetch_owned_attribute_node(xmi_id)
@@ -535,15 +550,32 @@ module Lutaml
535
550
  # @param xmi_id [String]
536
551
  # @param source_or_target [String]
537
552
  # @return [String]
538
- def connector_name_by_source_or_target(xmi_id, source_or_target)
539
- node = @xmi_root_model.extension.connectors.connector.select do |con|
553
+ def connector_node_by_id(xmi_id, source_or_target)
554
+ @xmi_root_model.extension.connectors.connector.find do |con|
540
555
  con.send(source_or_target.to_sym).idref == xmi_id
541
556
  end
542
- return if node.empty? ||
543
- node.first.send(source_or_target.to_sym).nil? ||
544
- node.first.send(source_or_target.to_sym).model.nil?
557
+ end
558
+
559
+ # @param xmi_id [String]
560
+ # @param source_or_target [String]
561
+ # @return [String]
562
+ def connector_name_by_source_or_target(xmi_id, source_or_target)
563
+ node = connector_node_by_id(xmi_id, source_or_target)
564
+ return if node.nil? ||
565
+ node.send(source_or_target.to_sym).nil? ||
566
+ node.send(source_or_target.to_sym).model.nil?
567
+
568
+ node.send(source_or_target.to_sym).model.name
569
+ end
570
+
571
+ # @param xmi_id [String]
572
+ # @param source_or_target [String]
573
+ # @return [String]
574
+ def connector_labels(xmi_id, source_or_target)
575
+ node = connector_node_by_id(xmi_id, source_or_target)
576
+ return if node.nil?
545
577
 
546
- node.first.send(source_or_target.to_sym).model.name
578
+ node.labels&.rt || node.labels&.lt
547
579
  end
548
580
 
549
581
  # @param xmi_id [String]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lutaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-17 00:00:00.000000000 Z
11
+ date: 2024-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: expressir