lutaml-xmi 0.1.1 → 0.1.2

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: 0e858e6db1ba319029749472712e560d0b674c09f50fc1a6f0140a31b336fd0b
4
- data.tar.gz: b0f73e57fc490d434bdb038bad499717d826e0044f1df6600b7acf98030a375e
3
+ metadata.gz: 629f979aa19a9752da8b4c75d763fc4b7cb2bb7e8c94ecf99080f6b69cc7cb91
4
+ data.tar.gz: 3d43008c0fdf0cba05f2266129aaa6e2f1e3d3ca21ecde1e0226d1dd9f6e3b09
5
5
  SHA512:
6
- metadata.gz: 0adb4d6ccb24ca5b22d0c96d28f32c50b1ba7595b18d5842b97b0c5f2007e53f27a3319f8d9291035e5d7b9e17106367acf028912b53f048fd8f601b0b0c964f
7
- data.tar.gz: 02cb13ff769e592f7ad0fef6aa6147420584bdacd36218bbdec6922dff26a7ae85bd0d0596f54c6a7c75b54ede39c4736f46123956deab595a806befa890f4ff
6
+ metadata.gz: 35c6eaef31f0041dca19d776f6dde6150aafa50cfd7bc24c0fbab21deb5d7bd9193ba87df698ebda194c2ad58c58c6daf1880a2a09d3b961786cb786b7601b0e
7
+ data.tar.gz: 70294ad01b275265d8106690cb34ee82694546f1746bbb9cae24d2b14041f2194d09025c2eea932be994b529300566519b8dd85fb9ff65d859f2e66bcfb2f9ca
data/Makefile ADDED
@@ -0,0 +1,2 @@
1
+ fix-lint-staged:
2
+ git status --short | egrep '^(A|M)' | awk '{ print $$2}' | grep -v db/schema.rb | xargs bundle exec rubocop -a
@@ -7,17 +7,17 @@ module Lutaml
7
7
  module Parsers
8
8
  # Class for parsing .xmi schema files into ::Lutaml::Uml::Document
9
9
  class XML
10
- ATTRIBUTE_MAPPINGS = {
11
- "uml:LiteralInteger" => "1",
12
- "uml:LiteralUnlimitedNatural" => "*"
13
- }
10
+ LOVER_VALUE_MAPPINGS = {
11
+ "0" => "C",
12
+ "1" => "M",
13
+ }.freeze
14
14
  attr_reader :main_model, :xmi_cache
15
15
 
16
16
  # @param [String] io - file object with path to .xmi file
17
17
  # [Hash] options - options for parsing
18
18
  #
19
19
  # @return [Lutaml::XMI::Model::Document]
20
- def self.parse(io, options = {})
20
+ def self.parse(io, _options = {})
21
21
  new.parse(Nokogiri::XML(io.read))
22
22
  end
23
23
 
@@ -31,20 +31,20 @@ module Lutaml
31
31
  private
32
32
 
33
33
  def serialize_to_hash(xmi_doc)
34
- main_model = xmi_doc.xpath('//uml:Model[@xmi:type="uml:Model"]').first
34
+ model = xmi_doc.xpath('//uml:Model[@xmi:type="uml:Model"]').first
35
35
  {
36
- name: main_model["name"],
37
- packages: serialize_model_packages(main_model)
36
+ name: model["name"],
37
+ packages: serialize_model_packages(model),
38
38
  }
39
39
  end
40
40
 
41
- def serialize_model_packages(main_model)
42
- main_model.xpath('./packagedElement[@xmi:type="uml:Package"]').map do |package|
41
+ def serialize_model_packages(model)
42
+ model.xpath('./packagedElement[@xmi:type="uml:Package"]').map do |package|
43
43
  {
44
44
  name: package["name"],
45
45
  packages: serialize_model_packages(package),
46
46
  classes: serialize_model_classes(package),
47
- enums: serialize_model_enums(package)
47
+ enums: serialize_model_enums(package),
48
48
  }
49
49
  end
50
50
  end
@@ -52,12 +52,15 @@ module Lutaml
52
52
  def serialize_model_classes(model)
53
53
  model.xpath('./packagedElement[@xmi:type="uml:Class"]').map do |klass|
54
54
  {
55
- xmi_id: klass['xmi:id'],
56
- xmi_uuid: klass['xmi:uuid'],
57
- name: klass['name'],
55
+ xmi_id: klass["xmi:id"],
56
+ xmi_uuid: klass["xmi:uuid"],
57
+ name: klass["name"],
58
58
  attributes: serialize_class_attributes(klass),
59
59
  associations: serialize_model_associations(klass),
60
- definition: lookup_model_definition(klass)
60
+ constraints: serialize_class_constraints(klass),
61
+ is_abstract: doc_node_attribute_value(klass, "isAbstract"),
62
+ definition: doc_node_attribute_value(klass, "documentation"),
63
+ stereotype: doc_node_attribute_value(klass, "stereotype"),
61
64
  }
62
65
  end
63
66
  end
@@ -65,77 +68,159 @@ module Lutaml
65
68
  def serialize_model_enums(model)
66
69
  model.xpath('./packagedElement[@xmi:type="uml:Enumeration"]').map do |enum|
67
70
  attributes = enum
