reqif 0.1.0 → 0.2.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.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +7 -4
  3. data/.rubocop.yml +17 -6
  4. data/.rubocop_todo.yml +241 -0
  5. data/CLAUDE.md +73 -0
  6. data/Gemfile +5 -2
  7. data/README.adoc +61 -1
  8. data/lib/reqif/alternative_id.rb +2 -2
  9. data/lib/reqif/attribute_definition_boolean.rb +5 -4
  10. data/lib/reqif/attribute_definition_date.rb +5 -4
  11. data/lib/reqif/attribute_definition_enumeration.rb +5 -4
  12. data/lib/reqif/attribute_definition_integer.rb +5 -4
  13. data/lib/reqif/attribute_definition_real.rb +5 -4
  14. data/lib/reqif/attribute_definition_string.rb +5 -4
  15. data/lib/reqif/attribute_definition_xhtml.rb +5 -4
  16. data/lib/reqif/attribute_value_boolean.rb +3 -2
  17. data/lib/reqif/attribute_value_date.rb +4 -3
  18. data/lib/reqif/attribute_value_enumeration.rb +3 -2
  19. data/lib/reqif/attribute_value_integer.rb +4 -3
  20. data/lib/reqif/attribute_value_real.rb +4 -3
  21. data/lib/reqif/attribute_value_string.rb +3 -2
  22. data/lib/reqif/attribute_value_xhtml.rb +3 -2
  23. data/lib/reqif/children.rb +3 -2
  24. data/lib/reqif/core_content.rb +3 -2
  25. data/lib/reqif/datatype_definition_boolean.rb +5 -4
  26. data/lib/reqif/datatype_definition_date.rb +5 -4
  27. data/lib/reqif/datatype_definition_enumeration.rb +5 -4
  28. data/lib/reqif/datatype_definition_integer.rb +7 -6
  29. data/lib/reqif/datatype_definition_real.rb +7 -6
  30. data/lib/reqif/datatype_definition_string.rb +5 -4
  31. data/lib/reqif/datatype_definition_xhtml.rb +5 -4
  32. data/lib/reqif/datatypes.rb +23 -12
  33. data/lib/reqif/default_value.rb +4 -3
  34. data/lib/reqif/definition.rb +24 -16
  35. data/lib/reqif/doors/identifier.rb +15 -0
  36. data/lib/reqif/doors/module_definition.rb +23 -0
  37. data/lib/reqif/doors/namespace.rb +10 -0
  38. data/lib/reqif/doors/readonly_attributes.rb +48 -0
  39. data/lib/reqif/doors/rif_definition.rb +26 -0
  40. data/lib/reqif/doors/string_type.rb +12 -0
  41. data/lib/reqif/doors.rb +12 -0
  42. data/lib/reqif/editable_atts.rb +24 -16
  43. data/lib/reqif/embedded_value.rb +4 -3
  44. data/lib/reqif/enum_value.rb +4 -4
  45. data/lib/reqif/high_precision_date_time.rb +52 -0
  46. data/lib/reqif/namespace.rb +16 -0
  47. data/lib/reqif/object.rb +3 -3
  48. data/lib/reqif/properties.rb +2 -2
  49. data/lib/reqif/relation_group.rb +5 -4
  50. data/lib/reqif/relation_group_type.rb +5 -4
  51. data/lib/reqif/req_if.rb +7 -2
  52. data/lib/reqif/req_if_content.rb +3 -2
  53. data/lib/reqif/req_if_header.rb +4 -5
  54. data/lib/reqif/req_if_tool_extension.rb +48 -2
  55. data/lib/reqif/reqif_float.rb +97 -0
  56. data/lib/reqif/reqif_integer.rb +36 -0
  57. data/lib/reqif/source.rb +3 -3
  58. data/lib/reqif/source_specification.rb +3 -3
  59. data/lib/reqif/spec_attributes.rb +25 -13
  60. data/lib/reqif/spec_hierarchy.rb +5 -4
  61. data/lib/reqif/spec_object.rb +5 -4
  62. data/lib/reqif/spec_object_type.rb +5 -4
  63. data/lib/reqif/spec_objects.rb +3 -2
  64. data/lib/reqif/spec_relation.rb +5 -4
  65. data/lib/reqif/spec_relation_groups.rb +2 -2
  66. data/lib/reqif/spec_relation_type.rb +5 -4
  67. data/lib/reqif/spec_relations.rb +3 -3
  68. data/lib/reqif/spec_types.rb +3 -2
  69. data/lib/reqif/specification.rb +5 -4
  70. data/lib/reqif/specification_type.rb +5 -4
  71. data/lib/reqif/specifications.rb +3 -2
  72. data/lib/reqif/specified_values.rb +2 -2
  73. data/lib/reqif/string_type.rb +7 -0
  74. data/lib/reqif/target.rb +3 -3
  75. data/lib/reqif/target_specification.rb +3 -3
  76. data/lib/reqif/the_header.rb +3 -2
  77. data/lib/reqif/tool_extensions.rb +2 -2
  78. data/lib/reqif/type.rb +28 -20
  79. data/lib/reqif/values.rb +8 -5
  80. data/lib/reqif/version.rb +1 -1
  81. data/lib/reqif/xhtml/div.rb +18 -0
  82. data/lib/reqif/xhtml/namespace.rb +10 -0
  83. data/lib/reqif/xhtml/p.rb +18 -0
  84. data/lib/reqif/xhtml/span.rb +18 -0
  85. data/lib/reqif/xhtml.rb +12 -0
  86. data/lib/reqif/xhtml_content.rb +182 -2
  87. data/lib/reqif.rb +70 -14
  88. data/references/driver.xsd +270 -270
  89. data/references/reqif.xsd +892 -892
  90. data/reqif.gemspec +4 -3
  91. data/spec/fixtures/antcc_MAG8000-LTE-FeatureSpecReqBL4.reqif +4299 -0
  92. data/spec/fixtures/ea_example.reqif.xml +236 -0
  93. data/spec/fixtures/eclipse_capella_Sample.xml +177 -0
  94. data/spec/fixtures/eclipse_capella_Sample1.xml +239 -0
  95. data/spec/fixtures/eclipse_capella_Sample2.xml +239 -0
  96. data/spec/fixtures/eclipse_capella_Sample3.xml +304 -0
  97. data/spec/fixtures/eclipse_capella_model1.xml +4080 -0
  98. data/spec/fixtures/eclipse_rmf_sample.reqif +96 -0
  99. data/spec/fixtures/eclipse_rmf_specRelationTest.reqif +110 -0
  100. data/spec/fixtures/polarion_export.xml +70 -0
  101. data/spec/fixtures/strictdoc_01_minimal_reqif_sample.reqif +4 -0
  102. data/spec/fixtures/strictdoc_02_read_reqif_input.reqif +3996 -0
  103. data/spec/fixtures/strictdoc_04_convert_reqif_to_json_sample1_polarion.reqif +197 -0
  104. data/spec/fixtures/strictdoc_04_convert_reqif_to_json_sample2_sdoc.reqif +451 -0
  105. data/spec/fixtures/strictdoc_04_convert_reqif_to_json_sample3_eclipse_rmf.reqif +334 -0
  106. data/spec/fixtures/strictdoc_04_convert_reqif_to_json_sample_polarion_reqifz.reqifz +0 -0
  107. data/spec/reqif/data_types_spec.rb +29 -0
  108. data/spec/reqif/polarion_export_spec.rb +22 -0
  109. data/spec/reqif/req_if_header_spec.rb +31 -0
  110. data/spec/reqif/req_if_spec.rb +43 -0
  111. data/spec/reqif/spec_objects_spec.rb +35 -0
  112. data/spec/reqif/spec_relations_spec.rb +33 -0
  113. data/spec/reqif/spec_types_spec.rb +40 -0
  114. data/spec/reqif/specifications_spec.rb +35 -0
  115. data/spec/reqif/tool_extension_spec.rb +27 -0
  116. data/spec/reqif_spec.rb +56 -0
  117. data/spec/spec_helper.rb +70 -0
  118. metadata +58 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0f9bdc52dbdc885bb1b46156c06618ba14184f46fe33769c82e75382a40fcdc
