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.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +7 -1
  3. data/docs/lutaml-express.adoc +35 -0
  4. data/docs/lutaml-sysml.adoc +10 -0
  5. data/docs/lutaml-uml.adoc +111 -0
  6. data/docs/lutaml-xmi.adoc +33 -0
  7. data/exe/lutaml-yaml2uml +1 -1
  8. data/lib/lutaml/command_line.rb +1 -1
  9. data/lib/lutaml/converter/dsl_to_uml.rb +235 -0
  10. data/lib/lutaml/converter/xmi_hash_to_uml.rb +196 -0
  11. data/lib/lutaml/express.rb +0 -1
  12. data/lib/lutaml/formatter/base.rb +7 -7
  13. data/lib/lutaml/formatter/graphviz.rb +19 -8
  14. data/lib/lutaml/formatter.rb +0 -2
  15. data/lib/lutaml/parser.rb +1 -1
  16. data/lib/lutaml/sysml/allocate.rb +1 -1
  17. data/lib/lutaml/sysml/allocated.rb +1 -1
  18. data/lib/lutaml/sysml/binding_connector.rb +1 -1
  19. data/lib/lutaml/sysml/block.rb +1 -1
  20. data/lib/lutaml/sysml/constraint_block.rb +1 -1
  21. data/lib/lutaml/sysml/copy.rb +1 -1
  22. data/lib/lutaml/sysml/derive_requirement.rb +1 -1
  23. data/lib/lutaml/sysml/nested_connector_end.rb +1 -1
  24. data/lib/lutaml/sysml/refine.rb +1 -1
  25. data/lib/lutaml/sysml/requirement_related.rb +1 -1
  26. data/lib/lutaml/sysml/satisfy.rb +1 -1
  27. data/lib/lutaml/sysml/test_case.rb +1 -1
  28. data/lib/lutaml/sysml/trace.rb +1 -1
  29. data/lib/lutaml/sysml/verify.rb +1 -1
  30. data/lib/lutaml/sysml/xmi_file.rb +1 -1
  31. data/lib/lutaml/sysml.rb +0 -1
  32. data/lib/lutaml/uml/action.rb +15 -0
  33. data/lib/lutaml/uml/actor.rb +0 -8
  34. data/lib/lutaml/uml/association.rb +25 -34
  35. data/lib/lutaml/uml/cardinality.rb +10 -0
  36. data/lib/lutaml/uml/class.rb +43 -68
  37. data/lib/lutaml/uml/classifier.rb +5 -3
  38. data/lib/lutaml/uml/connector.rb +5 -8
  39. data/lib/lutaml/uml/connector_end.rb +20 -0
  40. data/lib/lutaml/uml/constraint.rb +11 -1
  41. data/lib/lutaml/uml/data_type.rb +48 -64
  42. data/lib/lutaml/uml/dependency.rb +5 -8
  43. data/lib/lutaml/uml/document.rb +46 -73
  44. data/lib/lutaml/uml/enum.rb +12 -35
  45. data/lib/lutaml/uml/event.rb +0 -1
  46. data/lib/lutaml/uml/fidelity.rb +10 -0
  47. data/lib/lutaml/uml/group.rb +17 -0
  48. data/lib/lutaml/uml/instance.rb +5 -7
  49. data/lib/lutaml/uml/model.rb +3 -3
  50. data/lib/lutaml/uml/namespace.rb +10 -0
  51. data/lib/lutaml/uml/node/base.rb +1 -1
  52. data/lib/lutaml/uml/operation.rb +6 -22
  53. data/lib/lutaml/uml/package.rb +23 -44
  54. data/lib/lutaml/uml/parsers/dsl.rb +5 -2
  55. data/lib/lutaml/uml/parsers/yaml.rb +2 -28
  56. data/lib/lutaml/uml/primitive_type.rb +3 -4
  57. data/lib/lutaml/uml/property.rb +15 -17
  58. data/lib/lutaml/uml/region.rb +0 -1
  59. data/lib/lutaml/uml/state.rb +9 -1
  60. data/lib/lutaml/uml/state_machine.rb +0 -1
  61. data/lib/lutaml/uml/top_element.rb +61 -39
  62. data/lib/lutaml/uml/top_element_attribute.rb +33 -22
  63. data/lib/lutaml/uml/transition.rb +11 -1
  64. data/lib/lutaml/uml/trigger.rb +5 -1
  65. data/lib/lutaml/uml/value.rb +18 -14
  66. data/lib/lutaml/uml.rb +40 -2
  67. data/lib/lutaml/version.rb +1 -1
  68. data/lib/lutaml/xmi/liquid_drops/enum_drop.rb +1 -1
  69. data/lib/lutaml/xmi/liquid_drops/klass_drop.rb +2 -1
  70. data/lib/lutaml/xmi/parsers/xmi_base.rb +20 -2
  71. data/lib/lutaml/xmi/parsers/xml.rb +5 -4
  72. metadata +15 -19
  73. data/lib/lutaml/express/README.adoc +0 -55
  74. data/lib/lutaml/express/version.rb +0 -7
  75. data/lib/lutaml/sysml/README.md +0 -40
  76. data/lib/lutaml/sysml/version.rb +0 -5
  77. data/lib/lutaml/uml/README.adoc +0 -44
  78. data/lib/lutaml/uml/constructor_end.rb +0 -16
  79. data/lib/lutaml/uml/formatter/base.rb +0 -67
  80. data/lib/lutaml/uml/formatter/graphviz.rb +0 -332
  81. data/lib/lutaml/uml/formatter.rb +0 -21
  82. data/lib/lutaml/uml/serializers/association.rb +0 -58
  83. data/lib/lutaml/uml/serializers/base.rb +0 -16
  84. data/lib/lutaml/uml/serializers/class.rb +0 -29
  85. data/lib/lutaml/uml/serializers/top_element_attribute.rb +0 -14
  86. data/lib/lutaml/uml/serializers/yaml_view.rb +0 -18
  87. data/lib/lutaml/uml/version.rb +0 -7
  88. data/lib/lutaml/xmi/README.adoc +0 -24
  89. /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 then format_field(node)
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); raise NotImplementedError; end
53
+ def format_field(_node); raise NotImplementedError; end
54
54
 
