Sha256: 10e323f72df6be3045fb9d46bfb041f0c58979c173fc707994128c9f7ce12728

Contents?: true

Size: 2 KB

Versions: 4

Compression:

Stored size: 2 KB

Contents

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

module RTM::Axes

  class Association < ItemProxy

    # ---- players-axis ------------------------------------------------------#
    
    # Returns all Role players of Roles in this Association.
    #
    # The optional identifier specifies the type of the Roles to be considered.
    # The identifier may be a topic reference.
    #
    # Multiple instances of the same Topic are possible.
    # The result may be empty.
    #
    # :call-seq:
    #   players -> Array of Topics
    #   players(identifier) -> Array of Topics
    #
    def players(type=:any)
      _res = @construct.players(type).map{|r| r.axes}
      _res.extend(Topics)
    end

    # ---- reifier-axis ------------------------------------------------------#
    
    # Returns the reifing Topic or nil, if no such Topic exists.
    #
    # :call-seq:
    #   reverse_reified -> Topic or nil
    #
    def reverse_reifier
      _res = @construct.reifier #Topic or nil
      RTM::Axes::Topic.new(_res,@tm) if _res
    end

    # ---- roles-axis --------------------------------------------------------#
    
    # Returns all Topics that are types of Roles of this Association.
    # Multiple instances of the same Topic are possible.
    #
    # The result may be empty.
    #
    # :call-seq:
    #   roles -> Array of Topics
    #
    def roles
      _res = @construct.getRoles.map {|r| r.getType }
      _res = _res.map{|r| r.axes}
      _res.extend(Topics)
    end

    # ---- scope-axis --------------------------------------------------------#
    
    # Returns the scope of this Association.
    #
    # The result may be empty.
    #
    # :call-seq:
    #   scope -> Array of Topics
    #
    def scope
      _res = @construct.scope.map{|r| r.axes} #Array of Topics or empty Array
      _res.extend(Topics)
    end

#    # ---- traverse-axis -----------------------------------------------------#
#    #def reverse_traverse
#    #
#    #end


  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtm-0.3.1 lib/rtm/axes/association.rb
rtm-0.3.0 lib/rtm/axes/association.rb
rtm-0.2.1 lib/rtm/axes/association.rb
rtm-0.2 lib/rtm/axes/association.rb