archimate 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/archimate.gemspec +2 -1
- data/lib/archimate/color.rb +2 -2
- data/lib/archimate/data_model/any_attribute.rb +4 -10
- data/lib/archimate/data_model/any_element.rb +9 -17
- data/lib/archimate/data_model/bounds.rb +6 -6
- data/lib/archimate/data_model/color.rb +6 -6
- data/lib/archimate/data_model/comparison.rb +101 -5
- data/lib/archimate/data_model/concern.rb +5 -13
- data/lib/archimate/data_model/connection.rb +39 -48
- data/lib/archimate/data_model/connector_type.rb +1 -0
- data/lib/archimate/data_model/diagram.rb +27 -42
- data/lib/archimate/data_model/diagram_type.rb +1 -0
- data/lib/archimate/data_model/element.rb +14 -35
- data/lib/archimate/data_model/elements.rb +681 -0
- data/lib/archimate/data_model/font.rb +8 -8
- data/lib/archimate/data_model/lang_string.rb +10 -36
- data/lib/archimate/data_model/layer.rb +4 -5
- data/lib/archimate/data_model/layers.rb +45 -49
- data/lib/archimate/data_model/location.rb +6 -6
- data/lib/archimate/data_model/metadata.rb +2 -6
- data/lib/archimate/data_model/model.rb +50 -62
- data/lib/archimate/data_model/modeling_note.rb +3 -8
- data/lib/archimate/data_model/organization.rb +18 -27
- data/lib/archimate/data_model/property.rb +9 -8
- data/lib/archimate/data_model/property_definition.rb +15 -21
- data/lib/archimate/data_model/referenceable.rb +14 -9
- data/lib/archimate/data_model/referenceable_list.rb +82 -0
- data/lib/archimate/data_model/relationship.rb +41 -152
- data/lib/archimate/data_model/relationship_references.rb +29 -0
- data/lib/archimate/data_model/relationships.rb +214 -0
- data/lib/archimate/data_model/schema_info.rb +6 -12
- data/lib/archimate/data_model/style.rb +14 -25
- data/lib/archimate/data_model/view_node.rb +38 -66
- data/lib/archimate/data_model/viewpoint.rb +23 -38
- data/lib/archimate/data_model/viewpoint_type.rb +347 -387
- data/lib/archimate/data_model.rb +7 -6
- data/lib/archimate/derived_relations.rb +106 -31
- data/lib/archimate/export/cypher.rb +0 -18
- data/lib/archimate/export/jsonl.rb +16 -45
- data/lib/archimate/export/n_quads.rb +1 -24
- data/lib/archimate/file_formats/archi_file_reader.rb +2 -1
- data/lib/archimate/file_formats/model_exchange_file_writer_21.rb +9 -1
- data/lib/archimate/file_formats/sax/archi/archi_handler_factory.rb +2 -2
- data/lib/archimate/file_formats/sax/archi/connection.rb +2 -1
- data/lib/archimate/file_formats/sax/archi/element.rb +7 -5
- data/lib/archimate/file_formats/sax/archi/relationship.rb +1 -1
- data/lib/archimate/file_formats/sax/model_exchange_file/connection.rb +2 -1
- data/lib/archimate/file_formats/sax/model_exchange_file/element.rb +1 -1
- data/lib/archimate/file_formats/sax/model_exchange_file/relationship.rb +1 -1
- data/lib/archimate/file_formats/sax/model_exchange_file/view_node.rb +0 -1
- data/lib/archimate/file_formats/serializer/archi/relationship.rb +1 -1
- data/lib/archimate/lint/duplicate_entities.rb +46 -42
- data/lib/archimate/svg/archimate.css +12 -2
- data/lib/archimate/svg/entity/base_entity.rb +6 -29
- data/lib/archimate/svg/entity/location.rb +1 -0
- data/lib/archimate/svg/entity_factory.rb +3 -3
- data/lib/archimate/svg/point.rb +3 -3
- data/lib/archimate/svg/svg_template.svg.erb +5 -5
- data/lib/archimate/version.rb +2 -1
- metadata +20 -6
- data/TODOs.org +0 -505
- data/lib/archimate/data_model/differentiable.rb +0 -142
- data/lib/archimate/data_model/element_type.rb +0 -89
- data/lib/archimate/data_model/relationship_type.rb +0 -45
@@ -10,58 +10,28 @@ module Archimate
|
|
10
10
|
extend Forwardable
|
11
11
|
|
12
12
|
def_delegators :@default_text, :strip, :tr, :+, :gsub, :sub, :downcase, :empty?, :split, :size, :include?
|
13
|
-
# def_delegators :@lang_hash, :size
|
14
13
|
|
15
14
|
# @!attribute [r] lang_hash
|
16
|
-
#
|
15
|
+
# @return [Hash]
|
17
16
|
model_attr :lang_hash
|
18
17
|
# @!attribute [r] default_lang
|
19
|
-
#
|
18
|
+
# @return [String, NilClass]
|
20
19
|
model_attr :default_lang
|
21
20
|
# @!attribute [r] default_text
|
22
|
-
#
|
21
|
+
# @return [String]
|
23
22
|
model_attr :default_text
|
24
23
|
|
25
|
-
# def self.default_lang
|
26
|
-
# Archimate::Config.instance.default_lang
|
27
|
-
# end
|
28
|
-
|
29
24
|
def self.string(str, lang = nil)
|
30
25
|
return nil if !str || str.strip.empty?
|
31
|
-
str
|
32
|
-
lang = nil if !lang || lang.empty?
|
33
|
-
new(
|
34
|
-
lang_hash: { lang => str },
|
35
|
-
default_lang: lang,
|
36
|
-
default_text: str
|
37
|
-
)
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.create(copy)
|
41
|
-
case copy
|
42
|
-
when String
|
43
|
-
string(copy)
|
44
|
-
when LangString
|
45
|
-
copy
|
46
|
-
when Hash
|
47
|
-
lang_hash = copy.fetch(:lang_hash, {})
|
48
|
-
default_lang = copy.fetch(:default_lang, "")
|
49
|
-
default_text = copy.fetch(:default_text, "")
|
50
|
-
return nil if [lang_hash, default_lang, default_text].any? { |i| i && i.empty? }
|
51
|
-
new(
|
52
|
-
lang_hash: lang_hash,
|
53
|
-
default_lang: default_lang,
|
54
|
-
default_text: default_text
|
55
|
-
)
|
56
|
-
end
|
26
|
+
new(str, lang)
|
57
27
|
end
|
58
28
|
|
59
29
|
# @param [Hash{Symbol => Object},LangString, String] attributes
|
60
30
|
# @raise [Struct::Error] if the given attributes don't conform {#schema}
|
61
31
|
# with given {# # constructor_type}
|
62
|
-
def initialize(str = nil, lang_hash: {}, default_lang: nil, default_text: nil)
|
32
|
+
def initialize(str = nil, lang = nil, lang_hash: {}, default_lang: nil, default_text: nil)
|
63
33
|
@lang_hash = lang_hash
|
64
|
-
@default_lang = default_lang
|
34
|
+
@default_lang = default_lang || lang
|
65
35
|
@default_text = default_text
|
66
36
|
case str
|
67
37
|
when String
|
@@ -89,6 +59,10 @@ module Archimate
|
|
89
59
|
end
|
90
60
|
end
|
91
61
|
|
62
|
+
def brief_inspect
|
63
|
+
"#{to_s.slice(0, 40).inspect}#{'...' if to_s.size > 40}"
|
64
|
+
end
|
65
|
+
|
92
66
|
def by_lang(lang)
|
93
67
|
lang_hash.fetch(lang, nil)
|
94
68
|
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "ruby-enum"
|
3
4
|
|
4
5
|
module Archimate
|
5
6
|
module DataModel
|
6
7
|
class Layer
|
7
|
-
attr_reader :elements
|
8
8
|
attr_reader :name
|
9
|
+
attr_reader :background_class
|
9
10
|
|
10
11
|
# No user serviceable parts here. don't use me.
|
11
|
-
def initialize(layer = "None",
|
12
|
+
def initialize(layer = "None", background_class = "")
|
12
13
|
@symbol = Layer.symbolize(layer)
|
13
14
|
@name = layer
|
14
|
-
@
|
15
|
+
@background_class = background_class
|
15
16
|
end
|
16
17
|
|
17
18
|
def hash
|
@@ -44,8 +45,6 @@ module Archimate
|
|
44
45
|
@name
|
45
46
|
end
|
46
47
|
|
47
|
-
private
|
48
|
-
|
49
48
|
def self.symbolize(str)
|
50
49
|
return str if str.is_a?(Symbol)
|
51
50
|
str.downcase.tr(" ", "_").to_sym
|
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require "ruby-enum"
|
3
4
|
|
4
5
|
module Archimate
|
@@ -6,57 +7,52 @@ module Archimate
|
|
6
7
|
class Layers
|
7
8
|
include Ruby::Enum
|
8
9
|
|
9
|
-
define :Strategy, Layer.new(
|
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
|
-
define :
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
define :Connectors, Layer.new(
|
10
|
+
define :Strategy, Layer.new(
|
11
|
+
"Strategy",
|
12
|
+
"archimate-strategy-background"
|
13
|
+
)
|
14
|
+
|
15
|
+
define :Business, Layer.new(
|
16
|
+
"Business",
|
17
|
+
"archimate-business-background"
|
18
|
+
)
|
19
|
+
|
20
|
+
define :Application, Layer.new(
|
21
|
+
"Application",
|
22
|
+
"archimate-application-background"
|
23
|
+
)
|
24
|
+
|
25
|
+
define :Technology, Layer.new(
|
26
|
+
"Technology",
|
27
|
+
"archimate-infrastructure-background"
|
28
|
+
)
|
29
|
+
|
30
|
+
define :Physical, Layer.new(
|
31
|
+
"Physical",
|
32
|
+
"archimate-physical-background"
|
33
|
+
)
|
34
|
+
|
35
|
+
define :Motivation, Layer.new(
|
36
|
+
"Motivation",
|
37
|
+
"archimate-motivation-background"
|
38
|
+
)
|
39
|
+
|
40
|
+
define :Implementation_and_migration, Layer.new(
|
41
|
+
"Implementation and Migration",
|
42
|
+
"archimate-implementation-background"
|
43
|
+
)
|
44
|
+
|
45
|
+
define :Connectors, Layer.new(
|
46
|
+
"Connectors",
|
47
|
+
"archimate-connectors-background"
|
48
|
+
)
|
49
|
+
|
50
|
+
define :Other, Layer.new(
|
51
|
+
"Other",
|
52
|
+
"archimate-other-background"
|
53
|
+
)
|
45
54
|
|
46
55
|
define :None, Layer.new("None")
|
47
|
-
|
48
|
-
# def [](name_or_sym)
|
49
|
-
# case name_or_sym
|
50
|
-
# when Integer
|
51
|
-
# @layers[name_or_sym]
|
52
|
-
# else
|
53
|
-
# @layers.find { |layer| layer === name_or_sym }
|
54
|
-
# end
|
55
|
-
# end
|
56
|
-
|
57
|
-
def self.for_element(type)
|
58
|
-
values.find { |layer| layer.elements.include?(type) } || Layers::None
|
59
|
-
end
|
60
56
|
end
|
61
57
|
end
|
62
58
|
end
|
@@ -15,22 +15,22 @@ module Archimate
|
|
15
15
|
# corner of the diagram to the Top, Left corner of the bounding box of the concept.
|
16
16
|
# @note the XSD has this as a NonNegativeInteger
|
17
17
|
# @!attribute [r] x
|
18
|
-
#
|
18
|
+
# @return [Float]
|
19
19
|
model_attr :x
|
20
20
|
# The y (towards the bottom, associated with height) attribute from the Top,Left (i.e. 0,0)
|
21
21
|
# corner of the diagram to the Top, Left corner of the bounding box of the concept.
|
22
22
|
# @note the XSD has this as a NonNegativeInteger
|
23
23
|
# @!attribute [r] y
|
24
|
-
#
|
24
|
+
# @return [Float]
|
25
25
|
model_attr :y
|
26
26
|
|
27
27
|
# These are holdovers from the archi file format and are only maintained for compatability
|
28
28
|
# @!attribute [r] end_x
|
29
|
-
#
|
30
|
-
model_attr :end_x
|
29
|
+
# @return [Int, NilClass]
|
30
|
+
model_attr :end_x, default: nil
|
31
31
|
# @!attribute [r] end_y
|
32
|
-
#
|
33
|
-
model_attr :end_y
|
32
|
+
# @return [Int, NilClass]
|
33
|
+
model_attr :end_y, default: nil
|
34
34
|
|
35
35
|
def initialize(x:, y:, end_x: nil, end_y: nil)
|
36
36
|
@x = x.to_i
|
@@ -10,12 +10,8 @@ module Archimate
|
|
10
10
|
include Comparison
|
11
11
|
|
12
12
|
# @!attribute [r] schema_infos
|
13
|
-
#
|
14
|
-
model_attr :schema_infos
|
15
|
-
|
16
|
-
def initialize(schema_infos: [])
|
17
|
-
@schema_infos = schema_infos
|
18
|
-
end
|
13
|
+
# @return [Array<SchemaInfo>]
|
14
|
+
model_attr :schema_infos, default: []
|
19
15
|
end
|
20
16
|
end
|
21
17
|
end
|
@@ -10,91 +10,70 @@ module Archimate
|
|
10
10
|
include Comparison
|
11
11
|
|
12
12
|
# @!attribute [r] id
|
13
|
-
#
|
13
|
+
# @return [String] unique identifier of this model
|
14
14
|
model_attr :id
|
15
15
|
# @!attribute [r] name
|
16
|
-
#
|
16
|
+
# @return [LangString] name of the model
|
17
17
|
model_attr :name
|
18
18
|
|
19
19
|
# @!attribute [r] documentation
|
20
|
-
#
|
21
|
-
model_attr :documentation
|
20
|
+
# @return [PreservedLangString, NilClass] model documentation
|
21
|
+
model_attr :documentation, default: nil
|
22
22
|
# @!attribute [r] properties
|
23
|
-
#
|
24
|
-
model_attr :properties
|
23
|
+
# @return [Array<Property>] model properties
|
24
|
+
model_attr :properties, default: []
|
25
25
|
# @!attribute [r] metadata
|
26
|
-
#
|
27
|
-
model_attr :metadata
|
26
|
+
# @return [Metadata, NilClass] model metadata
|
27
|
+
model_attr :metadata, default: nil
|
28
28
|
# @!attribute [r] elements
|
29
|
-
#
|
30
|
-
model_attr :elements
|
29
|
+
# @return [Array<Element>]
|
30
|
+
model_attr :elements, default: [], referenceable_list: true
|
31
31
|
# @!attribute [r] relationships
|
32
|
-
#
|
33
|
-
model_attr :relationships
|
32
|
+
# @return [Array<Relationship>]
|
33
|
+
model_attr :relationships, default: [], referenceable_list: true
|
34
34
|
# @!attribute [r] organizations
|
35
|
-
#
|
36
|
-
model_attr :organizations
|
35
|
+
# @return [Array<Organization>]
|
36
|
+
model_attr :organizations, default: [], referenceable_list: true
|
37
37
|
# @!attribute [r] property_definitions
|
38
|
-
#
|
39
|
-
model_attr :property_definitions
|
38
|
+
# @return [Array<PropertyDefinition>]
|
39
|
+
model_attr :property_definitions, default: [], referenceable_list: true
|
40
40
|
# @!attribute [r] version
|
41
|
-
#
|
42
|
-
model_attr :version
|
41
|
+
# @return [String, NilClass]
|
42
|
+
model_attr :version, default: nil
|
43
43
|
# @!attribute [r] diagrams
|
44
|
-
#
|
45
|
-
model_attr :diagrams
|
44
|
+
# @return [Array<Diagram>]
|
45
|
+
model_attr :diagrams, default: [], referenceable_list: true
|
46
46
|
# @!attribute [r] viewpoints
|
47
|
-
#
|
48
|
-
model_attr :viewpoints
|
47
|
+
# @return [Array<Viewpoint>]
|
48
|
+
model_attr :viewpoints, default: [], referenceable_list: true
|
49
49
|
|
50
50
|
# Following attributes are to hold info on where the model came from
|
51
51
|
# @!attribute [r] filename
|
52
|
-
#
|
53
|
-
model_attr :filename
|
52
|
+
# @return [String]
|
53
|
+
model_attr :filename, default: nil
|
54
54
|
# @see Archimate::SUPPORTED_FORMATS
|
55
55
|
# @!attribute [r] file_format
|
56
|
-
#
|
57
|
-
model_attr :file_format
|
56
|
+
# @return [Symbol, NilClass] supported Archimate format [Archimate::SUPPORTED_FORMATS] or +nil+
|
57
|
+
model_attr :file_format, default: nil
|
58
58
|
# @!attribute [r] archimate_version
|
59
|
-
#
|
60
|
-
model_attr :archimate_version
|
59
|
+
# @return [Symbol] one of [Archimate::ARCHIMATE_VERSIONS], default +:archimate_3_0+
|
60
|
+
model_attr :archimate_version, default: :archimate_3_0
|
61
61
|
|
62
62
|
# @!attribute [r] namespaces
|
63
|
-
#
|
64
|
-
model_attr :namespaces
|
63
|
+
# @return [Hash]
|
64
|
+
model_attr :namespaces, default: {}
|
65
65
|
# @!attribute [r] schema_locations
|
66
|
-
#
|
67
|
-
model_attr :schema_locations
|
66
|
+
# @return [Array<String>]
|
67
|
+
model_attr :schema_locations, default: []
|
68
68
|
|
69
|
-
#
|
70
|
-
|
71
|
-
#
|
72
|
-
|
69
|
+
# @return [Array<AnyElement>]
|
70
|
+
model_attr :other_elements, default: []
|
71
|
+
# @return [Array<AnyAttribute>]
|
72
|
+
model_attr :other_attributes, default: []
|
73
73
|
|
74
74
|
# Constructor
|
75
|
-
def initialize(
|
76
|
-
|
77
|
-
organizations: [], property_definitions: [],
|
78
|
-
version: nil, diagrams: [], viewpoints: [],
|
79
|
-
filename: nil, file_format: nil, archimate_version: :archimate_3_0,
|
80
|
-
namespaces: {}, schema_locations: [])
|
81
|
-
@id = id
|
82
|
-
@name = name
|
83
|
-
@documentation = documentation
|
84
|
-
@properties = properties
|
85
|
-
@metadata = metadata
|
86
|
-
@elements = elements
|
87
|
-
@relationships = relationships
|
88
|
-
@organizations = organizations
|
89
|
-
@property_definitions = property_definitions
|
90
|
-
@version = version
|
91
|
-
@diagrams = diagrams
|
92
|
-
@viewpoints = viewpoints
|
93
|
-
@filename = filename
|
94
|
-
@file_format = file_format
|
95
|
-
@archimate_version = archimate_version
|
96
|
-
@namespaces = namespaces
|
97
|
-
@schema_locations = schema_locations
|
75
|
+
def initialize(opts = {})
|
76
|
+
super
|
98
77
|
rebuild_index
|
99
78
|
end
|
100
79
|
|
@@ -131,7 +110,7 @@ module Archimate
|
|
131
110
|
.concat(diagrams).each do |item|
|
132
111
|
if find_in_organizations(item).nil?
|
133
112
|
default_organization = default_organization_for(item)
|
134
|
-
default_organization.items.push(item
|
113
|
+
default_organization.items.push(item) unless default_organization.items.include?(item)
|
135
114
|
end
|
136
115
|
end
|
137
116
|
self
|
@@ -181,7 +160,14 @@ module Archimate
|
|
181
160
|
# Only used by [#find_default_organization]
|
182
161
|
def add_organization(type, name)
|
183
162
|
raise "Program Error: #{organizations.inspect}" unless organizations.none? { |f| f.type == type || f.name == name }
|
184
|
-
organization = Organization.new(
|
163
|
+
organization = Organization.new(
|
164
|
+
id: make_unique_id,
|
165
|
+
name: LangString.new(name),
|
166
|
+
type: type,
|
167
|
+
items: [],
|
168
|
+
organizations: [],
|
169
|
+
documentation: nil
|
170
|
+
)
|
185
171
|
register(organization, organizations)
|
186
172
|
organizations.push(organization)
|
187
173
|
organization
|
@@ -217,6 +203,8 @@ module Archimate
|
|
217
203
|
find_default_organization("implementation_migration", "Implementation & Migration")
|
218
204
|
when Layers::Connectors
|
219
205
|
find_default_organization("connectors", "Connectors")
|
206
|
+
when Layers::Other
|
207
|
+
find_default_organization("other", "Other")
|
220
208
|
else
|
221
209
|
raise StandardError, "Unexpected Element Layer: #{item.layer} for item type #{item.type}"
|
222
210
|
end
|
@@ -242,7 +230,7 @@ module Archimate
|
|
242
230
|
end
|
243
231
|
|
244
232
|
def find_in_organizations(item, _fs = nil)
|
245
|
-
find_by_class(DataModel::Organization).select { |f| f.items.include?(item
|
233
|
+
find_by_class(DataModel::Organization).select { |f| f.items.include?(item) }.first
|
246
234
|
end
|
247
235
|
|
248
236
|
# Only used by [#unreferenced_nodes]
|
@@ -8,17 +8,12 @@ module Archimate
|
|
8
8
|
include Comparison
|
9
9
|
|
10
10
|
# @!attribute [r] documentation
|
11
|
-
#
|
11
|
+
# @return [PreservedLangString]
|
12
12
|
model_attr :documentation
|
13
13
|
# `type` attribute expresses a type for the notes, e.g. OCL for OCL rules.
|
14
14
|
# @!attribute [r] type
|
15
|
-
#
|
16
|
-
model_attr :type
|
17
|
-
|
18
|
-
def initialize(documentation:, type: nil)
|
19
|
-
@documentation = documentation
|
20
|
-
@type = type
|
21
|
-
end
|
15
|
+
# @return [String, NilClass]
|
16
|
+
model_attr :type, default: nil
|
22
17
|
end
|
23
18
|
end
|
24
19
|
end
|
@@ -14,44 +14,35 @@ module Archimate
|
|
14
14
|
# @note that Organization must fit into a tree structure (so strictly nested).
|
15
15
|
class Organization
|
16
16
|
include Comparison
|
17
|
+
include Referenceable
|
17
18
|
|
18
19
|
# Format should match +/[[[:alpha:]]_][w-.]*/+ to be valid for Archimate
|
19
20
|
# Model exchange format
|
20
21
|
# @!attribute [r] id
|
21
|
-
#
|
22
|
-
model_attr :id
|
22
|
+
# @return [String, NilClass]
|
23
|
+
model_attr :id, default: nil
|
23
24
|
# LabelGroup in the XSD
|
24
25
|
# @!attribute [r] name
|
25
|
-
#
|
26
|
-
model_attr :name
|
26
|
+
# @return [LangString, NilClass]
|
27
|
+
model_attr :name, default: nil
|
27
28
|
# I believe this is used only for Archi formats
|
28
29
|
# @!attribute [r] type
|
29
|
-
#
|
30
|
-
model_attr :type
|
30
|
+
# @return [String, NilClass]
|
31
|
+
model_attr :type, default: nil
|
31
32
|
# @!attribute [r] documentation
|
32
|
-
#
|
33
|
-
model_attr :documentation
|
33
|
+
# @return [PreservedLangString, NilClass]
|
34
|
+
model_attr :documentation, default: nil
|
34
35
|
# @!attribute [rw] items
|
35
|
-
#
|
36
|
-
model_attr :items, writable: true
|
36
|
+
# @return [Array<Object>]
|
37
|
+
model_attr :items, writable: true, default: [], referenceable_list: true
|
37
38
|
# item in the XSD
|
38
39
|
# @!attribute [rw] organizations
|
39
|
-
#
|
40
|
-
model_attr :organizations, writable: true
|
41
|
-
#
|
42
|
-
|
43
|
-
#
|
44
|
-
|
45
|
-
|
46
|
-
def initialize(id: nil, name: nil, type: nil, documentation: nil,
|
47
|
-
items: [], organizations: [])
|
48
|
-
@id = id
|
49
|
-
@name = name
|
50
|
-
@type = type
|
51
|
-
@documentation = documentation
|
52
|
-
@items = items
|
53
|
-
@organizations = organizations
|
54
|
-
end
|
40
|
+
# @return [Array<Organization>]
|
41
|
+
model_attr :organizations, writable: true, default: [], referenceable_list: true
|
42
|
+
# @return [Array<AnyElement>]
|
43
|
+
model_attr :other_elements, default: []
|
44
|
+
# @return [Array<AnyAttribute>]
|
45
|
+
model_attr :other_attributes, default: []
|
55
46
|
|
56
47
|
def to_s
|
57
48
|
"#{Archimate::Color.data_model('Organization')}<#{id}>[#{Archimate::Color.color(name, %i[white underline])}]"
|
@@ -59,7 +50,7 @@ module Archimate
|
|
59
50
|
|
60
51
|
def referenced_identified_nodes
|
61
52
|
organizations.reduce(items) do |a, e|
|
62
|
-
a.
|
53
|
+
a.to_ary + e.referenced_identified_nodes
|
63
54
|
end
|
64
55
|
end
|
65
56
|
|
@@ -8,17 +8,12 @@ module Archimate
|
|
8
8
|
include Comparison
|
9
9
|
|
10
10
|
# @!attribute [r] value
|
11
|
-
#
|
12
|
-
model_attr :value
|
11
|
+
# @return [LangString, NilClass] value of the property, default +nil+
|
12
|
+
model_attr :value, default: nil
|
13
13
|
# @!attribute [rw] property_definition
|
14
|
-
#
|
14
|
+
# @return [PropertyDefinition] property definition of the property
|
15
15
|
model_attr :property_definition, writable: true
|
16
16
|
|
17
|
-
def initialize(property_definition:, value: nil)
|
18
|
-
@property_definition = property_definition
|
19
|
-
@value = value
|
20
|
-
end
|
21
|
-
|
22
17
|
def to_s
|
23
18
|
"Property(key: #{property_definition.name}, value: #{value || 'no value'})"
|
24
19
|
end
|
@@ -26,6 +21,12 @@ module Archimate
|
|
26
21
|
def key
|
27
22
|
property_definition.name
|
28
23
|
end
|
24
|
+
|
25
|
+
def brief_inspect
|
26
|
+
cls_name = self.class.name.split('::').last
|
27
|
+
val = "#{value.to_s.slice(0, 40).inspect}#{'...' if value.to_s.size > 40}"
|
28
|
+
"#<#{cls_name} #{key} = #{val}>"
|
29
|
+
end
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
@@ -9,38 +9,32 @@ module Archimate
|
|
9
9
|
# A Property definition type containing its unique identifier, name, and data type.
|
10
10
|
class PropertyDefinition
|
11
11
|
include Comparison
|
12
|
+
include Referenceable
|
12
13
|
|
13
14
|
# @!attribute [r] id
|
14
|
-
#
|
15
|
+
# @return [String]
|
15
16
|
model_attr :id
|
16
17
|
# @!attribute [r] name
|
17
|
-
#
|
18
|
+
# @return [LangString]
|
18
19
|
model_attr :name
|
19
20
|
# @!attribute [r] documentation
|
20
|
-
#
|
21
|
-
model_attr :documentation
|
22
|
-
#
|
23
|
-
#
|
24
|
-
model_attr :other_elements
|
25
|
-
#
|
26
|
-
#
|
27
|
-
model_attr :other_attributes
|
21
|
+
# @return [PreservedLangString, NilClass]
|
22
|
+
model_attr :documentation, default: nil
|
23
|
+
# @!attribute [r] other_elements
|
24
|
+
# @return [Array<AnyElement>]
|
25
|
+
model_attr :other_elements, default: []
|
26
|
+
# @!attribute [r] other_attributes
|
27
|
+
# @return [Array<AnyAttribute>]
|
28
|
+
model_attr :other_attributes, default: []
|
28
29
|
# @!attribute [r] type
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
model_attr :type
|
30
|
+
# @note if +type+ is nil, then type "string" is assumed
|
31
|
+
# @see Archimate::DataModel::PROPERTY_DEFINITION_TYPES
|
32
|
+
# @return [String, NilClass]
|
33
|
+
model_attr :type, default: nil
|
33
34
|
|
34
35
|
def self.identifier_for_key(key)
|
35
36
|
(self.class.hash ^ key.hash).to_s(16)
|
36
37
|
end
|
37
|
-
|
38
|
-
def initialize(id:, name:, documentation: nil, type: nil)
|
39
|
-
@id = id
|
40
|
-
@name = name
|
41
|
-
@documentation = documentation
|
42
|
-
@type = type
|
43
|
-
end
|
44
38
|
end
|
45
39
|
end
|
46
40
|
end
|
@@ -2,18 +2,23 @@
|
|
2
2
|
|
3
3
|
module Archimate
|
4
4
|
module DataModel
|
5
|
-
# Something that can be referenced
|
6
|
-
|
7
|
-
|
5
|
+
# Something that can be referenced by another entity.
|
6
|
+
module Referenceable
|
7
|
+
def add_reference(referencer)
|
8
|
+
references << referencer unless references.include?(referencer)
|
9
|
+
end
|
10
|
+
|
11
|
+
def remove_reference(referencer)
|
12
|
+
references.delete(referencer)
|
13
|
+
end
|
8
14
|
|
9
|
-
def
|
10
|
-
|
15
|
+
def references
|
16
|
+
@referenceable_set ||= []
|
11
17
|
end
|
12
18
|
|
13
|
-
#
|
14
|
-
def
|
15
|
-
|
16
|
-
properties.concat(node.properties)
|
19
|
+
# Diagrams that this entity is referenced in.
|
20
|
+
def diagrams
|
21
|
+
references.select { |ref| ref.is_a?(Diagram) }
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|