[Dbix-class] complex relationships II

Benjamin Hitz hitz at genome.stanford.edu
Thu Sep 20 23:31:31 GMT 2007


>
> DBIx::Class::Feature->many_to_many(gos => 'go_annotations',  
> 'feature_no');
> DBIx::Class::Go_Annotation->many_to_many(references => 'go_refs',  
> 'go_annotation_no');

These I am sure I messed up.
In Go_Annotation.pm we have:
=================
__PACKAGE__->belongs_to("go_no", "DB::Mod::Go", { go_no => "go_no" });
__PACKAGE__->belongs_to(
   "feature_no",
   "DB::Mod::Feature",
   { feature_no => "feature_no" },
);

and
__PACKAGE__->has_many(
   "go_refs",
   "DB::Mod::Go_ref",
   { "foreign.go_annotation_no" => "self.go_annotation_no" },
);
================

So the above should be:

DBIx::Class::Feature->many_to_many(goes => 'go_annotations', 'go_no');
and



with
===========
__PACKAGE__->belongs_to(
   "reference_no",
   "DB::Mod::Reference",
   { reference_no => "reference_no" },
);
===========
In the Go_ref.pm module.

DBIx::Class::Go_annotation->many_to_many(references => 'go_refs',  
reference_no);

Still not sure if there is a tricky way to span directly from Feature- 
 >Reference via Go_annotation and Go_ref.

Maybe just make my own accessor call "go_references" in Feature.pm?

Thanks, and sorry for working this out myself via mailing list
Ben
--
Ben Hitz
Senior Scientific Programmer ** Saccharomyces Genome Database ** GO  
Consortium
Stanford University ** hitz at genome.stanford.edu






More information about the DBIx-Class mailing list