4
- data.tar.gz: f91af84530330b4ad4b412648db399903ea96a340ec510afe36c8644c60fb5f6
3
+ metadata.gz: 455355645036e719c0878c741609fb0b23c4edbc4f0b5a221db0513a142c4e72
4
+ data.tar.gz: 6d44e1233fb002d17ee4e371f240dd5d8eb25e7df99f571becbd96e6bc86e373
5
5
  SHA512:
6
- metadata.gz: 6939509f792d37e0822fbf9e3a363354cf3826ea1e89007622b864fa4e21ad3723e6d7792a05c0096be61069845ac7b4f9b66704759e5f582e40994416d7b69e
7
- data.tar.gz: 4428ff962c5049f6542424a1c6aaeec7d30ccbe4525596cf087d2bfd034a3d27d83c43d28f03c442b23b6daaa35191e69e39f0c15f2e66d7b31aa4dd53a4e8a6
6
+ metadata.gz: 5d8fab36ee06d539bfef358c7bbd3f410ca35ec10e37e40d932b0bb3f12056644b7c7ad572a096898611097e7b5e666be99effe7b240a62b8d69decdde97672e
7
+ data.tar.gz: a44955c71b98fcea4d13240165e3bd7e6b9502c16bb485f797f3af062f1234ae1ed49076d60fdea43e93333582ec6966687f19988de10560271d80962650e540
@@ -2,6 +2,11 @@
2
2
  # See https://github.com/metanorma/cimas