68
- .xpath('.//ownedLiteral[@xmi:type="uml:EnumerationLiteral"]')
69
- .map do |attribute|
70
- {
71
- # TODO: xmi_id
72
- # xmi_id: enum['xmi:id'],
73
- type: attribute['name'],
74
- }
75
- end
71
+ .xpath('.//ownedLiteral[@xmi:type="uml:EnumerationLiteral"]')
72
+ .map do |attribute|
73
+ {
74
+ # TODO: xmi_id
75
+ # xmi_id: enum['xmi:id'],
76
+ type: attribute["name"],
77
+ }
78
+ end
76
79
  {
77
- xmi_id: enum['xmi:id'],
78
- xmi_uuid: enum['xmi:uuid'],
79
- name: enum['name'],
80
- attributes: attributes
80
+ xmi_id: enum["xmi:id"],
81
+ xmi_uuid: enum["xmi:uuid"],
82
+ name: enum["name"],
83
+ attributes: attributes,
84
+ definition: doc_node_attribute_value(enum, "documentation"),
85
+ stereotype: doc_node_attribute_value(enum, "stereotype"),
81
86
  }
82
87
  end
83
88
  end
84
89
 
85
90
  def serialize_model_associations(klass)
86
- return unless klass.attributes['name']
91
+ xmi_id = klass["xmi:id"]
92
+ main_model.xpath(%(//element[@xmi:idref="#{xmi_id}"]/links/*)).map do |link|
93
+ member_end, member_end_type, member_end_cardinality, member_end_attribute_name = serialize_member_type(xmi_id, link)
94
+ {
95
+ xmi_id: link["xmi:id"],
96
+ member_end: member_end,
97
+ member_end_type: member_end_type,
98
+ member_end_cardinality: member_end_cardinality,
99
+ member_end_attribute_name: member_end_attribute_name,
100
+ }
101
+ end
102
+ end
87
103
 
88
- klass.xpath('.//ownedAttribute/type').map do |assoc|
89
- if assoc.attributes && assoc.attributes['idref']
90
- id_ref = assoc.attributes['idref'].value
91
- member_end = lookup_entity_name(id_ref)
92
- end
93
- if member_end
104
+ def serialize_class_constraints(klass)
105
+ class_element_metadata(klass).xpath("./constraints/constraint").map do |constraint|
106
+ {
107
+ xmi_id: constraint["xmi:id"],
108
+ body: constraint["name"],
109
+ }
110
+ end
111
+ end
112
+
113
+ def serialize_member_type(owned_xmi_id, link)
114
+ return generalization_association(owned_xmi_id, link) if link.name == "Generalization"
115
+
116
+ xmi_id = link.attributes["start"].value
117
+ member_end = lookup_entity_name(xmi_id)
118
+
119
+ member_end_node = if link.name == "Association"
120
+ link_xmk_id = link["xmi:id"]
121
+ main_model.xpath(%(//packagedElement[@xmi:id="#{link_xmk_id}"]//type[@xmi:idref="#{xmi_id}"])).first
122
+ else
123
+ main_model.xpath(%(//ownedAttribute[@association]/type[@xmi:idref="#{xmi_id}"])).first
124
+ end
125
+ if member_end_node
126
+ assoc = member_end_node.parent
127
+ member_end_cardinality = { "min" => cardinality_min_value(assoc), "max" => cardinality_max_value(assoc) }
128
+ member_end_attribute_name = assoc.attributes["name"]&.value
129
+ end
130
+
131
+ [member_end, "aggregation", member_end_cardinality, member_end_attribute_name]
132
+ end
133
+
134
+ def generalization_association(owned_xmi_id, link)
135
+ if link.attributes["start"].value == owned_xmi_id
136
+ xmi_id = link.attributes["end"].value
137
+ member_end_type = "inheritance"
138
+ else
139
+ xmi_id = link.attributes["start"].value
140
+ member_end_type = "generalization"
141
+ end
142
+ member_end = lookup_entity_name(xmi_id)
143
+
144
+ member_end_node = main_model.xpath(%(//ownedAttribute[@association]/type[@xmi:idref="#{xmi_id}"])).first
145
+ if member_end_node
146
+ assoc = member_end_node.parent
147
+ member_end_cardinality = { "min" => cardinality_min_value(assoc), "max" => cardinality_max_value(assoc) }
148
+ end
149
+
150
+ [member_end, member_end_type, member_end_cardinality, nil]
151
+ end
152
+
153
+ def class_element_metadata(klass)
154
+ main_model.xpath(%(//element[@xmi:idref="#{klass['xmi:id']}"]))
155
+ end
156
+
157
+ def serialize_class_attributes(klass)
158
+ klass.xpath('.//ownedAttribute[@xmi:type="uml:Property"]').map do |attribute|
159
+ type = attribute.xpath(".//type").first || {}
160
+ if attribute.attributes["association"].nil?
94
161
  {
95
- xmi_id: assoc['xmi:id'],
96
- xmi_uuid: assoc['xmi:uuid'],
97
- name: assoc['name'],
98
- member_end: member_end
162
+ # TODO: xmi_id
163
+ # xmi_id: klass['xmi:id'],
164
+ name: attribute["name"],
165
+ type: lookup_entity_name(type["xmi:idref"]) || type["xmi:idref"],
166
+ is_derived: attribute["isDerived"],
167
+ cardinality: { "min" => cardinality_min_value(attribute), "max" => cardinality_max_value(attribute) },
168
+ definition: lookup_attribute_definition(attribute),
99
169
  }
100
170
  end
101
171
  end.compact
102
172
  end
103
173
 
104
- def serialize_class_attributes(klass)
105
- klass.xpath('.//ownedAttribute[@xmi:type="uml:Property"]').map do |attribute|
106
- type = attribute.xpath('.//type').first || {}
107
- lowerValue = attribute.xpath('.//lowerValue').first || {}
108
- upperValue = attribute.xpath('.//upperValue').first || {}
109
- {
110
- # TODO: xmi_id
111
- # xmi_id: klass['xmi:id'],
112
- name: attribute['name'],
113
- type: lookup_entity_name(type['xmi:idref']) || type['xmi:idref'],
114
- cardinality: [ATTRIBUTE_MAPPINGS[lowerValue["xmi:type"]], ATTRIBUTE_MAPPINGS[upperValue["xmi:type"]]].compact
115
- }
116
- end
174
+ def cardinality_min_value(node)
175
+ lower_value_node = node.xpath(".//lowerValue").first
176
+ return unless lower_value_node
177
+
178
+ lower_value = lower_value_node.attributes["value"]&.value
179
+ LOVER_VALUE_MAPPINGS[lower_value]
117
180
  end
118
181
 
119
- def lookup_model_definition(klass)
120
- xmi_id = klass['xmi:id']
121
- node = main_model.xpath(%Q(//element[@xmi:idref="#{xmi_id}"]/properties)).first
122
- return unless node
182
+ def cardinality_max_value(node)
183
+ upper_value_node = node.xpath(".//upperValue").first
184
+ return unless upper_value_node
185
+
186
+ upper_value_node.attributes["value"]&.value
187
+ end
123
188
 
124
- node.attributes['documentation']&.value
189
+ def doc_node_attribute_value(node, attr_name)
190
+ xmi_id = node["xmi:id"]
191
+ doc_node = main_model.xpath(%(//element[@xmi:idref="#{xmi_id}"]/properties)).first
192
+ return unless doc_node
193
+
194
+ doc_node.attributes[attr_name]&.value
195
+ end
196
+
197
+ def lookup_attribute_definition(node)
198
+ xmi_id = node["xmi:id"]
199
+ doc_node = main_model.xpath(%(//attribute[@xmi:idref="#{xmi_id}"]/documentation)).first
200
+ return unless doc_node
201
+
202
+ doc_node.attributes["value"]&.value
125
203
  end
126
204
 
127
205
  def lookup_entity_name(xmi_id)
128
- xmi_cache[xmi_id] ||= model_node_name_by_xmi_id(xmi_id)
206
+ xmi_cache[xmi_id] ||= model_node_name_by_xmi_id(xmi_id) || connector_source_name(xmi_id)
129
207
  xmi_cache[xmi_id]
130
208
  end
131
209
 
210
+ def connector_source_name(xmi_id)
211
+ node = main_model.xpath(%(//source[@xmi:idref="#{xmi_id}"]/model)).first
212
+ return unless node
213
+
214
+ node.attributes["name"]&.value
215
+ end
216
+
132
217
  def model_node_name_by_xmi_id(xmi_id)
133
- node = main_model.xpath(%Q(//*[@xmi:id="#{xmi_id}"])).first
218
+ node = main_model.xpath(%(//*[@xmi:id="#{xmi_id}"])).first
134
219
  return unless node
135
220
 
136
- node.attributes['name']&.value
221
+ node.attributes["name"]&.value
137
222
  end
138
223
  end
139
224
  end
140
225
  end
141
- end
226
+ end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
2
  module XMI
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -244,6 +244,41 @@
244
244
  <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="EAID_LI000064_49E6_4725_AC7B_382A34BB8935" value="1"/>
245
245
  </ownedAttribute>
246
246
  </packagedElement>
247
+ <packagedElement xmi:type="uml:Association" xmi:id="EAID_7F310A6F_F068_4c1d_8FFD_B01FE62D6D1C">
248
+ <memberEnd xmi:idref="EAID_dst310A6F_F068_4c1d_8FFD_B01FE62D6D1C"/>
249
+ <ownedEnd xmi:type="uml:Property" xmi:id="EAID_dst310A6F_F068_4c1d_8FFD_B01FE62D6D1C" association="EAID_7F310A6F_F068_4c1d_8FFD_B01FE62D6D1C">
250
+ <type xmi:idref="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA"/>
251
+ </ownedEnd>
252
+ <memberEnd xmi:idref="EAID_src310A6F_F068_4c1d_8FFD_B01FE62D6D1C"/>
253
+ </packagedElement>
254
+ <packagedElement xmi:type="uml:Class" xmi:id="EAID_37BF1557_0370_435d_94BB_8FCC4574561B" name="TemporalGeometricPrimitive" isAbstract="true">
255
+ <ownedAttribute xmi:type="uml:Property" xmi:id="EAID_43D3DBAC_3887_4b74_8DBB_949F1AFDE20E" name="spatialDimension">
256
+ <type xmi:idref="EAID_12886CE2_182E_4081_8D05_E09B06F51177"/>
257
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI000011_3887_4b74_8DBB_949F1AFDE20E" value="1"/>
258
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="EAID_LI000012_3887_4b74_8DBB_949F1AFDE20E" value="1"/>
259
+ </ownedAttribute>
260
+ <ownedAttribute xmi:type="uml:Property" xmi:id="EAID_5085D691_2244_4232_ACA0_CB0C32654079" name="temporalDimension">
261
+ <type xmi:idref="EAID_12886CE2_182E_4081_8D05_E09B06F51177"/>
262
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI000013_2244_4232_ACA0_CB0C32654079" value="1"/>
263
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="EAID_LI000014_2244_4232_ACA0_CB0C32654079" value="1"/>
264
+ </ownedAttribute>
265
+ <generalization xmi:type="uml:Generalization" xmi:id="EAID_84688F21_D758_44ab_870D_69D890029769" general="EAID_AF08B23A_D40E_4e8a_B258_60C53D27E384"/>
266
+ <generalization xmi:type="uml:Generalization" xmi:id="EAID_AD6CE071_3261_4681_B8E1_25AE657BBCD2" general="EAID_82DA65AB_212B_44fd_BCDC_232A2AA22542"/>
267
+ </packagedElement>
268
+ <packagedElement xmi:type="uml:Association" xmi:id="EAID_25C1510D_9559_406f_867E_2A350C45C8A5" name="Realisation">
269
+ <memberEnd xmi:idref="EAID_dstC1510D_9559_406f_867E_2A350C45C8A5"/>
270
+ <memberEnd xmi:idref="EAID_srcC1510D_9559_406f_867E_2A350C45C8A5"/>
271
+ <ownedEnd xmi:type="uml:Property" xmi:id="EAID_srcC1510D_9559_406f_867E_2A350C45C8A5" name="topology" association="EAID_25C1510D_9559_406f_867E_2A350C45C8A5">
272
+ <type xmi:idref="EAID_AE0137BF_A059_4c07_B438_75C5D3A3705D"/>
273
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI000015__9559_406f_867E_2A350C45C8A5" value="0"/>
274
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="EAID_LI000016__9559_406f_867E_2A350C45C8A5" value="*"/>
275
+ </ownedEnd>
276
+ <ownedEnd xmi:type="uml:Property" xmi:id="EAID_dstC1510D_9559_406f_867E_2A350C45C8A5" name="geometry" association="EAID_25C1510D_9559_406f_867E_2A350C45C8A5">
277
+ <type xmi:idref="EAID_37BF1557_0370_435d_94BB_8FCC4574561B"/>
278
+ <lowerValue xmi:type="uml:LiteralInteger" xmi:id="EAID_LI000029__9559_406f_867E_2A350C45C8A5" value="0"/>
279
+ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="EAID_LI000030__9559_406f_867E_2A350C45C8A5" value="1"/>
280
+ </ownedEnd>
281
+ </packagedElement>
247
282
  </packagedElement>
248
283
  <packagedElement xmi:type="uml:Package" xmi:id="EAPK_6FEDD31A_6F40_4ed8_9230_600BB66D2296" name="Common Spatio-temporal Classes">
249
284
  <packagedElement xmi:type="uml:Package" xmi:id="EAPK_C93A8CD8_53C7_4d95_8BC7_591AE2BB7563" name="Temporal and Zonal Geometry">
@@ -1216,6 +1251,249 @@
1216
1251
  <appliedProfile xmi:type="uml:Profile" href="http://www.sparxsystems.com/profiles/thecustomprofile/1.0#thecustomprofile"/>
1217
1252
  </profileApplication>
1218
1253
  </uml:Model>
1254
+ <xmi:Extension extender="Enterprise Architect" extenderID="6.5">
1255
+ <elements>
1256
+ <element xmi:idref="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA" xmi:type="uml:Class" name="TemporalGeometricComplex" scope="public">
1257
+ <model package="EAPK_A6E46DCC_4D34_4dc0_AD3E_D006699DC90B" tpos="8" ea_localid="195" ea_eleType="element"/>
1258
+ <properties documentation="&lt;b&gt;Temporal Geometric Complex&lt;/b&gt; implements geometric &lt;b&gt;Complex&lt;/b&gt; for &lt;b&gt;Temporal Geometry.&lt;/b&gt;" isSpecification="false" sType="Class" nType="0" scope="public" stereotype="interface" isRoot="false" isLeaf="false" isAbstract="true" isActive="false"/>
1259
+ <project author="Gibb Robert" version="1.0" phase="1.0" created="2019-12-28 17:33:48" modified="2020-12-04 15:29:48" complexity="1" status="Proposed"/>
1260
+ <code gentype="Java"/>
1261
+ <style appearance="BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=1;HSwimLanes=1;BorderStyle=0;"/>
1262
+ <tags>
1263
+ <tag xmi:id="EAID_1538380D_5A39_4652_A61F_E3A59A665D40" name="callableElement" modelElement="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA"/>
1264
+ <tag xmi:id="EAID_99754119_9123_4fff_B8D8_4A3959990702" name="documentation" modelElement="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA"/>
1265
+ <tag xmi:id="EAID_D30569CC_A71F_406c_8270_173E28C03FBC" name="implementationRef" modelElement="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA"/>
1266
+ <tag xmi:id="EAID_36A4E32B_02A7_4ba2_B8DF_2C05DDD08030" name="operationRefs" modelElement="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA"/>
1267
+ </tags>
1268
+ <xrefs value="$XREFPROP=$XID={0FF4F100-7C89-4d8e-85B8-2A94D1E7D5B1}$XID;$NAM=Stereotypes$NAM;$TYP=element property$TYP;$VIS=Public$VIS;$PAR=0$PAR;$DES=@STEREO;Name=interface;GUID={5053837D-425B-435d-8D8B-C0487035B858};@ENDSTEREO;$DES;$CLT={60A00B1F-43C3-433b-8060-2EB473EEE6BA}$CLT;$SUP=&lt;none&gt;$SUP;$ENDXREF;"/>
1269
+ <extendedProperties tagged="0" package_name="Temporal Geometry and Topology"/>
1270
+ <links>
1271
+ <Generalization xmi:id="EAID_FBC084CC_4070_4dd5_8276_8A47DE1A72CD" start="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA" end="EAID_66ADAA69_93B4_4837_A00D_1AE9BB6FB53B"/>
1272
+ <Association xmi:id="EAID_7EB3B4C8_5C04_473c_A4D8_DE460008BE7F" start="EAID_00ACADD9_EF9A_4ac8_8257_3DB6227AF948" end="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA"/>
1273
+ <Aggregation xmi:id="EAID_7F310A6F_F068_4c1d_8FFD_B01FE62D6D1C" start="EAID_37BF1557_0370_435d_94BB_8FCC4574561B" end="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA"/>
1274
+ <Aggregation xmi:id="EAID_F502A1E3_E24C_4549_8B9F_8AF1E3F428C6" start="EAID_B1233577_2573_4def_A92F_1C0E83443842" end="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA"/>
1275
+ </links>
1276
+ </element>
1277
+ <element xmi:idref="EAID_66ADAA69_93B4_4837_A00D_1AE9BB6FB53B" xmi:type="uml:Class" name="TemporalGeometricCollection" scope="public">
1278
+ <model package="EAPK_A6E46DCC_4D34_4dc0_AD3E_D006699DC90B" tpos="9" ea_localid="201" ea_eleType="element"/>
1279
+ <properties documentation="&lt;b&gt;Temporal Geometric Collection&lt;/b&gt; implements geometric &lt;b&gt;Collection&lt;/b&gt; for &lt;b&gt;Temporal Geometry.&lt;/b&gt;&#xA;" isSpecification="false" sType="Class" nType="0" scope="public" stereotype="interface" isRoot="false" isLeaf="false" isAbstract="true" isActive="false"/>
1280
+ <project author="Gibb Robert" version="1.0" phase="1.0" created="2020-02-18 09:35:33" modified="2020-12-04 15:29:52" complexity="1" status="Proposed"/>
1281
+ <code gentype="Java"/>
1282
+ <style appearance="BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=1;HSwimLanes=1;BorderStyle=0;"/>
1283
+ <tags>
1284
+ <tag xmi:id="EAID_70343355_16F7_406d_82A7_D63CA70124F7" name="callableElement" modelElement="EAID_66ADAA69_93B4_4837_A00D_1AE9BB6FB53B"/>
1285
+ <tag xmi:id="EAID_9F0A2876_7854_4928_A1F7_B7F0CB465185" name="documentation" modelElement="EAID_66ADAA69_93B4_4837_A00D_1AE9BB6FB53B"/>
1286
+ <tag xmi:id="EAID_DAEED741_8AB5_4e19_8B96_2DBD158591E3" name="implementationRef" modelElement="EAID_66ADAA69_93B4_4837_A00D_1AE9BB6FB53B"/>
1287
+ <tag xmi:id="EAID_B9494DCD_1447_4e75_9679_BA9F22C0C8F5" name="operationRefs" modelElement="EAID_66ADAA69_93B4_4837_A00D_1AE9BB6FB53B"/>
1288
+ </tags>
1289
+ <xrefs value="$XREFPROP=$XID={53451E9A-C43C-4342-BA8D-969F2BAACB3A}$XID;$NAM=Stereotypes$NAM;$TYP=element property$TYP;$VIS=Public$VIS;$PAR=0$PAR;$DES=@STEREO;Name=interface;GUID={5053837D-425B-435d-8D8B-C0487035B858};@ENDSTEREO;$DES;$CLT={66ADAA69-93B4-4837-A00D-1AE9BB6FB53B}$CLT;$SUP=&lt;none&gt;$SUP;$ENDXREF;"/>
1290
+ <extendedProperties tagged="0" package_name="Temporal Geometry and Topology"/>
1291
+ <links>
1292
+ <Generalization xmi:id="EAID_3B3D9500_1668_4529_A500_03753B605AA9" start="EAID_66ADAA69_93B4_4837_A00D_1AE9BB6FB53B" end="EAID_82DA65AB_212B_44fd_BCDC_232A2AA22542"/>
1293
+ <Aggregation xmi:id="EAID_AD3FB2D7_370B_45ea_A98B_40B5B296E946" start="EAID_82DA65AB_212B_44fd_BCDC_232A2AA22542" end="EAID_66ADAA69_93B4_4837_A00D_1AE9BB6FB53B"/>
1294
+ <Generalization xmi:id="EAID_FBC084CC_4070_4dd5_8276_8A47DE1A72CD" start="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA" end="EAID_66ADAA69_93B4_4837_A00D_1AE9BB6FB53B"/>
1295
+ </links>
1296
+ </element>
1297
+ </elements>
1298
+ <element xmi:idref="EAID_37BF1557_0370_435d_94BB_8FCC4574561B" xmi:type="uml:Class" name="TemporalGeometricPrimitive" scope="public">
1299
+ <model package="EAPK_A6E46DCC_4D34_4dc0_AD3E_D006699DC90B" tpos="5" ea_localid="200" ea_eleType="element"/>
1300
+ <properties documentation="&lt;b&gt;Temporal Geometric Primitive &lt;/b&gt;implements geometric &lt;b&gt;Primitive &lt;/b&gt;for &lt;b&gt;Temporal Geometry.&lt;/b&gt;" isSpecification="false" sType="Class" nType="0" scope="public" stereotype="interface" isRoot="false" isLeaf="false" isAbstract="true" isActive="false"/>
1301
+ <project version="2006" phase="IS" created="2020-03-09 13:56:11" modified="2020-12-04 15:28:44" complexity="2" status="Approved"/>
1302
+ <code/>
1303
+ <style appearance="BackColor=-1;BorderColor=-1;BorderWidth=-1;FontColor=-1;VSwimLanes=1;HSwimLanes=1;BorderStyle=0;"/>
1304
+ <tags>
1305
+ <tag xmi:id="EAID_F96414D6_F8FE_4936_8DC7_D9B30AED6A66" name="callableElement" modelElement="EAID_37BF1557_0370_435d_94BB_8FCC4574561B"/>
1306
+ <tag xmi:id="EAID_5CE471BA_BDEB_4b9b_B372_B503E8873A6B" name="documentation" modelElement="EAID_37BF1557_0370_435d_94BB_8FCC4574561B"/>
1307
+ <tag xmi:id="EAID_268A14D8_E953_4ca3_9CCF_E0C12A3156B4" name="implementationRef" modelElement="EAID_37BF1557_0370_435d_94BB_8FCC4574561B"/>
1308
+ <tag xmi:id="EAID_0A68E48A_B8F4_4012_8D7C_B0EA4CDA134A" name="operationRefs" modelElement="EAID_37BF1557_0370_435d_94BB_8FCC4574561B"/>
1309
+ <tag xmi:id="EAID_2B2032F4_C702_40ce_8058_A02DBBF614CD" name="persistence" value="persistent" modelElement="EAID_37BF1557_0370_435d_94BB_8FCC4574561B"/>
1310
+ </tags>
1311
+ <xrefs value="$XREFPROP=$XID={6A6ED87F-D2CD-406e-940C-7AE9E61D24FB}$XID;$NAM=Stereotypes$NAM;$TYP=element property$TYP;$VIS=Public$VIS;$PAR=0$PAR;$DES=@STEREO;Name=interface;GUID={5053837D-425B-435d-8D8B-C0487035B858};@ENDSTEREO;$DES;$CLT={37BF1557-0370-435d-94BB-8FCC4574561B}$CLT;$SUP=&lt;none&gt;$SUP;$ENDXREF;$XREFPROP=$XID={93706A91-553C-4a70-9F58-5D3E7B865678}$XID;$NAM=CustomProperties$NAM;$TYP=element property$TYP;$VIS=Public$VIS;$DES=@PROP=@NAME=isActive@ENDNAME;@TYPE=Boolean@ENDTYPE;@VALU=@ENDVALU;@PRMT=@ENDPRMT;@ENDPROP;$DES;$CLT={37BF1557-0370-435d-94BB-8FCC4574561B}$CLT;$SUP=&lt;none&gt;$SUP;$ENDXREF;"/>
1312
+ <extendedProperties tagged="0" package_name="Temporal Geometry and Topology" persistence="Persistent"/>
1313
+ <attributes>
1314
+ <attribute xmi:idref="EAID_43D3DBAC_3887_4b74_8DBB_949F1AFDE20E" name="spatialDimension" scope="Public">
1315
+ <initial/>
1316
+ <documentation value="Dimension of its spatial geometry component."/>
1317
+ <model ea_localid="417" ea_guid="{43D3DBAC-3887-4b74-8DBB-949F1AFDE20E}"/>
1318
+ <properties type="Integer" derived="0" precision="0" collection="false" length="0" static="0" duplicates="0" changeability="changeable"/>
1319
+ <coords ordered="0" scale="0"/>
1320
+ <containment containment="Not Specified" position="0"/>
1321
+ <stereotype/>
1322
+ <bounds lower="1" upper="1"/>
1323
+ <options/>
1324
+ <style/>
1325
+ <styleex value="volatile=0;union=0;"/>
1326
+ <tags/>
1327
+ <xrefs/>
1328
+ </attribute>
1329
+ <attribute xmi:idref="EAID_5085D691_2244_4232_ACA0_CB0C32654079" name="temporalDimension" scope="Public">
1330
+ <initial/>
1331
+ <documentation value="Dimension of its temporal geometry component."/>
1332
+ <model ea_localid="418" ea_guid="{5085D691-2244-4232-ACA0-CB0C32654079}"/>
1333
+ <properties type="Integer" derived="0" precision="0" collection="false" length="0" static="0" duplicates="0" changeability="changeable"/>
1334
+ <coords ordered="0" scale="0"/>
1335
+ <containment containment="Not Specified" position="1"/>
1336
+ <stereotype/>
1337
+ <bounds lower="1" upper="1"/>
1338
+ <options/>
1339
+ <style/>
1340
+ <styleex value="volatile=0;union=0;"/>
1341
+ <tags/>
1342
+ <xrefs/>
1343
+ </attribute>
1344
+ </attributes>
1345
+ <constraints>
1346
+ <constraint name="self.coordinateDimension &lt;= 1&#xA;&#xA;" type="Invariant" weight="0.00" status="Approved"/>
1347
+ <constraint name="self.rsid.CoordinateSystem = TemporalCS" type="Invariant" weight="0.00" status="Approved"/>
1348
+ <constraint name="self.spatialDimension.isEmpty = True" type="Invariant" weight="0.00" status="Approved"/>
1349
+ <constraint name="self.type.in{point,line} = True" type="Invariant" weight="0.00" status="Approved"/>
1350
+ </constraints>
1351
+ <links>
1352
+ <Aggregation xmi:id="EAID_7F310A6F_F068_4c1d_8FFD_B01FE62D6D1C" start="EAID_37BF1557_0370_435d_94BB_8FCC4574561B" end="EAID_60A00B1F_43C3_433b_8060_2EB473EEE6BA"/>
1353
+ <Generalization xmi:id="EAID_84688F21_D758_44ab_870D_69D890029769" start="EAID_37BF1557_0370_435d_94BB_8FCC4574561B" end="EAID_AF08B23A_D40E_4e8a_B258_60C53D27E384"/>
1354
+ <Generalization xmi:id="EAID_AD6CE071_3261_4681_B8E1_25AE657BBCD2" start="EAID_37BF1557_0370_435d_94BB_8FCC4574561B" end="EAID_82DA65AB_212B_44fd_BCDC_232A2AA22542"/>
1355
+ <Association xmi:id="EAID_25C1510D_9559_406f_867E_2A350C45C8A5" start="EAID_AE0137BF_A059_4c07_B438_75C5D3A3705D" end="EAID_37BF1557_0370_435d_94BB_8FCC4574561B"/>
1356
+ <Generalization xmi:id="EAID_60129D98_D599_4e3c_9DC3_37724601FFD7" start="EAID_37ED45D9_A247_40c2_A156_6546916DA8BB" end="EAID_37BF1557_0370_435d_94BB_8FCC4574561B"/>
1357
+ <Generalization xmi:id="EAID_F43854F6_4D07_4e42_834F_434CCAAF0E4B" start="EAID_60BA6F15_2E36_4995_B3A8_C5389797D9A2" end="EAID_37BF1557_0370_435d_94BB_8FCC4574561B"/>
1358
+ </links>
1359
+ </element>
1360
+ <connector xmi:idref="EAID_84688F21_D758_44ab_870D_69D890029769">
1361
+ <source xmi:idref="EAID_37BF1557_0370_435d_94BB_8FCC4574561B">
1362
+ <model ea_localid="200" type="Class" name="TemporalGeometricPrimitive"/>
1363
+ <role visibility="Public" targetScope="instance"/>
1364
+ <type aggregation="none" containment="Unspecified"/>
1365
+ <constraints/>
1366
+ <modifiers isOrdered="false" changeable="none" isNavigable="false"/>
1367
+ <style value="Union=0;Derived=0;AllowDuplicates=0;"/>
1368
+ <documentation/>
1369
+ <xrefs/>
1370
+ <tags/>
1371
+ </source>
1372
+ <target xmi:idref="EAID_AF08B23A_D40E_4e8a_B258_60C53D27E384">
1373
+ <model ea_localid="898" type="Interface" name="Primitive"/>
1374
+ <role visibility="Public" targetScope="instance"/>
1375
+ <type aggregation="none" containment="Unspecified"/>
1376
+ <constraints/>
1377
+ <modifiers isOrdered="false" changeable="none" isNavigable="true"/>
1378
+ <style value="Union=0;Derived=0;AllowDuplicates=0;"/>
1379
+ <documentation/>
1380
+ <xrefs/>
1381
+ <tags/>
1382
+ </target>
1383
+ <model ea_localid="729"/>
1384
+ <properties ea_type="Generalization" direction="Source -&gt; Destination"/>
1385
+ <parameterSubstitutions/>
1386
+ <documentation/>
1387
+ <appearance linemode="3" linecolor="-1" linewidth="0" seqno="0" headStyle="0" lineStyle="0"/>
1388
+ <labels/>
1389
+ <extendedProperties virtualInheritance="0"/>
1390
+ <style/>
1391
+ <xrefs/>
1392
+ <tags/>
1393
+ </connector>
1394
+ <connector xmi:idref="EAID_AD6CE071_3261_4681_B8E1_25AE657BBCD2">
1395
+ <source xmi:idref="EAID_37BF1557_0370_435d_94BB_8FCC4574561B">
1396
+ <model ea_localid="200" type="Class" name="TemporalGeometricPrimitive"/>
1397
+ <role visibility="Public" targetScope="instance"/>
1398
+ <type aggregation="none" containment="Unspecified"/>
1399
+ <constraints/>
1400
+ <modifiers isOrdered="false" changeable="none" isNavigable="false"/>
1401
+ <style value="Union=0;Derived=0;AllowDuplicates=0;"/>
1402
+ <documentation/>
1403
+ <xrefs/>
1404
+ <tags/>
1405
+ </source>
1406
+ <target xmi:idref="EAID_82DA65AB_212B_44fd_BCDC_232A2AA22542">
1407
+ <model ea_localid="199" type="Class" name="TemporalGeometry"/>
1408
+ <role visibility="Public" targetScope="instance"/>
1409
+ <type aggregation="none" containment="Unspecified"/>
1410
+ <constraints/>
1411
+ <modifiers isOrdered="false" changeable="none" isNavigable="true"/>
1412
+ <style value="Union=0;Derived=0;AllowDuplicates=0;"/>
1413
+ <documentation/>
1414
+ <xrefs/>
1415
+ <tags/>
1416
+ </target>
1417
+ <model ea_localid="734"/>
1418
+ <properties ea_type="Generalization" direction="Source -&gt; Destination"/>
1419
+ <parameterSubstitutions/>
1420
+ <documentation/>
1421
+ <appearance linemode="3" linecolor="-1" linewidth="0" seqno="0" headStyle="0" lineStyle="0"/>
1422
+ <labels/>
1423
+ <extendedProperties virtualInheritance="0"/>
1424
+ <style/>
1425
+ <xrefs/>
1426
+ <tags/>
1427
+ </connector>
1428
+ <connector xmi:idref="EAID_60129D98_D599_4e3c_9DC3_37724601FFD7">
1429
+ <source xmi:idref="EAID_37ED45D9_A247_40c2_A156_6546916DA8BB">
1430
+ <model ea_localid="194" type="Class" name="Interval"/>
1431
+ <role visibility="Public" targetScope="instance"/>
1432
+ <type aggregation="none" containment="Unspecified"/>
1433
+ <constraints/>
1434
+ <modifiers isOrdered="false" changeable="none" isNavigable="false"/>
1435
+ <style value="Union=0;Derived=0;AllowDuplicates=0;"/>
1436
+ <documentation/>
1437
+ <xrefs/>
1438
+ <tags/>
1439
+ </source>
1440
+ <target xmi:idref="EAID_37BF1557_0370_435d_94BB_8FCC4574561B">
1441
+ <model ea_localid="200" type="Class" name="TemporalGeometricPrimitive"/>
1442
+ <role visibility="Public" targetScope="instance"/>
1443
+ <type aggregation="none" containment="Unspecified"/>
1444
+ <constraints/>
1445
+ <modifiers isOrdered="false" changeable="none" isNavigable="true"/>
1446
+ <style value="Union=0;Derived=0;AllowDuplicates=0;"/>
1447
+ <documentation/>
1448
+ <xrefs/>
1449
+ <tags/>
1450
+ </target>
1451
+ <model ea_localid="746"/>
1452
+ <properties ea_type="Generalization" direction="Source -&gt; Destination"/>
1453
+ <parameterSubstitutions/>
1454
+ <documentation/>
1455
+ <appearance linemode="3" linecolor="-1" linewidth="0" seqno="0" headStyle="0" lineStyle="0"/>
1456
+ <labels/>
1457
+ <extendedProperties virtualInheritance="0"/>
1458
+ <style/>
1459
+ <xrefs/>
1460
+ <tags/>
1461
+ </connector>
1462
+ <connector xmi:idref="EAID_F43854F6_4D07_4e42_834F_434CCAAF0E4B">
1463
+ <source xmi:idref="EAID_60BA6F15_2E36_4995_B3A8_C5389797D9A2">
1464
+ <model ea_localid="196" type="Class" name="Instant"/>
1465
+ <role visibility="Public" targetScope="instance"/>
1466
+ <type aggregation="none" containment="Unspecified"/>
1467
+ <constraints/>
1468
+ <modifiers isOrdered="false" changeable="none" isNavigable="false"/>
1469
+ <style value="Union=0;Derived=0;AllowDuplicates=0;"/>
1470
+ <documentation/>
1471
+ <xrefs/>
1472
+ <tags/>
1473
+ </source>
1474
+ <target xmi:idref="EAID_37BF1557_0370_435d_94BB_8FCC4574561B">
1475
+ <model ea_localid="200" type="Class" name="TemporalGeometricPrimitive"/>
1476
+ <role visibility="Public" targetScope="instance"/>
1477
+ <type aggregation="none" containment="Unspecified"/>
1478
+ <constraints/>
1479
+ <modifiers isOrdered="false" changeable="none" isNavigable="true"/>
1480
+ <style value="Union=0;Derived=0;AllowDuplicates=0;"/>
1481
+ <documentation/>
1482
+ <xrefs/>
1483
+ <tags/>
1484
+ </target>
1485
+ <model ea_localid="741"/>
1486
+ <properties ea_type="Generalization" direction="Source -&gt; Destination"/>
1487
+ <parameterSubstitutions/>
1488
+ <documentation/>
1489
+ <appearance linemode="3" linecolor="-1" linewidth="0" seqno="0" headStyle="0" lineStyle="0"/>
1490
+ <labels/>
1491
+ <extendedProperties virtualInheritance="0"/>
1492
+ <style/>
1493
+ <xrefs/>
1494
+ <tags/>
1495
+ </connector>
1496
+ </xmi:Extension>
1219
1497
  <thecustomprofile:Bibliography base_Class="EAID_D832D6D8_0518_43f7_9166_7A4E3E8605AA"/>
1220
1498
  <thecustomprofile:BasicDoc base_Class="EAID_10AD8D60_9972_475a_AB7E_FA40212D5297"/>
1221
1499
  <thecustomprofile:enumeration base_Enumeration="EAID_E497ABDA_05EF_416a_A461_03535864970D"/>
@@ -16,6 +16,7 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
16
16
  Requirement
17
17
  RequirementSubpart
18
18
  RequirementType
19
+ TemporalGeometricPrimitive
19
20
  ]
20
21
  end
21
22
  let(:expected_class_xmi_ids) do
@@ -28,6 +29,7 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
28
29
  EAID_2AC20C81_1E83_400d_B098_BAB784395E06
29
30
  EAID_035D8176_5E9E_42c8_B447_64411AE96F57
30
31
  EAID_C1155D80_E68B_46d5_ADE5_F5639486163D
32
+ EAID_37BF1557_0370_435d_94BB_8FCC4574561B
31
33
  ]
32
34
  end
33
35
  let(:expected_enum_names) { ["ObligationType"] }
@@ -84,6 +86,15 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
84
86
  EAJava_RequirementSubpart_0..___
85
87
  ]
86
88
  end
89
+ let(:expected_association_names) do
90
+ %w[
91
+ TemporalGeometricPrimitive
92
+ TemporalGeometry
93
+ TemporalTopologicalPrimitive
94
+ Interval
95
+ Instant
96
+ ]
97
+ end
87
98
  let(:first_package) { parse.packages.first }
88
99
  let(:first_nested_package) { parse.packages.first.packages.first }
89
100
 
@@ -116,8 +127,17 @@ RSpec.describe Lutaml::XMI::Parsers::XML do
116
127
  end
117
128
 
118
129
  it "correctly parses associations for class" do
119
- klass = first_nested_package.classes.find { |entity| entity.name == 'BibliographicItem' }
120
- expect(klass.associations.map(&:member_end)).to(eq(['RequirementType']))
130
+ klass = first_nested_package.classes.find { |entity| entity.name == 'TemporalGeometricPrimitive' }
131
+ expect(klass.associations.map(&:member_end).compact).to(eq(expected_association_names))
132
+
133
+ inheritance = klass.associations.find { |entity| entity.member_end == 'TemporalGeometry' }
134
+ expect(inheritance.member_end_type).to eq('inheritance')
135
+ expect(inheritance.member_end_cardinality).to eq({"min"=>"C", "max"=>"*"})
136
+
137
+ aggregation = klass.associations.find { |entity| entity.member_end == 'TemporalTopologicalPrimitive' }
138
+ expect(aggregation.member_end_attribute_name).to eq('topology')
139
+ expect(aggregation.member_end_type).to eq('aggregation')
140
+ expect(aggregation.member_end_cardinality).to eq({"min"=>"C", "max"=>"*"})
121
141
  end
122
142
  end
123
143
  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.1
4
+ version: 0.1.2
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-03-28 00:00:00.000000000 Z
11
+ date: 2021-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashie
@@ -165,6 +165,7 @@ files:
165
165
  - ".rspec"
166
166
  - CODE_OF_CONDUCT.md
167
167
  - Gemfile
168
+ - Makefile
168
169
  - README.adoc
169
170
  - Rakefile
170
171
  - bin/console