lutaml-uml 0.1.0 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +38 -0
- data/.github/workflows/ubuntu.yml +40 -0
- data/.github/workflows/windows.yml +51 -0
- data/.gitignore +1 -0
- data/Gemfile +2 -1
- data/LUTAML.adoc +339 -0
- data/{README.md → README.adoc} +15 -16
- data/Rakefile +3 -1
- data/bin/console +1 -0
- data/bin/folder_yaml2lutaml.sh +6 -0
- data/bin/plantuml2lutaml +58 -0
- data/bin/yaml2lutaml +144 -0
- data/exe/lutaml-uml +4 -3
- data/lib/lutaml/layout/engine.rb +15 -0
- data/lib/lutaml/layout/graph_viz_engine.rb +19 -0
- data/lib/lutaml/uml.rb +4 -0
- data/lib/lutaml/uml/abstraction.rb +7 -5
- data/lib/lutaml/uml/activity.rb +7 -5
- data/lib/lutaml/uml/actor.rb +14 -12
- data/lib/lutaml/uml/association.rb +40 -14
- data/lib/lutaml/uml/behavior.rb +7 -5
- data/lib/lutaml/uml/class.rb +61 -16
- data/lib/lutaml/uml/classifier.rb +9 -6
- data/lib/lutaml/uml/connector.rb +16 -12
- data/lib/lutaml/uml/constraint.rb +8 -7
- data/lib/lutaml/uml/constructor_end.rb +11 -8
- data/lib/lutaml/uml/data_type.rb +12 -4
- data/lib/lutaml/uml/dependency.rb +16 -13
- data/lib/lutaml/uml/document.rb +71 -0
- data/lib/lutaml/uml/enum.rb +40 -0
- data/lib/lutaml/uml/event.rb +7 -5
- data/lib/lutaml/uml/final_state.rb +7 -5
- data/lib/lutaml/uml/formatter.rb +21 -0
- data/lib/lutaml/uml/formatter/base.rb +67 -0
- data/lib/lutaml/uml/formatter/graphviz.rb +334 -0
- data/lib/lutaml/uml/has_attributes.rb +14 -0
- data/lib/lutaml/uml/has_members.rb +30 -0
- data/lib/lutaml/uml/instance.rb +15 -10
- data/lib/lutaml/uml/interface/base.rb +28 -0
- data/lib/lutaml/uml/interface/command_line.rb +265 -0
- data/lib/lutaml/uml/lutaml_path/document_wrapper.rb +15 -0
- data/lib/lutaml/uml/model.rb +11 -8
- data/lib/lutaml/uml/node/base.rb +21 -0
- data/lib/lutaml/uml/node/class_node.rb +57 -0
- data/lib/lutaml/uml/node/class_relationship.rb +14 -0
- data/lib/lutaml/uml/node/document.rb +18 -0
- data/lib/lutaml/uml/node/field.rb +34 -0
- data/lib/lutaml/uml/node/has_name.rb +15 -0
- data/lib/lutaml/uml/node/has_type.rb +15 -0
- data/lib/lutaml/uml/node/method.rb +29 -0
- data/lib/lutaml/uml/node/method_argument.rb +16 -0
- data/lib/lutaml/uml/node/relationship.rb +28 -0
- data/lib/lutaml/uml/opaque_behavior.rb +7 -6
- data/lib/lutaml/uml/package.rb +16 -13
- data/lib/lutaml/uml/parsers/attribute.rb +70 -0
- data/lib/lutaml/uml/parsers/dsl.rb +399 -0
- data/lib/lutaml/uml/parsers/dsl_preprocessor.rb +44 -0
- data/lib/lutaml/uml/parsers/dsl_transform.rb +27 -0
- data/lib/lutaml/uml/parsers/yaml.rb +46 -0
- data/lib/lutaml/uml/port.rb +6 -4
- data/lib/lutaml/uml/primitive_type.rb +11 -3
- data/lib/lutaml/uml/property.rb +25 -15
- data/lib/lutaml/uml/pseudostate.rb +7 -6
- data/lib/lutaml/uml/realization.rb +7 -5
- data/lib/lutaml/uml/region.rb +7 -6
- data/lib/lutaml/uml/serializers/association.rb +58 -0
- data/lib/lutaml/uml/serializers/base.rb +16 -0
- data/lib/lutaml/uml/serializers/class.rb +29 -0
- data/lib/lutaml/uml/serializers/top_element_attribute.rb +14 -0
- data/lib/lutaml/uml/serializers/yaml_view.rb +18 -0
- data/lib/lutaml/uml/state.rb +8 -6
- data/lib/lutaml/uml/state_machine.rb +7 -5
- data/lib/lutaml/uml/top_element.rb +45 -35
- data/lib/lutaml/uml/top_element_attribute.rb +26 -0
- data/lib/lutaml/uml/transition.rb +8 -6
- data/lib/lutaml/uml/trigger.rb +8 -6
- data/lib/lutaml/uml/version.rb +3 -1
- data/lib/lutaml/uml/vertex.rb +7 -5
- data/lutaml-uml.gemspec +11 -3
- data/spec/fixtures/datamodel/models/AddressClassProfile.yml +90 -0
- data/spec/fixtures/datamodel/models/AddressComponentProfile.yml +63 -0
- data/spec/fixtures/datamodel/models/AddressComponentSpecification.yml +15 -0
- data/spec/fixtures/datamodel/models/AddressProfile.yml +36 -0
- data/spec/fixtures/datamodel/models/AttributeProfile.yml +32 -0
- data/spec/fixtures/datamodel/models/InterchangeAddressClassProfile.yml +79 -0
- data/spec/fixtures/datamodel/models/Localization copy.yml +23 -0
- data/spec/fixtures/datamodel/models/Localization.yml +23 -0
- data/spec/fixtures/datamodel/models/ProfileCompliantAddress.yml +36 -0
- data/spec/fixtures/datamodel/models/ProfileCompliantAddressComponent.yml +15 -0
- data/spec/fixtures/datamodel/models/Signature.yml +20 -0
- data/spec/fixtures/datamodel/models/SignatureBlankDefinition.yml +20 -0
- data/spec/fixtures/datamodel/models/TextDirectionCode copy.yml +16 -0
- data/spec/fixtures/datamodel/models/TextDirectionCode.yml +16 -0
- data/spec/fixtures/datamodel/models/Validity.yml +14 -0
- data/spec/fixtures/datamodel/models/iso19160-1/Address.yml +22 -0
- data/spec/fixtures/datamodel/models/iso19160-1/AddressComponent.yml +2 -0
- data/spec/fixtures/datamodel/style.uml.inc +37 -0
- data/spec/fixtures/datamodel/views/AddressClassProfile.yml +12 -0
- data/spec/fixtures/datamodel/views/AddressProfile.yml +3 -0
- data/spec/fixtures/datamodel/views/CommonModels.yml +9 -0
- data/spec/fixtures/datamodel/views/TopDown.yml +62 -0
- data/spec/fixtures/dsl/diagram.lutaml +3 -0
- data/spec/fixtures/dsl/diagram_attributes.lutaml +5 -0
- data/spec/fixtures/dsl/diagram_class_assocation.lutaml +29 -0
- data/spec/fixtures/dsl/diagram_class_fields.lutaml +19 -0
- data/spec/fixtures/dsl/diagram_comments.lutaml +28 -0
- data/spec/fixtures/dsl/diagram_concept_model.lutaml +132 -0
- data/spec/fixtures/dsl/diagram_data_types.lutaml +24 -0
- data/spec/fixtures/dsl/diagram_definitions.lutaml +20 -0
- data/spec/fixtures/dsl/diagram_includes.lutaml +6 -0
- data/spec/fixtures/dsl/diagram_multiply_classes.lutaml +7 -0
- data/spec/fixtures/dsl/shared.lutaml +3 -0
- data/spec/fixtures/dsl/shared1.lutaml +4 -0
- data/spec/fixtures/generated_dot/AddressClassProfile.dot +170 -0
- data/spec/fixtures/generated_dot/AddressProfile.dot +34 -0
- data/spec/lutaml/layout/graph_viz_engine_spec.rb +31 -0
- data/spec/lutaml/uml/formatter/graphviz_spec.rb +41 -0
- data/spec/lutaml/uml/parsers/dsl_spec.rb +276 -0
- data/spec/lutaml/uml/parsers/yaml_spec.rb +18 -0
- data/spec/lutaml/uml/serializers/yaml_view_spec.rb +20 -0
- data/spec/lutaml/uml_spec.rb +2 -4
- data/spec/spec_helper.rb +11 -0
- metadata +182 -17
data/lib/lutaml/uml/behavior.rb
CHANGED
data/lib/lutaml/uml/class.rb
CHANGED
@@ -1,17 +1,62 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "lutaml/uml/has_members"
|
4
|
+
require "lutaml/uml/classifier"
|
5
|
+
require "lutaml/uml/association"
|
6
|
+
require "lutaml/uml/top_element_attribute"
|
7
|
+
|
8
|
+
module Lutaml
|
9
|
+
module Uml
|
10
|
+
class Class < Classifier
|
11
|
+
include HasMembers
|
12
|
+
|
13
|
+
attr_accessor :nested_classifier,
|
14
|
+
:is_abstract,
|
15
|
+
:type
|
16
|
+
|
17
|
+
attr_reader :associations,
|
18
|
+
:attributes,
|
19
|
+
:definition,
|
20
|
+
:members,
|
21
|
+
:modifier
|
22
|
+
|
23
|
+
def initialize(attributes = {})
|
24
|
+
@nested_classifier = []
|
25
|
+
@stereotype = []
|
26
|
+
@generalization = []
|
27
|
+
@is_abstract = false
|
28
|
+
super
|
29
|
+
end
|
16
30
|
|
17
|
-
|
31
|
+
def modifier=(value)
|
32
|
+
@modifier = value.to_s # TODO: Validate?
|
33
|
+
end
|
34
|
+
|
35
|
+
def definition=(value)
|
36
|
+
@definition = value.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def attributes=(value)
|
40
|
+
@attributes = value.to_a.map do |attr|
|
41
|
+
TopElementAttribute.new(attr)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def associations=(value)
|
46
|
+
@associations = value.to_a.map do |attr|
|
47
|
+
Association.new(attr.to_h.merge(owner_end: name))
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def methods
|
52
|
+
# @members&.select { |member| member.class == Method }
|
53
|
+
[]
|
54
|
+
end
|
55
|
+
|
56
|
+
def relationships
|
57
|
+
# @members&.select { |member| member.class == ClassRelationship }
|
58
|
+
[]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -1,8 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class Classifier < TopElement
|
4
|
-
attr_accessor :generalization
|
5
|
-
end
|
1
|
+
# frozen_string_literal: true
|
6
2
|
|
3
|
+
require "lutaml/uml/top_element"
|
7
4
|
|
8
|
-
|
5
|
+
module Lutaml
|
6
|
+
module Uml
|
7
|
+
class Classifier < TopElement
|
8
|
+
attr_accessor :generalization
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/lutaml/uml/connector.rb
CHANGED
@@ -1,17 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
##
|
2
4
|
## Behaviour metamodel
|
3
5
|
##
|
4
|
-
module Lutaml
|
5
|
-
|
6
|
-
class Connector
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@name = nil
|
10
|
-
@xmi_id = nil
|
11
|
-
@xmi_uuid = nil
|
12
|
-
@connector_end = []
|
13
|
-
@namespace = nil
|
14
|
-
@kind = nil
|
15
|
-
end
|
6
|
+
module Lutaml
|
7
|
+
module Uml
|
8
|
+
class Connector < TopElement
|
9
|
+
attr_accessor :kind, :connector_end
|
16
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
|
17
21
|
end
|
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
##
|
2
4
|
## Behaviour metamodel
|
3
5
|
##
|
4
|
-
module Lutaml
|
5
|
-
|
6
|
-
class Constraint < TopElement
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
|
6
|
+
module Lutaml
|
7
|
+
module Uml
|
8
|
+
class Constraint < TopElement
|
9
|
+
attr_accessor :body
|
10
|
+
end
|
11
|
+
end
|
11
12
|
end
|
@@ -1,13 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
##
|
2
4
|
## Behaviour metamodel
|
3
5
|
##
|
4
|
-
module Lutaml
|
6
|
+
module Lutaml
|
7
|
+
module Uml
|
8
|
+
class ConnectorEnd < TopElement
|
9
|
+
attr_accessor :role, :part_with_port, :connector
|
5
10
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
def initialize
|
12
|
+
@role = nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
11
16
|
end
|
12
|
-
|
13
|
-
end
|
data/lib/lutaml/uml/data_type.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
module Lutaml
|
4
|
+
module Uml
|
5
|
+
class DataType < Class
|
6
|
+
attr_reader :keyword
|
5
7
|
|
6
|
-
|
8
|
+
def initialize(attributes = {})
|
9
|
+
super
|
10
|
+
@keyword = "dataType"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,18 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
##
|
2
4
|
## Behaviour metamodel
|
3
5
|
##
|
4
|
-
module Lutaml
|
5
|
-
|
6
|
-
class Dependency < TopElement
|
7
|
-
|
8
|
-
def initialize
|
9
|
-
@name = nil
|
10
|
-
@xmi_id = nil
|
11
|
-
@xmi_uuid = nil
|
12
|
-
@client = []
|
13
|
-
@supplier = []
|
14
|
-
@namespace = nil
|
15
|
-
end
|
16
|
-
end
|
6
|
+
module Lutaml
|
7
|
+
module Uml
|
8
|
+
class Dependency < TopElement
|
9
|
+
attr_accessor :client, :supplier
|
17
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
|
18
21
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "lutaml/uml/class"
|
4
|
+
require "lutaml/uml/enum"
|
5
|
+
require "lutaml/uml/data_type"
|
6
|
+
require "lutaml/uml/primitive_type"
|
7
|
+
|
8
|
+
module Lutaml
|
9
|
+
module Uml
|
10
|
+
class Document
|
11
|
+
include HasAttributes
|
12
|
+
include HasMembers
|
13
|
+
|
14
|
+
attr_accessor :name,
|
15
|
+
:title,
|
16
|
+
:caption,
|
17
|
+
:groups,
|
18
|
+
:fidelity,
|
19
|
+
:fontname,
|
20
|
+
:comments
|
21
|
+
|
22
|
+
# rubocop:disable Rails/ActiveRecordAliases
|
23
|
+
def initialize(attributes = {})
|
24
|
+
update_attributes(attributes)
|
25
|
+
end
|
26
|
+
# rubocop:enable Rails/ActiveRecordAliases
|
27
|
+
|
28
|
+
def classes=(value)
|
29
|
+
@classes = value.to_a.map { |attributes| Class.new(attributes) }
|
30
|
+
end
|
31
|
+
|
32
|
+
def enums=(value)
|
33
|
+
@enums = value.to_a.map { |attributes| Enum.new(attributes) }
|
34
|
+
end
|
35
|
+
|
36
|
+
def data_types=(value)
|
37
|
+
@data_types = value.to_a.map { |attributes| DataType.new(attributes) }
|
38
|
+
end
|
39
|
+
|
40
|
+
def primitives=(value)
|
41
|
+
@primitives = value.to_a.map { |attributes| PrimitiveType.new(attributes) }
|
42
|
+
end
|
43
|
+
|
44
|
+
def associations=(value)
|
45
|
+
@associations = value.to_a.map do |attributes|
|
46
|
+
Association.new(attributes)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def classes
|
51
|
+
@classes || []
|
52
|
+
end
|
53
|
+
|
54
|
+
def enums
|
55
|
+
@enums || []
|
56
|
+
end
|
57
|
+
|
58
|
+
def data_types
|
59
|
+
@data_types || []
|
60
|
+
end
|
61
|
+
|
62
|
+
def primitives
|
63
|
+
@primitives || []
|
64
|
+
end
|
65
|
+
|
66
|
+
def associations
|
67
|
+
@associations || []
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "lutaml/uml/has_members"
|
4
|
+
require "lutaml/uml/classifier"
|
5
|
+
require "lutaml/uml/association"
|
6
|
+
require "lutaml/uml/top_element_attribute"
|
7
|
+
|
8
|
+
module Lutaml
|
9
|
+
module Uml
|
10
|
+
class Enum < Classifier
|
11
|
+
include HasMembers
|
12
|
+
|
13
|
+
attr_reader :attributes,
|
14
|
+
:members,
|
15
|
+
:modifier,
|
16
|
+
:definition,
|
17
|
+
:keyword
|
18
|
+
|
19
|
+
def initialize(attributes = {})
|
20
|
+
super
|
21
|
+
@keyword = "enumeration"
|
22
|
+
end
|
23
|
+
|
24
|
+
def attributes=(value)
|
25
|
+
@attributes = value.to_a.map do |attr|
|
26
|
+
TopElementAttribute.new(attr)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def definition=(value)
|
31
|
+
@definition = value.to_s
|
32
|
+
end
|
33
|
+
|
34
|
+
# TODO: reserved name, change
|
35
|
+
def methods
|
36
|
+
[]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/lutaml/uml/event.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Lutaml
|
4
|
+
module Uml
|
5
|
+
module Formatter
|
6
|
+
class << self
|
7
|
+
def all
|
8
|
+
@all ||= []
|
9
|
+
end
|
10
|
+
|
11
|
+
def find_by_name(name)
|
12
|
+
name = name.to_sym
|
13
|
+
|
14
|
+
all.detect { |formatter_class| formatter_class.name == name }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
require "lutaml/uml/formatter/graphviz"
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "lutaml/uml/formatter"
|
4
|
+
require "lutaml/uml/has_attributes"
|
5
|
+
|
6
|
+
module Lutaml
|
7
|
+
module Uml
|
8
|
+
module Formatter
|
9
|
+
class Base
|
10
|
+
class << self
|
11
|
+
def inherited(subclass)
|
12
|
+
Formatter.all << subclass
|
13
|
+
end
|
14
|
+
|
15
|
+
def format(node, attributes = {})
|
16
|
+
new(attributes).format(node)
|
17
|
+
end
|
18
|
+
|
19
|
+
def name
|
20
|
+
to_s.split("::").last.downcase.to_sym
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
include HasAttributes
|
25
|
+
|
26
|
+
# rubocop:disable Rails/ActiveRecordAliases
|
27
|
+
def initialize(attributes = {})
|
28
|
+
update_attributes(attributes)
|
29
|
+
end
|
30
|
+
# rubocop:enable Rails/ActiveRecordAliases
|
31
|
+
|
32
|
+
def name
|
33
|
+
self.class.name
|
34
|
+
end
|
35
|
+
|
36
|
+
attr_reader :type
|
37
|
+
|
38
|
+
def type=(value)
|
39
|
+
@type = value.to_s.strip.downcase.to_sym
|
40
|
+
end
|
41
|
+
|
42
|
+
def format(node)
|
43
|
+
case node
|
44
|
+
when Node::Field then format_field(node)
|
45
|
+
when Node::Method then format_method(node)
|
46
|
+
when Node::Relationship then format_relationship(node)
|
47
|
+
when Node::ClassRelationship then format_class_relationship(node)
|
48
|
+
when Node::ClassNode then format_class(node)
|
49
|
+
when Lutaml::Uml::Document then format_document(node)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def format_field(_node); raise NotImplementedError; end
|
54
|
+
|
55
|
+
def format_method(_node); raise NotImplementedError; end
|
56
|
+
|
57
|
+
def format_relationship(_node); raise NotImplementedError; end
|
58
|
+
|
59
|
+
def format_class_relationship(_node); raise NotImplementedError; end
|
60
|
+
|
61
|
+
def format_class(_node); raise NotImplementedError; end
|
62
|
+
|
63
|
+
def format_document(_node); raise NotImplementedError; end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|