lutaml 0.9.33 → 0.9.35
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.
- checksums.yaml +4 -4
- data/Gemfile +8 -0
- data/bin/plantuml2lutaml +1 -1
- data/bin/yaml2lutaml +6 -4
- data/exe/lutaml-wsd2uml +1 -1
- data/exe/lutaml-yaml2uml +6 -4
- data/lib/lutaml/command_line.rb +3 -3
- data/lib/lutaml/formatter/base.rb +3 -3
- data/lib/lutaml/formatter/graphviz.rb +10 -10
- data/lib/lutaml/sysml/block.rb +1 -1
- data/lib/lutaml/sysml/constraint_block.rb +1 -1
- data/lib/lutaml/sysml/nested_connector_end.rb +1 -1
- data/lib/lutaml/sysml/requirement.rb +41 -33
- data/lib/lutaml/sysml/xmi_file.rb +382 -355
- data/lib/lutaml/uml/actor.rb +1 -1
- data/lib/lutaml/uml/association.rb +5 -5
- data/lib/lutaml/uml/connector.rb +1 -1
- data/lib/lutaml/uml/constructor_end.rb +1 -1
- data/lib/lutaml/uml/dependency.rb +1 -1
- data/lib/lutaml/uml/document.rb +0 -1
- data/lib/lutaml/uml/formatter/base.rb +2 -2
- data/lib/lutaml/uml/formatter/graphviz.rb +10 -10
- data/lib/lutaml/uml/has_members.rb +4 -4
- data/lib/lutaml/uml/instance.rb +1 -1
- data/lib/lutaml/uml/model.rb +1 -1
- data/lib/lutaml/uml/node/class_node.rb +1 -1
- data/lib/lutaml/uml/operation.rb +2 -2
- data/lib/lutaml/uml/package.rb +2 -2
- data/lib/lutaml/uml/parsers/dsl.rb +7 -4
- data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +6 -3
- data/lib/lutaml/uml/property.rb +4 -4
- data/lib/lutaml/uml/top_element.rb +2 -2
- data/lib/lutaml/uml/top_element_attribute.rb +1 -1
- data/lib/lutaml/uml/value.rb +2 -2
- data/lib/lutaml/version.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/association_drop.rb +11 -2
- data/lib/lutaml/xmi/liquid_drops/attribute_drop.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/connector_drop.rb +48 -0
- data/lib/lutaml/xmi/liquid_drops/data_type_drop.rb +2 -1
- data/lib/lutaml/xmi/liquid_drops/generalization_attribute_drop.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +9 -3
- data/lib/lutaml/xmi/liquid_drops/source_target_drop.rb +36 -0
- data/lib/lutaml/xmi/parsers/xmi_base.rb +39 -19
- data/lib/lutaml/xmi.rb +0 -1
- data/lutaml.gemspec +2 -10
- metadata +6 -103
- data/lib/lutaml/xmi/version.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca966781f52ce9978f570ef4a2eaaccaf50cc58afae2b0f58767700983becbe1
|
4
|
+
data.tar.gz: '08378b29643e433382e78eb49fdb836309fab0750f3f8491542c1bc4b084fc2e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f631a08c0e17860697147994b5f588ec2ced711f9660c83d3c8a6026bbf9f0f551c35e0d460734383caa733f29db4963a64ffb6934e79fb95e03cf46e8b57d0
|
7
|
+
data.tar.gz: 0150c791377dbc0a1d045f8b52124c9a956b8357001c572a533a29b99eb322146706b50f4c0c4a87c1712f27e19a28fca6dcb35f3ca7d8048b7ebc280edcfcbd
|
data/Gemfile
CHANGED
@@ -2,3 +2,11 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in lutaml.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
gem "byebug"
|
7
|
+
gem "equivalent-xml", "~> 0.6.0"
|
8
|
+
gem "pry", "~> 0.12.2"
|
9
|
+
gem "rake", "~> 13.0"
|
10
|
+
gem "rspec", "~> 3.11"
|
11
|
+
gem "rubocop", "~> 1.58"
|
12
|
+
gem "rubocop-performance", "~> 1.19"
|
data/bin/plantuml2lutaml
CHANGED
@@ -26,7 +26,7 @@ ASSOCIATION_MAPPINGS = {
|
|
26
26
|
|
27
27
|
in_comment_block = false
|
28
28
|
|
29
|
-
def transform_line(line)
|
29
|
+
def transform_line(line) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
30
30
|
line = line.gsub(/^\s*'/, "** ").gsub(/\|[\sa-zA-Z]+$/, "")
|
31
31
|
return sync_puts(line, 2) if ASSOCIATION_MAPPINGS.keys.none? do |key|
|
32
32
|
line =~ key
|
data/bin/yaml2lutaml
CHANGED
@@ -30,7 +30,7 @@ encountered_relations = Hash.new { |h, key| h[key] = [] }
|
|
30
30
|
# cardinality:
|
31
31
|
# min: 0
|
32
32
|
# max: '*'
|
33
|
-
def process_association(owner, values, encountered_relations)
|
33
|
+
def process_association(owner, values, encountered_relations) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
34
34
|
target_name = values["target"]
|
35
35
|
return if encountered_relations[owner].include?(target_name)
|
36
36
|
|
@@ -45,7 +45,8 @@ def process_association(owner, values, encountered_relations)
|
|
45
45
|
if source["attribute"]
|
46
46
|
source_attribute_name = source["attribute"].keys.first
|
47
47
|
owner += "##{source_attribute_name}"
|
48
|
-
if source["attribute"][source_attribute_name] &&
|
48
|
+
if source["attribute"][source_attribute_name] &&
|
49
|
+
source["attribute"][source_attribute_name]["cardinality"]
|
49
50
|
cardinality = source["attribute"][source_attribute_name]["cardinality"]
|
50
51
|
owner += " [#{cardinality['min']}..#{cardinality['max']}]"
|
51
52
|
end
|
@@ -61,7 +62,8 @@ def process_association(owner, values, encountered_relations)
|
|
61
62
|
if target["attribute"]
|
62
63
|
target_attribute_name = target["attribute"].keys.first
|
63
64
|
member += "##{target_attribute_name}"
|
64
|
-
if target["attribute"][target_attribute_name] &&
|
65
|
+
if target["attribute"][target_attribute_name] &&
|
66
|
+
target["attribute"][target_attribute_name]["cardinality"]
|
65
67
|
cardinality = target["attribute"][target_attribute_name]["cardinality"]
|
66
68
|
member += " [#{cardinality['min']}..#{cardinality['max']}]"
|
67
69
|
end
|
@@ -82,7 +84,7 @@ view_yaml["relations"]&.each do |values|
|
|
82
84
|
process_association(values["source"], values, encountered_relations)
|
83
85
|
end
|
84
86
|
|
85
|
-
view_yaml["imports"].each_key do |entry|
|
87
|
+
view_yaml["imports"].each_key do |entry| # rubocop:disable Metrics/BlockLength
|
86
88
|
import = YAML.safe_load(File.read(File.join(models_path, "#{entry}.yml")))
|
87
89
|
import_name = import["name"] || File.basename(entry)
|
88
90
|
# Class notation
|
data/exe/lutaml-wsd2uml
CHANGED
@@ -26,7 +26,7 @@ ASSOCIATION_MAPPINGS = {
|
|
26
26
|
|
27
27
|
in_comment_block = false
|
28
28
|
|
29
|
-
def transform_line(line)
|
29
|
+
def transform_line(line) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
30
30
|
line = line.gsub(/^\s*'/, "** ").gsub(/\|[\sa-zA-Z]+$/, "").delete("\r")
|
31
31
|
return sync_puts(line, 2) if ASSOCIATION_MAPPINGS.keys.none? do |key|
|
32
32
|
line =~ key
|
data/exe/lutaml-yaml2uml
CHANGED
@@ -30,7 +30,7 @@ encountered_relations = Hash.new { |h, key| h[key] = [] }
|
|
30
30
|
# cardinality:
|
31
31
|
# min: 0
|
32
32
|
# max: '*'
|
33
|
-
def process_association(owner, values, encountered_relations)
|
33
|
+
def process_association(owner, values, encountered_relations) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
34
34
|
target_name = values["target"]
|
35
35
|
return if encountered_relations[owner].include?(target_name)
|
36
36
|
|
@@ -45,7 +45,8 @@ def process_association(owner, values, encountered_relations)
|
|
45
45
|
if source["attribute"]
|
46
46
|
source_attribute_name = source["attribute"].keys.first
|
47
47
|
owner += "##{source_attribute_name}"
|
48
|
-
if source["attribute"][source_attribute_name] &&
|
48
|
+
if source["attribute"][source_attribute_name] &&
|
49
|
+
source["attribute"][source_attribute_name]["cardinality"]
|
49
50
|
cardinality = source["attribute"][source_attribute_name]["cardinality"]
|
50
51
|
owner += " [#{cardinality['min']}..#{cardinality['max']}]"
|
51
52
|
end
|
@@ -61,7 +62,8 @@ def process_association(owner, values, encountered_relations)
|
|
61
62
|
if target["attribute"]
|
62
63
|
target_attribute_name = target["attribute"].keys.first
|
63
64
|
member += "##{target_attribute_name}"
|
64
|
-
if target["attribute"][target_attribute_name] &&
|
65
|
+
if target["attribute"][target_attribute_name] &&
|
66
|
+
target["attribute"][target_attribute_name]["cardinality"]
|
65
67
|
cardinality = target["attribute"][target_attribute_name]["cardinality"]
|
66
68
|
member += " [#{cardinality['min']}..#{cardinality['max']}]"
|
67
69
|
end
|
@@ -82,7 +84,7 @@ view_yaml["relations"]&.each do |values|
|
|
82
84
|
process_association(values["source"], values, encountered_relations)
|
83
85
|
end
|
84
86
|
|
85
|
-
view_yaml["imports"].each_key do |entry|
|
87
|
+
view_yaml["imports"].each_key do |entry| # rubocop:disable Metrics/BlockLength
|
86
88
|
import = YAML.safe_load(File.read(File.join(models_path, "#{entry}.yml")))
|
87
89
|
import_name = import["name"] || File.basename(entry)
|
88
90
|
# Class notation
|
data/lib/lutaml/command_line.rb
CHANGED
@@ -68,7 +68,7 @@ module Lutaml
|
|
68
68
|
raise(NotSupportedInputFormat, value) if @input_format.nil?
|
69
69
|
end
|
70
70
|
|
71
|
-
def run(original_args)
|
71
|
+
def run(original_args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
72
72
|
args = original_args.dup
|
73
73
|
if args.empty? || args.first.strip == "help"
|
74
74
|
print_help
|
@@ -143,7 +143,7 @@ module Lutaml
|
|
143
143
|
"\e[0m"
|
144
144
|
end
|
145
145
|
|
146
|
-
def setup_parser_options
|
146
|
+
def setup_parser_options # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
147
147
|
@option_parser.banner = ""
|
148
148
|
format_desc = "The output formatter (Default: '#{@formatter.name}')"
|
149
149
|
@option_parser
|
@@ -196,7 +196,7 @@ module Lutaml
|
|
196
196
|
end
|
197
197
|
end
|
198
198
|
|
199
|
-
def print_help
|
199
|
+
def print_help # rubocop:disable Metrics/AbcSize
|
200
200
|
@out_object.puts <<~HELP
|
201
201
|
#{text_bold('Usage:')} lutaml [options] PATHS
|
202
202
|
|
@@ -7,7 +7,7 @@ module Lutaml
|
|
7
7
|
module Formatter
|
8
8
|
class Base
|
9
9
|
class << self
|
10
|
-
def inherited(subclass)
|
10
|
+
def inherited(subclass) # rubocop:disable Lint/MissingSuper
|
11
11
|
Formatter.all << subclass
|
12
12
|
end
|
13
13
|
|
@@ -38,9 +38,9 @@ module Lutaml
|
|
38
38
|
@type = value.to_s.strip.downcase.to_sym
|
39
39
|
end
|
40
40
|
|
41
|
-
def format(node)
|
41
|
+
def format(node) # rubocop:disable Metrics/CyclomaticComplexity
|
42
42
|
case node
|
43
|
-
when ::Lutaml::Uml::Node::Field
|
43
|
+
when ::Lutaml::Uml::Node::Field then format_field(node)
|
44
44
|
when ::Lutaml::Uml::Node::Method then format_method(node)
|
45
45
|
when ::Lutaml::Uml::Node::Relationship then format_relationship(node)
|
46
46
|
when ::Lutaml::Uml::Node::ClassRelationship
|
@@ -40,7 +40,7 @@ module Lutaml
|
|
40
40
|
cmapx
|
41
41
|
].freeze
|
42
42
|
|
43
|
-
def initialize(attributes = {})
|
43
|
+
def initialize(attributes = {}) # rubocop:disable Metrics/MethodLength
|
44
44
|
super
|
45
45
|
|
46
46
|
@graph = Attributes.new
|
@@ -87,7 +87,7 @@ module Lutaml
|
|
87
87
|
.gsub("]", "]")
|
88
88
|
end
|
89
89
|
|
90
|
-
def format_field(node)
|
90
|
+
def format_field(node) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
91
91
|
symbol = ACCESS_SYMBOLS[node.visibility]
|
92
92
|
result = "#{symbol}#{node.name}"
|
93
93
|
if node.type
|
@@ -103,7 +103,7 @@ module Lutaml
|
|
103
103
|
result
|
104
104
|
end
|
105
105
|
|
106
|
-
def format_method(node)
|
106
|
+
def format_method(node) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
107
107
|
symbol = ACCESS_SYMBOLS[node.access]
|
108
108
|
result = "#{symbol} #{node.name}"
|
109
109
|
if node.arguments
|
@@ -129,7 +129,7 @@ module Lutaml
|
|
129
129
|
%{#{graph_parent_name} -> #{graph_node_name}#{graph_attributes}}
|
130
130
|
end
|
131
131
|
|
132
|
-
def generate_graph_relationship_attributes(node)
|
132
|
+
def generate_graph_relationship_attributes(node) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
133
133
|
attributes = Attributes.new
|
134
134
|
if %w[dependency realizes].include?(node.member_end_type)
|
135
135
|
attributes["style"] = "dashed"
|
@@ -196,7 +196,7 @@ module Lutaml
|
|
196
196
|
"#{res} #{cardinality['min']}..#{cardinality['max']}"
|
197
197
|
end
|
198
198
|
|
199
|
-
def format_member_rows(members, hide_members)
|
199
|
+
def format_member_rows(members, hide_members) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
|
200
200
|
unless !hide_members && members&.length&.positive?
|
201
201
|
return <<~HEREDOC.chomp
|
202
202
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
|
@@ -217,7 +217,7 @@ module Lutaml
|
|
217
217
|
field_table
|
218
218
|
end
|
219
219
|
|
220
|
-
def format_class(node, hide_members)
|
220
|
+
def format_class(node, hide_members) # rubocop:disable Metrics/AbcSize
|
221
221
|
name = ["<B>#{node.name}</B>"]
|
222
222
|
name.unshift("«#{node.keyword}»") if node.keyword
|
223
223
|
name_html = <<~HEREDOC
|
@@ -245,7 +245,7 @@ module Lutaml
|
|
245
245
|
HEREDOC
|
246
246
|
end
|
247
247
|
|
248
|
-
def format_document(node)
|
248
|
+
def format_document(node) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
249
249
|
@fontname = node.fontname || DEFAULT_CLASS_FONT
|
250
250
|
@node["fontname"] = "#{@fontname}-bold"
|
251
251
|
|
@@ -269,8 +269,8 @@ module Lutaml
|
|
269
269
|
associations = node.classes.map(&:associations).compact.flatten +
|
270
270
|
node.associations
|
271
271
|
if node.groups
|
272
|
-
associations =
|
273
|
-
|
272
|
+
associations = sort_by_document_grouping(node.groups,
|
273
|
+
associations)
|
274
274
|
end
|
275
275
|
classes_names = node.classes.map(&:name)
|
276
276
|
associations = associations.map do |assoc_node|
|
@@ -301,7 +301,7 @@ module Lutaml
|
|
301
301
|
|
302
302
|
protected
|
303
303
|
|
304
|
-
def
|
304
|
+
def sort_by_document_grouping(groups, associations) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
305
305
|
result = []
|
306
306
|
groups.each do |batch|
|
307
307
|
batch.each do |group_name|
|
data/lib/lutaml/sysml/block.rb
CHANGED
@@ -1,34 +1,42 @@
|
|
1
|
-
module Lutaml
|
1
|
+
module Lutaml
|
2
|
+
module Sysml
|
3
|
+
class Requirement < Lutaml::Uml::Class
|
4
|
+
attr_accessor :id, :text, :base_class, :refined_by, :traced_to,
|
5
|
+
:derived_from, :satisfied_by
|
2
6
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
##
|
27
|
-
##
|
28
|
-
##
|
29
|
-
##
|
30
|
-
##
|
31
|
-
##
|
32
|
-
##
|
33
|
-
##
|
34
|
-
|
7
|
+
def initialize # rubocop:disable Lint/MissingSuper
|
8
|
+
@xmi_id = nil
|
9
|
+
@id = nil
|
10
|
+
@nested_classifier = []
|
11
|
+
@stereotype = []
|
12
|
+
@namespace = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def name
|
16
|
+
if !base_class.nil? && !base_class.name.nil?
|
17
|
+
return base_class.name
|
18
|
+
end
|
19
|
+
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
|
23
|
+
def full_name
|
24
|
+
if !base_class.nil? && !base_class.name.nil?
|
25
|
+
return base_class.full_name
|
26
|
+
end
|
27
|
+
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
## def name
|
31
|
+
## if base_class != nil and base_class.name != nil
|
32
|
+
## base_class.name
|
33
|
+
## else
|
34
|
+
## nil
|
35
|
+
## end
|
36
|
+
## end
|
37
|
+
## def full_name
|
38
|
+
## get_base_class_full_name ( self )
|
39
|
+
## end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|