lutaml-xmi 0.1.0

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.
@@ -0,0 +1,98 @@
1
+ @startuml Requirements
2
+
3
+ /'
4
+ Diagram: Requirements
5
+ DateCreate: 2019-03-06
6
+ Description: This diagram presents the model used to capture requirements, for use both in standards document markup,
7
+ and as standalone machine-readable artefacts.
8
+
9
+ History of changes:
10
+ > 2019-03-19: Added RequirementType/filename
11
+ > 2019-0-19: Added subsequence
12
+ > 2020-06-16: Added number
13
+ > 2020-06-16: Added keep-with-next
14
+ '/
15
+
16
+
17
+ '******* CLASS DEFINITION *********************************************
18
+
19
+ together {
20
+ class Requirement {
21
+ + obligation: "requirement"
22
+ }
23
+
24
+ class Recommendation {
25
+ + obligation: "recommendation"
26
+ }
27
+
28
+ class Permission {
29
+ + obligation: "permission"
30
+ }
31
+ }
32
+
33
+ class RequirementType {
34
+ + obligation: ObligationType[1..*],
35
+ + id: String,
36
+ + unnumbered: Boolean[0..1],
37
+ + number: String[0..1],
38
+ + subsequence: String[0..1],
39
+ + keep-with-next: Boolean[0..1],
40
+ + keep-lines-together: Boolean[0..1],
41
+ + filename: String[0..1],
42
+ + title: FormattedString[0..1],
43
+ + label: String[0..1],
44
+ + subject: String[0..1],
45
+ + inherit: String[0..*],
46
+ + model: String[0..1],
47
+ + type: String[0..1],
48
+ + classification: ClassificationType[0..*],
49
+ + measurement-target: RequirementSubpart[0..*],
50
+ + specification: RequirementSubpart[0..*],
51
+ + verification: RequirementSubpart[0..*],
52
+ + import: RequirementSubpart[0..*],
53
+ + description: RequirementSubpart[0..*],
54
+ + references: BibliographicItem[0..1],
55
+ + subrequirement: RequirementType[0..*]
56
+ }
57
+
58
+ class RequirementSubpart {
59
+ + type: String[0..1],
60
+ + exclude: Boolean[0..1],
61
+ + content: Block[1..*]
62
+ + keep-with-next: Boolean[0..1],
63
+ + keep-lines-together: Boolean[0..1],
64
+ }
65
+
66
+ class ClassificationType {
67
+ + tag: String,
68
+ + value: String
69
+ }
70
+
71
+ enum ObligationType <<enumeration>> {
72
+ requirement
73
+ recommendation
74
+ permission
75
+ }
76
+
77
+ class BibliographicItem <<Bibliography>> {
78
+ }
79
+
80
+ class Block <<BasicDoc>> {
81
+ }
82
+
83
+ '******* NOTES ********************************************************
84
+ note left of RequirementType: RequirementType is a generic category,\nwhich is agnostic as to obligation.\nRequirement, Recommendation, Permission\nset a specific obligation, although this\ncan be overridden
85
+ note right of RequirementType: description, import, verification,\nmeasurement-target, references\ncan appear in any order.
86
+
87
+ '******* CLASS RELATIONS **********************************************
88
+ Requirement --down-|> RequirementType
89
+ Recommendation --down-|> RequirementType
90
+ Permission --down-|> RequirementType
91
+
92
+ RequirementType <-- ObligationType
93
+ RequirementType <-- ClassificationType
94
+ RequirementType <-- BibliographicItem
95
+ RequirementType <-- Block
96
+ RequirementType <-- RequirementSubpart
97
+
98
+ @enduml
@@ -0,0 +1,87 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Lutaml::XMI::Parsers::XML do
4
+ describe '.parse' do
5
+ subject(:parse) { described_class.parse(file) }
6
+
7
+ context 'when simple xmi schema' do
8
+ let(:file) { File.new(fixtures_path('ea-xmi-2.4.2.xmi')) }
9
+ let(:expected_class_names) do
10
+ %w[
11
+ BibliographicItem
12
+ Block
13
+ ClassificationType
14
+ Permission
15
+ Recommendation
16
+ Requirement
17
+ RequirementSubpart
18
+ RequirementType
19
+ ]
20
+ end
21
+ let(:expected_class_xmi_ids) do
22
+ %w[
23
+ EAID_D832D6D8_0518_43f7_9166_7A4E3E8605AA
24
+ EAID_10AD8D60_9972_475a_AB7E_FA40212D5297
25
+ EAID_30B0131C_804F_4f67_8B6F_35DF5ABD8E78
26
+ EAID_82354CDC_EACB_402f_8C2B_FD627B7416E7
27
+ EAID_AD7320C2_FEE6_4352_8D56_F2C8562B6153
28
+ EAID_2AC20C81_1E83_400d_B098_BAB784395E06
29
+ EAID_035D8176_5E9E_42c8_B447_64411AE96F57
30
+ EAID_C1155D80_E68B_46d5_ADE5_F5639486163D
31
+ ]
32
+ end
33
+ let(:expected_enum_names) { ["ObligationType"] }
34
+ let(:expected_enum_xmi_ids) { ["EAID_E497ABDA_05EF_416a_A461_03535864970D"] }
35
+ let(:expected_attributes_names) do
36
+ %w[
37
+ classification
38
+ description
39
+ filename
40
+ id
41
+ import
42
+ inherit
43
+ keep-lines-together
44
+ keep-with-next
45
+ label
46
+ measurement-target
47
+ model
48
+ number
49
+ obligation
50
+ references
51
+ specification
52
+ subject
53
+ subrequirement
54
+ subsequence
55
+ title
56
+ type
57
+ unnumbered
58
+ verification
59
+ ]
60
+ end
61
+
62
+ it "parses xml file into Lutaml::Uml::Node::Document object" do
63
+ expect(parse).to(be_instance_of(::Lutaml::Uml::Document))
64
+ end
65
+
66
+ it "correctly parses entities of class type" do
67
+ expect(parse.classes.map(&:name)).to(eq(expected_class_names))
68
+ expect(parse.classes.map(&:xmi_id)).to(eq(expected_class_xmi_ids))
69
+ end
70
+
71
+ it "correctly parses entities of enums type" do
72
+ expect(parse.enums.map(&:name)).to(eq(expected_enum_names))
73
+ expect(parse.enums.map(&:xmi_id)).to(eq(expected_enum_xmi_ids))
74
+ end
75
+
76
+ it "correctly parses entities and attributes for class" do
77
+ klass = parse.classes.find { |entity| entity.name == 'RequirementType' }
78
+ expect(klass.attributes.map(&:name)).to(eq(expected_attributes_names))
79
+ end
80
+
81
+ it "correctly parses associations for class" do
82
+ klass = parse.classes.find { |entity| entity.name == 'BibliographicItem' }
83
+ expect(klass.associations.map(&:member_end)).to(eq(['RequirementType']))
84
+ end
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ RSpec.describe Lutaml::XMI do
4
+ it "has a version number" do
5
+ expect(Lutaml::XMI::VERSION).not_to be nil
6
+ end
7
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/setup"
4
+ require "lutaml/xmi"
5
+ require "byebug"
6
+
7
+ RSpec.configure do |config|
8
+ # Enable flags like --only-failures and --next-failure
9
+ config.example_status_persistence_file_path = ".rspec_status"
10
+
11
+ # Disable RSpec exposing methods globally on `Module` and `main`
12
+ config.disable_monkey_patching!
13
+
14
+ config.expect_with :rspec do |c|
15
+ c.syntax = :expect
16
+ end
17
+ end
18
+
19
+ def fixtures_path(path)
20
+ File.join(File.expand_path("./fixtures", __dir__), path)
21
+ end
metadata ADDED
@@ -0,0 +1,209 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lutaml-xmi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ribose Inc.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-03-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hashie
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.1.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: lutaml-uml
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.10'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.10'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.12.2
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.12.2
111
+ - !ruby/object:Gem::Dependency
112
+ name: rake
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '10.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '10.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '3.0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '3.0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: 0.54.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: 0.54.0
153
+ description: XML Metadata Interchange (XMI) Specification parser in Ruby, tools for
154
+ accessing EXPRESS data models.
155
+ email:
156
+ - open.source@ribose.com'
157
+ executables: []
158
+ extensions: []
159
+ extra_rdoc_files: []
160
+ files:
161
+ - ".github/workflows/macos.yml"
162
+ - ".github/workflows/ubuntu.yml"
163
+ - ".github/workflows/windows.yml"
164
+ - ".gitignore"
165
+ - ".rspec"
166
+ - CODE_OF_CONDUCT.md
167
+ - Gemfile
168
+ - README.adoc
169
+ - Rakefile
170
+ - bin/console
171
+ - bin/setup
172
+ - lib/lutaml/xmi.rb
173
+ - lib/lutaml/xmi/parsers/xml.rb
174
+ - lib/lutaml/xmi/version.rb
175
+ - lutaml-xmi.gemspec
176
+ - spec/fixtures/ea-xmi-2.4.2.xmi
177
+ - spec/fixtures/ea-xmi-2.5.1.xmi
178
+ - spec/fixtures/requirements.wsd
179
+ - spec/lutaml/parsers/xmi_spec.rb
180
+ - spec/lutaml/xmi_spec.rb
181
+ - spec/spec_helper.rb
182
+ homepage: https://github.com/lutaml/lutaml-xmi
183
+ licenses:
184
+ - MIT
185
+ metadata:
186
+ homepage_uri: https://github.com/lutaml/lutaml-xmi
187
+ source_code_uri: https://github.com/lutaml/lutaml-xmi
188
+ changelog_uri: https://github.com/lutaml/lutaml-xmi/releases
189
+ post_install_message:
190
+ rdoc_options: []
191
+ require_paths:
192
+ - lib
193
+ required_ruby_version: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - ">="
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
198
+ required_rubygems_version: !ruby/object:Gem::Requirement
199
+ requirements:
200
+ - - ">="
201
+ - !ruby/object:Gem::Version
202
+ version: '0'
203
+ requirements: []
204
+ rubygems_version: 3.0.3
205
+ signing_key:
206
+ specification_version: 4
207
+ summary: XML Metadata Interchange (XMI) Specification parser in Ruby, tools for accessing
208
+ EXPRESS data models.
209
+ test_files: []