Sha256: 5b3046d18f8359f96c4ce58754ac0901e77b3acf3194c81fca2d3871ebaced80

Contents?: true

Size: 1020 Bytes

Versions: 1

Compression:

Stored size: 1020 Bytes

Contents

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

module RTM::Sugar::TopicMap
  module Remove

    # Removes all variants, names, occurrences, roles, asssociations and
    # topics (esp. reifier) from this topic map.
    def clear
      set_reifier(nil)
        
      variants.to_a.each do |v|
        v.set_reifier(nil)
        v.remove
      end
               
      names.to_a.each do |n|
        n.set_reifier(nil)
        n.remove
      end
        
      occurrences.to_a.each do |o|
        o.set_reifier(nil)
        o.remove
      end
           
      roles.to_a.each do |r|
        r.set_reifier(nil)
        r.remove
      end
             
      associations.to_a.each do |a|
        a.set_reifier(nil)
        a.remove
      end

      types.to_a.each do |type|
        type.instances.to_a.each do |instance|
          instance.remove_type(type)
        end
      end

      topics.to_a.each do |t|
        t.remove
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rtm-0.3.0 lib/rtm/sugar/topic_map/remove.rb