Project

General

Profile

« Previous | Next » 

Revision 5627

schemas/vegbien.sql: Moved taxonlabel.concept_reference_id to new taxonconcept table, which is a subclass of taxonlabel that adds information about who the taxon concept is according to

View differences:

schemas/vegbien.my.sql
219 219
    taxonlabel_id int(11) NOT NULL,
220 220
    creator_id int(11) NOT NULL,
221 221
    sourceaccessioncode text,
222
    concept_reference_id int(11),
223 222
    creationdate date,
224 223
    taxonstatus text,
225 224
    canon_label_id int(11),
......
264 263

  
265 264

  
266 265
--
267
-- Name: COLUMN taxonlabel.concept_reference_id; Type: COMMENT; Schema: public; Owner: -
268
--
269

  
270

  
271

  
272

  
273
--
274 266
-- Name: COLUMN taxonlabel.creationdate; Type: COMMENT; Schema: public; Owner: -
275 267
--
276 268

  
......
2404 2396

  
2405 2397

  
2406 2398
--
2399
-- Name: taxonconcept; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2400
--
2401

  
2402
CREATE TABLE taxonconcept (
2403
    taxonlabel_id int(11) NOT NULL,
2404
    concept_reference_id int(11)
2405
);
2406

  
2407

  
2408
--
2409
-- Name: TABLE taxonconcept; Type: COMMENT; Schema: public; Owner: -
2410
--
2411

  
2412

  
2413

  
2414

  
2415
--
2416
-- Name: COLUMN taxonconcept.concept_reference_id; Type: COMMENT; Schema: public; Owner: -
2417
--
2418

  
2419

  
2420

  
2421

  
2422
--
2423
-- Name: taxonconcept_taxonlabel_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2424
--
2425

  
2426

  
2427

  
2428

  
2429
--
2430
-- Name: taxonconcept_taxonlabel_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2431
--
2432

  
2433

  
2434

  
2435

  
2436
--
2407 2437
-- Name: taxoncorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
2408 2438
--
2409 2439

  
......
2997 3027

  
2998 3028

  
2999 3029
--
3030
-- Name: taxonlabel_id; Type: DEFAULT; Schema: public; Owner: -
3031
--
3032

  
3033

  
3034

  
3035

  
3036
--
3000 3037
-- Name: taxoncorrelation_id; Type: DEFAULT; Schema: public; Owner: -
3001 3038
--
3002 3039

  
......
3523 3560

  
3524 3561

  
3525 3562
--
3563
-- Name: taxonconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3564
--
3565

  
3566
ALTER TABLE taxonconcept
3567
    ADD CONSTRAINT taxonconcept_pkey PRIMARY KEY (taxonlabel_id);
3568

  
3569

  
3570
--
3526 3571
-- Name: taxoncorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3527 3572
--
3528 3573

  
......
4891 4936

  
4892 4937

  
4893 4938
--
4939
-- Name: taxonconcept_concept_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4940
--
4941

  
4942

  
4943

  
4944

  
4945
--
4946
-- Name: taxonconcept_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4947
--
4948

  
4949
ALTER TABLE taxonconcept
4950
    ADD CONSTRAINT taxonconcept_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
4951

  
4952

  
4953
--
4894 4954
-- Name: taxoncorrelation_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4895 4955
--
4896 4956

  
......
4944 5004

  
4945 5005

  
4946 5006
--
4947
-- Name: taxonlabel_concept_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4948
--
4949

  
4950

  
4951

  
4952

  
4953
--
4954 5007
-- Name: taxonlabel_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4955 5008
--
4956 5009

  
schemas/vegbien.sql
537 537
    taxonlabel_id integer NOT NULL,
538 538
    creator_id integer NOT NULL,
539 539
    sourceaccessioncode text,
540
    concept_reference_id integer,
541 540
    creationdate date,
542 541
    taxonstatus taxonomic_status,
543 542
    canon_label_id integer,
......
558 557
    description text,
559 558
    accessioncode text,
560 559
    CONSTRAINT taxonlabel_matched_label_fit_fraction_range CHECK (((matched_label_fit_fraction >= (0)::double precision) AND (matched_label_fit_fraction <= (1)::double precision))),
561
    CONSTRAINT taxonlabel_required_key CHECK ((((((((sourceaccessioncode IS NOT NULL) OR (taxonepithet IS NOT NULL)) OR (identifyingtaxonomicname IS NOT NULL)) OR (taxonomicname IS NOT NULL)) OR (taxonomicnamewithauthor IS NOT NULL)) OR (morphospecies IS NOT NULL)) OR ((parent_id IS NOT NULL) AND (((concept_reference_id IS NOT NULL) OR (creationdate IS NOT NULL)) OR (author IS NOT NULL)))))
560
    CONSTRAINT taxonlabel_required_key CHECK ((((((((sourceaccessioncode IS NOT NULL) OR (taxonepithet IS NOT NULL)) OR (identifyingtaxonomicname IS NOT NULL)) OR (taxonomicname IS NOT NULL)) OR (taxonomicnamewithauthor IS NOT NULL)) OR (morphospecies IS NOT NULL)) OR ((parent_id IS NOT NULL) AND ((creationdate IS NOT NULL) OR (author IS NOT NULL)))))