3
3
  name: release
4
4
 
5
+ permissions:
6
+ contents: write
7
+ packages: write
8
+ id-token: write
9
+
5
10
  on:
6
11
  workflow_dispatch:
7
12
  inputs:
@@ -16,10 +21,8 @@ on:
16
21
 
17
22
  jobs:
18
23
  release:
19
- uses: metanorma/ci/.github/workflows/rubygems-release.yml@main
24
+ uses: relaton/support/.github/workflows/release.yml@main
20
25
  with:
21
26
  next_version: ${{ github.event.inputs.next_version }}
22
27
  secrets:
23
- rubygems-api-key: ${{ secrets.METANORMA_CI_RUBYGEMS_API_KEY }}
24
- pat_token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
25
-
28
+ rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
data/.rubocop.yml CHANGED
@@ -1,8 +1,19 @@
1
- AllCops:
2
- TargetRubyVersion: 3.0
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ inherit_from:
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+ - .rubocop_todo.yml
6
+
7
+ inherit_mode:
8
+ merge:
9
+ - Exclude
3
10
 
4
- Style/StringLiterals:
5
- EnforcedStyle: double_quotes
11
+ # local repo-specific modifications
12
+ # ...
13
+ plugins:
14
+ - rubocop-rspec
15
+ - rubocop-performance
16
+ - rubocop-rake
6
17
 
