lutaml-uml 0.4.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +22 -0
- data/Gemfile +1 -5
- data/README.adoc +4 -42
- data/Rakefile +0 -5
- data/lutaml-uml.gemspec +23 -38
- metadata +20 -292
- data/.github/workflows/macos.yml +0 -38
- data/.github/workflows/ubuntu.yml +0 -40
- data/.github/workflows/windows.yml +0 -51
- data/.gitignore +0 -12
- data/.rspec +0 -3
- data/.travis.yml +0 -6
- data/CODE_OF_CONDUCT.md +0 -74
- data/LUTAML.adoc +0 -372
- data/bin/console +0 -15
- data/bin/folder_yaml2lutaml.sh +0 -6
- data/bin/plantuml2lutaml +0 -59
- data/bin/setup +0 -8
- data/bin/yaml2lutaml +0 -144
- data/exe/lutaml-wsd2uml +0 -59
- data/exe/lutaml-yaml2uml +0 -144
- data/lib/lutaml/layout/engine.rb +0 -15
- data/lib/lutaml/layout/graph_viz_engine.rb +0 -19
- data/lib/lutaml/uml/abstraction.rb +0 -11
- data/lib/lutaml/uml/activity.rb +0 -11
- data/lib/lutaml/uml/actor.rb +0 -19
- data/lib/lutaml/uml/association.rb +0 -43
- data/lib/lutaml/uml/behavior.rb +0 -11
- data/lib/lutaml/uml/class.rb +0 -83
- data/lib/lutaml/uml/classifier.rb +0 -11
- data/lib/lutaml/uml/connector.rb +0 -21
- data/lib/lutaml/uml/constraint.rb +0 -12
- data/lib/lutaml/uml/constructor_end.rb +0 -16
- data/lib/lutaml/uml/data_type.rb +0 -75
- data/lib/lutaml/uml/dependency.rb +0 -21
- data/lib/lutaml/uml/diagram.rb +0 -8
- data/lib/lutaml/uml/document.rb +0 -81
- data/lib/lutaml/uml/enum.rb +0 -45
- data/lib/lutaml/uml/event.rb +0 -12
- data/lib/lutaml/uml/final_state.rb +0 -11
- data/lib/lutaml/uml/formatter/base.rb +0 -67
- data/lib/lutaml/uml/formatter/graphviz.rb +0 -334
- data/lib/lutaml/uml/formatter.rb +0 -21
- data/lib/lutaml/uml/has_attributes.rb +0 -14
- data/lib/lutaml/uml/has_members.rb +0 -30
- data/lib/lutaml/uml/instance.rb +0 -17
- data/lib/lutaml/uml/model.rb +0 -13
- data/lib/lutaml/uml/node/base.rb +0 -21
- data/lib/lutaml/uml/node/class_node.rb +0 -57
- data/lib/lutaml/uml/node/class_relationship.rb +0 -14
- data/lib/lutaml/uml/node/document.rb +0 -18
- data/lib/lutaml/uml/node/field.rb +0 -34
- data/lib/lutaml/uml/node/has_name.rb +0 -15
- data/lib/lutaml/uml/node/has_type.rb +0 -15
- data/lib/lutaml/uml/node/method.rb +0 -29
- data/lib/lutaml/uml/node/method_argument.rb +0 -16
- data/lib/lutaml/uml/node/relationship.rb +0 -28
- data/lib/lutaml/uml/opaque_behavior.rb +0 -11
- data/lib/lutaml/uml/operation.rb +0 -31
- data/lib/lutaml/uml/package.rb +0 -53
- data/lib/lutaml/uml/parsers/attribute.rb +0 -70
- data/lib/lutaml/uml/parsers/dsl.rb +0 -413
- data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +0 -59
- data/lib/lutaml/uml/parsers/dsl_transform.rb +0 -27
- data/lib/lutaml/uml/parsers/yaml.rb +0 -46
- data/lib/lutaml/uml/port.rb +0 -8
- data/lib/lutaml/uml/primitive_type.rb +0 -14
- data/lib/lutaml/uml/property.rb +0 -27
- data/lib/lutaml/uml/pseudostate.rb +0 -11
- data/lib/lutaml/uml/realization.rb +0 -11
- data/lib/lutaml/uml/region.rb +0 -12
- 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/state.rb +0 -12
- data/lib/lutaml/uml/state_machine.rb +0 -12
- data/lib/lutaml/uml/top_element.rb +0 -58
- data/lib/lutaml/uml/top_element_attribute.rb +0 -38
- data/lib/lutaml/uml/transition.rb +0 -12
- data/lib/lutaml/uml/trigger.rb +0 -12
- data/lib/lutaml/uml/value.rb +0 -30
- data/lib/lutaml/uml/version.rb +0 -7
- data/lib/lutaml/uml/vertex.rb +0 -11
- data/lib/lutaml/uml.rb +0 -13
- data/spec/fixtures/datamodel/models/AddressClassProfile.yml +0 -90
- data/spec/fixtures/datamodel/models/AddressComponentProfile.yml +0 -63
- data/spec/fixtures/datamodel/models/AddressComponentSpecification.yml +0 -15
- data/spec/fixtures/datamodel/models/AddressProfile.yml +0 -36
- data/spec/fixtures/datamodel/models/AttributeProfile.yml +0 -32
- data/spec/fixtures/datamodel/models/InterchangeAddressClassProfile.yml +0 -79
- data/spec/fixtures/datamodel/models/Localization copy.yml +0 -23
- data/spec/fixtures/datamodel/models/Localization.yml +0 -23
- data/spec/fixtures/datamodel/models/ProfileCompliantAddress.yml +0 -36
- data/spec/fixtures/datamodel/models/ProfileCompliantAddressComponent.yml +0 -15
- data/spec/fixtures/datamodel/models/Signature.yml +0 -20
- data/spec/fixtures/datamodel/models/SignatureBlankDefinition.yml +0 -20
- data/spec/fixtures/datamodel/models/TextDirectionCode copy.yml +0 -16
- data/spec/fixtures/datamodel/models/TextDirectionCode.yml +0 -16
- data/spec/fixtures/datamodel/models/Validity.yml +0 -14
- data/spec/fixtures/datamodel/models/iso19160-1/Address.yml +0 -22
- data/spec/fixtures/datamodel/models/iso19160-1/AddressComponent.yml +0 -2
- data/spec/fixtures/datamodel/style.uml.inc +0 -37
- data/spec/fixtures/datamodel/views/AddressClassProfile.yml +0 -12
- data/spec/fixtures/datamodel/views/AddressProfile.yml +0 -3
- data/spec/fixtures/datamodel/views/CommonModels.yml +0 -9
- data/spec/fixtures/datamodel/views/TopDown.yml +0 -62
- data/spec/fixtures/dsl/broken_diagram.lutaml +0 -34
- data/spec/fixtures/dsl/diagram.lutaml +0 -3
- data/spec/fixtures/dsl/diagram_attributes.lutaml +0 -6
- data/spec/fixtures/dsl/diagram_blank_definion.lutaml +0 -6
- data/spec/fixtures/dsl/diagram_blank_entities.lutaml +0 -8
- data/spec/fixtures/dsl/diagram_class_assocation.lutaml +0 -29
- data/spec/fixtures/dsl/diagram_class_fields.lutaml +0 -25
- data/spec/fixtures/dsl/diagram_commented_includes.lutaml +0 -5
- data/spec/fixtures/dsl/diagram_comments.lutaml +0 -28
- data/spec/fixtures/dsl/diagram_concept_model.lutaml +0 -132
- data/spec/fixtures/dsl/diagram_data_types.lutaml +0 -44
- data/spec/fixtures/dsl/diagram_definitions.lutaml +0 -25
- data/spec/fixtures/dsl/diagram_includes.lutaml +0 -6
- data/spec/fixtures/dsl/diagram_multiply_classes.lutaml +0 -7
- data/spec/fixtures/dsl/diagram_non_existing_include.lutaml +0 -6
- data/spec/fixtures/dsl/shared.lutaml +0 -3
- data/spec/fixtures/dsl/shared1.lutaml +0 -4
- data/spec/fixtures/generated_dot/AddressClassProfile.dot +0 -170
- data/spec/fixtures/generated_dot/AddressProfile.dot +0 -34
- data/spec/lutaml/layout/graph_viz_engine_spec.rb +0 -31
- data/spec/lutaml/uml/formatter/graphviz_spec.rb +0 -41
- data/spec/lutaml/uml/parsers/dsl_spec.rb +0 -345
- data/spec/lutaml/uml/parsers/yaml_spec.rb +0 -18
- data/spec/lutaml/uml/serializers/yaml_view_spec.rb +0 -20
- data/spec/lutaml/uml_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -25
data/exe/lutaml-wsd2uml
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# Script to convert plantuml files into LutaML syntax
|
6
|
-
# Usage: bin/plantuml2lutaml /path/to/plantuml.wsd
|
7
|
-
|
8
|
-
file_path = ARGV[0]
|
9
|
-
FILE_NAME = File.basename(file_path, ".wsd")
|
10
|
-
wsd_file = File.new(ARGV[0])
|
11
|
-
|
12
|
-
def sync_puts(line, level = 0)
|
13
|
-
$stdout.puts("#{''.rjust(level)}#{line}")
|
14
|
-
$stdout.flush
|
15
|
-
end
|
16
|
-
|
17
|
-
SKIPPED_LINES_REGEXP = /^(@startuml|'\*{7}|note|@enduml|\!|'\/)/
|
18
|
-
COMMENT_START = /\/'/
|
19
|
-
COMMENT_END = /'\//
|
20
|
-
ASSOCIATION_MAPPINGS = {
|
21
|
-
/-\|>/ => ",inheritance",
|
22
|
-
/<\|-/ => "inheritance,",
|
23
|
-
/->/ => ",direct",
|
24
|
-
/<-/ => "direct,",
|
25
|
-
}.freeze
|
26
|
-
|
27
|
-
in_comment_block = false
|
28
|
-
|
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 }
|
32
|
-
|
33
|
-
owner_type, member_type = ASSOCIATION_MAPPINGS.detect { |(key, _value)| line =~ key }.last.split(",")
|
34
|
-
blocks = line.split(" ")
|
35
|
-
owner = blocks.first
|
36
|
-
member = blocks.last
|
37
|
-
sync_puts("association {", 2)
|
38
|
-
sync_puts("owner #{owner}", 4)
|
39
|
-
sync_puts("member #{member}", 4)
|
40
|
-
sync_puts("owner_type #{owner_type}", 4) if !owner_type.to_s.empty?
|
41
|
-
sync_puts("member_type #{member_type}", 4) if !member_type.to_s.empty?
|
42
|
-
sync_puts("}", 2)
|
43
|
-
end
|
44
|
-
|
45
|
-
sync_puts("diagram #{FILE_NAME} {")
|
46
|
-
wsd_file.readlines.each do |line|
|
47
|
-
if line.match?(COMMENT_START)
|
48
|
-
in_comment_block = true
|
49
|
-
end
|
50
|
-
|
51
|
-
if line.match?(COMMENT_END)
|
52
|
-
in_comment_block = false
|
53
|
-
end
|
54
|
-
|
55
|
-
next if in_comment_block || line =~ SKIPPED_LINES_REGEXP
|
56
|
-
|
57
|
-
transform_line(line)
|
58
|
-
end
|
59
|
-
sync_puts("}")
|
data/exe/lutaml-yaml2uml
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
#
|
5
|
-
# Script to convert datamodel yaml files into LutaML syntax
|
6
|
-
# Usage: bin/yaml2lutaml /path/to/datamodel/view/file.yml
|
7
|
-
|
8
|
-
require "yaml"
|
9
|
-
|
10
|
-
view_yaml = YAML.safe_load(File.read(ARGV[0]))
|
11
|
-
models_path = File.expand_path("../../models", ARGV[0])
|
12
|
-
|
13
|
-
def sync_puts(line, level = 0)
|
14
|
-
$stdout.puts("#{''.rjust(level)}#{line}")
|
15
|
-
$stdout.flush
|
16
|
-
end
|
17
|
-
|
18
|
-
encountered_relations = Hash.new { |h, key| h[key] = [] }
|
19
|
-
# relations:
|
20
|
-
# - target: AttributeProfile
|
21
|
-
# relationship:
|
22
|
-
# source:
|
23
|
-
# type: aggregation
|
24
|
-
# attribute:
|
25
|
-
# addressClassProfile:
|
26
|
-
# target:
|
27
|
-
# type: direct
|
28
|
-
# attribute:
|
29
|
-
# attributeProfile:
|
30
|
-
# cardinality:
|
31
|
-
# min: 0
|
32
|
-
# max: '*'
|
33
|
-
def process_association(owner, values, encountered_relations)
|
34
|
-
target_name = values["target"]
|
35
|
-
return if encountered_relations[owner].include?(target_name)
|
36
|
-
|
37
|
-
encountered_relations[owner].push(target_name)
|
38
|
-
sync_puts("association {", 2)
|
39
|
-
|
40
|
-
relationship_block = values["relationship"] || {}
|
41
|
-
|
42
|
-
if relationship_block["source"] && relationship_block["source"]["type"]
|
43
|
-
source = relationship_block["source"]
|
44
|
-
sync_puts("owner_type #{source['type']}", 4)
|
45
|
-
if source["attribute"]
|
46
|
-
source_attribute_name = source["attribute"].keys.first
|
47
|
-
owner += "##{source_attribute_name}"
|
48
|
-
if source["attribute"][source_attribute_name] && source["attribute"][source_attribute_name]["cardinality"]
|
49
|
-
cardinality = source["attribute"][source_attribute_name]["cardinality"]
|
50
|
-
owner += " [#{cardinality['min']}..#{cardinality['max']}]"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
sync_puts("owner #{owner}", 4)
|
55
|
-
|
56
|
-
member = target_name
|
57
|
-
if relationship_block["target"]
|
58
|
-
target = relationship_block["target"]
|
59
|
-
type = target["type"] || "direct"
|
60
|
-
sync_puts("member_type #{type}", 4)
|
61
|
-
if target["attribute"]
|
62
|
-
target_attribute_name = target["attribute"].keys.first
|
63
|
-
member += "##{target_attribute_name}"
|
64
|
-
if target["attribute"][target_attribute_name] && target["attribute"][target_attribute_name]["cardinality"]
|
65
|
-
cardinality = target["attribute"][target_attribute_name]["cardinality"]
|
66
|
-
member += " [#{cardinality['min']}..#{cardinality['max']}]"
|
67
|
-
end
|
68
|
-
end
|
69
|
-
else
|
70
|
-
sync_puts("member_type direct", 4)
|
71
|
-
end
|
72
|
-
sync_puts("member #{member}", 4)
|
73
|
-
|
74
|
-
sync_puts("}", 2)
|
75
|
-
end
|
76
|
-
sync_puts("diagram #{File.basename(ARGV[0], 'yml')[0..-2]} {")
|
77
|
-
sync_puts("title '#{view_yaml['title']}'", 2)
|
78
|
-
sync_puts("caption '#{view_yaml['caption']}'", 2)
|
79
|
-
|
80
|
-
# Class associations notations
|
81
|
-
view_yaml["relations"]&.each do |values|
|
82
|
-
process_association(values["source"], values, encountered_relations)
|
83
|
-
end
|
84
|
-
|
85
|
-
view_yaml["imports"].keys.each do |entry|
|
86
|
-
import = YAML.safe_load(File.read(File.join(models_path, "#{entry}.yml")))
|
87
|
-
import_name = import["name"] || File.basename(entry)
|
88
|
-
# Class notation
|
89
|
-
sync_puts("#{import['modelType']} #{import_name} {", 2)
|
90
|
-
if import["definition"]
|
91
|
-
definition = <<~TEXT
|
92
|
-
definition {
|
93
|
-
#{import['definition']}
|
94
|
-
}
|
95
|
-
TEXT
|
96
|
-
sync_puts(definition, 4)
|
97
|
-
end
|
98
|
-
import["values"]&.each_pair do |key, values|
|
99
|
-
result_string = key
|
100
|
-
if values["definition"]
|
101
|
-
result_string += <<~TEXT
|
102
|
-
{
|
103
|
-
definition {
|
104
|
-
#{values['definition']}
|
105
|
-
}
|
106
|
-
}
|
107
|
-
TEXT
|
108
|
-
end
|
109
|
-
sync_puts(result_string, 4)
|
110
|
-
end
|
111
|
-
import["attributes"]&.each_pair do |key, values|
|
112
|
-
definition = values["definition"]
|
113
|
-
cardinality = if values["cardinality"]
|
114
|
-
cardinality_val = values["cardinality"]
|
115
|
-
"[#{cardinality_val['min']}..#{cardinality_val['max']}]"
|
116
|
-
else
|
117
|
-
""
|
118
|
-
end
|
119
|
-
result_string = "+#{key}"
|
120
|
-
if values["type"]
|
121
|
-
result_string += ": #{values['type']}"
|
122
|
-
end
|
123
|
-
if cardinality
|
124
|
-
result_string += " #{cardinality}"
|
125
|
-
end
|
126
|
-
if definition
|
127
|
-
result_string += <<~TEXT
|
128
|
-
{
|
129
|
-
definition
|
130
|
-
#{definition}
|
131
|
-
end definition
|
132
|
-
}
|
133
|
-
TEXT
|
134
|
-
end
|
135
|
-
sync_puts(result_string, 4)
|
136
|
-
end
|
137
|
-
sync_puts("}", 2)
|
138
|
-
|
139
|
-
# Associations notations
|
140
|
-
import["relations"]&.each do |values|
|
141
|
-
process_association(import_name, values, encountered_relations)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
sync_puts("}")
|
data/lib/lutaml/layout/engine.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "ruby-graphviz"
|
4
|
-
require "lutaml/layout/engine"
|
5
|
-
|
6
|
-
module Lutaml
|
7
|
-
module Layout
|
8
|
-
class GraphVizEngine < Engine
|
9
|
-
def render(type)
|
10
|
-
Open3.popen3("dot -T#{type}") do |stdin, stdout, _stderr, _wait|
|
11
|
-
stdin.puts(input)
|
12
|
-
stdin.close
|
13
|
-
# unless (err = stderr.read).empty? then raise err end
|
14
|
-
stdout.read
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
data/lib/lutaml/uml/activity.rb
DELETED
data/lib/lutaml/uml/actor.rb
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
##
|
4
|
-
## Behaviour metamodel
|
5
|
-
##
|
6
|
-
|
7
|
-
module Lutaml
|
8
|
-
module Uml
|
9
|
-
class Actor < Classifier
|
10
|
-
def initialize
|
11
|
-
@name = nil
|
12
|
-
@xmi_id = nil
|
13
|
-
@stereotype = []
|
14
|
-
@generalization = []
|
15
|
-
@namespace = nil
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Lutaml
|
4
|
-
module Uml
|
5
|
-
class Association < TopElement
|
6
|
-
include HasMembers
|
7
|
-
|
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)
|
23
|
-
value.group_by { |member| member.keys.first }
|
24
|
-
.each do |(type, group)|
|
25
|
-
if %w[owner_end member_end].include?(type)
|
26
|
-
group.each do |member|
|
27
|
-
member.each_pair do |key, member_value|
|
28
|
-
public_send("#{associtaion_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("#{associtaion_type(type)}=", attribute_value.first)
|
36
|
-
end
|
37
|
-
|
38
|
-
public_send("#{associtaion_type(type)}=", attribute_value)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/lib/lutaml/uml/behavior.rb
DELETED
data/lib/lutaml/uml/class.rb
DELETED
@@ -1,83 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "lutaml/uml/classifier"
|
4
|
-
|
5
|
-
require "lutaml/uml/has_members"
|
6
|
-
require "lutaml/uml/association"
|
7
|
-
require "lutaml/uml/constraint"
|
8
|
-
require "lutaml/uml/data_type"
|
9
|
-
require "lutaml/uml/operation"
|
10
|
-
require "lutaml/uml/top_element_attribute"
|
11
|
-
|
12
|
-
module Lutaml
|
13
|
-
module Uml
|
14
|
-
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))
|
51
|
-
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
|
-
|
77
|
-
def relationships
|
78
|
-
# @members&.select { |member| member.class == ClassRelationship }
|
79
|
-
[]
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
data/lib/lutaml/uml/connector.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
##
|
4
|
-
## Behaviour metamodel
|
5
|
-
##
|
6
|
-
module Lutaml
|
7
|
-
module Uml
|
8
|
-
class Connector < TopElement
|
9
|
-
attr_accessor :kind, :connector_end
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
@name = nil
|
13
|
-
@xmi_id = nil
|
14
|
-
@xmi_uuid = nil
|
15
|
-
@connector_end = []
|
16
|
-
@namespace = nil
|
17
|
-
@kind = nil
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/lutaml/uml/data_type.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require "lutaml/uml/classifier"
|
3
|
-
|
4
|
-
module Lutaml
|
5
|
-
module Uml
|
6
|
-
class DataType < Classifier
|
7
|
-
include HasMembers
|
8
|
-
|
9
|
-
attr_accessor :nested_classifier,
|
10
|
-
:is_abstract,
|
11
|
-
:type
|
12
|
-
|
13
|
-
attr_reader :associations,
|
14
|
-
:attributes,
|
15
|
-
:members,
|
16
|
-
:modifier,
|
17
|
-
:constraints,
|
18
|
-
:operations,
|
19
|
-
:data_types
|
20
|
-
|
21
|
-
def initialize(attributes = {})
|
22
|
-
@nested_classifier = []
|
23
|
-
@stereotype = []
|
24
|
-
@generalization = []
|
25
|
-
@is_abstract = false
|
26
|
-
super
|
27
|
-
@keyword = "dataType"
|
28
|
-
end
|
29
|
-
|
30
|
-
def modifier=(value)
|
31
|
-
@modifier = value.to_s # TODO: Validate?
|
32
|
-
end
|
33
|
-
|
34
|
-
def attributes=(value)
|
35
|
-
@attributes = value.to_a.map do |attr|
|
36
|
-
TopElementAttribute.new(attr)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
def associations=(value)
|
41
|
-
@associations = value.to_a.map do |attr|
|
42
|
-
Association.new(attr.to_h.merge(owner_end: name))
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def constraints=(value)
|
47
|
-
@constraints = value.to_a.map do |attr|
|
48
|
-
Constraint.new(attr)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def operations=(value)
|
53
|
-
@operations = value.to_a.map do |attr|
|
54
|
-
Operation.new(attr)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def data_types=(value)
|
59
|
-
@data_types = value.to_a.map do |attr|
|
60
|
-
DataType.new(attr)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def methods
|
65
|
-
# @members&.select { |member| member.class == Method }
|
66
|
-
[]
|
67
|
-
end
|
68
|
-
|
69
|
-
def relationships
|
70
|
-
# @members&.select { |member| member.class == ClassRelationship }
|
71
|
-
[]
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
##
|
4
|
-
## Behaviour metamodel
|
5
|
-
##
|
6
|
-
module Lutaml
|
7
|
-
module Uml
|
8
|
-
class Dependency < TopElement
|
9
|
-
attr_accessor :client, :supplier
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
@name = nil
|
13
|
-
@xmi_id = nil
|
14
|
-
@xmi_uuid = nil
|
15
|
-
@client = []
|
16
|
-
@supplier = []
|
17
|
-
@namespace = nil
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/lib/lutaml/uml/diagram.rb
DELETED
data/lib/lutaml/uml/document.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "lutaml/uml/class"
|
4
|
-
require "lutaml/uml/data_type"
|
5
|
-
require "lutaml/uml/enum"
|
6
|
-
require "lutaml/uml/diagram"
|
7
|
-
require "lutaml/uml/package"
|
8
|
-
require "lutaml/uml/primitive_type"
|
9
|
-
|
10
|
-
module Lutaml
|
11
|
-
module Uml
|
12
|
-
class Document
|
13
|
-
include HasAttributes
|
14
|
-
include HasMembers
|
15
|
-
|
16
|
-
attr_accessor :name,
|
17
|
-
:title,
|
18
|
-
:caption,
|
19
|
-
:groups,
|
20
|
-
:fidelity,
|
21
|
-
:fontname,
|
22
|
-
:comments
|
23
|
-
attr_reader :packages
|
24
|
-
|
25
|
-
# rubocop:disable Rails/ActiveRecordAliases
|
26
|
-
def initialize(attributes = {})
|
27
|
-
update_attributes(attributes)
|
28
|
-
end
|
29
|
-
# rubocop:enable Rails/ActiveRecordAliases
|
30
|
-
def classes=(value)
|
31
|
-
@classes = value.to_a.map { |attributes| Class.new(attributes) }
|
32
|
-
end
|
33
|
-
|
34
|
-
def data_types=(value)
|
35
|
-
@data_types = value.to_a.map { |attributes| DataType.new(attributes) }
|
36
|
-
end
|
37
|
-
|
38
|
-
def enums=(value)
|
39
|
-
@enums = value.to_a.map { |attributes| Enum.new(attributes) }
|
40
|
-
end
|
41
|
-
|
42
|
-
def packages=(value)
|
43
|
-
@packages = value.to_a.map { |attributes| Package.new(attributes) }
|
44
|
-
end
|
45
|
-
|
46
|
-
def primitives=(value)
|
47
|
-
@primitives = value.to_a.map { |attributes| PrimitiveType.new(attributes) }
|
48
|
-
end
|
49
|
-
|
50
|
-
def associations=(value)
|
51
|
-
@associations = value.to_a.map do |attributes|
|
52
|
-
Association.new(attributes)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def classes
|
57
|
-
@classes || []
|
58
|
-
end
|
59
|
-
|
60
|
-
def enums
|
61
|
-
@enums || []
|
62
|
-
end
|
63
|
-
|
64
|
-
def data_types
|
65
|
-
@data_types || []
|
66
|
-
end
|
67
|
-
|
68
|
-
def packages
|
69
|
-
@packages || []
|
70
|
-
end
|
71
|
-
|
72
|
-
def primitives
|
73
|
-
@primitives || []
|
74
|
-
end
|
75
|
-
|
76
|
-
def associations
|
77
|
-
@associations || []
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|