Module: RTM::Axes::Topics
- Defined in:
- lib/rtm/axes/topics.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#characteristics(type = :any) ⇒ Object
Returns all Names and Occurrences of these Topics.
-
#indicators ⇒ Object
Returns all indicators (subject identifiers) of these Topics.
-
#instances ⇒ Object
(also: #reverse_types)
Returns the Topics which are instances of these Topics.
-
#item ⇒ Object
Returns one item identifier for each of these Topics, only if if the Topic has an item identifier.
-
#locators ⇒ Object
Returns all subject locators of these Topics.
-
#reifier ⇒ Object
Returns the Constructs which are reified by one of these Topics only if such Constructs exist.
- #result ⇒ Object (also: #tmapi)
-
#reverse_players(type = :any) ⇒ Object
Returns all Associations in which these Topics play a Role.
-
#reverse_roles ⇒ Object
Returns all Associations that have Roles that have one of these Topics as Roletype.
-
#reverse_scope ⇒ Object
Returns all Associations, Names and Occurrences that include at least one of these Topics (themes) in their scope.
-
#reverse_traverse ⇒ Object
Always returns an empty Array.
-
#subtypes ⇒ Object
(also: #reverse_supertypes)
Returns all subtypes of all of these Topics.
-
#supertypes ⇒ Object
(also: #reverse_subtypes)
Returns all supertypes of all of these Topics.
-
#traverse(type = :any) ⇒ Object
First computes all Associations where these Topics play a Role.
-
#types ⇒ Object
(also: #reverse_instances)
Returns the Topics these Topics are instances of.
Class Method Details
.extended(k) ⇒ Object
7 8 9 |
# File 'lib/rtm/axes/topics.rb', line 7 def self.extended(k) k.extend ArrayProxy end |
Instance Method Details
#characteristics(type = :any) ⇒ Object
Returns all Names and Occurrences of these Topics. If an identifier is given, only those Names and Occurrences are returned, whose type or supertypes include the identifier.
Identifier may be a topic reference.
The result may be empty.
:call-seq:
characteristics -> Array of Names and Occurrences
characteristics(identifier) -> Array of Names and Occurrences
30 31 32 33 34 35 |
# File 'lib/rtm/axes/topics.rb', line 30 def characteristics(type=:any) _res = self.inject([]){|all,containee| all << containee.send(:characteristics,type)}.flatten ### NO UNIQUE NEEDED _res = _res.extend(Characteristics) _res end |
#indicators ⇒ Object
Returns all indicators (subject identifiers) of these Topics.
The result may be empty.
:call-seq:
indicators -> Array of Strings
46 47 48 49 50 51 52 |
# File 'lib/rtm/axes/topics.rb', line 46 def indicators #self = Array of TopicProxies #containee: RTM::Axes::Topic #send -> Array of Strings self.inject([]){|all,containee| all << containee.send(:indicators)}.flatten ### NO UNIQUE NEEDED end |
#instances ⇒ Object Also known as: reverse_types
Returns the Topics which are instances of these Topics. Uses the TMAPI TypeInstanceIndex.
The result may be empty.
:call-seq:
instances -> Array of Topics
267 268 269 270 271 272 273 274 |
# File 'lib/rtm/axes/topics.rb', line 267 def instances _res = self.inject([]){|all,containee| all << containee.send(:instances)}.flatten ### FLAG UNIQUE ### _res = _res.map{|i| i.construct}.uniq.map{|i| i.axes} ### ### _res.extend(Topics) _res end |
#item ⇒ Object
Returns one item identifier for each of these Topics, only if if the Topic has an item identifier.
The result may be an empty Array.
:call-seq:
item -> Array of Strings
64 65 66 67 68 69 70 71 |
# File 'lib/rtm/axes/topics.rb', line 64 def item #self = Array of TopicProxies #containee: RTM::Axes::Topic #send -> Array of (String or nil)s _res = self.inject([]){|all,containee| all << containee.send(:item)}.flatten _res = _res.select{|i| i} ### NO UNIQUE NEEDED end |
#locators ⇒ Object
Returns all subject locators of these Topics.
The result may be empty.
:call-seq:
locators -> Array of Strings
82 83 84 85 |
# File 'lib/rtm/axes/topics.rb', line 82 def locators self.inject([]){|all,containee| all << containee.send(:locators)}.flatten ### NO UNIQUE NEEDED end |
#reifier ⇒ Object
Returns the Constructs which are reified by one of these Topics only if such Constructs exist.
:call-seq:
reifier -> Array of Associations, Names and Occurrences
117 118 119 120 121 122 123 |
# File 'lib/rtm/axes/topics.rb', line 117 def reifier _res = self.inject([]){|all,containee| all << containee.send(:reifier)}.flatten _res = _res.select{|i| i} #reject nil ### NO UNIQUE NEEDED _res = _res.extend(AssocsNamesOccs) _res end |
#result ⇒ Object Also known as: tmapi
11 12 13 |
# File 'lib/rtm/axes/topics.rb', line 11 def result self.map{|i| i.construct} end |
#reverse_players(type = :any) ⇒ Object
Returns all Associations in which these Topics play a Role.
The optional identifier specifies the type of the Roles to be considered. The identifier may be a topic reference.
Multiple instances of the same Association are possible. The result may be empty.
:call-seq:
reverse_players -> Array of Associations
reverse_players(identifier) -> Array of Associations
102 103 104 105 106 107 |
# File 'lib/rtm/axes/topics.rb', line 102 def reverse_players(type=:any) _res = self.inject([]){|all,containee| all << containee.send(:reverse_players,type)}.flatten ### NO UNIQUE ### _res = _res.extend(Associations) _res end |
#reverse_roles ⇒ Object
Returns all Associations that have Roles that have one of these Topics as Roletype. Multiple instances of the same Association are possible.
The result may be empty.
:call-seq:
reverse_roles -> Array of Associations
136 137 138 139 140 141 |
# File 'lib/rtm/axes/topics.rb', line 136 def reverse_roles _res = self.inject([]){|all,containee| all << containee.send(:reverse_roles)}.flatten ### NO UNIQUE ### _res = _res.extend(Associations) _res end |
#reverse_scope ⇒ Object
Returns all Associations, Names and Occurrences that include at least one of these Topics (themes) in their scope.
The result may be empty.
:call-seq:
reverse_scope -> Array of Names, Associations and Occurrences
153 154 155 156 157 158 159 160 |
# File 'lib/rtm/axes/topics.rb', line 153 def reverse_scope _res = self.inject([]){|all,containee| all << containee.send(:reverse_scope)}.flatten ### FLAG UNIQUE ### _res = _res.map{|i| i.construct}.uniq.map{|i| i.axes} ### ### _res = _res.extend(AssocsNamesOccs) _res end |
#reverse_traverse ⇒ Object
Always returns an empty Array
:call-seq:
reverse_traverse -> Array of Topics
229 230 231 232 |
# File 'lib/rtm/axes/topics.rb', line 229 def reverse_traverse _res = [] #HARDCODED _res.extend(Topics) end |
#subtypes ⇒ Object Also known as: reverse_supertypes
Returns all subtypes of all of these Topics. The result includes the direct subtypes and the subtypes of these direct subtypes.
The result may be an empty Array.
:call-seq:
subtypes -> Array of Topics
191 192 193 194 195 196 197 198 |
# File 'lib/rtm/axes/topics.rb', line 191 def subtypes _res = self.inject([]){|all,containee| all << containee.send(:subtypes)}.flatten ### FLAG UNIQUE ### _res = _res.map{|i| i.construct}.uniq.map{|i| i.axes} ### ### _res = _res.extend(Topics) _res end |
#supertypes ⇒ Object Also known as: reverse_subtypes
Returns all supertypes of all of these Topics. The result includes all direct supertypes and the supertypes of these direct supertypes.
The result may be an empty Array.
:call-seq:
supertypes -> Array of Topics
173 174 175 176 177 178 179 180 181 |
# File 'lib/rtm/axes/topics.rb', line 173 def supertypes _res = self.define_helper(:supertypes) #_res = self.inject([]){|all,containee| all << containee.send(:supertypes)}.flatten ### FLAG UNIQUE ### _res = _res.map{|i| i.construct}.uniq.map{|i| i.axes} ### ### _res = _res.extend(Topics) _res end |
#traverse(type = :any) ⇒ Object
First computes all Associations where these Topics play a Role. There, the optional identifier filters the Associations for their type.
Returns all Players of all Roles in these Associations. Each Topic is deducted ones from the returned Array. The result may be empty.
The identifier may be a topic reference.
:call-seq:
traverse(identifier) -> Array of Topics
217 218 219 220 221 222 |
# File 'lib/rtm/axes/topics.rb', line 217 def traverse(type=:any) _res = self.inject([]){|all,containee| all << containee.send(:traverse,type)}.flatten ### NO UNIQUE ### _res = _res.extend(Topics) _res end |
#types ⇒ Object Also known as: reverse_instances
Returns the Topics these Topics are instances of. Calls the TMAPI getTypes method.
The result may be empty.
:call-seq:
types -> Array of Topics
244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/rtm/axes/topics.rb', line 244 def types #self = Array of TopicProxies #containee: RTM::Axes::Topic #send -> Array of TopicProxies #uniq -> Topics in Array, call unique on Array #convert to TopicProxies again #extend result-Array _res = self.inject([]){|all,containee| all << containee.send(:types)}.flatten ### FLAG UNIQUE ### _res = _res.map{|i| i.construct}.uniq.map{|i| i.axes} ### ### _res.extend(Topics) _res end |