7
- Style/StringLiteralsInInterpolation:
8
- EnforcedStyle: double_quotes
18
+ AllCops:
19
+ TargetRubyVersion: 3.0
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,241 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2026-04-01 07:11:02 UTC using RuboCop version 1.86.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 17
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
12
+ Bundler/OrderedGems:
13
+ Exclude:
14
+ - 'Gemfile'
15
+
16
+ # Offense count: 1
17
+ # This cop supports safe autocorrection (--autocorrect).
18
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation.
19
+ Gemspec/OrderedDependencies:
20
+ Exclude:
21
+ - 'reqif.gemspec'
22
+
23
+ # Offense count: 1
24
+ # This cop supports safe autocorrection (--autocorrect).
25
+ Gemspec/RequireMFA:
26
+ Exclude:
27
+ - 'reqif.gemspec'
28
+
29
+ # Offense count: 63
30
+ # This cop supports safe autocorrection (--autocorrect).
31
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
32
+ # SupportedStyles: with_first_argument, with_fixed_indentation
33
+ Layout/ArgumentAlignment:
34
+ Exclude:
35
+ - 'lib/reqif.rb'
36
+ - 'lib/reqif/datatypes.rb'
37
+ - 'lib/reqif/default_value.rb'
38
+ - 'lib/reqif/definition.rb'
39
+ - 'lib/reqif/doors/readonly_attributes.rb'
40
+ - 'lib/reqif/editable_atts.rb'
41
+ - 'lib/reqif/reqif_float.rb'
42
+ - 'lib/reqif/spec_attributes.rb'
43
+ - 'lib/reqif/type.rb'
44
+ - 'lib/reqif/values.rb'
45
+
46
+ # Offense count: 2
47
+ # This cop supports safe autocorrection (--autocorrect).
48
+ Layout/ClosingParenthesisIndentation:
49
+ Exclude:
50
+ - 'spec/reqif/polarion_export_spec.rb'
51
+ - 'spec/spec_helper.rb'
52
+
53
+ # Offense count: 22
54
+ # This cop supports safe autocorrection (--autocorrect).
55
+ # Configuration parameters: AllowForAlignment.
56
+ Layout/CommentIndentation:
57
+ Exclude:
58
+ - 'lib/reqif/doors/module_definition.rb'
59
+ - 'lib/reqif/doors/readonly_attributes.rb'
60
+ - 'lib/reqif/doors/rif_definition.rb'
61
+ - 'lib/reqif/req_if_tool_extension.rb'
62
+
63
+ # Offense count: 1
64
+ # This cop supports safe autocorrection (--autocorrect).
65
+ Layout/ElseAlignment:
66
+ Exclude:
67
+ - 'spec/spec_helper.rb'
68
+
69
+ # Offense count: 1
70
+ # This cop supports safe autocorrection (--autocorrect).
71
+ # Configuration parameters: EnforcedStyle.
72
+ # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
73
+ Layout/EmptyLinesAroundClassBody:
74
+ Exclude:
75
+ - 'lib/reqif/req_if_tool_extension.rb'
76
+
77
+ # Offense count: 2
78
+ # This cop supports safe autocorrection (--autocorrect).
79
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
80
+ # SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
81
+ Layout/FirstArgumentIndentation:
82
+ Exclude:
83
+ - 'spec/reqif/polarion_export_spec.rb'
84
+ - 'spec/spec_helper.rb'
85
+
86
+ # Offense count: 4
87
+ # This cop supports safe autocorrection (--autocorrect).
88
+ # Configuration parameters: EnforcedStyle.
89
+ # SupportedStyles: normal, indented_internal_methods
90
+ Layout/IndentationConsistency:
91
+ Exclude:
92
+ - 'lib/reqif/doors/readonly_attributes.rb'
93
+ - 'reqif.gemspec'
94
+
95
+ # Offense count: 10
96
+ # This cop supports safe autocorrection (--autocorrect).
97
+ # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
98
+ # SupportedStylesAlignWith: start_of_line, relative_to_receiver
99
+ Layout/IndentationWidth:
100
+ Exclude:
101
+ - 'lib/reqif/doors/readonly_attributes.rb'
102
+ - 'spec/spec_helper.rb'
103
+
104
+ # Offense count: 78
105
+ # This cop supports safe autocorrection (--autocorrect).
106
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
107
+ # URISchemes: http, https
108
+ Layout/LineLength:
109
+ Enabled: false
110
+
111
+ # Offense count: 1
112
+ # This cop supports safe autocorrection (--autocorrect).
113
+ # Configuration parameters: EnforcedStyle.
114
+ # SupportedStyles: symmetrical, new_line, same_line
115
+ Layout/MultilineMethodCallBraceLayout:
116
+ Exclude:
117
+ - 'spec/reqif/polarion_export_spec.rb'
118
+
119
+ # Offense count: 1
120
+ # This cop supports safe autocorrection (--autocorrect).
121
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
122
+ # SupportedStyles: aligned, indented
123
+ Layout/MultilineOperationIndentation:
124
+ Exclude:
125
+ - 'spec/reqif_spec.rb'
126
+
127
+ # Offense count: 8
128
+ # This cop supports safe autocorrection (--autocorrect).
129
+ # Configuration parameters: EnforcedStyle.
130
+ # SupportedStyles: final_newline, final_blank_line
131
+ Layout/TrailingEmptyLines:
132
+ Exclude:
133
+ - 'lib/reqif/doors/identifier.rb'
134
+ - 'lib/reqif/doors/module_definition.rb'
135
+ - 'lib/reqif/doors/namespace.rb'
136
+ - 'lib/reqif/doors/readonly_attributes.rb'
137
+ - 'lib/reqif/doors/rif_definition.rb'
138
+ - 'lib/reqif/doors/string_type.rb'
139
+ - 'lib/reqif/string_type.rb'
140
+ - 'lib/reqif/xhtml/namespace.rb'
141
+
142
+ # Offense count: 63
143
+ # This cop supports safe autocorrection (--autocorrect).
144
+ # Configuration parameters: AllowInHeredoc.
145
+ Layout/TrailingWhitespace:
146
+ Exclude:
147
+ - 'lib/reqif.rb'
148
+ - 'lib/reqif/datatypes.rb'
149
+ - 'lib/reqif/default_value.rb'
150
+ - 'lib/reqif/definition.rb'
151
+ - 'lib/reqif/doors/readonly_attributes.rb'
152
+ - 'lib/reqif/editable_atts.rb'
153
+ - 'lib/reqif/reqif_float.rb'
154
+ - 'lib/reqif/spec_attributes.rb'
155
+ - 'lib/reqif/type.rb'
156
+ - 'lib/reqif/values.rb'
157
+
158
+ # Offense count: 1
159
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
160
+ # AllowedMethods: refine
161
+ Metrics/BlockLength:
162
+ Max: 90
163
+
164
+ # Offense count: 1
165
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
166
+ Metrics/CyclomaticComplexity:
167
+ Exclude:
168
+ - 'lib/reqif/reqif_float.rb'
169
+
170
+ # Offense count: 3
171
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
172
+ Metrics/MethodLength:
173
+ Max: 12
174
+
175
+ # Offense count: 1
176
+ # Configuration parameters: IgnoredMetadata.
177
+ RSpec/DescribeClass:
178
+ Exclude:
179
+ - 'spec/reqif/polarion_export_spec.rb'
180
+
181
+ # Offense count: 4
182
+ # Configuration parameters: CountAsOne.
183
+ RSpec/ExampleLength:
184
+ Max: 11
185
+
186
+ # Offense count: 11
187
+ RSpec/MultipleExpectations:
188
+ Max: 8
189
+
190
+ # Offense count: 1
191
+ # This cop supports safe autocorrection (--autocorrect).
192
+ # Configuration parameters: EnforcedStyle.
193
+ # SupportedStyles: not_to, to_not
194
+ RSpec/NotToNot:
195
+ Exclude:
196
+ - 'spec/reqif/polarion_export_spec.rb'
197
+
198
+ # Offense count: 2
199
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
200
+ # SupportedInflectors: default, active_support
201
+ RSpec/SpecFilePathFormat:
202
+ Exclude:
203
+ - 'spec/reqif/data_types_spec.rb'
204
+ - 'spec/reqif/tool_extension_spec.rb'
205
+
206
+ # Offense count: 2
207
+ # This cop supports safe autocorrection (--autocorrect).
208
+ # Configuration parameters: EnforcedStyle.
209
+ # SupportedStyles: separated, grouped
210
+ Style/AccessorGrouping:
211
+ Exclude:
212
+ - 'lib/reqif/high_precision_date_time.rb'
213
+
214
+ # Offense count: 1
215
+ # This cop supports safe autocorrection (--autocorrect).
216
+ # Configuration parameters: AllowIfModifier.
217
+ Style/IfInsideElse:
218
+ Exclude:
219
+ - 'spec/spec_helper.rb'
220
+
221
+ # Offense count: 1
222
+ # This cop supports safe autocorrection (--autocorrect).
223
+ Style/MultilineIfModifier:
224
+ Exclude:
225
+ - 'lib/reqif/reqif_float.rb'
226
+
227
+ # Offense count: 2
228
+ # This cop supports safe autocorrection (--autocorrect).
229
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
230
+ # SupportedStyles: single_quotes, double_quotes
231
+ Style/StringLiterals:
232
+ Exclude:
233
+ - 'reqif.gemspec'
234
+
235
+ # Offense count: 1
236
+ # This cop supports safe autocorrection (--autocorrect).
237
+ # Configuration parameters: EnforcedStyleForMultiline.
238
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
239
+ Style/TrailingCommaInArguments:
240
+ Exclude:
241
+ - 'spec/reqif/req_if_spec.rb'
data/CLAUDE.md ADDED
@@ -0,0 +1,73 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Overview
6
+
7
+ This is a Ruby gem (`reqif`) that parses and generates ReqIF (Requirements Interchange Format) XML documents. ReqIF is an OMG standard (v1.2) for exchanging requirements between different tools. The gem is part of the `lutaml` family.
8
+
9
+ ## Commands
10
+
11
+ ```bash
12
+ bundle install # Install dependencies
13
+ bundle exec rake # Run specs + rubocop (default)
14
+ bundle exec rake spec # Run specs only
15
+ bundle exec rake rubocop # Run linter only
16
+ bundle exec rspec spec/reqif_spec.rb # Run a single spec file
17
+ bundle exec bin/console # Start an IRB console with the gem loaded
18
+ ```
19
+
20
+ ## Architecture
21
+
22
+ ### Framework: lutaml/model
23
+
24
+ All model classes inherit from `Lutaml::Model::Serializable` and use an `xml` DSL block to define XML serialization. The gem uses `Lutaml::Model::XmlAdapter::NokogiriAdapter` for XML parsing/generation.
25
+
26
+ ### Class-per-file pattern
27
+
28
+ Each ReqIF concept is a separate class in `lib/reqif/`. Classes follow a consistent structure:
29
+
30
+ ```ruby
31
+ module Reqif
32
+ class Foo < Lutaml::Model::Serializable
33
+ attribute :bar, :string
34
+ attribute :baz, SomeOtherClass
35
+
36
+ xml do
37
+ element "FOO"
38
+ namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd"
39
+ map_attribute "BAR", to: :bar
40
+ map_element "BAZ", to: :baz
41
+ end
42
+ end
43
+ end
44
+ ```
45
+
46
+ ### Key model classes
47
+
48
+ - `ReqIf` — Root element, contains `THE-HEADER`, `CORE-CONTENT`, `TOOL-EXTENSIONS`
49
+ - `ReqIfContent` — Contains `DATATYPES`, `SPEC-TYPES`, `SPEC-OBJECTS`, `SPEC-RELATIONS`, `SPECIFICATIONS`, `SPEC-RELATION-GROUPS`
50
+ - `SpecObject` — A single requirement with attributes (identifier, long_name, desc, etc.) and `VALUES`
51
+ - `Specification` — A container/hierarchy that has `CHILDREN` referencing other specs
52
+ - `SpecRelation` — A relation between two specs with `SOURCE` and `TARGET` references
53
+ - `Values` — Container for `AttributeValue` elements (boolean, date, enumeration, integer, real, string, xhtml)
54
+ - `Type` / `SpecObjectType` / `SpecificationType` — Type definitions for spec objects/specifications
55
+ - `Datatypes` — Container for datatype definitions (boolean, date, enumeration, integer, real, string, xhtml)
56
+
57
+ ### Attribute naming conventions
58
+
59
+ XML element names use uppercase-kebab-case (e.g., `SPEC-OBJECT`, `LAST-CHANGE`) while Ruby attributes use snake_case (e.g., `spec_object`, `last_change`). The `map_element` and `map_attribute` DSL methods handle the translation.
60
+
61
+ ### Autoloading
62
+
63
+ Zeitwerk is used for autoloading. `lib/reqif.rb` sets up the loader and eager loads all classes.
64
+
65
+ ### XML round-trip testing
66
+
67
+ Round-trip tests in `spec/reqif_spec.rb` parse fixture XML files, regenerate XML via `to_xml`, and compare canonicalization using `xml-c14n`. All fixture files under `spec/fixtures/` (`.xml`, `.reqif`) are automatically included.
68
+
69
+ ### Style
70
+
71
+ - String literals: double quotes enforced by RuboCop
72
+ - Ruby version: 3.0+
73
+ - Frozen string literals: required at the top of every file
data/Gemfile CHANGED
@@ -5,9 +5,12 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in reqif.gemspec
6
6
  gemspec
