5 use Test::More 'no_plan'; # tests => 1;
11 -- The cvterm module design is based on the ontology
13 -- ================================================
15 -- ================================================
18 cv_id serial not null,
20 cvname varchar not null,
26 -- ================================================
28 -- ================================================
31 cvterm_id serial not null,
32 primary key (cvterm_id),
34 foreign key (cv_id) references cv (cv_id),
35 name varchar(255) not null,
38 foreign key (dbxref_id) references dbxref (dbxref_id),
40 unique(termname, cv_id)
42 create index cvterm_idx1 on cvterm (cv_id);
43 -- the primary dbxref for this term. Other dbxrefs may be cvterm_dbxref
44 -- The unique key on termname, termtype_id ensures that all terms are
45 -- unique within a given cv
48 -- ================================================
49 -- TABLE: cvrelationship
50 -- ================================================
52 create table cvrelationship (
53 cvrelationship_id serial not null,
54 primary key (cvrelationship_id),
55 reltype_id int not null,
56 foreign key (reltype_id) references cvterm (cvterm_id),
57 subjterm_id int not null,
58 foreign key (subjterm_id) references cvterm (cvterm_id),
59 objterm_id int not null,
60 foreign key (objterm_id) references cvterm (cvterm_id),
62 unique(reltype_id, subjterm_id, objterm_id)
64 create index cvrelationship_idx1 on cvrelationship (reltype_id);
65 create index cvrelationship_idx2 on cvrelationship (subjterm_id);
66 create index cvrelationship_idx3 on cvrelationship (objterm_id);
69 -- ================================================
71 -- ================================================
74 cvpath_id serial not null,
75 primary key (cvpath_id),
77 foreign key (reltype_id) references cvterm (cvterm_id),
78 subjterm_id int not null,
79 foreign key (subjterm_id) references cvterm (cvterm_id),
80 objterm_id int not null,
81 foreign key (objterm_id) references cvterm (cvterm_id),
83 foreign key (cv_id) references cv (cv_id),
86 unique (subjterm_id, objterm_id)
88 create index cvpath_idx1 on cvpath (reltype_id);
89 create index cvpath_idx2 on cvpath (subjterm_id);
90 create index cvpath_idx3 on cvpath (objterm_id);
91 create index cvpath_idx4 on cvpath (cv_id);
94 -- ================================================
95 -- TABLE: cvtermsynonym
96 -- ================================================
98 create table cvtermsynonym (
99 cvterm_id int not null,
100 foreign key (cvterm_id) references cvterm (cvterm_id),
101 termsynonym varchar(255) not null,
103 unique(cvterm_id, termsynonym)
105 create index cvterm_synonym_idx1 on cvterm_synonym (cvterm_id);
107 -- ================================================
108 -- TABLE: cvterm_dbxref
109 -- ================================================
111 create table cvterm_dbxref (
112 cvterm_dbxref_id serial not null,
113 primary key (cvterm_dbxref_id),
114 cvterm_id int not null,
115 foreign key (cvterm_id) references cvterm (cvterm_id),
116 dbxref_id int not null,
117 foreign key (dbxref_id) references dbxref (dbxref_id),
119 unique(cvterm_id, dbxref_id)
121 create index cvterm_dbxref_idx1 on cvterm_dbxref (cvterm_id);
122 create index cvterm_dbxref_idx2 on cvterm_dbxref (dbxref_id);
126 my $tr = SQL::Translator->new(
127 parser => "PostgreSQL",
131 ok( $tr->translate(\$create), 'Translate PG2My' );