Project

General

Profile

« Previous | Next » 

Revision 5225

schemas/vegbien.sql: Renamed taxonpath -> taxonconcept as part of taxonomic schema refactoring at <https://projects.nceas.ucsb.edu/nceas/projects/bien/wiki/2012-10-03_conference_call#Taxonomic-schema-refactoring>

View differences:

vegbien.my.sql
103 103

  
104 104

  
105 105
--
106
-- Name: _set_canon_taxonpath(int(11), int(11)); Type: FUNCTION; Schema: public; Owner: -
106
-- Name: _set_canon_taxonconcept(int(11), int(11)); Type: FUNCTION; Schema: public; Owner: -
107 107
--
108 108

  
109 109

  
......
145 145

  
146 146

  
147 147
--
148
-- Name: taxonpath_canon_taxonpath_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
148
-- Name: taxonconcept_canon_taxonconcept_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
149 149
--
150 150

  
151 151

  
......
760 760

  
761 761

  
762 762
--
763
-- Name: taxondetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: 
763
-- Name: taxonconcept; Type: TABLE; Schema: public; Owner: -; Tablespace: 
764 764
--
765 765

  
766
CREATE TABLE taxondetermination (
767
    taxondetermination_id int(11) NOT NULL,
768
    taxonoccurrence_id int(11) NOT NULL,
769
    taxonpath_id int(11) NOT NULL,
770
    party_id int(11),
771
    role text DEFAULT 'unknown' NOT NULL,
772
    determinationtype text,
773
    reference_id int(11),
774
    isoriginal int(1) DEFAULT false NOT NULL,
775
    iscurrent int(1) DEFAULT false NOT NULL,
776
    taxonfit text,
777
    taxonconfidence text,
778
    grouptype text,
779
    notes text,
780
    notespublic int(1),
781
    notesmgt int(1),
782
    revisions int(1),
783
    determinationdate timestamp NULL,
766
CREATE TABLE taxonconcept (
767
    taxonconcept_id int(11) NOT NULL,
768
    datasource_id int(11) NOT NULL,
769
    identifyingtaxonomicname text,
770
    canon_taxonconcept_id int(11),
771
    taxon_id int(11),
772
    taxonomicname text,
773
    author text,
774
    taxonomicnamewithauthor text,
775
    domain text,
776
    kingdom text,
777
    phylum text,
778
    class text,
779
    `order` text,
780
    family text,
781
    genus text,
782
    species text,
783
    subspecies text,
784
    variety text,
785
    forma text,
786
    cultivar text,
787
    morphospecies text,
788
    otherranks text,
789
    scope_id int(11),
784 790
    accessioncode text
785 791
);
786 792

  
787 793

  
788 794
--
789
-- Name: TABLE taxondetermination; Type: COMMENT; Schema: public; Owner: -
795
-- Name: TABLE taxonconcept; Type: COMMENT; Schema: public; Owner: -
790 796
--
791 797

  
792 798

  
793 799

  
794 800

  
795 801
--
796
-- Name: taxonoccurrence; Type: TABLE; Schema: public; Owner: -; Tablespace: 
802
-- Name: COLUMN taxonconcept.identifyingtaxonomicname; Type: COMMENT; Schema: public; Owner: -
797 803
--
798 804

  
799
CREATE TABLE taxonoccurrence (
800
    taxonoccurrence_id int(11) NOT NULL,
801
    datasource_id int(11) NOT NULL,
802
    sourceaccessioncode text,
803
    locationevent_id int(11),
804
    authortaxoncode text,
805
    verbatimcollectorname text,
806
    growthform text,
807
    iscultivated int(1),
808
    cultivatedbasis text,
809
    isnative int(1),
810
    accessioncode text
811
);
812 805

  
813 806

  
807

  
814 808
--
815
-- Name: TABLE taxonoccurrence; Type: COMMENT; Schema: public; Owner: -
809
-- Name: COLUMN taxonconcept.canon_taxonconcept_id; Type: COMMENT; Schema: public; Owner: -
816 810
--
817 811

  
818 812

  
819 813

  
820 814

  
821 815
--
822
-- Name: COLUMN taxonoccurrence.iscultivated; Type: COMMENT; Schema: public; Owner: -
816
-- Name: COLUMN taxonconcept.taxon_id; Type: COMMENT; Schema: public; Owner: -
823 817
--
824 818

  
825 819

  
826 820

  
827 821

  
828 822
--
829
-- Name: COLUMN taxonoccurrence.cultivatedbasis; Type: COMMENT; Schema: public; Owner: -
823
-- Name: COLUMN taxonconcept.taxonomicname; Type: COMMENT; Schema: public; Owner: -
830 824
--
831 825

  
832 826

  
833 827

  
834 828

  
835 829
--
836
-- Name: COLUMN taxonoccurrence.isnative; Type: COMMENT; Schema: public; Owner: -
830
-- Name: COLUMN taxonconcept.author; Type: COMMENT; Schema: public; Owner: -
837 831
--
838 832

  
839 833

  
840 834

  
841 835

  
842 836
--
843
-- Name: taxonpath; Type: TABLE; Schema: public; Owner: -; Tablespace: 
837
-- Name: COLUMN taxonconcept.taxonomicnamewithauthor; Type: COMMENT; Schema: public; Owner: -
844 838
--
845 839

  
846
CREATE TABLE taxonpath (
847
    taxonpath_id int(11) NOT NULL,
848
    datasource_id int(11) NOT NULL,
849
    identifyingtaxonomicname text,
850
    canon_taxonpath_id int(11),
851
    taxon_id int(11),
852
    taxonomicname text,
853
    author text,
854
    taxonomicnamewithauthor text,
855
    domain text,
856
    kingdom text,
857
    phylum text,
858
    class text,
859
    `order` text,
860
    family text,
861
    genus text,
862
    species text,
863
    subspecies text,
864
    variety text,
865
    forma text,
866
    cultivar text,
867
    morphospecies text,
868
    otherranks text,
869
    scope_id int(11),
870
    accessioncode text
871
);
872 840

  
873 841

  
842

  
874 843
--
875
-- Name: TABLE taxonpath; Type: COMMENT; Schema: public; Owner: -
844
-- Name: COLUMN taxonconcept.domain; Type: COMMENT; Schema: public; Owner: -
876 845
--
877 846

  
878 847

  
879 848

  
880 849

  
881 850
--
882
-- Name: COLUMN taxonpath.identifyingtaxonomicname; Type: COMMENT; Schema: public; Owner: -
851
-- Name: COLUMN taxonconcept.kingdom; Type: COMMENT; Schema: public; Owner: -
883 852
--
884 853

  
885 854

  
886 855

  
887 856

  
888 857
--
889
-- Name: COLUMN taxonpath.canon_taxonpath_id; Type: COMMENT; Schema: public; Owner: -
858
-- Name: COLUMN taxonconcept.phylum; Type: COMMENT; Schema: public; Owner: -
890 859
--
891 860

  
892 861

  
893 862

  
894 863

  
895 864
--
896
-- Name: COLUMN taxonpath.taxon_id; Type: COMMENT; Schema: public; Owner: -
865
-- Name: COLUMN taxonconcept.class; Type: COMMENT; Schema: public; Owner: -
897 866
--
898 867

  
899 868

  
900 869

  
901 870

  
902 871
--
903
-- Name: COLUMN taxonpath.taxonomicname; Type: COMMENT; Schema: public; Owner: -
872
-- Name: COLUMN taxonconcept.`order`; Type: COMMENT; Schema: public; Owner: -
904 873
--
905 874

  
906 875

  
907 876

  
908 877

  
909 878
--
910
-- Name: COLUMN taxonpath.author; Type: COMMENT; Schema: public; Owner: -
879
-- Name: COLUMN taxonconcept.family; Type: COMMENT; Schema: public; Owner: -
911 880
--
912 881

  
913 882

  
914 883

  
915 884

  
916 885
--
917
-- Name: COLUMN taxonpath.taxonomicnamewithauthor; Type: COMMENT; Schema: public; Owner: -
886
-- Name: COLUMN taxonconcept.genus; Type: COMMENT; Schema: public; Owner: -
918 887
--
919 888

  
920 889

  
921 890

  
922 891

  
923 892
--
924
-- Name: COLUMN taxonpath.domain; Type: COMMENT; Schema: public; Owner: -
893
-- Name: COLUMN taxonconcept.species; Type: COMMENT; Schema: public; Owner: -
925 894
--
926 895

  
927 896

  
928 897

  
929 898

  
930 899
--
931
-- Name: COLUMN taxonpath.kingdom; Type: COMMENT; Schema: public; Owner: -
900
-- Name: COLUMN taxonconcept.subspecies; Type: COMMENT; Schema: public; Owner: -
932 901
--
933 902

  
934 903

  
935 904

  
936 905

  
937 906
--
938
-- Name: COLUMN taxonpath.phylum; Type: COMMENT; Schema: public; Owner: -
907
-- Name: COLUMN taxonconcept.variety; Type: COMMENT; Schema: public; Owner: -
939 908
--
940 909

  
941 910

  
942 911

  
943 912

  
944 913
--
945
-- Name: COLUMN taxonpath.class; Type: COMMENT; Schema: public; Owner: -
914
-- Name: COLUMN taxonconcept.forma; Type: COMMENT; Schema: public; Owner: -
946 915
--
947 916

  
948 917

  
949 918

  
950 919

  
951 920
--
952
-- Name: COLUMN taxonpath.`order`; Type: COMMENT; Schema: public; Owner: -
921
-- Name: COLUMN taxonconcept.cultivar; Type: COMMENT; Schema: public; Owner: -
953 922
--
954 923

  
955 924

  
956 925

  
957 926

  
958 927
--
959
-- Name: COLUMN taxonpath.family; Type: COMMENT; Schema: public; Owner: -
928
-- Name: COLUMN taxonconcept.morphospecies; Type: COMMENT; Schema: public; Owner: -
960 929
--
961 930

  
962 931

  
963 932

  
964 933

  
965 934
--
966
-- Name: COLUMN taxonpath.genus; Type: COMMENT; Schema: public; Owner: -
935
-- Name: COLUMN taxonconcept.otherranks; Type: COMMENT; Schema: public; Owner: -
967 936
--
968 937

  
969 938

  
970 939

  
971 940

  
972 941
--
973
-- Name: COLUMN taxonpath.species; Type: COMMENT; Schema: public; Owner: -
942
-- Name: COLUMN taxonconcept.scope_id; Type: COMMENT; Schema: public; Owner: -
974 943
--
975 944

  
976 945

  
977 946

  
978 947

  
979 948
--
980
-- Name: COLUMN taxonpath.subspecies; Type: COMMENT; Schema: public; Owner: -
949
-- Name: taxondetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: 
981 950
--
982 951

  
952
CREATE TABLE taxondetermination (
953
    taxondetermination_id int(11) NOT NULL,
954
    taxonoccurrence_id int(11) NOT NULL,
955
    taxonconcept_id int(11) NOT NULL,
956
    party_id int(11),
957
    role text DEFAULT 'unknown' NOT NULL,
958
    determinationtype text,
959
    reference_id int(11),
960
    isoriginal int(1) DEFAULT false NOT NULL,
961
    iscurrent int(1) DEFAULT false NOT NULL,
962
    taxonfit text,
963
    taxonconfidence text,
964
    grouptype text,
965
    notes text,
966
    notespublic int(1),
967
    notesmgt int(1),
968
    revisions int(1),
969
    determinationdate timestamp NULL,
970
    accessioncode text
971
);
983 972

  
984 973

  
985

  
986 974
--
987
-- Name: COLUMN taxonpath.variety; Type: COMMENT; Schema: public; Owner: -
975
-- Name: TABLE taxondetermination; Type: COMMENT; Schema: public; Owner: -
988 976
--
989 977

  
990 978

  
991 979

  
992 980

  
993 981
--
994
-- Name: COLUMN taxonpath.forma; Type: COMMENT; Schema: public; Owner: -
982
-- Name: taxonoccurrence; Type: TABLE; Schema: public; Owner: -; Tablespace: 
995 983
--
996 984

  
985
CREATE TABLE taxonoccurrence (
986
    taxonoccurrence_id int(11) NOT NULL,
987
    datasource_id int(11) NOT NULL,
988
    sourceaccessioncode text,
989
    locationevent_id int(11),
990
    authortaxoncode text,
991
    verbatimcollectorname text,
992
    growthform text,
993
    iscultivated int(1),
994
    cultivatedbasis text,
995
    isnative int(1),
996
    accessioncode text
997
);
997 998

  
998 999

  
999

  
1000 1000
--
1001
-- Name: COLUMN taxonpath.cultivar; Type: COMMENT; Schema: public; Owner: -
1001
-- Name: TABLE taxonoccurrence; Type: COMMENT; Schema: public; Owner: -
1002 1002
--
1003 1003

  
1004 1004

  
1005 1005

  
1006 1006

  
1007 1007
--
1008
-- Name: COLUMN taxonpath.morphospecies; Type: COMMENT; Schema: public; Owner: -
1008
-- Name: COLUMN taxonoccurrence.iscultivated; Type: COMMENT; Schema: public; Owner: -
1009 1009
--
1010 1010

  
1011 1011

  
1012 1012

  
1013 1013

  
1014 1014
--
1015
-- Name: COLUMN taxonpath.otherranks; Type: COMMENT; Schema: public; Owner: -
1015
-- Name: COLUMN taxonoccurrence.cultivatedbasis; Type: COMMENT; Schema: public; Owner: -
1016 1016
--
1017 1017

  
1018 1018

  
1019 1019

  
1020 1020

  
1021 1021
--
1022
-- Name: COLUMN taxonpath.scope_id; Type: COMMENT; Schema: public; Owner: -
1022
-- Name: COLUMN taxonoccurrence.isnative; Type: COMMENT; Schema: public; Owner: -
1023 1023
--
1024 1024

  
1025 1025

  
......
1030 1030
--
1031 1031

  
1032 1032
CREATE VIEW analytical_db_view AS
1033
    SELECT datasource.organizationname AS `dataSourceName`, taxonpath.family, taxonpath.genus, taxonpath.species, COALESCE(taxonpath.taxonomicnamewithauthor, taxonpath.taxonomicname) AS taxon, taxonpath.author AS `taxonAuthor`, taxonpath.variety AS `taxonMorphospecies`, placepath.country, placepath.stateprovince AS `stateProvince`, placepath.county AS `countyParish`, taxonoccurrence.verbatimcollectorname AS collector, plantobservation.collectionnumber AS `collectionNumber`, array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], CAST(' ' AS text)) AS `identifiedBy`, aggregateoccurrence.collectiondate AS `observationDate`, location.authorlocationcode AS `plotCode`, functions._m2_to_ha(location.area_m2) AS `plotAreaHa`, method.name AS `plotMethod`, locationcoords.latitude_deg AS latitude, locationcoords.longitude_deg AS longitude, location.elevation_m, taxonoccurrence.iscultivated AS `isCultivated`, taxonoccurrence.cultivatedbasis AS `isCultivatedReason`, functions._fraction_to_percent(aggregateoccurrence.cover_fraction) AS `pctCover` FROM (((((((((((((location JOIN party datasource ON (((datasource.party_id = location.datasource_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonpath USING (taxonpath_id)) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
1033
    SELECT datasource.organizationname AS `dataSourceName`, taxonconcept.family, taxonconcept.genus, taxonconcept.species, COALESCE(taxonconcept.taxonomicnamewithauthor, taxonconcept.taxonomicname) AS taxon, taxonconcept.author AS `taxonAuthor`, taxonconcept.variety AS `taxonMorphospecies`, placepath.country, placepath.stateprovince AS `stateProvince`, placepath.county AS `countyParish`, taxonoccurrence.verbatimcollectorname AS collector, plantobservation.collectionnumber AS `collectionNumber`, array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], CAST(' ' AS text)) AS `identifiedBy`, aggregateoccurrence.collectiondate AS `observationDate`, location.authorlocationcode AS `plotCode`, functions._m2_to_ha(location.area_m2) AS `plotAreaHa`, method.name AS `plotMethod`, locationcoords.latitude_deg AS latitude, locationcoords.longitude_deg AS longitude, location.elevation_m, taxonoccurrence.iscultivated AS `isCultivated`, taxonoccurrence.cultivatedbasis AS `isCultivatedReason`, functions._fraction_to_percent(aggregateoccurrence.cover_fraction) AS `pctCover` FROM (((((((((((((location JOIN party datasource ON (((datasource.party_id = location.datasource_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonconcept USING (taxonconcept_id)) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
1034 1034

  
1035 1035

  
1036 1036
--
......
1587 1587
CREATE TABLE methodtaxonclass (
1588 1588
    methodtaxonclass_id int(11) NOT NULL,
1589 1589
    method_id int(11) NOT NULL,
1590
    taxonpath_id int(11),
1590
    taxonconcept_id int(11),
1591 1591
    included int(1) NOT NULL,
1592 1592
    submethod_id int(11),
1593 1593
    taxonclass text
......
1843 1843
CREATE TABLE plantcorrelation (
1844 1844
    plantcorrelation_id int(11) NOT NULL,
1845 1845
    plantstatus_id int(11) NOT NULL,
1846
    taxonpath_id int(11) NOT NULL,
1846
    taxonconcept_id int(11) NOT NULL,
1847 1847
    plantconvergence text NOT NULL,
1848 1848
    correlationstart timestamp NOT NULL,
1849 1849
    correlationstop timestamp NULL
......
1909 1909

  
1910 1910
CREATE TABLE plantstatus (
1911 1911
    plantstatus_id int(11) NOT NULL,
1912
    taxonpath_id int(11) NOT NULL,
1912
    taxonconcept_id int(11) NOT NULL,
1913 1913
    party_id int(11),
1914
    taxonpathstatus text DEFAULT 'undetermined' NOT NULL,
1914
    taxonconceptstatus text DEFAULT 'undetermined' NOT NULL,
1915 1915
    reference_id int(11),
1916 1916
    plantpartycomments text,
1917 1917
    startdate timestamp NULL,
......
1941 1941
CREATE TABLE plantusage (
1942 1942
    plantusage_id int(11) NOT NULL,
1943 1943
    taxon_id int(11) NOT NULL,
1944
    taxonpath_id int(11),
1944
    taxonconcept_id int(11),
1945 1945
    taxonstatus text,
1946 1946
    taxon text,
1947 1947
    classsystem text,
......
2525 2525
CREATE TABLE taxonalt (
2526 2526
    taxonalt_id int(11) NOT NULL,
2527 2527
    taxondetermination_id int(11) NOT NULL,
2528
    taxonpath_id int(11) NOT NULL,
2528
    taxonconcept_id int(11) NOT NULL,
2529 2529
    taxonaltfit text,
2530 2530
    taxonaltconfidence text,
2531 2531
    taxonaltnotes text
......
2547 2547

  
2548 2548

  
2549 2549
--
2550
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2550
-- Name: taxonconcept_taxonconcept_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2551 2551
--
2552 2552

  
2553 2553

  
2554 2554

  
2555 2555

  
2556 2556
--
2557
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2557
-- Name: taxonconcept_taxonconcept_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2558 2558
--
2559 2559

  
2560 2560

  
2561 2561

  
2562 2562

  
2563 2563
--
2564
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2564
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2565 2565
--
2566 2566

  
2567 2567

  
2568 2568

  
2569 2569

  
2570 2570
--
2571
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2571
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2572 2572
--
2573 2573

  
2574 2574

  
2575 2575

  
2576 2576

  
2577 2577
--
2578
-- Name: taxonpath_taxonpath_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2578
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE; Schema: public; Owner: -
2579 2579
--
2580 2580

  
2581 2581

  
2582 2582

  
2583 2583

  
2584 2584
--
2585
-- Name: taxonpath_taxonpath_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2585
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
2586 2586
--
2587 2587

  
2588 2588

  
......
3100 3100

  
3101 3101

  
3102 3102
--
3103
-- Name: taxondetermination_id; Type: DEFAULT; Schema: public; Owner: -
3103
-- Name: taxonconcept_id; Type: DEFAULT; Schema: public; Owner: -
3104 3104
--
3105 3105

  
3106 3106

  
3107 3107

  
3108 3108

  
3109 3109
--
3110
-- Name: taxonoccurrence_id; Type: DEFAULT; Schema: public; Owner: -
3110
-- Name: taxondetermination_id; Type: DEFAULT; Schema: public; Owner: -
3111 3111
--
3112 3112

  
3113 3113

  
3114 3114

  
3115 3115

  
3116 3116
--
3117
-- Name: taxonpath_id; Type: DEFAULT; Schema: public; Owner: -
3117
-- Name: taxonoccurrence_id; Type: DEFAULT; Schema: public; Owner: -
3118 3118
--
3119 3119

  
3120 3120

  
......
3388 3388

  
3389 3389

  
3390 3390
--
3391
-- Name: methodtaxonclass_unique_taxonpath_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3391
-- Name: methodtaxonclass_unique_taxonconcept_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3392 3392
--
3393 3393

  
3394 3394
ALTER TABLE methodtaxonclass
3395
    ADD CONSTRAINT methodtaxonclass_unique_taxonpath_id UNIQUE (method_id, taxonpath_id);
3395
    ADD CONSTRAINT methodtaxonclass_unique_taxonconcept_id UNIQUE (method_id, taxonconcept_id);
3396 3396

  
3397 3397

  
3398 3398
--
......
3504 3504
--
3505 3505

  
3506 3506
ALTER TABLE plantstatus
3507
    ADD CONSTRAINT plantstatus_unique UNIQUE (taxonpath_id, party_id);
3507
    ADD CONSTRAINT plantstatus_unique UNIQUE (taxonconcept_id, party_id);
3508 3508

  
3509 3509

  
3510 3510
--
......
3668 3668

  
3669 3669

  
3670 3670
--
3671
-- Name: taxonconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3672
--
3673

  
3674
ALTER TABLE taxonconcept
3675
    ADD CONSTRAINT taxonconcept_pkey PRIMARY KEY (taxonconcept_id);
3676

  
3677

  
3678
--
3671 3679
-- Name: taxondetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3672 3680
--
3673 3681

  
......
3684 3692

  
3685 3693

  
3686 3694
--
3687
-- Name: taxonpath_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3688
--
3689

  
3690
ALTER TABLE taxonpath
3691
    ADD CONSTRAINT taxonpath_pkey PRIMARY KEY (taxonpath_id);
3692

  
3693

  
3694
--
3695 3695
-- Name: taxonscope_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
3696 3696
--
3697 3697

  
......
4098 4098

  
4099 4099

  
4100 4100
--
4101
-- Name: taxondetermination_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4101
-- Name: taxonconcept_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4102 4102
--
4103 4103

  
4104
CREATE UNIQUE INDEX taxondetermination_accessioncode_index ON taxondetermination  (accessioncode);
4104
CREATE UNIQUE INDEX taxonconcept_accessioncode_index ON taxonconcept  (accessioncode);
4105 4105

  
4106 4106

  
4107 4107
--
4108
-- Name: taxondetermination_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4108
-- Name: taxonconcept_unique_within_datasource_by_identifying_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4109 4109
--
4110 4110

  
4111 4111

  
4112 4112

  
4113 4113

  
4114 4114
--
4115
-- Name: taxonoccurrence_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4115
-- Name: taxonconcept_unique_within_datasource_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4116 4116
--
4117 4117

  
4118
CREATE UNIQUE INDEX taxonoccurrence_accessioncode_index ON taxonoccurrence  (accessioncode);
4119 4118

  
4120 4119

  
4120

  
4121 4121
--
4122
-- Name: taxonoccurrence_locationevent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4122
-- Name: taxondetermination_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4123 4123
--
4124 4124

  
4125
CREATE INDEX taxonoccurrence_locationevent ON taxonoccurrence  (locationevent_id);
4125
CREATE UNIQUE INDEX taxondetermination_accessioncode_index ON taxondetermination  (accessioncode);
4126 4126

  
4127 4127

  
4128 4128
--
4129
-- Name: taxonoccurrence_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4129
-- Name: taxondetermination_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4130 4130
--
4131 4131

  
4132 4132

  
4133 4133

  
4134 4134

  
4135 4135
--
4136
-- Name: taxonoccurrence_unique_within_locationevent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4136
-- Name: taxonoccurrence_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4137 4137
--
4138 4138

  
4139
CREATE UNIQUE INDEX taxonoccurrence_accessioncode_index ON taxonoccurrence  (accessioncode);
4139 4140

  
4140 4141

  
4141

  
4142 4142
--
4143
-- Name: taxonpath_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4143
-- Name: taxonoccurrence_locationevent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4144 4144
--
4145 4145

  
4146
CREATE UNIQUE INDEX taxonpath_accessioncode_index ON taxonpath  (accessioncode);
4146
CREATE INDEX taxonoccurrence_locationevent ON taxonoccurrence  (locationevent_id);
4147 4147

  
4148 4148

  
4149 4149
--
4150
-- Name: taxonpath_unique_within_datasource_by_identifying_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4150
-- Name: taxonoccurrence_unique_within_datasource; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4151 4151
--
4152 4152

  
4153 4153

  
4154 4154

  
4155 4155

  
4156 4156
--
4157
-- Name: taxonpath_unique_within_datasource_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4157
-- Name: taxonoccurrence_unique_within_locationevent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
4158 4158
--
4159 4159

  
4160 4160

  
......
4203 4203

  
4204 4204

  
4205 4205
--
4206
-- Name: taxonpath_canon_taxonpath_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
4206
-- Name: taxonconcept_canon_taxonconcept_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
4207 4207
--
4208 4208

  
4209 4209

  
......
4653 4653

  
4654 4654

  
4655 4655
--
4656
-- Name: methodtaxonclass_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4656
-- Name: methodtaxonclass_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4657 4657
--
4658 4658

  
4659 4659
ALTER TABLE methodtaxonclass
4660
    ADD CONSTRAINT methodtaxonclass_taxonpath_id_fkey FOREIGN KEY (taxonpath_id) REFERENCES taxonpath(taxonpath_id) ON UPDATE CASCADE ON DELETE CASCADE;
4660
    ADD CONSTRAINT methodtaxonclass_taxonconcept_id_fkey FOREIGN KEY (taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
4661 4661

  
4662 4662

  
4663 4663
--
......
4771 4771

  
4772 4772

  
4773 4773
--
4774
-- Name: plantcorrelation_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4774
-- Name: plantcorrelation_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4775 4775
--
4776 4776

  
4777 4777

  
......
4831 4831

  
4832 4832

  
4833 4833
--
4834
-- Name: plantstatus_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4834
-- Name: plantstatus_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4835 4835
--
4836 4836

  
4837 4837

  
......
4861 4861

  
4862 4862

  
4863 4863
--
4864
-- Name: plantusage_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4864
-- Name: plantusage_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
4865 4865
--
4866 4866

  
4867 4867

  
......
5052 5052

  
5053 5053

  
5054 5054
--
5055
-- Name: taxonalt_taxondetermination_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5055
-- Name: taxonalt_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5056 5056
--
5057 5057

  
5058 5058
ALTER TABLE taxonalt
5059
    ADD CONSTRAINT taxonalt_taxondetermination_id_fkey FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;
5059
    ADD CONSTRAINT taxonalt_taxonconcept_id_fkey FOREIGN KEY (taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5060 5060

  
5061 5061

  
5062 5062
--
5063
-- Name: taxonalt_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5063
-- Name: taxonalt_taxondetermination_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5064 5064
--
5065 5065

  
5066 5066
ALTER TABLE taxonalt
5067
    ADD CONSTRAINT taxonalt_taxonpath_id_fkey FOREIGN KEY (taxonpath_id) REFERENCES taxonpath(taxonpath_id) ON UPDATE CASCADE ON DELETE CASCADE;
5067
    ADD CONSTRAINT taxonalt_taxondetermination_id_fkey FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;
5068 5068

  
5069 5069

  
5070 5070
--
5071
-- Name: taxondetermination_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5071
-- Name: taxonconcept_canon_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5072 5072
--
5073 5073

  
5074
ALTER TABLE taxonconcept
5075
    ADD CONSTRAINT taxonconcept_canon_taxonconcept_id_fkey FOREIGN KEY (canon_taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5074 5076

  
5075 5077

  
5076

  
5077 5078
--
5078
-- Name: taxondetermination_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5079
-- Name: taxonconcept_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5079 5080
--
5080 5081

  
5081 5082

  
5082 5083

  
5083 5084

  
5084 5085
--
5085
-- Name: taxondetermination_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5086
-- Name: taxonconcept_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5086 5087
--
5087 5088

  
5088
ALTER TABLE taxondetermination
5089
    ADD CONSTRAINT taxondetermination_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
5089
ALTER TABLE taxonconcept
5090
    ADD CONSTRAINT taxonconcept_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES taxonscope(taxonscope_id) ON UPDATE CASCADE ON DELETE CASCADE;
5090 5091

  
5091 5092

  
5092 5093
--
5093
-- Name: taxondetermination_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5094
-- Name: taxonconcept_taxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5094 5095
--
5095 5096

  
5096
ALTER TABLE taxondetermination
5097
    ADD CONSTRAINT taxondetermination_taxonpath_id_fkey FOREIGN KEY (taxonpath_id) REFERENCES taxonpath(taxonpath_id) ON UPDATE CASCADE ON DELETE CASCADE;
5097
ALTER TABLE taxonconcept
5098
    ADD CONSTRAINT taxonconcept_taxon_id_fkey FOREIGN KEY (taxon_id) REFERENCES taxon(taxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
5098 5099

  
5099 5100

  
5100 5101
--
5101
-- Name: taxonoccurrence_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5102
-- Name: taxondetermination_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5102 5103
--
5103 5104

  
5104 5105

  
5105 5106

  
5106 5107

  
5107 5108
--
5108
-- Name: taxonoccurrence_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5109
-- Name: taxondetermination_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5109 5110
--
5110 5111

  
5111
ALTER TABLE taxonoccurrence
5112
    ADD CONSTRAINT taxonoccurrence_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5113 5112

  
5114 5113

  
5114

  
5115 5115
--
5116
-- Name: taxonpath_canon_taxonpath_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5116
-- Name: taxondetermination_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5117 5117
--
5118 5118

  
5119
ALTER TABLE taxonpath
5120
    ADD CONSTRAINT taxonpath_canon_taxonpath_id_fkey FOREIGN KEY (canon_taxonpath_id) REFERENCES taxonpath(taxonpath_id) ON UPDATE CASCADE ON DELETE CASCADE;
5119
ALTER TABLE taxondetermination
5120
    ADD CONSTRAINT taxondetermination_taxonconcept_id_fkey FOREIGN KEY (taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
5121 5121

  
5122 5122

  
5123 5123
--
5124
-- Name: taxonpath_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5124
-- Name: taxondetermination_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5125 5125
--
5126 5126

  
5127
ALTER TABLE taxondetermination
5128
    ADD CONSTRAINT taxondetermination_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
5127 5129

  
5128 5130

  
5129

  
5130 5131
--
5131
-- Name: taxonpath_scope_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5132
-- Name: taxonoccurrence_datasource_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5132 5133
--
5133 5134

  
5134
ALTER TABLE taxonpath
5135
    ADD CONSTRAINT taxonpath_scope_id_fkey FOREIGN KEY (scope_id) REFERENCES taxonscope(taxonscope_id) ON UPDATE CASCADE ON DELETE CASCADE;
5136 5135

  
5137 5136

  
5137

  
5138 5138
--
5139
-- Name: taxonpath_taxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5139
-- Name: taxonoccurrence_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
5140 5140
--
5141 5141

  
5142
ALTER TABLE taxonpath
5143
    ADD CONSTRAINT taxonpath_taxon_id_fkey FOREIGN KEY (taxon_id) REFERENCES taxon(taxon_id) ON UPDATE CASCADE ON DELETE CASCADE;
5142
ALTER TABLE taxonoccurrence
5143
    ADD CONSTRAINT taxonoccurrence_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;
5144 5144

  
5145 5145

  
5146 5146
--

Also available in: Unified diff