lutaml 0.9.28 → 0.9.29

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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/bin/plantuml2lutaml +11 -7
  3. data/bin/yaml2lutaml +1 -1
  4. data/exe/lutaml-sysml +4 -2
  5. data/exe/lutaml-wsd2uml +11 -7
  6. data/exe/lutaml-yaml2uml +1 -1
  7. data/lib/lutaml/express/parsers/exp.rb +4 -4
  8. data/lib/lutaml/formatter/graphviz.rb +7 -7
  9. data/lib/lutaml/sysml/allocate.rb +6 -7
  10. data/lib/lutaml/sysml/allocated.rb +6 -6
  11. data/lib/lutaml/sysml/binding_connector.rb +6 -6
  12. data/lib/lutaml/sysml/block.rb +28 -25
  13. data/lib/lutaml/sysml/constraint_block.rb +11 -11
  14. data/lib/lutaml/sysml/copy.rb +5 -5
  15. data/lib/lutaml/sysml/derive_requirement.rb +6 -6
  16. data/lib/lutaml/sysml/nested_connector_end.rb +9 -9
  17. data/lib/lutaml/sysml/refine.rb +6 -6
  18. data/lib/lutaml/sysml/requirement_related.rb +6 -6
  19. data/lib/lutaml/sysml/satisfy.rb +6 -6
  20. data/lib/lutaml/sysml/test_case.rb +20 -19
  21. data/lib/lutaml/sysml/trace.rb +6 -6
  22. data/lib/lutaml/sysml/verify.rb +5 -5
  23. data/lib/lutaml/sysml/version.rb +1 -1
  24. data/lib/lutaml/sysml/xmi_file.rb +455 -415
  25. data/lib/lutaml/sysml.rb +1 -1
  26. data/lib/lutaml/uml/association.rb +4 -3
  27. data/lib/lutaml/uml/data_type.rb +1 -0
  28. data/lib/lutaml/uml/document.rb +4 -1
  29. data/lib/lutaml/uml/formatter/graphviz.rb +11 -13
  30. data/lib/lutaml/uml/has_attributes.rb +2 -2
  31. data/lib/lutaml/uml/has_members.rb +4 -3
  32. data/lib/lutaml/uml/node/class_node.rb +5 -7
  33. data/lib/lutaml/uml/node/field.rb +1 -3
  34. data/lib/lutaml/uml/node/method.rb +1 -3
  35. data/lib/lutaml/uml/node/relationship.rb +1 -3
  36. data/lib/lutaml/uml/operation.rb +6 -6
  37. data/lib/lutaml/uml/package.rb +3 -1
  38. data/lib/lutaml/uml/parsers/attribute.rb +1 -3
  39. data/lib/lutaml/uml/parsers/dsl.rb +11 -10
  40. data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +7 -6
  41. data/lib/lutaml/uml/parsers/yaml.rb +2 -2
  42. data/lib/lutaml/uml/serializers/class.rb +1 -1
  43. data/lib/lutaml/uml/top_element.rb +9 -9
  44. data/lib/lutaml/uml/top_element_attribute.rb +6 -6
  45. data/lib/lutaml/uml/value.rb +6 -6
  46. data/lib/lutaml/version.rb +1 -1
  47. data/lib/lutaml/xmi/liquid_drops/association_drop.rb +31 -11
  48. data/lib/lutaml/xmi/liquid_drops/attribute_drop.rb +29 -11
  49. data/lib/lutaml/xmi/liquid_drops/cardinality_drop.rb +8 -2
  50. data/lib/lutaml/xmi/liquid_drops/constraint_drop.rb +6 -4
  51. data/lib/lutaml/xmi/liquid_drops/data_type_drop.rb +76 -18
  52. data/lib/lutaml/xmi/liquid_drops/diagram_drop.rb +13 -6
  53. data/lib/lutaml/xmi/liquid_drops/enum_drop.rb +16 -7
  54. data/lib/lutaml/xmi/liquid_drops/enum_owned_literal_drop.rb +10 -4
  55. data/lib/lutaml/xmi/liquid_drops/generalization_attribute_drop.rb +2 -0
  56. data/lib/lutaml/xmi/liquid_drops/generalization_drop.rb +10 -3
  57. data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +98 -24
  58. data/lib/lutaml/xmi/liquid_drops/operation_drop.rb +11 -5
  59. data/lib/lutaml/xmi/liquid_drops/package_drop.rb +61 -18
  60. data/lib/lutaml/xmi/liquid_drops/root_drop.rb +14 -4
  61. data/lib/lutaml/xmi/parsers/xmi_base.rb +1031 -0
  62. data/lib/lutaml/xmi/parsers/xml.rb +19 -1016
  63. data/lib/lutaml/xml/parsers/xml.rb +2 -2
  64. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3d4343125b51531e1c2cab816a8a9e85ada1764ecaef15c1598038124167ba6