562 561
);
563 562

  
564 563

  
......
592 591

  
593 592

  
594 593
--
595
-- Name: COLUMN taxonlabel.concept_reference_id; Type: COMMENT; Schema: public; Owner: -
596
--
597

  
598
COMMENT ON COLUMN taxonlabel.concept_reference_id IS 'The entity that defined the taxon concept. This is who the taxon label is according to.
599

  
600
Equivalent to "Name sec. x".';
601

  
602

  
603
--
604 594
-- Name: COLUMN taxonlabel.creationdate; Type: COMMENT; Schema: public; Owner: -
605 595
--
606 596

  
......
3103 3093

  
3104 3094

  
3105 3095
--
3096
-- Name: taxonconcept; Type: TABLE; Schema: public; Owner: -; Tablespace: 
3097
--
3098

  
3099
CREATE TABLE taxonconcept (
3100
    taxonlabel_id integer NOT NULL,
3101
    concept_reference_id integer
3102
);
3103

  
3104

  
3105
--
3106
-- Name: TABLE taxonconcept; Type: COMMENT; Schema: public; Owner: -
3107
--
3108

  
3109
COMMENT ON TABLE taxonconcept IS 'A circumscribed taxon concept. This extends taxonlabel with information about who the taxon concept is according to.';
3110

  
3111

  
3112
--
3113
-- Name: COLUMN taxonconcept.concept_reference_id; Type: COMMENT; Schema: public; Owner: -
3114
--
3115

  
3116
COMMENT ON COLUMN taxonconcept.concept_reference_id IS 'The entity that defined the taxon concept. This is who the taxon concept is according to.
3117

  
3118
Equivalent to "Name sec. x".';
3119

  
3120

  
3121
--
3122
-- Name: taxonconcept_taxonlabel_id_seq; Type: SEQUENCE; Schema: public; Owner: -
3123
--
3124

  
3125
CREATE SEQUENCE taxonconcept_taxonlabel_id_seq
3126
    START WITH 1
3127
    INCREMENT BY 1
3128
    NO MINVALUE
3129
    NO MAXVALUE
3130
    CACHE 1;
3131

  
3132

  
3133
--
3134
-- Name: taxonconcept_taxonlabel_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
3135
--
3136

  
3137
ALTER SEQUENCE taxonconcept_taxonlabel_id_seq OWNED BY taxonconcept.taxonlabel_id;
3138

  
3139

  
3140
--
3106 3141
-- Name: taxoncorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
3107 3142
--
3108 3143

  
......
3746 3781

  
3747 3782

  
3748 3783
--
3784
-- Name: taxonlabel_id; Type: DEFAULT; Schema: public; Owner: -
3785
--
3786

  
3787
ALTER TABLE taxonconcept ALTER COLUMN taxonlabel_id SET DEFAULT nextval('taxonconcept_taxonlabel_id_seq'::regclass);
3788

  
3789

  
3790
--
3749 3791
-- Name: taxoncorrelation_id; Type: DEFAULT; Schema: public; Owner: -
3750 3792
--
3751 3793

  
......
4272 4314

  
4273 4315

  
4274 4316
--
4317
-- Name: taxonconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4318
--
4319

  
4320
ALTER TABLE ONLY taxonconcept
4321
    ADD CONSTRAINT taxonconcept_pkey PRIMARY KEY (taxonlabel_id);
4322

  
4323

  
4324
--
4275 4325
-- Name: taxoncorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
4276 4326
--
4277 4327

  
......
4779 4829
-- Name: taxonlabel_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4780 4830
--
4781 4831

  
4782
CREATE UNIQUE INDEX taxonlabel_unique ON taxonlabel USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(taxonepithet, '\\N'::text)), (COALESCE(rank, 'unknown'::taxonrank)), creator_id, (COALESCE(sourceaccessioncode, '\\N'::text)), (COALESCE(concept_reference_id, 2147483647)), (COALESCE(creationdate, 'infinity'::date)), (COALESCE(identifyingtaxonomicname, '\\N'::text)), (COALESCE(taxonomicname, '\\N'::text)), (COALESCE(author, '\\N'::text)), (COALESCE(taxonomicnamewithauthor, '\\N'::text)), (COALESCE(morphospecies, '\\N'::text)));
4832
CREATE UNIQUE INDEX taxonlabel_unique ON taxonlabel USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(taxonepithet, '\\N'::text)), (COALESCE(rank, 'unknown'::taxonrank)), creator_id, (COALESCE(sourceaccessioncode, '\\N'::text)), (COALESCE(creationdate, 'infinity'::date)), (COALESCE(identifyingtaxonomicname, '\\N'::text)), (COALESCE(taxonomicname, '\\N'::text)), (COALESCE(author, '\\N'::text)), (COALESCE(taxonomicnamewithauthor, '\\N'::text)), (COALESCE(morphospecies, '\\N'::text)));
4783 4833

  
4784 4834

  
4785 4835
--
......
5671 5721

  
5672 5722

  
5673 5723
--
5724
-- Name: taxonconcept_concept_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5725
--
5726

  
5727
ALTER TABLE ONLY taxonconcept
5728
    ADD CONSTRAINT taxonconcept_concept_reference_id_fkey FOREIGN KEY (concept_reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5729

  
5730

  
5731
--
5732
-- Name: taxonconcept_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5733
--
5734

  
5735
ALTER TABLE ONLY taxonconcept
5736
    ADD CONSTRAINT taxonconcept_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
5737

  
5738

  
5739
--
5674 5740
-- Name: taxoncorrelation_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5675 5741
--
5676 5742

  
......
5727 5793

  
5728 5794

  
5729 5795
--
5730
-- Name: taxonlabel_concept_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5731
--
5732

  
5733
ALTER TABLE ONLY taxonlabel
5734
    ADD CONSTRAINT taxonlabel_concept_reference_id_fkey FOREIGN KEY (concept_reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
5735

  
5736

  
5737
--
5738 5796
-- Name: taxonlabel_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5739 5797
--
5740 5798

  

Also available in: Unified diff