# Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig. # License: Apache License, Version 2.0 module RTM::Axes module Characteristics def self.extended(k) k.extend ArrayProxy end def result self.map{|i| i.construct} end alias :tmapi :result # ---- atomify-axis ------------------------------------------------------# # Returns the atomic values of these Characteristics. # # :call-seq: # atomify -> Array of Strings # def atomify #self = Array of TopicProxies #containee: RTM::Axes::Topic #send -> Array of (String or nil)s _res = self.inject([]){|all,containee| all << containee.send(:atomify)}.flatten _res = _res.select{|i| i} ### NO UNIQUE _res.extend(Strings) end # ---- characteristics-axis ----------------------------------------------# # Returns the Topics these Characteristics belong to. # The optional argument identifier filters the # Characteristics for their types. If the type # does not match, the Topic is not returned. # # The identifier may be a topic reference. # # :call-seq: # reverse_characteristics -> Array of Topic # reverse_characteristics(identifier) -> Array of Topic or empty Array # def reverse_characteristics(type=:any) _res = self.inject([]){|all,containee| all << containee.send(:reverse_characteristics,type)}.flatten _res = _res.select{|i| i} ### FLAG UNIQUE ### _res = _res.map{|i| i.construct}.uniq.map{|i| i.axes} ### ### _res.extend(Topics) end # ---- reifier-axis ------------------------------------------------------# # Returns the reifing Topics of these Characteristics only # if such Topics exists. # # The result may be empty. # # :call-seq: # reverse_reified -> Array of Topics # def reverse_reifier _res = self.inject([]){|all,containee| all << containee.send(:reverse_reifier)}.flatten _res = _res.select{|i| i} ### FLAG UNIQUE ### _res = _res.map{|i| i.construct}.uniq.map{|i| i.axes} ### ### _res.extend(Topics) end # ---- scope-axis --------------------------------------------------------# # Returns the scope of these Characteristics. # # The result may be empty. # # :call-seq: # scope -> Array of Topics # def scope _res = self.inject([]){|all,containee| all << containee.send(:scope)}.flatten ### FLAG UNIQUE ### _res = _res.map{|i| i.construct}.uniq.map{|i| i.axes} ### ### _res = _res.extend(Topics) _res end end end