archimate 2.0.1 → 2.0.2

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/archimate.gemspec +2 -1
  3. data/lib/archimate/color.rb +2 -2
  4. data/lib/archimate/data_model/any_attribute.rb +4 -10
  5. data/lib/archimate/data_model/any_element.rb +9 -17
  6. data/lib/archimate/data_model/bounds.rb +6 -6
  7. data/lib/archimate/data_model/color.rb +6 -6
  8. data/lib/archimate/data_model/comparison.rb +101 -5
  9. data/lib/archimate/data_model/concern.rb +5 -13
  10. data/lib/archimate/data_model/connection.rb +39 -48
  11. data/lib/archimate/data_model/connector_type.rb +1 -0
  12. data/lib/archimate/data_model/diagram.rb +27 -42
  13. data/lib/archimate/data_model/diagram_type.rb +1 -0
  14. data/lib/archimate/data_model/element.rb +14 -35
  15. data/lib/archimate/data_model/elements.rb +681 -0
  16. data/lib/archimate/data_model/font.rb +8 -8
  17. data/lib/archimate/data_model/lang_string.rb +10 -36
  18. data/lib/archimate/data_model/layer.rb +4 -5
  19. data/lib/archimate/data_model/layers.rb +45 -49
  20. data/lib/archimate/data_model/location.rb +6 -6
  21. data/lib/archimate/data_model/metadata.rb +2 -6
  22. data/lib/archimate/data_model/model.rb +50 -62
  23. data/lib/archimate/data_model/modeling_note.rb +3 -8
  24. data/lib/archimate/data_model/organization.rb +18 -27
  25. data/lib/archimate/data_model/property.rb +9 -8
  26. data/lib/archimate/data_model/property_definition.rb +15 -21
  27. data/lib/archimate/data_model/referenceable.rb +14 -9
  28. data/lib/archimate/data_model/referenceable_list.rb +82 -0
  29. data/lib/archimate/data_model/relationship.rb +41 -152
  30. data/lib/archimate/data_model/relationship_references.rb +29 -0
  31. data/lib/archimate/data_model/relationships.rb +214 -0
  32. data/lib/archimate/data_model/schema_info.rb +6 -12
  33. data/lib/archimate/data_model/style.rb +14 -25
  34. data/lib/archimate/data_model/view_node.rb +38 -66
  35. data/lib/archimate/data_model/viewpoint.rb +23 -38
  36. data/lib/archimate/data_model/viewpoint_type.rb +347 -387
  37. data/lib/archimate/data_model.rb +7 -6
  38. data/lib/archimate/derived_relations.rb +106 -31
  39. data/lib/archimate/export/cypher.rb +0 -18
  40. data/lib/archimate/export/jsonl.rb +16 -45
  41. data/lib/archimate/export/n_quads.rb +1 -24
  42. data/lib/archimate/file_formats/archi_file_reader.rb +2 -1
  43. data/lib/archimate/file_formats/model_exchange_file_writer_21.rb +9 -1
  44. data/lib/archimate/file_formats/sax/archi/archi_handler_factory.rb +2 -2
  45. data/lib/archimate/file_formats/sax/archi/connection.rb +2 -1
  46. data/lib/archimate/file_formats/sax/archi/element.rb +7 -5
  47. data/lib/archimate/file_formats/sax/archi/relationship.rb +1 -1
  48. data/lib/archimate/file_formats/sax/model_exchange_file/connection.rb +2 -1
  49. data/lib/archimate/file_formats/sax/model_exchange_file/element.rb +1 -1
  50. data/lib/archimate/file_formats/sax/model_exchange_file/relationship.rb +1 -1
  51. data/lib/archimate/file_formats/sax/model_exchange_file/view_node.rb +0 -1
  52. data/lib/archimate/file_formats/serializer/archi/relationship.rb +1 -1
  53. data/lib/archimate/lint/duplicate_entities.rb +46 -42
  54. data/lib/archimate/svg/archimate.css +12 -2
  55. data/lib/archimate/svg/entity/base_entity.rb +6 -29
  56. data/lib/archimate/svg/entity/location.rb +1 -0
  57. data/lib/archimate/svg/entity_factory.rb +3 -3
  58. data/lib/archimate/svg/point.rb +3 -3
  59. data/lib/archimate/svg/svg_template.svg.erb +5 -5
  60. data/lib/archimate/version.rb +2 -1
  61. metadata +20 -6
  62. data/TODOs.org +0 -505
  63. data/lib/archimate/data_model/differentiable.rb +0 -142
  64. data/lib/archimate/data_model/element_type.rb +0 -89
  65. data/lib/archimate/data_model/relationship_type.rb +0 -45
