Sha256: 724bdebeb8cee1d4d5a0f6d03691cce547762de53bf1de5add942271b8adc6dc

Contents?: true

Size: 1.8 KB

Versions: 1

Compression:

Stored size: 1.8 KB

Contents

# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
# License:   Apache License, Version 2.0

module Sugar
  module Topic
    module Scoped
      
      # Returns the Associations, Names, Occurrences and Variants
      # whose scope contains this Topic. Beware: The scope of a Variant includes
      # the themes of the Name this Variant belongs to.
      #
      # :call-seq:
      #   scoped -> Array of Associations, Names, Occurrences and Variants
      #
      def scoped
        _index = topic_map.scoped_index
        _index.get_associations(self).to_a + _index.get_names(self).to_a + _index.get_occurrences(self).to_a + _index.get_variants(self).to_a
      end

      # Returns the Associations whose scope contains this Topic.
      #
      # The result may be empty.
      #
      # :call-seq:
      #   scoped_associations -> Array of Associations
      #
      def scoped_associations
        topic_map.scoped_index.get_associations(self).to_a
      end

      # Returns the Names whose scope contains this Topic.
      #
      # The result may be empty.
      #
      # :call-seq:
      #   scoped_names -> Array of Names
      #
      def scoped_names
        topic_map.scoped_index.get_names(self).to_a
      end

      # Returns the Occurrences whose scope contains this Topic.
      #
      # :call-seq:
      #   scoped_occurrences -> Array of Occurrences
      #
      def scoped_occurrences
        topic_map.scoped_index.get_occurrences(self).to_a
      end

      # Returns the Variants whose scope (including the scope of the parent Name)
      # contains this Topic.
      #
      # The result may be empty.
      #
      # :call-seq:
      #   scoped_variants -> Array of Variants
      #
      def scoped_variants
        topic_map.scoped_index.get_variants(self).to_a
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.2.0 lib/rtm/sugar/topic/scoped.rb