lutaml 0.10.4 → 0.10.6

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 (119) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +8 -0
  3. data/.rubocop.yml +10 -0
  4. data/.rubocop_todo.yml +218 -94
  5. data/TODO.cleanups/01-resolve-production-todos.md +65 -0
  6. data/TODO.cleanups/02-reduce-metrics-offenses.md +37 -0
  7. data/TODO.cleanups/03-reduce-rspec-multiple-expectations.md +54 -0
  8. data/TODO.cleanups/04-reduce-rspec-example-length.md +45 -0
  9. data/TODO.cleanups/05-replace-marshal-load.md +37 -0
  10. data/TODO.cleanups/06-replace-eval-in-tests.md +41 -0
  11. data/TODO.cleanups/07-fix-lint-offenses.md +74 -0
  12. data/TODO.cleanups/08-reduce-memoized-helpers-and-nesting.md +43 -0
  13. data/TODO.cleanups/09-reduce-verified-doubles-and-rspec-style.md +57 -0
  14. data/TODO.cleanups/10-split-large-files.md +47 -0
  15. data/bin/console +0 -1
  16. data/exe/lutaml +1 -0
  17. data/lib/lutaml/cli/element_identifier.rb +3 -6
  18. data/lib/lutaml/cli/interactive_shell/bookmark_commands.rb +88 -0
  19. data/lib/lutaml/cli/interactive_shell/command_base.rb +32 -0
  20. data/lib/lutaml/cli/interactive_shell/export_handler.rb +67 -0
  21. data/lib/lutaml/cli/interactive_shell/help_display.rb +114 -0
  22. data/lib/lutaml/cli/interactive_shell/navigation_commands.rb +135 -0
  23. data/lib/lutaml/cli/interactive_shell/query_commands.rb +185 -0
  24. data/lib/lutaml/cli/interactive_shell.rb +116 -802
  25. data/lib/lutaml/cli/uml/build_command.rb +5 -5
  26. data/lib/lutaml/cli/uml/verify_command.rb +0 -1
  27. data/lib/lutaml/converter/xmi_to_uml.rb +3 -153
  28. data/lib/lutaml/converter/xmi_to_uml_generalization.rb +193 -0
  29. data/lib/lutaml/formatter/graphviz.rb +1 -2
  30. data/lib/lutaml/qea/database.rb +1 -47
  31. data/lib/lutaml/qea/factory/association_builder.rb +188 -0
  32. data/lib/lutaml/qea/factory/base_transformer.rb +0 -1
  33. data/lib/lutaml/qea/factory/class_transformer.rb +40 -590
  34. data/lib/lutaml/qea/factory/diagram_transformer.rb +0 -3
  35. data/lib/lutaml/qea/factory/generalization_builder.rb +211 -0
  36. data/lib/lutaml/qea/factory/package_transformer.rb +1 -2
  37. data/lib/lutaml/qea/factory/stereotype_loader.rb +34 -0
  38. data/lib/lutaml/qea/lookup_indexes.rb +54 -0
  39. data/lib/lutaml/qea/models/ea_datatype.rb +0 -2
  40. data/lib/lutaml/qea/validation/validation_engine.rb +0 -2
  41. data/lib/lutaml/uml/has_members.rb +0 -1
  42. data/lib/lutaml/uml/inheritance_walker.rb +92 -0
  43. data/lib/lutaml/uml/model_helpers.rb +129 -0
  44. data/lib/lutaml/uml/node/attribute.rb +3 -1
  45. data/lib/lutaml/uml/node/class_node.rb +3 -3
  46. data/lib/lutaml/uml/operation.rb +2 -0
  47. data/lib/lutaml/uml_repository/class_lookup_index.rb +40 -0
  48. data/lib/lutaml/uml_repository/exporters/markdown/class_page_builder.rb +179 -0
  49. data/lib/lutaml/uml_repository/exporters/markdown/formatting.rb +36 -0
  50. data/lib/lutaml/uml_repository/exporters/markdown/index_page_builder.rb +73 -0
  51. data/lib/lutaml/uml_repository/exporters/markdown/link_resolver.rb +40 -0
  52. data/lib/lutaml/uml_repository/exporters/markdown/package_page_builder.rb +107 -0
  53. data/lib/lutaml/uml_repository/exporters/markdown_exporter.rb +26 -538
  54. data/lib/lutaml/uml_repository/index_builder.rb +3 -271
  55. data/lib/lutaml/uml_repository/index_builders/association_index.rb +141 -0
  56. data/lib/lutaml/uml_repository/index_builders/class_index.rb +94 -0
  57. data/lib/lutaml/uml_repository/index_builders/package_index.rb +57 -0
  58. data/lib/lutaml/uml_repository/package_exporter.rb +10 -20
  59. data/lib/lutaml/uml_repository/package_loader.rb +37 -17
  60. data/lib/lutaml/uml_repository/repository/deprecated.rb +39 -0
  61. data/lib/lutaml/uml_repository/repository/loader.rb +112 -0
  62. data/lib/lutaml/uml_repository/repository.rb +7 -57
  63. data/lib/lutaml/uml_repository/static_site/association_serialization.rb +142 -0
  64. data/lib/lutaml/uml_repository/static_site/configuration.rb +0 -2
  65. data/lib/lutaml/uml_repository/static_site/data_transformer.rb +52 -873
  66. data/lib/lutaml/uml_repository/static_site/generator.rb +29 -8
  67. data/lib/lutaml/uml_repository/static_site/search_index_builder.rb +1 -4
  68. data/lib/lutaml/uml_repository/static_site/serializers/attribute_serializer.rb +78 -0
  69. data/lib/lutaml/uml_repository/static_site/serializers/class_serializer.rb +124 -0
  70. data/lib/lutaml/uml_repository/static_site/serializers/diagram_serializer.rb +60 -0
  71. data/lib/lutaml/uml_repository/static_site/serializers/inheritance_resolver.rb +258 -0
  72. data/lib/lutaml/uml_repository/static_site/serializers/metadata_builder.rb +48 -0
  73. data/lib/lutaml/uml_repository/static_site/serializers/operation_serializer.rb +57 -0
  74. data/lib/lutaml/uml_repository/static_site/serializers/package_serializer.rb +94 -0
  75. data/lib/lutaml/uml_repository/static_site/serializers/package_tree_builder.rb +93 -0
  76. data/lib/lutaml/version.rb +1 -1
  77. data/lib/lutaml/xmi/liquid_drops/association_drop.rb +13 -35
  78. data/lib/lutaml/xmi/liquid_drops/attribute_drop.rb +12 -18
  79. data/lib/lutaml/xmi/liquid_drops/cardinality_drop.rb +14 -6
  80. data/lib/lutaml/xmi/liquid_drops/connector_drop.rb +0 -3
  81. data/lib/lutaml/xmi/liquid_drops/constraint_drop.rb +1 -3
  82. data/lib/lutaml/xmi/liquid_drops/data_type_drop.rb +13 -70
  83. data/lib/lutaml/xmi/liquid_drops/dependency_drop.rb +2 -5
  84. data/lib/lutaml/xmi/liquid_drops/diagram_drop.rb +5 -11
  85. data/lib/lutaml/xmi/liquid_drops/enum_drop.rb +8 -16
  86. data/lib/lutaml/xmi/liquid_drops/enum_owned_literal_drop.rb +3 -9
  87. data/lib/lutaml/xmi/liquid_drops/generalization_attribute_drop.rb +11 -13
  88. data/lib/lutaml/xmi/liquid_drops/generalization_drop.rb +27 -85
  89. data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +39 -91
  90. data/lib/lutaml/xmi/liquid_drops/operation_drop.rb +3 -9
  91. data/lib/lutaml/xmi/liquid_drops/package_drop.rb +16 -44
  92. data/lib/lutaml/xmi/liquid_drops/root_drop.rb +3 -11
  93. data/lib/lutaml/xmi/liquid_drops/source_target_drop.rb +2 -5
  94. data/lib/lutaml/xmi/parsers/xmi_base.rb +2 -749
  95. data/lib/lutaml/xmi/parsers/xmi_class_members.rb +45 -0
  96. data/lib/lutaml/xmi/parsers/xmi_connector.rb +251 -0
  97. data/lib/lutaml/xmi/parsers/xml.rb +7 -120
  98. data/lib/lutaml/xmi/xmi_lookup_service.rb +42 -0
  99. data/lib/lutaml.rb +0 -1
  100. metadata +48 -21
  101. data/lib/lutaml/cli/commands/base_command.rb +0 -118
  102. data/lib/lutaml/command_line.rb +0 -272
  103. data/lib/lutaml/sysml/allocate.rb +0 -9
  104. data/lib/lutaml/sysml/allocated.rb +0 -9
  105. data/lib/lutaml/sysml/binding_connector.rb +0 -9
  106. data/lib/lutaml/sysml/block.rb +0 -32
  107. data/lib/lutaml/sysml/constraint_block.rb +0 -14
  108. data/lib/lutaml/sysml/copy.rb +0 -8
  109. data/lib/lutaml/sysml/derive_requirement.rb +0 -9
  110. data/lib/lutaml/sysml/nested_connector_end.rb +0 -13
  111. data/lib/lutaml/sysml/refine.rb +0 -9
  112. data/lib/lutaml/sysml/requirement.rb +0 -44
  113. data/lib/lutaml/sysml/requirement_related.rb +0 -9
  114. data/lib/lutaml/sysml/satisfy.rb +0 -9
  115. data/lib/lutaml/sysml/test_case.rb +0 -25
  116. data/lib/lutaml/sysml/trace.rb +0 -9
  117. data/lib/lutaml/sysml/verify.rb +0 -8
  118. data/lib/lutaml/sysml/xmi_file.rb +0 -486
  119. data/lib/lutaml/sysml.rb +0 -11
