[BioSQL-l] adding a namespace for trees

Hilmar Lapp hlapp at gmx.net
Fri Jun 8 00:06:21 UTC 2007


We're doing some work for a small demonstration project here and we  
find that phylogenetic trees are data objects in their own rights,  
and in fact are often identifiable and come from a database, for  
example if they are from TreeBASE.

So I needed to add a namespace for trees in the form of a foreign key  
to biodatabase. Since namespaces that can't be relied upon are of  
little use, the foreign key is required, making this a fairly  
significant change.

Any thoughts or comments are welcome.

If anyone is using the phylogeny module already (the BioSQL core is  
completely unaffected by this), here's the migration path:

INSERT INTO biodatabase (name, description)
VALUES ('biosql_phylo','Default namespace for phylogenetic trees.');
ALTER TABLE tree ADD COLUMN biodatabase_id INTEGER;
UPDATE tree SET biodatabase_id = (
	SELECT biodatabase_id FROM biodatabase WHERE name = 'biosql_phylo'
);
ALTER TABLE tree ALTER COLUMN biodatabase SET NOT NULL;
ALTER TABLE tree ADD CONSTRAINT FKbiodatabase
        FOREIGN KEY (biodatabase_id) REFERENCES biodatabase  
(biodatabase_id);

Cheers,

	-hilmar
-- 
===========================================================
: Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
===========================================================








More information about the BioSQL-l mailing list