Skip to content

Instantly share code, notes, and snippets.

@rtirrell
Created July 1, 2010 03:38
Show Gist options
  • Save rtirrell/459540 to your computer and use it in GitHub Desktop.
Save rtirrell/459540 to your computer and use it in GitHub Desktop.
#class GEO
# def self.inherited(subclass)
# subclass.class_eval do
# include DataMapper::Resource
# def self.default_repository_name; :expr_geo; end
# end
# end
#end
#
#class GSE < GEO
# storage_names[:expr_geo] = "gse_list"
# property :gse, Integer, :key => true
#
# has n, :gse_gsms, "GSEGSM", :child_key => [:gse], :parent_key => [:gse]
# has n, :gsm_objects, "GSM", :through => :gse_gsm
#
#end
#
#class GSEGSM < GEO
# storage_names[:expr_geo] = "gse_gsm"
# property :gse, Integer, :key => true
# belongs_to :gse_object, "GSE", :child_key => [:gse], :parent_key => [:gse], :key => true
# belongs_to :gsm_object, "GSM", :child_key => [:gsm], :parent_key => [:gsm], :key => true
#end
#
#class GSM < GEO
# storage_names[:expr_geo] = "gsm_list"
# property :gsm, Integer, :key => true
#
# has n, :gse_gsms, "GSEGSM", :child_key => [:gsm], :parent_key => [:gsm]
# has n, :gse_objects, "GSE", :through => :gse_gsm
#
#end
require "rubygems"
require "dm-core"
require "dm-migrations"
class GSE
include DataMapper::Resource
def self.default_repository_name; :expr_geo; end
storage_names[:expr_geo] = "gse_list"
property :gse, Integer, :key => true
has n, :gse_gsms, "GSEGSM", :child_key => [:gse], :parent_key => [:gse]
has n, :gsm_objects, "GSM", :through => :gse_gsm
end
class GSEGSM
include DataMapper::Resource
def self.default_repository_name; :expr_geo; end
storage_names[:expr_geo] = "gse_gsm"
belongs_to :gse_object, "GSE", :child_key => [:gse], :parent_key => [:gse], :key => true
belongs_to :gsm_object, "GSM", :child_key => [:gsm], :parent_key => [:gsm], :key => true
end
class GSM
include DataMapper::Resource
def self.default_repository_name; :expr_geo; end
storage_names[:expr_geo] = "gsm_list"
property :gsm, Integer, :key => true
has n, :gse_gsms, "GSEGSM", :child_key => [:gsm], :parent_key => [:gsm]
has n, :gse_objects, "GSE", :through => :gse_gsm
end
DataMapper.setup(:expr_geo, "sqlite3::memory:")
DataMapper.finalize
DataMapper.auto_migrate!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment