One-to-many relationships

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

One-to-many relationships

Alex Batchelor
Hi,

My data model has a one-to-many relationship with a gene having a
collection of alleles but an allele having a reference to one gene.

This is the relevant part from my genomic_model.xml:


<class name="Gene" extends="SequenceFeature" is-interface="true">
<collection name="artificialAlleles" referenced-type="ArtificialAllele"
reverse-reference="gene"/>
</class>

<class name="ArtificialAllele" is-interface="true">
<reference name="gene" referenced-type="Gene"
reverse-reference="artificialAlleles"/>
</class>


The column geneid in the artificialallele table is not filled in.  When
I view the data in the webapp, I cannot see which alleles belong to a
gene or which gene belongs to an allele.

However, when I make the relationship many-to-many by changing the data
model to this:


<class name="Gene" extends="SequenceFeature" is-interface="true">
<collection name="artificialAlleles" referenced-type="ArtificialAllele"
reverse-reference="gene"/>
</class>

<class name="ArtificialAllele" is-interface="true">
<collection name="gene" referenced-type="Gene"
reverse-reference="artificialAlleles"/>
</class>


A linking table artificialallelegenes is produced and I can then see
which alleles belong to a gene or which gene belongs to an allele.  How
can I fix this?


Thanks

Alex Batchelor
(Thank you for your previous response, I found the intermine_sequence
table with my sequence data in).



--
 The Wellcome Trust Sanger Institute is operated by Genome Research
 Limited, a charity registered in England with number 1021457 and a
 company registered in England with number 2742969, whose registered
 office is 215 Euston Road, London, NW1 2BE.

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: One-to-many relationships

Julie Sullivan
Hi Alex,

It may be that you are populating the gene.artificialAlleles collection instead
of the artificialAllele.gene reference in your converter.

If you have a one-to-many relationship, you populate the reference not the
collection, the collection is ignored.  If you have a many-to-many relationship
you can populate either end and in fact shouldn't populate both ends.

Let me know if that wasn't the problem.

Cheers,
Julie

On 08/08/11 14:11, Alex Batchelor wrote:

> Hi,
>
> My data model has a one-to-many relationship with a gene having a collection of
> alleles but an allele having a reference to one gene.
>
> This is the relevant part from my genomic_model.xml:
>
>
> <class name="Gene" extends="SequenceFeature" is-interface="true">
> <collection name="artificialAlleles" referenced-type="ArtificialAllele"
> reverse-reference="gene"/>
> </class>
>
> <class name="ArtificialAllele" is-interface="true">
> <reference name="gene" referenced-type="Gene"
> reverse-reference="artificialAlleles"/>
> </class>
>
>
> The column geneid in the artificialallele table is not filled in. When I view
> the data in the webapp, I cannot see which alleles belong to a gene or which
> gene belongs to an allele.
>
> However, when I make the relationship many-to-many by changing the data model to
> this:
>
>
> <class name="Gene" extends="SequenceFeature" is-interface="true">
> <collection name="artificialAlleles" referenced-type="ArtificialAllele"
> reverse-reference="gene"/>
> </class>
>
> <class name="ArtificialAllele" is-interface="true">
> <collection name="gene" referenced-type="Gene"
> reverse-reference="artificialAlleles"/>
> </class>
>
>
> A linking table artificialallelegenes is produced and I can then see which
> alleles belong to a gene or which gene belongs to an allele. How can I fix this?
>
>
> Thanks
>
> Alex Batchelor
> (Thank you for your previous response, I found the intermine_sequence table with
> my sequence data in).
>
>
>

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev
Reply | Threaded
Open this post in threaded view
|

Re: One-to-many relationships

Vallejos, Andrew
In reply to this post by Alex Batchelor
Julie is right.  What you need to be doing is setting the single
reference, not the collection, so that's the error.  

So you should update your parser to set the ArtificialAllele.gene, not
Genes.artificialAlleles, if that makes sense.

-Andrew

-----Original Message-----
From: Alex Batchelor [mailto:[hidden email]]
Sent: Monday, August 08, 2011 8:40 AM
To: Vallejos, Andrew
Subject: Re: [InterMine Dev] One-to-many relationships

On 08/08/11 14:23, Vallejos, Andrew wrote:
> In your first example when you load data are you setting the reference
> to the gene in the Artificial Allele, or are you setting the
references

> to the collection in the Gene?
>
> -Andrew
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On
> Behalf Of Alex Batchelor
> Sent: Monday, August 08, 2011 8:12 AM
> To: [hidden email]
> Subject: [InterMine Dev] One-to-many relationships
>
> Hi,
>
> My data model has a one-to-many relationship with a gene having a
> collection of alleles but an allele having a reference to one gene.
>
> This is the relevant part from my genomic_model.xml:
>
>
> <class name="Gene" extends="SequenceFeature" is-interface="true">
> <collection name="artificialAlleles"
referenced-type="ArtificialAllele"

> reverse-reference="gene"/>
> </class>
>
> <class name="ArtificialAllele" is-interface="true">
> <reference name="gene" referenced-type="Gene"
> reverse-reference="artificialAlleles"/>
> </class>
>
>
> The column geneid in the artificialallele table is not filled in.
When
> I view the data in the webapp, I cannot see which alleles belong to a
> gene or which gene belongs to an allele.
>
> However, when I make the relationship many-to-many by changing the
data
> model to this:
>
>
> <class name="Gene" extends="SequenceFeature" is-interface="true">
> <collection name="artificialAlleles"
referenced-type="ArtificialAllele"

> reverse-reference="gene"/>
> </class>
>
> <class name="ArtificialAllele" is-interface="true">
> <collection name="gene" referenced-type="Gene"
> reverse-reference="artificialAlleles"/>
> </class>
>
>
> A linking table artificialallelegenes is produced and I can then see
> which alleles belong to a gene or which gene belongs to an allele.
How

> can I fix this?
>
>
> Thanks
>
> Alex Batchelor
> (Thank you for your previous response, I found the intermine_sequence
> table with my sequence data in).
>
>
>
> setting the references
> to the collection in the Gene?
I am setting the references to the collection in Gene, so the
intermine-xml file holding my data looks like this:

<item id="0_45638" class="Gene" implements="">
<collection name="artificialAlleles">
<reference ref_id="0_4334" />
<reference ref_id="0_10798" />
</collection>
</item>

Thanks

Alex



--
 The Wellcome Trust Sanger Institute is operated by Genome Research
 Limited, a charity registered in England with number 1021457 and a
 company registered in England with number 2742969, whose registered
 office is 215 Euston Road, London, NW1 2BE.

_______________________________________________
dev mailing list
[hidden email]
http://mail.intermine.org/cgi-bin/mailman/listinfo/dev