@@ -4,49 +4,29 @@ module Lutaml
4
4
  module Xmi
5
5
  module LiquidDrops
6
6
  class PackageDrop < Liquid::Drop
7
- include Parsers::XmiBase
8
-
9
- def initialize(model, guidance = nil, options = {}) # rubocop:disable Lint/MissingSuper,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
7
+ def initialize(model, guidance = nil, options = {}) # rubocop:disable Lint/MissingSuper
10
8
  @model = model
11
9
  @guidance = guidance
12
-
13
10
  @options = options
11
+ @lookup = options[:lookup]
14
12
  @xmi_root_model = options[:xmi_root_model]
15
- @id_name_mapping = options[:id_name_mapping]
16
-
17
- @packages = model.packaged_element.select do |e|
18
- e.type?("uml:Package")
19
- end
20
-
21
- @klasses = model.packaged_element.select do |e|
22
- e.type?("uml:Class") || e.type?("uml:AssociationClass") ||
23
- e.type?("uml:Interface")
24
- end
25
-
26
- @all_data_type_elements = []
27
- select_all_packaged_elements(@all_data_type_elements, model,
28
- "uml:DataType")
29
-
30
- @children_packages ||= packages.map do |pkg|
31
- [pkg, pkg.packages, pkg.packages.map(&:children_packages)]
32
- end.flatten.uniq
33
13
  end
