[BioSQL-l] _removeSequence
Hilmar Lapp
hlapp at gnf.org
Mon Jun 20 15:57:56 EDT 2005
On Jun 20, 2005, at 8:20 AM, Martina wrote:
> Hi,
>
> so I have this new database (still biosqldb-mysql.sqlv 1.40 2004/11/04
> 01:49:41) and after removing all sequences, I do still have entries in
> term, term_relationship,term_relationship_term and ontology. And of
> course, in biodatabase. If I delete the entry in biodatabase too,
> nothing changes. Is that what is to be expected?
Yes. Deletes cascade through foreign key constraints and nothing else.
Term has a n:n relationship with bioentry and therefore does not have a
foreign key to bioentry.
More generally, and provided cascading deletes are enabled, if you
delete a row in a master table, all corresponding rows in detail tables
are deleted that stand in a 1:n relationship to the master table (and
therefore have a foreign key defined pointing to the master table).
Rows in n:n related tables will not be deleted, but dissociated by
deleting the corresponding rows from the association table. As
examples, Comment and Biosequence are 1:n related to bioentry, whereas
dbxref, reference, and term are n:n related, with bioentry_dbxref,
bioentry_reference, and bioentry_qualifier_value being the association
tables.
If this is confusing to you, you should read a general textbook on
relational databases and normalization which usually will explain this
a lot better than I do.
> Cause I still have trouble with the dublicate entry key, but that must
> be my code then.
Yes. When you insert a sequence you must be prepared that when
inserting its ontology term or tag/value annotation the term may
already be present because another bioentry uses it too. Similarly for
Reference and Dbxref (although I believe Biojava doesn't use these -
yet).
-hilmar
>
> Thanks
> Martina
> _______________________________________________
> BioSQL-l mailing list
> BioSQL-l at open-bio.org
> http://open-bio.org/mailman/listinfo/biosql-l
>
--
-------------------------------------------------------------
Hilmar Lapp email: lapp at gnf.org
GNF, San Diego, Ca. 92121 phone: +1-858-812-1757
-------------------------------------------------------------
More information about the BioSQL-l
mailing list