Sha256: 7721923f3fa0487dd3916feca7fda49312513375bdeab72fb7f9783650e2d6f6

Contents?: true

Size: 1.75 KB

Versions: 4

Compression:

Stored size: 1.75 KB

Contents

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

module RTM::AR::Sugar
  module Topic
    module PredefinedAssociations
      extend RTM::AR::TraverseAssociations    
      # maybe these pairs could be declared each with a single statement and a reversible option
      define_association :types, :type => :Topic, :rule => {
        :transitive => false,
        :role_type => RTM::PSI[:instance],
        :association_type => RTM::PSI[:type_instance],
        :association_arity => 2,
        :other_role_type => RTM::PSI[:type],
        :infer_other => :supertypes,
        :add => :type,
      }
      alias :addType :add_type

      define_association :instances, :type => :Topic, :rule => {
        :transitive => false,
        :role_type => RTM::PSI[:type],
        :association_type => RTM::PSI[:type_instance],
        :association_arity => 2,
        :other_role_type => RTM::PSI[:instance],
        :infer => :subtypes,
        :add => :instance,
      }
      alias :addInstance :add_instance

      define_association :supertypes, :type => :Topic, :rule => {
        :transitive => true,
        :role_type => RTM::PSI[:subtype],
        :association_type => RTM::PSI[:supertype_subtype],
        :association_arity => 2,
        :other_role_type => RTM::PSI[:supertype],
        :add => :supertype,
      }
      alias :addSupertype :add_supertype

      define_association :subtypes, :type => :Topic, :rule => {
        :transitive => true,
        :role_type => RTM::PSI[:supertype],
        :association_type => RTM::PSI[:supertype_subtype],
        :association_arity => 2,
        :other_role_type => RTM::PSI[:subtype],
        :add => :subtype,
      }
      alias :addSubtype :add_subtype

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rtm-activerecord-0.3.1 lib/rtm/activerecord/sugar/topic/predefined_associations.rb
rtm-activerecord-0.3.0 lib/rtm/activerecord/sugar/topic/predefined_associations.rb
rtm-activerecord-0.2.1 lib/rtm/activerecord/sugar/topic/predefined_associations.rb
rtm-activerecord-0.2.0 lib/rtm/activerecord/sugar/topic/predefined_associations.rb