lutaml 0.9.5 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lutaml/version.rb +1 -1
- data/lib/lutaml/xmi/parsers/xml.rb +35 -11
- data/lutaml.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4db5dffc542b1571b200b43d83253caafa1f90cd67aec5ece16af26a31ac5f8b
|
4
|
+
data.tar.gz: 9e12f4317fb3a5690d5475ebec249cbafa92de81d1f813845438062dfd51083d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e15272b553e564a0432e758d56e00cae2c79a8c8e166615812ad5e05004b9c5fe2e33a667d6910ffd6fc1156365fed895d1aa2c4412da4892511edd324c0785
|
7
|
+
data.tar.gz: 16281e22ee7b86fba771f7eee75455bfcd175c0ac4af02ecdda5538bd75a63ecaaa71cbdfde4e5815f5d5a15db1bbf11be5d129fd71285d3219cc4702d9c4561
|
data/lib/lutaml/version.rb
CHANGED
@@ -100,6 +100,7 @@ module Lutaml
|
|
100
100
|
xmi_id: klass.id,
|
101
101
|
name: klass.name,
|
102
102
|
package: model,
|
103
|
+
type: klass.type.split(":").last,
|
103
104
|
attributes: serialize_class_attributes(klass),
|
104
105
|
associations: serialize_model_associations(klass.id),
|
105
106
|
operations: serialize_class_operations(klass),
|
@@ -336,12 +337,19 @@ module Lutaml
|
|
336
337
|
source_or_target = :target
|
337
338
|
end
|
338
339
|
|
339
|
-
member_end =
|
340
|
-
connector_name_by_source_or_target(xmi_id, source_or_target)
|
341
|
-
|
340
|
+
member_end = member_end_name(xmi_id, source_or_target)
|
342
341
|
[member_end, xmi_id]
|
343
342
|
end
|
344
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)
|
348
|
+
connector_labels(xmi_id, source_or_target) ||
|
349
|
+
lookup_entity_name(xmi_id) ||
|
350
|
+
connector_name_by_source_or_target(xmi_id, source_or_target)
|
351
|
+
end
|
352
|
+
|
345
353
|
# @param owner_xmi_id [String]
|
346
354
|
# @param link [Shale::Mapper]
|
347
355
|
# @param link_member_name [String]
|
@@ -401,8 +409,7 @@ module Lutaml
|
|
401
409
|
source_or_target = :target
|
402
410
|
end
|
403
411
|
|
404
|
-
member_end =
|
405
|
-
connector_name_by_source_or_target(xmi_id, source_or_target)
|
412
|
+
member_end = member_end_name(xmi_id, source_or_target)
|
406
413
|
|
407
414
|
member_end_cardinality, _member_end_attribute_name =
|
408
415
|
fetch_owned_attribute_node(xmi_id)
|
@@ -534,15 +541,32 @@ module Lutaml
|
|
534
541
|
# @param xmi_id [String]
|
535
542
|
# @param source_or_target [String]
|
536
543
|
# @return [String]
|
537
|
-
def
|
538
|
-
|
544
|
+
def connector_node_by_id(xmi_id, source_or_target)
|
545
|
+
@xmi_root_model.extension.connectors.connector.find do |con|
|
539
546
|
con.send(source_or_target.to_sym).idref == xmi_id
|
540
547
|
end
|
541
|
-
|
542
|
-
|
543
|
-
|
548
|
+
end
|
549
|
+
|
550
|
+
# @param xmi_id [String]
|
551
|
+
# @param source_or_target [String]
|
552
|
+
# @return [String]
|
553
|
+
def connector_name_by_source_or_target(xmi_id, source_or_target)
|
554
|
+
node = connector_node_by_id(xmi_id, source_or_target)
|
555
|
+
return if node.nil? ||
|
556
|
+
node.send(source_or_target.to_sym).nil? ||
|
557
|
+
node.send(source_or_target.to_sym).model.nil?
|
558
|
+
|
559
|
+
node.send(source_or_target.to_sym).model.name
|
560
|
+
end
|
561
|
+
|
562
|
+
# @param xmi_id [String]
|
563
|
+
# @param source_or_target [String]
|
564
|
+
# @return [String]
|
565
|
+
def connector_labels(xmi_id, source_or_target)
|
566
|
+
node = connector_node_by_id(xmi_id, source_or_target)
|
567
|
+
return if node.nil?
|
544
568
|
|
545
|
-
node.
|
569
|
+
node.labels&.rt || node.labels&.lt
|
546
570
|
end
|
547
571
|
|
548
572
|
# @param xmi_id [String]
|
data/lutaml.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_runtime_dependency "parslet", "~> 2.0.0"
|
37
37
|
spec.add_runtime_dependency "ruby-graphviz", "~> 1.2"
|
38
38
|
spec.add_runtime_dependency "thor", "~> 1.0"
|
39
|
-
spec.add_runtime_dependency "xmi", ">= 0.3.
|
39
|
+
spec.add_runtime_dependency "xmi", ">= 0.3.8"
|
40
40
|
|
41
41
|
spec.add_development_dependency "byebug"
|
42
42
|
spec.add_development_dependency "equivalent-xml", "~> 0.6.0"
|
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.
|
4
|
+
version: 0.9.7
|
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-
|
11
|
+
date: 2024-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: expressir
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.3.
|
117
|
+
version: 0.3.8
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.3.
|
124
|
+
version: 0.3.8
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: byebug
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|