lutaml-xmi 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,98 +0,0 @@
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
@@ -1,145 +0,0 @@
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
- TemporalGeometricPrimitive
20
- ]
21
- end
22
- let(:expected_class_xmi_ids) do
23
- %w[
24
- EAID_D832D6D8_0518_43f7_9166_7A4E3E8605AA
25
- EAID_10AD8D60_9972_475a_AB7E_FA40212D5297
26
- EAID_30B0131C_804F_4f67_8B6F_35DF5ABD8E78
27
- EAID_82354CDC_EACB_402f_8C2B_FD627B7416E7
28
- EAID_AD7320C2_FEE6_4352_8D56_F2C8562B6153
29
- EAID_2AC20C81_1E83_400d_B098_BAB784395E06
30
- EAID_035D8176_5E9E_42c8_B447_64411AE96F57
31
- EAID_C1155D80_E68B_46d5_ADE5_F5639486163D
32
- EAID_37BF1557_0370_435d_94BB_8FCC4574561B
33
- ]
34
- end
35
- let(:expected_enum_names) { ["ObligationType"] }
36
- let(:expected_enum_xmi_ids) { ["EAID_E497ABDA_05EF_416a_A461_03535864970D"] }
37
- let(:expected_attributes_names) do
38
- %w[
39
- classification
40
- description
41
- filename
42
- id
43
- import
44
- inherit
45
- keep-lines-together
46
- keep-with-next
47
- label
48
- measurement-target
49
- model
50
- number
51
- obligation
52
- references
53
- specification
54
- subject
55
- subrequirement
56
- subsequence
57
- title
58
- type
59
- unnumbered
60
- verification
61
- ]
62
- end
63
- let(:expected_attributes_types) do
64
- %w[
65
- EAJava_ClassificationType_0..___
66
- EAJava_RequirementSubpart_0..___
67
- EAJava_String_0..1__
68
- EAJava_String_
69
- EAJava_RequirementSubpart_0..___
70
- EAJava_String_0..___
71
- EAJava_boolean_0..1__
72
- EAJava_boolean_0..1__
73
- EAJava_String_0..1__
74
- EAJava_RequirementSubpart_0..___
75
- EAJava_String_0..1__
76
- EAJava_String_0..1__
77
- EAJava_ObligationType_1..___
78
- EAJava_BibliographicItem_0..1__
79
- EAJava_RequirementSubpart_0..___
80
- EAJava_String_0..1__
81
- EAJava_RequirementSubpart_0..___
82
- EAJava_String_0..1__
83
- EAJava_FormattedString_0..1__
84
- EAJava_String_0..1__
85
- EAJava_boolean_0..1__
86
- EAJava_RequirementSubpart_0..___
87
- ]
88
- end
89
- let(:expected_association_names) do
90
- %w[
91
- Primitive
92
- TemporalGeometry
93
- Interval
94
- Instant
95
- ]
96
- end
97
- let(:first_package) { parse.packages.first }
98
- let(:first_nested_package) { parse.packages.first.packages.first }
99
-
100
- it "parses xml file into Lutaml::Uml::Node::Document object" do
101
- expect(parse).to(be_instance_of(::Lutaml::Uml::Document))
102
- end
103
-
104
- it "correctly parses package tree" do
105
- expect(parse.packages.map(&:name)).to(eq(['ISO 19170-1 Edition 1']))
106
- expect(first_package.packages.map(&:name))
107
- .to(eq(["requirement type class diagram", "Common Spatio-temporal Classes"]))
108
- expect(first_package.packages.last.packages.map(&:name))
109
- .to(eq(["Temporal and Zonal Geometry", "Temporal and Zonal RS using Identifiers"]))
110
- end
111
-
112
- it "correctly parses package classes" do
113
- expect(first_nested_package.classes.map(&:name)).to(eq(expected_class_names))
114
- expect(first_nested_package.classes.map(&:xmi_id)).to(eq(expected_class_xmi_ids))
115
- end
116
-
117
- it "correctly parses entities of enums type" do
118
- expect(first_nested_package.enums.map(&:name)).to(eq(expected_enum_names))
119
- expect(first_nested_package.enums.map(&:xmi_id)).to(eq(expected_enum_xmi_ids))
120
- end
121
-
122
- it "correctly parses entities and attributes for class" do
123
- klass = first_nested_package.classes.find { |entity| entity.name == 'RequirementType' }
124
- expect(klass.attributes.map(&:name)).to(eq(expected_attributes_names))
125
- expect(klass.attributes.map(&:type)).to(eq(expected_attributes_types))
126
- end
127
-
128
- it "correctly parses associations for class" do
129
- klass = first_nested_package.classes.find { |entity| entity.name == 'TemporalGeometricPrimitive' }
130
- expect(klass.associations.map(&:member_end).compact).to(eq(expected_association_names))
131
-
132
- inheritance = klass.associations.find { |entity| entity.member_end == 'TemporalGeometry' }
133
- expect(inheritance.member_end_type).to eq('inheritance')
134
- expect(inheritance.member_end_cardinality).to eq({"min"=>"C", "max"=>"*"})
135
- end
136
-
137
- it "correctly parses diagrams for package" do
138
- root_package = parse.packages.first
139
- expect(root_package.diagrams.length).to(eq(2))
140
- expect(root_package.diagrams.map(&:name)).to(eq(['Fig: DGGS Package Diagram', 'Fig: Context for Temporal Geometry and Topology']))
141
- expect(root_package.diagrams.map(&:definition)).to(eq(['this is a documentation', '']))
142
- end
143
- end
144
- end
145
- end
@@ -1,7 +0,0 @@
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
data/spec/spec_helper.rb DELETED
@@ -1,21 +0,0 @@
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