lutaml 0.9.39 → 0.9.41
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/README.adoc +7 -1
- data/docs/lutaml-express.adoc +35 -0
- data/docs/lutaml-sysml.adoc +10 -0
- data/docs/lutaml-uml.adoc +111 -0
- data/docs/lutaml-xmi.adoc +33 -0
- data/exe/lutaml-yaml2uml +1 -1
- data/lib/lutaml/command_line.rb +1 -1
- data/lib/lutaml/converter/dsl_to_uml.rb +235 -0
- data/lib/lutaml/converter/xmi_hash_to_uml.rb +196 -0
- data/lib/lutaml/express.rb +0 -1
- data/lib/lutaml/formatter/base.rb +7 -7
- data/lib/lutaml/formatter/graphviz.rb +19 -8
- data/lib/lutaml/formatter.rb +0 -2
- data/lib/lutaml/parser.rb +1 -1
- data/lib/lutaml/sysml/allocate.rb +1 -1
- data/lib/lutaml/sysml/allocated.rb +1 -1
- data/lib/lutaml/sysml/binding_connector.rb +1 -1
- data/lib/lutaml/sysml/block.rb +1 -1
- data/lib/lutaml/sysml/constraint_block.rb +1 -1
- data/lib/lutaml/sysml/copy.rb +1 -1
- data/lib/lutaml/sysml/derive_requirement.rb +1 -1
- data/lib/lutaml/sysml/nested_connector_end.rb +1 -1
- data/lib/lutaml/sysml/refine.rb +1 -1
- data/lib/lutaml/sysml/requirement_related.rb +1 -1
- data/lib/lutaml/sysml/satisfy.rb +1 -1
- data/lib/lutaml/sysml/test_case.rb +1 -1
- data/lib/lutaml/sysml/trace.rb +1 -1
- data/lib/lutaml/sysml/verify.rb +1 -1
- data/lib/lutaml/sysml/xmi_file.rb +1 -1
- data/lib/lutaml/sysml.rb +0 -1
- data/lib/lutaml/uml/action.rb +15 -0
- data/lib/lutaml/uml/actor.rb +0 -8
- data/lib/lutaml/uml/association.rb +25 -34
- data/lib/lutaml/uml/cardinality.rb +10 -0
- data/lib/lutaml/uml/class.rb +43 -68
- data/lib/lutaml/uml/classifier.rb +5 -3
- data/lib/lutaml/uml/connector.rb +5 -8
- data/lib/lutaml/uml/connector_end.rb +20 -0
- data/lib/lutaml/uml/constraint.rb +11 -1
- data/lib/lutaml/uml/data_type.rb +48 -64
- data/lib/lutaml/uml/dependency.rb +5 -8
- data/lib/lutaml/uml/document.rb +46 -73
- data/lib/lutaml/uml/enum.rb +12 -35
- data/lib/lutaml/uml/event.rb +0 -1
- data/lib/lutaml/uml/fidelity.rb +10 -0
- data/lib/lutaml/uml/group.rb +17 -0
- data/lib/lutaml/uml/instance.rb +5 -7
- data/lib/lutaml/uml/model.rb +3 -3
- data/lib/lutaml/uml/namespace.rb +10 -0
- data/lib/lutaml/uml/node/base.rb +1 -1
- data/lib/lutaml/uml/operation.rb +6 -22
- data/lib/lutaml/uml/package.rb +23 -44
- data/lib/lutaml/uml/parsers/dsl.rb +5 -2
- data/lib/lutaml/uml/parsers/yaml.rb +2 -28
- data/lib/lutaml/uml/primitive_type.rb +3 -4
- data/lib/lutaml/uml/property.rb +15 -17
- data/lib/lutaml/uml/region.rb +0 -1
- data/lib/lutaml/uml/state.rb +9 -1
- data/lib/lutaml/uml/state_machine.rb +0 -1
- data/lib/lutaml/uml/top_element.rb +61 -39
- data/lib/lutaml/uml/top_element_attribute.rb +33 -22
- data/lib/lutaml/uml/transition.rb +11 -1
- data/lib/lutaml/uml/trigger.rb +5 -1
- data/lib/lutaml/uml/value.rb +18 -14
- data/lib/lutaml/uml.rb +40 -2
- data/lib/lutaml/version.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/enum_drop.rb +1 -1
- data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +2 -1
- data/lib/lutaml/xmi/parsers/xmi_base.rb +20 -2
- data/lib/lutaml/xmi/parsers/xml.rb +5 -4
- metadata +15 -19
- data/lib/lutaml/express/README.adoc +0 -55
- data/lib/lutaml/express/version.rb +0 -7
- data/lib/lutaml/sysml/README.md +0 -40
- data/lib/lutaml/sysml/version.rb +0 -5
- data/lib/lutaml/uml/README.adoc +0 -44
- data/lib/lutaml/uml/constructor_end.rb +0 -16
- data/lib/lutaml/uml/formatter/base.rb +0 -67
- data/lib/lutaml/uml/formatter/graphviz.rb +0 -332
- data/lib/lutaml/uml/formatter.rb +0 -21
- data/lib/lutaml/uml/serializers/association.rb +0 -58
- data/lib/lutaml/uml/serializers/base.rb +0 -16
- data/lib/lutaml/uml/serializers/class.rb +0 -29
- data/lib/lutaml/uml/serializers/top_element_attribute.rb +0 -14
- data/lib/lutaml/uml/serializers/yaml_view.rb +0 -18
- data/lib/lutaml/uml/version.rb +0 -7
- data/lib/lutaml/xmi/README.adoc +0 -24
- /data/{LUTAML.adoc → docs/lutaml_syntax.adoc} +0 -0
@@ -40,27 +40,27 @@ module Lutaml
|
|
40
40
|
|
41
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
|
47
47
|
format_class_relationship(node)
|
48
48
|
when ::Lutaml::Uml::Node::ClassNode then format_class(node)
|
49
|
-
when Lutaml::Uml::Document then format_document(node)
|
49
|
+
when ::Lutaml::Uml::Document then format_document(node)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def format_field(_node);
|
53
|
+
def format_field(_node); raise NotImplementedError; end
|
54
54
|
|
55
|
-
def format_method(_node);
|
55
|
+
def format_method(_node); raise NotImplementedError; end
|
56
56
|
|
57
|
-
def format_relationship(_node);
|
57
|
+
def format_relationship(_node); raise NotImplementedError; end
|
58
58
|
|
59
59
|
def format_class_relationship(_node); raise NotImplementedError; end
|
60
60
|
|
61
|
-
def format_class(_node);
|
61
|
+
def format_class(_node); raise NotImplementedError; end
|
62
62
|
|
63
|
-
def format_document(_node);
|
63
|
+
def format_document(_node); raise NotImplementedError; end
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
@@ -95,7 +95,8 @@ module Lutaml
|
|
95
95
|
result += " : #{keyword}#{node.type}"
|
96
96
|
end
|
97
97
|
if node.cardinality
|
98
|
-
result += "[#{node.cardinality
|
98
|
+
result += "[#{node.cardinality.min}.." \
|
99
|
+
"#{node.cardinality.max}]"
|
99
100
|
end
|
100
101
|
result = escape_html_chars(result)
|
101
102
|
result = "<U>#{result}</U>" if node.static
|
@@ -141,7 +142,17 @@ module Lutaml
|
|
141
142
|
else
|
142
143
|
"direct"
|
143
144
|
end
|
144
|
-
|
145
|
+
|
146
|
+
if node&.action&.verb
|
147
|
+
attributes["label"] = node.action.verb
|
148
|
+
end
|
149
|
+
case node&.action&.direction
|
150
|
+
when "target"
|
151
|
+
attributes["label"] = "#{attributes['label']} \u25b6"
|
152
|
+
when "source"
|
153
|
+
attributes["label"] = "\u25c0 #{attributes['label']}"
|
154
|
+
end
|
155
|
+
|
145
156
|
if node.owner_end_attribute_name
|
146
157
|
attributes["headlabel"] = format_label(
|
147
158
|
node.owner_end_attribute_name,
|
@@ -189,11 +200,11 @@ module Lutaml
|
|
189
200
|
def format_label(name, cardinality = {})
|
190
201
|
res = "+#{name}"
|
191
202
|
if cardinality.nil? ||
|
192
|
-
(cardinality
|
203
|
+
(cardinality.min.nil? || cardinality.max.nil?)
|
193
204
|
return res
|
194
205
|
end
|
195
206
|
|
196
|
-
"#{res} #{cardinality
|
207
|
+
"#{res} #{cardinality.min}..#{cardinality.max}"
|
197
208
|
end
|
198
209
|
|
199
210
|
def format_member_rows(members, hide_members) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
|
@@ -250,8 +261,8 @@ module Lutaml
|
|
250
261
|
@node["fontname"] = "#{@fontname}-bold"
|
251
262
|
|
252
263
|
if node.fidelity
|
253
|
-
hide_members = node.fidelity
|
254
|
-
hide_other_classes = node.fidelity
|
264
|
+
hide_members = node.fidelity.hideMembers
|
265
|
+
hide_other_classes = node.fidelity.hideOtherClasses
|
255
266
|
end
|
256
267
|
classes = (node.classes +
|
257
268
|
node.enums +
|
@@ -303,8 +314,8 @@ module Lutaml
|
|
303
314
|
|
304
315
|
def sort_by_document_grouping(groups, associations) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
305
316
|
result = []
|
306
|
-
groups.each do |
|
307
|
-
|
317
|
+
groups.each do |group|
|
318
|
+
group.values.each do |group_name| # rubocop:disable Style/HashEachMethods
|
308
319
|
associations
|
309
320
|
.select { |assc| assc.owner_end == group_name }
|
310
321
|
.each do |association|
|
data/lib/lutaml/formatter.rb
CHANGED
data/lib/lutaml/parser.rb
CHANGED
@@ -35,7 +35,7 @@ module Lutaml
|
|
35
35
|
file_list.map { |file| Lutaml::Xml::Parsers::Xml.parse(file) }
|
36
36
|
when "lutaml"
|
37
37
|
file_list.map { |file| Lutaml::Uml::Parsers::Dsl.parse(file) }
|
38
|
-
when "yml"
|
38
|
+
when "yml", "yaml"
|
39
39
|
file_list.map { |file| Lutaml::Uml::Parsers::Yaml.parse(file.path) }
|
40
40
|
else
|
41
41
|
raise ArgumentError, "Unsupported file format"
|
data/lib/lutaml/sysml/block.rb
CHANGED
data/lib/lutaml/sysml/copy.rb
CHANGED
data/lib/lutaml/sysml/refine.rb
CHANGED
data/lib/lutaml/sysml/satisfy.rb
CHANGED
data/lib/lutaml/sysml/trace.rb
CHANGED
data/lib/lutaml/sysml/verify.rb
CHANGED
data/lib/lutaml/sysml.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Uml
|
5
|
+
class Action < Lutaml::Model::Serializable
|
6
|
+
attribute :verb, :string
|
7
|
+
attribute :direction, :string
|
8
|
+
|
9
|
+
yaml do
|
10
|
+
map "verb", to: :verb
|
11
|
+
map "direction", to: :direction
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/lutaml/uml/actor.rb
CHANGED
@@ -3,17 +3,9 @@
|
|
3
3
|
##
|
4
4
|
## Behaviour metamodel
|
5
5
|
##
|
6
|
-
|
7
6
|
module Lutaml
|
8
7
|
module Uml
|
9
8
|
class Actor < Classifier
|
10
|
-
def initialize # rubocop:disable Lint/MissingSuper
|
11
|
-
@name = nil
|
12
|
-
@xmi_id = nil
|
13
|
-
@stereotype = []
|
14
|
-
@generalization = []
|
15
|
-
@namespace = nil
|
16
|
-
end
|
17
9
|
end
|
18
10
|
end
|
19
11
|
end
|
@@ -3,41 +3,32 @@
|
|
3
3
|
module Lutaml
|
4
4
|
module Uml
|
5
5
|
class Association < TopElement
|
6
|
-
|
6
|
+
attribute :owner_end, :string
|
7
|
+
attribute :owner_end_attribute_name, :string
|
8
|
+
attribute :owner_end_cardinality, Cardinality
|
9
|
+
attribute :owner_end_type, :string
|
10
|
+
attribute :owner_end_xmi_id, :string
|
11
|
+
attribute :member_end, :string
|
12
|
+
attribute :member_end_attribute_name, :string
|
13
|
+
attribute :member_end_xmi_id, :string
|
14
|
+
attribute :member_end_cardinality, Cardinality
|
15
|
+
attribute :member_end_type, :string
|
16
|
+
attribute :static, :string
|
17
|
+
attribute :action, Action
|
7
18
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# TODO: move to Parslet::Transform
|
22
|
-
def members=(value) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
23
|
-
value.group_by { |member| member.keys.first }
|
24
|
-
.each do |(type, group)|
|
25
|
-
if %w[owner_end member_end].include?(type) # rubocop:disable Performance/CollectionLiteralInLoop
|
26
|
-
group.each do |member|
|
27
|
-
member.each_pair do |key, member_value|
|
28
|
-
public_send(:"#{association_type(key)}=", member_value)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
next
|
32
|
-
end
|
33
|
-
attribute_value = group.map(&:values).flatten
|
34
|
-
if attribute_value.length == 1 && !attribute_value.first.is_a?(Hash)
|
35
|
-
next public_send(:"#{association_type(type)}=",
|
36
|
-
attribute_value.first)
|
37
|
-
end
|
38
|
-
|
39
|
-
public_send(:"#{association_type(type)}=", attribute_value)
|
40
|
-
end
|
19
|
+
yaml do
|
20
|
+
map "owner_end", to: :owner_end
|
21
|
+
map "owner_end_attribute_name", to: :owner_end_attribute_name
|
22
|
+
map "owner_end_cardinality", to: :owner_end_cardinality
|
23
|
+
map "owner_end_type", to: :owner_end_type
|
24
|
+
map "owner_end_xmi_id", to: :owner_end_xmi_id
|
25
|
+
map "member_end", to: :member_end
|
26
|
+
map "member_end_attribute_name", to: :member_end_attribute_name
|
27
|
+
map "member_end_xmi_id", to: :member_end_xmi_id
|
28
|
+
map "member_end_cardinality", to: :member_end_cardinality
|
29
|
+
map "member_end_type", to: :member_end_type
|
30
|
+
map "static", to: :static
|
31
|
+
map "action", to: :action
|
41
32
|
end
|
42
33
|
end
|
43
34
|
end
|
data/lib/lutaml/uml/class.rb
CHANGED
@@ -1,82 +1,57 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "lutaml/uml/
|
4
|
-
|
5
|
-
require "lutaml/uml/has_members"
|
3
|
+
require "lutaml/uml/package"
|
6
4
|
require "lutaml/uml/association"
|
7
5
|
require "lutaml/uml/constraint"
|
8
|
-
require "lutaml/uml/data_type"
|
9
6
|
require "lutaml/uml/operation"
|
10
|
-
require "lutaml/uml/
|
7
|
+
require "lutaml/uml/data_type"
|
11
8
|
|
12
9
|
module Lutaml
|
13
10
|
module Uml
|
14
11
|
class Class < Classifier
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
12
|
+
attribute :nested_classifier, :string, collection: true,
|
13
|
+
default: -> { [] }
|
14
|
+
attribute :is_abstract, :boolean, default: false
|
15
|
+
attribute :type, :string
|
16
|
+
attribute :package, Package
|
17
|
+
attribute :attributes, TopElementAttribute, collection: true
|
18
|
+
attribute :modifier, :string
|
19
|
+
attribute :constraints, Constraint, collection: true
|
20
|
+
attribute :operations, Operation, collection: true
|
21
|
+
attribute :data_types, DataType, collection: true
|
22
|
+
attribute :methods, :string, collection: true, default: -> { [] }
|
23
|
+
|
24
|
+
attribute :associations, Association, collection: true
|
25
|
+
|
26
|
+
yaml do
|
27
|
+
map "nested_classifier", to: :nested_classifier
|
28
|
+
map "is_abstract", to: :is_abstract
|
29
|
+
map "type", to: :type
|
30
|
+
map "package", to: :package
|
31
|
+
map "attributes", to: :attributes
|
32
|
+
map "modifier", to: :modifier
|
33
|
+
map "constraints", to: :constraints
|
34
|
+
map "operations", to: :operations
|
35
|
+
map "data_types", to: :data_types
|
36
|
+
map "methods", to: :methods
|
37
|
+
|
38
|
+
map "associations", to: :associations, with: {
|
39
|
+
to: :associations_to_yaml, from: :associations_from_yaml
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def associations_to_yaml(model, doc)
|
44
|
+
associations = model.associations.map(&:to_hash)
|
45
|
+
doc["associations"] = associations unless associations.empty?
|
46
|
+
end
|
47
|
+
|
48
|
+
def associations_from_yaml(model, values)
|
49
|
+
associations = values.map do |value|
|
50
|
+
value["owner_end"] = model.name if value["owner_end"].nil?
|
51
|
+
Association.from_yaml(value.to_yaml)
|
51
52
|
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def constraints=(value)
|
55
|
-
@constraints = value.to_a.map do |attr|
|
56
|
-
Constraint.new(attr)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def operations=(value)
|
61
|
-
@operations = value.to_a.map do |attr|
|
62
|
-
Operation.new(attr)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
def data_types=(value)
|
67
|
-
@data_types = value.to_a.map do |attr|
|
68
|
-
DataType.new(attr)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def methods
|
73
|
-
# @members&.select { |member| member.class == Method }
|
74
|
-
[]
|
75
|
-
end
|
76
53
|
|
77
|
-
|
78
|
-
# @members&.select { |member| member.class == ClassRelationship }
|
79
|
-
[]
|
54
|
+
model.associations = associations
|
80
55
|
end
|
81
56
|
end
|
82
57
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "lutaml/uml/top_element"
|
4
|
-
|
5
3
|
module Lutaml
|
6
4
|
module Uml
|
7
5
|
class Classifier < TopElement
|
8
|
-
|
6
|
+
attribute :generalization, :string, collection: true, default: -> { [] }
|
7
|
+
|
8
|
+
yaml do
|
9
|
+
map "generalization", to: :generalization
|
10
|
+
end
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
data/lib/lutaml/uml/connector.rb
CHANGED
@@ -6,15 +6,12 @@
|
|
6
6
|
module Lutaml
|
7
7
|
module Uml
|
8
8
|
class Connector < TopElement
|
9
|
-
|
9
|
+
attribute :kind, :string
|
10
|
+
attribute :connector_end, :string, collection: true, default: -> { [] }
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
@xmi_uuid = nil
|
15
|
-
@connector_end = []
|
16
|
-
@namespace = nil
|
17
|
-
@kind = nil
|
12
|
+
yaml do
|
13
|
+
map "kind", to: :kind
|
14
|
+
map "connector_end", to: :connector_end
|
18
15
|
end
|
19
16
|
end
|
20
17
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
##
|
4
|
+
## Behaviour metamodel
|
5
|
+
##
|
6
|
+
module Lutaml
|
7
|
+
module Uml
|
8
|
+
class ConnectorEnd < TopElement
|
9
|
+
attribute :role, :string
|
10
|
+
attribute :part_with_port, :string
|
11
|
+
attribute :connector, :string
|
12
|
+
|
13
|
+
yaml do
|
14
|
+
map "role", to: :role
|
15
|
+
map "part_with_port", to: :part_with_port
|
16
|
+
map "connector", to: :connector
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -6,7 +6,17 @@
|
|
6
6
|
module Lutaml
|
7
7
|
module Uml
|
8
8
|
class Constraint < TopElement
|
9
|
-
|
9
|
+
attribute :body, :string
|
10
|
+
attribute :type, :string
|
11
|
+
attribute :weight, :string
|
12
|
+
attribute :status, :string
|
13
|
+
|
14
|
+
yaml do
|
15
|
+
map "body", to: :body
|
16
|
+
map "type", to: :type
|
17
|
+
map "weight", to: :weight
|
18
|
+
map "status", to: :status
|
19
|
+
end
|
10
20
|
end
|
11
21
|
end
|
12
22
|
end
|