4
- data.tar.gz: 0bb4810dfe1e8d1cc363379d5f5cfbee8e778bf2ccb6dda67bcaf2360d625034
3
+ metadata.gz: 9906a661e00ac7afb79f61a10c4d73e07ee9103028aab33e7364d50e1e5a45c0
4
+ data.tar.gz: eebdee0a0418f2de61317e2f320f7fc15a1ab79eb32200bccce98c2dc3b55cfd
5
5
  SHA512:
6
- metadata.gz: af85cb2b8f1e4ae8ab8e2fb7831c4ef995b39899150ed35debada9e22f5211032ad1249bd1e45a35bb13708c1355d5a2d2a13df5821bd6ed5cc16e1bccbb8c8e
7
- data.tar.gz: '019cd5694d0a1a91ec72116680728bb848ba184693af97f096d2d929ffda1b64fdf2d0bc0ba71d2e1b3fec0d060e1e2aeab122ab9683ee85bbc582b6d0000233'
6
+ metadata.gz: 07ad5d9a28f2e5dd7df6b836d810028f4bccfa194ae46dfa95a1d4f923e07707249a0b60f1e05ec80130fc4ecbb9ed626651a63599629deb4da23a68740631e8
7
+ data.tar.gz: 9da4230858d7876cdd83d2748020e4400d14245ab26623d1d18e15422e03a0c7fdaf447ed70328310efd0b396e662027d766c3b832d8a13513812fca6af8c798
data/bin/plantuml2lutaml CHANGED
@@ -14,9 +14,9 @@ def sync_puts(line, level = 0)
14
14
  $stdout.flush
15
15
  end
16
16
 
