archimate 1.2.1 → 2.0.0
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.md +47 -0
- data/TODOs.org +219 -0
- data/archimate.gemspec +2 -1
- data/exe/archidiff +7 -0
- data/exe/archidiff-summary +7 -0
- data/exe/archimerge +7 -0
- data/exe/fmtxml +7 -0
- data/lib/archimate.rb +10 -21
- data/lib/archimate/cli/archi.rb +2 -1
- data/lib/archimate/cli/cleanup.rb +8 -9
- data/lib/archimate/cli/convert.rb +3 -1
- data/lib/archimate/cli/mapper.rb +1 -1
- data/lib/archimate/cli/stats.rb +1 -1
- data/lib/archimate/config.rb +4 -1
- data/lib/archimate/data_model.rb +11 -24
- data/lib/archimate/data_model/any_attribute.rb +18 -5
- data/lib/archimate/data_model/any_element.rb +30 -7
- data/lib/archimate/data_model/bounds.rb +34 -7
- data/lib/archimate/data_model/color.rb +32 -7
- data/lib/archimate/data_model/comparison.rb +87 -0
- data/lib/archimate/data_model/concern.rb +20 -7
- data/lib/archimate/data_model/connection.rb +71 -51
- data/lib/archimate/data_model/connector_type.rb +23 -0
- data/lib/archimate/data_model/diagram.rb +72 -10
- data/lib/archimate/data_model/diagram_type.rb +17 -0
- data/lib/archimate/data_model/differentiable.rb +142 -0
- data/lib/archimate/data_model/element.rb +39 -45
- data/lib/archimate/data_model/element_type.rb +89 -0
- data/lib/archimate/data_model/font.rb +30 -12
- data/lib/archimate/data_model/lang_string.rb +89 -16
- data/lib/archimate/data_model/layer.rb +55 -0
- data/lib/archimate/data_model/layers.rb +62 -0
- data/lib/archimate/data_model/location.rb +27 -11
- data/lib/archimate/data_model/metadata.rb +10 -3
- data/lib/archimate/data_model/model.rb +188 -121
- data/lib/archimate/data_model/modeling_note.rb +14 -3
- data/lib/archimate/data_model/organization.rb +44 -13
- data/lib/archimate/data_model/{documentation.rb → preserved_lang_string.rb} +1 -5
- data/lib/archimate/data_model/property.rb +17 -11
- data/lib/archimate/data_model/property_definition.rb +34 -4
- data/lib/archimate/data_model/referenceable.rb +0 -9
- data/lib/archimate/data_model/referenceable_collection.rb +201 -0
- data/lib/archimate/data_model/relationship.rb +52 -33
- data/lib/archimate/data_model/relationship_type.rb +43 -0
- data/lib/archimate/data_model/schema_info.rb +17 -6
- data/lib/archimate/data_model/style.rb +41 -11
- data/lib/archimate/data_model/view_node.rb +153 -59
- data/lib/archimate/data_model/viewpoint.rb +56 -80
- data/lib/archimate/data_model/viewpoint_type.rb +429 -0
- data/lib/archimate/export/csv_export.rb +2 -2
- data/lib/archimate/export/cypher.rb +2 -2
- data/lib/archimate/export/graph_ml.rb +7 -5
- data/lib/archimate/export/jsonl.rb +166 -0
- data/lib/archimate/export/n_quads.rb +8 -5
- data/lib/archimate/file_format.rb +4 -5
- data/lib/archimate/file_formats/archi_file_reader.rb +7 -240
- data/lib/archimate/file_formats/archi_file_writer.rb +16 -188
- data/lib/archimate/file_formats/model_exchange_file_reader.rb +7 -225
- data/lib/archimate/file_formats/model_exchange_file_writer_21.rb +22 -114
- data/lib/archimate/file_formats/model_exchange_file_writer_30.rb +22 -122
- data/lib/archimate/file_formats/sax.rb +55 -0
- data/lib/archimate/file_formats/sax/any_element.rb +64 -0
- data/lib/archimate/file_formats/sax/archi/archi_handler_factory.rb +48 -0
- data/lib/archimate/file_formats/sax/archi/bounds.rb +25 -0
- data/lib/archimate/file_formats/sax/archi/connection.rb +47 -0
- data/lib/archimate/file_formats/sax/archi/content.rb +28 -0
- data/lib/archimate/file_formats/sax/archi/diagram.rb +66 -0
- data/lib/archimate/file_formats/sax/archi/element.rb +36 -0
- data/lib/archimate/file_formats/sax/archi/location.rb +25 -0
- data/lib/archimate/file_formats/sax/archi/model.rb +109 -0
- data/lib/archimate/file_formats/sax/archi/organization.rb +60 -0
- data/lib/archimate/file_formats/sax/archi/property.rb +54 -0
- data/lib/archimate/file_formats/sax/archi/relationship.rb +50 -0
- data/lib/archimate/file_formats/sax/archi/style.rb +35 -0
- data/lib/archimate/file_formats/sax/archi/view_node.rb +76 -0
- data/lib/archimate/file_formats/sax/capture_content.rb +20 -0
- data/lib/archimate/file_formats/sax/capture_documentation.rb +19 -0
- data/lib/archimate/file_formats/sax/capture_properties.rb +20 -0
- data/lib/archimate/file_formats/sax/content_element.rb +19 -0
- data/lib/archimate/file_formats/sax/document.rb +80 -0
- data/lib/archimate/file_formats/sax/handler.rb +54 -0
- data/lib/archimate/file_formats/sax/lang_string.rb +28 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/color.rb +36 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/connection.rb +67 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/diagram.rb +60 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/element.rb +43 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/font.rb +44 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/item.rb +64 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/location.rb +23 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/metadata.rb +66 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/model.rb +124 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/model_exchange_handler_factory.rb +53 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/property.rb +32 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/property_definition.rb +36 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/relationship.rb +49 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/schema_info.rb +47 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/style.rb +66 -0
- data/lib/archimate/file_formats/sax/model_exchange_file/view_node.rb +86 -0
- data/lib/archimate/file_formats/sax/no_op.rb +17 -0
- data/lib/archimate/file_formats/sax/preserved_lang_string.rb +28 -0
- data/lib/archimate/file_formats/serializer.rb +57 -0
- data/lib/archimate/file_formats/serializer/archi/bounds.rb +23 -0
- data/lib/archimate/file_formats/serializer/archi/connection.rb +33 -0
- data/lib/archimate/file_formats/serializer/archi/diagram.rb +28 -0
- data/lib/archimate/file_formats/serializer/archi/documentation.rb +16 -0
- data/lib/archimate/file_formats/serializer/archi/element.rb +24 -0
- data/lib/archimate/file_formats/serializer/archi/location.rb +26 -0
- data/lib/archimate/file_formats/serializer/archi/model.rb +25 -0
- data/lib/archimate/file_formats/serializer/archi/organization.rb +21 -0
- data/lib/archimate/file_formats/serializer/archi/property.rb +15 -0
- data/lib/archimate/file_formats/serializer/archi/relationship.rb +36 -0
- data/lib/archimate/file_formats/serializer/archi/view_node.rb +52 -0
- data/lib/archimate/file_formats/serializer/archi/viewpoint_type.rb +45 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/element.rb +25 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/location.rb +15 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/model_exchange_file_writer.rb +32 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/organization.rb +23 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/properties.rb +15 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/relationship.rb +19 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/style.rb +48 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/connection.rb +25 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/diagram.rb +27 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/item.rb +17 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/label.rb +17 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/model.rb +36 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/organization_body.rb +25 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/property.rb +19 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v21/view_node.rb +44 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/connection.rb +26 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/diagram.rb +27 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/item.rb +17 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/label.rb +17 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/model.rb +41 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/organization_body.rb +25 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/property.rb +19 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/property_definitions.rb +34 -0
- data/lib/archimate/file_formats/serializer/model_exchange_file/v30/view_node.rb +45 -0
- data/lib/archimate/file_formats/serializer/named_collection.rb +21 -0
- data/lib/archimate/file_formats/serializer/writer.rb +56 -0
- data/lib/archimate/file_formats/serializer/xml_lang_string.rb +30 -0
- data/lib/archimate/file_formats/serializer/xml_metadata.rb +64 -0
- data/lib/archimate/file_formats/{model_exchange_file → serializer}/xml_property_defs.rb +2 -2
- data/lib/archimate/lint/duplicate_entities.rb +3 -3
- data/lib/archimate/lint/linter.rb +24 -29
- data/lib/archimate/svg/connection.rb +13 -103
- data/lib/archimate/svg/diagram.rb +1 -1
- data/lib/archimate/svg/entity/base_entity.rb +12 -8
- data/lib/archimate/svg/entity/data_entity.rb +2 -2
- data/lib/archimate/svg/entity/diagram_model_reference.rb +1 -1
- data/lib/archimate/svg/entity/event_entity.rb +2 -2
- data/lib/archimate/svg/entity/gap.rb +1 -1
- data/lib/archimate/svg/entity/group.rb +1 -1
- data/lib/archimate/svg/entity/motivation_entity.rb +1 -1
- data/lib/archimate/svg/entity/node.rb +1 -1
- data/lib/archimate/svg/entity/rect_entity.rb +1 -1
- data/lib/archimate/svg/entity/rounded_rect_entity.rb +1 -1
- data/lib/archimate/svg/entity/service_entity.rb +2 -2
- data/lib/archimate/svg/entity/value.rb +2 -2
- data/lib/archimate/svg/path.rb +153 -0
- data/lib/archimate/svg/point.rb +8 -1
- data/lib/archimate/version.rb +1 -1
- metadata +118 -36
- data/lib/archimate/data_model/archimate_node.rb +0 -181
- data/lib/archimate/data_model/concept.rb +0 -14
- data/lib/archimate/data_model/constants.rb +0 -82
- data/lib/archimate/data_model/container.rb +0 -17
- data/lib/archimate/data_model/diffable_array.rb +0 -213
- data/lib/archimate/data_model/diffable_primitive.rb +0 -83
- data/lib/archimate/data_model/label.rb +0 -19
- data/lib/archimate/data_model/named_referenceable.rb +0 -14
- data/lib/archimate/data_model/view.rb +0 -12
- data/lib/archimate/data_model/view_concept.rb +0 -18
- data/lib/archimate/file_formats/archi_file_format.rb +0 -151
- data/lib/archimate/file_formats/archimate_v2.rb +0 -461
- data/lib/archimate/file_formats/model_exchange_file/xml_lang_string.rb +0 -35
- data/lib/archimate/file_formats/model_exchange_file/xml_metadata.rb +0 -115
- data/lib/archimate/file_formats/model_exchange_file/xml_property_definitions.rb +0 -28
- data/lib/archimate/file_formats/model_exchange_file_reader_21.rb +0 -73
- data/lib/archimate/file_formats/model_exchange_file_reader_30.rb +0 -134
- data/lib/archimate/file_formats/model_exchange_file_writer.rb +0 -157
- data/lib/archimate/file_formats/writer.rb +0 -56
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
module Archimate
|
|
3
|
-
module DataModel
|
|
4
|
-
class ArchimateNode < Dry::Struct
|
|
5
|
-
using DiffablePrimitive
|
|
6
|
-
using DiffableArray
|
|
7
|
-
|
|
8
|
-
constructor_type :schema # specifies constructor style for Dry::Struct
|
|
9
|
-
|
|
10
|
-
attr_writer :parent_attribute_name
|
|
11
|
-
attr_reader :struct_instance_variables
|
|
12
|
-
|
|
13
|
-
def initialize(attributes)
|
|
14
|
-
super
|
|
15
|
-
@struct_instance_variables = self.class.schema.keys
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# TODO: Schedule this for eliminations
|
|
19
|
-
# Outside of test code, this is only used for the Bounds class
|
|
20
|
-
def with(options = {})
|
|
21
|
-
self.class.new(
|
|
22
|
-
struct_instance_variables
|
|
23
|
-
.each_with_object({}) { |i, a| a[i] = self[i] }
|
|
24
|
-
.merge(options)
|
|
25
|
-
.each_with_object({}) { |(k, v), a| a[k] = v.dup }
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
# Note: my clone method does one non-idiomatic thing - it does not clone the
|
|
30
|
-
# frozen state. TODO: respect the frozen state of the clone'd object.
|
|
31
|
-
def clone
|
|
32
|
-
self.class.new(
|
|
33
|
-
struct_instance_variables
|
|
34
|
-
.each_with_object({}) do |i, a|
|
|
35
|
-
a[i] = self[i].primitive? ? self[i] : self[i].clone
|
|
36
|
-
end
|
|
37
|
-
)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
# Makes a copy of the archimate node which is not frozen
|
|
41
|
-
def dup
|
|
42
|
-
self.class.new(
|
|
43
|
-
struct_instance_variables
|
|
44
|
-
.each_with_object({}) do |i, a|
|
|
45
|
-
a[i] = self[i].primitive? ? self[i] : self[i].dup
|
|
46
|
-
end
|
|
47
|
-
)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def in_model
|
|
51
|
-
@in_model if defined?(@in_model)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def parent
|
|
55
|
-
@parent if defined?(@parent)
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# TODO: this is used only such that every item has an id for sticking in the index.
|
|
59
|
-
# Is this really needed still?
|
|
60
|
-
def id
|
|
61
|
-
object_id
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
def ancestors
|
|
65
|
-
result = [self]
|
|
66
|
-
p = self
|
|
67
|
-
result << p until (p = p.parent).nil?
|
|
68
|
-
result
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def primitive?
|
|
72
|
-
false
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def parent=(par)
|
|
76
|
-
@parent = par
|
|
77
|
-
struct_instance_variables.each do |attrname|
|
|
78
|
-
self[attrname].parent = self
|
|
79
|
-
end
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
def parent_attribute_name
|
|
83
|
-
return @parent_attribute_name if defined?(@parent_attribute_name)
|
|
84
|
-
parent.find_index(self) if parent&.is_a?(Array)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def in_model=(model)
|
|
88
|
-
@in_model = model unless is_a?(Model)
|
|
89
|
-
struct_instance_variables.each { |attrname|
|
|
90
|
-
puts "#{attrname} is frozen in #{self.class}" if self[attrname].frozen? && self[attrname].is_a?(Array)
|
|
91
|
-
self[attrname].in_model = model }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def build_index(hash_index = {})
|
|
95
|
-
hash_index[id] = self unless id.nil?
|
|
96
|
-
struct_instance_variables.reduce(hash_index) do |a, e|
|
|
97
|
-
self[e].parent_attribute_name = e
|
|
98
|
-
self[e].build_index(a)
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def diff(other)
|
|
103
|
-
raise ArgumentError, "other expected to be not nil" if other.nil?
|
|
104
|
-
raise TypeError, "Expected other <#{other.class} to be of type #{self.class}" unless other.is_a?(self.class)
|
|
105
|
-
struct_instance_variables.each_with_object([]) do |k, a|
|
|
106
|
-
val = self[k]
|
|
107
|
-
if val.nil?
|
|
108
|
-
a.concat([Diff::Insert.new(Diff::ArchimateNodeAttributeReference.new(other, k))]) unless other[k].nil?
|
|
109
|
-
elsif val.primitive?
|
|
110
|
-
a.concat(val.diff(other[k], self, other, k))
|
|
111
|
-
else
|
|
112
|
-
a.concat(val.diff(other[k]))
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
def path(options = {})
|
|
118
|
-
[
|
|
119
|
-
parent&.path(options),
|
|
120
|
-
path_identifier
|
|
121
|
-
].compact.map(&:to_s).reject(&:empty?).join("/")
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
def compact!
|
|
125
|
-
struct_instance_variables.each { |attrname| self[attrname].compact! }
|
|
126
|
-
self
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def delete(attrname)
|
|
130
|
-
if !attrname || attrname.empty?
|
|
131
|
-
raise(
|
|
132
|
-
ArgumentError,
|
|
133
|
-
"attrname was blank must be one of: #{struct_instance_variables.map(&:to_s).join(',')}"
|
|
134
|
-
)
|
|
135
|
-
end
|
|
136
|
-
in_model&.deregister(self[attrname])
|
|
137
|
-
instance_variable_set("@#{attrname}".to_sym, nil)
|
|
138
|
-
self
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
def set(attrname, value)
|
|
142
|
-
if !attrname
|
|
143
|
-
raise(
|
|
144
|
-
ArgumentError,
|
|
145
|
-
"attrname was blank must be one of: #{struct_instance_variables.map(&:to_s).join(',')}"
|
|
146
|
-
)
|
|
147
|
-
end # || attrname.empty?
|
|
148
|
-
# value = value.clone
|
|
149
|
-
in_model&.register(value, self)
|
|
150
|
-
instance_variable_set("@#{attrname}".to_sym, value)
|
|
151
|
-
self
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
def referenced_identified_nodes
|
|
155
|
-
struct_instance_variables.reduce([]) do |a, e|
|
|
156
|
-
a.concat(self[e].referenced_identified_nodes)
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
def element_by_id(element_id)
|
|
161
|
-
return nil unless element_id
|
|
162
|
-
in_model&.lookup(element_id)
|
|
163
|
-
end
|
|
164
|
-
|
|
165
|
-
private
|
|
166
|
-
|
|
167
|
-
def path_identifier
|
|
168
|
-
case parent
|
|
169
|
-
when Array
|
|
170
|
-
find_my_index
|
|
171
|
-
else
|
|
172
|
-
parent_attribute_name
|
|
173
|
-
end
|
|
174
|
-
end
|
|
175
|
-
|
|
176
|
-
def find_my_index
|
|
177
|
-
parent.find_index(self)
|
|
178
|
-
end
|
|
179
|
-
end
|
|
180
|
-
end
|
|
181
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Archimate
|
|
4
|
-
module DataModel
|
|
5
|
-
# This is an abstract class for Concepts (Elements, Relationships, Composites, and RelationConnectors).
|
|
6
|
-
class Concept < Referenceable
|
|
7
|
-
attribute :properties, PropertiesList
|
|
8
|
-
# group -> ConceptGroup # Empty. Available for Extension purposes.
|
|
9
|
-
# attributeGroup -> ConceptAttributeGroup # Empty. Available for Extension purposes.
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
Dry::Types.register_class(Concept)
|
|
13
|
-
end
|
|
14
|
-
end
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
module Archimate
|
|
3
|
-
module DataModel
|
|
4
|
-
# The Constants module contains constants for ArchiMate standards
|
|
5
|
-
# TODO: This should be namespaced for the ArchiMate version in effect
|
|
6
|
-
module Constants
|
|
7
|
-
ELEMENTS = %w(BusinessActor BusinessCollaboration BusinessEvent BusinessFunction
|
|
8
|
-
BusinessInteraction BusinessInterface BusinessObject BusinessProcess
|
|
9
|
-
BusinessRole BusinessService Contract Location Meaning Value Product
|
|
10
|
-
Representation ApplicationCollaboration ApplicationComponent
|
|
11
|
-
ApplicationFunction ApplicationInteraction ApplicationInterface
|
|
12
|
-
ApplicationService DataObject Artifact CommunicationPath Device
|
|
13
|
-
InfrastructureFunction InfrastructureInterface InfrastructureService
|
|
14
|
-
Network Node SystemSoftware Assessment Constraint Driver Goal Principle
|
|
15
|
-
Requirement Stakeholder Deliverable Gap Plateau WorkPackage AndJunction
|
|
16
|
-
Junction OrJunction Capability CourseOfAction Resource
|
|
17
|
-
ApplicationProcess ApplicationEvent TechnologyCollaboration
|
|
18
|
-
TechnologyInterface Path CommunicationNetwork
|
|
19
|
-
TechnologyFunction TechnologyProcess TechnologyInteraction
|
|
20
|
-
TechnologyEvent TechnologyService
|
|
21
|
-
TechnologyObject Equipment Facility DistributionNetwork Material
|
|
22
|
-
Outcome ImplementationEvent).freeze
|
|
23
|
-
|
|
24
|
-
RELATIONSHIPS = %w(AssociationRelationship AccessRelationship UsedByRelationship
|
|
25
|
-
RealisationRelationship AssignmentRelationship AggregationRelationship
|
|
26
|
-
CompositionRelationship FlowRelationship TriggeringRelationship
|
|
27
|
-
GroupingRelationship SpecialisationRelationship InfluenceRelationship).freeze
|
|
28
|
-
|
|
29
|
-
LAYER_ELEMENTS = {
|
|
30
|
-
"Strategy" =>
|
|
31
|
-
%w(Capability CourseOfAction Resource),
|
|
32
|
-
"Business" =>
|
|
33
|
-
%w(BusinessActor BusinessCollaboration
|
|
34
|
-
BusinessEvent BusinessFunction
|
|
35
|
-
BusinessInteraction BusinessInterface
|
|
36
|
-
BusinessObject BusinessProcess
|
|
37
|
-
BusinessRole BusinessService
|
|
38
|
-
Contract Location
|
|
39
|
-
Meaning Value
|
|
40
|
-
Product Representation),
|
|
41
|
-
"Application" =>
|
|
42
|
-
%w(ApplicationCollaboration ApplicationComponent
|
|
43
|
-
ApplicationFunction ApplicationInteraction
|
|
44
|
-
ApplicationInterface ApplicationService
|
|
45
|
-
DataObject ApplicationProcess ApplicationEvent),
|
|
46
|
-
"Technology" =>
|
|
47
|
-
%w(Artifact CommunicationPath
|
|
48
|
-
Device InfrastructureFunction
|
|
49
|
-
InfrastructureInterface InfrastructureService
|
|
50
|
-
Network Node SystemSoftware TechnologyCollaboration
|
|
51
|
-
TechnologyInterface Path CommunicationNetwork
|
|
52
|
-
TechnologyFunction TechnologyProcess TechnologyInteraction
|
|
53
|
-
TechnologyEvent TechnologyService
|
|
54
|
-
TechnologyObject),
|
|
55
|
-
"Physical" =>
|
|
56
|
-
%w(Equipment Facility DistributionNetwork Material),
|
|
57
|
-
"Motivation" =>
|
|
58
|
-
%w(Assessment Constraint Driver
|
|
59
|
-
Goal Principle Requirement
|
|
60
|
-
Stakeholder Outcome),
|
|
61
|
-
"Implementation and Migration" =>
|
|
62
|
-
%w(Deliverable Gap Plateau
|
|
63
|
-
WorkPackage ImplementationEvent),
|
|
64
|
-
"Connectors" =>
|
|
65
|
-
%w(AndJunction Junction OrJunction)
|
|
66
|
-
}.freeze
|
|
67
|
-
|
|
68
|
-
ELEMENT_LAYER = LAYER_ELEMENTS.each_with_object({}) do |(layer, elements), el_layer_hash|
|
|
69
|
-
elements.each_with_object(el_layer_hash) { |element, a| a[element] = layer }
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
VIEWPOINTS = ["Total", "Actor Co-operation", "Application Behaviour",
|
|
73
|
-
"Application Co-operation", "Application Structure", "Application Usage",
|
|
74
|
-
"Business Function", "Business Process Co-operation", "Business Process",
|
|
75
|
-
"Business Product", "Implementation and Deployment", "Information Structure",
|
|
76
|
-
"Infrastructure Usage", "Infrastructure", "Layered", "Organisation",
|
|
77
|
-
"Service Realization", "Stakeholder", "Goal Realization", "Goal Contribution",
|
|
78
|
-
"Principles", "Requirements Realisation", "Motivation", "Project",
|
|
79
|
-
"Migration", "Implementation and Migration"].freeze
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Archimate
|
|
4
|
-
module DataModel
|
|
5
|
-
# Node type to allow a Container in a Artifact. This is a visual grouping container.
|
|
6
|
-
class Container < ViewNode
|
|
7
|
-
# This is to support Nested Nodes on the Diagram
|
|
8
|
-
# The order of sibling nodes in their parent View or Node container as declared in the model
|
|
9
|
-
# instance dictates the z-order of the nodes. Given nodes A, B, and C as declared in that order,
|
|
10
|
-
# node B is considered to be in front of node A, node C is considered to be in front of node B, and
|
|
11
|
-
# node C is considered to be in front of nodes A and B.
|
|
12
|
-
attribute :nodes, Strict::Array.member(ViewNode)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
Dry::Types.register_class(Container)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
module Archimate
|
|
3
|
-
module DataModel
|
|
4
|
-
module DiffableArray
|
|
5
|
-
using DiffablePrimitive
|
|
6
|
-
|
|
7
|
-
refine Array do
|
|
8
|
-
using DiffablePrimitive
|
|
9
|
-
|
|
10
|
-
attr_writer :parent_attribute_name
|
|
11
|
-
|
|
12
|
-
def in_model
|
|
13
|
-
@in_model if defined?(@in_model)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
def parent
|
|
17
|
-
@parent if defined?(@parent)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def id
|
|
21
|
-
object_id.to_s
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def ancestors
|
|
25
|
-
result = [self]
|
|
26
|
-
p = self
|
|
27
|
-
result << p until (p = p.parent).nil?
|
|
28
|
-
result
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def primitive?
|
|
32
|
-
false
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# def diff(other)
|
|
36
|
-
# raise TypeError, "Expected other #{other.class} to be of type #{self.class}" unless other.is_a?(self.class)
|
|
37
|
-
# raise "Well Hell other #{other.path} in_model is nil" if other.in_model.nil?
|
|
38
|
-
# raise "Well Hell my path `#{path}` in_model is nil" if in_model.nil?
|
|
39
|
-
|
|
40
|
-
# result = []
|
|
41
|
-
# remaining_content = Array.new(self) # TODO: I want a copy of the array, not a deep clone
|
|
42
|
-
# other_enum = other.each_with_index
|
|
43
|
-
|
|
44
|
-
# loop do
|
|
45
|
-
# if other_enum.peek[0] == remaining_content[0]
|
|
46
|
-
# other_enum.next
|
|
47
|
-
# remaining_content.shift
|
|
48
|
-
# elsif items_are_changed?(other, other_enum, remaining_content)
|
|
49
|
-
# result.concat(compute_item_changes(other, other_enum, self, remaining_content[0]))
|
|
50
|
-
# remaining_content.shift
|
|
51
|
-
# other_enum.next
|
|
52
|
-
# elsif !remaining_content.empty? && !other.smart_include?(remaining_content[0])
|
|
53
|
-
# result << Diff::Delete.new(Diff::ArchimateArrayReference.new(self, smart_find(remaining_content[0])))
|
|
54
|
-
# remaining_content.shift
|
|
55
|
-
# elsif !smart_include?(other_enum.peek[0])
|
|
56
|
-
# result << Diff::Insert.new(Diff::ArchimateArrayReference.new(other, other_enum.next[1]))
|
|
57
|
-
# elsif smart_include?(other_enum.peek[0])
|
|
58
|
-
# result << Diff::Move.new(
|
|
59
|
-
# Diff::ArchimateArrayReference.new(other, other_enum.peek[1]),
|
|
60
|
-
# Diff::ArchimateArrayReference.new(self, smart_find(other_enum.peek[0]))
|
|
61
|
-
# )
|
|
62
|
-
# remaining_item_idx = remaining_content.smart_find(other_enum.peek[0])
|
|
63
|
-
# if remaining_item_idx
|
|
64
|
-
# result.concat(compute_item_changes(other, other_enum, self, remaining_content[remaining_item_idx]))
|
|
65
|
-
# remaining_content.delete_at(remaining_item_idx) if remaining_content.smart_include?(other_enum.peek[0])
|
|
66
|
-
# end
|
|
67
|
-
# other_enum.next
|
|
68
|
-
# else
|
|
69
|
-
# raise "Unhandled diff case for remaining_content: #{remaining_content[0]} and #{other_enum.peek[0]}"
|
|
70
|
-
# end
|
|
71
|
-
# end
|
|
72
|
-
|
|
73
|
-
# result.concat(
|
|
74
|
-
# remaining_content
|
|
75
|
-
# .reject { |item| other.include?(item) }
|
|
76
|
-
# .map do |item|
|
|
77
|
-
# Diff::Delete.new(Diff::ArchimateArrayReference.new(self, find_index(item)))
|
|
78
|
-
# end
|
|
79
|
-
# )
|
|
80
|
-
# end
|
|
81
|
-
|
|
82
|
-
# TODO: This may not continue to live here. Only used by testing.
|
|
83
|
-
# def patch(diffs)
|
|
84
|
-
# # TODO: Beware, order of diffs could break patching at the moment.
|
|
85
|
-
# Array(diffs).each do |diff|
|
|
86
|
-
# case diff
|
|
87
|
-
# when Diff::Delete
|
|
88
|
-
# delete_at(smart_find(diff.target.value))
|
|
89
|
-
# when Diff::Insert
|
|
90
|
-
# insert(diff.target.array_index, diff.target.value)
|
|
91
|
-
# when Diff::Change
|
|
92
|
-
# self[smart_find(diff.changed_from.value)] = diff.target.value
|
|
93
|
-
# when Diff::Move
|
|
94
|
-
# insert(diff.target.array_index, delete_at(smart_find(diff.target.value)))
|
|
95
|
-
# else
|
|
96
|
-
# raise "Unexpected diff type: #{diff.class}"
|
|
97
|
-
# end
|
|
98
|
-
# end
|
|
99
|
-
# self
|
|
100
|
-
# end
|
|
101
|
-
|
|
102
|
-
def items_are_changed?(other, other_enum, remaining)
|
|
103
|
-
!remaining.empty? &&
|
|
104
|
-
case remaining[0]
|
|
105
|
-
when DataModel::Referenceable
|
|
106
|
-
remaining[0].id == other_enum.peek[0].id
|
|
107
|
-
when String, DataModel::ArchimateNode
|
|
108
|
-
!other.include?(remaining[0]) && !include?(other_enum.peek[0])
|
|
109
|
-
else
|
|
110
|
-
raise "Unhandled type for #{remaining[0].class}"
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def compute_item_changes(other, other_enum, _myself, my_item)
|
|
115
|
-
case my_item
|
|
116
|
-
when DataModel::ArchimateNode
|
|
117
|
-
my_item.diff(other_enum.peek[0])
|
|
118
|
-
else
|
|
119
|
-
my_item.diff(other_enum.peek[0], self, other, other_enum.peek[1], find_index(my_item))
|
|
120
|
-
end
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
def in_model=(model)
|
|
124
|
-
puts "#{self.inspect} is frozen" if self.frozen?
|
|
125
|
-
@in_model = model
|
|
126
|
-
each { |item| item.in_model = model }
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
def parent=(par)
|
|
130
|
-
@parent = par
|
|
131
|
-
each { |i| i.parent = self }
|
|
132
|
-
end
|
|
133
|
-
|
|
134
|
-
def parent_attribute_name
|
|
135
|
-
@parent_attribute_name if defined?(@parent_attribute_name)
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def build_index(hash_index = {})
|
|
139
|
-
reduce(hash_index) { |hi, array_item| array_item.build_index(hi) }
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
def path(options = {})
|
|
143
|
-
[
|
|
144
|
-
parent&.path(options),
|
|
145
|
-
parent_attribute_name
|
|
146
|
-
].compact.reject(&:empty?).join("/")
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
def clone
|
|
150
|
-
map(&:clone)
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
def dup
|
|
154
|
-
map(&:dup)
|
|
155
|
-
end
|
|
156
|
-
|
|
157
|
-
def to_s
|
|
158
|
-
"#{parent}/#{parent_attribute_name}"
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
def referenced_identified_nodes
|
|
162
|
-
reduce([]) do |a, e|
|
|
163
|
-
a.concat(e.referenced_identified_nodes)
|
|
164
|
-
end
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
def find_by_id(an_id)
|
|
168
|
-
find { |el| el.id == an_id }
|
|
169
|
-
end
|
|
170
|
-
|
|
171
|
-
def smart_find(val = nil)
|
|
172
|
-
case val
|
|
173
|
-
when Referenceable
|
|
174
|
-
lazy.map(&:id).find_index(val.id)
|
|
175
|
-
else
|
|
176
|
-
find_index(val)
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
|
|
180
|
-
def smart_include?(val)
|
|
181
|
-
case val
|
|
182
|
-
when Referenceable
|
|
183
|
-
lazy.map(&:id).include?(val.id)
|
|
184
|
-
else
|
|
185
|
-
include?(val)
|
|
186
|
-
end
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
def smart_intersection(ary)
|
|
190
|
-
select { |item| ary.smart_include?(item) }
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
def after(idx)
|
|
194
|
-
return [] if idx >= size - 1
|
|
195
|
-
self[idx + 1..-1]
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
# Given a node in self and ary,
|
|
199
|
-
# return the idx of first node p in self that exists in both self and ary
|
|
200
|
-
# and is previous to node in self
|
|
201
|
-
def previous_item_index(ary, node)
|
|
202
|
-
return -1 unless ary.smart_include?(node)
|
|
203
|
-
initial_idx = smart_find(node)
|
|
204
|
-
return -1 if initial_idx.nil?
|
|
205
|
-
|
|
206
|
-
(initial_idx - 1).downto(0).find(-> { -1 }) do |idx|
|
|
207
|
-
ary.smart_include?(at(idx))
|
|
208
|
-
end
|
|
209
|
-
end
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
end
|
|
213
|
-
end
|