7
7
 
8
+ gem "canon"
9
+ gem "lutaml-model", github: "lutaml/lutaml-model", branch: "main"
10
+ gem "nokogiri"
8
11
  gem "rake", "~> 13.0"
9
12
  gem "rspec", "~> 3.0"
10
13
  gem "rubocop", "~> 1.21"
11
- gem "nokogiri"
12
14
  gem "rubocop-performance"
13
- gem "xml-c14n"
15
+ gem "rubocop-rake"
16
+ gem "rubocop-rspec"
data/README.adoc CHANGED
@@ -1,8 +1,52 @@
1
1
  = ReqIF Ruby library
2
2
 
3
+ == Purpose
4
+
3
5
  The `reqif` library is a parser and generator for ReqIF XML documents.
4
6
 
5
- It is intended to be used to parse and generate ReqIF XML v1.2 documents.
7
+ http://www.omg.org/spec/ReqIF/[ReqIF (Requirements Interchange Format)] is an
8
+ OMG (Object Management Group) standard for the exchange of requirements between
9
+ different tools. It is designed to facilitate the transfer of requirements
10
+ information, ensuring that data can be shared and understood across various
11
+ platforms and organizations. ReqIF provides a standardized XML format for
12
+ requirements, making it easier to manage and collaborate on requirements
13
+ throughout the development lifecycle.
14
+
15
+ This library is intended to be used to parse and generate ReqIF XML v1.2
16
+ documents.
17
+
18
+
19
+ == A brief history of ReqIF
20
+
21
+ In 2004, the HIS (Hersteller Initiative Software), a panel of Germany's
22
+ automotive manufacturers (Daimler, VW, Porsche, Audi and BMW Group) developed
23
+ the idea of creating the "Requirements Interchange Format".
24
+
25
+ In 2005, the first
26
+ version of that format was presented at the REConf, a conference about
27
+ requirements engineering and management, in Munich. In 2008, the HIS Steering
28
+ Committee decided that the internationalization and maintenance of the
29
+ Requirements Interchange Format should be proceeded with the ProSTEP iViP
30
+ Association.
31
+
32
+ A project was set up and a team was built that includes members of
33
+ the ProSTEP iViP Association, representatives of manufacturing companies (Audi,
34
+ BMW Group, Daimler, VW, Bosch and Continental), tool vendors (Atego, IBM, MKS)
35
+ and development partners (HOOD GmbH, PROSTEP AG).
36
+
37
+ The HIS released the Requirements Interchange Format as RIF 1.0, RIF 1.0a, RIF
38
+ 1.1; RIF 1.1a and the ProSTEP iViP released the recommendation RIF 1.2.
39
+
40
+ OMG ReqIF 1.0 is the direct successor of the ProSTEP iViP recommendation RIF
41
+ 1.2.
42
+
43
+ The latest version of OMG ReqIF is 1.2.
44
+
45
+ == Formats
46
+
47
+ ReqIF file extensions are `.xml`, `.reqif` and `.reqifz` (compressed).
48
+
49
+
6
50
 