17
- SKIPPED_LINES_REGEXP = /^(@startuml|'\*{7}|note|@enduml|\!|'\/)/
18
- COMMENT_START = /\/'/
19
- COMMENT_END = /'\//
17
+ SKIPPED_LINES_REGEXP = /^(@startuml|'\*{7}|note|@enduml|!|'\/)/.freeze
18
+ COMMENT_START = /\/'/.freeze
19
+ COMMENT_END = /'\//.freeze
20
20
  ASSOCIATION_MAPPINGS = {
21
21
  /-\|>/ => ",inheritance",
22
22
  /<\|-/ => "inheritance,",
@@ -27,11 +27,15 @@ ASSOCIATION_MAPPINGS = {
27
27
  in_comment_block = false
28
28
 
29
29
  def transform_line(line)
30
- line = line.gsub(/^\s*'/, '** ').gsub(/\|[\sa-zA-Z]+$/, '')
31
- return sync_puts(line, 2) if ASSOCIATION_MAPPINGS.keys.none? { |key| line =~ key }
30
+ line = line.gsub(/^\s*'/, "** ").gsub(/\|[\sa-zA-Z]+$/, "")
31
+ return sync_puts(line, 2) if ASSOCIATION_MAPPINGS.keys.none? do |key|
32
+ line =~ key
33
+ end
32
34
 
33
- owner_type, member_type = ASSOCIATION_MAPPINGS.detect { |(key, _value)| line =~ key }.last.split(",")
34
- blocks = line.split(" ")
35
+ owner_type, member_type = ASSOCIATION_MAPPINGS.detect do |(key, _value)|
36
+ line =~ key
37
+ end.last.split(",")
38
+ blocks = line.split
35
39
  owner = blocks.first
36
40
  member = blocks.last
37
41
  sync_puts("association {", 2)
data/bin/yaml2lutaml CHANGED
@@ -82,7 +82,7 @@ view_yaml["relations"]&.each do |values|
82
82
  process_association(values["source"], values, encountered_relations)
83
83
  end
84
84
 
85
- view_yaml["imports"].keys.each do |entry|
85
+ view_yaml["imports"].each_key do |entry|
86
86
  import = YAML.safe_load(File.read(File.join(models_path, "#{entry}.yml")))
87
87
  import_name = import["name"] || File.basename(entry)
88
88
  # Class notation
data/exe/lutaml-sysml CHANGED
@@ -11,8 +11,10 @@ $:.unshift File.expand_path("../../lib", bin_file)
11
11
  # Fixes https://github.com/rubygems/rubygems/issues/1420
12
12
  require "rubygems/specification"
13
13
 
14
- class Gem::Specification
15
- def this; self; end
14
+ module Gem
15
+ class Specification
16
+ def this; self; end
17
+ end
16
18
  end
17
19
 
18
20
  # start up the CLI
data/exe/lutaml-wsd2uml CHANGED
@@ -14,9 +14,9 @@ def sync_puts(line, level = 0)
14
14
  $stdout.flush
15
15
  end
16
16
 
17
- SKIPPED_LINES_REGEXP = /^(@startuml|'\*{7}|note|@enduml|\!|'\/)/
18
- COMMENT_START = /\/'/
19
- COMMENT_END = /'\//
17
+ SKIPPED_LINES_REGEXP = /^(@startuml|'\*{7}|note|@enduml|!|'\/)/.freeze
18
+ COMMENT_START = /\/'/.freeze
19
+ COMMENT_END = /'\//.freeze
20
20
  ASSOCIATION_MAPPINGS = {
21
21
  /-\|>/ => ",inheritance",
22
22
  /<\|-/ => "inheritance,",
@@ -27,11 +27,15 @@ ASSOCIATION_MAPPINGS = {
27
27
  in_comment_block = false
28
28
 
29
29
  def transform_line(line)
30
- line = line.gsub(/^\s*'/, '** ').gsub(/\|[\sa-zA-Z]+$/, '').gsub(/\r/, '')
31
- return sync_puts(line, 2) if ASSOCIATION_MAPPINGS.keys.none? { |key| line =~ key }
30
+ line = line.gsub(/^\s*'/, "** ").gsub(/\|[\sa-zA-Z]+$/, "").delete("\r")
31
+ return sync_puts(line, 2) if ASSOCIATION_MAPPINGS.keys.none? do |key|
32
+ line =~ key
33
+ end
32
34
 
33
- owner_type, member_type = ASSOCIATION_MAPPINGS.detect { |(key, _value)| line =~ key }.last.split(",")
34
- blocks = line.split(" ")
35
+ owner_type, member_type = ASSOCIATION_MAPPINGS.detect do |(key, _value)|
36
+ line =~ key
37
+ end.last.split(",")
38
+ blocks = line.split
35
39
  owner = blocks.first
36
40
  member = blocks.last
37
41
  sync_puts("association {", 2)
data/exe/lutaml-yaml2uml CHANGED
@@ -82,7 +82,7 @@ view_yaml["relations"]&.each do |values|
82
82
  process_association(values["source"], values, encountered_relations)
83
83
  end
84
84
 
85
- view_yaml["imports"].keys.each do |entry|
85
+ view_yaml["imports"].each_key do |entry|
86
86
  import = YAML.safe_load(File.read(File.join(models_path, "#{entry}.yml")))
87
87
  import_name = import["name"] || File.basename(entry)
88
88
  # Class notation
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'expressir'
4
- require 'expressir/express/parser'
3
+ require "expressir"
4
+ require "expressir/express/parser"
5
5
 
6
6
  module Lutaml
7
7
  module Express
@@ -12,10 +12,10 @@ module Lutaml
12
12
  # [Hash] options - options for parsing
13
13
  #
14
14
  # @return [Expressir::Model::Repository]
15
- def self.parse(io, options = {})
15
+ def self.parse(io, _options = {})
16
16
  Expressir::Express::Parser.from_file(io.path)
17
17
  end
18
18
  end
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -81,10 +81,10 @@ module Lutaml
81
81
 
82
82
  def escape_html_chars(text)
83
83
  text
84
- .gsub(/</, "&#60;")
85
- .gsub(/>/, "&#62;")
86
- .gsub(/\[/, "&#91;")
87
- .gsub(/\]/, "&#93;")
84
+ .gsub("<", "&#60;")
85
+ .gsub(">", "&#62;")
86
+ .gsub("[", "&#91;")
87
+ .gsub("]", "&#93;")
88
88
  end
89
89
 
90
90
  def format_field(node)
@@ -197,7 +197,7 @@ module Lutaml
197
197
  end
198
198
 
199
199
  def format_member_rows(members, hide_members)
200
- unless !hide_members && members && members.length.positive?
200
+ unless !hide_members && members&.length&.positive?
201
201
  return <<~HEREDOC.chomp
202
202
  <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
203
203
  <TR><TD ALIGN="LEFT"></TD></TR>
@@ -210,10 +210,10 @@ module Lutaml
210
210
  end
211
211
  field_table = <<~HEREDOC.chomp
212
212
  <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
213
- #{field_rows.map { |row| ' ' * 10 + row }.join("\n")}
213
+ #{field_rows.map { |row| (' ' * 10) + row }.join("\n")}
214
214
  </TABLE>
215
215
  HEREDOC
216
- field_table << "\n" << " " * 6
216
+ field_table << "\n" << (" " * 6)
217
217
  field_table
218
218
  end
219
219
 
@@ -1,8 +1,7 @@
1
- module Lutaml::SysMl
2
-
3
-
4
- class Allocate < Lutaml::Uml::Abstraction
5
- attr_accessor :base_abstraction
1
+ module Lutaml
2
+ module SysMl
3
+ class Allocate < Lutaml::Uml::Abstraction
4
+ attr_accessor :base_abstraction
5
+ end
6
+ end
6
7
  end
7
-
8
- end
@@ -1,7 +1,7 @@
1
- module Lutaml::SysMl
2
-
3
- class Allocated < Lutaml::Uml::TopElement
4
- attr_accessor :base_named_element, :allocated_from, :allocated_to
1
+ module Lutaml
2
+ module SysMl
3
+ class Allocated < Lutaml::Uml::TopElement
4
+ attr_accessor :base_named_element, :allocated_from, :allocated_to
5
+ end
6
+ end
5
7
  end
6
-
7
- end
@@ -1,7 +1,7 @@
1
- module Lutaml::SysMl
2
-
3
- class BindingConnector < Lutaml::Uml::Connector
4
- attr_accessor :base_connector
1
+ module Lutaml
2
+ module SysMl
3
+ class BindingConnector < Lutaml::Uml::Connector
4
+ attr_accessor :base_connector
5
+ end
6
+ end
5
7
  end
6
-
7
- end
@@ -1,27 +1,30 @@
1
- module Lutaml::SysMl
1
+ module Lutaml
2
+ module SysMl
3
+ class Block < Lutaml::Uml::Class
4
+ attr_accessor :base_class
2
5
 
3
- class Block < Lutaml::Uml::Class
4
- attr_accessor :base_class
5
- def initialize
6
- @xmi_id = nil
7
- @nested_classifier = []
8
- @stereotype = []
9
- @namespace = nil
10
- end
11
-
12
- def name
13
- if base_class != nil and base_class.name != nil
14
- return base_class.name
15
- end
16
- return nil
17
- end
18
-
19
- def full_name
20
- if base_class != nil and base_class.name != nil
21
- return base_class.full_name
22
- end
23
- return nil
24
- end
25
- end
6
+ def initialize
7
+ @xmi_id = nil
8
+ @nested_classifier = []
9
+ @stereotype = []
10
+ @namespace = nil
11
+ end
12
+
13
+ def name
14
+ if !base_class.nil? && !base_class.name.nil?
15
+ return base_class.name
16
+ end
17
+
18
+ nil
19
+ end
26
20
 
27
- end
21
+ def full_name
22
+ if !base_class.nil? && !base_class.name.nil?
23
+ return base_class.full_name
24
+ end
25
+
26
+ nil
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,12 +1,12 @@
1
- module Lutaml::SysMl
2
-
3
- class ConstraintBlock < Block
4
- def initialize
5
- @xmi_id = nil
6
- @nested_classifier = []
7
- @stereotype = []
8
- @namespace = nil
9
- end
1
+ module Lutaml
2
+ module SysMl
3
+ class ConstraintBlock < Block
4
+ def initialize
5
+ @xmi_id = nil
6
+ @nested_classifier = []
7
+ @stereotype = []
8
+ @namespace = nil
9
+ end
10
+ end
11
+ end
10
12
  end
11
-
12
- end
@@ -1,6 +1,6 @@
1
- module Lutaml::SysMl
2
-
3
- class Copy < Trace
1
+ module Lutaml
2
+ module SysMl
3
+ class Copy < Trace
4
+ end
4
5
  end
5
-
6
- end
6
+ end
@@ -1,7 +1,7 @@
1
- module Lutaml::SysMl
2
-
3
- class DeriveRequirement < Lutaml::Uml::TopElement
4
- attr_accessor :base_abstraction
1
+ module Lutaml
2
+ module SysMl
3
+ class DeriveRequirement < Lutaml::Uml::TopElement
4
+ attr_accessor :base_abstraction
5
+ end
6
+ end
5
7
  end
6
-
7
- end
@@ -1,11 +1,11 @@
1
- module Lutaml::SysMl
1
+ module Lutaml
2
+ module SysMl
3
+ class NestedConnectorEnd < Lutaml::Uml::ConnectorEnd
4
+ attr_accessor :base_connectorend, :property_path
2
5
 
3
- class NestedConnectorEnd < Lutaml::Uml::ConnectorEnd
4
- attr_accessor :base_connectorend, :property_path
5
- def initialize
6
- @property_path = []
7
- end
6
+ def initialize
7
+ @property_path = []
8
+ end
9
+ end
10
+ end
8
11
  end
9
-
10
-
11
- end
@@ -1,7 +1,7 @@
1
- module Lutaml::SysMl
2
-
3
- class Refine < Lutaml::Uml::TopElement
4
- attr_accessor :base_abstraction
1
+ module Lutaml
2
+ module SysMl
3
+ class Refine < Lutaml::Uml::TopElement
4
+ attr_accessor :base_abstraction
5
+ end
6
+ end
5
7
  end
6
-
7
- end
@@ -1,7 +1,7 @@
1
- module Lutaml::SysMl
2
-
3
- class RequirementRelated < Lutaml::Uml::TopElement
4
- attr_accessor :base_named_element, :satisfies, :refines
1
+ module Lutaml
2
+ module SysMl
3
+ class RequirementRelated < Lutaml::Uml::TopElement
4
+ attr_accessor :base_named_element, :satisfies, :refines
5
+ end
6
+ end
5
7
  end
6
-
7
- end
@@ -1,7 +1,7 @@
1
- module Lutaml::SysMl
2
-
3
- class Satisfy < Trace
4
- attr_accessor :base_realization
1
+ module Lutaml
2
+ module SysMl
3
+ class Satisfy < Trace
4
+ attr_accessor :base_realization
5
+ end
6
+ end
5
7
  end
6
-
7
- end
@@ -1,22 +1,23 @@
1
- module Lutaml::SysMl
1
+ module Lutaml
2
+ module SysMl
3
+ class TestCase < Lutaml::Uml::TopElement
4
+ attr_accessor :base_behavior, :verifies
2
5
 
3
- class TestCase < Lutaml::Uml::TopElement
4
- attr_accessor :base_behavior, :verifies
5
-
6
- def name
7
- if base_behavior != nil and base_behavior.name != nil
8
- return base_behavior.name
9
- end
10
- return nil
11
- end
12
-
13
- def full_name
14
- if base_behavior != nil and base_behavior.name != nil
15
- return base_behavior.full_name
16
- end
17
- return nil
18
- end
6
+ def name
7
+ if !base_behavior.nil? && !base_behavior.name.nil?
8
+ return base_behavior.name
9
+ end
19
10
 
20
- end
11
+ nil
12
+ end
13
+
14
+ def full_name
15
+ if !base_behavior.nil? && !base_behavior.name.nil?
16
+ return base_behavior.full_name
17
+ end
21
18
 
22
- end
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,7 +1,7 @@
1
- module Lutaml::SysMl
2
-
3
- class Trace < Lutaml::Uml::TopElement
4
- attr_accessor :base_abstraction
1
+ module Lutaml
2
+ module SysMl
3
+ class Trace < Lutaml::Uml::TopElement
4
+ attr_accessor :base_abstraction
5
+ end
6
+ end
5
7
  end
6
-
7
- end
@@ -1,6 +1,6 @@
1
- module Lutaml::SysMl
2
-
3
- class Verify < Trace
1
+ module Lutaml
2
+ module SysMl
3
+ class Verify < Trace
4
+ end
5
+ end
4
6
  end
5
-
6
- end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
2
  module Sysml
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.0".freeze
4
4
  end
5
5
  end