lutaml-xmi 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lutaml/xmi/parsers/xml.rb +24 -12
- data/lib/lutaml/xmi/version.rb +1 -1
- data/lutaml-xmi.gemspec +1 -1
- data/spec/lutaml/parsers/xmi_spec.rb +3 -3
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aa59d686f5cec8d4bc3f145fdb89e7f56cc144ad573e2cf6743201a319b8414
|
4
|
+
data.tar.gz: 347bb418b224b5e7f565b2cdabb10edf63a13ffeef61017c324fbaaec1163066
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66197ddf677dccaf10859e3ce997dc91c96c5135306db310030d802c63637b4a21adc3978c23d73c4fc2a19b6502d6dc314f1b99a2379b4b82dcf863fd8f21a0
|
7
|
+
data.tar.gz: acbd3a66c75abc3ebe8ef6c14019db023984b94f060202a49f27c811d6b00f1cd5edc3b6bde80df7873587cfd2e00b1c2588f7db9031c1827644aba5a5d42097
|
@@ -117,18 +117,30 @@ module Lutaml
|
|
117
117
|
return generalization_association(owned_xmi_id, link) if link.name == "Generalization"
|
118
118
|
|
119
119
|
xmi_id = link.attributes["start"].value
|
120
|
-
member_end = lookup_entity_name(xmi_id)
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
120
|
+
member_end = lookup_entity_name(xmi_id) || connector_source_name(xmi_id)
|
121
|
+
|
122
|
+
if link.name == "Association"
|
123
|
+
assoc_connector = main_model.xpath(%(//connector[@xmi:idref="#{link['xmi:id']}"]/source)).first
|
124
|
+
if assoc_connector
|
125
|
+
connector_type = assoc_connector.children.find { |node| node.name == 'type' }
|
126
|
+
if connector_type && connector_type.attributes['multiplicity']
|
127
|
+
cardinality = connector_type.attributes['multiplicity']&.value&.split('..')
|
128
|
+
cardinality.unshift('1') if cardinality.length == 1
|
129
|
+
min, max = cardinality
|
130
|
+
end
|
131
|
+
connector_role = assoc_connector.children.find { |node| node.name == 'role' }
|
132
|
+
if connector_role
|
133
|
+
member_end_attribute_name = connector_role.attributes["name"]&.value
|
134
|
+
end
|
135
|
+
member_end_cardinality = { "min" => LOVER_VALUE_MAPPINGS[min], "max" => max }
|
136
|
+
end
|
137
|
+
else
|
138
|
+
member_end_node = main_model.xpath(%(//ownedAttribute[@association]/type[@xmi:idref="#{xmi_id}"])).first
|
139
|
+
if member_end_node
|
140
|
+
assoc = member_end_node.parent
|
141
|
+
member_end_cardinality = { "min" => cardinality_min_value(assoc), "max" => cardinality_max_value(assoc) }
|
142
|
+
member_end_attribute_name = assoc.attributes["name"]&.value
|
143
|
+
end
|
132
144
|
end
|
133
145
|
|
134
146
|
[member_end, "aggregation", member_end_cardinality, member_end_attribute_name]
|
data/lib/lutaml/xmi/version.rb
CHANGED
data/lutaml-xmi.gemspec
CHANGED
@@ -26,10 +26,10 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_runtime_dependency "hashie", "~> 4.1.0"
|
27
27
|
spec.add_runtime_dependency "thor", "~> 1.0"
|
28
28
|
spec.add_runtime_dependency "lutaml-uml"
|
29
|
+
spec.add_runtime_dependency "nokogiri", "~> 1.10"
|
29
30
|
|
30
31
|
spec.add_development_dependency "bundler", "~> 2.0"
|
31
32
|
spec.add_development_dependency "byebug"
|
32
|
-
spec.add_development_dependency "nokogiri", "~> 1.10"
|
33
33
|
spec.add_development_dependency "pry", "~> 0.12.2"
|
34
34
|
spec.add_development_dependency "rake", "~> 10.0"
|
35
35
|
spec.add_development_dependency "rspec", "~> 3.0"
|
@@ -89,8 +89,8 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
|
|
89
89
|
let(:expected_association_names) do
|
90
90
|
%w[
|
91
91
|
TemporalGeometricPrimitive
|
92
|
+
Primitive
|
92
93
|
TemporalGeometry
|
93
|
-
TemporalTopologicalPrimitive
|
94
94
|
Interval
|
95
95
|
Instant
|
96
96
|
]
|
@@ -134,8 +134,8 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
|
|
134
134
|
expect(inheritance.member_end_type).to eq('inheritance')
|
135
135
|
expect(inheritance.member_end_cardinality).to eq({"min"=>"C", "max"=>"*"})
|
136
136
|
|
137
|
-
aggregation = klass.associations.find { |entity| entity.member_end == '
|
138
|
-
expect(aggregation.member_end_attribute_name).to eq('
|
137
|
+
aggregation = klass.associations.find { |entity| entity.member_end == 'TemporalGeometricPrimitive' }
|
138
|
+
expect(aggregation.member_end_attribute_name).to eq('element')
|
139
139
|
expect(aggregation.member_end_type).to eq('aggregation')
|
140
140
|
expect(aggregation.member_end_cardinality).to eq({"min"=>"C", "max"=>"*"})
|
141
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lutaml-xmi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashie
|
@@ -53,47 +53,47 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
-
type: :
|
61
|
+
version: '1.10'
|
62
|
+
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.10'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
75
|
+
version: '2.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
82
|
+
version: '2.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: byebug
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
202
|
- !ruby/object:Gem::Version
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
205
|
+
rubygems_version: 3.1.6
|
206
206
|
signing_key:
|
207
207
|
specification_version: 4
|
208
208
|
summary: XML Metadata Interchange (XMI) Specification parser in Ruby, tools for accessing
|