# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module RTM::Axes class String < ItemProxy # ---- atomify-axis ------------------------------------------------------# # Returns all Names and Occurrences which have # String as data value. If the String is found as value of a Variant, # the parent Name is returned. # # The result may be empty. # # :call-seq: # reverse_atomify -> Array of Names and Occurrences # def reverse_atomify index = @tm.literal_index names = index.getNames(@construct).to_a occs = index.getOccurrences(@construct).to_a variants = index.getVariants(@construct).to_a names2 = variants.map{|v| v.parent} _res = names + occs + names2 #could be empty _res = _res.map{|r| r.axes} _res.extend(Characteristics) end # ---- indicators-axis ---------------------------------------------------# # Returns the Topic which has this String as indicator (subject identifier) # or nil if no such Topic exists. # # :call-seq: # reverse_indicators -> Topic or nil # def reverse_indicators _res = @tm.get_topic_by_subject_identifier(@construct) #Topic or nil _res = RTM::Axes::Topic.new(_res,@tm) if _res return _res end # ---- item-axis ---------------------------------------------------------# # Returns one Topic which has this String as item identifer or nil # if no such Topic exists. # # :call-seq: # reverse_item -> Topic or nil # def reverse_item _res = @tm.get_construct_by_item_identifier(@construct) #Construct or nil TODO -> Topic return nil unless _res if _res.is_a?(RTM::Topic) return RTM::Axes::Topic.new(_res,@tm) else return nil end end # ---- locators-axis -----------------------------------------------------# # Returns the Topic which has this String as subject locator or nil # if no such Topic exists. # # :call-seq: # reverse_locators -> Topic or nil # def reverse_locators _res = @tm.get_topic_by_subject_locator(@construct) #Topic or nil _res = RTM::Axes::Topic.new(_res,@tm) if _res return _res #RTM::Axes::Topic or nil end end end