# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module RTM::Sugar module TopicMap module Types # Returns all topics in this topic map that are used # as types of associations. # # :call-seq: # association_types -> Collection of Topics # def association_types type_instance_index.getAssociationTypes end # 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 # def association_types_sorted(by_what = :best_name) type_instance_index.getAssociationTypes.sort_by(&by_what) end # Returns the all Topics in this TopicMap that are used # as types of Roles. # # :call-seq: # role_types -> Collection of Topics # def role_types type_instance_index.getRoleTypes end # 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 # def role_types_sorted(by_what = :best_name) type_instance_index.getRoleTypes.sort_by(&by_what) end # Returns all Topics in this TopicMap that are used # as types of Names. # # :call-seq: # name_types -> Collection of Topics # def name_types type_instance_index.getNameTypes end # 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 # def name_types_sorted(by_what = :best_name) type_instance_index.getNameTypes.sort_by(&by_what) end # Returns all Topics in this TopicMap that are used # as types of Occurrences. # # :call-seq: # occurrence_types -> Collection of Topics # def occurrence_types type_instance_index.getOccurrenceTypes end # 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 # def occurrence_types_sorted(by_what = :best_name) type_instance_index.getOccurrenceTypes.sort_by(&by_what) end # Returns all Topics that are no type of any kind 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 end end end