Module: RTM::Sugar::TopicMap::Types

Defined in:
lib/rtm/sugar/topic_map/types.rb

Instance Method Summary collapse

Instance Method Details

#association_typesObject

Returns all topics in this topic map that are used as types of associations.

:call-seq:

association_types -> Collection of Topics


14
15
16
# File 'lib/rtm/sugar/topic_map/types.rb', line 14

def association_types
  type_instance_index.getAssociationTypes
end

#association_types_sorted(by_what = :best_name) ⇒ Object

Returns all topics in this topic map that are used as types of associations sorted by their best names.

:call-seq:

association_types -> Array of Topics sorted by their best names


24
25
26
# File 'lib/rtm/sugar/topic_map/types.rb', line 24

def association_types_sorted(by_what = :best_name)
  type_instance_index.getAssociationTypes.sort_by(&by_what)
end

#individualsObject

Returns all Topics that are no type of any kind



89
90
91
92
# File 'lib/rtm/sugar/topic_map/types.rb', line 89

def individuals
  all_types = types.to_a + association_types.to_a + role_types.to_a + name_types.to_a + occurrence_types.to_a
  topics.to_a - all_types
end

#name_typesObject

Returns all Topics in this TopicMap that are used as types of Names.

:call-seq:

name_types -> Collection of Topics


54
55
56
# File 'lib/rtm/sugar/topic_map/types.rb', line 54

def name_types
  type_instance_index.getNameTypes
end

#name_types_sorted(by_what = :best_name) ⇒ Object

Returns all Topics in this TopicMap that are used as types of Names sorted by their best names.

:call-seq:

name_types -> Array of Topics sorted by their best names


64
65
66
# File 'lib/rtm/sugar/topic_map/types.rb', line 64

def name_types_sorted(by_what = :best_name)
  type_instance_index.getNameTypes.sort_by(&by_what)
end

#occurrence_typesObject

Returns all Topics in this TopicMap that are used as types of Occurrences.

:call-seq:

occurrence_types -> Collection of Topics


74
75
76
# File 'lib/rtm/sugar/topic_map/types.rb', line 74

def occurrence_types
  type_instance_index.getOccurrenceTypes
end

#occurrence_types_sorted(by_what = :best_name) ⇒ Object

Returns all Topics in this TopicMap that are used as types of Occurrences sorted by their best names.

:call-seq:

occurrence_types -> Array of Topics sorted by their best names


84
85
86
# File 'lib/rtm/sugar/topic_map/types.rb', line 84

def occurrence_types_sorted(by_what = :best_name)
  type_instance_index.getOccurrenceTypes.sort_by(&by_what)
end

#role_typesObject

Returns the all Topics in this TopicMap that are used as types of Roles.

:call-seq:

role_types -> Collection of Topics


34
35
36
# File 'lib/rtm/sugar/topic_map/types.rb', line 34

def role_types
  type_instance_index.getRoleTypes
end

#role_types_sorted(by_what = :best_name) ⇒ Object

Returns the all Topics in this TopicMap that are used as types of Roles sorted by their best names.

:call-seq:

role_types -> Array of Topics sorted by their best names


44
45
46
# File 'lib/rtm/sugar/topic_map/types.rb', line 44

def role_types_sorted(by_what = :best_name)
  type_instance_index.getRoleTypes.sort_by(&by_what)
end