Module: Archimate::DataModel::Relationships
- Defined in:
- lib/archimate/data_model/relationships.rb
Overview
Relationship Classifications: Structural, Dynamic, Dependency, Other
-
No relationships are allowed between two relationships
-
All relationships connected with relationship connectors must be of the same type
-
A chain of relationships of the same type that connects two elements, and is in turn connected via relationship connectors, is valid only if a direct relationship of that same type between those two elements is valid
-
A relationship connecting an element with a second relationship can only be an aggregation, composition, or association; aggregation or composition are valid only from a composite element to that second relationship
Aggregation, composition, and specialization relationships are always permitted between two elements of the same type, and association is always allowed between any two elements, and between any element and relationship.
Defined Under Namespace
Classes: Access, Aggregation, AndJunction, Assignment, Association, Composition, Flow, Influence, OrJunction, Realization, Serving, Specialization, Triggering
Class Method Summary collapse
- .===(other) ⇒ Object
- .classes ⇒ Object
- .create(*args) ⇒ Object
- .default ⇒ Object
- .str_filter(str) ⇒ Object
Class Method Details
.===(other) ⇒ Object
207 208 209 |
# File 'lib/archimate/data_model/relationships.rb', line 207 def self.===(other) constants.map(&:to_s).include?(str_filter(other)) end |
.classes ⇒ Object
222 223 224 |
# File 'lib/archimate/data_model/relationships.rb', line 222 def self.classes constants.map { |cls_name| const_get(cls_name) } end |
.create(*args) ⇒ Object
196 197 198 199 200 201 202 203 204 205 |
# File 'lib/archimate/data_model/relationships.rb', line 196 def self.create(*args) # type = args[0].delete(:type) # cls_name = type.strip.sub(/Relationship$/, '') # cls_name = RELATIONSHIP_SUBSTITUTIONS.fetch(cls_name, cls_name) cls_name = str_filter(args[0].delete(:type)) Relationships.const_get(cls_name).new(*args) rescue NameError => err Archimate::Logging.error "An invalid relationship type '#{cls_name}' was used to create a Relationship" raise err end |
.default ⇒ Object
226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/archimate/data_model/relationships.rb', line 226 def self.default [ Relationships::Access, Relationships::Aggregation, Relationships::Assignment, Relationships::Association, Relationships::Composition, Relationships::Flow, Relationships::Realization, Relationships::Specialization, Relationships::Triggering, Relationships::Serving ].freeze end |
.str_filter(str) ⇒ Object
211 212 213 214 215 216 217 218 219 220 |
# File 'lib/archimate/data_model/relationships.rb', line 211 def self.str_filter(str) relationship_substitutions = { "Realisation" => "Realization", "Specialisation" => "Specialization", "UsedBy" => "Serving" }.freeze cls_name = str.strip.sub(/Relationship$/, '') relationship_substitutions.fetch(cls_name, cls_name) end |