55
- def format_method(_node); raise NotImplementedError; end
55
+ def format_method(_node); raise NotImplementedError; end
56
56
 
57
- def format_relationship(_node); raise NotImplementedError; end
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); raise NotImplementedError; end
61
+ def format_class(_node); raise NotImplementedError; end
62
62
 
63
- def format_document(_node); raise NotImplementedError; end
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['min']}..#{node.cardinality['max']}]"
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
- attributes["label"] = node.action if node.action
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[:min].nil? || cardinality[:max].nil?)
203
+ (cardinality.min.nil? || cardinality.max.nil?)
193
204
  return res
194
205
  end
195
206
 
196
- "#{res} #{cardinality['min']}..#{cardinality['max']}"
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["hideMembers"]
254
- hide_other_classes = node.fidelity["hideOtherClasses"]
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 |batch|
307
- batch.each do |group_name|
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|
@@ -15,5 +15,3 @@ module Lutaml
15
15
  end
16
16
  end
17
17
  end
18
-
19
- require "lutaml/formatter/graphviz"
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"
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Allocate < Lutaml::Uml::Abstraction
4
4
  attr_accessor :base_abstraction
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Allocated < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_named_element, :allocated_from, :allocated_to
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class BindingConnector < Lutaml::Uml::Connector
4
4
  attr_accessor :base_connector
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Block < Lutaml::Uml::Class
4
4
  attr_accessor :base_class
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class ConstraintBlock < Block
4
4
  def initialize # rubocop:disable Lint/MissingSuper
5
5
  @xmi_id = nil
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Copy < Trace
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class DeriveRequirement < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_abstraction
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class NestedConnectorEnd < Lutaml::Uml::ConnectorEnd
4
4
  attr_accessor :base_connectorend, :property_path
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Refine < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_abstraction
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class RequirementRelated < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_named_element, :satisfies, :refines
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Satisfy < Trace
4
4
  attr_accessor :base_realization
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class TestCase < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_behavior, :verifies
5
5
 
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Trace < Lutaml::Uml::TopElement
4
4
  attr_accessor :base_abstraction
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class Verify < Trace
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Lutaml
2
- module SysMl
2
+ module Sysml
3
3
  class XmiFile
4
4
  attr_accessor :package_list, :model_list, :class_list, :activity_list,
5
5
  :property_list, :port_list,
data/lib/lutaml/sysml.rb CHANGED
@@ -1,4 +1,3 @@
1
- require "lutaml/sysml/version"
2
1
  require "lutaml/uml"
3
2
  require "nokogiri"
4
3
 
@@ -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
@@ -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
- include HasMembers
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
- attr_accessor :owner_end,
9
- :owner_end_attribute_name,
10
- :owner_end_cardinality,
11
- :owner_end_type,
12
- :owner_end_xmi_id,
13
- :member_end,
14
- :member_end_attribute_name,
15
- :member_end_xmi_id,
16
- :member_end_cardinality,
17
- :member_end_type,
18
- :static,
19
- :action
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
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lutaml
4
+ module Uml
5
+ class Cardinality < Lutaml::Model::Serializable
6
+ attribute :min, :string
7
+ attribute :max, :string
8
+ end
9
+ end
10
+ end
@@ -1,82 +1,57 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "lutaml/uml/classifier"
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/top_element_attribute"
7
+ require "lutaml/uml/data_type"
11
8
 
12
9
  module Lutaml
13
10
  module Uml
14
11
  class Class < Classifier
15
- include HasMembers
16
-
17
- attr_accessor :nested_classifier,
18
- :is_abstract,
19
- :type,
20
- :package
21
-
22
- attr_reader :associations,
23
- :attributes,
24
- :members,
25
- :modifier,
26
- :constraints,
27
- :operations,
28
- :data_types
29
-
30
- def initialize(attributes = {})
31
- @nested_classifier = []
32
- @stereotype = []
33
- @generalization = []
34
- @is_abstract = false
35
- super
36
- end
37
-
38
- def modifier=(value)
39
- @modifier = value.to_s # TODO: Validate?
40
- end
41
-
42
- def attributes=(value)
43
- @attributes = value.to_a.map do |attr|
44
- TopElementAttribute.new(attr)
45
- end
46
- end
47
-
48
- def associations=(value)
49
- @associations = value.to_a.map do |attr|
50
- Association.new(attr.to_h.merge(owner_end: name))
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
- def relationships
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
- attr_accessor :generalization
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
@@ -6,15 +6,12 @@
6
6
  module Lutaml
7
7
  module Uml
8
8
  class Connector < TopElement
9
- attr_accessor :kind, :connector_end
9
+ attribute :kind, :string
10
+ attribute :connector_end, :string, collection: true, default: -> { [] }
10
11
 
11
- def initialize # rubocop:disable Lint/MissingSuper
12
- @name = nil
13
- @xmi_id = nil
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
- attr_accessor :body
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