@@ -27,77 +27,77 @@ module Archimate
27
27
  # elementRef)
28
28
  class ViewNode
29
29
  include Comparison
30
+ include Referenceable
30
31
 
31
32
  # ViewConceptType
32
33
  # @!attribute [r] id
33
- # @return [String]
34
+ # @return [String]
34
35
  model_attr :id
35
36
  # @!attribute [r] name
36
- # @return [LangString, NilClass]
37
- model_attr :name
37
+ # @return [LangString, NilClass]
38
+ model_attr :name, default: nil
38
39
  # @!attribute [r] documentation
39
- # @return [PreservedLangString, NilClass]
40
- model_attr :documentation
40
+ # @return [PreservedLangString, NilClass]
41
+ model_attr :documentation, default: nil
41
42
  # # @!attribute [r] other_elements
42
- # @return [Array<AnyElement>]
43
- model_attr :other_elements
43
+ # @return [Array<AnyElement>]
44
+ model_attr :other_elements, default: []
44
45
  # # @!attribute [r] other_attributes
45
- # @return [Array<AnyAttribute>]
46
- model_attr :other_attributes
46
+ # @return [Array<AnyAttribute>]
47
+ model_attr :other_attributes, default: []
47
48
  # @note type here was used for the Element/Relationship/Diagram type
48
49
  # @!attribute [r] type
49
- # @return [String, NilClass]
50
- model_attr :type
50
+ # @return [String, NilClass]
51
+ model_attr :type, default: nil
51
52
  # @!attribute [r] style
52
- # @return [Style, NilClass]
53
- model_attr :style
53
+ # @return [Style, NilClass]
54
+ model_attr :style, default: nil
54
55
 
55
56
  # @note viewRefs are pointers to 0-* Diagrams for diagram drill in defined in abstract View Concept
56
- # @todo Make this an array
57
57
  # @!attribute [rw] view_refs
58
- # @return [Diagram]
59
- model_attr :view_refs, comparison_attr: :id, writable: true
58
+ # @return [Diagram]
59
+ model_attr :view_refs, comparison_attr: :id, writable: true, default: nil
60
60
 
61
61
  # @todo document where this comes from
62
62
  # @!attribute [r] content
63
- # @return [String, NilClass]
64
- model_attr :content
63
+ # @return [String, NilClass]
64
+ model_attr :content, default: nil
65
65
 
66
66
  # This is needed for various calculations
67
67
  # @!attribute [r] parent
68
- # @return [ViewNode]
69
- model_attr :parent, writable: true, comparison_attr: :no_compare
68
+ # @return [ViewNode]
69
+ model_attr :parent, writable: true, comparison_attr: :no_compare, default: nil
70
70
 
71
71
  # ViewNodeType
72
72
  # @!attribute [r] bounds
73
- # @return [Bounds, NilClass]
74
- model_attr :bounds
73
+ # @return [Bounds, NilClass]
74
+ model_attr :bounds, default: nil
75
75
 
76
76
  # Container - container doesn't distinguish between nodes and connections
77
77
  # @!attribute [r] nodes
78
- # @return [Array<ViewNode>]
79
- model_attr :nodes
78
+ # @return [Array<ViewNode>]
79
+ model_attr :nodes, default: [], referenceable_list: true, also_reference: [:diagram]
80
80
  # @!attribute [r] connections
81
- # @return [Array<Connection>]
82
- model_attr :connections
81
+ # @return [Array<Connection>]
82
+ model_attr :connections, default: [], referenceable_list: true
83
83
 
84
84
  # @note properties is not in the model under element, it's added under Real Element
85
85
  # @todo Delete this - I think it's not used
86
86
  # @!attribute [r] properties
87
- # @return [Array<Property>]
88
- model_attr :properties
87
+ # @return [Array<Property>]
88
+ model_attr :properties, default: []
89
89
 
90
90
  # Element
91
91
  # @!attribute [rw] element
92
- # @return [Element, NilClass]
93
- model_attr :element, writable: true, comparison_attr: :id
92
+ # @return [Element, NilClass]
93
+ model_attr :element, writable: true, comparison_attr: :id, default: nil, also_reference: [:diagram]
94
94
  # Archi format, selects the shape of element (for elements that can have two or more shapes)
95
95
  # @!attribute [r] child_type
