archimate 1.2.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "ruby-enum"
|
3
|
+
|
4
|
+
module Archimate
|
5
|
+
module DataModel
|
6
|
+
RELATION_VERBS = {
|
7
|
+
"AccessRelationship" => "accesses",
|
8
|
+
"AggregationRelationship" => "aggregates",
|
9
|
+
"AssignmentRelationship" => "is assigned to",
|
10
|
+
"AssociationRelationship" => "is associated with",
|
11
|
+
"CompositionRelationship" => "composes",
|
12
|
+
"FlowRelationship" => "flows to",
|
13
|
+
"InfluenceRelationship" => "influenecs",
|
14
|
+
"RealisationRelationship" => "realizes",
|
15
|
+
"SpecialisationRelationship" => "specializes",
|
16
|
+
"TriggeringRelationship" => "triggers",
|
17
|
+
"UsedByRelationship" => "is used by"
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
class RelationshipType
|
21
|
+
include Ruby::Enum
|
22
|
+
|
23
|
+
define :AccessRelationship, "AccessRelationship"
|
24
|
+
define :AggregationRelationship, "AggregationRelationship"
|
25
|
+
define :AssignmentRelationship, "AssignmentRelationship"
|
26
|
+
define :AssociationRelationship, "AssociationRelationship"
|
27
|
+
define :CompositionRelationship, "CompositionRelationship"
|
28
|
+
define :FlowRelationship, "FlowRelationship"
|
29
|
+
define :InfluenceRelationship, "InfluenceRelationship"
|
30
|
+
define :RealisationRelationship, "RealisationRelationship"
|
31
|
+
define :SpecialisationRelationship, "SpecialisationRelationship"
|
32
|
+
define :SpecializationRelationship, "SpecializationRelationship"
|
33
|
+
define :TriggeringRelationship, "TriggeringRelationship"
|
34
|
+
define :UsedByRelationship, "UsedByRelationship" # @todo Support: Serving
|
35
|
+
define :ServingRelationship, "ServingRelationship" # @todo Support: Serving
|
36
|
+
define :GroupingRelationship, "GroupingRelationship"
|
37
|
+
|
38
|
+
def self.===(other)
|
39
|
+
values.include?(other)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -2,17 +2,28 @@
|
|
2
2
|
|
3
3
|
module Archimate
|
4
4
|
module DataModel
|
5
|
-
class SchemaInfo
|
6
|
-
|
5
|
+
class SchemaInfo
|
6
|
+
include Comparison
|
7
7
|
|
8
|
-
attribute
|
9
|
-
|
10
|
-
|
8
|
+
# @!attribute [r] schema
|
9
|
+
# @return [String, NilClass]
|
10
|
+
model_attr :schema
|
11
|
+
# @!attribute [r] schemaversion
|
12
|
+
# @return [String, NilClass]
|
13
|
+
model_attr :schemaversion
|
14
|
+
# @!attribute [r] elements
|
15
|
+
# @return [Array<AnyElement>]
|
16
|
+
model_attr :elements
|
17
|
+
|
18
|
+
def initialize(schema: nil, schemaversion: nil, elements: [])
|
19
|
+
@schema = schema
|
20
|
+
@schemaversion = schemaversion
|
21
|
+
@elements = elements
|
22
|
+
end
|
11
23
|
|
12
24
|
def to_s
|
13
25
|
"#{type.light_black}[#{schema} #{schemaversion}]"
|
14
26
|
end
|
15
27
|
end
|
16
|
-
Dry::Types.register_class(SchemaInfo)
|
17
28
|
end
|
18
29
|
end
|
@@ -1,17 +1,49 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Archimate
|
3
4
|
module DataModel
|
4
|
-
class Style
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
class Style
|
6
|
+
include Comparison
|
7
|
+
|
8
|
+
# @todo make this an enum
|
9
|
+
# @!attribute [r] text_alignment
|
10
|
+
# @return [Int, NilClass]
|
11
|
+
model_attr :text_alignment
|
12
|
+
# @!attribute [r] fill_color
|
13
|
+
# @return [Color, NilClass]
|
14
|
+
model_attr :fill_color
|
15
|
+
# @!attribute [r] line_color
|
16
|
+
# @return [Color, NilClass]
|
17
|
+
model_attr :line_color
|
18
|
+
# @todo move this to font
|
19
|
+
# @!attribute [r] font_color
|
20
|
+
# @return [Color, NilClass]
|
21
|
+
model_attr :font_color
|
22
|
+
# @!attribute [r] line_width
|
23
|
+
# @return [Int, NilClass]
|
24
|
+
model_attr :line_width
|
25
|
+
# @!attribute [r] font
|
26
|
+
# @return [Font, NilClass]
|
27
|
+
model_attr :font
|
28
|
+
# @todo make this an enum
|
29
|
+
# @!attribute [r] text_position
|
30
|
+
# @return [Int, NilClass]
|
31
|
+
model_attr :text_position
|
32
|
+
|
33
|
+
def initialize(text_alignment: nil, fill_color: nil, line_color: nil,
|
34
|
+
font_color: nil, line_width: nil, font: nil, text_position: nil)
|
35
|
+
@text_alignment = text_alignment
|
36
|
+
@fill_color = fill_color
|
37
|
+
@line_color = line_color
|
38
|
+
@font_color = font_color
|
39
|
+
@line_width = line_width
|
40
|
+
@font = font
|
41
|
+
@text_position = text_position
|
42
|
+
end
|
12
43
|
|
13
44
|
def to_s
|
14
|
-
attr_name_vals =
|
45
|
+
attr_name_vals = %i[text_alignment fill_color line_color font_color line_width
|
46
|
+
font text_position].map { |k| "#{k}: #{send(k)}" }.join(", ")
|
15
47
|
"Style(#{attr_name_vals})"
|
16
48
|
end
|
17
49
|
|
@@ -26,7 +58,5 @@ module Archimate
|
|
26
58
|
end
|
27
59
|
end
|
28
60
|
end
|
29
|
-
|
30
|
-
Dry::Types.register_class(Style)
|
31
61
|
end
|
32
62
|
end
|
@@ -1,55 +1,151 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
module Archimate
|
3
4
|
module DataModel
|
4
|
-
PositiveInteger =
|
5
|
+
# PositiveInteger =Int.constrained(gt: 0)
|
5
6
|
|
6
7
|
# Graphical node type. It can contain child node types.
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
attribute
|
32
|
-
|
33
|
-
|
34
|
-
attribute
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
#
|
8
|
+
# This can be specialized as Label and Container
|
9
|
+
# In the ArchiMate v3 Schema, the tree of these nodes is:
|
10
|
+
# ViewConceptType(
|
11
|
+
# LabelGroup (name LangString)
|
12
|
+
# PreservedLangString
|
13
|
+
# style (optional)
|
14
|
+
# viewRefs
|
15
|
+
# id)
|
16
|
+
# - ViewNodeType(
|
17
|
+
# LocationGroup (x, y)
|
18
|
+
# SizeGroup (width, height))
|
19
|
+
# - Label(
|
20
|
+
# conceptRef
|
21
|
+
# attributeRef
|
22
|
+
# xpathPart (optional)
|
23
|
+
# )
|
24
|
+
# - Container(
|
25
|
+
# nodes (ViewNodeType)
|
26
|
+
# - Element(
|
27
|
+
# elementRef)
|
28
|
+
class ViewNode
|
29
|
+
include Comparison
|
30
|
+
|
31
|
+
# ViewConceptType
|
32
|
+
# @!attribute [r] id
|
33
|
+
# @return [String]
|
34
|
+
model_attr :id
|
35
|
+
# @!attribute [r] name
|
36
|
+
# @return [LangString, NilClass]
|
37
|
+
model_attr :name
|
38
|
+
# @!attribute [r] documentation
|
39
|
+
# @return [PreservedLangString, NilClass]
|
40
|
+
model_attr :documentation
|
41
|
+
# # @!attribute [r] other_elements
|
42
|
+
# @return [Array<AnyElement>]
|
43
|
+
model_attr :other_elements
|
44
|
+
# # @!attribute [r] other_attributes
|
45
|
+
# @return [Array<AnyAttribute>]
|
46
|
+
model_attr :other_attributes
|
47
|
+
# @note type here was used for the Element/Relationship/Diagram type
|
48
|
+
# @!attribute [r] type
|
49
|
+
# @return [String, NilClass]
|
50
|
+
model_attr :type
|
51
|
+
# @!attribute [r] style
|
52
|
+
# @return [Style, NilClass]
|
53
|
+
model_attr :style
|
54
|
+
|
55
|
+
# @note viewRefs are pointers to 0-* Diagrams for diagram drill in defined in abstract View Concept
|
56
|
+
# @todo Make this an array
|
57
|
+
# @!attribute [rw] view_refs
|
58
|
+
# @return [Diagram]
|
59
|
+
model_attr :view_refs, comparison_attr: :id, writable: true
|
60
|
+
|
61
|
+
# @todo document where this comes from
|
62
|
+
# @!attribute [r] content
|
63
|
+
# @return [String, NilClass]
|
64
|
+
model_attr :content
|
65
|
+
|
66
|
+
# This is needed for various calculations
|
67
|
+
# @!attribute [r] parent
|
68
|
+
# @return [ViewNode]
|
69
|
+
model_attr :parent, writable: true, comparison_attr: :no_compare
|
70
|
+
|
71
|
+
# ViewNodeType
|
72
|
+
# @!attribute [r] bounds
|
73
|
+
# @return [Bounds, NilClass]
|
74
|
+
model_attr :bounds
|
75
|
+
|
76
|
+
# Container - container doesn't distinguish between nodes and connections
|
77
|
+
# @!attribute [r] nodes
|
78
|
+
# @return [Array<ViewNode>]
|
79
|
+
model_attr :nodes
|
80
|
+
# @!attribute [r] connections
|
81
|
+
# @return [Array<Connection>]
|
82
|
+
model_attr :connections
|
83
|
+
|
84
|
+
# @note properties is not in the model under element, it's added under Real Element
|
85
|
+
# @todo Delete this - I think it's not used
|
86
|
+
# @!attribute [r] properties
|
87
|
+
# @return [Array<Property>]
|
88
|
+
model_attr :properties
|
89
|
+
|
90
|
+
# Element
|
91
|
+
# @!attribute [rw] element
|
92
|
+
# @return [Element, NilClass]
|
93
|
+
model_attr :element, writable: true, comparison_attr: :id
|
94
|
+
# Archi format, selects the shape of element (for elements that can have two or more shapes)
|
95
|
+
# @!attribute [r] child_type
|
96
|
+
# @return [Int, NilClass]
|
97
|
+
model_attr :child_type
|
98
|
+
|
99
|
+
# @!attribute [r] diagram
|
100
|
+
# @return [Diagram, NilClass]
|
101
|
+
model_attr :diagram, comparison_attr: :no_compare
|
102
|
+
|
103
|
+
# Node type to allow a Label in a Artifact. the "label" element holds the info for the @note.
|
104
|
+
# Label View Nodes have the following attributes
|
105
|
+
|
106
|
+
# conceptRef is a reference to an concept for this particular label, along with the attributeRef
|
107
|
+
# which references the particular concept's part which this label represents.
|
108
|
+
# @!attribute [r] concept_ref
|
109
|
+
# @return [String]
|
110
|
+
model_attr :concept_ref
|
111
|
+
# conceptRef is a reference to an concept for this particular label, along with the partRef
|
112
|
+
# which references the particular concept's part which this label represents. If this attribute
|
113
|
+
# is set, then there is no need to add a label tag in the Label parent (since it is contained in the model).
|
114
|
+
# the XPATH statement is meant to be interpreted in the context of what the conceptRef points to.
|
115
|
+
# @!attribute [r] xpath_path
|
116
|
+
# @return [String, NilClass]
|
117
|
+
model_attr :xpath_path
|
118
|
+
|
119
|
+
def initialize(id:, name: nil, documentation: nil, type: nil, parent: nil,
|
120
|
+
style: nil, view_refs: [], content: nil, bounds: nil,
|
121
|
+
nodes: [], connections: [], properties: [], element: nil,
|
122
|
+
child_type: nil, diagram:, concept_ref: nil, xpath_path: nil)
|
123
|
+
@id = id
|
124
|
+
@name = name
|
125
|
+
@documentation = documentation
|
126
|
+
@type = type
|
127
|
+
@parent = parent
|
128
|
+
@style = style
|
129
|
+
@view_refs = view_refs
|
130
|
+
@content = content
|
131
|
+
@bounds = bounds
|
132
|
+
@nodes = nodes
|
133
|
+
@connections = connections
|
134
|
+
@properties = properties
|
135
|
+
@element = element
|
136
|
+
@child_type = child_type
|
137
|
+
@diagram = diagram
|
138
|
+
@concept_ref = concept_ref
|
139
|
+
@xpath_path = xpath_path
|
140
|
+
end
|
39
141
|
|
40
142
|
def replace(entity, with_entity)
|
41
|
-
if
|
42
|
-
|
43
|
-
@element = with_entity
|
44
|
-
end
|
45
|
-
if (model == entity.id)
|
46
|
-
@model = with_entity.id
|
47
|
-
@model_element = with_entity
|
48
|
-
end
|
143
|
+
@element = with_entity if element.id == entity.id
|
144
|
+
@view_refs = with_entity if view_refs == entity
|
49
145
|
end
|
50
146
|
|
51
147
|
def to_s
|
52
|
-
"ViewNode[#{name || ''}](#{
|
148
|
+
"ViewNode[#{name || ''}](#{element if element})"
|
53
149
|
end
|
54
150
|
|
55
151
|
def description
|
@@ -60,14 +156,6 @@ module Archimate
|
|
60
156
|
].compact.join(" ")
|
61
157
|
end
|
62
158
|
|
63
|
-
def element
|
64
|
-
@element ||= in_model.lookup(archimate_element)
|
65
|
-
end
|
66
|
-
|
67
|
-
def model_element
|
68
|
-
@model_element ||= in_model.lookup(model)
|
69
|
-
end
|
70
|
-
|
71
159
|
def all_nodes
|
72
160
|
nodes.inject(Array.new(nodes)) { |child_ary, child| child_ary.concat(child.all_nodes) }
|
73
161
|
end
|
@@ -78,30 +166,36 @@ module Archimate
|
|
78
166
|
|
79
167
|
def referenced_identified_nodes
|
80
168
|
(nodes + connections).reduce(
|
81
|
-
|
169
|
+
[element]
|
170
|
+
.compact
|
82
171
|
) do |a, e|
|
83
172
|
a.concat(e.referenced_identified_nodes)
|
84
173
|
end
|
85
174
|
end
|
86
175
|
|
87
176
|
def in_diagram
|
88
|
-
|
177
|
+
diagram # ||= ->(node) { node = node.parent until node.nil? || node.is_a?(Diagram) }.call(self)
|
89
178
|
end
|
90
179
|
|
91
|
-
#
|
180
|
+
# @todo Is this true for all or only Archi models?
|
92
181
|
def absolute_position
|
93
|
-
offset = bounds ||
|
94
|
-
el = parent
|
182
|
+
offset = bounds || Bounds.zero
|
183
|
+
el = parent
|
95
184
|
while el.respond_to?(:bounds) && el.bounds
|
96
185
|
bounds = el.bounds
|
97
|
-
offset = offset.
|
98
|
-
el = el.parent
|
186
|
+
offset = Bounds.new(offset.to_h.merge(x: (offset.x || 0) + (bounds.x || 0), y: (offset.y || 0) + (bounds.y || 0)))
|
187
|
+
el = el.parent
|
99
188
|
end
|
100
189
|
offset
|
101
190
|
end
|
102
|
-
end
|
103
191
|
|
104
|
-
|
192
|
+
def target_connections
|
193
|
+
diagram
|
194
|
+
.connections
|
195
|
+
.select { |conn| conn.target&.id == id }
|
196
|
+
.map(&:id)
|
197
|
+
end
|
198
|
+
end
|
105
199
|
end
|
106
200
|
end
|
107
201
|
|
@@ -2,86 +2,62 @@
|
|
2
2
|
|
3
3
|
module Archimate
|
4
4
|
module DataModel
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
IMPLEMENTATION_AND_MIGRATION_VIEWPOINTS].flatten
|
62
|
-
)
|
63
|
-
|
64
|
-
ViewpointType = Strict::String.enum(*VIEWPOINTS_ENUM).optional
|
65
|
-
|
66
|
-
ViewpointContentEnum = Strict::String.enum(%w[Details Coherence Overview])
|
67
|
-
ViewpointContent = Strict::Array.member(ViewpointContentEnum).default([])
|
68
|
-
|
69
|
-
ViewpointPurposeEnum = Strict::String.enum(%w[Designing Deciding Informing])
|
70
|
-
ViewpointPurpose = Strict::Array.member(ViewpointPurposeEnum).default([])
|
71
|
-
|
72
|
-
class Viewpoint < NamedReferenceable
|
73
|
-
using DataModel::DiffableArray
|
74
|
-
using DataModel::DiffablePrimitive
|
75
|
-
|
76
|
-
attribute :concern, ConcernList
|
77
|
-
attribute :viewpointPurpose, ViewpointPurpose.optional
|
78
|
-
attribute :viewpointContent, ViewpointContent.optional
|
79
|
-
attribute :allowedElementTypes, AllowedElementTypes
|
80
|
-
attribute :allowedRelationshipTypes, AllowedRelationshipTypes
|
81
|
-
attribute :modelingNotes, Strict::Array.member(ModelingNote).default([])
|
5
|
+
class Viewpoint
|
6
|
+
include Comparison
|
7
|
+
|
8
|
+
# @!attribute [r] id
|
9
|
+
# @return [String]
|
10
|
+
model_attr :id
|
11
|
+
# @!attribute [r] name
|
12
|
+
# @return [LangString]
|
13
|
+
model_attr :name
|
14
|
+
# @!attribute [r] documentation
|
15
|
+
# @return [PreservedLangString]
|
16
|
+
model_attr :documentation
|
17
|
+
# # @!attribute [r] other_elements
|
18
|
+
# @return [Array<AnyElement>]
|
19
|
+
model_attr :other_elements
|
20
|
+
# # @!attribute [r] other_attributes
|
21
|
+
# @return [Array<AnyAttribute>]
|
22
|
+
model_attr :other_attributes
|
23
|
+
# type here was used for the Element/Relationship/Diagram type
|
24
|
+
# @!attribute [r] type
|
25
|
+
# @return [String, NilClass]
|
26
|
+
model_attr :type
|
27
|
+
# @!attribute [r] concerns
|
28
|
+
# @return [Array<Concern>]
|
29
|
+
model_attr :concerns
|
30
|
+
# @!attribute [r] viewpoint_purposes
|
31
|
+
# @return [Array<ViewpointPurposeEnum>]
|
32
|
+
model_attr :viewpoint_purposes
|
33
|
+
# @!attribute [r] viewpoint_contents
|
34
|
+
# @return [Array<ViewpointContentEnum>]
|
35
|
+
model_attr :viewpoint_contents
|
36
|
+
# @!attribute [r] allowed_element_types
|
37
|
+
# @return [Array<ElementType>]
|
38
|
+
model_attr :allowed_element_types
|
39
|
+
# @!attribute [r] allowed_relationship_types
|
40
|
+
# @return [Array<RelationshipType>]
|
41
|
+
model_attr :allowed_relationship_types
|
42
|
+
# @!attribute [r] modeling_notes
|
43
|
+
# @return [Array<ModelingNote>]
|
44
|
+
model_attr :modeling_notes
|
45
|
+
|
46
|
+
def initialize(id:, name:, documentation: nil, type: nil,
|
47
|
+
concerns: [], viewpoint_purposes: [],
|
48
|
+
viewpoint_contents: [], allowed_element_types: [],
|
49
|
+
allowed_relationship_types: [], modeling_notes: [])
|
50
|
+
@id = id
|
51
|
+
@name = name
|
52
|
+
@documentation = documentation
|
53
|
+
@type = type
|
54
|
+
@concerns = concerns
|
55
|
+
@viewpoint_purposes = viewpoint_purposes
|
56
|
+
@viewpoint_contents = viewpoint_contents
|
57
|
+
@allowed_element_types = allowed_element_types
|
58
|
+
@allowed_relationship_types = allowed_relationship_types
|
59
|
+
@modeling_notes = modeling_notes
|
60
|
+
end
|
82
61
|
end
|
83
|
-
|
84
|
-
Dry::Types.register_class(Viewpoint)
|
85
|
-
ViewpointList = Strict::Array.member(Viewpoint).default([])
|
86
62
|
end
|
87
63
|
end
|