928 |
928 |
ALTER TABLE analytical_stem ALTER COLUMN "institutionCode" SET NOT NULL;
|
929 |
929 |
ALTER TABLE analytical_stem ALTER COLUMN "plotName" SET NOT NULL;
|
930 |
930 |
|
931 |
|
CREATE INDEX ON analytical_stem ("institutionCode", "plotName", "dateCollected" );
|
|
931 |
CREATE INDEX ON analytical_stem ("institutionCode", "occurrenceID" );
|
|
932 |
CREATE INDEX ON analytical_stem ("institutionCode", "subInstitutionCode", "collectionCode", "catalogNumber" );
|
|
933 |
CREATE INDEX ON analytical_stem ("institutionCode", "projectID", "plotName", "dateCollected" );
|
932 |
934 |
$$;
|
933 |
935 |
|
934 |
936 |
|
... | ... | |
1462 |
1464 |
"coordinateUncertaintyInMeters" double precision,
|
1463 |
1465 |
geovalid boolean,
|
1464 |
1466 |
"isNewWorld" boolean,
|
1465 |
|
"distanceToCountry_km" double precision,
|
1466 |
|
"distanceToStateProvince_km" double precision,
|
1467 |
1467 |
"plotName" text NOT NULL,
|
1468 |
1468 |
"elevationInMeters" double precision,
|
1469 |
1469 |
"plotArea_ha" double precision,
|
... | ... | |
1495 |
1495 |
|
1496 |
1496 |
CREATE TABLE analytical_stem (
|
1497 |
1497 |
"institutionCode" text NOT NULL,
|
|
1498 |
"subInstitutionCode" text,
|
|
1499 |
"collectionCode" text,
|
|
1500 |
"catalogNumber" text,
|
|
1501 |
"occurrenceID" text,
|
1498 |
1502 |
country text,
|
1499 |
1503 |
"stateProvince" text,
|
1500 |
1504 |
county text,
|
... | ... | |
1503 |
1507 |
"coordinateUncertaintyInMeters" double precision,
|
1504 |
1508 |
geovalid boolean,
|
1505 |
1509 |
"isNewWorld" boolean,
|
1506 |
|
"distanceToCountry_km" double precision,
|
1507 |
|
"distanceToStateProvince_km" double precision,
|
|
1510 |
"projectID" integer,
|
1508 |
1511 |
"plotName" text NOT NULL,
|
1509 |
1512 |
"elevationInMeters" double precision,
|
1510 |
1513 |
"plotArea_ha" double precision,
|
... | ... | |
1516 |
1519 |
"speciesBinomial" text,
|
1517 |
1520 |
"scientificName" text,
|
1518 |
1521 |
"scientificNameAuthorship" text,
|
|
1522 |
"speciesBinomialWithMorphospecies" text,
|
1519 |
1523 |
"scientificNameWithMorphospecies" text,
|
1520 |
1524 |
threatened boolean,
|
1521 |
1525 |
"identifiedBy" text,
|
1522 |
1526 |
"growthForm" growthform,
|
1523 |
1527 |
cultivated boolean,
|
1524 |
1528 |
"cultivatedBasis" text,
|
|
1529 |
"recordedBy" text,
|
|
1530 |
"recordNumber" text,
|
1525 |
1531 |
"coverPercent" double precision,
|
1526 |
1532 |
"diameterBreastHeight_cm" double precision,
|
1527 |
1533 |
height_m double precision,
|
1528 |
1534 |
tag text,
|
1529 |
1535 |
"organismX_m" double precision,
|
1530 |
1536 |
"organismY_m" double precision,
|
1531 |
|
"recordedBy" text,
|
1532 |
|
"recordNumber" text
|
|
1537 |
"taxonOccurrenceID" text,
|
|
1538 |
"authorTaxonCode" text,
|
|
1539 |
"individualID" text,
|
|
1540 |
"authorStemCode" text
|
1533 |
1541 |
);
|
1534 |
1542 |
|
1535 |
1543 |
|
... | ... | |
1538 |
1546 |
--
|
1539 |
1547 |
|
1540 |
1548 |
CREATE VIEW analytical_aggregate_view AS
|
1541 |
|
SELECT analytical_stem."institutionCode", analytical_stem.country, analytical_stem."stateProvince", analytical_stem.county, analytical_stem."decimalLatitude", analytical_stem."decimalLongitude", analytical_stem."coordinateUncertaintyInMeters", analytical_stem.geovalid, analytical_stem."isNewWorld", analytical_stem."distanceToCountry_km", analytical_stem."distanceToStateProvince_km", analytical_stem."plotName", analytical_stem."elevationInMeters", analytical_stem."plotArea_ha", analytical_stem."samplingProtocol", analytical_stem."dateCollected", analytical_stem."higherPlantGroup", analytical_stem.family, analytical_stem.genus, analytical_stem."speciesBinomial", analytical_stem."scientificName", analytical_stem."scientificNameAuthorship", analytical_stem."scientificNameWithMorphospecies", analytical_stem.threatened, analytical_stem."identifiedBy", analytical_stem."growthForm", analytical_stem.cultivated, analytical_stem."cultivatedBasis", sum(analytical_stem."coverPercent") AS "coverPercent", count(analytical_stem."diameterBreastHeight_cm") AS "individualCount", count((analytical_stem."diameterBreastHeight_cm" >= _cm_to_m((1)::double precision))) AS "individualCount_1cm_or_more", count((analytical_stem."diameterBreastHeight_cm" >= _cm_to_m((2.5)::double precision))) AS "individualCount_2_5cm_or_more", count((analytical_stem."diameterBreastHeight_cm" >= _cm_to_m((10)::double precision))) AS "individualCount_10cm_or_more" FROM analytical_stem GROUP BY analytical_stem."institutionCode", analytical_stem.country, analytical_stem."stateProvince", analytical_stem.county, analytical_stem."decimalLatitude", analytical_stem."decimalLongitude", analytical_stem."coordinateUncertaintyInMeters", analytical_stem.geovalid, analytical_stem."isNewWorld", analytical_stem."distanceToCountry_km", analytical_stem."distanceToStateProvince_km", analytical_stem."plotName", analytical_stem."elevationInMeters", analytical_stem."plotArea_ha", analytical_stem."samplingProtocol", analytical_stem."dateCollected", analytical_stem."higherPlantGroup", analytical_stem.family, analytical_stem.genus, analytical_stem."speciesBinomial", analytical_stem."scientificName", analytical_stem."scientificNameAuthorship", analytical_stem."scientificNameWithMorphospecies", analytical_stem.threatened, analytical_stem."identifiedBy", analytical_stem."growthForm", analytical_stem.cultivated, analytical_stem."cultivatedBasis";
|
|
1549 |
SELECT analytical_stem."institutionCode", analytical_stem.country, analytical_stem."stateProvince", analytical_stem.county, analytical_stem."decimalLatitude", analytical_stem."decimalLongitude", analytical_stem."coordinateUncertaintyInMeters", analytical_stem.geovalid, analytical_stem."isNewWorld", analytical_stem."plotName", analytical_stem."elevationInMeters", analytical_stem."plotArea_ha", analytical_stem."samplingProtocol", analytical_stem."dateCollected", analytical_stem."higherPlantGroup", analytical_stem.family, analytical_stem.genus, analytical_stem."speciesBinomial", analytical_stem."scientificName", analytical_stem."scientificNameAuthorship", analytical_stem."scientificNameWithMorphospecies", analytical_stem.threatened, analytical_stem."identifiedBy", analytical_stem."growthForm", analytical_stem.cultivated, analytical_stem."cultivatedBasis", sum(analytical_stem."coverPercent") AS "coverPercent", count(analytical_stem."diameterBreastHeight_cm") AS "individualCount", count((analytical_stem."diameterBreastHeight_cm" >= _cm_to_m((1)::double precision))) AS "individualCount_1cm_or_more", count((analytical_stem."diameterBreastHeight_cm" >= _cm_to_m((2.5)::double precision))) AS "individualCount_2_5cm_or_more", count((analytical_stem."diameterBreastHeight_cm" >= _cm_to_m((10)::double precision))) AS "individualCount_10cm_or_more" FROM analytical_stem GROUP BY analytical_stem."institutionCode", analytical_stem.country, analytical_stem."stateProvince", analytical_stem.county, analytical_stem."decimalLatitude", analytical_stem."decimalLongitude", analytical_stem."coordinateUncertaintyInMeters", analytical_stem.geovalid, analytical_stem."isNewWorld", analytical_stem."plotName", analytical_stem."elevationInMeters", analytical_stem."plotArea_ha", analytical_stem."samplingProtocol", analytical_stem."dateCollected", analytical_stem."higherPlantGroup", analytical_stem.family, analytical_stem.genus, analytical_stem."speciesBinomial", analytical_stem."scientificName", analytical_stem."scientificNameAuthorship", analytical_stem."scientificNameWithMorphospecies", analytical_stem.threatened, analytical_stem."identifiedBy", analytical_stem."growthForm", analytical_stem.cultivated, analytical_stem."cultivatedBasis";
|
1542 |
1550 |
|
1543 |
1551 |
|
1544 |
1552 |
--
|
... | ... | |
2013 |
2021 |
|
2014 |
2022 |
|
2015 |
2023 |
--
|
|
2024 |
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
2025 |
--
|
|
2026 |
|
|
2027 |
CREATE TABLE project (
|
|
2028 |
project_id integer NOT NULL,
|
|
2029 |
source_id integer NOT NULL,
|
|
2030 |
sourceaccessioncode text,
|
|
2031 |
projectname text,
|
|
2032 |
projectdescription text,
|
|
2033 |
startdate date,
|
|
2034 |
stopdate date,
|
|
2035 |
accessioncode text,
|
|
2036 |
CONSTRAINT project_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (projectname IS NOT NULL)))
|
|
2037 |
);
|
|
2038 |
|
|
2039 |
|
|
2040 |
--
|
2016 |
2041 |
-- Name: source; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
2017 |
2042 |
--
|
2018 |
2043 |
|
... | ... | |
2052 |
2077 |
|
2053 |
2078 |
|
2054 |
2079 |
--
|
|
2080 |
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
2081 |
--
|
|
2082 |
|
|
2083 |
CREATE TABLE sourcename (
|
|
2084 |
sourcename_id integer NOT NULL,
|
|
2085 |
source_id integer NOT NULL,
|
|
2086 |
system text,
|
|
2087 |
name text NOT NULL,
|
|
2088 |
matched_source_id integer
|
|
2089 |
);
|
|
2090 |
|
|
2091 |
|
|
2092 |
--
|
|
2093 |
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
2094 |
--
|
|
2095 |
|
|
2096 |
CREATE TABLE specimenreplicate (
|
|
2097 |
specimenreplicate_id integer NOT NULL,
|
|
2098 |
source_id integer NOT NULL,
|
|
2099 |
sourceaccessioncode text,
|
|
2100 |
plantobservation_id integer,
|
|
2101 |
institution_id integer,
|
|
2102 |
collectioncode_dwc text,
|
|
2103 |
catalognumber_dwc text,
|
|
2104 |
description text,
|
|
2105 |
specimen_id integer,
|
|
2106 |
accessioncode text,
|
|
2107 |
CONSTRAINT specimenreplicate_required_key CHECK ((((plantobservation_id IS NOT NULL) OR (sourceaccessioncode IS NOT NULL)) OR (catalognumber_dwc IS NOT NULL)))
|
|
2108 |
);
|
|
2109 |
|
|
2110 |
|
|
2111 |
--
|
|
2112 |
-- Name: TABLE specimenreplicate; Type: COMMENT; Schema: public; Owner: -
|
|
2113 |
--
|
|
2114 |
|
|
2115 |
COMMENT ON TABLE specimenreplicate IS 'A herbarium''s replicate of a specimen. Contains Darwin Core specimen data.';
|
|
2116 |
|
|
2117 |
|
|
2118 |
--
|
|
2119 |
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: -
|
|
2120 |
--
|
|
2121 |
|
|
2122 |
COMMENT ON COLUMN specimenreplicate.institution_id IS 'The institution (such as a museum) that the specimenreplicate is from.';
|
|
2123 |
|
|
2124 |
|
|
2125 |
--
|
|
2126 |
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: -
|
|
2127 |
--
|
|
2128 |
|
|
2129 |
COMMENT ON COLUMN specimenreplicate.collectioncode_dwc IS 'The code for the collection that the specimenreplicate is from.';
|
|
2130 |
|
|
2131 |
|
|
2132 |
--
|
2055 |
2133 |
-- Name: stemobservation; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
2056 |
2134 |
--
|
2057 |
2135 |
|
... | ... | |
2273 |
2351 |
--
|
2274 |
2352 |
|
2275 |
2353 |
CREATE VIEW analytical_stem_view AS
|
2276 |
|
SELECT source.shortname AS "institutionCode", 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", _m_to_km(canon_place.distance_to_country_m) AS "distanceToCountry_km", _m_to_km(canon_place.distance_to_state_m) AS "distanceToStateProvince_km", 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, parent_plot_event.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 "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", _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", collector.fullname AS "recordedBy", NULLIF(array_to_string(ARRAY[taxonoccurrence.sourceaccessioncode, taxonoccurrence.authortaxoncode, plantobservation.sourceaccessioncode, plantobservation.collectionnumber, stemobservation.sourceaccessioncode, stemobservation.authorstemcode, stemobservation.tag], '; '::text), ''::text) AS "recordNumber" 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" = iso_code_gadm."2-digit iso code"))) LEFT JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) LEFT JOIN taxonoccurrence USING (locationevent_id)) LEFT JOIN locationevent parent_plot_event ON ((parent_plot_event.locationevent_id = locationevent.parent_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)) WHERE taxondetermination.iscurrent;
|
|
2354 |
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" = 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)));
|
2277 |
2355 |
|
2278 |
2356 |
|
2279 |
2357 |
--
|
... | ... | |
2799 |
2877 |
|
2800 |
2878 |
|
2801 |
2879 |
--
|
2802 |
|
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
2803 |
|
--
|
2804 |
|
|
2805 |
|
CREATE TABLE project (
|
2806 |
|
project_id integer NOT NULL,
|
2807 |
|
source_id integer NOT NULL,
|
2808 |
|
sourceaccessioncode text,
|
2809 |
|
projectname text,
|
2810 |
|
projectdescription text,
|
2811 |
|
startdate date,
|
2812 |
|
stopdate date,
|
2813 |
|
accessioncode text,
|
2814 |
|
CONSTRAINT project_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (projectname IS NOT NULL)))
|
2815 |
|
);
|
2816 |
|
|
2817 |
|
|
2818 |
|
--
|
2819 |
|
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
2820 |
|
--
|
2821 |
|
|
2822 |
|
CREATE TABLE sourcename (
|
2823 |
|
sourcename_id integer NOT NULL,
|
2824 |
|
source_id integer NOT NULL,
|
2825 |
|
system text,
|
2826 |
|
name text NOT NULL,
|
2827 |
|
matched_source_id integer
|
2828 |
|
);
|
2829 |
|
|
2830 |
|
|
2831 |
|
--
|
2832 |
|
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
2833 |
|
--
|
2834 |
|
|
2835 |
|
CREATE TABLE specimenreplicate (
|
2836 |
|
specimenreplicate_id integer NOT NULL,
|
2837 |
|
source_id integer NOT NULL,
|
2838 |
|
sourceaccessioncode text,
|
2839 |
|
plantobservation_id integer,
|
2840 |
|
institution_id integer,
|
2841 |
|
collectioncode_dwc text,
|
2842 |
|
catalognumber_dwc text,
|
2843 |
|
description text,
|
2844 |
|
specimen_id integer,
|
2845 |
|
accessioncode text,
|
2846 |
|
CONSTRAINT specimenreplicate_required_key CHECK ((((plantobservation_id IS NOT NULL) OR (sourceaccessioncode IS NOT NULL)) OR (catalognumber_dwc IS NOT NULL)))
|
2847 |
|
);
|
2848 |
|
|
2849 |
|
|
2850 |
|
--
|
2851 |
|
-- Name: TABLE specimenreplicate; Type: COMMENT; Schema: public; Owner: -
|
2852 |
|
--
|
2853 |
|
|
2854 |
|
COMMENT ON TABLE specimenreplicate IS 'A herbarium''s replicate of a specimen. Contains Darwin Core specimen data.';
|
2855 |
|
|
2856 |
|
|
2857 |
|
--
|
2858 |
|
-- Name: COLUMN specimenreplicate.institution_id; Type: COMMENT; Schema: public; Owner: -
|
2859 |
|
--
|
2860 |
|
|
2861 |
|
COMMENT ON COLUMN specimenreplicate.institution_id IS 'The institution (such as a museum) that the specimenreplicate is from.';
|
2862 |
|
|
2863 |
|
|
2864 |
|
--
|
2865 |
|
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: -
|
2866 |
|
--
|
2867 |
|
|
2868 |
|
COMMENT ON COLUMN specimenreplicate.collectioncode_dwc IS 'The code for the collection that the specimenreplicate is from.';
|
2869 |
|
|
2870 |
|
|
2871 |
|
--
|
2872 |
2880 |
-- Name: darwin_core_view; Type: VIEW; Schema: public; Owner: -
|
2873 |
2881 |
--
|
2874 |
2882 |
|
... | ... | |
6038 |
6046 |
|
6039 |
6047 |
|
6040 |
6048 |
--
|
6041 |
|
-- Name: analytical_stem_institutionCode_plotName_dateCollected_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
6049 |
-- Name: analytical_stem_institutionCode_occurrenceID_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
6042 |
6050 |
--
|
6043 |
6051 |
|
6044 |
|
CREATE INDEX "analytical_stem_institutionCode_plotName_dateCollected_idx" ON analytical_stem USING btree ("institutionCode", "plotName", "dateCollected");
|
|
6052 |
CREATE INDEX "analytical_stem_institutionCode_occurrenceID_idx" ON analytical_stem USING btree ("institutionCode", "occurrenceID");
|
6045 |
6053 |
|
6046 |
6054 |
|
6047 |
6055 |
--
|
|
6056 |
-- Name: analytical_stem_institutionCode_projectID_plotName_dateColl_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
6057 |
--
|
|
6058 |
|
|
6059 |
CREATE INDEX "analytical_stem_institutionCode_projectID_plotName_dateColl_idx" ON analytical_stem USING btree ("institutionCode", "projectID", "plotName", "dateCollected");
|
|
6060 |
|
|
6061 |
|
|
6062 |
--
|
|
6063 |
-- Name: analytical_stem_institutionCode_subInstitutionCode_collecti_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
6064 |
--
|
|
6065 |
|
|
6066 |
CREATE INDEX "analytical_stem_institutionCode_subInstitutionCode_collecti_idx" ON analytical_stem USING btree ("institutionCode", "subInstitutionCode", "collectionCode", "catalogNumber");
|
|
6067 |
|
|
6068 |
|
|
6069 |
--
|
6048 |
6070 |
-- Name: commclass_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
6049 |
6071 |
--
|
6050 |
6072 |
|
... | ... | |
7778 |
7800 |
|
7779 |
7801 |
|
7780 |
7802 |
--
|
|
7803 |
-- Name: project; Type: ACL; Schema: public; Owner: -
|
|
7804 |
--
|
|
7805 |
|
|
7806 |
REVOKE ALL ON TABLE project FROM PUBLIC;
|
|
7807 |
REVOKE ALL ON TABLE project FROM bien;
|
|
7808 |
GRANT ALL ON TABLE project TO bien;
|
|
7809 |
GRANT SELECT ON TABLE project TO bien_read;
|
|
7810 |
|
|
7811 |
|
|
7812 |
--
|
7781 |
7813 |
-- Name: source; Type: ACL; Schema: public; Owner: -
|
7782 |
7814 |
--
|
7783 |
7815 |
|
... | ... | |
7788 |
7820 |
|
7789 |
7821 |
|
7790 |
7822 |
--
|
|
7823 |
-- Name: sourcename; Type: ACL; Schema: public; Owner: -
|
|
7824 |
--
|
|
7825 |
|
|
7826 |
REVOKE ALL ON TABLE sourcename FROM PUBLIC;
|
|
7827 |
REVOKE ALL ON TABLE sourcename FROM bien;
|
|
7828 |
GRANT ALL ON TABLE sourcename TO bien;
|
|
7829 |
GRANT SELECT ON TABLE sourcename TO bien_read;
|
|
7830 |
|
|
7831 |
|
|
7832 |
--
|
|
7833 |
-- Name: specimenreplicate; Type: ACL; Schema: public; Owner: -
|
|
7834 |
--
|
|
7835 |
|
|
7836 |
REVOKE ALL ON TABLE specimenreplicate FROM PUBLIC;
|
|
7837 |
REVOKE ALL ON TABLE specimenreplicate FROM bien;
|
|
7838 |
GRANT ALL ON TABLE specimenreplicate TO bien;
|
|
7839 |
GRANT SELECT ON TABLE specimenreplicate TO bien_read;
|
|
7840 |
|
|
7841 |
|
|
7842 |
--
|
7791 |
7843 |
-- Name: stemobservation; Type: ACL; Schema: public; Owner: -
|
7792 |
7844 |
--
|
7793 |
7845 |
|
... | ... | |
7958 |
8010 |
|
7959 |
8011 |
|
7960 |
8012 |
--
|
7961 |
|
-- Name: project; Type: ACL; Schema: public; Owner: -
|
7962 |
|
--
|
7963 |
|
|
7964 |
|
REVOKE ALL ON TABLE project FROM PUBLIC;
|
7965 |
|
REVOKE ALL ON TABLE project FROM bien;
|
7966 |
|
GRANT ALL ON TABLE project TO bien;
|
7967 |
|
GRANT SELECT ON TABLE project TO bien_read;
|
7968 |
|
|
7969 |
|
|
7970 |
|
--
|
7971 |
|
-- Name: sourcename; Type: ACL; Schema: public; Owner: -
|
7972 |
|
--
|
7973 |
|
|
7974 |
|
REVOKE ALL ON TABLE sourcename FROM PUBLIC;
|
7975 |
|
REVOKE ALL ON TABLE sourcename FROM bien;
|
7976 |
|
GRANT ALL ON TABLE sourcename TO bien;
|
7977 |
|
GRANT SELECT ON TABLE sourcename TO bien_read;
|
7978 |
|
|
7979 |
|
|
7980 |
|
--
|
7981 |
|
-- Name: specimenreplicate; Type: ACL; Schema: public; Owner: -
|
7982 |
|
--
|
7983 |
|
|
7984 |
|
REVOKE ALL ON TABLE specimenreplicate FROM PUBLIC;
|
7985 |
|
REVOKE ALL ON TABLE specimenreplicate FROM bien;
|
7986 |
|
GRANT ALL ON TABLE specimenreplicate TO bien;
|
7987 |
|
GRANT SELECT ON TABLE specimenreplicate TO bien_read;
|
7988 |
|
|
7989 |
|
|
7990 |
|
--
|
7991 |
8013 |
-- Name: definedvalue; Type: ACL; Schema: public; Owner: -
|
7992 |
8014 |
--
|
7993 |
8015 |
|
schemas/vegbien.sql: Merged darwin_core into analytical_stem