96
- # @return [Int, NilClass]
97
- model_attr :child_type
96
+ # @return [Int, NilClass]
97
+ model_attr :child_type, default: nil
98
98
 
99
99
  # @!attribute [r] diagram
100
- # @return [Diagram, NilClass]
100
+ # @return [Diagram, NilClass]
101
101
  model_attr :diagram, comparison_attr: :no_compare
102
102
 
103
103
  # Node type to allow a Label in a Artifact. the "label" element holds the info for the @note.
@@ -106,43 +106,15 @@ module Archimate
106
106
  # conceptRef is a reference to an concept for this particular label, along with the attributeRef
107
107
  # which references the particular concept's part which this label represents.
108
108
  # @!attribute [r] concept_ref
109
- # @return [String]
110
- model_attr :concept_ref
109
+ # @return [String]
110
+ model_attr :concept_ref, default: nil
111
111
  # conceptRef is a reference to an concept for this particular label, along with the partRef
112
112
  # which references the particular concept's part which this label represents. If this attribute
113
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
114
  # the XPATH statement is meant to be interpreted in the context of what the conceptRef points to.
115
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
141
-
142
- def replace(entity, with_entity)
143
- @element = with_entity if element.id == entity.id
144
- @view_refs = with_entity if view_refs == entity
145
- end
116
+ # @return [String, NilClass]
117
+ model_attr :xpath_path, default: nil
146
118
 
147
119
  def to_s
148
120
  "ViewNode[#{name || ''}](#{element if element})"
@@ -165,7 +137,7 @@ module Archimate
165
137
  end
166
138
 
167
139
  def referenced_identified_nodes
168
- (nodes + connections).reduce(
140
+ (nodes.to_ary + connections).reduce(
169
141
  [element]
170
142
  .compact
171
143
  ) do |a, e|
@@ -4,60 +4,45 @@ module Archimate
4
4
  module DataModel
5
5
  class Viewpoint
6
6
  include Comparison
7
+ include Referenceable
7
8
 
8
9
  # @!attribute [r] id
9
- # @return [String]
10
+ # @return [String]
10
11
  model_attr :id
11
12
  # @!attribute [r] name
12
- # @return [LangString]
13
+ # @return [LangString]
13
14
  model_attr :name
14
15
  # @!attribute [r] documentation
15
- # @return [PreservedLangString]
16
- model_attr :documentation
16
+ # @return [PreservedLangString]
17
+ model_attr :documentation, default: nil
17
18
  # # @!attribute [r] other_elements
18
- # @return [Array<AnyElement>]
19
- model_attr :other_elements
19
+ # @return [Array<AnyElement>]
20
+ model_attr :other_elements, default: []
20
21
  # # @!attribute [r] other_attributes
21
- # @return [Array<AnyAttribute>]
22
- model_attr :other_attributes
22
+ # @return [Array<AnyAttribute>]
23
+ model_attr :other_attributes, default: []
23
24
  # type here was used for the Element/Relationship/Diagram type
24
25
  # @!attribute [r] type
25
- # @return [String, NilClass]
26
- model_attr :type
26
+ # @return [String, NilClass]
27
+ model_attr :type, default: nil
27
28
  # @!attribute [r] concerns
28
- # @return [Array<Concern>]
29
- model_attr :concerns
29
+ # @return [Array<Concern>]
30
+ model_attr :concerns, default: []
30
31
  # @!attribute [r] viewpoint_purposes
31
- # @return [Array<ViewpointPurposeEnum>]
32
- model_attr :viewpoint_purposes
32
+ # @return [Array<ViewpointPurposeEnum>]
33
+ model_attr :viewpoint_purposes, default: []
33
34
  # @!attribute [r] viewpoint_contents
34
- # @return [Array<ViewpointContentEnum>]
35
- model_attr :viewpoint_contents
35
+ # @return [Array<ViewpointContentEnum>]
36
+ model_attr :viewpoint_contents, default: []
36
37
  # @!attribute [r] allowed_element_types
37
- # @return [Array<ElementType>]
38
- model_attr :allowed_element_types
38
+ # @return [Array<ElementType>]
39
+ model_attr :allowed_element_types, default: []
39
40
  # @!attribute [r] allowed_relationship_types
40
- # @return [Array<RelationshipType>]
41
- model_attr :allowed_relationship_types
41
+ # @return [Array<Relationships::*>]
42
+ model_attr :allowed_relationship_types, default: []
42
43
  # @!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
44
+ # @return [Array<ModelingNote>]
45
+ model_attr :modeling_notes, default: []
61
46
  end
62
47
  end
63
48
  end