34
14
 
35
15
  def xmi_id
36
- @model.id
16
+ @model.xmi_id
37
17
  end
38
18
 
39
19
  def name
40
- get_package_name(@model)
20
+ @model.name
41
21
  end
42
22
 
43
23
  def absolute_path
44
24
  absolute_path_arr = [@model.name]
45
- e = find_upper_level_packaged_element(@model.id)
25
+ e = @lookup.find_upper_level_packaged_element(@model.xmi_id)
46
26
  absolute_path_arr << e.name if e
47
27
 
48
28
  while e
49
- e = find_upper_level_packaged_element(e.id)
29
+ e = @lookup.find_upper_level_packaged_element(e.id)
50
30
  absolute_path_arr << e.name if e
51
31
  end
52
32
 
@@ -54,8 +34,8 @@ module Lutaml
54
34
  absolute_path_arr.reverse.join("::")
55
35
  end
56
36
 
57
- def klasses # rubocop:disable Metrics/MethodLength
58
- @klasses.map do |klass|
37
+ def klasses
38
+ @model.classes.map do |klass|
59
39
  ::Lutaml::Xmi::LiquidDrops::KlassDrop.new(
60
40
  klass,
61
41
  @guidance,
@@ -70,33 +50,25 @@ module Lutaml
70
50
  alias classes klasses
71
51
 
72
52
  def enums
73
- enums = @model.packaged_element.select do |e|
74
- e.type?("uml:Enumeration")
75
- end
76
-
77
- enums.map do |enum|
53
+ @model.enums.map do |enum|
78
54
  ::Lutaml::Xmi::LiquidDrops::EnumDrop.new(enum, @options)
79
55
  end
80
56
  end
81
57
 
82
58
  def data_types
83
- @all_data_type_elements.map do |data_type|
59
+ @model.data_types.map do |data_type|
84
60
  ::Lutaml::Xmi::LiquidDrops::DataTypeDrop.new(data_type, @options)
85
61
  end
86
62
  end
87
63
 
88
64
  def diagrams
89
- diagrams = @xmi_root_model.extension.diagrams.diagram.select do |d|
90
- d.model.package == @model.id
91
- end
92
-
93
- diagrams.map do |diagram|
65
+ @model.diagrams.map do |diagram|
94
66
  ::Lutaml::Xmi::LiquidDrops::DiagramDrop.new(diagram, @options)
95
67
  end
96
68
  end
97
69
 
98
- def packages # rubocop:disable Metrics/MethodLength
99
- @packages.map do |package|
70
+ def packages
71
+ @model.packages.map do |package|
100
72
  ::Lutaml::Xmi::LiquidDrops::PackageDrop.new(
101
73
  package,
102
74
  @guidance,
@@ -110,15 +82,15 @@ module Lutaml
110
82
  end
111
83
 
112
84
  def children_packages
113
- @children_packages
85
+ @model.children_packages
114
86
  end
115
87
 
116
88
  def definition
117
- doc_node_attribute_value(@model.id, "documentation")
89
+ @model.definition
118
90
  end
119
91
 
120
92
  def stereotype
121
- doc_node_attribute_value(@model.id, "stereotype")
93
+ @model.stereotype&.first
122
94
  end
123
95
  end
124
96
  end
@@ -4,7 +4,7 @@ module Lutaml
4
4
  module Xmi
5
5
  module LiquidDrops
6
6
  class RootDrop < Liquid::Drop
7
- def initialize(model, guidance = nil, options = {}) # rubocop:disable Lint/MissingSuper,Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity
7
+ def initialize(model, guidance = nil, options = {}) # rubocop:disable Lint/MissingSuper
8
8
  @model = model
9
9
  @guidance = guidance
10
10
  @options = options
@@ -12,14 +12,6 @@ module Lutaml
12
12
  @id_name_mapping = options[:id_name_mapping]
13
13
 
14
14
  @options[:absolute_path] = "::#{model.name}"
15
-
16
- @packages = model&.packaged_element&.select do |e|
17
- e.type?("uml:Package")
18
- end
19
-
20
- @children_packages ||= packages.map do |pkg|
21
- [pkg, pkg.packages, pkg.packages.map(&:children_packages)]
22
- end.flatten.uniq
23
15
  end
24
16
 
25
17
  def name
@@ -27,14 +19,14 @@ module Lutaml
27
19
  end
28
20
 
29
21
  def packages
30
- @packages.map do |package|
22
+ @model.packages.map do |package|
31
23
  ::Lutaml::Xmi::LiquidDrops::PackageDrop.new(package, @guidance,
32
24
  @options)
33
25
  end
34
26
  end
35
27
 
36
28
  def children_packages
37
- @children_packages
29
+ @model.packages.flat_map(&:children_packages).uniq
38
30
  end
39
31
  end
40
32
  end
@@ -4,13 +4,10 @@ module Lutaml
4
4
  module Xmi
5
5
  module LiquidDrops
6
6
  class SourceTargetDrop < Liquid::Drop
7
- include Parsers::XmiBase
8
-
9
7
  def initialize(model, options = {}) # rubocop:disable Lint/MissingSuper
10
8
  @model = model
11
9
  @options = options
12
- @xmi_root_model = options[:xmi_root_model]
13
- @id_name_mapping = options[:id_name_mapping]
10
+ @lookup = options[:lookup]
14
11
  end
15
12
 
16
13
  def idref
@@ -38,7 +35,7 @@ module Lutaml
38
35
  end
39
36
 
40
37
  def stereotype
41
- doc_node_attribute_value(@model.idref, "stereotype")
38
+ @lookup.doc_node_attribute_value(@model.idref, "stereotype")
42
39
  end
43
40
  end
44
41
  end