Class: RTM::Axes::Topic

Inherits:
ItemProxy show all
Defined in:
rtm/lib/rtm/axes.rb,
rtm/lib/rtm/axes/topic.rb,
rtm/spec/rtm/axes/topic_spec.rb

Overview

--- RTM::Axes::Topic ---------------------------#

Instance Method Summary

Methods inherited from Proxy

#initialize

Constructor Details

This class inherits a constructor from RTM::Axes::Proxy

Instance Method Details

- (Object) characteristics(type = :any)

Returns all Names and Occurrences of this Topic. 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


22
23
24
25
# File 'rtm/lib/rtm/axes/topic.rb', line 22

def characteristics(type=:any)
  _res = @construct.characteristics(type).map{|r| r.axes}
  _res.extend(Characteristics)
end

- (Object) indicators

Returns all indicators (subject identifiers) of this Topic.

The result may be empty.

:call-seq:

  indicators -> Array of Strings


36
37
38
# File 'rtm/lib/rtm/axes/topic.rb', line 36

def indicators
  @construct.indicators #Array of Strings or empty
end

- (Object) instances Also known as: reverse_types

Returns the Topics which are instances of this Topic. Uses the TMAPI TypeInstanceIndex.

The result may be empty.

:call-seq:

  instances -> Array of Topics


223
224
225
226
# File 'rtm/lib/rtm/axes/topic.rb', line 223

def instances
  _res = @construct.instances.map{|r| r.axes}
  _res.extend(Topics)
end

- (Object) item

Returns one item identifier of this Topic or nil if this Topic has no item identifier.

:call-seq:

  item -> String or nil


48
49
50
# File 'rtm/lib/rtm/axes/topic.rb', line 48

def item
  @construct.item #String or nil
end

- (Object) locators

Returns all subject locators of this Topic.

The result may be empty.

:call-seq:

  locators -> Array of Strings


61
62
63
# File 'rtm/lib/rtm/axes/topic.rb', line 61

def locators
  @construct.locators #Array of Strings or empty
end

- (Object) reifier

Alias for the TMAPI function getReified. Returns the Construct which is reified by this Topic or nil if this Topic does not reify a Construct.

So far, only Associations, Names or Occurrences are returned.

:call-seq:

  reifier -> Association, Name, Occurrence or nil


96
97
98
99
100
101
102
103
# File 'rtm/lib/rtm/axes/topic.rb', line 96

def reifier
  #TODO: what if the reified construct is a Topic Map?
  _res = @construct.getReified # Name,Occ,Assoc or nil
  return RTM::Axes::Name.new(_res,@tm) if _res.is_a?(RTM::Name)
  return RTM::Axes::Occurrence.new(_res,@tm) if _res.is_a?(RTM::Occurrence)
  return RTM::Axes::Association.new(_res,@tm) if _res.is_a?(RTM::Association)
  return nil
end

- (Object) reverse_players(type = :any)

Returns all Associations in which this Topic plays 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


80
81
82
83
# File 'rtm/lib/rtm/axes/topic.rb', line 80

def reverse_players(type=:any)
  _res = @construct.reverse_players(type).map{|r| r.axes}
  _res.extend(Associations)
end

- (Object) reverse_roles

Returns all Associations that have Roles that have this Topic as Role type. Multiple instances of the same Association are possible.

The result may be empty.

:call-seq:

  reverse_roles -> Array of Associations


116
117
118
119
120
# File 'rtm/lib/rtm/axes/topic.rb', line 116

def reverse_roles
  _res = @tm.type_instance_index.getRoles(@construct).map {|r| r.getParent }
  _res = _res.map{|r| r.axes}
  _res.extend(Associations)
end

- (Object) reverse_scope

Returns all Associations, Names and Occurrences that include this Topic (theme) in their scope.

The result may be empty.

:call-seq:

  reverse_scope -> Array of Names, Associations and Occurrences


132
133
134
135
136
137
# File 'rtm/lib/rtm/axes/topic.rb', line 132

def reverse_scope
  _index = @tm.scoped_index
  _res = _index.names(@construct).to_a + _index.occurrences(@construct).to_a + _index.associations(@construct).to_a
  _res = _res.map{|r| r.axes}
  _res.extend(AssocsNamesOccs)
end

- (Object) reverse_traverse

Always returns an empty Array

:call-seq:

  reverse_traverse -> Array of Topics


195
196
197
198
# File 'rtm/lib/rtm/axes/topic.rb', line 195

def reverse_traverse
  _res = [] #HARDCODED
  _res.extend(Topics)
end

- (Object) subtypes Also known as: reverse_supertypes

Returns all subtypes of this Topic. 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


163
164
165
166
# File 'rtm/lib/rtm/axes/topic.rb', line 163

def subtypes
  _res = @construct.transitive_subtypes_with_self.map{|r| r.axes}
  _res.extend(Topics)
end

- (Object) supertypes Also known as: reverse_subtypes

Returns all supertypes of this Topic. 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


150
151
152
153
# File 'rtm/lib/rtm/axes/topic.rb', line 150

def supertypes
  _res = @construct.transitive_supertypes_with_self.map{|r| r.axes}
  _res.extend(Topics)
end

- (Object) traverse(type = :any)

First computes all Associations where this Topic playes a Role. There, the optional identifier filters the Associations for their type.

Returns all Players of all Roles in these Associations. The current 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


185
186
187
188
# File 'rtm/lib/rtm/axes/topic.rb', line 185

def traverse(type=:any)
  _res = @construct.traverse(type).map{|r| r.axes}
  _res.extend(Topics)
end

- (Object) types Also known as: reverse_instances

Returns the Topics this Topic is an instance of. Calls the TMAPI getTypes method.

The result may be empty.

:call-seq:

  types -> Array of Topics


210
211
212
213
# File 'rtm/lib/rtm/axes/topic.rb', line 210

def types
  _res = @construct.types.map{|r| r.axes}
  _res.extend(Topics)
end