7
51
  == Installation
8
52
 
@@ -59,6 +103,22 @@ reqif.sections = [
59
103
  puts reqif.to_xml
60
104
  ----
61
105
 
106
+ == Tests
107
+
108
+ Round-trip tests are all under `spec/fixtures`.
109
+
110
+ These tests originate from various locations:
111
+
112
+ `antcc_*`:: https://git.ebersold.fr/?p=antcc.git;a=summary
113
+ `doors_*`:: https://jazz.net/wiki/bin/view/Main/DNGReqIF
114
+ `eclipse_capella_*.xml`:: https://github.com/eclipse-capella/capella-requirements-vp/
115
+ `eclipse_rmf_*.reqif`:: https://eclipse.googlesource.com/rmf/
116
+ `ec`
117
+
118
+ `ea_*`:: https://github.com/redsteve/EnterpriseArchitect_ReqIF_AddIn
119
+ `polarion_*`:: https://almdemo.polarion.com/polarion/import/reqif
120
+ `strictdoc-*.reqif`:: https://github.com/strictdoc-project/reqif/
121
+
62
122
 
63
123
  == Contributing
64
124
 
@@ -5,8 +5,8 @@ module Reqif
5
5
  attribute :identifier, :string
6
6
 
7
7
  xml do
8
- root "ALTERNATIVE-ID"
9
- namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd", "REQIF"
8
+ element "ALTERNATIVE-ID"
9
+ namespace Namespace
10
10
 
11
11
  map_attribute "IDENTIFIER", to: :identifier
12
12
  end
@@ -5,17 +5,18 @@ module Reqif
5
5
  attribute :desc, :string
6
6
  attribute :identifier, :string
7
7
  attribute :is_editable, :boolean
8
- attribute :last_change, :time
8
+ attribute :last_change, HighPrecisionDateTime
9
9
  attribute :long_name, :string
10
10
  attribute :alternative_id, AlternativeId
11
11
  attribute :default_value, DefaultValue
12
12
  attribute :type, Type
13
13
 
14
14
  xml do
15
- root "ATTRIBUTE-DEFINITION-BOOLEAN"
16
- namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd", "REQIF"
15
+ element "ATTRIBUTE-DEFINITION-BOOLEAN"
16
+ namespace Namespace
17
+ ordered
17
18
 
18
- map_attribute "DESC", to: :desc
19
+ map_attribute "DESC", to: :desc, render_empty: true
19
20
  map_attribute "IDENTIFIER", to: :identifier
20
21
  map_attribute "IS-EDITABLE", to: :is_editable
21
22
  map_attribute "LAST-CHANGE", to: :last_change
@@ -5,17 +5,18 @@ module Reqif
5
5
  attribute :desc, :string
6
6
  attribute :identifier, :string
7
7
  attribute :is_editable, :boolean
8
- attribute :last_change, :time
8
+ attribute :last_change, HighPrecisionDateTime
9
9
  attribute :long_name, :string
10
10
  attribute :alternative_id, AlternativeId
11
11
  attribute :default_value, DefaultValue
12
12
  attribute :type, Type
13
13
 
14
14
  xml do
15
- root "ATTRIBUTE-DEFINITION-DATE"
16
- namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd", "REQIF"
15
+ element "ATTRIBUTE-DEFINITION-DATE"
16
+ namespace Namespace
17
+ ordered
17
18
 
18
- map_attribute "DESC", to: :desc
19
+ map_attribute "DESC", to: :desc, render_empty: true
19
20
  map_attribute "IDENTIFIER", to: :identifier
20
21
  map_attribute "IS-EDITABLE", to: :is_editable
21
22
  map_attribute "LAST-CHANGE", to: :last_change
@@ -5,7 +5,7 @@ module Reqif
5
5
  attribute :desc, :string
6
6
  attribute :identifier, :string
7
7
  attribute :is_editable, :boolean
8
- attribute :last_change, :time
8
+ attribute :last_change, HighPrecisionDateTime
9
9
  attribute :long_name, :string
10
10
  attribute :multi_valued, :boolean
11
11
  attribute :default_value, DefaultValue
@@ -13,10 +13,11 @@ module Reqif
13
13
  attribute :type, Type
14
14
 
15
15
  xml do
16
- root "ATTRIBUTE-DEFINITION-ENUMERATION"
17
- namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd", "REQIF"
16
+ element "ATTRIBUTE-DEFINITION-ENUMERATION"
17
+ namespace Namespace
18
+ ordered
18
19
 
19
- map_attribute "DESC", to: :desc
20
+ map_attribute "DESC", to: :desc, render_empty: true
20
21
  map_attribute "IDENTIFIER", to: :identifier
21
22
  map_attribute "IS-EDITABLE", to: :is_editable
22
23
  map_attribute "LAST-CHANGE", to: :last_change
@@ -5,17 +5,18 @@ module Reqif
5
5
  attribute :desc, :string
6
6
  attribute :identifier, :string
7
7
  attribute :is_editable, :boolean
8
- attribute :last_change, :time
8
+ attribute :last_change, HighPrecisionDateTime
9
9
  attribute :long_name, :string
10
10
  attribute :alternative_id, AlternativeId
11
11
  attribute :default_value, DefaultValue
12
12
  attribute :type, Type
13
13
 
14
14
  xml do
15
- root "ATTRIBUTE-DEFINITION-INTEGER"
16
- namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd", "REQIF"
15
+ element "ATTRIBUTE-DEFINITION-INTEGER"
16
+ namespace Namespace
17
+ ordered
17
18
 
18
- map_attribute "DESC", to: :desc
19
+ map_attribute "DESC", to: :desc, render_empty: true
19
20
  map_attribute "IDENTIFIER", to: :identifier
20
21
  map_attribute "IS-EDITABLE", to: :is_editable
21
22
  map_attribute "LAST-CHANGE", to: :last_change
@@ -5,17 +5,18 @@ module Reqif
5
5
  attribute :desc, :string
6
6
  attribute :identifier, :string
7
7
  attribute :is_editable, :boolean
8
- attribute :last_change, :time
8
+ attribute :last_change, HighPrecisionDateTime
9
9
  attribute :long_name, :string
10
10
  attribute :alternative_id, AlternativeId
11
11
  attribute :default_value, DefaultValue
12
12
  attribute :type, Type
13
13
 
14
14
  xml do
15
- root "ATTRIBUTE-DEFINITION-REAL"
16
- namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd", "REQIF"
15
+ element "ATTRIBUTE-DEFINITION-REAL"
16
+ namespace Namespace
17
+ ordered
17
18
 
18
- map_attribute "DESC", to: :desc
19
+ map_attribute "DESC", to: :desc, render_empty: true
19
20
  map_attribute "IDENTIFIER", to: :identifier
20
21
  map_attribute "IS-EDITABLE", to: :is_editable
21
22
  map_attribute "LAST-CHANGE", to: :last_change
@@ -5,17 +5,18 @@ module Reqif
5
5
  attribute :desc, :string
6
6
  attribute :identifier, :string
7
7
  attribute :is_editable, :boolean
8
- attribute :last_change, :time
8
+ attribute :last_change, HighPrecisionDateTime
9
9
  attribute :long_name, :string
10
10
  attribute :alternative_id, AlternativeId
11
11
  attribute :default_value, DefaultValue
12
12
  attribute :type, Type
13
13
 
14
14
  xml do
15
- root "ATTRIBUTE-DEFINITION-STRING"
16
- namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd", "REQIF"
15
+ element "ATTRIBUTE-DEFINITION-STRING"
16
+ namespace Namespace
17
+ ordered
17
18
 
18
- map_attribute "DESC", to: :desc
19
+ map_attribute "DESC", to: :desc, render_empty: true
19
20
  map_attribute "IDENTIFIER", to: :identifier
20
21
  map_attribute "IS-EDITABLE", to: :is_editable
21
22
  map_attribute "LAST-CHANGE", to: :last_change
@@ -5,17 +5,18 @@ module Reqif
5
5
  attribute :desc, :string
6
6
  attribute :identifier, :string
7
7
  attribute :is_editable, :boolean
8
- attribute :last_change, :time
8
+ attribute :last_change, HighPrecisionDateTime
9
9
  attribute :long_name, :string
10
10
  attribute :alternative_id, AlternativeId
11
11
  attribute :default_value, DefaultValue
12
12
  attribute :type, Type
13
13
 
14
14
  xml do
15
- root "ATTRIBUTE-DEFINITION-XHTML"
16
- namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd", "REQIF"
15
+ element "ATTRIBUTE-DEFINITION-XHTML"
16
+ namespace Namespace
17
+ ordered
17
18
 
18
- map_attribute "DESC", to: :desc
19
+ map_attribute "DESC", to: :desc, render_empty: true
19
20
  map_attribute "IDENTIFIER", to: :identifier
20
21
  map_attribute "IS-EDITABLE", to: :is_editable
21
22
  map_attribute "LAST-CHANGE", to: :last_change
@@ -6,8 +6,9 @@ module Reqif
6
6
  attribute :definition, Definition
7
7
 
8
8
  xml do
9
- root "ATTRIBUTE-VALUE-BOOLEAN"
10
- namespace "http://www.omg.org/spec/ReqIF/20110401/reqif.xsd", "REQIF"
9
+ element "ATTRIBUTE-VALUE-BOOLEAN"
10
+ namespace Namespace
11
+ ordered
11
12
 
12
13
  map_attribute "THE-VALUE", to: :the_value
13
14
  map_element "DEFINITION", to: :definition