Revision 6497
Added by Aaron Marcuse-Kubitza about 12 years ago
schemas/vegbien.my.sql | ||
---|---|---|
402 | 402 |
|
403 | 403 |
|
404 | 404 |
-- |
405 |
-- Name: sync_darwin_core_to_view(); Type: FUNCTION; Schema: public; Owner: - |
|
406 |
-- |
|
407 |
|
|
408 |
|
|
409 |
|
|
410 |
|
|
411 |
-- |
|
405 | 412 |
-- Name: sync_geoscrub_input_to_view(); Type: FUNCTION; Schema: public; Owner: - |
406 | 413 |
-- |
407 | 414 |
|
... | ... | |
1893 | 1900 |
|
1894 | 1901 |
|
1895 | 1902 |
-- |
1903 |
-- Name: darwin_core; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1904 |
-- |
|
1905 |
|
|
1906 |
CREATE TABLE darwin_core ( |
|
1907 |
`institutionCode` varchar(255), |
|
1908 |
`subInstitutionCode` varchar(255), |
|
1909 |
`collectionCode` varchar(255), |
|
1910 |
`catalogNumber` varchar(255), |
|
1911 |
`occurrenceID` varchar(255), |
|
1912 |
country varchar(255), |
|
1913 |
`stateProvince` varchar(255), |
|
1914 |
county varchar(255), |
|
1915 |
`decimalLatitude` double precision, |
|
1916 |
`decimalLongitude` double precision, |
|
1917 |
`coordinateUncertaintyInMeters` double precision, |
|
1918 |
geovalid int(1), |
|
1919 |
`isNewWorld` int(1), |
|
1920 |
`projectID` int(11), |
|
1921 |
`plotName` varchar(255), |
|
1922 |
`elevationInMeters` double precision, |
|
1923 |
`plotArea_ha` double precision, |
|
1924 |
`samplingProtocol` varchar(255), |
|
1925 |
`dateCollected` date, |
|
1926 |
`higherPlantGroup` varchar(255), |
|
1927 |
family varchar(255), |
|
1928 |
genus varchar(255), |
|
1929 |
`speciesBinomial` varchar(255), |
|
1930 |
`scientificName` varchar(255), |
|
1931 |
`scientificNameAuthorship` varchar(255), |
|
1932 |
`speciesBinomialWithMorphospecies` varchar(255), |
|
1933 |
`scientificNameWithMorphospecies` varchar(255), |
|
1934 |
threatened int(1), |
|
1935 |
`identifiedBy` varchar(255), |
|
1936 |
`growthForm` varchar(255), |
|
1937 |
cultivated int(1), |
|
1938 |
`cultivatedBasis` varchar(255), |
|
1939 |
`recordedBy` varchar(255), |
|
1940 |
`recordNumber` varchar(255), |
|
1941 |
`coverPercent` double precision, |
|
1942 |
`diameterBreastHeight_cm` double precision, |
|
1943 |
height_m double precision, |
|
1944 |
tag varchar(255), |
|
1945 |
`organismX_m` double precision, |
|
1946 |
`organismY_m` double precision, |
|
1947 |
`taxonOccurrenceID` varchar(255), |
|
1948 |
`authorTaxonCode` varchar(255), |
|
1949 |
`individualID` varchar(255), |
|
1950 |
`authorStemCode` varchar(255) |
|
1951 |
); |
|
1952 |
|
|
1953 |
|
|
1954 |
-- |
|
1955 |
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1956 |
-- |
|
1957 |
|
|
1958 |
CREATE TABLE project ( |
|
1959 |
project_id int(11) NOT NULL, |
|
1960 |
source_id int(11) NOT NULL, |
|
1961 |
sourceaccessioncode varchar(255), |
|
1962 |
projectname varchar(255), |
|
1963 |
projectdescription varchar(255), |
|
1964 |
startdate date, |
|
1965 |
stopdate date, |
|
1966 |
accessioncode varchar(255) |
|
1967 |
); |
|
1968 |
|
|
1969 |
|
|
1970 |
-- |
|
1971 |
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1972 |
-- |
|
1973 |
|
|
1974 |
CREATE TABLE sourcename ( |
|
1975 |
sourcename_id int(11) NOT NULL, |
|
1976 |
source_id int(11) NOT NULL, |
|
1977 |
system varchar(255), |
|
1978 |
name varchar(255) NOT NULL, |
|
1979 |
matched_source_id int(11) |
|
1980 |
); |
|
1981 |
|
|
1982 |
|
|
1983 |
-- |
|
1984 |
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1985 |
-- |
|
1986 |
|
|
1987 |
CREATE TABLE specimenreplicate ( |
|
1988 |
specimenreplicate_id int(11) NOT NULL, |
|
1989 |
source_id int(11) NOT NULL, |
|
1990 |
sourceaccessioncode varchar(255), |
|
1991 |
plantobservation_id int(11), |
|
1992 |
institution_id int(11), |
|
1993 |
collectioncode_dwc varchar(255), |
|
1994 |
catalognumber_dwc varchar(255), |
|
1995 |
description varchar(255), |
|
1996 |
specimen_id int(11), |
|
1997 |
accessioncode varchar(255) |
|
1998 |
); |
|
1999 |
|
|
2000 |
|
|
2001 |
-- |
|
2002 |
-- Name: TABLE specimenreplicate; Type: COMMENT; Schema: public; Owner: - |
|
2003 |
-- |
|
2004 |
|
|
2005 |
|
|
2006 |
|
|
2007 |
|
|
2008 |
-- |
|
2009 |
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: - |
|
2010 |
-- |
|
2011 |
|
|
2012 |
|
|
2013 |
|
|
2014 |
|
|
2015 |
-- |
|
2016 |
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: - |
|
2017 |
-- |
|
2018 |
|
|
2019 |
|
|
2020 |
|
|
2021 |
|
|
2022 |
-- |
|
2023 |
-- Name: darwin_core_view; Type: VIEW; Schema: public; Owner: - |
|
2024 |
-- |
|
2025 |
|
|
2026 |
|
|
2027 |
|
|
2028 |
|
|
2029 |
-- |
|
1896 | 2030 |
-- Name: dba_preassignacccode_dba_requestnumber_seq; Type: SEQUENCE; Schema: public; Owner: - |
1897 | 2031 |
-- |
1898 | 2032 |
|
... | ... | |
2524 | 2658 |
|
2525 | 2659 |
|
2526 | 2660 |
-- |
2527 |
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
2528 |
-- |
|
2529 |
|
|
2530 |
CREATE TABLE project ( |
|
2531 |
project_id int(11) NOT NULL, |
|
2532 |
source_id int(11) NOT NULL, |
|
2533 |
sourceaccessioncode varchar(255), |
|
2534 |
projectname varchar(255), |
|
2535 |
projectdescription varchar(255), |
|
2536 |
startdate date, |
|
2537 |
stopdate date, |
|
2538 |
accessioncode varchar(255) |
|
2539 |
); |
|
2540 |
|
|
2541 |
|
|
2542 |
-- |
|
2543 | 2661 |
-- Name: project_project_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
2544 | 2662 |
-- |
2545 | 2663 |
|
... | ... | |
2769 | 2887 |
|
2770 | 2888 |
|
2771 | 2889 |
-- |
2772 |
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
2773 |
-- |
|
2774 |
|
|
2775 |
CREATE TABLE sourcename ( |
|
2776 |
sourcename_id int(11) NOT NULL, |
|
2777 |
source_id int(11) NOT NULL, |
|
2778 |
system varchar(255), |
|
2779 |
name varchar(255) NOT NULL, |
|
2780 |
matched_source_id int(11) |
|
2781 |
); |
|
2782 |
|
|
2783 |
|
|
2784 |
-- |
|
2785 | 2890 |
-- Name: sourcename_sourcename_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
2786 | 2891 |
-- |
2787 | 2892 |
|
... | ... | |
2838 | 2943 |
|
2839 | 2944 |
|
2840 | 2945 |
-- |
2841 |
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
2842 |
-- |
|
2843 |
|
|
2844 |
CREATE TABLE specimenreplicate ( |
|
2845 |
specimenreplicate_id int(11) NOT NULL, |
|
2846 |
source_id int(11) NOT NULL, |
|
2847 |
sourceaccessioncode varchar(255), |
|
2848 |
plantobservation_id int(11), |
|
2849 |
institution_id int(11), |
|
2850 |
collectioncode_dwc varchar(255), |
|
2851 |
catalognumber_dwc varchar(255), |
|
2852 |
description varchar(255), |
|
2853 |
specimen_id int(11), |
|
2854 |
accessioncode varchar(255) |
|
2855 |
); |
|
2856 |
|
|
2857 |
|
|
2858 |
-- |
|
2859 |
-- Name: TABLE specimenreplicate; Type: COMMENT; Schema: public; Owner: - |
|
2860 |
-- |
|
2861 |
|
|
2862 |
|
|
2863 |
|
|
2864 |
|
|
2865 |
-- |
|
2866 |
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: - |
|
2867 |
-- |
|
2868 |
|
|
2869 |
|
|
2870 |
|
|
2871 |
|
|
2872 |
-- |
|
2873 |
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: - |
|
2874 |
-- |
|
2875 |
|
|
2876 |
|
|
2877 |
|
|
2878 |
|
|
2879 |
-- |
|
2880 | 2946 |
-- Name: specimenreplicate_specimenreplicate_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
2881 | 2947 |
-- |
2882 | 2948 |
|
... | ... | |
3942 | 4008 |
|
3943 | 4009 |
|
3944 | 4010 |
-- |
4011 |
-- Data for Name: darwin_core; Type: TABLE DATA; Schema: public; Owner: - |
|
4012 |
-- |
|
4013 |
|
|
4014 |
|
|
4015 |
|
|
4016 |
-- |
|
3945 | 4017 |
-- Data for Name: definedvalue; Type: TABLE DATA; Schema: public; Owner: - |
3946 | 4018 |
-- |
3947 | 4019 |
|
... | ... | |
4932 | 5004 |
|
4933 | 5005 |
|
4934 | 5006 |
-- |
5007 |
-- Name: darwin_core_institutionCode_catalogNumber_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
5008 |
-- |
|
5009 |
|
|
5010 |
CREATE INDEX `darwin_core_institutionCode_catalogNumber_idx` ON darwin_core (`institutionCode`, `catalogNumber`); |
|
5011 |
|
|
5012 |
|
|
5013 |
-- |
|
5014 |
-- Name: darwin_core_institutionCode_occurrenceID_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
5015 |
-- |
|
5016 |
|
|
5017 |
CREATE INDEX `darwin_core_institutionCode_occurrenceID_idx` ON darwin_core (`institutionCode`, `occurrenceID`); |
|
5018 |
|
|
5019 |
|
|
5020 |
-- |
|
5021 |
-- Name: darwin_core_institutionCode_projectID_plotName_dateCollecte_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
5022 |
-- |
|
5023 |
|
|
5024 |
CREATE INDEX `darwin_core_institutionCode_projectID_plotName_dateCollecte_idx` ON darwin_core (`institutionCode`, `projectID`, `plotName`, `dateCollected`); |
|
5025 |
|
|
5026 |
|
|
5027 |
-- |
|
5028 |
-- Name: darwin_core_institutionCode_subInstitutionCode_collectionCo_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
5029 |
-- |
|
5030 |
|
|
5031 |
CREATE INDEX `darwin_core_institutionCode_subInstitutionCode_collectionCo_idx` ON darwin_core (`institutionCode`, `subInstitutionCode`, `collectionCode`, `catalogNumber`); |
|
5032 |
|
|
5033 |
|
|
5034 |
-- |
|
4935 | 5035 |
-- Name: graphic_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4936 | 5036 |
-- |
4937 | 5037 |
|
... | ... | |
6739 | 6839 |
|
6740 | 6840 |
|
6741 | 6841 |
-- |
6742 |
-- Name: definedvalue; Type: ACL; Schema: public; Owner: -
|
|
6842 |
-- Name: project; Type: ACL; Schema: public; Owner: -
|
|
6743 | 6843 |
-- |
6744 | 6844 |
|
6745 | 6845 |
|
... | ... | |
6749 | 6849 |
|
6750 | 6850 |
|
6751 | 6851 |
-- |
6752 |
-- Name: disturbanceobs; Type: ACL; Schema: public; Owner: -
|
|
6852 |
-- Name: sourcename; Type: ACL; Schema: public; Owner: -
|
|
6753 | 6853 |
-- |
6754 | 6854 |
|
6755 | 6855 |
|
... | ... | |
6759 | 6859 |
|
6760 | 6860 |
|
6761 | 6861 |
-- |
6762 |
-- Name: geoscrub_input; Type: ACL; Schema: public; Owner: -
|
|
6862 |
-- Name: specimenreplicate; Type: ACL; Schema: public; Owner: -
|
|
6763 | 6863 |
-- |
6764 | 6864 |
|
6765 | 6865 |
|
... | ... | |
6769 | 6869 |
|
6770 | 6870 |
|
6771 | 6871 |
-- |
6772 |
-- Name: geoscrub_input_view; Type: ACL; Schema: public; Owner: -
|
|
6872 |
-- Name: definedvalue; Type: ACL; Schema: public; Owner: -
|
|
6773 | 6873 |
-- |
6774 | 6874 |
|
6775 | 6875 |
|
... | ... | |
6779 | 6879 |
|
6780 | 6880 |
|
6781 | 6881 |
-- |
6782 |
-- Name: graphic; Type: ACL; Schema: public; Owner: -
|
|
6882 |
-- Name: disturbanceobs; Type: ACL; Schema: public; Owner: -
|
|
6783 | 6883 |
-- |
6784 | 6884 |
|
6785 | 6885 |
|
... | ... | |
6789 | 6889 |
|
6790 | 6890 |
|
6791 | 6891 |
-- |
6792 |
-- Name: higher_plant_group_nodes; Type: ACL; Schema: public; Owner: -
|
|
6892 |
-- Name: geoscrub_input; Type: ACL; Schema: public; Owner: -
|
|
6793 | 6893 |
-- |
6794 | 6894 |
|
6795 | 6895 |
|
... | ... | |
6799 | 6899 |
|
6800 | 6900 |
|
6801 | 6901 |
-- |
6802 |
-- Name: locationeventcontributor; Type: ACL; Schema: public; Owner: -
|
|
6902 |
-- Name: geoscrub_input_view; Type: ACL; Schema: public; Owner: -
|
|
6803 | 6903 |
-- |
6804 | 6904 |
|
6805 | 6905 |
|
... | ... | |
6809 | 6909 |
|
6810 | 6910 |
|
6811 | 6911 |
-- |
6812 |
-- Name: locationeventsynonym; Type: ACL; Schema: public; Owner: -
|
|
6912 |
-- Name: graphic; Type: ACL; Schema: public; Owner: -
|
|
6813 | 6913 |
-- |
6814 | 6914 |
|
6815 | 6915 |
|
... | ... | |
6819 | 6919 |
|
6820 | 6920 |
|
6821 | 6921 |
-- |
6822 |
-- Name: methodtaxonclass; Type: ACL; Schema: public; Owner: -
|
|
6922 |
-- Name: higher_plant_group_nodes; Type: ACL; Schema: public; Owner: -
|
|
6823 | 6923 |
-- |
6824 | 6924 |
|
6825 | 6925 |
|
... | ... | |
6829 | 6929 |
|
6830 | 6930 |
|
6831 | 6931 |
-- |
6832 |
-- Name: note; Type: ACL; Schema: public; Owner: -
|
|
6932 |
-- Name: locationeventcontributor; Type: ACL; Schema: public; Owner: -
|
|
6833 | 6933 |
-- |
6834 | 6934 |
|
6835 | 6935 |
|
... | ... | |
6839 | 6939 |
|
6840 | 6940 |
|
6841 | 6941 |
-- |
6842 |
-- Name: notelink; Type: ACL; Schema: public; Owner: -
|
|
6942 |
-- Name: locationeventsynonym; Type: ACL; Schema: public; Owner: -
|
|
6843 | 6943 |
-- |
6844 | 6944 |
|
6845 | 6945 |
|
... | ... | |
6849 | 6949 |
|
6850 | 6950 |
|
6851 | 6951 |
-- |
6852 |
-- Name: partymember; Type: ACL; Schema: public; Owner: -
|
|
6952 |
-- Name: methodtaxonclass; Type: ACL; Schema: public; Owner: -
|
|
6853 | 6953 |
-- |
6854 | 6954 |
|
6855 | 6955 |
|
... | ... | |
6859 | 6959 |
|
6860 | 6960 |
|
6861 | 6961 |
-- |
6862 |
-- Name: placecorrelation; Type: ACL; Schema: public; Owner: -
|
|
6962 |
-- Name: note; Type: ACL; Schema: public; Owner: -
|
|
6863 | 6963 |
-- |
6864 | 6964 |
|
6865 | 6965 |
|
... | ... | |
6869 | 6969 |
|
6870 | 6970 |
|
6871 | 6971 |
-- |
6872 |
-- Name: placename; Type: ACL; Schema: public; Owner: -
|
|
6972 |
-- Name: notelink; Type: ACL; Schema: public; Owner: -
|
|
6873 | 6973 |
-- |
6874 | 6974 |
|
6875 | 6975 |
|
... | ... | |
6879 | 6979 |
|
6880 | 6980 |
|
6881 | 6981 |
-- |
6882 |
-- Name: placename_ancestor; Type: ACL; Schema: public; Owner: -
|
|
6982 |
-- Name: partymember; Type: ACL; Schema: public; Owner: -
|
|
6883 | 6983 |
-- |
6884 | 6984 |
|
6885 | 6985 |
|
... | ... | |
6889 | 6989 |
|
6890 | 6990 |
|
6891 | 6991 |
-- |
6892 |
-- Name: plant; Type: ACL; Schema: public; Owner: -
|
|
6992 |
-- Name: placecorrelation; Type: ACL; Schema: public; Owner: -
|
|
6893 | 6993 |
-- |
6894 | 6994 |
|
6895 | 6995 |
|
... | ... | |
6899 | 6999 |
|
6900 | 7000 |
|
6901 | 7001 |
-- |
6902 |
-- Name: project; Type: ACL; Schema: public; Owner: -
|
|
7002 |
-- Name: placename; Type: ACL; Schema: public; Owner: -
|
|
6903 | 7003 |
-- |
6904 | 7004 |
|
6905 | 7005 |
|
... | ... | |
6909 | 7009 |
|
6910 | 7010 |
|
6911 | 7011 |
-- |
6912 |
-- Name: projectcontributor; Type: ACL; Schema: public; Owner: -
|
|
7012 |
-- Name: placename_ancestor; Type: ACL; Schema: public; Owner: -
|
|
6913 | 7013 |
-- |
6914 | 7014 |
|
6915 | 7015 |
|
... | ... | |
6919 | 7019 |
|
6920 | 7020 |
|
6921 | 7021 |
-- |
6922 |
-- Name: revision; Type: ACL; Schema: public; Owner: -
|
|
7022 |
-- Name: plant; Type: ACL; Schema: public; Owner: -
|
|
6923 | 7023 |
-- |
6924 | 7024 |
|
6925 | 7025 |
|
... | ... | |
6929 | 7029 |
|
6930 | 7030 |
|
6931 | 7031 |
-- |
6932 |
-- Name: soilsample; Type: ACL; Schema: public; Owner: -
|
|
7032 |
-- Name: projectcontributor; Type: ACL; Schema: public; Owner: -
|
|
6933 | 7033 |
-- |
6934 | 7034 |
|
6935 | 7035 |
|
... | ... | |
6939 | 7039 |
|
6940 | 7040 |
|
6941 | 7041 |
-- |
6942 |
-- Name: soiltaxon; Type: ACL; Schema: public; Owner: -
|
|
7042 |
-- Name: revision; Type: ACL; Schema: public; Owner: -
|
|
6943 | 7043 |
-- |
6944 | 7044 |
|
6945 | 7045 |
|
... | ... | |
6949 | 7049 |
|
6950 | 7050 |
|
6951 | 7051 |
-- |
6952 |
-- Name: sourcecontributor; Type: ACL; Schema: public; Owner: -
|
|
7052 |
-- Name: soilsample; Type: ACL; Schema: public; Owner: -
|
|
6953 | 7053 |
-- |
6954 | 7054 |
|
6955 | 7055 |
|
... | ... | |
6959 | 7059 |
|
6960 | 7060 |
|
6961 | 7061 |
-- |
6962 |
-- Name: sourcename; Type: ACL; Schema: public; Owner: -
|
|
7062 |
-- Name: soiltaxon; Type: ACL; Schema: public; Owner: -
|
|
6963 | 7063 |
-- |
6964 | 7064 |
|
6965 | 7065 |
|
... | ... | |
6969 | 7069 |
|
6970 | 7070 |
|
6971 | 7071 |
-- |
6972 |
-- Name: specimen; Type: ACL; Schema: public; Owner: -
|
|
7072 |
-- Name: sourcecontributor; Type: ACL; Schema: public; Owner: -
|
|
6973 | 7073 |
-- |
6974 | 7074 |
|
6975 | 7075 |
|
... | ... | |
6979 | 7079 |
|
6980 | 7080 |
|
6981 | 7081 |
-- |
6982 |
-- Name: specimenreplicate; Type: ACL; Schema: public; Owner: -
|
|
7082 |
-- Name: specimen; Type: ACL; Schema: public; Owner: - |
|
6983 | 7083 |
-- |
6984 | 7084 |
|
6985 | 7085 |
|
schemas/vegbien.sql | ||
---|---|---|
917 | 917 |
|
918 | 918 |
|
919 | 919 |
-- |
920 |
-- Name: sync_darwin_core_to_view(); Type: FUNCTION; Schema: public; Owner: - |
|
921 |
-- |
|
922 |
|
|
923 |
CREATE FUNCTION sync_darwin_core_to_view() RETURNS void |
|
924 |
LANGUAGE sql |
|
925 |
AS $$ |
|
926 |
DROP TABLE IF EXISTS darwin_core; |
|
927 |
CREATE TABLE darwin_core AS SELECT * FROM darwin_core_view; |
|
928 |
|
|
929 |
CREATE INDEX ON darwin_core ("institutionCode", "projectID", "plotName", "dateCollected" ); |
|
930 |
CREATE INDEX ON darwin_core ("institutionCode", "occurrenceID" ); |
|
931 |
CREATE INDEX ON darwin_core ("institutionCode", "subInstitutionCode", "collectionCode", "catalogNumber" ); |
|
932 |
CREATE INDEX ON darwin_core ("institutionCode", "catalogNumber" ); |
|
933 |
$$; |
|
934 |
|
|
935 |
|
|
936 |
-- |
|
920 | 937 |
-- Name: sync_geoscrub_input_to_view(); Type: FUNCTION; Schema: public; Owner: - |
921 | 938 |
-- |
922 | 939 |
|
... | ... | |
2713 | 2730 |
|
2714 | 2731 |
|
2715 | 2732 |
-- |
2733 |
-- Name: darwin_core; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
2734 |
-- |
|
2735 |
|
|
2736 |
CREATE TABLE darwin_core ( |
|
2737 |
"institutionCode" text, |
|
2738 |
"subInstitutionCode" text, |
|
2739 |
"collectionCode" text, |
|
2740 |
"catalogNumber" text, |
|
2741 |
"occurrenceID" text, |
|
2742 |
country text, |
|
2743 |
"stateProvince" text, |
|
2744 |
county text, |
|
2745 |
"decimalLatitude" double precision, |
|
2746 |
"decimalLongitude" double precision, |
|
2747 |
"coordinateUncertaintyInMeters" double precision, |
|
2748 |
geovalid boolean, |
|
2749 |
"isNewWorld" boolean, |
|
2750 |
"projectID" integer, |
|
2751 |
"plotName" text, |
|
2752 |
"elevationInMeters" double precision, |
|
2753 |
"plotArea_ha" double precision, |
|
2754 |
"samplingProtocol" text, |
|
2755 |
"dateCollected" date, |
|
2756 |
"higherPlantGroup" higher_plant_group, |
|
2757 |
family text, |
|
2758 |
genus text, |
|
2759 |
"speciesBinomial" text, |
|
2760 |
"scientificName" text, |
|
2761 |
"scientificNameAuthorship" text, |
|
2762 |
"speciesBinomialWithMorphospecies" text, |
|
2763 |
"scientificNameWithMorphospecies" text, |
|
2764 |
threatened boolean, |
|
2765 |
"identifiedBy" text, |
|
2766 |
"growthForm" growthform, |
|
2767 |
cultivated boolean, |
|
2768 |
"cultivatedBasis" text, |
|
2769 |
"recordedBy" text, |
|
2770 |
"recordNumber" text, |
|
2771 |
"coverPercent" double precision, |
|
2772 |
"diameterBreastHeight_cm" double precision, |
|
2773 |
height_m double precision, |
|
2774 |
tag text, |
|
2775 |
"organismX_m" double precision, |
|
2776 |
"organismY_m" double precision, |
|
2777 |
"taxonOccurrenceID" text, |
|
2778 |
"authorTaxonCode" text, |
|
2779 |
"individualID" text, |
|
2780 |
"authorStemCode" text |
|
2781 |
); |
|
2782 |
|
|
2783 |
|
|
2784 |
-- |
|
2785 |
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
2786 |
-- |
|
2787 |
|
|
2788 |
CREATE TABLE project ( |
|
2789 |
project_id integer NOT NULL, |
|
2790 |
source_id integer NOT NULL, |
|
2791 |
sourceaccessioncode text, |
|
2792 |
projectname text, |
|
2793 |
projectdescription text, |
|
2794 |
startdate date, |
|
2795 |
stopdate date, |
|
2796 |
accessioncode text, |
|
2797 |
CONSTRAINT project_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (projectname IS NOT NULL))) |
|
2798 |
); |
|
2799 |
|
|
2800 |
|
|
2801 |
-- |
|
2802 |
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
2803 |
-- |
|
2804 |
|
|
2805 |
CREATE TABLE sourcename ( |
|
2806 |
sourcename_id integer NOT NULL, |
|
2807 |
source_id integer NOT NULL, |
|
2808 |
system text, |
|
2809 |
name text NOT NULL, |
|
2810 |
matched_source_id integer |
|
2811 |
); |
|
2812 |
|
|
2813 |
|
|
2814 |
-- |
|
2815 |
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
2816 |
-- |
|
2817 |
|
|
2818 |
CREATE TABLE specimenreplicate ( |
|
2819 |
specimenreplicate_id integer NOT NULL, |
|
2820 |
source_id integer NOT NULL, |
|
2821 |
sourceaccessioncode text, |
|
2822 |
plantobservation_id integer, |
|
2823 |
institution_id integer, |
|
2824 |
collectioncode_dwc text, |
|
2825 |
catalognumber_dwc text, |
|
2826 |
description text, |
|
2827 |
specimen_id integer, |
|
2828 |
accessioncode text, |
|
2829 |
CONSTRAINT specimenreplicate_required_key CHECK ((((plantobservation_id IS NOT NULL) OR (sourceaccessioncode IS NOT NULL)) OR (catalognumber_dwc IS NOT NULL))) |
|
2830 |
); |
|
2831 |
|
|
2832 |
|
|
2833 |
-- |
|
2834 |
-- Name: TABLE specimenreplicate; Type: COMMENT; Schema: public; Owner: - |
|
2835 |
-- |
|
2836 |
|
|
2837 |
COMMENT ON TABLE specimenreplicate IS 'A herbarium''s replicate of a specimen. Contains Darwin Core specimen data.'; |
|
2838 |
|
|
2839 |
|
|
2840 |
-- |
|
2841 |
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: - |
|
2842 |
-- |
|
2843 |
|
|
2844 |
COMMENT ON COLUMN specimenreplicate.institution_id IS 'The institution (such as a museum) that the specimenreplicate is from.'; |
|
2845 |
|
|
2846 |
|
|
2847 |
-- |
|
2848 |
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: - |
|
2849 |
-- |
|
2850 |
|
|
2851 |
COMMENT ON COLUMN specimenreplicate.collectioncode_dwc IS 'The code for the collection that the specimenreplicate is from.'; |
|
2852 |
|
|
2853 |
|
|
2854 |
-- |
|
2855 |
-- Name: darwin_core_view; Type: VIEW; Schema: public; Owner: - |
|
2856 |
-- |
|
2857 |
|
|
2858 |
CREATE VIEW darwin_core_view AS |
|
2859 |
SELECT source.shortname AS "institutionCode", sourcename.name AS "subInstitutionCode", specimenreplicate.collectioncode_dwc AS "collectionCode", specimenreplicate.catalognumber_dwc AS "catalogNumber", specimenreplicate.sourceaccessioncode AS "occurrenceID", canon_place.country, canon_place.stateprovince AS "stateProvince", datasource_place.county, coordinates.latitude_deg AS "decimalLatitude", coordinates.longitude_deg AS "decimalLongitude", coordinates.coordsaccuracy_m AS "coordinateUncertaintyInMeters", canon_place.geovalid, "newWorldCountries"."isNewWorld", locationevent.project_id AS "projectID", COALESCE(location.sourceaccessioncode, location.authorlocationcode) AS "plotName", location.elevation_m AS "elevationInMeters", _m2_to_ha(location.area_m2) AS "plotArea_ha", method.name AS "samplingProtocol", COALESCE(locationevent.obsstartdate, aggregateoccurrence.collectiondate) AS "dateCollected", family_higher_plant_group.higher_plant_group AS "higherPlantGroup", accepted_taxonverbatim.family, accepted_taxonverbatim.genus, ((accepted_taxonverbatim.genus || ' '::text) || accepted_taxonverbatim.specific_epithet) AS "speciesBinomial", COALESCE(accepted_taxonverbatim.taxonomicname, accepted_taxonverbatim.taxonname) AS "scientificName", accepted_taxonverbatim.author AS "scientificNameAuthorship", NULLIF(array_to_string(ARRAY[COALESCE(accepted_taxonverbatim.genus, accepted_taxonverbatim.family), COALESCE(accepted_taxonverbatim.specific_epithet, parsed_taxonverbatim.morphospecies)], ' '::text), ''::text) AS "speciesBinomialWithMorphospecies", NULLIF(array_to_string(ARRAY[accepted_taxonverbatim.taxonomicname, parsed_taxonverbatim.morphospecies], ' '::text), ''::text) AS "scientificNameWithMorphospecies", (threatened_taxonlabel.taxonlabel_id IS NOT NULL) AS threatened, identifiedby.fullname AS "identifiedBy", taxonoccurrence.growthform AS "growthForm", ((cultivated_family_locations.country IS NOT NULL) OR _or(taxonoccurrence.iscultivated, location.iscultivated)) AS cultivated, CASE WHEN (taxonoccurrence.iscultivated IS NOT NULL) THEN taxonoccurrence.cultivatedbasis WHEN (location.iscultivated IS NOT NULL) THEN NULL::text ELSE NULL::text END AS "cultivatedBasis", collector.fullname AS "recordedBy", plantobservation.collectionnumber AS "recordNumber", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "coverPercent", _m_to_cm(stemobservation.diameterbreastheight_m) AS "diameterBreastHeight_cm", stemobservation.height_m, stemobservation.tag, stemobservation.xposition_m AS "organismX_m", stemobservation.yposition_m AS "organismY_m", taxonoccurrence.sourceaccessioncode AS "taxonOccurrenceID", taxonoccurrence.authortaxoncode AS "authorTaxonCode", plantobservation.sourceaccessioncode AS "individualID", stemobservation.authorstemcode AS "authorStemCode" FROM ((((((((((((((((((((((((((((source JOIN location USING (source_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN place datasource_place USING (place_id)) LEFT JOIN place canon_place ON ((canon_place.place_id = datasource_place.canon_place_id))) LEFT JOIN coordinates ON ((coordinates.coordinates_id = canon_place.coordinates_id))) LEFT JOIN "newWorld".iso_code_gadm ON ((iso_code_gadm."GADM country" = canon_place.country))) LEFT JOIN "newWorld"."newWorldCountries" ON ((("newWorldCountries"."isoCode")::text = iso_code_gadm."2-digit iso code"))) LEFT JOIN locationevent USING (location_id)) LEFT JOIN project USING (project_id)) LEFT JOIN method USING (method_id)) LEFT JOIN taxonoccurrence USING (locationevent_id)) LEFT JOIN party collector ON ((collector.party_id = taxonoccurrence.collector_id))) LEFT JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) LEFT JOIN taxonverbatim datasource_taxonverbatim USING (taxonverbatim_id)) LEFT JOIN taxonlabel datasource_taxonlabel USING (taxonlabel_id)) LEFT JOIN taxonlabel parsed_taxonlabel ON ((parsed_taxonlabel.taxonlabel_id = datasource_taxonlabel.matched_label_id))) LEFT JOIN taxonverbatim parsed_taxonverbatim ON ((parsed_taxonverbatim.taxonlabel_id = parsed_taxonlabel.taxonlabel_id))) LEFT JOIN taxonlabel accepted_taxonlabel ON ((accepted_taxonlabel.taxonlabel_id = datasource_taxonlabel.canon_label_id))) LEFT JOIN taxonverbatim accepted_taxonverbatim ON ((accepted_taxonverbatim.taxonlabel_id = accepted_taxonlabel.taxonlabel_id))) LEFT JOIN threatened_taxonlabel ON ((threatened_taxonlabel.taxonlabel_id = accepted_taxonlabel.taxonlabel_id))) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN family_higher_plant_group ON ((family_higher_plant_group.family = accepted_taxonverbatim.family))) LEFT JOIN cultivated_family_locations ON (((cultivated_family_locations.family = accepted_taxonverbatim.family) AND (cultivated_family_locations.country = canon_place.country)))) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN stemobservation USING (plantobservation_id)) LEFT JOIN specimenreplicate USING (plantobservation_id)) LEFT JOIN sourcename ON ((sourcename.sourcename_id = specimenreplicate.institution_id))) WHERE (taxondetermination.iscurrent AND (COALESCE(locationevent.obsstartdate, aggregateoccurrence.collectiondate) IS NOT NULL)); |
|
2860 |
|
|
2861 |
|
|
2862 |
-- |
|
2716 | 2863 |
-- Name: dba_preassignacccode_dba_requestnumber_seq; Type: SEQUENCE; Schema: public; Owner: - |
2717 | 2864 |
-- |
2718 | 2865 |
|
... | ... | |
3448 | 3595 |
|
3449 | 3596 |
|
3450 | 3597 |
-- |
3451 |
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
3452 |
-- |
|
3453 |
|
|
3454 |
CREATE TABLE project ( |
|
3455 |
project_id integer NOT NULL, |
|
3456 |
source_id integer NOT NULL, |
|
3457 |
sourceaccessioncode text, |
|
3458 |
projectname text, |
|
3459 |
projectdescription text, |
|
3460 |
startdate date, |
|
3461 |
stopdate date, |
|
3462 |
accessioncode text, |
|
3463 |
CONSTRAINT project_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (projectname IS NOT NULL))) |
|
3464 |
); |
|
3465 |
|
|
3466 |
|
|
3467 |
-- |
|
3468 | 3598 |
-- Name: project_project_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
3469 | 3599 |
-- |
3470 | 3600 |
|
... | ... | |
3729 | 3859 |
|
3730 | 3860 |
|
3731 | 3861 |
-- |
3732 |
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
3733 |
-- |
|
3734 |
|
|
3735 |
CREATE TABLE sourcename ( |
|
3736 |
sourcename_id integer NOT NULL, |
|
3737 |
source_id integer NOT NULL, |
|
3738 |
system text, |
|
3739 |
name text NOT NULL, |
|
3740 |
matched_source_id integer |
|
3741 |
); |
|
3742 |
|
|
3743 |
|
|
3744 |
-- |
|
3745 | 3862 |
-- Name: sourcename_sourcename_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
3746 | 3863 |
-- |
3747 | 3864 |
|
... | ... | |
3808 | 3925 |
|
3809 | 3926 |
|
3810 | 3927 |
-- |
3811 |
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
3812 |
-- |
|
3813 |
|
|
3814 |
CREATE TABLE specimenreplicate ( |
|
3815 |
specimenreplicate_id integer NOT NULL, |
|
3816 |
source_id integer NOT NULL, |
|
3817 |
sourceaccessioncode text, |
|
3818 |
plantobservation_id integer, |
|
3819 |
institution_id integer, |
|
3820 |
collectioncode_dwc text, |
|
3821 |
catalognumber_dwc text, |
|
3822 |
description text, |
|
3823 |
specimen_id integer, |
|
3824 |
accessioncode text, |
|
3825 |
CONSTRAINT specimenreplicate_required_key CHECK ((((plantobservation_id IS NOT NULL) OR (sourceaccessioncode IS NOT NULL)) OR (catalognumber_dwc IS NOT NULL))) |
|
3826 |
); |
|
3827 |
|
|
3828 |
|
|
3829 |
-- |
|
3830 |
-- Name: TABLE specimenreplicate; Type: COMMENT; Schema: public; Owner: - |
|
3831 |
-- |
|
3832 |
|
|
3833 |
COMMENT ON TABLE specimenreplicate IS 'A herbarium''s replicate of a specimen. Contains Darwin Core specimen data.'; |
|
3834 |
|
|
3835 |
|
|
3836 |
-- |
|
3837 |
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: - |
|
3838 |
-- |
|
3839 |
|
|
3840 |
COMMENT ON COLUMN specimenreplicate.institution_id IS 'The institution (such as a museum) that the specimenreplicate is from.'; |
|
3841 |
|
|
3842 |
|
|
3843 |
-- |
|
3844 |
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: - |
|
3845 |
-- |
|
3846 |
|
|
3847 |
COMMENT ON COLUMN specimenreplicate.collectioncode_dwc IS 'The code for the collection that the specimenreplicate is from.'; |
|
3848 |
|
|
3849 |
|
|
3850 |
-- |
|
3851 | 3928 |
-- Name: specimenreplicate_specimenreplicate_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
3852 | 3929 |
-- |
3853 | 3930 |
|
... | ... | |
4997 | 5074 |
|
4998 | 5075 |
|
4999 | 5076 |
-- |
5077 |
-- Data for Name: darwin_core; Type: TABLE DATA; Schema: public; Owner: - |
|
5078 |
-- |
|
5079 |
|
|
5080 |
|
|
5081 |
|
|
5082 |
-- |
|
5000 | 5083 |
-- Data for Name: definedvalue; Type: TABLE DATA; Schema: public; Owner: - |
5001 | 5084 |
-- |
5002 | 5085 |
|
... | ... | |
5987 | 6070 |
|
5988 | 6071 |
|
5989 | 6072 |
-- |
6073 |
-- Name: darwin_core_institutionCode_catalogNumber_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
6074 |
-- |
|
6075 |
|
|
6076 |
CREATE INDEX "darwin_core_institutionCode_catalogNumber_idx" ON darwin_core USING btree ("institutionCode", "catalogNumber"); |
|
6077 |
|
|
6078 |
|
|
6079 |
-- |
|
6080 |
-- Name: darwin_core_institutionCode_occurrenceID_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
6081 |
-- |
|
6082 |
|
|
6083 |
CREATE INDEX "darwin_core_institutionCode_occurrenceID_idx" ON darwin_core USING btree ("institutionCode", "occurrenceID"); |
|
6084 |
|
|
6085 |
|
|
6086 |
-- |
|
6087 |
-- Name: darwin_core_institutionCode_projectID_plotName_dateCollecte_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
6088 |
-- |
|
6089 |
|
|
6090 |
CREATE INDEX "darwin_core_institutionCode_projectID_plotName_dateCollecte_idx" ON darwin_core USING btree ("institutionCode", "projectID", "plotName", "dateCollected"); |
|
6091 |
|
|
6092 |
|
|
6093 |
-- |
|
6094 |
-- Name: darwin_core_institutionCode_subInstitutionCode_collectionCo_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: |
|
6095 |
-- |
|
6096 |
|
|
6097 |
CREATE INDEX "darwin_core_institutionCode_subInstitutionCode_collectionCo_idx" ON darwin_core USING btree ("institutionCode", "subInstitutionCode", "collectionCode", "catalogNumber"); |
|
6098 |
|
|
6099 |
|
|
6100 |
-- |
|
5990 | 6101 |
-- Name: graphic_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace: |
5991 | 6102 |
-- |
5992 | 6103 |
|
... | ... | |
7840 | 7951 |
|
7841 | 7952 |
|
7842 | 7953 |
-- |
7954 |
-- Name: project; Type: ACL; Schema: public; Owner: - |
|
7955 |
-- |
|
7956 |
|
|
7957 |
REVOKE ALL ON TABLE project FROM PUBLIC; |
|
7958 |
REVOKE ALL ON TABLE project FROM bien; |
|
7959 |
GRANT ALL ON TABLE project TO bien; |
|
7960 |
GRANT SELECT ON TABLE project TO bien_read; |
|
7961 |
|
|
7962 |
|
|
7963 |
-- |
|
7964 |
-- Name: sourcename; Type: ACL; Schema: public; Owner: - |
|
7965 |
-- |
|
7966 |
|
|
7967 |
REVOKE ALL ON TABLE sourcename FROM PUBLIC; |
|
7968 |
REVOKE ALL ON TABLE sourcename FROM bien; |
|
7969 |
GRANT ALL ON TABLE sourcename TO bien; |
|
7970 |
GRANT SELECT ON TABLE sourcename TO bien_read; |
|
7971 |
|
|
7972 |
|
|
7973 |
-- |
|
7974 |
-- Name: specimenreplicate; Type: ACL; Schema: public; Owner: - |
|
7975 |
-- |
|
7976 |
|
|
7977 |
REVOKE ALL ON TABLE specimenreplicate FROM PUBLIC; |
|
7978 |
REVOKE ALL ON TABLE specimenreplicate FROM bien; |
|
7979 |
GRANT ALL ON TABLE specimenreplicate TO bien; |
|
7980 |
GRANT SELECT ON TABLE specimenreplicate TO bien_read; |
|
7981 |
|
|
7982 |
|
|
7983 |
-- |
|
7843 | 7984 |
-- Name: definedvalue; Type: ACL; Schema: public; Owner: - |
7844 | 7985 |
-- |
7845 | 7986 |
|
... | ... | |
8000 | 8141 |
|
8001 | 8142 |
|
8002 | 8143 |
-- |
8003 |
-- Name: project; Type: ACL; Schema: public; Owner: - |
|
8004 |
-- |
|
8005 |
|
|
8006 |
REVOKE ALL ON TABLE project FROM PUBLIC; |
|
8007 |
REVOKE ALL ON TABLE project FROM bien; |
|
8008 |
GRANT ALL ON TABLE project TO bien; |
|
8009 |
GRANT SELECT ON TABLE project TO bien_read; |
|
8010 |
|
|
8011 |
|
|
8012 |
-- |
|
8013 | 8144 |
-- Name: projectcontributor; Type: ACL; Schema: public; Owner: - |
8014 | 8145 |
-- |
8015 | 8146 |
|
... | ... | |
8060 | 8191 |
|
8061 | 8192 |
|
8062 | 8193 |
-- |
8063 |
-- Name: sourcename; Type: ACL; Schema: public; Owner: - |
|
8064 |
-- |
|
8065 |
|
|
8066 |
REVOKE ALL ON TABLE sourcename FROM PUBLIC; |
|
8067 |
REVOKE ALL ON TABLE sourcename FROM bien; |
|
8068 |
GRANT ALL ON TABLE sourcename TO bien; |
|
8069 |
GRANT SELECT ON TABLE sourcename TO bien_read; |
|
8070 |
|
|
8071 |
|
|
8072 |
-- |
|
8073 | 8194 |
-- Name: specimen; Type: ACL; Schema: public; Owner: - |
8074 | 8195 |
-- |
8075 | 8196 |
|
... | ... | |
8080 | 8201 |
|
8081 | 8202 |
|
8082 | 8203 |
-- |
8083 |
-- Name: specimenreplicate; Type: ACL; Schema: public; Owner: - |
|
8084 |
-- |
|
8085 |
|
|
8086 |
REVOKE ALL ON TABLE specimenreplicate FROM PUBLIC; |
|
8087 |
REVOKE ALL ON TABLE specimenreplicate FROM bien; |
|
8088 |
GRANT ALL ON TABLE specimenreplicate TO bien; |
|
8089 |
GRANT SELECT ON TABLE specimenreplicate TO bien_read; |
|
8090 |
|
|
8091 |
|
|
8092 |
-- |
|
8093 | 8204 |
-- Name: stratum; Type: ACL; Schema: public; Owner: - |
8094 | 8205 |
-- |
8095 | 8206 |
|
Also available in: Unified diff
schemas/vegbien.sql: Added darwin_core_view