--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

--
-- Name: public_validations; Type: SCHEMA; Schema: -; Owner: -
--

CREATE SCHEMA public_validations;


--
-- Name: SCHEMA public_validations; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON SCHEMA public_validations IS '
aggregating validations queries

to run the validations on all datasources:
SELECT public_validations.remake_diff_tables();

to run the validations on a particular datasource:
SELECT public_validations.remake_diff_tables(''datasource'');

to run just the output queries on a particular datasource:
SELECT public_validations.remake_output_tables(''datasource'', ''_prefix_'');

to run a particular validations query for a datasource:
SELECT public_validations.remake_diff_table(''"datasource"._view_name'');

to reset the queries to what''s in schemas/vegbien.sql:
SELECT public_validations.rm_output_queries();
run the portion of schemas/vegbien.sql from
SET search_path = public_validations, pg_catalog;
to the last _* view
**IMPORTANT**: run every `CREATE TYPE` with a comment containing "custom"

to remove a validations query so its columns can be changed:
SELECT public_validations.rm_output_queries(''public_validations._view_name'');
	-- not rm_query_view() because that also removes input queries

to change the key and value columns for a validations query:
DROP   TYPE public_validations."keys_~type._view_name"    CASCADE;
CREATE TYPE public_validations."keys_~type._view_name"    AS (key_cols);
DROP   TYPE public_validations."values__~type._view_name" CASCADE;
CREATE TYPE public_validations."values__~type._view_name" AS (value_cols);
SELECT public_validations.remake_diff_table(''"datasource"._view_name'');

to reset the key and value columns for all validations queries:
SELECT public_validations.rm_output_queries();
reset the queries to what''s in schemas/vegbien.sql, as described above
SELECT public_validations.remake_diff_tables();
';


SET search_path = public, pg_catalog;

--
-- Name: accesslevel; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE accesslevel AS ENUM (
    'private',
    'metadata only',
    'data by request',
    'public'
);


--
-- Name: coordinatesource; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE coordinatesource AS ENUM (
    'source data',
    'GPS',
    'georeferencing'
);


--
-- Name: TYPE coordinatesource; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TYPE coordinatesource IS '
From <https://projects.nceas.ucsb.edu/nceas/projects/bien/wiki/VegCore_data_dictionary#coordinateSource>
';


--
-- Name: establishmentmeans_dwc; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE establishmentmeans_dwc AS ENUM (
    'cultivated',
    'wild',
    'native',
    'exotic',
    'invasive',
    'escaped from captivity'
);


--
-- Name: TYPE establishmentmeans_dwc; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TYPE establishmentmeans_dwc IS '
See <http://rs.tdwg.org/dwc/terms/#establishmentMeans>
';


--
-- Name: growthform; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE growthform AS ENUM (
    'tree',
    'shrub',
    'liana',
    'vine',
    'herb',
    'hemiepiphyte',
    'epiphyte',
    'grass',
    'forb',
    'moss',
    'lichen',
    'fungus',
    'floating aquatic',
    'submerged aquatic'
);


--
-- Name: higher_plant_group; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE higher_plant_group AS ENUM (
    'all',
    'bryophytes',
    'ferns and allies',
    'flowering plants',
    'gymnosperms (conifers)',
    'gymnosperms (non-conifer)'
);


--
-- Name: observationtype; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE observationtype AS ENUM (
    'plot',
    'specimen'
);


--
-- Name: occurrencestatus_dwc; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE occurrencestatus_dwc AS ENUM (
    'present',
    'absent',
    'common',
    'irregular',
    'rare',
    'doubtful'
);


--
-- Name: placerank; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE placerank AS ENUM (
    'continent',
    'waterBody',
    'islandGroup',
    'island',
    'country',
    'territory',
    'region',
    'stateProvince',
    'county',
    'municipality',
    'village',
    'site'
);


--
-- Name: TYPE placerank; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TYPE placerank IS '
county = parish, canton
municipality = city

From <http://rs.tdwg.org/dwc/terms/#dcindex#dcterms:Location>, <http://vegbank.org/vegbank/views/dba_fielddescription_detail.jsp?view=detail&wparam=1415&entity=dba_fielddescription&params=1415>
';


--
-- Name: rankedplacename; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE rankedplacename AS (
	rank placerank,
	verbatimrank text,
	placename text
);


--
-- Name: taxonrank; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE taxonrank AS ENUM (
    'unknown',
    'suprageneric',
    'domain',
    'superkingdom',
    'kingdom',
    'subkingdom',
    'infrakingdom',
    'superphylum',
    'phylum',
    'subphylum',
    'infraphylum',
    'superclass',
    'class',
    'subclass',
    'infraclass',
    'superorder',
    'order',
    'suborder',
    'infraorder',
    'family group',
    'superfamily',
    'family',
    'subfamily',
    'infrafamily',
    'family subdivision',
    'supertribe',
    'tribe',
    'subtribe',
    'infratribe',
    'genus group',
    'genus',
    'subgenus',
    'infragenus',
    'genus subdivision',
    'section',
    'subsection',
    'series',
    'subseries',
    'infrageneric',
    'species aggregate',
    'species group',
    'species',
    'subspecies',
    'subspecific aggregate',
    'below subspecies',
    'infraspecies',
    'biovariety',
    'pathovariety',
    'variety',
    'subvariety',
    'subsubvariety',
    'forma',
    'subforma',
    'subsubforma',
    'special forma',
    'infraspecific',
    'candidate',
    'cultivated plants',
    'cultivar',
    'convar',
    'grex',
    'cultivar group',
    'graft-chimaera',
    'denomination class'
);


--
-- Name: TYPE taxonrank; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TYPE taxonrank IS '
From <http://www.tdwg.org/standards/117/download/>
';


--
-- Name: rankedtaxonname; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE rankedtaxonname AS (
	rank taxonrank,
	verbatimrank text,
	taxonname text
);


--
-- Name: relationship; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE relationship AS ENUM (
    'is congruent to',
    'is not congruent to',
    'is included in',
    'is not included in',
    'overlaps',
    'does not overlap',
    'is child taxon of',
    'is anamorph of',
    'is teleomorph of',
    'is hybrid child of',
    'is ambiregnal of',
    'is vernacular for'
);


--
-- Name: role; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE role AS ENUM (
    'unknown',
    'advisor',
    'author',
    'co-principal investigator',
    'collector',
    'computer',
    'contact',
    'contributor',
    'custodian/steward',
    'editor',
    'identifier',
    'originator',
    'performer',
    'principal investigator',
    'recipient',
    'reviewer',
    'technician'
);


--
-- Name: TYPE role; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TYPE role IS '
From <http://vegbank.org/vegbank/views/dba_fielddescription_detail.jsp?view=detail&wparam=1331&entity=dba_fielddescription&params=1331>, <http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=projectcontributor&entity=dba_tabledescription&where=where_tablename#ROLE_ID>, and misc terms.
';


--
-- Name: schema_anchor; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE schema_anchor AS (
);


--
-- Name: TYPE schema_anchor; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TYPE schema_anchor IS 'used with schema_anchor params';


--
-- Name: sourcetype; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE sourcetype AS ENUM (
    'herbarium',
    'primary database',
    'aggregator',
    'book',
    'article',
    'chapter',
    'conference proceedings',
    'dissertation',
    'edited book',
    'generic',
    'journal',
    'manuscript',
    'personal communication',
    'presentation',
    'report',
    'thesis',
    'website'
);


--
-- Name: TYPE sourcetype; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TYPE sourcetype IS '
From <https://projects.nceas.ucsb.edu/nceas/attachments/download/428/bien_web_datasource_schema.sql>, <http://vegbank.org/vegbank/views/dba_fielddescription_detail.jsp?view=detail&wparam=1300&entity=dba_fielddescription&params=1300>, <http://vegbiendev.nceas.ucsb.edu/phppgadmin/display.php?server=localhost%3A5432%3Aallow&database=vegbien&schema=VegBank&table=source&subject=table#sourcetype>
';


--
-- Name: taxonclass; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE taxonclass AS ENUM (
    'tree',
    'shrub',
    'liana',
    'vine',
    'herb',
    'hemiepiphyte',
    'epiphyte',
    'grass',
    'forb',
    'moss',
    'lichen',
    'fungus',
    'floating aquatic',
    'submerged aquatic',
    'cultivated',
    'wild',
    'native',
    'exotic',
    'invasive',
    'escaped from captivity',
    'dominant',
    'vascular',
    'woody'
);


--
-- Name: TYPE taxonclass; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TYPE taxonclass IS '
= growthform + establishmentmeans_dwc + some others
';


--
-- Name: taxonomic_status; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE taxonomic_status AS ENUM (
    'No opinion',
    'Accepted',
    'Synonym',
    'Illegitimate',
    'Invalid'
);


--
-- Name: TYPE taxonomic_status; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TYPE taxonomic_status IS '
See <http://tnrs.iplantcollaborative.org/instructions.html#Status>
';


SET search_path = public_validations, pg_catalog;

--
-- Name: keys_~type._plots_01_count_of_projects; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_01_count_of_projects" AS (
);


--
-- Name: keys_~type._plots_02_list_of_project_names; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_02_list_of_project_names" AS (
	project_name text
);


--
-- Name: keys_~type._plots_03_count_of_all_plots_in_this_source; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_03_count_of_all_plots_in_this_source" AS (
);


--
-- Name: keys_~type._plots_04_count_of_plots_in_each_project_in_this_sou; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_04_count_of_plots_in_each_project_in_this_sou" AS (
	project_name text
);


--
-- Name: keys_~type._plots_05_list_of_plot_codes_by_project; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_05_list_of_plot_codes_by_project" AS (
	project_name text,
	plot_code text
);


--
-- Name: keys_~type._plots_06_list_of_plots_with_stem_measurements; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_06_list_of_plots_with_stem_measurements" AS (
	project_name text,
	plot_code text
);


--
-- Name: keys_~type._plots_06a_list_of_stems; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_06a_list_of_stems" AS (
	project_name text,
	plot_code text,
	stem_id text
);


--
-- Name: keys_~type._plots_07_list_of_plots_which_use_counts_of_indiv_pe; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_07_list_of_plots_which_use_counts_of_indiv_pe" AS (
	project_name text,
	plot_code text
);


--
-- Name: keys_~type._plots_08_list_of_plots_which_use_percent_cover; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_08_list_of_plots_which_use_percent_cover" AS (
	project_name text,
	plot_code text
);


--
-- Name: keys_~type._plots_09_list_of_plots_which_use_line_intercept; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_09_list_of_plots_which_use_line_intercept" AS (
	project_name text,
	plot_code text
);


--
-- Name: keys_~type._plots_10_count_of_individuals_per_plot_in_each_proj; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_10_count_of_individuals_per_plot_in_each_proj" AS (
	project_name text,
	plot_code text
);


--
-- Name: keys_~type._plots_10a_aggregate_observation_individual_counts; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_10a_aggregate_observation_individual_counts" AS (
	project_name text,
	plot_code text,
	individual_id text
);


--
-- Name: keys_~type._plots_11_count_of_stems_per_plot_in_each_project; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_11_count_of_stems_per_plot_in_each_project" AS (
	project_name text,
	plot_code text
);


--
-- Name: keys_~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_pr; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_pr" AS (
	project_name text,
	plot_code text
);


--
-- Name: keys_~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plo; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plo" AS (
	project_name text,
	plot_code text,
	taxon text
);


--
-- Name: keys_~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot" AS (
	project_name text,
	plot_code text,
	taxon text
);


--
-- Name: keys_~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_" AS (
	project_name text,
	plot_code text,
	taxon text,
	totalpercentcover double precision
);


--
-- Name: keys_~type._plots_16_intercepts_for_each_verb_taxon_in_each_plo; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_16_intercepts_for_each_verb_taxon_in_each_plo" AS (
	project_name text,
	plot_code text,
	taxon text
);


--
-- Name: keys_~type._plots_17_count_of_subplots_per_plot_for_each_projec; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_17_count_of_subplots_per_plot_for_each_projec" AS (
	project_name text,
	plot_code text
);


--
-- Name: keys_~type._plots_18_list_of_subplots_codes_for_each_plot_for_e; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_18_list_of_subplots_codes_for_each_plot_for_e" AS (
	project_name text,
	plot_code text,
	subplot_code text
);


--
-- Name: keys_~type._plots_19_count_of_censuses_per_plot_in_each_project; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._plots_19_count_of_censuses_per_plot_in_each_project" AS (
	project_name text,
	plot_code text
);


--
-- Name: TYPE "keys_~type._plots_19_count_of_censuses_per_plot_in_each_project"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._plots_19_count_of_censuses_per_plot_in_each_project" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_01_count_of_total_records_specimens_in_so; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_01_count_of_total_records_specimens_in_so" AS (
);


--
-- Name: TYPE "keys_~type._specimens_01_count_of_total_records_specimens_in_so"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_01_count_of_total_records_specimens_in_so" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_02_count_of_unique_verbatim_families; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_02_count_of_unique_verbatim_families" AS (
);


--
-- Name: TYPE "keys_~type._specimens_02_count_of_unique_verbatim_families"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_02_count_of_unique_verbatim_families" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_03_list_of_verbatim_families; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_03_list_of_verbatim_families" AS (
	family text
);


--
-- Name: TYPE "keys_~type._specimens_03_list_of_verbatim_families"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_03_list_of_verbatim_families" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_04_count_of_species_binomials; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_04_count_of_species_binomials" AS (
);


--
-- Name: TYPE "keys_~type._specimens_04_count_of_species_binomials"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_04_count_of_species_binomials" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_05_list_of_species_binomials; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_05_list_of_species_binomials" AS (
	species_binomial text
);


--
-- Name: TYPE "keys_~type._specimens_05_list_of_species_binomials"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_05_list_of_species_binomials" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a" AS (
);


--
-- Name: TYPE "keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with" AS (
	taxon_name_with_author text
);


--
-- Name: TYPE "keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w" AS (
);


--
-- Name: TYPE "keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi" AS (
	taxon_name_with_author text
);


--
-- Name: TYPE "keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_10_count_number_of_records_by_institution; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_10_count_number_of_records_by_institution" AS (
	specimen_duplicate_institutions text
);


--
-- Name: TYPE "keys_~type._specimens_10_count_number_of_records_by_institution"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_10_count_number_of_records_by_institution" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_11_list_of_three_standard_political_divis; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_11_list_of_three_standard_political_divis" AS (
	country text,
	"stateProvince" text,
	county text
);


--
-- Name: TYPE "keys_~type._specimens_11_list_of_three_standard_political_divis"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_11_list_of_three_standard_political_divis" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_12_distinct_collector_name_collect_num_da; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_12_distinct_collector_name_collect_num_da" AS (
	"collectorName" text,
	"collectionNumber" text,
	"dateCollected" text
);


--
-- Name: TYPE "keys_~type._specimens_12_distinct_collector_name_collect_num_da"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_12_distinct_collector_name_collect_num_da" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_13_count_of_all_verbatim_and_decimal_lat_; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_13_count_of_all_verbatim_and_decimal_lat_" AS (
);


--
-- Name: TYPE "keys_~type._specimens_13_count_of_all_verbatim_and_decimal_lat_"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_13_count_of_all_verbatim_and_decimal_lat_" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_13a_list_of_all_verbatim_lat_long; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_13a_list_of_all_verbatim_lat_long" AS (
	"verbatimLatitude" text,
	"verbatimLongitude" text
);


--
-- Name: TYPE "keys_~type._specimens_13a_list_of_all_verbatim_lat_long"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_13a_list_of_all_verbatim_lat_long" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_13b_list_of_all_decimal_lat_long; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_13b_list_of_all_decimal_lat_long" AS (
	"decimalLatitude" double precision,
	"decimalLongitude" double precision
);


--
-- Name: TYPE "keys_~type._specimens_13b_list_of_all_decimal_lat_long"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_13b_list_of_all_decimal_lat_long" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_14_count_of_all_invalid_verbatim_lat_long; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_14_count_of_all_invalid_verbatim_lat_long" AS (
);


--
-- Name: TYPE "keys_~type._specimens_14_count_of_all_invalid_verbatim_lat_long"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_14_count_of_all_invalid_verbatim_lat_long" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_15_list_distinct_locality_descriptions; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_15_list_distinct_locality_descriptions" AS (
	"localityDescription" text
);


--
-- Name: TYPE "keys_~type._specimens_15_list_distinct_locality_descriptions"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_15_list_distinct_locality_descriptions" IS '
autogenerated
';


--
-- Name: keys_~type._specimens_16_list_distinct_specimen_descriptions; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._specimens_16_list_distinct_specimen_descriptions" AS (
	"specimenDescription" text
);


--
-- Name: TYPE "keys_~type._specimens_16_list_distinct_specimen_descriptions"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "keys_~type._specimens_16_list_distinct_specimen_descriptions" IS '
autogenerated
';


--
-- Name: keys_~type._traits_01_count_records; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._traits_01_count_records" AS (
);


--
-- Name: keys_~type._traits_02_count_trait_names; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._traits_02_count_trait_names" AS (
);


--
-- Name: keys_~type._traits_03_list_trait_names; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._traits_03_list_trait_names" AS (
	trait text
);


--
-- Name: keys_~type._traits_04_count_records_per_trait; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._traits_04_count_records_per_trait" AS (
	trait text
);


--
-- Name: keys_~type._traits_05_count_taxa; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._traits_05_count_taxa" AS (
);


--
-- Name: keys_~type._traits_06_list_distinct_taxa; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._traits_06_list_distinct_taxa" AS (
	taxonwithauthor text
);


--
-- Name: keys_~type._traits_07_trait_value_and_units; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._traits_07_trait_value_and_units" AS (
	trait text,
	value text,
	units text
);


--
-- Name: keys_~type._traits_08_taxonname_trait_and_value; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "keys_~type._traits_08_taxonname_trait_and_value" AS (
	taxonwithauthor text,
	trait text,
	value text
);


--
-- Name: schema_anchor; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE schema_anchor AS (
);


--
-- Name: TYPE schema_anchor; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE schema_anchor IS 'used with schema_anchor params';


--
-- Name: values__~type._plots_01_count_of_projects; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_01_count_of_projects" AS (
	projects bigint
);


--
-- Name: values__~type._plots_02_list_of_project_names; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_02_list_of_project_names" AS (
	project_name text
);


--
-- Name: values__~type._plots_03_count_of_all_plots_in_this_source; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_03_count_of_all_plots_in_this_source" AS (
	plots bigint
);


--
-- Name: values__~type._plots_04_count_of_plots_in_each_project_in_this_; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_04_count_of_plots_in_each_project_in_this_" AS (
	plots bigint
);


--
-- Name: values__~type._plots_05_list_of_plot_codes_by_project; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_05_list_of_plot_codes_by_project" AS (
	project_name text,
	plot_code text
);


--
-- Name: values__~type._plots_06_list_of_plots_with_stem_measurements; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_06_list_of_plots_with_stem_measurements" AS (
	project_name text,
	plot_code text
);


--
-- Name: values__~type._plots_06a_list_of_stems; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_06a_list_of_stems" AS (
	project_name text,
	plot_code text,
	stem_id text
);


--
-- Name: values__~type._plots_07_list_of_plots_which_use_counts_of_indiv; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_07_list_of_plots_which_use_counts_of_indiv" AS (
	project_name text,
	plot_code text
);


--
-- Name: values__~type._plots_08_list_of_plots_which_use_percent_cover; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_08_list_of_plots_which_use_percent_cover" AS (
	project_name text,
	plot_code text
);


--
-- Name: values__~type._plots_09_list_of_plots_which_use_line_intercept; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_09_list_of_plots_which_use_line_intercept" AS (
	project_name text,
	plot_code text
);


--
-- Name: values__~type._plots_10_count_of_individuals_per_plot_in_each_p; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_10_count_of_individuals_per_plot_in_each_p" AS (
	individuals bigint
);


--
-- Name: values__~type._plots_10a_aggregate_observation_individual_count; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_10a_aggregate_observation_individual_count" AS (
	individuals integer
);


--
-- Name: values__~type._plots_11_count_of_stems_per_plot_in_each_project; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_11_count_of_stems_per_plot_in_each_project" AS (
	stems bigint
);


--
-- Name: values__~type._plots_12_count_of_verbatim_taxa_per_plot_in_each; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_12_count_of_verbatim_taxa_per_plot_in_each" AS (
	taxa bigint
);


--
-- Name: values__~type._plots_13_list_of_distinct_verbatim_taxa_in_each_; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_13_list_of_distinct_verbatim_taxa_in_each_" AS (
	project_name text,
	plot_code text,
	taxon text
);


--
-- Name: values__~type._plots_14_count_of_indiv_per_verbatim_taxon_per_p; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_14_count_of_indiv_per_verbatim_taxon_per_p" AS (
	individuals bigint
);


--
-- Name: values__~type._plots_15_pct_cover_of_each_verb_taxon_in_each_pl; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_15_pct_cover_of_each_verb_taxon_in_each_pl" AS (
	project_name text,
	plot_code text,
	taxon text,
	totalpercentcover double precision
);


--
-- Name: values__~type._plots_16_intercepts_for_each_verb_taxon_in_each_; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_16_intercepts_for_each_verb_taxon_in_each_" AS (
	intercept_cm double precision
);


--
-- Name: values__~type._plots_17_count_of_subplots_per_plot_for_each_pro; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_17_count_of_subplots_per_plot_for_each_pro" AS (
	subplots bigint
);


--
-- Name: values__~type._plots_18_list_of_subplots_codes_for_each_plot_fo; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_18_list_of_subplots_codes_for_each_plot_fo" AS (
	project_name text,
	plot_code text,
	subplot_code text
);


--
-- Name: values__~type._plots_19_count_of_censuses_per_plot_in_each_proj; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._plots_19_count_of_censuses_per_plot_in_each_proj" AS (
	inventories bigint
);


--
-- Name: TYPE "values__~type._plots_19_count_of_censuses_per_plot_in_each_proj"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._plots_19_count_of_censuses_per_plot_in_each_proj" IS '
autogenerated
';


--
-- Name: values__~type._specimens_01_count_of_total_records_specimens_in; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_01_count_of_total_records_specimens_in" AS (
	"totalSpecimenRecords" bigint
);


--
-- Name: TYPE "values__~type._specimens_01_count_of_total_records_specimens_in"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_01_count_of_total_records_specimens_in" IS '
autogenerated
';


--
-- Name: values__~type._specimens_02_count_of_unique_verbatim_families; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_02_count_of_unique_verbatim_families" AS (
	families bigint
);


--
-- Name: TYPE "values__~type._specimens_02_count_of_unique_verbatim_families"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_02_count_of_unique_verbatim_families" IS '
autogenerated
';


--
-- Name: values__~type._specimens_03_list_of_verbatim_families; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_03_list_of_verbatim_families" AS (
	family text
);


--
-- Name: TYPE "values__~type._specimens_03_list_of_verbatim_families"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_03_list_of_verbatim_families" IS '
autogenerated
';


--
-- Name: values__~type._specimens_04_count_of_species_binomials; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_04_count_of_species_binomials" AS (
	species_binomials bigint
);


--
-- Name: TYPE "values__~type._specimens_04_count_of_species_binomials"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_04_count_of_species_binomials" IS '
autogenerated
';


--
-- Name: values__~type._specimens_05_list_of_species_binomials; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_05_list_of_species_binomials" AS (
	species_binomial text
);


--
-- Name: TYPE "values__~type._specimens_05_list_of_species_binomials"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_05_list_of_species_binomials" IS '
autogenerated
';


--
-- Name: values__~type._specimens_06_count_of_unique_verb_subsp_taxa_wit; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_06_count_of_unique_verb_subsp_taxa_wit" AS (
	taxon_names_with_author bigint
);


--
-- Name: TYPE "values__~type._specimens_06_count_of_unique_verb_subsp_taxa_wit"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_06_count_of_unique_verb_subsp_taxa_wit" IS '
autogenerated
';


--
-- Name: values__~type._specimens_07_list_of_verbatim_subspecific_taxa_w; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_07_list_of_verbatim_subspecific_taxa_w" AS (
	taxon_name_with_author text
);


--
-- Name: TYPE "values__~type._specimens_07_list_of_verbatim_subspecific_taxa_w"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_07_list_of_verbatim_subspecific_taxa_w" IS '
autogenerated
';


--
-- Name: values__~type._specimens_08_count_of_unique_verbatim_author_tax; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_08_count_of_unique_verbatim_author_tax" AS (
	taxon_names_with_author bigint
);


--
-- Name: TYPE "values__~type._specimens_08_count_of_unique_verbatim_author_tax"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_08_count_of_unique_verbatim_author_tax" IS '
autogenerated
';


--
-- Name: values__~type._specimens_09_list_of_unique_verbatim_author_taxa; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_09_list_of_unique_verbatim_author_taxa" AS (
	taxon_name_with_author text
);


--
-- Name: TYPE "values__~type._specimens_09_list_of_unique_verbatim_author_taxa"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_09_list_of_unique_verbatim_author_taxa" IS '
autogenerated
';


--
-- Name: values__~type._specimens_10_count_number_of_records_by_institut; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_10_count_number_of_records_by_institut" AS (
	records bigint
);


--
-- Name: TYPE "values__~type._specimens_10_count_number_of_records_by_institut"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_10_count_number_of_records_by_institut" IS '
autogenerated
';


--
-- Name: values__~type._specimens_11_list_of_three_standard_political_di; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_11_list_of_three_standard_political_di" AS (
	country text,
	"stateProvince" text,
	county text
);


--
-- Name: TYPE "values__~type._specimens_11_list_of_three_standard_political_di"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_11_list_of_three_standard_political_di" IS '
autogenerated
';


--
-- Name: values__~type._specimens_12_distinct_collector_name_collect_num; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_12_distinct_collector_name_collect_num" AS (
	"specimenRecords" bigint
);


--
-- Name: TYPE "values__~type._specimens_12_distinct_collector_name_collect_num"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_12_distinct_collector_name_collect_num" IS '
autogenerated
';


--
-- Name: values__~type._specimens_13_count_of_all_verbatim_and_decimal_l; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_13_count_of_all_verbatim_and_decimal_l" AS (
	"allLatLongs" bigint,
	"decimalLatLongs" bigint
);


--
-- Name: TYPE "values__~type._specimens_13_count_of_all_verbatim_and_decimal_l"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_13_count_of_all_verbatim_and_decimal_l" IS '
autogenerated
';


--
-- Name: values__~type._specimens_13a_list_of_all_verbatim_lat_long; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_13a_list_of_all_verbatim_lat_long" AS (
	"verbatimLatitude" text,
	"verbatimLongitude" text
);


--
-- Name: TYPE "values__~type._specimens_13a_list_of_all_verbatim_lat_long"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_13a_list_of_all_verbatim_lat_long" IS '
autogenerated
';


--
-- Name: values__~type._specimens_13b_list_of_all_decimal_lat_long; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_13b_list_of_all_decimal_lat_long" AS (
	"decimalLatitude" double precision,
	"decimalLongitude" double precision
);


--
-- Name: TYPE "values__~type._specimens_13b_list_of_all_decimal_lat_long"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_13b_list_of_all_decimal_lat_long" IS '
autogenerated
';


--
-- Name: values__~type._specimens_14_count_of_all_invalid_verbatim_lat_l; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_14_count_of_all_invalid_verbatim_lat_l" AS (
	"badLats" bigint,
	"badLongs" bigint
);


--
-- Name: TYPE "values__~type._specimens_14_count_of_all_invalid_verbatim_lat_l"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_14_count_of_all_invalid_verbatim_lat_l" IS '
autogenerated
';


--
-- Name: values__~type._specimens_15_list_distinct_locality_descriptions; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_15_list_distinct_locality_descriptions" AS (
	"localityDescription" text
);


--
-- Name: TYPE "values__~type._specimens_15_list_distinct_locality_descriptions"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_15_list_distinct_locality_descriptions" IS '
autogenerated
';


--
-- Name: values__~type._specimens_16_list_distinct_specimen_descriptions; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._specimens_16_list_distinct_specimen_descriptions" AS (
	"specimenDescription" text
);


--
-- Name: TYPE "values__~type._specimens_16_list_distinct_specimen_descriptions"; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON TYPE "values__~type._specimens_16_list_distinct_specimen_descriptions" IS '
autogenerated
';


--
-- Name: values__~type._traits_01_count_records; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._traits_01_count_records" AS (
	"totalRecords" bigint
);


--
-- Name: values__~type._traits_02_count_trait_names; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._traits_02_count_trait_names" AS (
	traits bigint
);


--
-- Name: values__~type._traits_03_list_trait_names; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._traits_03_list_trait_names" AS (
	trait text
);


--
-- Name: values__~type._traits_04_count_records_per_trait; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._traits_04_count_records_per_trait" AS (
	measurements bigint
);


--
-- Name: values__~type._traits_05_count_taxa; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._traits_05_count_taxa" AS (
	taxa bigint
);


--
-- Name: values__~type._traits_06_list_distinct_taxa; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._traits_06_list_distinct_taxa" AS (
	taxonwithauthor text
);


--
-- Name: values__~type._traits_07_trait_value_and_units; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._traits_07_trait_value_and_units" AS (
	trait text,
	value text,
	units text
);


--
-- Name: values__~type._traits_08_taxonname_trait_and_value; Type: TYPE; Schema: public_validations; Owner: -
--

CREATE TYPE "values__~type._traits_08_taxonname_trait_and_value" AS (
	taxonwithauthor text,
	trait text,
	value text
);


SET search_path = public, pg_catalog;

--
-- Name: _cm_to_m(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _cm_to_m(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1/100.
$_$;


--
-- Name: _filter_genus(text); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _filter_genus(value text) RETURNS text
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT (CASE WHEN $1 ~ '\d' THEN NULL ELSE $1 END)
$_$;


--
-- Name: _fraction_to_percent(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _fraction_to_percent(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1*100.
$_$;


--
-- Name: _ft_to_m(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _ft_to_m(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT _in_to_m($1*12)
$_$;


--
-- Name: _ha_to_m2(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _ha_to_m2(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1*10000.
$_$;


--
-- Name: _has_taxonomic_name(taxonrank); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _has_taxonomic_name(rank taxonrank) RETURNS boolean
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1 >= 'family'
$_$;


--
-- Name: _in_to_m(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _in_to_m(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1*2.54/100.
$_$;


--
-- Name: _km_to_m(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _km_to_m(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT util._km_to_m($1)
$_$;


--
-- Name: _locationnarrative_is_cultivated(text); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _locationnarrative_is_cultivated(locationnarrative text) RETURNS boolean
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT bool_or(value)
FROM
(VALUES
      (NULLIF($1 LIKE '%cultivated%', false))
    , (NULLIF($1 LIKE '%cultivad%', false))
    , (NULLIF($1 LIKE '%ornamental%', false))
    , (NULLIF($1 LIKE '%garden%', false))
    , (NULLIF($1 LIKE '%jardin%', false))
    , (NULLIF($1 LIKE '%jard?n%', false))
    , (NULLIF($1 LIKE '%jardim%', false))
    , (NULLIF($1 LIKE '%plantation%', false))
    , (NULLIF($1 LIKE '%plantacion%', false))
    , (NULLIF($1 LIKE '%plantaci?n%', false))
    , (NULLIF($1 LIKE '%universit%', false))
    , (NULLIF($1 LIKE '%universidad%', false))
    , (NULLIF($1 LIKE '%campus%' , false))
    , (NULLIF($1 LIKE '%urban%', false))
    , (NULLIF($1 LIKE '%greenhouse%', false))
    , (NULLIF($1 LIKE '%arboretum%', false))
    , (NULLIF($1 LIKE '%farm%', false))
    , (NULLIF($1 LIKE '%weed%', false))
    , (NULLIF($1 LIKE '%corn field%', false))
)
AS v (value)
$_$;


--
-- Name: _m2_to_ha(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _m2_to_ha(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1/10000.
$_$;


--
-- Name: _m_to_cm(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _m_to_cm(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1*100.
$_$;


--
-- Name: _m_to_km(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _m_to_km(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1/1000.
$_$;


--
-- Name: _mm_to_m(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _mm_to_m(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1/1000.
$_$;


--
-- Name: _or(boolean, boolean, boolean, boolean, boolean); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _or("0" boolean DEFAULT NULL::boolean, "1" boolean DEFAULT NULL::boolean, "2" boolean DEFAULT NULL::boolean, "3" boolean DEFAULT NULL::boolean, "4" boolean DEFAULT NULL::boolean) RETURNS boolean
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT bool_or(value)
FROM
(VALUES
      ($1)
    , ($2)
    , ($3)
    , ($4)
    , ($5)
)
AS v (value)
$_$;


--
-- Name: FUNCTION _or("0" boolean, "1" boolean, "2" boolean, "3" boolean, "4" boolean); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION _or("0" boolean, "1" boolean, "2" boolean, "3" boolean, "4" boolean) IS '
_or() ignores NULL values, while OR combines them with the other values to potentially convert false to NULL. OR should be used with required fields, and _or() with optional fields.
';


--
-- Name: _percent_to_fraction(double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _percent_to_fraction(value double precision) RETURNS double precision
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1/100.
$_$;


--
-- Name: _taxon_family_require_std(text); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _taxon_family_require_std(family text) RETURNS text
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT (CASE WHEN
    lower($1) LIKE '%aceae'
    OR lower($1) IN (
        'compositae',
        'cruciferae',
        'gramineae',
        'labiatae',
        'leguminosae',
        'palmae',
        'umbelliferae'
    )
THEN $1 ELSE NULL END)
$_$;


--
-- Name: _taxonlabel_set_parent_id(integer, integer); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _taxonlabel_set_parent_id(taxonlabel_id integer, parent_id integer) RETURNS integer
    LANGUAGE sql
    AS $_$
UPDATE taxonlabel SET parent_id = $2 WHERE taxonlabel_id = $1 RETURNING $1
$_$;


--
-- Name: _taxonomic_name_is_epithet(taxonrank); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION _taxonomic_name_is_epithet(rank taxonrank) RETURNS boolean
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT $1 <= 'genus'
$_$;


--
-- Name: analytical_stem_view_modify(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION analytical_stem_view_modify() RETURNS void
    LANGUAGE sql
    AS $_$
SELECT util.recreate($$
DROP TABLE IF EXISTS analytical_stem;
SELECT util.copy('analytical_stem_view'::regclass, 'analytical_stem');
ALTER TABLE analytical_stem ADD COLUMN "TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" serial PRIMARY KEY;
COMMENT ON COLUMN analytical_stem."TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" IS 'VegBIEN-autogenerated "identifier assigned to each unique observation of a taxon in a plot"';

GRANT SELECT ON TABLE analytical_stem TO bien_read;
GRANT SELECT ON TABLE analytical_stem_view TO bien_read;

ALTER TABLE analytical_stem ALTER COLUMN "datasource__@Brad__.identifier_examples@vegpath.org" SET NOT NULL;
ALTER TABLE analytical_stem ALTER COLUMN "locationID__@DwC__@vegpath.org" SET NOT NULL;

CREATE INDEX ON analytical_stem ("datasource__@Brad__.identifier_examples@vegpath.org", "occurrenceID__@DwC__@vegpath.org");
CREATE INDEX ON analytical_stem ("datasource__@Brad__.identifier_examples@vegpath.org", "[custodial_]institutionCode[s]__@DwC__@vegpath.org", "collectionCode__@DwC__@vegpath.org", "catalogNumber__@DwC__@vegpath.org");
CREATE INDEX ON analytical_stem ("datasource__@Brad__.identifier_examples@vegpath.org", "projectID__@VegX__.plotObservation@vegpath.org", "locationID__@DwC__@vegpath.org", "eventDate__@DwC__@vegpath.org");
CREATE INDEX ON analytical_stem ("speciesBinomialWithMorphospecies__@VegCore__@vegpath.org");
$$);
$_$;


--
-- Name: datasource_publish(text, anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION datasource_publish(datasource text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
DECLARE
	live_datasource text;
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	live_datasource = rm_version_suffix(datasource);
	
	-- don't datasource_rm() the datasource to publish!
	IF live_datasource = datasource THEN RETURN; END IF;
	
	PERFORM datasource_rm(live_datasource, schema_anchor);
	PERFORM datasource_rename(datasource, live_datasource, schema_anchor);
END;
$$;


--
-- Name: FUNCTION datasource_publish(datasource text, schema_anchor anyelement); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION datasource_publish(datasource text, schema_anchor anyelement) IS '
secure against renamings of the public schema.

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: datasource_rename(text, text, anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION datasource_rename(old text, new text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	UPDATE source SET shortname = new WHERE shortname = old;
END;
$$;


--
-- Name: FUNCTION datasource_rename(old text, new text, schema_anchor anyelement); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION datasource_rename(old text, new text, schema_anchor anyelement) IS '
secure against renamings of the public schema.

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: datasource_rm(text, anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION datasource_rm(datasource text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	DELETE FROM source WHERE shortname = datasource;
END;
$$;


--
-- Name: FUNCTION datasource_rm(datasource text, schema_anchor anyelement); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION datasource_rm(datasource text, schema_anchor anyelement) IS '
secure against renamings of the public schema.

schema_anchor: identifies this function''s schema. should be left as the default.

runtime:
ACAD:  30 s  :   27738 ms/   45,503 rows = 0.61 ms/row
MO  :  55 min: 3311962 ms/3,894,706 rows = 0.85 ms/row
GBIF: ~13 h  : 55,417,646 rows * 0.85 ms/row * 1 s/1000 ms * 1 h/3600 s = 13.1 h

to calculate runtime:
BEGIN;
SELECT datasource_rm(''datasource'');
ROLLBACK;
';


--
-- Name: datasource_unpublish(text, anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION datasource_unpublish(datasource text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	PERFORM datasource_rename(datasource, datasource||'.new');
END;
$$;


--
-- Name: FUNCTION datasource_unpublish(datasource text, schema_anchor anyelement); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION datasource_unpublish(datasource text, schema_anchor anyelement) IS '
secure against renamings of the public schema.

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: delete_scrubbed_taxondeterminations(text); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION delete_scrubbed_taxondeterminations(datasource text) RETURNS void
    LANGUAGE sql
    AS $_$
DELETE FROM taxondetermination
USING taxonoccurrence
WHERE
    taxonoccurrence.source_id = (SELECT source_by_shortname($1))
AND taxondetermination.taxonoccurrence_id = taxonoccurrence.taxonoccurrence_id
AND taxondetermination.source_id = (SELECT source_by_shortname('TNRS'))
$_$;


--
-- Name: geoscrub_input_view_modify(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION geoscrub_input_view_modify() RETURNS void
    LANGUAGE sql
    AS $$
DROP TABLE IF EXISTS geoscrub_input;
SELECT util.copy('geoscrub_input_view'::regclass, 'geoscrub_input');

GRANT SELECT ON TABLE geoscrub_input TO bien_read;
GRANT SELECT ON TABLE geoscrub_input_view TO bien_read;
$$;


--
-- Name: in_iucn_red_list(text, text, anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION in_iucn_red_list(accepted_family text, accepted_species_binomial text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS boolean
    LANGUAGE plpgsql STABLE
    SET client_min_messages TO 'warning'
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
DECLARE
	accepted_family_ text = accepted_family;
	accepted_species_binomial_ text = accepted_species_binomial;
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	RETURN EXISTS(
		SELECT NULL FROM iucn_red_list t
		WHERE
			t.accepted_family = accepted_family_
		AND	t.accepted_species_binomial = accepted_species_binomial_
	);
END;
$$;


--
-- Name: in_new_world(double precision, double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION in_new_world(latitude_deg double precision, longitude_deg double precision) RETURNS boolean
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT util.in_new_world(($1, $2))
$_$;


--
-- Name: FUNCTION in_new_world(latitude_deg double precision, longitude_deg double precision); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION in_new_world(latitude_deg double precision, longitude_deg double precision) IS '
wrapper that prevents views from getting dropped when the util schema is reinstalled
';


--
-- Name: in_south_america(double precision, double precision); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION in_south_america(latitude_deg double precision, longitude_deg double precision) RETURNS boolean
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT util.in_south_america(($1, $2))
$_$;


--
-- Name: FUNCTION in_south_america(latitude_deg double precision, longitude_deg double precision); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION in_south_america(latitude_deg double precision, longitude_deg double precision) IS '
wrapper that prevents views from getting dropped when the util schema is reinstalled
';


--
-- Name: iucn_red_list_view_modify(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION iucn_red_list_view_modify() RETURNS void
    LANGUAGE sql
    AS $$
SELECT util.rematerialize_view('iucn_red_list', 'iucn_red_list_view');

ALTER TABLE iucn_red_list ADD PRIMARY KEY(accepted_family, accepted_species_binomial);
$$;


--
-- Name: location__pull_forward_from_parent(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION location__pull_forward_from_parent() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
	parent location;
BEGIN
	SELECT * INTO parent FROM location WHERE location_id = new.parent_id;
	
	IF new.place_id IS NULL THEN new.place_id = parent.place_id; END IF;
	
	RETURN new;
END;
$$;


--
-- Name: FUNCTION location__pull_forward_from_parent(); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION location__pull_forward_from_parent() IS '
see wiki.vegpath.org/Pull-forward
';


--
-- Name: location_set_plot_location_id(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION location_set_plot_location_id() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
	new.plot_location_id = (CASE WHEN new.parent_id IS NULL
		THEN new.location_id
		ELSE (SELECT plot_location_id FROM location WHERE location_id = new.parent_id)
		END);
	RETURN new;
END;
$$;


--
-- Name: locationevent__communities(integer); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION locationevent__communities(locationevent_id integer) RETURNS SETOF text
    LANGUAGE sql STABLE
    AS $_$
SELECT commdescription
FROM      commclass
/* inner-join to commdetermination instead of left-joining, so that this does
not produce community entries (which occur because there is one commclass per
locationevent, but only some commclasses will then have a commdetermination) */
JOIN      commdetermination USING (commclass_id)
LEFT JOIN commconcept       USING (commconcept_id)
WHERE locationevent_id = $1
ORDER BY commdescription
$_$;


--
-- Name: locationevent__communities__array(integer); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION locationevent__communities__array(locationevent_id integer) RETURNS text[]
    LANGUAGE sql STABLE
    AS $_$
SELECT array_agg(locationevent__communities)
FROM locationevent__communities($1)
$_$;


--
-- Name: locationevent__contributors(integer); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION locationevent__contributors(locationevent_id integer) RETURNS SETOF text
    LANGUAGE sql STABLE
    AS $_$
SELECT fullname
FROM locationeventcontributor
LEFT JOIN party USING (party_id)
WHERE locationevent_id = $1
ORDER BY fullname
$_$;


--
-- Name: locationevent__contributors__array(integer); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION locationevent__contributors__array(locationevent_id integer) RETURNS text[]
    LANGUAGE sql STABLE
    AS $_$
SELECT array_agg(locationevent__contributors)
FROM locationevent__contributors($1)
$_$;


--
-- Name: locationevent_pull_forward_from_parent(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION locationevent_pull_forward_from_parent() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
	parent locationevent;
BEGIN
	SELECT * INTO parent FROM locationevent WHERE locationevent_id = new.parent_id;
	
	IF new.project_id IS NULL THEN new.project_id = parent.project_id; END IF;
	
	RETURN new;
END;
$$;


--
-- Name: FUNCTION locationevent_pull_forward_from_parent(); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION locationevent_pull_forward_from_parent() IS '
see wiki.vegpath.org/Pull-forward
';


--
-- Name: locationevent_pull_forward_from_parent_for_stratum(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION locationevent_pull_forward_from_parent_for_stratum() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
DECLARE
	parent locationevent;
BEGIN
	SELECT * INTO parent FROM locationevent WHERE locationevent_id = new.parent_id;
	
	IF new.location_id IS NULL THEN new.location_id = parent.location_id; END IF;
	
	RETURN new;
END;
$$;


--
-- Name: FUNCTION locationevent_pull_forward_from_parent_for_stratum(); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION locationevent_pull_forward_from_parent_for_stratum() IS '
see wiki.vegpath.org/Pull-forward
';


--
-- Name: locationevent_set_place_visit_id(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION locationevent_set_place_visit_id() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
	new.place_visit_id = (CASE WHEN new.parent_id IS NULL
		THEN new.locationevent_id
		ELSE (SELECT place_visit_id FROM locationevent WHERE locationevent_id = new.parent_id)
		END);
	RETURN new;
END;
$$;


--
-- Name: locationevent_set_plot_id(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION locationevent_set_plot_id() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
	new.plot_id = (SELECT plot_location_id FROM location
		WHERE location_id = new.location_id);
	RETURN new;
END;
$$;


--
-- Name: locationplace__set_location_current_place(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION locationplace__set_location_current_place() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
	UPDATE location SET place_id = new.place_id
	WHERE location_id = new.location_id;
	
	RETURN new;
END;
$$;


--
-- Name: make_family_higher_plant_group(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION make_family_higher_plant_group() RETURNS void
    LANGUAGE plpgsql
    AS $$
DECLARE
    source_id_ integer :=
        (SELECT source_id FROM source WHERE shortname = 'NCBI');
    row_ higher_plant_group_nodes%ROWTYPE;
BEGIN
    TRUNCATE family_higher_plant_group;
    
    FOR row_ IN
        SELECT * FROM higher_plant_group_nodes
        ORDER BY higher_plant_group, node_name
    LOOP
        DECLARE
            higher_plant_group_id integer := (
                SELECT taxonlabel_id FROM taxonlabel
                WHERE source_id = source_id_
                AND taxonomicname = row_.node_name
            );
            family text;
        BEGIN
            FOR family IN
                SELECT taxonepithet
                FROM taxonlabel_relationship
                JOIN taxonlabel ON taxonlabel_id = descendant_id
                WHERE ancestor_id = higher_plant_group_id
                AND rank = 'family'
                AND source_id = source_id_
                AND taxonepithet IS NOT NULL
            LOOP
                BEGIN
                    INSERT INTO family_higher_plant_group
                    VALUES (family, row_.higher_plant_group)
                    ;
                EXCEPTION
                    WHEN unique_violation THEN NULL;
                END;
            END LOOP;
        END;
    END LOOP;
END;
$$;


--
-- Name: party_source_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION party_source_id_self_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    IF new.party_id IS NULL THEN -- prepopulate party_id
        new.party_id = nextval('party_party_id_seq'::regclass);
    END IF;
    IF new.source_id = 0 THEN -- make self-source
        new.source_id = new.party_id;
    END IF;
    RETURN new;
END;
$$;


--
-- Name: place_matched_place_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION place_matched_place_id_self_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    IF new.place_id IS NULL THEN -- prepopulate place_id
        new.place_id = nextval('place_place_id_seq'::regclass);
    END IF;
    IF new.matched_place_id = 0 THEN -- make self-source
        new.matched_place_id = new.place_id;
    END IF;
    RETURN new;
END;
$$;


SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: place; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE place (
    place_id integer NOT NULL,
    source_id integer NOT NULL,
    canon_place_id integer,
    matched_place_id integer,
    coordinates_id integer,
    placename_id integer,
    continent text,
    country text,
    stateprovince text,
    county text,
    description text,
    geovalid boolean DEFAULT false NOT NULL,
    distance_to_country_m double precision,
    distance_to_state_m double precision,
    distance_to_county_m double precision,
    CONSTRAINT place_required_key CHECK ((((((coordinates_id IS NOT NULL) OR (continent IS NOT NULL)) OR (country IS NOT NULL)) OR (stateprovince IS NOT NULL)) OR (county IS NOT NULL)))
);


--
-- Name: TABLE place; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE place IS '
The full path to a place. Can be either verbatim or accepted. For accepted names, points to the identified place.

To use a custom hierarchy of placenames with no explicit column, point to the lowest-rank placename in placename_id.
';


--
-- Name: COLUMN place.matched_place_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN place.matched_place_id IS '
The closest match to this place. Places should be linked in a three-level hierarchy of datasource place -> verbatim place -> accepted place.

An accepted place should point to itself in this field. This will happen automatically by setting it to the special value 0.
';


--
-- Name: place_set_canon_place_id(place, integer, boolean); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION place_set_canon_place_id(new place, old_matched_place_id integer DEFAULT NULL::integer, is_update boolean DEFAULT false) RETURNS place
    LANGUAGE plpgsql
    AS $$
BEGIN
    IF NOT is_update
        OR new.matched_place_id IS DISTINCT FROM old_matched_place_id THEN
        IF new.matched_place_id IS NOT NULL THEN
            IF new.matched_place_id = new.place_id THEN -- self-source
                new.canon_place_id := new.place_id; -- make self-source
            ELSE -- propagate from matched place
                new.canon_place_id := (
                    SELECT canon_place_id
                    FROM place
                    WHERE place_id = new.matched_place_id
                );
            END IF;
            
            IF is_update THEN
                -- Update canon_place_id on places that resolve to this place
                UPDATE place
                SET canon_place_id = new.canon_place_id
                WHERE matched_place_id = new.place_id
                AND place_id != new.place_id -- no infinite recursion
                ;
            END IF;
        ELSE -- no matched place
            new.canon_place_id := new.place_id; -- make self-source
        END IF;
    END IF;
    
    RETURN new;
END;
$$;


--
-- Name: place_set_canon_place_id_on_insert(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION place_set_canon_place_id_on_insert() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    new := place_set_canon_place_id(new);
    
    RETURN new;
END;
$$;


--
-- Name: place_set_canon_place_id_on_update(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION place_set_canon_place_id_on_update() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    new := place_set_canon_place_id(new, old.matched_place_id, true);
    
    RETURN new;
END;
$$;


--
-- Name: placename_update_ancestors(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION placename_update_ancestors() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    -- Delete existing ancestors
    DELETE FROM placename_ancestor WHERE placename_id = new.placename_id;
    
    IF new.parent_id IS NOT NULL THEN
        -- Copy parent's ancestors to this node's ancestors
        INSERT
        INTO placename_ancestor
        (placename_id, ancestor_id)
        SELECT
            new.placename_id, ancestor_id
        FROM placename_ancestor
        WHERE placename_id = new.parent_id
        ;
    END IF;
    
    -- Add "ancestor" for this node
    /* This is useful for queries, because you don't have to separately test if
    the leaf node is the one you're looking for, in addition to that leaf node's
    ancestors. */
    INSERT
    INTO placename_ancestor
    (placename_id, ancestor_id)
    VALUES (new.placename_id, new.placename_id)
    ;
    
    -- Tell immediate children to update their ancestors lists, which will
    -- recursively tell all descendants
    UPDATE placename
    SET placename_id = placename_id -- need at least one SET statement
    -- Add COALESCE() to enable using placename_unique index for lookup
    WHERE COALESCE(parent_id, 2147483647) = new.placename_id
    AND placename_id != new.placename_id -- avoid infinite recursion
    ;
    
    /* Note: We don't need an ON DELETE trigger to update the descendants'
    ancestors when a node is deleted, because the placename.placename_parent_id
    foreign key is set to ON DELETE CASCADE, which just removes all the
    descendants anyway. */
    
    RETURN new;
END;
$$;


--
-- Name: plantobservation_aggregateoccurrence_count_1(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION plantobservation_aggregateoccurrence_count_1() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
	IF (SELECT observationtype = 'specimen' FROM source
		WHERE source_id = new.source_id) THEN
		UPDATE aggregateoccurrence
		SET count = GREATEST(COALESCE(count, 0), 1) -- at least 1
		WHERE aggregateoccurrence_id = new.aggregateoccurrence_id
		;
	END IF;
	RETURN new;
END;
$$;


--
-- Name: plot.**.modify(text, anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION "plot.**.modify"(view_query text DEFAULT NULL::text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    AS $_$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	PERFORM util.recreate_view('"plot.**"', $1);
END;
$_$;


--
-- Name: FUNCTION "plot.**.modify"(view_query text, schema_anchor anyelement); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION "plot.**.modify"(view_query text, schema_anchor anyelement) IS '
usage:
SELECT "plot.**.modify"($$
SELECT __
$$);

idempotent
';


--
-- Name: project_contributors(integer); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION project_contributors(project_id integer) RETURNS SETOF text
    LANGUAGE sql STABLE
    AS $_$
SELECT fullname
FROM projectcontributor
LEFT JOIN party USING (party_id)
WHERE project_id = $1
ORDER BY fullname
$_$;


--
-- Name: FUNCTION project_contributors(project_id integer); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION project_contributors(project_id integer) IS '
usage: array(SELECT project_contributors(...))
';


--
-- Name: provider_count_view_modify(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION provider_count_view_modify() RETURNS void
    LANGUAGE sql
    AS $$
DROP TABLE IF EXISTS provider_count;
SELECT util.copy('provider_count_view'::regclass, 'provider_count');

GRANT SELECT ON TABLE provider_count TO bien_read;
GRANT SELECT ON TABLE provider_count TO public_;
GRANT SELECT ON TABLE provider_count_view TO bien_read;
GRANT SELECT ON TABLE provider_count_view TO public_;

ALTER TABLE provider_count ADD PRIMARY KEY (dataprovider, dataset);
$$;


--
-- Name: public_schema_publish(text); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION public_schema_publish(schema text) RETURNS void
    LANGUAGE sql
    AS $_$
SELECT util.schema_bundle_replace('public', $1);
$_$;


--
-- Name: publish(anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION publish(schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	PERFORM public_schema_publish(util.schema_esc(schema_anchor));
END;
$$;


--
-- Name: FUNCTION publish(schema_anchor anyelement); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION publish(schema_anchor anyelement) IS '
publishes this schema.

usage: SELECT public_schema.publish()

runtime: 1 min ("1m10.451s")

secure against renamings of the public schema.

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: rm(anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION rm(schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	PERFORM util.schema_bundle_rm(util.schema_esc(schema_anchor));
END;
$$;


--
-- Name: FUNCTION rm(schema_anchor anyelement); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION rm(schema_anchor anyelement) IS '
deletes this schema.

usage: SELECT public_schema.rm()

runtime: 1 min ("1m10.451s")

secure against renamings of the public schema.

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: rm_version_suffix(text); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION rm_version_suffix(name text) RETURNS text
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT regexp_replace($1, '\..*$', '')
$_$;


--
-- Name: source__observation_type(text, anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION source__observation_type(shortname text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS text
    LANGUAGE plpgsql STABLE
    SET client_min_messages TO 'warning'
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
DECLARE
	shortname_ text = shortname;
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	RETURN (SELECT observationtype FROM source
		WHERE source.shortname = shortname_);
END;
$$;


--
-- Name: source_by_shortname(text, anyelement); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION source_by_shortname(shortname text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS integer
    LANGUAGE plpgsql STABLE
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
DECLARE
	source_id_ integer;
	shortname_ text = shortname;
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	SELECT source_id INTO source_id_
	FROM source WHERE source.shortname = shortname_ LIMIT 1
	;
	
	RETURN source_id_;
END;
$$;


--
-- Name: FUNCTION source_by_shortname(shortname text, schema_anchor anyelement); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION source_by_shortname(shortname text, schema_anchor anyelement) IS '
usage:
-- try each of these and use whichever creates the better query plan:
SELECT public.source_by_shortname(''datasource'') AS source_id;
SELECT (SELECT public.source_by_shortname(''datasource'')) AS source_id;
/* *sometimes*, this must instead be run as a nested SELECT, because in some
cases, Postgres apparently will not inline it[1]. *however*, in other cases, you
must *not* use a nested SELECT, because this will prevent Postgres from using an
index scan (causing an equally bad slowdown).

[1] not inlining causes the query to be run for *each* row in a table of
potentially millions, and creates a significant slowdown; eg. >~1.5 hours
("5013s") for SALVIAS._plots_06_list_of_plots_with_stem_measurements.
*/
';


--
-- Name: sourcename_set_matched_source_id(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION sourcename_set_matched_source_id() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    IF new.matched_source_id IS NULL THEN -- populate matched_source_id
        new.matched_source_id :=
            (SELECT source_id FROM source WHERE shortname = new.name);
    END IF;
    RETURN new;
END;
$$;


--
-- Name: subspecies(text); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION subspecies(taxon_name text) RETURNS text
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT util.subspecies($1)
$_$;


--
-- Name: FUNCTION subspecies(taxon_name text); Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON FUNCTION subspecies(taxon_name text) IS '
wrapper that prevents views from getting dropped when the util schema is reinstalled
';


--
-- Name: taxon_trait_view_modify(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxon_trait_view_modify() RETURNS void
    LANGUAGE sql
    AS $$
DROP TABLE IF EXISTS taxon_trait;
SELECT util.copy('taxon_trait_view'::regclass, 'taxon_trait');

GRANT SELECT ON TABLE taxon_trait TO bien_read;
GRANT SELECT ON TABLE taxon_trait_view TO bien_read;

ALTER TABLE taxon_trait ALTER COLUMN "scientificName" SET NOT NULL;
ALTER TABLE taxon_trait ALTER COLUMN "measurementType" SET NOT NULL;

CREATE INDEX ON taxon_trait ("scientificName", "measurementType" );
$$;


--
-- Name: taxondetermination_set_iscurrent(integer); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxondetermination_set_iscurrent(taxonoccurrence_id_ integer) RETURNS void
    LANGUAGE plpgsql
    AS $$
BEGIN
    UPDATE taxondetermination SET iscurrent = false
    WHERE taxonoccurrence_id = taxonoccurrence_id_ AND iscurrent;
    
    UPDATE taxondetermination SET iscurrent = true
    WHERE taxondetermination_id = (
        SELECT taxondetermination_id FROM taxondetermination
        WHERE taxonoccurrence_id = taxonoccurrence_id_
        ORDER BY
              COALESCE(iscurrent__verbatim, false) DESC/*true first*/
            , COALESCE(isoriginal, false)/*false first*/
            , determinationdate DESC NULLS LAST
        LIMIT 1
    );
END;
$$;


--
-- Name: taxondetermination_set_iscurrent_on_delete(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxondetermination_set_iscurrent_on_delete() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    BEGIN
        PERFORM taxondetermination_set_iscurrent(old.taxonoccurrence_id);
    EXCEPTION
        WHEN foreign_key_violation THEN NULL; -- cascading delete
    END;
    
    RETURN old;
END;
$$;


--
-- Name: taxondetermination_set_iscurrent_on_insert(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxondetermination_set_iscurrent_on_insert() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    PERFORM taxondetermination_set_iscurrent(new.taxonoccurrence_id);
    RETURN new;
END;
$$;


--
-- Name: taxonlabel_0_matched_label_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxonlabel_0_matched_label_id_self_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    IF new.taxonlabel_id IS NULL THEN -- prepopulate taxonlabel_id
        new.taxonlabel_id = nextval('taxonlabel_taxonlabel_id_seq'::regclass);
    END IF;
    IF new.matched_label_id = 0 THEN -- make self-source
        new.matched_label_id = new.taxonlabel_id;
    END IF;
    RETURN new;
END;
$$;


--
-- Name: taxonlabel_2_set_canon_label_id_on_insert(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxonlabel_2_set_canon_label_id_on_insert() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    new := taxonlabel_set_canon_label_id(new);
    
    RETURN new;
END;
$$;


--
-- Name: taxonlabel_2_set_canon_label_id_on_update(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxonlabel_2_set_canon_label_id_on_update() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    new := taxonlabel_set_canon_label_id(new, old.matched_label_id, true);
    
    RETURN new;
END;
$$;


--
-- Name: taxonlabel_3_parent_id_avoid_self_ref(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxonlabel_3_parent_id_avoid_self_ref() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    new.parent_id = nullif(new.parent_id, new.taxonlabel_id);
    RETURN new;
END;
$$;


--
-- Name: taxonlabel; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonlabel (
    taxonlabel_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    taxonstatus taxonomic_status,
    canon_label_id integer,
    matched_label_id integer,
    parent_id integer,
    taxonepithet text,
    rank taxonrank,
    taxonomicname text,
    CONSTRAINT taxonlabel_required_key CHECK ((((sourceaccessioncode IS NOT NULL) OR (taxonepithet IS NOT NULL)) OR (taxonomicname IS NOT NULL)))
);


--
-- Name: TABLE taxonlabel; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE taxonlabel IS '
A taxon label defined by an entity. Can be at any level in the taxonomic hierarchy. Can be either verbatim or accepted.

"A taxon (plural: taxa) is a group of one (or more) populations of organism(s), which a taxonomist adjudges to be a unit" (http://en.wikipedia.org/wiki/Taxon)

Note that taxonepithet stores only one rank (e.g. family) of the full taxonomic name. The higher-level ranks are stored in the taxon label''s chain of parent_id ancestors.

Equivalent to VegBank''s plantConcept and plantName tables, plus plantParent_ID and plantLevel from plantStatus.
';


--
-- Name: COLUMN taxonlabel.source_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonlabel.source_id IS '
The entity that created the taxon label.
';


--
-- Name: COLUMN taxonlabel.sourceaccessioncode; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonlabel.sourceaccessioncode IS '
The datasource''s identifier for the taxonlabel.
';


--
-- Name: COLUMN taxonlabel.canon_label_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonlabel.canon_label_id IS '
The canonical taxonlabel for this taxonlabel.
';


--
-- Name: COLUMN taxonlabel.matched_label_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonlabel.matched_label_id IS '
The taxonlabel containing the closest match to this taxonlabel. taxonlabels should be linked in a four-level hierarchy of datasource label -> parsed label -> matched label -> accepted label. A previously-accepted name''s label should be further linked to the synonym that has replaced it.

To indicate a synonym between taxonlabels of different sources, choose one taxonlabel to be authoritative and point the other taxonlabel to it using this field.

An accepted name should point to itself in this field. This will happen automatically by setting it to the special value 0.
';


--
-- Name: COLUMN taxonlabel.parent_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonlabel.parent_id IS '
The parent taxonlabel. Note that while a taxon *name* may have multiple parents, a taxonlabel *instance* has only one, based on the creator''s opinion of where that taxonlabel goes in the taxonomic hierarchy.
';


--
-- Name: COLUMN taxonlabel.taxonepithet; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonlabel.taxonepithet IS '
The epithet of the taxon within its parent taxon. This is the lowest-rank portion of this taxonlabel''s full taxonomic name, if it has one.
';


--
-- Name: COLUMN taxonlabel.rank; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonlabel.rank IS '
The taxon''s level in the taxonomic hierarchy, standardized to a closed list. Even if you specify a custom verbatimrank in taxonverbatim, you should also specify a closest-match rank from the taxonrank closed list.
';


--
-- Name: COLUMN taxonlabel.taxonomicname; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonlabel.taxonomicname IS '
The concatenated taxonomic name which uniquely identifies this taxon, including the family and author of that name. Must be unique within the datasource.

Equivalent to Darwin Core''s scientificName.
';


--
-- Name: taxonlabel_set_canon_label_id(taxonlabel, integer, boolean); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxonlabel_set_canon_label_id(new taxonlabel, old_matched_label_id integer DEFAULT NULL::integer, is_update boolean DEFAULT false) RETURNS taxonlabel
    LANGUAGE plpgsql
    AS $$
BEGIN
    IF NOT is_update
        OR new.matched_label_id IS DISTINCT FROM old_matched_label_id THEN
        IF new.matched_label_id IS NOT NULL THEN
            IF new.matched_label_id = new.taxonlabel_id THEN -- self-source
                new.canon_label_id := new.taxonlabel_id; -- make self-source
            ELSE -- propagate from matched label
                new.canon_label_id := (
                    SELECT canon_label_id
                    FROM taxonlabel
                    WHERE taxonlabel_id = new.matched_label_id
                );
            END IF;
            
            IF is_update THEN
                -- Update canon_label_id on labels that resolve to this label
                UPDATE taxonlabel
                SET canon_label_id = new.canon_label_id
                WHERE matched_label_id = new.taxonlabel_id
                AND taxonlabel_id != new.taxonlabel_id -- no infinite recursion
                ;
            END IF;
        ELSE -- no matched taxonlabel
            new.canon_label_id := new.taxonlabel_id; -- make self-source
        END IF;
    END IF;
    
    RETURN new;
END;
$$;


--
-- Name: taxonlabel_update_ancestors(taxonlabel, integer, integer); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxonlabel_update_ancestors(new taxonlabel, parent_id_ integer, old_parent_id integer DEFAULT NULL::integer) RETURNS void
    LANGUAGE plpgsql
    AS $$
BEGIN
	IF parent_id_ IS DISTINCT FROM old_parent_id THEN
		DECLARE
			-- These include the parent itself
			old_ancestors integer[] =
			CASE WHEN old_parent_id IS NULL THEN array[]::integer[] ELSE (
				SELECT array_agg(ancestor_id) FROM taxonlabel_relationship
				WHERE descendant_id = old_parent_id
			) END;
			new_ancestors integer[] = 
			CASE WHEN parent_id_ IS NULL THEN array[]::integer[] ELSE (
				SELECT array_agg(ancestor_id) FROM taxonlabel_relationship
				WHERE descendant_id = parent_id_
			) END;
			descendant_id_ taxonlabel_relationship.descendant_id%TYPE;
			ancestor_id_ taxonlabel_relationship.ancestor_id%TYPE;
		BEGIN
			FOR descendant_id_ IN -- also includes self
				SELECT descendant_id
				FROM taxonlabel_relationship
				WHERE ancestor_id = new.taxonlabel_id
			LOOP
				-- Delete old parent's ancestors
				IF descendant_id_ IS NOT NULL THEN
					DELETE FROM taxonlabel_relationship
					WHERE descendant_id = descendant_id_
					AND ancestor_id = ANY (old_ancestors)
					;
				END IF;
				
				-- Add new parent's ancestors
				FOR ancestor_id_ IN
					SELECT unnest(new_ancestors)
				LOOP
					INSERT INTO taxonlabel_relationship
					(descendant_id, ancestor_id)
					SELECT descendant_id_, ancestor_id_
					;
				END LOOP;
			END LOOP;
		END;
	END IF;
	
	/* Note: We don't need an ON DELETE trigger to update the descendants'
	ancestors when a node is deleted, because the
	taxonlabel_relationship.ancestor_id foreign key is ON DELETE CASCADE. */
END;
$$;


--
-- Name: taxonlabel_update_ancestors_on_insert(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxonlabel_update_ancestors_on_insert() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    /* Add "ancestor" for this node. This is useful for queries, because you
    don't have to separately test if the leaf node is the one you're looking
    for, in addition to that leaf node's ancestors. */
    INSERT
    INTO taxonlabel_relationship
    (descendant_id, ancestor_id)
    VALUES (new.taxonlabel_id, new.taxonlabel_id)
    ;
    
    PERFORM taxonlabel_update_ancestors(new,
        COALESCE(NULLIF(new.matched_label_id, new.taxonlabel_id), new.parent_id));
    
    RETURN new;
END;
$$;


--
-- Name: taxonlabel_update_ancestors_on_update(); Type: FUNCTION; Schema: public; Owner: -
--

CREATE FUNCTION taxonlabel_update_ancestors_on_update() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    PERFORM taxonlabel_update_ancestors(new,
        COALESCE(NULLIF(new.matched_label_id, new.taxonlabel_id), new.parent_id),
        COALESCE(NULLIF(old.matched_label_id, old.taxonlabel_id), old.parent_id));
    
    RETURN new;
END;
$$;


SET search_path = public_validations, pg_catalog;

--
-- Name: ~type._plots_01_count_of_projects; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_01_count_of_projects" (
    projects bigint
);


--
-- Name: keys("~type._plots_01_count_of_projects"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_01_count_of_projects") RETURNS "keys_~type._plots_01_count_of_projects"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._plots_01_count_of_projects"
$$;


--
-- Name: ~type._plots_02_list_of_project_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_02_list_of_project_names" (
    project_name text
);


--
-- Name: keys("~type._plots_02_list_of_project_names"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_02_list_of_project_names") RETURNS "keys_~type._plots_02_list_of_project_names"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name)::public_validations."keys_~type._plots_02_list_of_project_names"
$_$;


--
-- Name: ~type._plots_03_count_of_all_plots_in_this_source; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_03_count_of_all_plots_in_this_source" (
    plots bigint
);


--
-- Name: keys("~type._plots_03_count_of_all_plots_in_this_source"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_03_count_of_all_plots_in_this_source") RETURNS "keys_~type._plots_03_count_of_all_plots_in_this_source"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._plots_03_count_of_all_plots_in_this_source"
$$;


--
-- Name: ~type._plots_04_count_of_plots_in_each_project_in_this_source; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_04_count_of_plots_in_each_project_in_this_source" (
    project_name text,
    plots bigint
);


--
-- Name: keys("~type._plots_04_count_of_plots_in_each_project_in_this_source"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_04_count_of_plots_in_each_project_in_this_source") RETURNS "keys_~type._plots_04_count_of_plots_in_each_project_in_this_sou"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name)::public_validations."keys_~type._plots_04_count_of_plots_in_each_project_in_this_sou"
$_$;


--
-- Name: ~type._plots_05_list_of_plot_codes_by_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_05_list_of_plot_codes_by_project" (
    project_name text,
    plot_code text
);


--
-- Name: keys("~type._plots_05_list_of_plot_codes_by_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_05_list_of_plot_codes_by_project") RETURNS "keys_~type._plots_05_list_of_plot_codes_by_project"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_05_list_of_plot_codes_by_project"
$_$;


--
-- Name: ~type._plots_06_list_of_plots_with_stem_measurements; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_06_list_of_plots_with_stem_measurements" (
    project_name text,
    plot_code text
);


--
-- Name: keys("~type._plots_06_list_of_plots_with_stem_measurements"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_06_list_of_plots_with_stem_measurements") RETURNS "keys_~type._plots_06_list_of_plots_with_stem_measurements"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_06_list_of_plots_with_stem_measurements"
$_$;


--
-- Name: ~type._plots_06a_list_of_stems; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_06a_list_of_stems" (
    project_name text,
    plot_code text,
    stem_id text
);


--
-- Name: keys("~type._plots_06a_list_of_stems"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_06a_list_of_stems") RETURNS "keys_~type._plots_06a_list_of_stems"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.stem_id)::public_validations."keys_~type._plots_06a_list_of_stems"
$_$;


--
-- Name: ~type._plots_07_list_of_plots_which_use_counts_of_indiv_per_spe; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_07_list_of_plots_which_use_counts_of_indiv_per_spe" (
    project_name text,
    plot_code text
);


--
-- Name: keys("~type._plots_07_list_of_plots_which_use_counts_of_indiv_per_spe"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_07_list_of_plots_which_use_counts_of_indiv_per_spe") RETURNS "keys_~type._plots_07_list_of_plots_which_use_counts_of_indiv_pe"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_07_list_of_plots_which_use_counts_of_indiv_pe"
$_$;


--
-- Name: ~type._plots_08_list_of_plots_which_use_percent_cover; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_08_list_of_plots_which_use_percent_cover" (
    project_name text,
    plot_code text
);


--
-- Name: keys("~type._plots_08_list_of_plots_which_use_percent_cover"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_08_list_of_plots_which_use_percent_cover") RETURNS "keys_~type._plots_08_list_of_plots_which_use_percent_cover"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_08_list_of_plots_which_use_percent_cover"
$_$;


--
-- Name: ~type._plots_09_list_of_plots_which_use_line_intercept; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_09_list_of_plots_which_use_line_intercept" (
    project_name text,
    plot_code text
);


--
-- Name: keys("~type._plots_09_list_of_plots_which_use_line_intercept"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_09_list_of_plots_which_use_line_intercept") RETURNS "keys_~type._plots_09_list_of_plots_which_use_line_intercept"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_09_list_of_plots_which_use_line_intercept"
$_$;


--
-- Name: ~type._plots_10_count_of_individuals_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_10_count_of_individuals_per_plot_in_each_project" (
    project_name text,
    plot_code text,
    individuals bigint
);


--
-- Name: keys("~type._plots_10_count_of_individuals_per_plot_in_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_10_count_of_individuals_per_plot_in_each_project") RETURNS "keys_~type._plots_10_count_of_individuals_per_plot_in_each_proj"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_10_count_of_individuals_per_plot_in_each_proj"
$_$;


--
-- Name: ~type._plots_10a_aggregate_observation_individual_counts; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_10a_aggregate_observation_individual_counts" (
    project_name text,
    plot_code text,
    individual_id text,
    individuals integer
);


--
-- Name: keys("~type._plots_10a_aggregate_observation_individual_counts"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_10a_aggregate_observation_individual_counts") RETURNS "keys_~type._plots_10a_aggregate_observation_individual_counts"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.individual_id)::public_validations."keys_~type._plots_10a_aggregate_observation_individual_counts"
$_$;


--
-- Name: ~type._plots_11_count_of_stems_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_11_count_of_stems_per_plot_in_each_project" (
    project_name text,
    plot_code text,
    stems bigint
);


--
-- Name: keys("~type._plots_11_count_of_stems_per_plot_in_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_11_count_of_stems_per_plot_in_each_project") RETURNS "keys_~type._plots_11_count_of_stems_per_plot_in_each_project"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_11_count_of_stems_per_plot_in_each_project"
$_$;


--
-- Name: ~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project" (
    project_name text,
    plot_code text,
    taxa bigint
);


--
-- Name: keys("~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project") RETURNS "keys_~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_pr"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_pr"
$_$;


--
-- Name: ~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_" (
    project_name text,
    plot_code text,
    taxon text
);


--
-- Name: keys("~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_") RETURNS "keys_~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plo"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.taxon)::public_validations."keys_~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plo"
$_$;


--
-- Name: ~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e" (
    project_name text,
    plot_code text,
    taxon text,
    individuals bigint
);


--
-- Name: keys("~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e") RETURNS "keys_~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.taxon)::public_validations."keys_~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot"
$_$;


--
-- Name: ~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_ea; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_ea" (
    project_name text,
    plot_code text,
    taxon text,
    totalpercentcover double precision
);


--
-- Name: keys("~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_ea"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_ea") RETURNS "keys_~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.taxon, $1.totalpercentcover)::public_validations."keys_~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_"
$_$;


--
-- Name: ~type._plots_16_intercepts_for_each_verb_taxon_in_each_plot_eac; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_16_intercepts_for_each_verb_taxon_in_each_plot_eac" (
    project_name text,
    plot_code text,
    taxon text,
    intercept_cm double precision
);


--
-- Name: keys("~type._plots_16_intercepts_for_each_verb_taxon_in_each_plot_eac"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_16_intercepts_for_each_verb_taxon_in_each_plot_eac") RETURNS "keys_~type._plots_16_intercepts_for_each_verb_taxon_in_each_plo"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.taxon)::public_validations."keys_~type._plots_16_intercepts_for_each_verb_taxon_in_each_plo"
$_$;


--
-- Name: ~type._plots_17_count_of_subplots_per_plot_for_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_17_count_of_subplots_per_plot_for_each_project" (
    project_name text,
    plot_code text,
    subplots bigint
);


--
-- Name: keys("~type._plots_17_count_of_subplots_per_plot_for_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_17_count_of_subplots_per_plot_for_each_project") RETURNS "keys_~type._plots_17_count_of_subplots_per_plot_for_each_projec"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_17_count_of_subplots_per_plot_for_each_projec"
$_$;


--
-- Name: ~type._plots_18_list_of_subplots_codes_for_each_plot_for_each_p; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_18_list_of_subplots_codes_for_each_plot_for_each_p" (
    project_name text,
    plot_code text,
    subplot_code text
);


--
-- Name: keys("~type._plots_18_list_of_subplots_codes_for_each_plot_for_each_p"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_18_list_of_subplots_codes_for_each_plot_for_each_p") RETURNS "keys_~type._plots_18_list_of_subplots_codes_for_each_plot_for_e"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.subplot_code)::public_validations."keys_~type._plots_18_list_of_subplots_codes_for_each_plot_for_e"
$_$;


--
-- Name: ~type._plots_19_count_of_censuses_per_plot_in_each_project; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._plots_19_count_of_censuses_per_plot_in_each_project" (
    project_name text,
    plot_code text,
    inventories bigint
);


--
-- Name: keys("~type._plots_19_count_of_censuses_per_plot_in_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._plots_19_count_of_censuses_per_plot_in_each_project") RETURNS "keys_~type._plots_19_count_of_censuses_per_plot_in_each_project"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."keys_~type._plots_19_count_of_censuses_per_plot_in_each_project"
$_$;


--
-- Name: ~type._specimens_01_count_of_total_records_specimens_in_source_; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_01_count_of_total_records_specimens_in_source_" (
    "totalSpecimenRecords" bigint
);


--
-- Name: keys("~type._specimens_01_count_of_total_records_specimens_in_source_"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_01_count_of_total_records_specimens_in_source_") RETURNS "keys_~type._specimens_01_count_of_total_records_specimens_in_so"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._specimens_01_count_of_total_records_specimens_in_so"
$$;


--
-- Name: ~type._specimens_02_count_of_unique_verbatim_families; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_02_count_of_unique_verbatim_families" (
    families bigint
);


--
-- Name: keys("~type._specimens_02_count_of_unique_verbatim_families"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_02_count_of_unique_verbatim_families") RETURNS "keys_~type._specimens_02_count_of_unique_verbatim_families"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._specimens_02_count_of_unique_verbatim_families"
$$;


--
-- Name: ~type._specimens_03_list_of_verbatim_families; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_03_list_of_verbatim_families" (
    family text
);


--
-- Name: keys("~type._specimens_03_list_of_verbatim_families"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_03_list_of_verbatim_families") RETURNS "keys_~type._specimens_03_list_of_verbatim_families"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.family)::public_validations."keys_~type._specimens_03_list_of_verbatim_families"
$_$;


--
-- Name: ~type._specimens_04_count_of_species_binomials; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_04_count_of_species_binomials" (
    species_binomials bigint
);


--
-- Name: keys("~type._specimens_04_count_of_species_binomials"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_04_count_of_species_binomials") RETURNS "keys_~type._specimens_04_count_of_species_binomials"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._specimens_04_count_of_species_binomials"
$$;


--
-- Name: ~type._specimens_05_list_of_species_binomials; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_05_list_of_species_binomials" (
    species_binomial text
);


--
-- Name: keys("~type._specimens_05_list_of_species_binomials"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_05_list_of_species_binomials") RETURNS "keys_~type._specimens_05_list_of_species_binomials"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.species_binomial)::public_validations."keys_~type._specimens_05_list_of_species_binomials"
$_$;


--
-- Name: ~type._specimens_06_count_of_unique_verb_subsp_taxa_with_author; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_06_count_of_unique_verb_subsp_taxa_with_author" (
    taxon_names_with_author bigint
);


--
-- Name: keys("~type._specimens_06_count_of_unique_verb_subsp_taxa_with_author"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_06_count_of_unique_verb_subsp_taxa_with_author") RETURNS "keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a"
$$;


--
-- Name: ~type._specimens_07_list_of_verbatim_subspecific_taxa_with_auth; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_07_list_of_verbatim_subspecific_taxa_with_auth" (
    taxon_name_with_author text
);


--
-- Name: keys("~type._specimens_07_list_of_verbatim_subspecific_taxa_with_auth"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_07_list_of_verbatim_subspecific_taxa_with_auth") RETURNS "keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxon_name_with_author)::public_validations."keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with"
$_$;


--
-- Name: ~type._specimens_08_count_of_unique_verbatim_author_taxa_with_g; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_08_count_of_unique_verbatim_author_taxa_with_g" (
    taxon_names_with_author bigint
);


--
-- Name: keys("~type._specimens_08_count_of_unique_verbatim_author_taxa_with_g"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_08_count_of_unique_verbatim_author_taxa_with_g") RETURNS "keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w"
$$;


--
-- Name: ~type._specimens_09_list_of_unique_verbatim_author_taxa_with_ge; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_09_list_of_unique_verbatim_author_taxa_with_ge" (
    taxon_name_with_author text
);


--
-- Name: keys("~type._specimens_09_list_of_unique_verbatim_author_taxa_with_ge"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_09_list_of_unique_verbatim_author_taxa_with_ge") RETURNS "keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxon_name_with_author)::public_validations."keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi"
$_$;


--
-- Name: ~type._specimens_10_count_number_of_records_by_institution; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_10_count_number_of_records_by_institution" (
    specimen_duplicate_institutions text,
    records bigint
);


--
-- Name: keys("~type._specimens_10_count_number_of_records_by_institution"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_10_count_number_of_records_by_institution") RETURNS "keys_~type._specimens_10_count_number_of_records_by_institution"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.specimen_duplicate_institutions)::public_validations."keys_~type._specimens_10_count_number_of_records_by_institution"
$_$;


--
-- Name: ~type._specimens_11_list_of_three_standard_political_divisions; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_11_list_of_three_standard_political_divisions" (
    country text,
    "stateProvince" text,
    county text
);


--
-- Name: keys("~type._specimens_11_list_of_three_standard_political_divisions"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_11_list_of_three_standard_political_divisions") RETURNS "keys_~type._specimens_11_list_of_three_standard_political_divis"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.country, $1."stateProvince", $1.county)::public_validations."keys_~type._specimens_11_list_of_three_standard_political_divis"
$_$;


--
-- Name: ~type._specimens_12_distinct_collector_name_collect_num_date_w_; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_12_distinct_collector_name_collect_num_date_w_" (
    "collectorName" text,
    "collectionNumber" text,
    "dateCollected" text,
    "specimenRecords" bigint
);


--
-- Name: keys("~type._specimens_12_distinct_collector_name_collect_num_date_w_"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_12_distinct_collector_name_collect_num_date_w_") RETURNS "keys_~type._specimens_12_distinct_collector_name_collect_num_da"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."collectorName", $1."collectionNumber", $1."dateCollected")::public_validations."keys_~type._specimens_12_distinct_collector_name_collect_num_da"
$_$;


--
-- Name: ~type._specimens_13_count_of_all_verbatim_and_decimal_lat_long; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_13_count_of_all_verbatim_and_decimal_lat_long" (
    "allLatLongs" bigint,
    "decimalLatLongs" bigint
);


--
-- Name: keys("~type._specimens_13_count_of_all_verbatim_and_decimal_lat_long"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_13_count_of_all_verbatim_and_decimal_lat_long") RETURNS "keys_~type._specimens_13_count_of_all_verbatim_and_decimal_lat_"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._specimens_13_count_of_all_verbatim_and_decimal_lat_"
$$;


--
-- Name: ~type._specimens_13a_list_of_all_verbatim_lat_long; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_13a_list_of_all_verbatim_lat_long" (
    "verbatimLatitude" text,
    "verbatimLongitude" text
);


--
-- Name: keys("~type._specimens_13a_list_of_all_verbatim_lat_long"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_13a_list_of_all_verbatim_lat_long") RETURNS "keys_~type._specimens_13a_list_of_all_verbatim_lat_long"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."verbatimLatitude", $1."verbatimLongitude")::public_validations."keys_~type._specimens_13a_list_of_all_verbatim_lat_long"
$_$;


--
-- Name: ~type._specimens_13b_list_of_all_decimal_lat_long; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_13b_list_of_all_decimal_lat_long" (
    "decimalLatitude" double precision,
    "decimalLongitude" double precision
);


--
-- Name: keys("~type._specimens_13b_list_of_all_decimal_lat_long"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_13b_list_of_all_decimal_lat_long") RETURNS "keys_~type._specimens_13b_list_of_all_decimal_lat_long"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."decimalLatitude", $1."decimalLongitude")::public_validations."keys_~type._specimens_13b_list_of_all_decimal_lat_long"
$_$;


--
-- Name: ~type._specimens_14_count_of_all_invalid_verbatim_lat_long; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_14_count_of_all_invalid_verbatim_lat_long" (
    "badLats" bigint,
    "badLongs" bigint
);


--
-- Name: keys("~type._specimens_14_count_of_all_invalid_verbatim_lat_long"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_14_count_of_all_invalid_verbatim_lat_long") RETURNS "keys_~type._specimens_14_count_of_all_invalid_verbatim_lat_long"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._specimens_14_count_of_all_invalid_verbatim_lat_long"
$$;


--
-- Name: ~type._specimens_15_list_distinct_locality_descriptions; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_15_list_distinct_locality_descriptions" (
    "localityDescription" text
);


--
-- Name: keys("~type._specimens_15_list_distinct_locality_descriptions"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_15_list_distinct_locality_descriptions") RETURNS "keys_~type._specimens_15_list_distinct_locality_descriptions"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."localityDescription")::public_validations."keys_~type._specimens_15_list_distinct_locality_descriptions"
$_$;


--
-- Name: ~type._specimens_16_list_distinct_specimen_descriptions; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._specimens_16_list_distinct_specimen_descriptions" (
    "specimenDescription" text
);


--
-- Name: keys("~type._specimens_16_list_distinct_specimen_descriptions"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._specimens_16_list_distinct_specimen_descriptions") RETURNS "keys_~type._specimens_16_list_distinct_specimen_descriptions"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."specimenDescription")::public_validations."keys_~type._specimens_16_list_distinct_specimen_descriptions"
$_$;


--
-- Name: ~type._traits_01_count_records; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._traits_01_count_records" (
    "totalRecords" bigint
);


--
-- Name: keys("~type._traits_01_count_records"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._traits_01_count_records") RETURNS "keys_~type._traits_01_count_records"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._traits_01_count_records"
$$;


--
-- Name: ~type._traits_02_count_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._traits_02_count_trait_names" (
    traits bigint
);


--
-- Name: keys("~type._traits_02_count_trait_names"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._traits_02_count_trait_names") RETURNS "keys_~type._traits_02_count_trait_names"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._traits_02_count_trait_names"
$$;


--
-- Name: ~type._traits_03_list_trait_names; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._traits_03_list_trait_names" (
    trait text
);


--
-- Name: keys("~type._traits_03_list_trait_names"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._traits_03_list_trait_names") RETURNS "keys_~type._traits_03_list_trait_names"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.trait)::public_validations."keys_~type._traits_03_list_trait_names"
$_$;


--
-- Name: ~type._traits_04_count_records_per_trait; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._traits_04_count_records_per_trait" (
    trait text,
    measurements bigint
);


--
-- Name: keys("~type._traits_04_count_records_per_trait"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._traits_04_count_records_per_trait") RETURNS "keys_~type._traits_04_count_records_per_trait"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.trait)::public_validations."keys_~type._traits_04_count_records_per_trait"
$_$;


--
-- Name: ~type._traits_05_count_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._traits_05_count_taxa" (
    taxa bigint
);


--
-- Name: keys("~type._traits_05_count_taxa"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._traits_05_count_taxa") RETURNS "keys_~type._traits_05_count_taxa"
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT ROW()::public_validations."keys_~type._traits_05_count_taxa"
$$;


--
-- Name: ~type._traits_06_list_distinct_taxa; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._traits_06_list_distinct_taxa" (
    taxonwithauthor text
);


--
-- Name: keys("~type._traits_06_list_distinct_taxa"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._traits_06_list_distinct_taxa") RETURNS "keys_~type._traits_06_list_distinct_taxa"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxonwithauthor)::public_validations."keys_~type._traits_06_list_distinct_taxa"
$_$;


--
-- Name: ~type._traits_07_trait_value_and_units; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._traits_07_trait_value_and_units" (
    trait text,
    value text,
    units text,
    copies bigint NOT NULL
);


--
-- Name: keys("~type._traits_07_trait_value_and_units"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._traits_07_trait_value_and_units") RETURNS "keys_~type._traits_07_trait_value_and_units"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.trait, $1.value, $1.units)::public_validations."keys_~type._traits_07_trait_value_and_units"
$_$;


--
-- Name: ~type._traits_08_taxonname_trait_and_value; Type: TABLE; Schema: public_validations; Owner: -; Tablespace: 
--

CREATE TABLE "~type._traits_08_taxonname_trait_and_value" (
    taxonwithauthor text,
    trait text,
    value text,
    copies bigint NOT NULL
);


--
-- Name: keys("~type._traits_08_taxonname_trait_and_value"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION keys(value "~type._traits_08_taxonname_trait_and_value") RETURNS "keys_~type._traits_08_taxonname_trait_and_value"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxonwithauthor, $1.trait, $1.value)::public_validations."keys_~type._traits_08_taxonname_trait_and_value"
$_$;


--
-- Name: query_view_relation_max_prefix_len(); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION query_view_relation_max_prefix_len() RETURNS integer
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT 8/*len of 'values__'*/ + 6/*len of '~type.'/'_diff_'*/
$$;


--
-- Name: new_query_view_relation_name(text, text, text, integer); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION new_query_view_relation_name(query_view_from text, query_view_to text, relation_from text, max_prefix_len integer DEFAULT query_view_relation_max_prefix_len()) RETURNS text
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT util.replace_suffix($3, $1, $2, $4)
$_$;


--
-- Name: FUNCTION new_query_view_relation_name(query_view_from text, query_view_to text, relation_from text, max_prefix_len integer); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION new_query_view_relation_name(query_view_from text, query_view_to text, relation_from text, max_prefix_len integer) IS '
max_prefix_len: when str may have been truncated (eg. as a table name) due to
	the prepending of a prefix, support prefixes up to this length. should be
	left as the default value.
';


--
-- Name: output_queries(text, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION output_queries(prefix text DEFAULT NULL::text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS SETOF regclass
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	RETURN QUERY
	SELECT * FROM validation_views(util.schema(schema_anchor), prefix)
	;
END;
$$;


--
-- Name: query_relations(regclass, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION query_relations(query_view regclass, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS SETOF regclass
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $_$
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	RETURN QUERY
	SELECT * FROM util.show_relations_like(
	truncated_prefixed_name_regexp(util.name($1)),
	(CASE WHEN util.schema($1) = util.schema($2) -- is in public_validations?
	THEN '' -- output query, so remove in *all* schemas
	ELSE util.schema_regexp($1) -- input query, so remove only in datasource's schema
	END)
	)
	;
END;
$_$;


--
-- Name: FUNCTION query_relations(query_view regclass, schema_anchor anyelement); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION query_relations(query_view regclass, schema_anchor anyelement) IS '
query_view: if an output query, will remove in *all* schemas
max_prefix_len: when str may have been truncated (eg. as a table name) due to
	the prepending of a prefix, support prefixes up to this length. should be
	left as the default value.
schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: query_view_regexp(); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION query_view_regexp() RETURNS text
    LANGUAGE sql IMMUTABLE
    AS $$
SELECT '^(?:_[[:alpha:]]+_)?_[[:alpha:]]+_\d+'::text
$$;


--
-- Name: remake_diff_table(regclass, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION remake_diff_table(in_view regclass, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS regclass
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
DECLARE
	type_table text = util.qual_name(util.schema(schema_anchor),
		'~type.'||util.name(in_view)); -- sort at end
	diff_table text = util.qual_name(util.schema(in_view),
		'_diff_'||util.name(in_view));
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	PERFORM util.remake_diff_table(diff_table, rematerialize_in_view(in_view),
		rematerialize_out_view(in_view), type_table);
	/* document how to regenerate the diff table, in a place that's readily
	available to someone using the table */
	PERFORM util.prepend_comment(diff_table, '
to regenerate this table:
SELECT '|| util.quote_func_call(
util.curr_func('remake_diff_table', schema_anchor), util.quote_typed(in_view))
||';
');
	
	RETURN diff_table;
END;
$$;


--
-- Name: FUNCTION remake_diff_table(in_view regclass, schema_anchor anyelement); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION remake_diff_table(in_view regclass, schema_anchor anyelement) IS '
usage:
SELECT public_validations.remake_diff_table(''datasource._view_name'') AS diff_table;

idempotent, but repeats action each time

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: remake_diff_tables(anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION remake_diff_tables(schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	PERFORM remake_diff_tables(schema) FROM validatable_datasources() schema;
END;
$$;


--
-- Name: remake_diff_tables(text, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION remake_diff_tables(schema text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
DECLARE
	errors_ct integer = 0;
	in_view regclass;
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	FOR in_view IN SELECT * FROM validation_views(schema)
	LOOP
		BEGIN
			PERFORM remake_diff_table(in_view, schema_anchor);
		EXCEPTION
		WHEN OTHERS THEN
			errors_ct = errors_ct+1;
			PERFORM util.raise_error_warning(SQLERRM);
		END;
	END LOOP;
	IF errors_ct > 0 THEN
		-- can't raise exception because this would roll back the transaction
		PERFORM util.raise_error_warning(errors_ct
			||' queries had errors. please see the WARNINGs for details.');
	END IF;
END;
$$;


--
-- Name: remake_output_tables(text, text, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION remake_output_tables(datasource_schema text, prefix text DEFAULT NULL::text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $_$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	PERFORM util.loop_ignore_errors(
		$$SELECT * FROM output_queries($$||util.quote_typed(prefix)||$$)$$,
		$$SELECT rematerialize_out_view($$||util.quote_typed(datasource_schema)||$$, $1)$$,
		NULL::regclass);
END;
$_$;


--
-- Name: rematerialize_in_view(regclass); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION rematerialize_in_view(in_view regclass) RETURNS regclass
    LANGUAGE plpgsql
    AS $$
DECLARE
	in_table text = util.qual_name(util.schema(in_view), '_in_'||util.name(in_view));
BEGIN
	PERFORM util.rematerialize_view(in_table, in_view);
	
	RETURN in_table;
END;
$$;


--
-- Name: FUNCTION rematerialize_in_view(in_view regclass); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION rematerialize_in_view(in_view regclass) IS '
usage:
SELECT public_validations.rematerialize_in_view(''datasource._view_name'') AS in_table;

idempotent, but repeats action each time
';


--
-- Name: rematerialize_out_view(text, regclass); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION rematerialize_out_view(datasource_schema text, out_view regclass) RETURNS regclass
    LANGUAGE plpgsql
    SET enable_seqscan TO 'off'
    SET search_path TO pg_temp
    SET join_collapse_limit TO '1'
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
DECLARE
	out_table text = util.qual_name(datasource_schema,
		'_out_'||util.name(out_view));
BEGIN
	/* datasource_schema must be 1st in the search_path so that queries can use
	it in current_schema */
	PERFORM util.set_search_path(util.mk_search_path(datasource_schema));
	
	PERFORM util.rematerialize_view(out_table, out_view);
	
	RETURN out_table;
END;
$$;


--
-- Name: FUNCTION rematerialize_out_view(datasource_schema text, out_view regclass); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION rematerialize_out_view(datasource_schema text, out_view regclass) IS '
helper function; use rematerialize_out_view(in_view) instead

usage:
SELECT public_validations.rematerialize_out_view(''datasource'', ''public_validations._view_name'') AS out_table;

idempotent, but repeats action each time
';


--
-- Name: rematerialize_out_view(regclass, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION rematerialize_out_view(in_view regclass, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS regclass
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	RETURN rematerialize_out_view(datasource_schema := util.schema(in_view),
		out_view := util.qual_name(util.schema(schema_anchor),
		util.name(in_view)));
END;
$$;


--
-- Name: FUNCTION rematerialize_out_view(in_view regclass, schema_anchor anyelement); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION rematerialize_out_view(in_view regclass, schema_anchor anyelement) IS '
usage:
SELECT public_validations.rematerialize_out_view(''datasource._view_name'') AS out_table;

idempotent, but repeats action each time

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: rename_query_view(regclass, text, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION rename_query_view(from_ regclass, to_ text, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	PERFORM util.rename_relation(view_,
		new_query_view_relation_name(util.name(from_), to_, util.name(view_)))
	FROM query_relations(from_) view_
	;
END;
$$;


--
-- Name: FUNCTION rename_query_view(from_ regclass, to_ text, schema_anchor anyelement); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION rename_query_view(from_ regclass, to_ text, schema_anchor anyelement) IS '
renames all DB objects related to a particular validations query

usage:
SELECT public_validations.rename_query_view(''public_validations._view_name'', ''new_name'');

idempotent

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: rm_all_queries(text, text); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION rm_all_queries(schema text DEFAULT NULL::text, query_view_regexp text DEFAULT query_view_regexp()) RETURNS void
    LANGUAGE sql
    AS $_$
SELECT util.drop_relations_like($2, $1,
force := true/*needed because some query-view-relations depend on others*/)
$_$;


--
-- Name: FUNCTION rm_all_queries(schema text, query_view_regexp text); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION rm_all_queries(schema text, query_view_regexp text) IS '
removes all validations queries in a specific schema, or in all schemas

usage:
SELECT public_validations.rm_all_queries(''datasource'');

idempotent

schema: if NULL, operates on all schemas
schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: rm_output_queries(text, integer, anyelement, text); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION rm_output_queries(name text DEFAULT NULL::text, max_prefix_len integer DEFAULT query_view_relation_max_prefix_len(), schema_anchor anyelement DEFAULT NULL::schema_anchor, query_view_regexp text DEFAULT query_view_regexp()) RETURNS void
    LANGUAGE sql
    AS $_$
SELECT util.drop_relations_like(
COALESCE(util.truncated_prefixed_name_regexp($1, $2), $4),
$3, force := true/*needed because some query-view-relations depend on others*/)
$_$;


--
-- Name: FUNCTION rm_output_queries(name text, max_prefix_len integer, schema_anchor anyelement, query_view_regexp text); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION rm_output_queries(name text, max_prefix_len integer, schema_anchor anyelement, query_view_regexp text) IS '
removes validations *output* queries (in this function''s schema)

note that this will cascadingly drop all result tables for those queries as well
(as these inherit from type tables in this function''s schema).

usage:

to remove all output queries:
SELECT public_validations.rm_output_queries();

to remove a particular output query:
SELECT public_validations.rm_output_queries(''_view_name'');

idempotent

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: rm_query_view(regclass, anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION rm_query_view(query_view regclass, schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS void
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	PERFORM util.drop_relation(view_, force := true)
		-- force: needed because some query-view-relations depend on others
	FROM query_relations(query_view) view_
	;
END;
$$;


--
-- Name: FUNCTION rm_query_view(query_view regclass, schema_anchor anyelement); Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON FUNCTION rm_query_view(query_view regclass, schema_anchor anyelement) IS '
removes all DB objects related to a particular validations query

usage:
SELECT public_validations.rm_query_view(''public_validations._view_name'');

idempotent

schema_anchor: identifies this function''s schema. should be left as the default.
';


--
-- Name: truncated_prefixed_name_regexp(text, integer); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION truncated_prefixed_name_regexp(name text, max_prefix_len integer DEFAULT query_view_relation_max_prefix_len()) RETURNS text
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT util.truncated_prefixed_name_regexp($1, $2)
$_$;


--
-- Name: validatable_datasources(anyelement); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION validatable_datasources(schema_anchor anyelement DEFAULT NULL::schema_anchor) RETURNS SETOF text
    LANGUAGE plpgsql
    SET search_path TO pg_temp
    AS $_$
/* must use LANGUAGE plpgsql because LANGUAGE sql does not support runtime
changes of search_path (schema elements are bound at inline time rather than
runtime) */
/* function option search_path is needed to limit the effects of
`SET LOCAL search_path` to the current function */
BEGIN
	PERFORM util.use_schema(schema_anchor);
	
	RETURN QUERY
		SELECT DISTINCT util.schema(view)
		FROM validation_views() view
		WHERE util.schema(view) !~ '_validations$'/*all datasources*/
	;
END;
$_$;


--
-- Name: validation_views(text, text, text); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION validation_views(schema text DEFAULT NULL::text, prefix text DEFAULT NULL::text, query_view_regexp text DEFAULT query_view_regexp()) RETURNS SETOF regclass
    LANGUAGE sql STABLE
    AS $_$
SELECT * FROM util.show_views_like(COALESCE('^'||$2, $3), (CASE WHEN $1 IS NULL
THEN ''/*all schemas*/ ELSE util.str_equality_regexp($1) END))
$_$;


--
-- Name: values_("~type._plots_01_count_of_projects"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_01_count_of_projects") RETURNS "values__~type._plots_01_count_of_projects"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.projects)::public_validations."values__~type._plots_01_count_of_projects"
$_$;


--
-- Name: values_("~type._plots_02_list_of_project_names"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_02_list_of_project_names") RETURNS "values__~type._plots_02_list_of_project_names"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name)::public_validations."values__~type._plots_02_list_of_project_names"
$_$;


--
-- Name: values_("~type._plots_03_count_of_all_plots_in_this_source"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_03_count_of_all_plots_in_this_source") RETURNS "values__~type._plots_03_count_of_all_plots_in_this_source"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.plots)::public_validations."values__~type._plots_03_count_of_all_plots_in_this_source"
$_$;


--
-- Name: values_("~type._plots_04_count_of_plots_in_each_project_in_this_source"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_04_count_of_plots_in_each_project_in_this_source") RETURNS "values__~type._plots_04_count_of_plots_in_each_project_in_this_"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.plots)::public_validations."values__~type._plots_04_count_of_plots_in_each_project_in_this_"
$_$;


--
-- Name: values_("~type._plots_05_list_of_plot_codes_by_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_05_list_of_plot_codes_by_project") RETURNS "values__~type._plots_05_list_of_plot_codes_by_project"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."values__~type._plots_05_list_of_plot_codes_by_project"
$_$;


--
-- Name: values_("~type._plots_06_list_of_plots_with_stem_measurements"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_06_list_of_plots_with_stem_measurements") RETURNS "values__~type._plots_06_list_of_plots_with_stem_measurements"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."values__~type._plots_06_list_of_plots_with_stem_measurements"
$_$;


--
-- Name: values_("~type._plots_06a_list_of_stems"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_06a_list_of_stems") RETURNS "values__~type._plots_06a_list_of_stems"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.stem_id)::public_validations."values__~type._plots_06a_list_of_stems"
$_$;


--
-- Name: values_("~type._plots_07_list_of_plots_which_use_counts_of_indiv_per_spe"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_07_list_of_plots_which_use_counts_of_indiv_per_spe") RETURNS "values__~type._plots_07_list_of_plots_which_use_counts_of_indiv"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."values__~type._plots_07_list_of_plots_which_use_counts_of_indiv"
$_$;


--
-- Name: values_("~type._plots_08_list_of_plots_which_use_percent_cover"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_08_list_of_plots_which_use_percent_cover") RETURNS "values__~type._plots_08_list_of_plots_which_use_percent_cover"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."values__~type._plots_08_list_of_plots_which_use_percent_cover"
$_$;


--
-- Name: values_("~type._plots_09_list_of_plots_which_use_line_intercept"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_09_list_of_plots_which_use_line_intercept") RETURNS "values__~type._plots_09_list_of_plots_which_use_line_intercept"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code)::public_validations."values__~type._plots_09_list_of_plots_which_use_line_intercept"
$_$;


--
-- Name: values_("~type._plots_10_count_of_individuals_per_plot_in_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_10_count_of_individuals_per_plot_in_each_project") RETURNS "values__~type._plots_10_count_of_individuals_per_plot_in_each_p"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.individuals)::public_validations."values__~type._plots_10_count_of_individuals_per_plot_in_each_p"
$_$;


--
-- Name: values_("~type._plots_10a_aggregate_observation_individual_counts"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_10a_aggregate_observation_individual_counts") RETURNS "values__~type._plots_10a_aggregate_observation_individual_count"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.individuals)::public_validations."values__~type._plots_10a_aggregate_observation_individual_count"
$_$;


--
-- Name: values_("~type._plots_11_count_of_stems_per_plot_in_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_11_count_of_stems_per_plot_in_each_project") RETURNS "values__~type._plots_11_count_of_stems_per_plot_in_each_project"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.stems)::public_validations."values__~type._plots_11_count_of_stems_per_plot_in_each_project"
$_$;


--
-- Name: values_("~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project") RETURNS "values__~type._plots_12_count_of_verbatim_taxa_per_plot_in_each"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxa)::public_validations."values__~type._plots_12_count_of_verbatim_taxa_per_plot_in_each"
$_$;


--
-- Name: values_("~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_") RETURNS "values__~type._plots_13_list_of_distinct_verbatim_taxa_in_each_"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.taxon)::public_validations."values__~type._plots_13_list_of_distinct_verbatim_taxa_in_each_"
$_$;


--
-- Name: values_("~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e") RETURNS "values__~type._plots_14_count_of_indiv_per_verbatim_taxon_per_p"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.individuals)::public_validations."values__~type._plots_14_count_of_indiv_per_verbatim_taxon_per_p"
$_$;


--
-- Name: values_("~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_ea"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_ea") RETURNS "values__~type._plots_15_pct_cover_of_each_verb_taxon_in_each_pl"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.taxon, $1.totalpercentcover)::public_validations."values__~type._plots_15_pct_cover_of_each_verb_taxon_in_each_pl"
$_$;


--
-- Name: values_("~type._plots_16_intercepts_for_each_verb_taxon_in_each_plot_eac"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_16_intercepts_for_each_verb_taxon_in_each_plot_eac") RETURNS "values__~type._plots_16_intercepts_for_each_verb_taxon_in_each_"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.intercept_cm)::public_validations."values__~type._plots_16_intercepts_for_each_verb_taxon_in_each_"
$_$;


--
-- Name: values_("~type._plots_17_count_of_subplots_per_plot_for_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_17_count_of_subplots_per_plot_for_each_project") RETURNS "values__~type._plots_17_count_of_subplots_per_plot_for_each_pro"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.subplots)::public_validations."values__~type._plots_17_count_of_subplots_per_plot_for_each_pro"
$_$;


--
-- Name: values_("~type._plots_18_list_of_subplots_codes_for_each_plot_for_each_p"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_18_list_of_subplots_codes_for_each_plot_for_each_p") RETURNS "values__~type._plots_18_list_of_subplots_codes_for_each_plot_fo"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.project_name, $1.plot_code, $1.subplot_code)::public_validations."values__~type._plots_18_list_of_subplots_codes_for_each_plot_fo"
$_$;


--
-- Name: values_("~type._plots_19_count_of_censuses_per_plot_in_each_project"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._plots_19_count_of_censuses_per_plot_in_each_project") RETURNS "values__~type._plots_19_count_of_censuses_per_plot_in_each_proj"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.inventories)::public_validations."values__~type._plots_19_count_of_censuses_per_plot_in_each_proj"
$_$;


--
-- Name: values_("~type._specimens_01_count_of_total_records_specimens_in_source_"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_01_count_of_total_records_specimens_in_source_") RETURNS "values__~type._specimens_01_count_of_total_records_specimens_in"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."totalSpecimenRecords")::public_validations."values__~type._specimens_01_count_of_total_records_specimens_in"
$_$;


--
-- Name: values_("~type._specimens_02_count_of_unique_verbatim_families"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_02_count_of_unique_verbatim_families") RETURNS "values__~type._specimens_02_count_of_unique_verbatim_families"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.families)::public_validations."values__~type._specimens_02_count_of_unique_verbatim_families"
$_$;


--
-- Name: values_("~type._specimens_03_list_of_verbatim_families"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_03_list_of_verbatim_families") RETURNS "values__~type._specimens_03_list_of_verbatim_families"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.family)::public_validations."values__~type._specimens_03_list_of_verbatim_families"
$_$;


--
-- Name: values_("~type._specimens_04_count_of_species_binomials"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_04_count_of_species_binomials") RETURNS "values__~type._specimens_04_count_of_species_binomials"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.species_binomials)::public_validations."values__~type._specimens_04_count_of_species_binomials"
$_$;


--
-- Name: values_("~type._specimens_05_list_of_species_binomials"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_05_list_of_species_binomials") RETURNS "values__~type._specimens_05_list_of_species_binomials"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.species_binomial)::public_validations."values__~type._specimens_05_list_of_species_binomials"
$_$;


--
-- Name: values_("~type._specimens_06_count_of_unique_verb_subsp_taxa_with_author"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_06_count_of_unique_verb_subsp_taxa_with_author") RETURNS "values__~type._specimens_06_count_of_unique_verb_subsp_taxa_wit"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxon_names_with_author)::public_validations."values__~type._specimens_06_count_of_unique_verb_subsp_taxa_wit"
$_$;


--
-- Name: values_("~type._specimens_07_list_of_verbatim_subspecific_taxa_with_auth"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_07_list_of_verbatim_subspecific_taxa_with_auth") RETURNS "values__~type._specimens_07_list_of_verbatim_subspecific_taxa_w"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxon_name_with_author)::public_validations."values__~type._specimens_07_list_of_verbatim_subspecific_taxa_w"
$_$;


--
-- Name: values_("~type._specimens_08_count_of_unique_verbatim_author_taxa_with_g"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_08_count_of_unique_verbatim_author_taxa_with_g") RETURNS "values__~type._specimens_08_count_of_unique_verbatim_author_tax"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxon_names_with_author)::public_validations."values__~type._specimens_08_count_of_unique_verbatim_author_tax"
$_$;


--
-- Name: values_("~type._specimens_09_list_of_unique_verbatim_author_taxa_with_ge"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_09_list_of_unique_verbatim_author_taxa_with_ge") RETURNS "values__~type._specimens_09_list_of_unique_verbatim_author_taxa"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxon_name_with_author)::public_validations."values__~type._specimens_09_list_of_unique_verbatim_author_taxa"
$_$;


--
-- Name: values_("~type._specimens_10_count_number_of_records_by_institution"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_10_count_number_of_records_by_institution") RETURNS "values__~type._specimens_10_count_number_of_records_by_institut"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.records)::public_validations."values__~type._specimens_10_count_number_of_records_by_institut"
$_$;


--
-- Name: values_("~type._specimens_11_list_of_three_standard_political_divisions"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_11_list_of_three_standard_political_divisions") RETURNS "values__~type._specimens_11_list_of_three_standard_political_di"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.country, $1."stateProvince", $1.county)::public_validations."values__~type._specimens_11_list_of_three_standard_political_di"
$_$;


--
-- Name: values_("~type._specimens_12_distinct_collector_name_collect_num_date_w_"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_12_distinct_collector_name_collect_num_date_w_") RETURNS "values__~type._specimens_12_distinct_collector_name_collect_num"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."specimenRecords")::public_validations."values__~type._specimens_12_distinct_collector_name_collect_num"
$_$;


--
-- Name: values_("~type._specimens_13_count_of_all_verbatim_and_decimal_lat_long"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_13_count_of_all_verbatim_and_decimal_lat_long") RETURNS "values__~type._specimens_13_count_of_all_verbatim_and_decimal_l"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."allLatLongs", $1."decimalLatLongs")::public_validations."values__~type._specimens_13_count_of_all_verbatim_and_decimal_l"
$_$;


--
-- Name: values_("~type._specimens_13a_list_of_all_verbatim_lat_long"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_13a_list_of_all_verbatim_lat_long") RETURNS "values__~type._specimens_13a_list_of_all_verbatim_lat_long"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."verbatimLatitude", $1."verbatimLongitude")::public_validations."values__~type._specimens_13a_list_of_all_verbatim_lat_long"
$_$;


--
-- Name: values_("~type._specimens_13b_list_of_all_decimal_lat_long"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_13b_list_of_all_decimal_lat_long") RETURNS "values__~type._specimens_13b_list_of_all_decimal_lat_long"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."decimalLatitude", $1."decimalLongitude")::public_validations."values__~type._specimens_13b_list_of_all_decimal_lat_long"
$_$;


--
-- Name: values_("~type._specimens_14_count_of_all_invalid_verbatim_lat_long"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_14_count_of_all_invalid_verbatim_lat_long") RETURNS "values__~type._specimens_14_count_of_all_invalid_verbatim_lat_l"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."badLats", $1."badLongs")::public_validations."values__~type._specimens_14_count_of_all_invalid_verbatim_lat_l"
$_$;


--
-- Name: values_("~type._specimens_15_list_distinct_locality_descriptions"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_15_list_distinct_locality_descriptions") RETURNS "values__~type._specimens_15_list_distinct_locality_descriptions"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."localityDescription")::public_validations."values__~type._specimens_15_list_distinct_locality_descriptions"
$_$;


--
-- Name: values_("~type._specimens_16_list_distinct_specimen_descriptions"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._specimens_16_list_distinct_specimen_descriptions") RETURNS "values__~type._specimens_16_list_distinct_specimen_descriptions"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."specimenDescription")::public_validations."values__~type._specimens_16_list_distinct_specimen_descriptions"
$_$;


--
-- Name: values_("~type._traits_01_count_records"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._traits_01_count_records") RETURNS "values__~type._traits_01_count_records"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1."totalRecords")::public_validations."values__~type._traits_01_count_records"
$_$;


--
-- Name: values_("~type._traits_02_count_trait_names"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._traits_02_count_trait_names") RETURNS "values__~type._traits_02_count_trait_names"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.traits)::public_validations."values__~type._traits_02_count_trait_names"
$_$;


--
-- Name: values_("~type._traits_03_list_trait_names"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._traits_03_list_trait_names") RETURNS "values__~type._traits_03_list_trait_names"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.trait)::public_validations."values__~type._traits_03_list_trait_names"
$_$;


--
-- Name: values_("~type._traits_04_count_records_per_trait"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._traits_04_count_records_per_trait") RETURNS "values__~type._traits_04_count_records_per_trait"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.measurements)::public_validations."values__~type._traits_04_count_records_per_trait"
$_$;


--
-- Name: values_("~type._traits_05_count_taxa"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._traits_05_count_taxa") RETURNS "values__~type._traits_05_count_taxa"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxa)::public_validations."values__~type._traits_05_count_taxa"
$_$;


--
-- Name: values_("~type._traits_06_list_distinct_taxa"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._traits_06_list_distinct_taxa") RETURNS "values__~type._traits_06_list_distinct_taxa"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxonwithauthor)::public_validations."values__~type._traits_06_list_distinct_taxa"
$_$;


--
-- Name: values_("~type._traits_07_trait_value_and_units"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._traits_07_trait_value_and_units") RETURNS "values__~type._traits_07_trait_value_and_units"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.trait, $1.value, $1.units)::public_validations."values__~type._traits_07_trait_value_and_units"
$_$;


--
-- Name: values_("~type._traits_08_taxonname_trait_and_value"); Type: FUNCTION; Schema: public_validations; Owner: -
--

CREATE FUNCTION values_(value "~type._traits_08_taxonname_trait_and_value") RETURNS "values__~type._traits_08_taxonname_trait_and_value"
    LANGUAGE sql IMMUTABLE
    AS $_$
SELECT ROW($1.taxonwithauthor, $1.trait, $1.value)::public_validations."values__~type._traits_08_taxonname_trait_and_value"
$_$;


SET search_path = public, pg_catalog;

--
-- Name: analytical_stem; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE analytical_stem (
    "datasource__@Brad__.identifier_examples@vegpath.org" text NOT NULL,
    "country__@DwC__@vegpath.org" text,
    "stateProvince__@DwC__@vegpath.org" text,
    "county__@DwC__@vegpath.org" text,
    "locality__@DwC__@vegpath.org" text,
    "decimalLatitude__@DwC__@vegpath.org" double precision,
    "decimalLongitude__@DwC__@vegpath.org" double precision,
    "coordinateUncertaintyInMeters__@DwC__@vegpath.org" double precision,
    "georeferenceSources__@DwC__@vegpath.org" coordinatesource,
    "georeferenceProtocol__@DwC__@vegpath.org" text,
    geovalid_bien integer,
    "isNewWorld_bien" integer,
    "projectID__@VegX__.plotObservation@vegpath.org" text,
    "projectContributor[s]__@VegBank__@vegpath.org" text[],
    "locationID__@DwC__@vegpath.org" text NOT NULL,
    "plotName__@VegX__.plot@vegpath.org" text,
    "subplot__@SALVIAS__.Plot_data@vegpath.org" text,
    location__cultivated__bien boolean,
    "locationevent.locationevent_id__@VegBIEN__.public@vegpath.org" integer,
    "eventDate__@DwC__@vegpath.org" date,
    "(-minimum-)ElevationInMeters__@DwC__@vegpath.org" double precision,
    "slopeAspect[_deg]__@VegX__.plot@vegpath.org" double precision,
    "slopeGradient[_deg]__@VegX__.plot@vegpath.org" double precision,
    "plot.area[_ha]__@VegX__@vegpath.org" double precision,
    "samplingProtocol__@DwC__@vegpath.org" text,
    "temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org" double precision,
    "precip_mm__@SALVIAS__.Plot_metadata@vegpath.org" double precision,
    "stratumName__@VegX__.stratum@vegpath.org" text,
    "communityConcept.name__@VegX__.communityDet@vegpath.org" text[],
    "observationContributor[s]__@VegBank__@vegpath.org" text[],
    "[custodial_]institutionCode[s]__@DwC__@vegpath.org" text,
    "collectionCode__@DwC__@vegpath.org" text,
    "catalogNumber__@DwC__@vegpath.org" text,
    "occurrenceID__@DwC__@vegpath.org" text,
    "recordedBy__@DwC__@vegpath.org" text,
    "recordNumber__@DwC__@vegpath.org" text,
    "(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org" date,
    "[verbatim_]family__@DwC__@vegpath.org" text,
    "[verbatim_]scientificName__@DwC__@vegpath.org" text,
    "identifiedBy__@DwC__@vegpath.org" text,
    "dateIdentified__@DwC__@vegpath.org" date,
    "identificationRemarks__@DwC__@vegpath.org" text,
    "Family_matched__@TNRS__@vegpath.org" text,
    "Name_matched__@TNRS__@vegpath.org" text,
    "Name_matched_author__@TNRS__@vegpath.org" text,
    "[higher_plant_group~]higherClassification__@DwC__@vegpath.org" higher_plant_group,
    "taxonomicStatus__@DwC__@vegpath.org" text,
    scrubbed_family text,
    scrubbed_genus text,
    scrubbed_specific_epithet text,
    scrubbed_species_binomial text,
    scrubbed_taxon_name_no_author text,
    scrubbed_author text,
    scrubbed_taxon_name_with_author text,
    "speciesBinomialWithMorphospecies__@VegCore__@vegpath.org" text,
    "[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org" growthform,
    "reproductiveCondition__@DwC__@vegpath.org" text,
    threatened_bien integer,
    cultivated_bien integer,
    "cultivatedBasis_bien" text,
    "occurrenceRemarks__@DwC__@vegpath.org" text,
    "coverPercent__@VegX__.attribute.ordinal@vegpath.org" double precision,
    "stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org" double precision,
    "stemHeight[_m]__@VegBank__.stemCount@vegpath.org" double precision,
    "[tag=]identificationLabel__@VegX__.individual@vegpath.org" text,
    "relativeX[_m]__@VegX__.individualOrganismObs@vegpath.org" double precision,
    "relativeY[_m]__@VegX__.individualOrganismObs@vegpath.org" double precision,
    "taxonObservation[.id]__@VegBank__@vegpath.org" text,
    "taxonNameUsageConcept.authorCode__@VegX__@vegpath.org" text,
    "aggregateOrganismObservation.id__@VegX__@vegpath.org" text,
    "individualOrganismObservation.id__@VegX__@vegpath.org" text,
    "individualID__@DwC__@vegpath.org" text,
    "individualCount__@DwC__@vegpath.org" integer,
    "stemCode__@VegBank__.stemLocation@vegpath.org" text,
    "TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" integer NOT NULL
);


--
-- Name: COLUMN analytical_stem."datasource__@Brad__.identifier_examples@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."datasource__@Brad__.identifier_examples@vegpath.org" IS '"the person [or] institution that provided the data [to this database] (the *proximate* data provider)"';


--
-- Name: COLUMN analytical_stem."country__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."country__@DwC__@vegpath.org" IS 'http://geoscrub.geoscrub_output.acceptedCountry__@VegBIEN__@vegpath.org;
"The name of the country or major administrative unit in which the Location occurs"';


--
-- Name: COLUMN analytical_stem."stateProvince__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."stateProvince__@DwC__@vegpath.org" IS '"The name of the next smaller administrative region than country (state, province, canton, department, region, etc.) in which the Location occurs"';


--
-- Name: COLUMN analytical_stem."county__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."county__@DwC__@vegpath.org" IS '"The full, unabbreviated name of the next smaller administrative region than stateProvince (county, shire, department, etc.) in which the Location occurs"';


--
-- Name: COLUMN analytical_stem."locality__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."locality__@DwC__@vegpath.org" IS '"The specific description of the place"';


--
-- Name: COLUMN analytical_stem."decimalLatitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS '"The geographic latitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN analytical_stem."decimalLongitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS '"The geographic longitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org" IS 'for a point observation, this is the fuzziness of the coordinates. for a plot (or other shape), this is the radius of the circle that circumscribes the entire plot, or the fuzziness, whichever is greater. note that the DwC definition is confusingly worded: it uses the ambiguous term Location, which sometimes refers to the asserted named place, but which they intended to refer to the plot or point.';


--
-- Name: COLUMN analytical_stem."georeferenceSources__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."georeferenceSources__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of maps, gazetteers, or other resources used to georeference the Location, described specifically enough to allow anyone in the future to use the same resources"';


--
-- Name: COLUMN analytical_stem."georeferenceProtocol__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."georeferenceProtocol__@DwC__@vegpath.org" IS '"A description or reference to the methods used to determine the spatial footprint, coordinates, and uncertainties"';


--
-- Name: COLUMN analytical_stem.geovalid_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.geovalid_bien IS 'whether the coordinates are within the boundary of the asserted named places';


--
-- Name: COLUMN analytical_stem."isNewWorld_bien"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."isNewWorld_bien" IS 'whether the country is in the Americas';


--
-- Name: COLUMN analytical_stem."projectID__@VegX__.plotObservation@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."projectID__@VegX__.plotObservation@vegpath.org" IS 'http://project.sourceaccessioncode__@VegBIEN__.public@vegpath.org;
"A reference to a specific ''project''"';


--
-- Name: COLUMN analytical_stem."projectContributor[s]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."projectContributor[s]__@VegBank__@vegpath.org" IS '"intersection entit[ies] used to ''link'' a party with a specific project wherein vegetation plots are described"';


--
-- Name: COLUMN analytical_stem."locationID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."locationID__@DwC__@vegpath.org" IS '"An identifier for the set of location information (data associated with dcterms:Location)"';


--
-- Name: COLUMN analytical_stem."plotName__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."plotName__@VegX__.plot@vegpath.org" IS '"Name or label for a plot"';


--
-- Name: COLUMN analytical_stem."subplot__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."subplot__@SALVIAS__.Plot_data@vegpath.org" IS 'http://location.authorlocationcode__@VegBIEN__.public@vegpath.org;
"Code for subplot, line, or any other subsample or subdivision of plot"';


--
-- Name: COLUMN analytical_stem.location__cultivated__bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.location__cultivated__bien IS 'whether the occurrence''s *location* was flagged as cultivated. note that this refers just to the cultivated status of the *location*; the occurrence may be cultivated even if the location isn''t.';


--
-- Name: COLUMN analytical_stem."locationevent.locationevent_id__@VegBIEN__.public@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."locationevent.locationevent_id__@VegBIEN__.public@vegpath.org" IS 'http://locationevent.locationevent_id__@VegBIEN__.public@vegpath.org;
autogenerated ID for locationevent';


--
-- Name: COLUMN analytical_stem."eventDate__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."eventDate__@DwC__@vegpath.org" IS '"The date-time or interval during which an Event occurred. For occurrences, this is the date-time when the event was recorded."';


--
-- Name: COLUMN analytical_stem."(-minimum-)ElevationInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."(-minimum-)ElevationInMeters__@DwC__@vegpath.org" IS 'the "elevation (altitude, usually above sea level), in meters"';


--
-- Name: COLUMN analytical_stem."slopeAspect[_deg]__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."slopeAspect[_deg]__@VegX__.plot@vegpath.org" IS '"Representative azimuth of slope gradient (0-360 degrees) or as a cardinal direction (e.g. N, S, NE)"';


--
-- Name: COLUMN analytical_stem."slopeGradient[_deg]__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."slopeGradient[_deg]__@VegX__.plot@vegpath.org" IS '"Representative inclination of slope in degrees"';


--
-- Name: COLUMN analytical_stem."plot.area[_ha]__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."plot.area[_ha]__@VegX__@vegpath.org" IS '"Total area of the plot"';


--
-- Name: COLUMN analytical_stem."samplingProtocol__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."samplingProtocol__@DwC__@vegpath.org" IS '"The name of, reference to, or description of the method or protocol used during an Event"';


--
-- Name: COLUMN analytical_stem."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org" IS '"Temperature during observation [...] [in] Celsius"';


--
-- Name: COLUMN analytical_stem."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org" IS '"Total annual precipitation, in mm"';


--
-- Name: COLUMN analytical_stem."stratumName__@VegX__.stratum@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."stratumName__@VegX__.stratum@vegpath.org" IS '"Name associated with this stratum"';


--
-- Name: COLUMN analytical_stem."communityConcept.name__@VegX__.communityDet@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."communityConcept.name__@VegX__.communityDet@vegpath.org" IS '"A textual label for a community type. A community type is an abstract grouping of organisms that tend to co-occur on the landscape due to shared ecological requirements or preferences."';


--
-- Name: COLUMN analytical_stem."observationContributor[s]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."observationContributor[s]__@VegBank__@vegpath.org" IS '"intersection[s] that link[] a party with a specific plot observation event"';


--
-- Name: COLUMN analytical_stem."[custodial_]institutionCode[s]__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."[custodial_]institutionCode[s]__@DwC__@vegpath.org" IS '"The name[s] (or acronym[s]) in use by the institution[s] having custody of the object(s) or information referred to in the record"';


--
-- Name: COLUMN analytical_stem."collectionCode__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."collectionCode__@DwC__@vegpath.org" IS '"The name, acronym, coden, or initialism identifying the collection or data set from which the record was derived"';


--
-- Name: COLUMN analytical_stem."catalogNumber__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."catalogNumber__@DwC__@vegpath.org" IS '"An identifier (preferably unique) for the record within the data set or collection"';


--
-- Name: COLUMN analytical_stem."occurrenceID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."occurrenceID__@DwC__@vegpath.org" IS '"An identifier for the Occurrence (as opposed to a particular digital record of the occurrence). In the absence of a persistent global unique identifier, construct one from a combination of identifiers in the record that will most closely make the occurrenceID globally unique."';


--
-- Name: COLUMN analytical_stem."recordedBy__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."recordedBy__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of names of people, groups, or organizations responsible for recording the original Occurrence. The primary collector or observer, especially one who applies a personal identifier (recordNumber), should be listed first."';


--
-- Name: COLUMN analytical_stem."recordNumber__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."recordNumber__@DwC__@vegpath.org" IS '"An identifier given to the Occurrence at the time it was recorded. Often serves as a link between field notes and an Occurrence record, such as a specimen collector''s number."';


--
-- Name: COLUMN analytical_stem."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org" IS 'the "date-time (Common Era calendar) in a date-time period during which an organism or group of organisms was collected or observed"';


--
-- Name: COLUMN analytical_stem."[verbatim_]family__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."[verbatim_]family__@DwC__@vegpath.org" IS '"The full scientific name of the family in which the taxon is classified [*before* any TNRS scrubbing]"';


--
-- Name: COLUMN analytical_stem."[verbatim_]scientificName__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."[verbatim_]scientificName__@DwC__@vegpath.org" IS '"The full scientific name [*before* any TNRS scrubbing], with authorship and date information if known. When forming part of an Identification, this should be the name in lowest level taxonomic rank that can be determined."';


--
-- Name: COLUMN analytical_stem."identifiedBy__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."identifiedBy__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of names of people, groups, or organizations who assigned the Taxon to the subject"';


--
-- Name: COLUMN analytical_stem."dateIdentified__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."dateIdentified__@DwC__@vegpath.org" IS '"The date on which the subject was identified as representing the Taxon"';


--
-- Name: COLUMN analytical_stem."identificationRemarks__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."identificationRemarks__@DwC__@vegpath.org" IS '"Comments or notes about the Identification"';


--
-- Name: COLUMN analytical_stem."Family_matched__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."Family_matched__@TNRS__@vegpath.org" IS 'http://TNRS.taxon_scrub.matchedFamily__@VegBIEN__.public@vegpath.org;
"The closest matching family in the TNRS database to the family submitted"';


--
-- Name: COLUMN analytical_stem."Name_matched__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."Name_matched__@TNRS__@vegpath.org" IS '"Scientific name with the highest match score. May be an exact match or a fuzzy match."';


--
-- Name: COLUMN analytical_stem."Name_matched_author__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."Name_matched_author__@TNRS__@vegpath.org" IS '"Standard authority for the matched name"';


--
-- Name: COLUMN analytical_stem."[higher_plant_group~]higherClassification__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."[higher_plant_group~]higherClassification__@DwC__@vegpath.org" IS 'closed list derived from higher taxa';


--
-- Name: COLUMN analytical_stem."taxonomicStatus__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."taxonomicStatus__@DwC__@vegpath.org" IS '"The status of the use of the scientificName as a label for a taxon. Requires taxonomic opinion to define the scope of a taxon. [...] Examples: "invalid", "misapplied", "homotypic synonym", "accepted"."';


--
-- Name: COLUMN analytical_stem.scrubbed_family; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.scrubbed_family IS 'the family of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem.scrubbed_genus; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.scrubbed_genus IS 'the genus of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem.scrubbed_specific_epithet; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.scrubbed_specific_epithet IS 'the specific epithet of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem.scrubbed_species_binomial; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.scrubbed_species_binomial IS 'the species binomial of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem.scrubbed_taxon_name_no_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.scrubbed_taxon_name_no_author IS 'the taxon name without author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem.scrubbed_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.scrubbed_author IS 'the author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem.scrubbed_taxon_name_with_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.scrubbed_taxon_name_with_author IS 'the taxon name with author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org" IS 'http://TNRS.taxon_scrub.scrubbed_morphospecies_binomial__@VegBIEN__.public@vegpath.org;
"combine the `taxon` plus `morphospecies` to produce a unique string, `taxonMorphospecies`";
a morphospecies is a custom species name assigned in the field by the collector (which does not validate to anything in TNRS)';


--
-- Name: COLUMN analytical_stem."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org" IS '"Growth form"; "Closed pick list"';


--
-- Name: COLUMN analytical_stem."reproductiveCondition__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."reproductiveCondition__@DwC__@vegpath.org" IS '"The reproductive condition of the biological individual(s) represented in the Occurrence. Recommended best practice is to use a controlled vocabulary."';


--
-- Name: COLUMN analytical_stem.threatened_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.threatened_bien IS 'whether the taxon is on the IUCN Red List of Threatened Species';


--
-- Name: COLUMN analytical_stem.cultivated_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem.cultivated_bien IS 'whether the occurrence was flagged as cultivated';


--
-- Name: COLUMN analytical_stem."cultivatedBasis_bien"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."cultivatedBasis_bien" IS 'why the occurrence was flagged as cultivated';


--
-- Name: COLUMN analytical_stem."occurrenceRemarks__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."occurrenceRemarks__@DwC__@vegpath.org" IS '"Comments or notes about the Occurrence"';


--
-- Name: COLUMN analytical_stem."coverPercent__@VegX__.attribute.ordinal@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."coverPercent__@VegX__.attribute.ordinal@vegpath.org" IS '"Average cover of the index in percent"';


--
-- Name: COLUMN analytical_stem."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org" IS '"Diameter at breast height of this stem (usually taken at 1.3 meters, but may vary)"';


--
-- Name: COLUMN analytical_stem."stemHeight[_m]__@VegBank__.stemCount@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."stemHeight[_m]__@VegBank__.stemCount@vegpath.org" IS '"The measured height of the stem in meters"';


--
-- Name: COLUMN analytical_stem."[tag=]identificationLabel__@VegX__.individual@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."[tag=]identificationLabel__@VegX__.individual@vegpath.org" IS '"A label that is associated with an individual (e.g. a numerical tree tag)"';


--
-- Name: COLUMN analytical_stem."relativeX[_m]__@VegX__.individualOrganismObs@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."relativeX[_m]__@VegX__.individualOrganismObs@vegpath.org" IS '"The X-coordinate of the related item position in m. The user will enter the relative position of related item with respect to the plot origin (in meters) with the x-axis defined by the plot azimuth."';


--
-- Name: COLUMN analytical_stem."relativeY[_m]__@VegX__.individualOrganismObs@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."relativeY[_m]__@VegX__.individualOrganismObs@vegpath.org" IS '"The Y-coordinate of the relatedSpatialItem position in m. The user will enter the relative position of relatedSpatialItems with respect to the plot origin (in meters) with the y-axis defined by the plot azimuth."';


--
-- Name: COLUMN analytical_stem."taxonObservation[.id]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."taxonObservation[.id]__@VegBank__@vegpath.org" IS '"identifier assigned [by the datasource] to each unique observation of a taxon in a plot"';


--
-- Name: COLUMN analytical_stem."taxonNameUsageConcept.authorCode__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."taxonNameUsageConcept.authorCode__@VegX__@vegpath.org" IS '"Verbatum short code used by the author to signify the species at time of observation"';


--
-- Name: COLUMN analytical_stem."aggregateOrganismObservation.id__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."aggregateOrganismObservation.id__@VegX__@vegpath.org" IS 'the ID for "An observation applying to all occurrences of an organism based on an aggregation factor. It contains an AggregateValue, which is an assessment of the overall occurrence of an organism in a Plot (e.g. number of stems, percentage cover, total biomass, basal area)."';


--
-- Name: COLUMN analytical_stem."individualOrganismObservation.id__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."individualOrganismObservation.id__@VegX__@vegpath.org" IS 'the ID for "An observation applying to one occurrence of an organism (or part of an organism). It is a container for measurements made on the organism (e.g. diameter, height, crown dimensions, biomass, growth form, number of stems)."';


--
-- Name: COLUMN analytical_stem."individualID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."individualID__@DwC__@vegpath.org" IS '"An identifier for an individual or named group of individual organisms represented in the Occurrence"';


--
-- Name: COLUMN analytical_stem."individualCount__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."individualCount__@DwC__@vegpath.org" IS '"The number of individuals represented present at the time of the Occurrence"';


--
-- Name: COLUMN analytical_stem."stemCode__@VegBank__.stemLocation@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."stemCode__@VegBank__.stemLocation@vegpath.org" IS 'http://stemobservation.authorstemcode__@VegBIEN__.public@vegpath.org;
"Name or code applied to a specific stem in the plot. This is generally a numeric label to associate a field data entry with a stem in the database."';


--
-- Name: COLUMN analytical_stem."TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem."TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" IS 'VegBIEN-autogenerated "identifier assigned to each unique observation of a taxon in a plot"';


--
-- Name: 2013-10-18.Brian_Enquist.Canadensys; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW "2013-10-18.Brian_Enquist.Canadensys" AS
 SELECT analytical_stem."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org" AS species,
    analytical_stem."decimalLatitude__@DwC__@vegpath.org" AS latitude__deg,
    analytical_stem."decimalLongitude__@DwC__@vegpath.org" AS longitude__deg,
    analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org" AS coords__uncertainty__m
   FROM analytical_stem
  WHERE (((((analytical_stem."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org" = ANY (ARRAY['Juniperus scopulorum'::text, 'Picea engelmannii'::text, 'Pinus contorta'::text, 'Pinus edulis'::text, 'Pinus ponderosa'::text, 'Populus tremuloides'::text, 'Pseudotsuga menziesii'::text, 'Quercus gambelii'::text])) AND (NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false))) AND COALESCE((analytical_stem.geovalid_bien)::boolean, true)) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL))
  ORDER BY analytical_stem."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org";


--
-- Name: 2013-7-10.Naia.range_limiting_factors; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW "2013-7-10.Naia.range_limiting_factors" AS
 SELECT analytical_stem."TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" AS occurrence_id,
    analytical_stem."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org" AS species,
    analytical_stem."decimalLatitude__@DwC__@vegpath.org" AS latitude__deg,
    analytical_stem."decimalLongitude__@DwC__@vegpath.org" AS longitude__deg
   FROM analytical_stem
  WHERE ((((((NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false)) AND COALESCE((analytical_stem.geovalid_bien)::boolean, true)) AND (analytical_stem."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL)) AND COALESCE((analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org" <= _km_to_m((10)::double precision)), true));


--
-- Name: 2014-3-11.Jeff_Ott.climatic_range_determinants; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW "2014-3-11.Jeff_Ott.climatic_range_determinants" AS
 SELECT analytical_stem."datasource__@Brad__.identifier_examples@vegpath.org" AS datasource,
    analytical_stem."decimalLatitude__@DwC__@vegpath.org" AS "decimalLatitude",
    analytical_stem."decimalLongitude__@DwC__@vegpath.org" AS "decimalLongitude",
    analytical_stem."[higher_plant_group~]higherClassification__@DwC__@vegpath.org" AS "higherPlantGroup",
    analytical_stem.scrubbed_family AS family,
    analytical_stem.scrubbed_genus AS genus,
    analytical_stem.scrubbed_species_binomial AS "speciesBinomial",
    analytical_stem.scrubbed_taxon_name_with_author AS "scientificName"
   FROM analytical_stem
  WHERE (((((COALESCE((analytical_stem.geovalid_bien)::boolean, true) AND COALESCE((analytical_stem."isNewWorld_bien")::boolean, false)) AND (NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false))) AND (analytical_stem.scrubbed_taxon_name_with_author IS NOT NULL)) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL));


--
-- Name: 2014-6-12.Jeff_Ott.climatic_range_determinants; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW "2014-6-12.Jeff_Ott.climatic_range_determinants" AS
 SELECT analytical_stem."datasource__@Brad__.identifier_examples@vegpath.org" AS datasource,
    analytical_stem."decimalLatitude__@DwC__@vegpath.org" AS "decimalLatitude",
    analytical_stem."decimalLongitude__@DwC__@vegpath.org" AS "decimalLongitude",
    analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org" AS "coordinateUncertaintyInMeters",
    analytical_stem.geovalid_bien,
    analytical_stem."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org" AS "dateCollected",
    analytical_stem."[higher_plant_group~]higherClassification__@DwC__@vegpath.org" AS "higherPlantGroup",
    analytical_stem.scrubbed_family AS family,
    analytical_stem.scrubbed_genus AS genus,
    analytical_stem.scrubbed_species_binomial AS "speciesBinomial",
    analytical_stem.scrubbed_taxon_name_with_author AS "scientificName"
   FROM analytical_stem
  WHERE ((((((COALESCE((analytical_stem.geovalid_bien)::boolean, true) AND (COALESCE((analytical_stem."isNewWorld_bien")::boolean, false) OR in_new_world(analytical_stem."decimalLatitude__@DwC__@vegpath.org", analytical_stem."decimalLongitude__@DwC__@vegpath.org"))) AND (NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false))) AND (analytical_stem.scrubbed_family IS NOT NULL)) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL)) AND COALESCE((analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org" <= _km_to_m((10)::double precision)), true));


--
-- Name: iucn_red_list; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE iucn_red_list (
    accepted_family text NOT NULL,
    accepted_species_binomial text NOT NULL
);


--
-- Name: source; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE source (
    source_id integer NOT NULL,
    matched_source_id integer,
    parent_id integer,
    shortname text NOT NULL,
    citation text,
    sourcetype sourcetype,
    accesslevel accesslevel,
    accessconditions text,
    observationtype observationtype,
    title text,
    titlesuperior text,
    volume text,
    issue text,
    pagerange text,
    totalpages integer,
    publisher text,
    publicationplace text,
    isbn text,
    edition text,
    numberofvolumes integer,
    chapternumber integer,
    reportnumber integer,
    communicationtype text,
    degree text,
    url text,
    doi text,
    additionalinfo text,
    pubdate date,
    accessdate date,
    conferencedate date,
    datecreated date DEFAULT now() NOT NULL,
    createdby text,
    datelastmodified date DEFAULT now() NOT NULL,
    lastmodifiedby text,
    import_revision text
);


--
-- Name: 2014-6-4.Iara_Lacher.reserve_prioritization; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW "2014-6-4.Iara_Lacher.reserve_prioritization" AS
 SELECT analytical_stem."country__@DwC__@vegpath.org" AS country,
    analytical_stem."decimalLatitude__@DwC__@vegpath.org" AS "decimalLatitude",
    analytical_stem."decimalLongitude__@DwC__@vegpath.org" AS "decimalLongitude",
    analytical_stem."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org" AS "dateCollected",
    source.observationtype AS collection_type,
    COALESCE(analytical_stem."[custodial_]institutionCode[s]__@DwC__@vegpath.org", analytical_stem."datasource__@Brad__.identifier_examples@vegpath.org") AS orig_datasource,
    analytical_stem.scrubbed_family AS accepted_family,
    analytical_stem.scrubbed_genus AS accepted_genus,
    analytical_stem.scrubbed_species_binomial AS accepted_species_binomial,
    subspecies(analytical_stem.scrubbed_taxon_name_no_author) AS accepted_subspecies,
    analytical_stem."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org" AS dbh_cm,
    analytical_stem."stemHeight[_m]__@VegBank__.stemCount@vegpath.org" AS height_m,
    analytical_stem."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org" AS lifeform,
    (iucn_red_list.accepted_family IS NOT NULL) AS is_threatened_iucn
   FROM ((analytical_stem
   LEFT JOIN source ON ((source.shortname = analytical_stem."datasource__@Brad__.identifier_examples@vegpath.org")))
   LEFT JOIN iucn_red_list ON (((iucn_red_list.accepted_family = analytical_stem.scrubbed_family) AND (iucn_red_list.accepted_species_binomial = analytical_stem.scrubbed_species_binomial))))
  WHERE (((((COALESCE((analytical_stem.geovalid_bien)::boolean, true) AND (NOT COALESCE((analytical_stem.cultivated_bien)::boolean, false))) AND (analytical_stem."decimalLatitude__@DwC__@vegpath.org" IS NOT NULL)) AND (analytical_stem."decimalLongitude__@DwC__@vegpath.org" IS NOT NULL)) AND in_south_america(analytical_stem."decimalLatitude__@DwC__@vegpath.org", analytical_stem."decimalLongitude__@DwC__@vegpath.org")) AND COALESCE((analytical_stem."taxonomicStatus__@DwC__@vegpath.org" = 'accepted'::text), false));


--
-- Name: address; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE address (
    address_id integer NOT NULL,
    party_id integer NOT NULL,
    organization_id integer,
    orgposition text,
    email text,
    street text,
    street2 text,
    city text,
    stateprovince text,
    postalcode text,
    country text,
    currentflag boolean,
    addressstartdate date
);


--
-- Name: address_address_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE address_address_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: address_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE address_address_id_seq OWNED BY address.address_id;


--
-- Name: aggregateoccurrence; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE aggregateoccurrence (
    aggregateoccurrence_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    taxonoccurrence_id integer,
    collectiondate date,
    cover_fraction double precision,
    linecover_m double precision,
    basalarea_m2 double precision,
    biomass_kg_m2 double precision,
    inferencearea_m2 double precision,
    count integer,
    stratum_id integer,
    coverindex_id integer,
    occurrencestatus_dwc occurrencestatus_dwc DEFAULT 'present'::occurrencestatus_dwc NOT NULL,
    method_id integer,
    notes text,
    CONSTRAINT aggregateoccurrence_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (taxonoccurrence_id IS NOT NULL)))
);


--
-- Name: TABLE aggregateoccurrence; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE aggregateoccurrence IS '
Equivalent to VegBank''s taxonimportance table.
';


--
-- Name: COLUMN aggregateoccurrence.linecover_m; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN aggregateoccurrence.linecover_m IS '
The distance in m along which this occurrence intercepts a line subplot.
';


--
-- Name: COLUMN aggregateoccurrence.occurrencestatus_dwc; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN aggregateoccurrence.occurrencestatus_dwc IS '
The extent to which the taxon is present. See <http://code.google.com/p/darwincore/wiki/Occurrence#occurrenceStatus>.
';


--
-- Name: aggregateoccurrence_aggregateoccurrence_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE aggregateoccurrence_aggregateoccurrence_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: aggregateoccurrence_aggregateoccurrence_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE aggregateoccurrence_aggregateoccurrence_id_seq OWNED BY aggregateoccurrence.aggregateoccurrence_id;


--
-- Name: analytical_plot; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW analytical_plot AS
 SELECT analytical_stem."datasource__@Brad__.identifier_examples@vegpath.org",
    analytical_stem."country__@DwC__@vegpath.org",
    analytical_stem."stateProvince__@DwC__@vegpath.org",
    analytical_stem."county__@DwC__@vegpath.org",
    analytical_stem."locality__@DwC__@vegpath.org",
    analytical_stem."decimalLatitude__@DwC__@vegpath.org",
    analytical_stem."decimalLongitude__@DwC__@vegpath.org",
    analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org",
    analytical_stem."georeferenceSources__@DwC__@vegpath.org",
    analytical_stem."georeferenceProtocol__@DwC__@vegpath.org",
    analytical_stem.geovalid_bien,
    analytical_stem."isNewWorld_bien",
    analytical_stem."projectID__@VegX__.plotObservation@vegpath.org",
    analytical_stem."projectContributor[s]__@VegBank__@vegpath.org",
    analytical_stem."locationID__@DwC__@vegpath.org",
    analytical_stem."plotName__@VegX__.plot@vegpath.org",
    analytical_stem."subplot__@SALVIAS__.Plot_data@vegpath.org",
    analytical_stem.location__cultivated__bien,
    analytical_stem."eventDate__@DwC__@vegpath.org",
    analytical_stem."(-minimum-)ElevationInMeters__@DwC__@vegpath.org",
    analytical_stem."slopeAspect[_deg]__@VegX__.plot@vegpath.org",
    analytical_stem."slopeGradient[_deg]__@VegX__.plot@vegpath.org",
    analytical_stem."plot.area[_ha]__@VegX__@vegpath.org",
    analytical_stem."samplingProtocol__@DwC__@vegpath.org",
    analytical_stem."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org",
    analytical_stem."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org",
    analytical_stem."stratumName__@VegX__.stratum@vegpath.org",
    analytical_stem."communityConcept.name__@VegX__.communityDet@vegpath.org",
    analytical_stem."observationContributor[s]__@VegBank__@vegpath.org",
    analytical_stem."recordedBy__@DwC__@vegpath.org",
    analytical_stem."recordNumber__@DwC__@vegpath.org",
    analytical_stem."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org",
    analytical_stem."[verbatim_]family__@DwC__@vegpath.org",
    analytical_stem."[verbatim_]scientificName__@DwC__@vegpath.org",
    analytical_stem."identifiedBy__@DwC__@vegpath.org",
    analytical_stem."dateIdentified__@DwC__@vegpath.org",
    analytical_stem."identificationRemarks__@DwC__@vegpath.org",
    analytical_stem."Family_matched__@TNRS__@vegpath.org",
    analytical_stem."Name_matched__@TNRS__@vegpath.org",
    analytical_stem."Name_matched_author__@TNRS__@vegpath.org",
    analytical_stem.scrubbed_family,
    analytical_stem.scrubbed_genus,
    analytical_stem."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org",
    analytical_stem.scrubbed_taxon_name_no_author,
    analytical_stem.scrubbed_author,
    analytical_stem."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org",
    analytical_stem."reproductiveCondition__@DwC__@vegpath.org",
    analytical_stem.cultivated_bien,
    analytical_stem."cultivatedBasis_bien",
    analytical_stem."occurrenceRemarks__@DwC__@vegpath.org",
    analytical_stem."coverPercent__@VegX__.attribute.ordinal@vegpath.org",
    analytical_stem."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org",
    analytical_stem."stemHeight[_m]__@VegBank__.stemCount@vegpath.org",
    analytical_stem."[tag=]identificationLabel__@VegX__.individual@vegpath.org",
    analytical_stem."relativeX[_m]__@VegX__.individualOrganismObs@vegpath.org",
    analytical_stem."relativeY[_m]__@VegX__.individualOrganismObs@vegpath.org",
    analytical_stem."taxonObservation[.id]__@VegBank__@vegpath.org",
    analytical_stem."taxonNameUsageConcept.authorCode__@VegX__@vegpath.org",
    analytical_stem."aggregateOrganismObservation.id__@VegX__@vegpath.org",
    analytical_stem."individualOrganismObservation.id__@VegX__@vegpath.org",
    analytical_stem."individualID__@DwC__@vegpath.org",
    analytical_stem."individualCount__@DwC__@vegpath.org",
    analytical_stem."stemCode__@VegBank__.stemLocation@vegpath.org"
   FROM analytical_stem;


--
-- Name: COLUMN analytical_plot."datasource__@Brad__.identifier_examples@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."datasource__@Brad__.identifier_examples@vegpath.org" IS '"the person [or] institution that provided the data [to this database] (the *proximate* data provider)"';


--
-- Name: COLUMN analytical_plot."country__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."country__@DwC__@vegpath.org" IS 'http://geoscrub.geoscrub_output.acceptedCountry__@VegBIEN__@vegpath.org;
"The name of the country or major administrative unit in which the Location occurs"';


--
-- Name: COLUMN analytical_plot."stateProvince__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."stateProvince__@DwC__@vegpath.org" IS '"The name of the next smaller administrative region than country (state, province, canton, department, region, etc.) in which the Location occurs"';


--
-- Name: COLUMN analytical_plot."county__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."county__@DwC__@vegpath.org" IS '"The full, unabbreviated name of the next smaller administrative region than stateProvince (county, shire, department, etc.) in which the Location occurs"';


--
-- Name: COLUMN analytical_plot."locality__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."locality__@DwC__@vegpath.org" IS '"The specific description of the place"';


--
-- Name: COLUMN analytical_plot."decimalLatitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."decimalLatitude__@DwC__@vegpath.org" IS '"The geographic latitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN analytical_plot."decimalLongitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."decimalLongitude__@DwC__@vegpath.org" IS '"The geographic longitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN analytical_plot."coordinateUncertaintyInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."coordinateUncertaintyInMeters__@DwC__@vegpath.org" IS 'for a point observation, this is the fuzziness of the coordinates. for a plot (or other shape), this is the radius of the circle that circumscribes the entire plot, or the fuzziness, whichever is greater. note that the DwC definition is confusingly worded: it uses the ambiguous term Location, which sometimes refers to the asserted named place, but which they intended to refer to the plot or point.';


--
-- Name: COLUMN analytical_plot."georeferenceSources__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."georeferenceSources__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of maps, gazetteers, or other resources used to georeference the Location, described specifically enough to allow anyone in the future to use the same resources"';


--
-- Name: COLUMN analytical_plot."georeferenceProtocol__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."georeferenceProtocol__@DwC__@vegpath.org" IS '"A description or reference to the methods used to determine the spatial footprint, coordinates, and uncertainties"';


--
-- Name: COLUMN analytical_plot.geovalid_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot.geovalid_bien IS 'whether the coordinates are within the boundary of the asserted named places';


--
-- Name: COLUMN analytical_plot."isNewWorld_bien"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."isNewWorld_bien" IS 'whether the country is in the Americas';


--
-- Name: COLUMN analytical_plot."projectID__@VegX__.plotObservation@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."projectID__@VegX__.plotObservation@vegpath.org" IS 'http://project.sourceaccessioncode__@VegBIEN__.public@vegpath.org;
"A reference to a specific ''project''"';


--
-- Name: COLUMN analytical_plot."projectContributor[s]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."projectContributor[s]__@VegBank__@vegpath.org" IS '"intersection entit[ies] used to ''link'' a party with a specific project wherein vegetation plots are described"';


--
-- Name: COLUMN analytical_plot."locationID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."locationID__@DwC__@vegpath.org" IS '"An identifier for the set of location information (data associated with dcterms:Location)"';


--
-- Name: COLUMN analytical_plot."plotName__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."plotName__@VegX__.plot@vegpath.org" IS '"Name or label for a plot"';


--
-- Name: COLUMN analytical_plot."subplot__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."subplot__@SALVIAS__.Plot_data@vegpath.org" IS 'http://location.authorlocationcode__@VegBIEN__.public@vegpath.org;
"Code for subplot, line, or any other subsample or subdivision of plot"';


--
-- Name: COLUMN analytical_plot.location__cultivated__bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot.location__cultivated__bien IS 'whether the occurrence''s *location* was flagged as cultivated. note that this refers just to the cultivated status of the *location*; the occurrence may be cultivated even if the location isn''t.';


--
-- Name: COLUMN analytical_plot."eventDate__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."eventDate__@DwC__@vegpath.org" IS '"The date-time or interval during which an Event occurred. For occurrences, this is the date-time when the event was recorded."';


--
-- Name: COLUMN analytical_plot."(-minimum-)ElevationInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."(-minimum-)ElevationInMeters__@DwC__@vegpath.org" IS 'the "elevation (altitude, usually above sea level), in meters"';


--
-- Name: COLUMN analytical_plot."slopeAspect[_deg]__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."slopeAspect[_deg]__@VegX__.plot@vegpath.org" IS '"Representative azimuth of slope gradient (0-360 degrees) or as a cardinal direction (e.g. N, S, NE)"';


--
-- Name: COLUMN analytical_plot."slopeGradient[_deg]__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."slopeGradient[_deg]__@VegX__.plot@vegpath.org" IS '"Representative inclination of slope in degrees"';


--
-- Name: COLUMN analytical_plot."plot.area[_ha]__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."plot.area[_ha]__@VegX__@vegpath.org" IS '"Total area of the plot"';


--
-- Name: COLUMN analytical_plot."samplingProtocol__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."samplingProtocol__@DwC__@vegpath.org" IS '"The name of, reference to, or description of the method or protocol used during an Event"';


--
-- Name: COLUMN analytical_plot."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org" IS '"Temperature during observation [...] [in] Celsius"';


--
-- Name: COLUMN analytical_plot."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org" IS '"Total annual precipitation, in mm"';


--
-- Name: COLUMN analytical_plot."stratumName__@VegX__.stratum@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."stratumName__@VegX__.stratum@vegpath.org" IS '"Name associated with this stratum"';


--
-- Name: COLUMN analytical_plot."communityConcept.name__@VegX__.communityDet@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."communityConcept.name__@VegX__.communityDet@vegpath.org" IS '"A textual label for a community type. A community type is an abstract grouping of organisms that tend to co-occur on the landscape due to shared ecological requirements or preferences."';


--
-- Name: COLUMN analytical_plot."observationContributor[s]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."observationContributor[s]__@VegBank__@vegpath.org" IS '"intersection[s] that link[] a party with a specific plot observation event"';


--
-- Name: COLUMN analytical_plot."recordedBy__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."recordedBy__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of names of people, groups, or organizations responsible for recording the original Occurrence. The primary collector or observer, especially one who applies a personal identifier (recordNumber), should be listed first."';


--
-- Name: COLUMN analytical_plot."recordNumber__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."recordNumber__@DwC__@vegpath.org" IS '"An identifier given to the Occurrence at the time it was recorded. Often serves as a link between field notes and an Occurrence record, such as a specimen collector''s number."';


--
-- Name: COLUMN analytical_plot."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org" IS 'the "date-time (Common Era calendar) in a date-time period during which an organism or group of organisms was collected or observed"';


--
-- Name: COLUMN analytical_plot."[verbatim_]family__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."[verbatim_]family__@DwC__@vegpath.org" IS '"The full scientific name of the family in which the taxon is classified [*before* any TNRS scrubbing]"';


--
-- Name: COLUMN analytical_plot."[verbatim_]scientificName__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."[verbatim_]scientificName__@DwC__@vegpath.org" IS '"The full scientific name [*before* any TNRS scrubbing], with authorship and date information if known. When forming part of an Identification, this should be the name in lowest level taxonomic rank that can be determined."';


--
-- Name: COLUMN analytical_plot."identifiedBy__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."identifiedBy__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of names of people, groups, or organizations who assigned the Taxon to the subject"';


--
-- Name: COLUMN analytical_plot."dateIdentified__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."dateIdentified__@DwC__@vegpath.org" IS '"The date on which the subject was identified as representing the Taxon"';


--
-- Name: COLUMN analytical_plot."identificationRemarks__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."identificationRemarks__@DwC__@vegpath.org" IS '"Comments or notes about the Identification"';


--
-- Name: COLUMN analytical_plot."Family_matched__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."Family_matched__@TNRS__@vegpath.org" IS 'http://TNRS.taxon_scrub.matchedFamily__@VegBIEN__.public@vegpath.org;
"The closest matching family in the TNRS database to the family submitted"';


--
-- Name: COLUMN analytical_plot."Name_matched__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."Name_matched__@TNRS__@vegpath.org" IS '"Scientific name with the highest match score. May be an exact match or a fuzzy match."';


--
-- Name: COLUMN analytical_plot."Name_matched_author__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."Name_matched_author__@TNRS__@vegpath.org" IS '"Standard authority for the matched name"';


--
-- Name: COLUMN analytical_plot.scrubbed_family; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot.scrubbed_family IS 'the family of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_plot.scrubbed_genus; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot.scrubbed_genus IS 'the genus of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_plot."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org" IS 'http://TNRS.taxon_scrub.scrubbed_morphospecies_binomial__@VegBIEN__.public@vegpath.org;
"combine the `taxon` plus `morphospecies` to produce a unique string, `taxonMorphospecies`";
a morphospecies is a custom species name assigned in the field by the collector (which does not validate to anything in TNRS)';


--
-- Name: COLUMN analytical_plot.scrubbed_taxon_name_no_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot.scrubbed_taxon_name_no_author IS 'the taxon name without author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_plot.scrubbed_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot.scrubbed_author IS 'the author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_plot."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org" IS '"Growth form"; "Closed pick list"';


--
-- Name: COLUMN analytical_plot."reproductiveCondition__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."reproductiveCondition__@DwC__@vegpath.org" IS '"The reproductive condition of the biological individual(s) represented in the Occurrence. Recommended best practice is to use a controlled vocabulary."';


--
-- Name: COLUMN analytical_plot.cultivated_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot.cultivated_bien IS 'whether the occurrence was flagged as cultivated';


--
-- Name: COLUMN analytical_plot."cultivatedBasis_bien"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."cultivatedBasis_bien" IS 'why the occurrence was flagged as cultivated';


--
-- Name: COLUMN analytical_plot."occurrenceRemarks__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."occurrenceRemarks__@DwC__@vegpath.org" IS '"Comments or notes about the Occurrence"';


--
-- Name: COLUMN analytical_plot."coverPercent__@VegX__.attribute.ordinal@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."coverPercent__@VegX__.attribute.ordinal@vegpath.org" IS '"Average cover of the index in percent"';


--
-- Name: COLUMN analytical_plot."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org" IS '"Diameter at breast height of this stem (usually taken at 1.3 meters, but may vary)"';


--
-- Name: COLUMN analytical_plot."stemHeight[_m]__@VegBank__.stemCount@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."stemHeight[_m]__@VegBank__.stemCount@vegpath.org" IS '"The measured height of the stem in meters"';


--
-- Name: COLUMN analytical_plot."[tag=]identificationLabel__@VegX__.individual@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."[tag=]identificationLabel__@VegX__.individual@vegpath.org" IS '"A label that is associated with an individual (e.g. a numerical tree tag)"';


--
-- Name: COLUMN analytical_plot."relativeX[_m]__@VegX__.individualOrganismObs@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."relativeX[_m]__@VegX__.individualOrganismObs@vegpath.org" IS '"The X-coordinate of the related item position in m. The user will enter the relative position of related item with respect to the plot origin (in meters) with the x-axis defined by the plot azimuth."';


--
-- Name: COLUMN analytical_plot."relativeY[_m]__@VegX__.individualOrganismObs@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."relativeY[_m]__@VegX__.individualOrganismObs@vegpath.org" IS '"The Y-coordinate of the relatedSpatialItem position in m. The user will enter the relative position of relatedSpatialItems with respect to the plot origin (in meters) with the y-axis defined by the plot azimuth."';


--
-- Name: COLUMN analytical_plot."taxonObservation[.id]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."taxonObservation[.id]__@VegBank__@vegpath.org" IS '"identifier assigned [by the datasource] to each unique observation of a taxon in a plot"';


--
-- Name: COLUMN analytical_plot."taxonNameUsageConcept.authorCode__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."taxonNameUsageConcept.authorCode__@VegX__@vegpath.org" IS '"Verbatum short code used by the author to signify the species at time of observation"';


--
-- Name: COLUMN analytical_plot."aggregateOrganismObservation.id__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."aggregateOrganismObservation.id__@VegX__@vegpath.org" IS 'the ID for "An observation applying to all occurrences of an organism based on an aggregation factor. It contains an AggregateValue, which is an assessment of the overall occurrence of an organism in a Plot (e.g. number of stems, percentage cover, total biomass, basal area)."';


--
-- Name: COLUMN analytical_plot."individualOrganismObservation.id__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."individualOrganismObservation.id__@VegX__@vegpath.org" IS 'the ID for "An observation applying to one occurrence of an organism (or part of an organism). It is a container for measurements made on the organism (e.g. diameter, height, crown dimensions, biomass, growth form, number of stems)."';


--
-- Name: COLUMN analytical_plot."individualID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."individualID__@DwC__@vegpath.org" IS '"An identifier for an individual or named group of individual organisms represented in the Occurrence"';


--
-- Name: COLUMN analytical_plot."individualCount__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."individualCount__@DwC__@vegpath.org" IS '"The number of individuals represented present at the time of the Occurrence"';


--
-- Name: COLUMN analytical_plot."stemCode__@VegBank__.stemLocation@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_plot."stemCode__@VegBank__.stemLocation@vegpath.org" IS 'http://stemobservation.authorstemcode__@VegBIEN__.public@vegpath.org;
"Name or code applied to a specific stem in the plot. This is generally a numeric label to associate a field data entry with a stem in the database."';


--
-- Name: analytical_specimen; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW analytical_specimen AS
 SELECT analytical_stem."datasource__@Brad__.identifier_examples@vegpath.org",
    analytical_stem."country__@DwC__@vegpath.org",
    analytical_stem."stateProvince__@DwC__@vegpath.org",
    analytical_stem."county__@DwC__@vegpath.org",
    analytical_stem."locality__@DwC__@vegpath.org",
    analytical_stem."decimalLatitude__@DwC__@vegpath.org",
    analytical_stem."decimalLongitude__@DwC__@vegpath.org",
    analytical_stem."coordinateUncertaintyInMeters__@DwC__@vegpath.org",
    analytical_stem."georeferenceSources__@DwC__@vegpath.org",
    analytical_stem."georeferenceProtocol__@DwC__@vegpath.org",
    analytical_stem.geovalid_bien,
    analytical_stem."isNewWorld_bien",
    analytical_stem.location__cultivated__bien,
    analytical_stem."eventDate__@DwC__@vegpath.org",
    analytical_stem."(-minimum-)ElevationInMeters__@DwC__@vegpath.org",
    analytical_stem."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org",
    analytical_stem."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org",
    analytical_stem."[custodial_]institutionCode[s]__@DwC__@vegpath.org",
    analytical_stem."collectionCode__@DwC__@vegpath.org",
    analytical_stem."catalogNumber__@DwC__@vegpath.org",
    analytical_stem."occurrenceID__@DwC__@vegpath.org",
    analytical_stem."recordedBy__@DwC__@vegpath.org",
    analytical_stem."recordNumber__@DwC__@vegpath.org",
    analytical_stem."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org",
    analytical_stem."[verbatim_]family__@DwC__@vegpath.org",
    analytical_stem."[verbatim_]scientificName__@DwC__@vegpath.org",
    analytical_stem."identifiedBy__@DwC__@vegpath.org",
    analytical_stem."dateIdentified__@DwC__@vegpath.org",
    analytical_stem."identificationRemarks__@DwC__@vegpath.org",
    analytical_stem."Family_matched__@TNRS__@vegpath.org",
    analytical_stem."Name_matched__@TNRS__@vegpath.org",
    analytical_stem."Name_matched_author__@TNRS__@vegpath.org",
    analytical_stem.scrubbed_family,
    analytical_stem.scrubbed_genus,
    analytical_stem.scrubbed_taxon_name_no_author,
    analytical_stem.scrubbed_author,
    analytical_stem."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org",
    analytical_stem."reproductiveCondition__@DwC__@vegpath.org",
    analytical_stem.cultivated_bien,
    analytical_stem."cultivatedBasis_bien",
    analytical_stem."occurrenceRemarks__@DwC__@vegpath.org",
    analytical_stem."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org",
    analytical_stem."stemHeight[_m]__@VegBank__.stemCount@vegpath.org",
    analytical_stem."[tag=]identificationLabel__@VegX__.individual@vegpath.org"
   FROM analytical_stem;


--
-- Name: COLUMN analytical_specimen."datasource__@Brad__.identifier_examples@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."datasource__@Brad__.identifier_examples@vegpath.org" IS '"the person [or] institution that provided the data [to this database] (the *proximate* data provider)"';


--
-- Name: COLUMN analytical_specimen."country__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."country__@DwC__@vegpath.org" IS 'http://geoscrub.geoscrub_output.acceptedCountry__@VegBIEN__@vegpath.org;
"The name of the country or major administrative unit in which the Location occurs"';


--
-- Name: COLUMN analytical_specimen."stateProvince__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."stateProvince__@DwC__@vegpath.org" IS '"The name of the next smaller administrative region than country (state, province, canton, department, region, etc.) in which the Location occurs"';


--
-- Name: COLUMN analytical_specimen."county__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."county__@DwC__@vegpath.org" IS '"The full, unabbreviated name of the next smaller administrative region than stateProvince (county, shire, department, etc.) in which the Location occurs"';


--
-- Name: COLUMN analytical_specimen."locality__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."locality__@DwC__@vegpath.org" IS '"The specific description of the place"';


--
-- Name: COLUMN analytical_specimen."decimalLatitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."decimalLatitude__@DwC__@vegpath.org" IS '"The geographic latitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN analytical_specimen."decimalLongitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."decimalLongitude__@DwC__@vegpath.org" IS '"The geographic longitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN analytical_specimen."coordinateUncertaintyInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."coordinateUncertaintyInMeters__@DwC__@vegpath.org" IS 'for a point observation, this is the fuzziness of the coordinates. for a plot (or other shape), this is the radius of the circle that circumscribes the entire plot, or the fuzziness, whichever is greater. note that the DwC definition is confusingly worded: it uses the ambiguous term Location, which sometimes refers to the asserted named place, but which they intended to refer to the plot or point.';


--
-- Name: COLUMN analytical_specimen."georeferenceSources__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."georeferenceSources__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of maps, gazetteers, or other resources used to georeference the Location, described specifically enough to allow anyone in the future to use the same resources"';


--
-- Name: COLUMN analytical_specimen."georeferenceProtocol__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."georeferenceProtocol__@DwC__@vegpath.org" IS '"A description or reference to the methods used to determine the spatial footprint, coordinates, and uncertainties"';


--
-- Name: COLUMN analytical_specimen.geovalid_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen.geovalid_bien IS 'whether the coordinates are within the boundary of the asserted named places';


--
-- Name: COLUMN analytical_specimen."isNewWorld_bien"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."isNewWorld_bien" IS 'whether the country is in the Americas';


--
-- Name: COLUMN analytical_specimen.location__cultivated__bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen.location__cultivated__bien IS 'whether the occurrence''s *location* was flagged as cultivated. note that this refers just to the cultivated status of the *location*; the occurrence may be cultivated even if the location isn''t.';


--
-- Name: COLUMN analytical_specimen."eventDate__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."eventDate__@DwC__@vegpath.org" IS '"The date-time or interval during which an Event occurred. For occurrences, this is the date-time when the event was recorded."';


--
-- Name: COLUMN analytical_specimen."(-minimum-)ElevationInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."(-minimum-)ElevationInMeters__@DwC__@vegpath.org" IS 'the "elevation (altitude, usually above sea level), in meters"';


--
-- Name: COLUMN analytical_specimen."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org" IS '"Temperature during observation [...] [in] Celsius"';


--
-- Name: COLUMN analytical_specimen."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org" IS '"Total annual precipitation, in mm"';


--
-- Name: COLUMN analytical_specimen."[custodial_]institutionCode[s]__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."[custodial_]institutionCode[s]__@DwC__@vegpath.org" IS '"The name[s] (or acronym[s]) in use by the institution[s] having custody of the object(s) or information referred to in the record"';


--
-- Name: COLUMN analytical_specimen."collectionCode__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."collectionCode__@DwC__@vegpath.org" IS '"The name, acronym, coden, or initialism identifying the collection or data set from which the record was derived"';


--
-- Name: COLUMN analytical_specimen."catalogNumber__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."catalogNumber__@DwC__@vegpath.org" IS '"An identifier (preferably unique) for the record within the data set or collection"';


--
-- Name: COLUMN analytical_specimen."occurrenceID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."occurrenceID__@DwC__@vegpath.org" IS '"An identifier for the Occurrence (as opposed to a particular digital record of the occurrence). In the absence of a persistent global unique identifier, construct one from a combination of identifiers in the record that will most closely make the occurrenceID globally unique."';


--
-- Name: COLUMN analytical_specimen."recordedBy__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."recordedBy__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of names of people, groups, or organizations responsible for recording the original Occurrence. The primary collector or observer, especially one who applies a personal identifier (recordNumber), should be listed first."';


--
-- Name: COLUMN analytical_specimen."recordNumber__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."recordNumber__@DwC__@vegpath.org" IS '"An identifier given to the Occurrence at the time it was recorded. Often serves as a link between field notes and an Occurrence record, such as a specimen collector''s number."';


--
-- Name: COLUMN analytical_specimen."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org" IS 'the "date-time (Common Era calendar) in a date-time period during which an organism or group of organisms was collected or observed"';


--
-- Name: COLUMN analytical_specimen."[verbatim_]family__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."[verbatim_]family__@DwC__@vegpath.org" IS '"The full scientific name of the family in which the taxon is classified [*before* any TNRS scrubbing]"';


--
-- Name: COLUMN analytical_specimen."[verbatim_]scientificName__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."[verbatim_]scientificName__@DwC__@vegpath.org" IS '"The full scientific name [*before* any TNRS scrubbing], with authorship and date information if known. When forming part of an Identification, this should be the name in lowest level taxonomic rank that can be determined."';


--
-- Name: COLUMN analytical_specimen."identifiedBy__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."identifiedBy__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of names of people, groups, or organizations who assigned the Taxon to the subject"';


--
-- Name: COLUMN analytical_specimen."dateIdentified__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."dateIdentified__@DwC__@vegpath.org" IS '"The date on which the subject was identified as representing the Taxon"';


--
-- Name: COLUMN analytical_specimen."identificationRemarks__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."identificationRemarks__@DwC__@vegpath.org" IS '"Comments or notes about the Identification"';


--
-- Name: COLUMN analytical_specimen."Family_matched__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."Family_matched__@TNRS__@vegpath.org" IS 'http://TNRS.taxon_scrub.matchedFamily__@VegBIEN__.public@vegpath.org;
"The closest matching family in the TNRS database to the family submitted"';


--
-- Name: COLUMN analytical_specimen."Name_matched__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."Name_matched__@TNRS__@vegpath.org" IS '"Scientific name with the highest match score. May be an exact match or a fuzzy match."';


--
-- Name: COLUMN analytical_specimen."Name_matched_author__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."Name_matched_author__@TNRS__@vegpath.org" IS '"Standard authority for the matched name"';


--
-- Name: COLUMN analytical_specimen.scrubbed_family; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen.scrubbed_family IS 'the family of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_specimen.scrubbed_genus; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen.scrubbed_genus IS 'the genus of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_specimen.scrubbed_taxon_name_no_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen.scrubbed_taxon_name_no_author IS 'the taxon name without author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_specimen.scrubbed_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen.scrubbed_author IS 'the author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_specimen."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org" IS '"Growth form"; "Closed pick list"';


--
-- Name: COLUMN analytical_specimen."reproductiveCondition__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."reproductiveCondition__@DwC__@vegpath.org" IS '"The reproductive condition of the biological individual(s) represented in the Occurrence. Recommended best practice is to use a controlled vocabulary."';


--
-- Name: COLUMN analytical_specimen.cultivated_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen.cultivated_bien IS 'whether the occurrence was flagged as cultivated';


--
-- Name: COLUMN analytical_specimen."cultivatedBasis_bien"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."cultivatedBasis_bien" IS 'why the occurrence was flagged as cultivated';


--
-- Name: COLUMN analytical_specimen."occurrenceRemarks__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."occurrenceRemarks__@DwC__@vegpath.org" IS '"Comments or notes about the Occurrence"';


--
-- Name: COLUMN analytical_specimen."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org" IS '"Diameter at breast height of this stem (usually taken at 1.3 meters, but may vary)"';


--
-- Name: COLUMN analytical_specimen."stemHeight[_m]__@VegBank__.stemCount@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."stemHeight[_m]__@VegBank__.stemCount@vegpath.org" IS '"The measured height of the stem in meters"';


--
-- Name: COLUMN analytical_specimen."[tag=]identificationLabel__@VegX__.individual@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_specimen."[tag=]identificationLabel__@VegX__.individual@vegpath.org" IS '"A label that is associated with an individual (e.g. a numerical tree tag)"';


--
-- Name: analytical_stem_TAXONOBSERVATION_ID__@VegBank__.taxonObserv_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE "analytical_stem_TAXONOBSERVATION_ID__@VegBank__.taxonObserv_seq"
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: analytical_stem_TAXONOBSERVATION_ID__@VegBank__.taxonObserv_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE "analytical_stem_TAXONOBSERVATION_ID__@VegBank__.taxonObserv_seq" OWNED BY analytical_stem."TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org";


--
-- Name: coordinates; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE coordinates (
    coordinates_id integer NOT NULL,
    source_id integer NOT NULL,
    latitude_deg double precision NOT NULL,
    longitude_deg double precision NOT NULL,
    verbatimlatitude text,
    verbatimlongitude text,
    verbatimcoordinates text,
    footprintgeometry_dwc text,
    coordsaccuracy_m double precision
);


--
-- Name: COLUMN coordinates.footprintgeometry_dwc; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN coordinates.footprintgeometry_dwc IS '
DwC''s footprintWKT field. "A Well-Known Text (WKT) representation of the shape (footprint, geometry) that defines the Location" (http://rs.tdwg.org/dwc/terms/#footprintWKT).
';


--
-- Name: COLUMN coordinates.coordsaccuracy_m; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN coordinates.coordsaccuracy_m IS '
Accuracy of latitude/longitude or footprint geometry, in meters. This should generally be at least 1 m, which is the accuracy of the best GPSes.
';


--
-- Name: cultivated_family_locations; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE cultivated_family_locations (
    family text NOT NULL,
    country text NOT NULL
);


--
-- Name: TABLE cultivated_family_locations; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE cultivated_family_locations IS '
from sftp://nimoy.nceas.ucsb.edu/home/bien/bien2_scripts/geoscrub/cultivated/cult_by_taxon/flag_by_taxa.inc
';


--
-- Name: family_higher_plant_group; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE family_higher_plant_group (
    family text NOT NULL,
    higher_plant_group higher_plant_group
);


--
-- Name: location; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE location (
    location_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    plot_location_id integer NOT NULL,
    parent_id integer,
    authorlocationcode text,
    place_id integer,
    accesslevel accesslevel,
    accessconditions text,
    sublocationxposition_m double precision,
    sublocationyposition_m double precision,
    iscultivated boolean,
    authorzone text,
    authordatum text,
    authorlocation text,
    locationnarrative text,
    azimuth double precision,
    shape text,
    area_m2 double precision,
    standsize text,
    placementmethod text,
    permanence boolean,
    layoutnarrative text,
    elevation_m double precision,
    elevationaccuracy_m double precision,
    elevationrange_m double precision,
    verbatimelevation text,
    slopeaspect_deg double precision,
    minslopeaspect_deg double precision,
    maxslopeaspect_deg double precision,
    slopegradient_fraction double precision,
    minslopegradient_fraction double precision,
    maxslopegradient_fraction double precision,
    topoposition text,
    landform text,
    surficialdeposits text,
    rocktype text,
    submitter_surname text,
    submitter_givenname text,
    submitter_email text,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    dateentered date DEFAULT now(),
    locationrationalenarrative text,
    CONSTRAINT location_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (authorlocationcode IS NOT NULL)))
);


--
-- Name: TABLE location; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE location IS '
Equivalent to VegBank''s plot table.

`CREATE INDEX plot_source_id` runtime: 5 min ("295235 ms") @vegbiendev
';


--
-- Name: COLUMN location.plot_location_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN location.plot_location_id IS '
autopopulated
';


--
-- Name: locationevent; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE locationevent (
    locationevent_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    accesslevel accesslevel,
    place_visit_id integer NOT NULL,
    parent_id integer,
    plot_id integer,
    location_id integer,
    project_id integer,
    stratum_id integer,
    authoreventcode text,
    previous_id integer,
    obsstartdate date,
    obsenddate date,
    dateaccuracy text,
    method_id integer,
    temperature_c double precision,
    precipitation_m double precision,
    autotaxoncover boolean,
    originaldata text,
    effortlevel text,
    floristicquality text,
    bryophytequality text,
    lichenquality text,
    locationeventnarrative text,
    landscapenarrative text,
    homogeneity text,
    phenologicaspect text,
    representativeness text,
    standmaturity text,
    successionalstatus text,
    basalarea double precision,
    hydrologicregime text,
    soilmoistureregime text,
    soildrainage text,
    watersalinity text,
    waterdepth_m double precision,
    shoredistance double precision,
    soildepth double precision,
    organicdepth double precision,
    soiltaxon_id integer,
    soiltaxonsrc text,
    percentbedrock double precision,
    percentrockgravel double precision,
    percentwood double precision,
    percentlitter double precision,
    percentbaresoil double precision,
    percentwater double precision,
    percentother double precision,
    nameother text,
    treeht double precision,
    shrubht double precision,
    fieldht double precision,
    nonvascularht double precision,
    submergedht double precision,
    treecover double precision,
    shrubcover double precision,
    fieldcover double precision,
    nonvascularcover double precision,
    floatingcover double precision,
    submergedcover double precision,
    dominantstratum text,
    growthform1type text,
    growthform2type text,
    growthform3type text,
    growthform1cover double precision,
    growthform2cover double precision,
    growthform3cover double precision,
    totalcover double precision,
    notespublic boolean,
    notesmgt boolean,
    revisions boolean,
    dateentered date DEFAULT now(),
    toptaxon1name text,
    toptaxon2name text,
    toptaxon3name text,
    toptaxon4name text,
    toptaxon5name text,
    numberoftaxa integer,
    CONSTRAINT locationevent_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (location_id IS NOT NULL)))
);


--
-- Name: TABLE locationevent; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE locationevent IS '
Equivalent to VegBank''s observation table.

`VACUUM ANALYZE VERBOSE locationevent` runtime: 20 min ("1188590 ms") @vegbiendev
`CREATE INDEX locationevent_place_visit_id` runtime: 3 min ("179139 ms") @vegbiendev
`UPDATE locationevent SET place_visit_id = place_visit_id` runtime: >~1 h @vegbiendev
';


--
-- Name: COLUMN locationevent.place_visit_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN locationevent.place_visit_id IS '
autopopulated
';


--
-- Name: COLUMN locationevent.plot_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN locationevent.plot_id IS '
autopopulated
';


--
-- Name: method; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE method (
    method_id integer NOT NULL,
    source_id integer NOT NULL,
    name text,
    description text,
    diameterheight_m double precision,
    mindiameter_m double precision,
    maxdiameter_m double precision,
    minheight_m double precision,
    maxheight_m double precision,
    observationtype text,
    observationmeasure text,
    covermethod_id integer,
    samplingfactor double precision DEFAULT 1 NOT NULL,
    coverbasis text,
    stemsamplemethod text,
    shape text,
    length_m double precision,
    width_m double precision,
    radius_m double precision,
    area_m2 double precision,
    samplearea_m2 double precision,
    subplotspacing_m double precision,
    subplotmethod_id integer,
    pointsperline integer,
    CONSTRAINT method_required_key CHECK ((((name IS NOT NULL) OR (description IS NOT NULL)) OR (observationmeasure IS NOT NULL)))
);


--
-- Name: TABLE method; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE method IS '
A method for sampling and aggregating plants. Replaces VegBank''s stratummethod and stratumtype tables.

Important: *All* length- or area-related measurements throughout VegBIEN must be converted to SI base units, e.g. cm -> m, ha -> m^2.**
';


--
-- Name: COLUMN method.source_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.source_id IS '
Use the source table (e.g. source.url) to store a link to the original plain text description.
';


--
-- Name: COLUMN method.name; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.name IS '
A short name for the set of methods used. Although there is no existing standard, many names are widely used, and could be useful for finding plots with similar methodology.
';


--
-- Name: COLUMN method.description; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.description IS '
Additional metadata helpful for understanding how the data were collected during the observation event.
';


--
-- Name: COLUMN method.diameterheight_m; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.diameterheight_m IS '
The height in m at which the diameter is measured. e.g. 1.37 m for breast height (DBH).
';


--
-- Name: COLUMN method.mindiameter_m; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.mindiameter_m IS '
Lower diameter limit in m for inclusion of a tree.
';


--
-- Name: COLUMN method.maxdiameter_m; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.maxdiameter_m IS '
Upper diameter limit in m for inclusion of a tree.
';


--
-- Name: COLUMN method.minheight_m; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.minheight_m IS '
Lower height limit in m for inclusion of a tree.
';


--
-- Name: COLUMN method.maxheight_m; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.maxheight_m IS '
Upper height limit in m for inclusion of a tree.
';


--
-- Name: COLUMN method.observationtype; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.observationtype IS '
values: aggregate, individual, both
';


--
-- Name: COLUMN method.observationmeasure; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.observationmeasure IS '
e.g. count, cover, presence, points-intercepted, distance-intercepted
';


--
-- Name: COLUMN method.samplingfactor; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.samplingfactor IS '
Here, we could explicitly say that we are sampling a particular area by a different size representative sample area. Simply divide the number of plants connected to this record by this value to get the extrapolated (or interpolated) number of plants in the area in question. This explicitly notes a subsample or supersample.
';


--
-- Name: COLUMN method.coverbasis; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.coverbasis IS '
Were cover values for the total taxon list collected from one contiguous area or dispersed subplots?

entire: Cover based on observation of an entire plot consisting of a single contiguous area of land. subplot-contiguous: Cover based on observation of a single contiguous area of land of less spatial extent than the entire plot.

subplot-regular: Cover based on observation of multiple subplots arranged in a regular pattern within the overall plot.

subplot-random: Cover based on observation of multiple randomly dispersed subplots within the overall plot.

subplot-haphazard: Cover based on observation of multiple subplots haphazardly arranged within the overall plot.

line-intercept: Cover based on length of line touching each species present.

point-intercept: Cover based on number of points for each species present.
';


--
-- Name: COLUMN method.stemsamplemethod; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.stemsamplemethod IS '
The method used to obtain basal area or tree stem data (e.g., full census, point quarter, random pairs, Bitterlich, other).

e.g.:
Full census
Point quarter
Random pairs
Bitterlich
Other
Subsample census
';


--
-- Name: COLUMN method.shape; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.shape IS '
e.g. square, rectangle, circle, line, point, other
';


--
-- Name: COLUMN method.samplearea_m2; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.samplearea_m2 IS '
The total surface area used for cover estimates and for which a complete species list is provided. If subplots were used, this would be the total area of the subplots without interstitial space.
';


--
-- Name: COLUMN method.subplotspacing_m; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.subplotspacing_m IS '
Spacing in m between adjacent subplots, lines (line-intercept data), or points (point-intercept data).
';


--
-- Name: COLUMN method.subplotmethod_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.subplotmethod_id IS '
Method to use for each subplot/line/point, which will specify subplot size, line length, etc.
';


--
-- Name: COLUMN method.pointsperline; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN method.pointsperline IS '
The number of points sampled on each line subplot for point-intercept data.
';


--
-- Name: party; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE party (
    party_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    fullname text,
    salutation text,
    givenname text,
    middlename text,
    surname text,
    suffix text,
    department text,
    organizationname text,
    currentname_id integer,
    contactinstructions text,
    email text,
    partytype text,
    partypublic boolean DEFAULT true,
    CONSTRAINT party_required_key CHECK (((organizationname IS NOT NULL) OR ((source_id <> party_id) AND ((fullname IS NOT NULL) OR (surname IS NOT NULL)))))
);


--
-- Name: plantobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plantobservation (
    plantobservation_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    aggregateoccurrence_id integer,
    overallheight_m double precision,
    overallheightaccuracy_m double precision,
    authorplantcode text,
    stemcount integer,
    reproductivecondition text,
    plant_id integer,
    CONSTRAINT plantobservation_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (aggregateoccurrence_id IS NOT NULL)))
);


--
-- Name: TABLE plantobservation; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE plantobservation IS '
Equivalent to VegBank''s stemcount table.
';


--
-- Name: COLUMN plantobservation.authorplantcode; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN plantobservation.authorplantcode IS '
The number of the organism within the data collection or event.
';


--
-- Name: project; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE project (
    project_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    projectname text,
    projectdescription text,
    startdate date,
    stopdate date,
    CONSTRAINT project_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (projectname IS NOT NULL)))
);


--
-- Name: stratum; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE stratum (
    stratum_id integer NOT NULL,
    source_id integer NOT NULL,
    stratumname text NOT NULL,
    stratumheight double precision,
    stratumbase double precision,
    stratumcover double precision,
    area double precision,
    method_id integer
);


--
-- Name: plot.**; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW "plot.**" AS
 SELECT source.shortname AS "datasource__@Brad__.identifier_examples@vegpath.org",
    COALESCE(geoscrub_output."acceptedCountry", place.country) AS "country__@DwC__@vegpath.org",
    COALESCE(geoscrub_output."acceptedStateProvince", place.stateprovince) AS "stateProvince__@DwC__@vegpath.org",
    COALESCE(geoscrub_output."acceptedCounty", place.county) AS "county__@DwC__@vegpath.org",
    location.locationnarrative AS "locality__@DwC__@vegpath.org",
        CASE
            WHEN (coordinates.latitude_deg IS NOT NULL) THEN coordinates.latitude_deg
            ELSE county_centroids."decimalLatitude"
        END AS "decimalLatitude__@DwC__@vegpath.org",
        CASE
            WHEN (coordinates.latitude_deg IS NOT NULL) THEN coordinates.longitude_deg
            ELSE county_centroids."decimalLongitude"
        END AS "decimalLongitude__@DwC__@vegpath.org",
        CASE
            WHEN (coordinates.latitude_deg IS NOT NULL) THEN coordinates.coordsaccuracy_m
            ELSE _km_to_m(county_centroids."*error_km")
        END AS "coordinateUncertaintyInMeters__@DwC__@vegpath.org",
        CASE
            WHEN (coordinates.latitude_deg IS NOT NULL) THEN 'source data'::coordinatesource
            WHEN (county_centroids."*row_num" IS NOT NULL) THEN 'georeferencing'::coordinatesource
            ELSE NULL::coordinatesource
        END AS "georeferenceSources__@DwC__@vegpath.org",
        CASE
            WHEN (coordinates.latitude_deg IS NOT NULL) THEN NULL::text
            WHEN (county_centroids."*row_num" IS NOT NULL) THEN 'county centroid'::text
            ELSE NULL::text
        END AS "georeferenceProtocol__@DwC__@vegpath.org",
    (geoscrub_output.geovalid)::integer AS geovalid_bien,
    ("newWorldCountries"."isNewWorld")::integer AS "isNewWorld_bien",
    COALESCE(project.sourceaccessioncode, project.projectname) AS "projectID__@VegX__.plotObservation@vegpath.org",
    ARRAY( SELECT project_contributors(project.project_id) AS project_contributors) AS "projectContributor[s]__@VegBank__@vegpath.org",
    COALESCE(location.sourceaccessioncode, NULLIF(concat_ws('; '::text, COALESCE(parent_location.sourceaccessioncode, parent_location.authorlocationcode), location.authorlocationcode), ''::text)) AS "locationID__@DwC__@vegpath.org",
    COALESCE(parent_location.authorlocationcode, location.authorlocationcode) AS "plotName__@VegX__.plot@vegpath.org",
        CASE
            WHEN (parent_location.location_id IS NOT NULL) THEN location.authorlocationcode
            ELSE NULL::text
        END AS "subplot__@SALVIAS__.Plot_data@vegpath.org",
    location.iscultivated AS location__cultivated__bien,
    locationevent.locationevent_id AS "locationevent.locationevent_id__@VegBIEN__.public@vegpath.org",
    COALESCE(locationevent.obsstartdate, parent_event.obsstartdate) AS "eventDate__@DwC__@vegpath.org",
    COALESCE(location.elevation_m, parent_location.elevation_m) AS "(-minimum-)ElevationInMeters__@DwC__@vegpath.org",
    COALESCE(location.slopeaspect_deg, parent_location.slopeaspect_deg) AS "slopeAspect[_deg]__@VegX__.plot@vegpath.org",
    COALESCE(location.slopegradient_fraction, parent_location.slopegradient_fraction) AS "slopeGradient[_deg]__@VegX__.plot@vegpath.org",
    _m2_to_ha(COALESCE(location.area_m2, parent_location.area_m2)) AS "plot.area[_ha]__@VegX__@vegpath.org",
    method.name AS "samplingProtocol__@DwC__@vegpath.org",
    COALESCE(locationevent.temperature_c, parent_event.temperature_c) AS "temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org",
    COALESCE(locationevent.precipitation_m, parent_event.precipitation_m) AS "precip_mm__@SALVIAS__.Plot_metadata@vegpath.org",
    stratum.stratumname AS "stratumName__@VegX__.stratum@vegpath.org",
    COALESCE(locationevent__communities__array(locationevent.locationevent_id), locationevent__communities__array(parent_event.locationevent_id)) AS "communityConcept.name__@VegX__.communityDet@vegpath.org",
    COALESCE(locationevent__contributors__array(locationevent.locationevent_id), locationevent__contributors__array(parent_event.locationevent_id)) AS "observationContributor[s]__@VegBank__@vegpath.org"
   FROM (((((((((((((source
   JOIN location USING (source_id))
   LEFT JOIN locationevent USING (location_id))
   LEFT JOIN place USING (place_id))
   LEFT JOIN location parent_location ON ((parent_location.location_id = location.parent_id)))
   LEFT JOIN coordinates USING (coordinates_id))
   LEFT JOIN geoscrub.geoscrub_output ON ((((((ARRAY[geoscrub_output."decimalLatitude"] = ARRAY[coordinates.latitude_deg]) AND (ARRAY[geoscrub_output."decimalLongitude"] = ARRAY[coordinates.longitude_deg])) AND (ARRAY[geoscrub_output.country] = ARRAY[place.country])) AND (ARRAY[geoscrub_output."stateProvince"] = ARRAY[place.stateprovince])) AND (ARRAY[geoscrub_output.county] = ARRAY[place.county]))))
   LEFT JOIN "newWorld".iso_code_gadm ON ((iso_code_gadm."*GADM country" = COALESCE(geoscrub_output."acceptedCountry", place.country))))
   LEFT JOIN "newWorld"."newWorldCountries" ON (("newWorldCountries"."*isoCode" = iso_code_gadm."*2-digit iso code")))
   LEFT JOIN geoscrub.county_centroids ON ((((place.country = 'United States'::text) AND (county_centroids."stateProvince" = COALESCE(geoscrub_output."acceptedStateProvince", place.stateprovince))) AND (county_centroids.county = COALESCE(geoscrub_output."acceptedCounty", place.county)))))
   LEFT JOIN locationevent parent_event ON ((parent_event.locationevent_id = locationevent.parent_id)))
   LEFT JOIN project ON ((project.project_id = COALESCE(locationevent.project_id, parent_event.project_id))))
   LEFT JOIN stratum ON ((stratum.stratum_id = COALESCE(locationevent.stratum_id, parent_event.stratum_id))))
   LEFT JOIN method ON ((method.method_id = COALESCE(locationevent.method_id, parent_event.method_id))));


--
-- Name: COLUMN "plot.**"."datasource__@Brad__.identifier_examples@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."datasource__@Brad__.identifier_examples@vegpath.org" IS '"the person [or] institution that provided the data [to this database] (the *proximate* data provider)"';


--
-- Name: COLUMN "plot.**"."country__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."country__@DwC__@vegpath.org" IS 'http://geoscrub.geoscrub_output.acceptedCountry__@VegBIEN__@vegpath.org;
"The name of the country or major administrative unit in which the Location occurs"';


--
-- Name: COLUMN "plot.**"."stateProvince__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."stateProvince__@DwC__@vegpath.org" IS '"The name of the next smaller administrative region than country (state, province, canton, department, region, etc.) in which the Location occurs"';


--
-- Name: COLUMN "plot.**"."county__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."county__@DwC__@vegpath.org" IS '"The full, unabbreviated name of the next smaller administrative region than stateProvince (county, shire, department, etc.) in which the Location occurs"';


--
-- Name: COLUMN "plot.**"."locality__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."locality__@DwC__@vegpath.org" IS '"The specific description of the place"';


--
-- Name: COLUMN "plot.**"."decimalLatitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."decimalLatitude__@DwC__@vegpath.org" IS '"The geographic latitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN "plot.**"."decimalLongitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."decimalLongitude__@DwC__@vegpath.org" IS '"The geographic longitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN "plot.**"."coordinateUncertaintyInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."coordinateUncertaintyInMeters__@DwC__@vegpath.org" IS 'for a point observation, this is the fuzziness of the coordinates. for a plot (or other shape), this is the radius of the circle that circumscribes the entire plot, or the fuzziness, whichever is greater. note that the DwC definition is confusingly worded: it uses the ambiguous term Location, which sometimes refers to the asserted named place, but which they intended to refer to the plot or point.';


--
-- Name: COLUMN "plot.**"."georeferenceSources__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."georeferenceSources__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of maps, gazetteers, or other resources used to georeference the Location, described specifically enough to allow anyone in the future to use the same resources"';


--
-- Name: COLUMN "plot.**"."georeferenceProtocol__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."georeferenceProtocol__@DwC__@vegpath.org" IS '"A description or reference to the methods used to determine the spatial footprint, coordinates, and uncertainties"';


--
-- Name: COLUMN "plot.**".geovalid_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**".geovalid_bien IS 'whether the coordinates are within the boundary of the asserted named places';


--
-- Name: COLUMN "plot.**"."isNewWorld_bien"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."isNewWorld_bien" IS 'whether the country is in the Americas';


--
-- Name: COLUMN "plot.**"."projectID__@VegX__.plotObservation@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."projectID__@VegX__.plotObservation@vegpath.org" IS 'http://project.sourceaccessioncode__@VegBIEN__.public@vegpath.org;
"A reference to a specific ''project''"';


--
-- Name: COLUMN "plot.**"."projectContributor[s]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."projectContributor[s]__@VegBank__@vegpath.org" IS '"intersection entit[ies] used to ''link'' a party with a specific project wherein vegetation plots are described"';


--
-- Name: COLUMN "plot.**"."locationID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."locationID__@DwC__@vegpath.org" IS '"An identifier for the set of location information (data associated with dcterms:Location)"';


--
-- Name: COLUMN "plot.**"."plotName__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."plotName__@VegX__.plot@vegpath.org" IS '"Name or label for a plot"';


--
-- Name: COLUMN "plot.**"."subplot__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."subplot__@SALVIAS__.Plot_data@vegpath.org" IS 'http://location.authorlocationcode__@VegBIEN__.public@vegpath.org;
"Code for subplot, line, or any other subsample or subdivision of plot"';


--
-- Name: COLUMN "plot.**".location__cultivated__bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**".location__cultivated__bien IS 'whether the occurrence''s *location* was flagged as cultivated. note that this refers just to the cultivated status of the *location*; the occurrence may be cultivated even if the location isn''t.';


--
-- Name: COLUMN "plot.**"."locationevent.locationevent_id__@VegBIEN__.public@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."locationevent.locationevent_id__@VegBIEN__.public@vegpath.org" IS 'http://locationevent.locationevent_id__@VegBIEN__.public@vegpath.org;
autogenerated ID for locationevent';


--
-- Name: COLUMN "plot.**"."eventDate__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."eventDate__@DwC__@vegpath.org" IS '"The date-time or interval during which an Event occurred. For occurrences, this is the date-time when the event was recorded."';


--
-- Name: COLUMN "plot.**"."(-minimum-)ElevationInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."(-minimum-)ElevationInMeters__@DwC__@vegpath.org" IS 'the "elevation (altitude, usually above sea level), in meters"';


--
-- Name: COLUMN "plot.**"."slopeAspect[_deg]__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."slopeAspect[_deg]__@VegX__.plot@vegpath.org" IS '"Representative azimuth of slope gradient (0-360 degrees) or as a cardinal direction (e.g. N, S, NE)"';


--
-- Name: COLUMN "plot.**"."slopeGradient[_deg]__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."slopeGradient[_deg]__@VegX__.plot@vegpath.org" IS '"Representative inclination of slope in degrees"';


--
-- Name: COLUMN "plot.**"."plot.area[_ha]__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."plot.area[_ha]__@VegX__@vegpath.org" IS '"Total area of the plot"';


--
-- Name: COLUMN "plot.**"."samplingProtocol__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."samplingProtocol__@DwC__@vegpath.org" IS '"The name of, reference to, or description of the method or protocol used during an Event"';


--
-- Name: COLUMN "plot.**"."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org" IS '"Temperature during observation [...] [in] Celsius"';


--
-- Name: COLUMN "plot.**"."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org" IS '"Total annual precipitation, in mm"';


--
-- Name: COLUMN "plot.**"."stratumName__@VegX__.stratum@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."stratumName__@VegX__.stratum@vegpath.org" IS '"Name associated with this stratum"';


--
-- Name: COLUMN "plot.**"."communityConcept.name__@VegX__.communityDet@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."communityConcept.name__@VegX__.communityDet@vegpath.org" IS '"A textual label for a community type. A community type is an abstract grouping of organisms that tend to co-occur on the landscape due to shared ecological requirements or preferences."';


--
-- Name: COLUMN "plot.**"."observationContributor[s]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN "plot.**"."observationContributor[s]__@VegBank__@vegpath.org" IS '"intersection[s] that link[] a party with a specific plot observation event"';


--
-- Name: sourcelist; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE sourcelist (
    sourcelist_id integer NOT NULL,
    source_id integer NOT NULL,
    name text NOT NULL
);


--
-- Name: specimenreplicate; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE specimenreplicate (
    specimenreplicate_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    plantobservation_id integer,
    duplicate_institutions_sourcelist_id integer,
    collectioncode_dwc text,
    catalognumber_dwc text,
    collectionnumber text,
    description text,
    specimen_id integer,
    CONSTRAINT specimenreplicate_required_key CHECK ((((plantobservation_id IS NOT NULL) OR (sourceaccessioncode IS NOT NULL)) OR (catalognumber_dwc IS NOT NULL)))
);


--
-- Name: TABLE specimenreplicate; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE specimenreplicate IS '
A herbarium''s replicate of a specimen. Contains Darwin Core specimen data.
';


--
-- Name: COLUMN specimenreplicate.duplicate_institutions_sourcelist_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN specimenreplicate.duplicate_institutions_sourcelist_id IS '
The institution(s) (such as museums) that the specimenreplicate is from.
';


--
-- Name: COLUMN specimenreplicate.collectioncode_dwc; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN specimenreplicate.collectioncode_dwc IS '
The code for the collection that the specimenreplicate is from.
';


--
-- Name: stemobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE stemobservation (
    stemobservation_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    plantobservation_id integer NOT NULL,
    authorstemcode text,
    tag text,
    tags text,
    xposition_m double precision,
    yposition_m double precision,
    diameterbreastheight_m double precision,
    basaldiameter_m double precision,
    diameteraccuracy_m double precision,
    height_m double precision,
    heightfirstbranch_m double precision,
    heightaccuracy_m double precision,
    health text,
    age double precision,
    CONSTRAINT stemobservation_non_empty CHECK (((((((((sourceaccessioncode IS NOT NULL) OR (authorstemcode IS NOT NULL)) OR (tag IS NOT NULL)) OR (xposition_m IS NOT NULL)) OR (diameterbreastheight_m IS NOT NULL)) OR (basaldiameter_m IS NOT NULL)) OR (height_m IS NOT NULL)) OR (heightfirstbranch_m IS NOT NULL)))
);


--
-- Name: TABLE stemobservation; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE stemobservation IS '
Equivalent to VegBank''s stemlocation table.
';


--
-- Name: COLUMN stemobservation.tags; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN stemobservation.tags IS '
Stores all tags when multiple tags provided. Older tags go first.
';


--
-- Name: taxondetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxondetermination (
    taxondetermination_id integer NOT NULL,
    taxonoccurrence_id integer NOT NULL,
    source_id integer NOT NULL,
    taxonverbatim_id integer NOT NULL,
    party_id integer,
    role role DEFAULT 'unknown'::role NOT NULL,
    determinationtype text,
    reference_id integer,
    isoriginal boolean,
    iscurrent__verbatim boolean,
    iscurrent boolean DEFAULT false NOT NULL,
    taxonfit text,
    taxonconfidence text,
    grouptype text,
    notes text,
    revisions boolean,
    determinationdate date
);


--
-- Name: TABLE taxondetermination; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE taxondetermination IS '
Equivalent to VegBank''s taxoninterpretation table.
';


--
-- Name: taxonoccurrence; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonoccurrence (
    taxonoccurrence_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceaccessioncode text,
    locationevent_id integer,
    authortaxoncode text,
    collector_id integer,
    growthform growthform,
    iscultivated boolean,
    cultivatedbasis text,
    isnative boolean,
    CONSTRAINT taxonoccurrence_required_key CHECK (((sourceaccessioncode IS NOT NULL) OR (locationevent_id IS NOT NULL)))
);


--
-- Name: TABLE taxonoccurrence; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE taxonoccurrence IS '
Equivalent to VegBank''s taxonobservation table.
';


--
-- Name: COLUMN taxonoccurrence.iscultivated; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonoccurrence.iscultivated IS '
cultivated or wild
';


--
-- Name: COLUMN taxonoccurrence.cultivatedbasis; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonoccurrence.cultivatedbasis IS '
The reason why a taxonoccurrence was marked as cultivated (or not).
';


--
-- Name: COLUMN taxonoccurrence.isnative; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonoccurrence.isnative IS '
native or exotic
';


--
-- Name: taxonverbatim; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonverbatim (
    taxonverbatim_id integer NOT NULL,
    source_id integer NOT NULL,
    taxonlabel_id integer,
    verbatimrank text,
    taxonomicname text,
    taxonname text,
    author text,
    family text,
    genus text,
    specific_epithet text,
    subspecies text,
    morphospecies text,
    morphoname text,
    growthform growthform,
    description text,
    CONSTRAINT taxonverbatim_required_key CHECK (((taxonlabel_id IS NOT NULL) OR (morphoname IS NOT NULL)))
);


--
-- Name: TABLE taxonverbatim; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE taxonverbatim IS '
Component parts of the taxonlabel. Contains the datasource''s original taxonomic name components, as well as any parsed components produced by name resolution.
';


--
-- Name: COLUMN taxonverbatim.verbatimrank; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonverbatim.verbatimrank IS '
The taxon''s verbatim level in the taxonomic hierarchy. Does not need to be in the taxonrank closed list.
';


--
-- Name: COLUMN taxonverbatim.taxonomicname; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonverbatim.taxonomicname IS '
The full taxonomic name which uniquely identifies this taxon, including the author of that name. The family should be omitted if possible.

Equivalent to Darwin Core''s scientificName.
';


--
-- Name: COLUMN taxonverbatim.taxonname; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonverbatim.taxonname IS '
The taxonomic name without the author. The family should be omitted if possible.
';


--
-- Name: COLUMN taxonverbatim.author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonverbatim.author IS '
The author of the taxonomic name.

Equivalent to Darwin Core''s scientificNameAuthorship.
';


--
-- Name: COLUMN taxonverbatim.family; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonverbatim.family IS '
The family of the taxonomic name. This is a cached field for easy querying; this should also be stored in taxonlabel at the appropriate rank.
';


--
-- Name: COLUMN taxonverbatim.genus; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonverbatim.genus IS '
The genus portion of the taxonomic name. This is a cached field for easy querying; this should also be stored in taxonlabel at the appropriate rank.
';


--
-- Name: COLUMN taxonverbatim.specific_epithet; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonverbatim.specific_epithet IS '
The specific epithet portion of the taxonomic name. This is a cached field for easy querying; this should also be stored in taxonlabel at the appropriate rank.
';


--
-- Name: COLUMN taxonverbatim.morphospecies; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonverbatim.morphospecies IS '
The morphospecies suffix.
';


--
-- Name: analytical_stem_view; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW analytical_stem_view AS
 SELECT "plot.**"."datasource__@Brad__.identifier_examples@vegpath.org",
    "plot.**"."country__@DwC__@vegpath.org",
    "plot.**"."stateProvince__@DwC__@vegpath.org",
    "plot.**"."county__@DwC__@vegpath.org",
    "plot.**"."locality__@DwC__@vegpath.org",
    "plot.**"."decimalLatitude__@DwC__@vegpath.org",
    "plot.**"."decimalLongitude__@DwC__@vegpath.org",
    "plot.**"."coordinateUncertaintyInMeters__@DwC__@vegpath.org",
    "plot.**"."georeferenceSources__@DwC__@vegpath.org",
    "plot.**"."georeferenceProtocol__@DwC__@vegpath.org",
    "plot.**".geovalid_bien,
    "plot.**"."isNewWorld_bien",
    "plot.**"."projectID__@VegX__.plotObservation@vegpath.org",
    "plot.**"."projectContributor[s]__@VegBank__@vegpath.org",
    "plot.**"."locationID__@DwC__@vegpath.org",
    "plot.**"."plotName__@VegX__.plot@vegpath.org",
    "plot.**"."subplot__@SALVIAS__.Plot_data@vegpath.org",
    "plot.**".location__cultivated__bien,
    "plot.**"."locationevent.locationevent_id__@VegBIEN__.public@vegpath.org",
    "plot.**"."eventDate__@DwC__@vegpath.org",
    "plot.**"."(-minimum-)ElevationInMeters__@DwC__@vegpath.org",
    "plot.**"."slopeAspect[_deg]__@VegX__.plot@vegpath.org",
    "plot.**"."slopeGradient[_deg]__@VegX__.plot@vegpath.org",
    "plot.**"."plot.area[_ha]__@VegX__@vegpath.org",
    "plot.**"."samplingProtocol__@DwC__@vegpath.org",
    "plot.**"."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org",
    "plot.**"."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org",
    "plot.**"."stratumName__@VegX__.stratum@vegpath.org",
    "plot.**"."communityConcept.name__@VegX__.communityDet@vegpath.org",
    "plot.**"."observationContributor[s]__@VegBank__@vegpath.org",
    sourcelist.name AS "[custodial_]institutionCode[s]__@DwC__@vegpath.org",
    specimenreplicate.collectioncode_dwc AS "collectionCode__@DwC__@vegpath.org",
    specimenreplicate.catalognumber_dwc AS "catalogNumber__@DwC__@vegpath.org",
    specimenreplicate.sourceaccessioncode AS "occurrenceID__@DwC__@vegpath.org",
    collector.fullname AS "recordedBy__@DwC__@vegpath.org",
    plantobservation.authorplantcode AS "recordNumber__@DwC__@vegpath.org",
    COALESCE(aggregateoccurrence.collectiondate, "plot.**"."eventDate__@DwC__@vegpath.org") AS "(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org",
    taxonverbatim.family AS "[verbatim_]family__@DwC__@vegpath.org",
    COALESCE(taxonverbatim.taxonomicname, (taxonverbatim.taxonname || COALESCE((' '::text || taxonverbatim.author), ''::text)), taxonlabel.taxonomicname) AS "[verbatim_]scientificName__@DwC__@vegpath.org",
    identifiedby.fullname AS "identifiedBy__@DwC__@vegpath.org",
    taxondetermination.determinationdate AS "dateIdentified__@DwC__@vegpath.org",
    taxondetermination.notes AS "identificationRemarks__@DwC__@vegpath.org",
    taxon_scrub."*Name_matched_accepted_family" AS "Family_matched__@TNRS__@vegpath.org",
    taxon_scrub."*Name_matched" AS "Name_matched__@TNRS__@vegpath.org",
    taxon_scrub."*Name_matched_author" AS "Name_matched_author__@TNRS__@vegpath.org",
    family_higher_plant_group.higher_plant_group AS "[higher_plant_group~]higherClassification__@DwC__@vegpath.org",
    taxon_scrub."taxonomicStatus" AS "taxonomicStatus__@DwC__@vegpath.org",
    taxon_scrub.scrubbed_family,
    taxon_scrub.scrubbed_genus,
    taxon_scrub.scrubbed_specific_epithet,
    ((taxon_scrub.scrubbed_genus || ' '::text) || taxon_scrub.scrubbed_specific_epithet) AS scrubbed_species_binomial,
    taxon_scrub.scrubbed_taxon_name_no_author,
    taxon_scrub.scrubbed_author,
    taxon_scrub.scrubbed_taxon_name_with_author,
    taxon_scrub.scrubbed_morphospecies_binomial AS "speciesBinomialWithMorphospecies__@VegCore__@vegpath.org",
    taxonoccurrence.growthform AS "[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org",
    plantobservation.reproductivecondition AS "reproductiveCondition__@DwC__@vegpath.org",
    (((cultivated_family_locations.country IS NOT NULL) OR _or(taxonoccurrence.iscultivated, "plot.**".location__cultivated__bien)))::integer AS cultivated_bien,
        CASE
            WHEN (taxonoccurrence.iscultivated IS NOT NULL) THEN taxonoccurrence.cultivatedbasis
            WHEN ("plot.**".location__cultivated__bien IS NOT NULL) THEN NULL::text
            ELSE NULL::text
        END AS "cultivatedBasis_bien",
    aggregateoccurrence.notes AS "occurrenceRemarks__@DwC__@vegpath.org",
    _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "coverPercent__@VegX__.attribute.ordinal@vegpath.org",
    _m_to_cm(stemobservation.diameterbreastheight_m) AS "stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org",
    stemobservation.height_m AS "stemHeight[_m]__@VegBank__.stemCount@vegpath.org",
    stemobservation.tag AS "[tag=]identificationLabel__@VegX__.individual@vegpath.org",
    stemobservation.xposition_m AS "relativeX[_m]__@VegX__.individualOrganismObs@vegpath.org",
    stemobservation.yposition_m AS "relativeY[_m]__@VegX__.individualOrganismObs@vegpath.org",
    taxonoccurrence.sourceaccessioncode AS "taxonObservation[.id]__@VegBank__@vegpath.org",
    taxonoccurrence.authortaxoncode AS "taxonNameUsageConcept.authorCode__@VegX__@vegpath.org",
    aggregateoccurrence.sourceaccessioncode AS "aggregateOrganismObservation.id__@VegX__@vegpath.org",
    plantobservation.sourceaccessioncode AS "individualOrganismObservation.id__@VegX__@vegpath.org",
    plantobservation.authorplantcode AS "individualID__@DwC__@vegpath.org",
    aggregateoccurrence.count AS "individualCount__@DwC__@vegpath.org",
    stemobservation.authorstemcode AS "stemCode__@VegBank__.stemLocation@vegpath.org"
   FROM (((((((((((((("plot.**"
   LEFT JOIN taxonoccurrence ON ((taxonoccurrence.locationevent_id = "plot.**"."locationevent.locationevent_id__@VegBIEN__.public@vegpath.org")))
   LEFT JOIN party collector ON ((collector.party_id = taxonoccurrence.collector_id)))
   LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id))
   LEFT JOIN plantobservation USING (aggregateoccurrence_id))
   LEFT JOIN stemobservation USING (plantobservation_id))
   LEFT JOIN specimenreplicate USING (plantobservation_id))
   LEFT JOIN sourcelist ON ((sourcelist.sourcelist_id = specimenreplicate.duplicate_institutions_sourcelist_id)))
   LEFT JOIN taxondetermination ON (((taxondetermination.taxonoccurrence_id = taxonoccurrence.taxonoccurrence_id) AND taxondetermination.iscurrent)))
   LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id)))
   LEFT JOIN taxonverbatim USING (taxonverbatim_id))
   LEFT JOIN taxonlabel USING (taxonlabel_id))
   LEFT JOIN "TNRS".taxon_scrub ON ((taxon_scrub."*Name_submitted" = taxonlabel.taxonomicname)))
   LEFT JOIN family_higher_plant_group ON ((family_higher_plant_group.family = taxon_scrub.scrubbed_family)))
   LEFT JOIN cultivated_family_locations ON (((cultivated_family_locations.family = taxon_scrub.scrubbed_family) AND (cultivated_family_locations.country = "plot.**"."country__@DwC__@vegpath.org"))));


--
-- Name: VIEW analytical_stem_view; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON VIEW analytical_stem_view IS '
after updating this:
SELECT analytical_stem_view_modify()
add applicable columns to analytical_specimen, analytical_plot
';


--
-- Name: COLUMN analytical_stem_view."datasource__@Brad__.identifier_examples@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."datasource__@Brad__.identifier_examples@vegpath.org" IS '"the person [or] institution that provided the data [to this database] (the *proximate* data provider)"';


--
-- Name: COLUMN analytical_stem_view."country__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."country__@DwC__@vegpath.org" IS 'http://geoscrub.geoscrub_output.acceptedCountry__@VegBIEN__@vegpath.org;
"The name of the country or major administrative unit in which the Location occurs"';


--
-- Name: COLUMN analytical_stem_view."stateProvince__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."stateProvince__@DwC__@vegpath.org" IS '"The name of the next smaller administrative region than country (state, province, canton, department, region, etc.) in which the Location occurs"';


--
-- Name: COLUMN analytical_stem_view."county__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."county__@DwC__@vegpath.org" IS '"The full, unabbreviated name of the next smaller administrative region than stateProvince (county, shire, department, etc.) in which the Location occurs"';


--
-- Name: COLUMN analytical_stem_view."locality__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."locality__@DwC__@vegpath.org" IS '"The specific description of the place"';


--
-- Name: COLUMN analytical_stem_view."decimalLatitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."decimalLatitude__@DwC__@vegpath.org" IS '"The geographic latitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN analytical_stem_view."decimalLongitude__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."decimalLongitude__@DwC__@vegpath.org" IS '"The geographic longitude (in decimal degrees, using the spatial reference system given in geodeticDatum) of the geographic center of a Location"';


--
-- Name: COLUMN analytical_stem_view."coordinateUncertaintyInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."coordinateUncertaintyInMeters__@DwC__@vegpath.org" IS 'for a point observation, this is the fuzziness of the coordinates. for a plot (or other shape), this is the radius of the circle that circumscribes the entire plot, or the fuzziness, whichever is greater. note that the DwC definition is confusingly worded: it uses the ambiguous term Location, which sometimes refers to the asserted named place, but which they intended to refer to the plot or point.';


--
-- Name: COLUMN analytical_stem_view."georeferenceSources__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."georeferenceSources__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of maps, gazetteers, or other resources used to georeference the Location, described specifically enough to allow anyone in the future to use the same resources"';


--
-- Name: COLUMN analytical_stem_view."georeferenceProtocol__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."georeferenceProtocol__@DwC__@vegpath.org" IS '"A description or reference to the methods used to determine the spatial footprint, coordinates, and uncertainties"';


--
-- Name: COLUMN analytical_stem_view.geovalid_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.geovalid_bien IS 'whether the coordinates are within the boundary of the asserted named places';


--
-- Name: COLUMN analytical_stem_view."isNewWorld_bien"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."isNewWorld_bien" IS 'whether the country is in the Americas';


--
-- Name: COLUMN analytical_stem_view."projectID__@VegX__.plotObservation@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."projectID__@VegX__.plotObservation@vegpath.org" IS 'http://project.sourceaccessioncode__@VegBIEN__.public@vegpath.org;
"A reference to a specific ''project''"';


--
-- Name: COLUMN analytical_stem_view."projectContributor[s]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."projectContributor[s]__@VegBank__@vegpath.org" IS '"intersection entit[ies] used to ''link'' a party with a specific project wherein vegetation plots are described"';


--
-- Name: COLUMN analytical_stem_view."locationID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."locationID__@DwC__@vegpath.org" IS '"An identifier for the set of location information (data associated with dcterms:Location)"';


--
-- Name: COLUMN analytical_stem_view."plotName__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."plotName__@VegX__.plot@vegpath.org" IS '"Name or label for a plot"';


--
-- Name: COLUMN analytical_stem_view."subplot__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."subplot__@SALVIAS__.Plot_data@vegpath.org" IS 'http://location.authorlocationcode__@VegBIEN__.public@vegpath.org;
"Code for subplot, line, or any other subsample or subdivision of plot"';


--
-- Name: COLUMN analytical_stem_view.location__cultivated__bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.location__cultivated__bien IS 'whether the occurrence''s *location* was flagged as cultivated. note that this refers just to the cultivated status of the *location*; the occurrence may be cultivated even if the location isn''t.';


--
-- Name: COLUMN analytical_stem_view."locationevent.locationevent_id__@VegBIEN__.public@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."locationevent.locationevent_id__@VegBIEN__.public@vegpath.org" IS 'http://locationevent.locationevent_id__@VegBIEN__.public@vegpath.org;
autogenerated ID for locationevent';


--
-- Name: COLUMN analytical_stem_view."eventDate__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."eventDate__@DwC__@vegpath.org" IS '"The date-time or interval during which an Event occurred. For occurrences, this is the date-time when the event was recorded."';


--
-- Name: COLUMN analytical_stem_view."(-minimum-)ElevationInMeters__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."(-minimum-)ElevationInMeters__@DwC__@vegpath.org" IS 'the "elevation (altitude, usually above sea level), in meters"';


--
-- Name: COLUMN analytical_stem_view."slopeAspect[_deg]__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."slopeAspect[_deg]__@VegX__.plot@vegpath.org" IS '"Representative azimuth of slope gradient (0-360 degrees) or as a cardinal direction (e.g. N, S, NE)"';


--
-- Name: COLUMN analytical_stem_view."slopeGradient[_deg]__@VegX__.plot@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."slopeGradient[_deg]__@VegX__.plot@vegpath.org" IS '"Representative inclination of slope in degrees"';


--
-- Name: COLUMN analytical_stem_view."plot.area[_ha]__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."plot.area[_ha]__@VegX__@vegpath.org" IS '"Total area of the plot"';


--
-- Name: COLUMN analytical_stem_view."samplingProtocol__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."samplingProtocol__@DwC__@vegpath.org" IS '"The name of, reference to, or description of the method or protocol used during an Event"';


--
-- Name: COLUMN analytical_stem_view."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."temperature[_C]__@VegX__.plotObs.obsCond@vegpath.org" IS '"Temperature during observation [...] [in] Celsius"';


--
-- Name: COLUMN analytical_stem_view."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."precip_mm__@SALVIAS__.Plot_metadata@vegpath.org" IS '"Total annual precipitation, in mm"';


--
-- Name: COLUMN analytical_stem_view."stratumName__@VegX__.stratum@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."stratumName__@VegX__.stratum@vegpath.org" IS '"Name associated with this stratum"';


--
-- Name: COLUMN analytical_stem_view."communityConcept.name__@VegX__.communityDet@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."communityConcept.name__@VegX__.communityDet@vegpath.org" IS '"A textual label for a community type. A community type is an abstract grouping of organisms that tend to co-occur on the landscape due to shared ecological requirements or preferences."';


--
-- Name: COLUMN analytical_stem_view."observationContributor[s]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."observationContributor[s]__@VegBank__@vegpath.org" IS '"intersection[s] that link[] a party with a specific plot observation event"';


--
-- Name: COLUMN analytical_stem_view."[custodial_]institutionCode[s]__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."[custodial_]institutionCode[s]__@DwC__@vegpath.org" IS '"The name[s] (or acronym[s]) in use by the institution[s] having custody of the object(s) or information referred to in the record"';


--
-- Name: COLUMN analytical_stem_view."collectionCode__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."collectionCode__@DwC__@vegpath.org" IS '"The name, acronym, coden, or initialism identifying the collection or data set from which the record was derived"';


--
-- Name: COLUMN analytical_stem_view."catalogNumber__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."catalogNumber__@DwC__@vegpath.org" IS '"An identifier (preferably unique) for the record within the data set or collection"';


--
-- Name: COLUMN analytical_stem_view."occurrenceID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."occurrenceID__@DwC__@vegpath.org" IS '"An identifier for the Occurrence (as opposed to a particular digital record of the occurrence). In the absence of a persistent global unique identifier, construct one from a combination of identifiers in the record that will most closely make the occurrenceID globally unique."';


--
-- Name: COLUMN analytical_stem_view."recordedBy__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."recordedBy__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of names of people, groups, or organizations responsible for recording the original Occurrence. The primary collector or observer, especially one who applies a personal identifier (recordNumber), should be listed first."';


--
-- Name: COLUMN analytical_stem_view."recordNumber__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."recordNumber__@DwC__@vegpath.org" IS '"An identifier given to the Occurrence at the time it was recorded. Often serves as a link between field notes and an Occurrence record, such as a specimen collector''s number."';


--
-- Name: COLUMN analytical_stem_view."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org" IS 'the "date-time (Common Era calendar) in a date-time period during which an organism or group of organisms was collected or observed"';


--
-- Name: COLUMN analytical_stem_view."[verbatim_]family__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."[verbatim_]family__@DwC__@vegpath.org" IS '"The full scientific name of the family in which the taxon is classified [*before* any TNRS scrubbing]"';


--
-- Name: COLUMN analytical_stem_view."[verbatim_]scientificName__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."[verbatim_]scientificName__@DwC__@vegpath.org" IS '"The full scientific name [*before* any TNRS scrubbing], with authorship and date information if known. When forming part of an Identification, this should be the name in lowest level taxonomic rank that can be determined."';


--
-- Name: COLUMN analytical_stem_view."identifiedBy__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."identifiedBy__@DwC__@vegpath.org" IS '"A list (concatenated and separated) of names of people, groups, or organizations who assigned the Taxon to the subject"';


--
-- Name: COLUMN analytical_stem_view."dateIdentified__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."dateIdentified__@DwC__@vegpath.org" IS '"The date on which the subject was identified as representing the Taxon"';


--
-- Name: COLUMN analytical_stem_view."identificationRemarks__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."identificationRemarks__@DwC__@vegpath.org" IS '"Comments or notes about the Identification"';


--
-- Name: COLUMN analytical_stem_view."Family_matched__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."Family_matched__@TNRS__@vegpath.org" IS 'http://TNRS.taxon_scrub.matchedFamily__@VegBIEN__.public@vegpath.org;
"The closest matching family in the TNRS database to the family submitted"';


--
-- Name: COLUMN analytical_stem_view."Name_matched__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."Name_matched__@TNRS__@vegpath.org" IS '"Scientific name with the highest match score. May be an exact match or a fuzzy match."';


--
-- Name: COLUMN analytical_stem_view."Name_matched_author__@TNRS__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."Name_matched_author__@TNRS__@vegpath.org" IS '"Standard authority for the matched name"';


--
-- Name: COLUMN analytical_stem_view."[higher_plant_group~]higherClassification__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."[higher_plant_group~]higherClassification__@DwC__@vegpath.org" IS 'closed list derived from higher taxa';


--
-- Name: COLUMN analytical_stem_view."taxonomicStatus__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."taxonomicStatus__@DwC__@vegpath.org" IS '"The status of the use of the scientificName as a label for a taxon. Requires taxonomic opinion to define the scope of a taxon. [...] Examples: "invalid", "misapplied", "homotypic synonym", "accepted"."';


--
-- Name: COLUMN analytical_stem_view.scrubbed_family; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.scrubbed_family IS 'the family of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem_view.scrubbed_genus; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.scrubbed_genus IS 'the genus of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem_view.scrubbed_specific_epithet; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.scrubbed_specific_epithet IS 'the specific epithet of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem_view.scrubbed_species_binomial; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.scrubbed_species_binomial IS 'the species binomial of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem_view.scrubbed_taxon_name_no_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.scrubbed_taxon_name_no_author IS 'the taxon name without author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem_view.scrubbed_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.scrubbed_author IS 'the author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem_view.scrubbed_taxon_name_with_author; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.scrubbed_taxon_name_with_author IS 'the taxon name with author of the TNRS accepted or matched name';


--
-- Name: COLUMN analytical_stem_view."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org" IS 'http://TNRS.taxon_scrub.scrubbed_morphospecies_binomial__@VegBIEN__.public@vegpath.org;
"combine the `taxon` plus `morphospecies` to produce a unique string, `taxonMorphospecies`";
a morphospecies is a custom species name assigned in the field by the collector (which does not validate to anything in TNRS)';


--
-- Name: COLUMN analytical_stem_view."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."[growth_form=]habit__@SALVIAS__.Plot_data@vegpath.org" IS '"Growth form"; "Closed pick list"';


--
-- Name: COLUMN analytical_stem_view."reproductiveCondition__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."reproductiveCondition__@DwC__@vegpath.org" IS '"The reproductive condition of the biological individual(s) represented in the Occurrence. Recommended best practice is to use a controlled vocabulary."';


--
-- Name: COLUMN analytical_stem_view.cultivated_bien; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view.cultivated_bien IS 'whether the occurrence was flagged as cultivated';


--
-- Name: COLUMN analytical_stem_view."cultivatedBasis_bien"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."cultivatedBasis_bien" IS 'why the occurrence was flagged as cultivated';


--
-- Name: COLUMN analytical_stem_view."occurrenceRemarks__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."occurrenceRemarks__@DwC__@vegpath.org" IS '"Comments or notes about the Occurrence"';


--
-- Name: COLUMN analytical_stem_view."coverPercent__@VegX__.attribute.ordinal@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."coverPercent__@VegX__.attribute.ordinal@vegpath.org" IS '"Average cover of the index in percent"';


--
-- Name: COLUMN analytical_stem_view."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."stem_dbh[_cm]__@SALVIAS__.Plot_data@vegpath.org" IS '"Diameter at breast height of this stem (usually taken at 1.3 meters, but may vary)"';


--
-- Name: COLUMN analytical_stem_view."stemHeight[_m]__@VegBank__.stemCount@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."stemHeight[_m]__@VegBank__.stemCount@vegpath.org" IS '"The measured height of the stem in meters"';


--
-- Name: COLUMN analytical_stem_view."[tag=]identificationLabel__@VegX__.individual@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."[tag=]identificationLabel__@VegX__.individual@vegpath.org" IS '"A label that is associated with an individual (e.g. a numerical tree tag)"';


--
-- Name: COLUMN analytical_stem_view."relativeX[_m]__@VegX__.individualOrganismObs@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."relativeX[_m]__@VegX__.individualOrganismObs@vegpath.org" IS '"The X-coordinate of the related item position in m. The user will enter the relative position of related item with respect to the plot origin (in meters) with the x-axis defined by the plot azimuth."';


--
-- Name: COLUMN analytical_stem_view."relativeY[_m]__@VegX__.individualOrganismObs@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."relativeY[_m]__@VegX__.individualOrganismObs@vegpath.org" IS '"The Y-coordinate of the relatedSpatialItem position in m. The user will enter the relative position of relatedSpatialItems with respect to the plot origin (in meters) with the y-axis defined by the plot azimuth."';


--
-- Name: COLUMN analytical_stem_view."taxonObservation[.id]__@VegBank__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."taxonObservation[.id]__@VegBank__@vegpath.org" IS '"identifier assigned [by the datasource] to each unique observation of a taxon in a plot"';


--
-- Name: COLUMN analytical_stem_view."taxonNameUsageConcept.authorCode__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."taxonNameUsageConcept.authorCode__@VegX__@vegpath.org" IS '"Verbatum short code used by the author to signify the species at time of observation"';


--
-- Name: COLUMN analytical_stem_view."aggregateOrganismObservation.id__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."aggregateOrganismObservation.id__@VegX__@vegpath.org" IS 'the ID for "An observation applying to all occurrences of an organism based on an aggregation factor. It contains an AggregateValue, which is an assessment of the overall occurrence of an organism in a Plot (e.g. number of stems, percentage cover, total biomass, basal area)."';


--
-- Name: COLUMN analytical_stem_view."individualOrganismObservation.id__@VegX__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."individualOrganismObservation.id__@VegX__@vegpath.org" IS 'the ID for "An observation applying to one occurrence of an organism (or part of an organism). It is a container for measurements made on the organism (e.g. diameter, height, crown dimensions, biomass, growth form, number of stems)."';


--
-- Name: COLUMN analytical_stem_view."individualID__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."individualID__@DwC__@vegpath.org" IS '"An identifier for an individual or named group of individual organisms represented in the Occurrence"';


--
-- Name: COLUMN analytical_stem_view."individualCount__@DwC__@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."individualCount__@DwC__@vegpath.org" IS '"The number of individuals represented present at the time of the Occurrence"';


--
-- Name: COLUMN analytical_stem_view."stemCode__@VegBank__.stemLocation@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN analytical_stem_view."stemCode__@VegBank__.stemLocation@vegpath.org" IS 'http://stemobservation.authorstemcode__@VegBIEN__.public@vegpath.org;
"Name or code applied to a specific stem in the plot. This is generally a numeric label to associate a field data entry with a stem in the database."';


--
-- Name: classcontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE classcontributor (
    classcontributor_id integer NOT NULL,
    commclass_id integer NOT NULL,
    party_id integer NOT NULL,
    role role
);


--
-- Name: classcontributor_classcontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE classcontributor_classcontributor_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: classcontributor_classcontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE classcontributor_classcontributor_id_seq OWNED BY classcontributor.classcontributor_id;


--
-- Name: collected_dates; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW collected_dates AS
 SELECT DISTINCT analytical_stem."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org"
   FROM analytical_stem
  ORDER BY analytical_stem."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org";


--
-- Name: COLUMN collected_dates."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org"; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN collected_dates."(-Earliest-)DateCollected__-2007-04-17__@DwC__.hist@vegpath.org" IS 'the "date-time (Common Era calendar) in a date-time period during which an organism or group of organisms was collected or observed"';


--
-- Name: commclass; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commclass (
    commclass_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    inspection boolean,
    tableanalysis boolean,
    multivariateanalysis boolean,
    classpublication_id integer,
    classnotes text,
    commname text,
    commcode text,
    commframework text,
    commlevel text,
    classstartdate date,
    classstopdate date,
    expertsystem text
);


--
-- Name: commclass_commclass_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE commclass_commclass_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: commclass_commclass_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE commclass_commclass_id_seq OWNED BY commclass.commclass_id;


--
-- Name: commconcept; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commconcept (
    commconcept_id integer NOT NULL,
    commname_id integer NOT NULL,
    reference_id integer,
    commdescription text,
    commname text
);


--
-- Name: commconcept_commconcept_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE commconcept_commconcept_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: commconcept_commconcept_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE commconcept_commconcept_id_seq OWNED BY commconcept.commconcept_id;


--
-- Name: commcorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commcorrelation (
    commcorrelation_id integer NOT NULL,
    commstatus_id integer NOT NULL,
    commconcept_id integer NOT NULL,
    commconvergence text NOT NULL,
    correlationstart date NOT NULL,
    correlationstop date
);


--
-- Name: commcorrelation_commcorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE commcorrelation_commcorrelation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: commcorrelation_commcorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE commcorrelation_commcorrelation_id_seq OWNED BY commcorrelation.commcorrelation_id;


--
-- Name: commdetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commdetermination (
    commdetermination_id integer NOT NULL,
    commclass_id integer NOT NULL,
    commconcept_id integer NOT NULL,
    commcode text,
    commname text,
    classfit text,
    classconfidence text,
    commauthority_id integer,
    notes text,
    type boolean,
    nomenclaturaltype boolean
);


--
-- Name: commdetermination_commdetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE commdetermination_commdetermination_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: commdetermination_commdetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE commdetermination_commdetermination_id_seq OWNED BY commdetermination.commdetermination_id;


--
-- Name: commlineage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commlineage (
    commlineage_id integer NOT NULL,
    parentcommstatus_id integer NOT NULL,
    childcommstatus_id integer NOT NULL
);


--
-- Name: commlineage_commlineage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE commlineage_commlineage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: commlineage_commlineage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE commlineage_commlineage_id_seq OWNED BY commlineage.commlineage_id;


--
-- Name: commname; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commname (
    commname_id integer NOT NULL,
    commname text NOT NULL,
    source_id integer,
    dateentered date DEFAULT now()
);


--
-- Name: commname_commname_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE commname_commname_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: commname_commname_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE commname_commname_id_seq OWNED BY commname.commname_id;


--
-- Name: commstatus; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commstatus (
    commstatus_id integer NOT NULL,
    commconcept_id integer NOT NULL,
    source_id integer,
    commconceptstatus text NOT NULL,
    commparent_id integer,
    commlevel text,
    commpartycomments text,
    party_id integer NOT NULL,
    startdate date NOT NULL,
    stopdate date
);


--
-- Name: commstatus_commstatus_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE commstatus_commstatus_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: commstatus_commstatus_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE commstatus_commstatus_id_seq OWNED BY commstatus.commstatus_id;


--
-- Name: commusage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE commusage (
    commusage_id integer NOT NULL,
    commname_id integer NOT NULL,
    commname text,
    commconcept_id integer,
    commnamestatus text,
    classsystem text,
    party_id integer,
    commstatus_id integer,
    usagestart date,
    usagestop date
);


--
-- Name: commusage_commusage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE commusage_commusage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: commusage_commusage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE commusage_commusage_id_seq OWNED BY commusage.commusage_id;


--
-- Name: coordinates_coordinates_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE coordinates_coordinates_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: coordinates_coordinates_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE coordinates_coordinates_id_seq OWNED BY coordinates.coordinates_id;


--
-- Name: coverindex; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE coverindex (
    coverindex_id integer NOT NULL,
    covermethod_id integer NOT NULL,
    covercode text NOT NULL,
    upperlimit double precision,
    lowerlimit double precision,
    coverpercent double precision NOT NULL,
    indexdescription text
);


--
-- Name: coverindex_coverindex_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE coverindex_coverindex_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: coverindex_coverindex_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE coverindex_coverindex_id_seq OWNED BY coverindex.coverindex_id;


--
-- Name: covermethod; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE covermethod (
    covermethod_id integer NOT NULL,
    source_id integer,
    covertype text NOT NULL,
    coverestimationmethod text
);


--
-- Name: covermethod_covermethod_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE covermethod_covermethod_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: covermethod_covermethod_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE covermethod_covermethod_id_seq OWNED BY covermethod.covermethod_id;


--
-- Name: dba_preassignacccode_dba_requestnumber_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE dba_preassignacccode_dba_requestnumber_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: definedvalue; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE definedvalue (
    definedvalue_id integer NOT NULL,
    userdefined_id integer NOT NULL,
    tablerecord_id integer NOT NULL,
    definedvalue text
);


--
-- Name: definedvalue_definedvalue_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE definedvalue_definedvalue_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: definedvalue_definedvalue_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE definedvalue_definedvalue_id_seq OWNED BY definedvalue.definedvalue_id;


--
-- Name: disturbanceobs; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE disturbanceobs (
    disturbanceobs_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    disturbancetype text NOT NULL,
    disturbanceintensity text,
    disturbanceage double precision,
    disturbanceextent double precision,
    disturbancecomment text
);


--
-- Name: disturbanceobs_disturbanceobs_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE disturbanceobs_disturbanceobs_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: disturbanceobs_disturbanceobs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE disturbanceobs_disturbanceobs_id_seq OWNED BY disturbanceobs.disturbanceobs_id;


--
-- Name: geoscrub_input; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE geoscrub_input (
    country text,
    "stateProvince" text,
    county text,
    "decimalLatitude" double precision,
    "decimalLongitude" double precision
);


--
-- Name: geoscrub_input_new; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW geoscrub_input_new AS
 SELECT geoscrub_input.country,
    geoscrub_input."stateProvince",
    geoscrub_input.county,
    geoscrub_input."decimalLatitude",
    geoscrub_input."decimalLongitude"
   FROM (geoscrub_input
   LEFT JOIN geoscrub.geoscrub_output ON ((((((geoscrub_output."decimalLatitude" = geoscrub_input."decimalLatitude") AND (geoscrub_output."decimalLongitude" = geoscrub_input."decimalLongitude")) AND (geoscrub_output.country = geoscrub_input.country)) AND (geoscrub_output."stateProvince" = geoscrub_input."stateProvince")) AND (geoscrub_output.county = geoscrub_input.county))))
  WHERE (geoscrub_output."*row_num" IS NULL);


--
-- Name: geoscrub_input_view; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW geoscrub_input_view AS
 SELECT DISTINCT place.country,
    place.stateprovince AS "stateProvince",
    place.county,
    coordinates.latitude_deg AS "decimalLatitude",
    coordinates.longitude_deg AS "decimalLongitude"
   FROM (place
   JOIN coordinates USING (coordinates_id))
  WHERE (place.country IS NOT NULL);


--
-- Name: graphic; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE graphic (
    graphic_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    graphicname text,
    graphiclocation text,
    graphicdescription text,
    graphictype text,
    graphicdata oid,
    graphicdate date
);


--
-- Name: graphic_graphic_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE graphic_graphic_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: graphic_graphic_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE graphic_graphic_id_seq OWNED BY graphic.graphic_id;


--
-- Name: higher_plant_group_nodes; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE higher_plant_group_nodes (
    higher_plant_group higher_plant_group,
    node_name text NOT NULL
);


--
-- Name: iucn_red_list_view; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW iucn_red_list_view AS
 SELECT DISTINCT "ValidMatchedTaxon"."*Accepted_name_family" AS accepted_family,
    "ValidMatchedTaxon"."*Accepted_name_species" AS accepted_species_binomial
   FROM (taxonlabel
   JOIN "TNRS"."ValidMatchedTaxon" ON (("ValidMatchedTaxon"."*Name_submitted" = taxonlabel.taxonomicname)))
  WHERE (((taxonlabel.source_id = source_by_shortname('IUCN'::text)) AND ("ValidMatchedTaxon"."*Accepted_name_family" IS NOT NULL)) AND ("ValidMatchedTaxon"."*Accepted_name_species" IS NOT NULL));


--
-- Name: VIEW iucn_red_list_view; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON VIEW iucn_red_list_view IS '
after updating this:
SELECT iucn_red_list_view_modify();
';


--
-- Name: location_location_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE location_location_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: location_location_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE location_location_id_seq OWNED BY location.location_id;


--
-- Name: locationevent_locationevent_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE locationevent_locationevent_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: locationevent_locationevent_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE locationevent_locationevent_id_seq OWNED BY locationevent.locationevent_id;


--
-- Name: locationeventcontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE locationeventcontributor (
    locationeventcontributor_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    party_id integer NOT NULL,
    role role,
    contributiondate date
);


--
-- Name: locationeventcontributor_locationeventcontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE locationeventcontributor_locationeventcontributor_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: locationeventcontributor_locationeventcontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE locationeventcontributor_locationeventcontributor_id_seq OWNED BY locationeventcontributor.locationeventcontributor_id;


--
-- Name: locationeventsynonym; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE locationeventsynonym (
    locationeventsynonym_id integer NOT NULL,
    synonymlocationevent_id integer NOT NULL,
    primarylocationevent_id integer NOT NULL,
    party_id integer NOT NULL,
    role role NOT NULL,
    synonymcomment text,
    classstartdate date DEFAULT now() NOT NULL,
    classstopdate date
);


--
-- Name: locationeventsynonym_locationeventsynonym_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE locationeventsynonym_locationeventsynonym_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: locationeventsynonym_locationeventsynonym_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE locationeventsynonym_locationeventsynonym_id_seq OWNED BY locationeventsynonym.locationeventsynonym_id;


--
-- Name: locationplace; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE locationplace (
    locationplace_id integer NOT NULL,
    location_id integer NOT NULL,
    place_id integer NOT NULL,
    identifier_id integer
);


--
-- Name: TABLE locationplace; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE locationplace IS '
Equivalent to VegBank''s place table.
';


--
-- Name: locationplace_locationplace_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE locationplace_locationplace_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: locationplace_locationplace_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE locationplace_locationplace_id_seq OWNED BY locationplace.locationplace_id;


--
-- Name: method_method_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE method_method_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: method_method_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE method_method_id_seq OWNED BY method.method_id;


--
-- Name: methodtaxonclass; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE methodtaxonclass (
    methodtaxonclass_id integer NOT NULL,
    method_id integer NOT NULL,
    taxonlabel_id integer,
    included boolean NOT NULL,
    submethod_id integer,
    taxonclass taxonclass,
    CONSTRAINT methodtaxonclass_key_required CHECK (((taxonlabel_id IS NOT NULL) OR (taxonclass IS NOT NULL)))
);


--
-- Name: COLUMN methodtaxonclass.included; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN methodtaxonclass.included IS '
Whether the method includes or excludes this taxon class.
';


--
-- Name: COLUMN methodtaxonclass.submethod_id; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN methodtaxonclass.submethod_id IS '
The submethod used to sample just this taxon class, distinct from the main method.
';


--
-- Name: methodtaxonclass_methodtaxonclass_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE methodtaxonclass_methodtaxonclass_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: methodtaxonclass_methodtaxonclass_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE methodtaxonclass_methodtaxonclass_id_seq OWNED BY methodtaxonclass.methodtaxonclass_id;


--
-- Name: note; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE note (
    note_id integer NOT NULL,
    notelink_id integer NOT NULL,
    party_id integer NOT NULL,
    role role NOT NULL,
    notetype text NOT NULL,
    notetext text NOT NULL,
    notedate date
);


--
-- Name: note_note_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE note_note_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: note_note_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE note_note_id_seq OWNED BY note.note_id;


--
-- Name: notelink; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE notelink (
    notelink_id integer NOT NULL,
    tablename text NOT NULL,
    attributename text,
    tablerecord integer NOT NULL
);


--
-- Name: notelink_notelink_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE notelink_notelink_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: notelink_notelink_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE notelink_notelink_id_seq OWNED BY notelink.notelink_id;


--
-- Name: party_party_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE party_party_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: party_party_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE party_party_id_seq OWNED BY party.party_id;


--
-- Name: partymember; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE partymember (
    partymember_id integer NOT NULL,
    parentparty_id integer NOT NULL,
    childparty_id integer NOT NULL,
    role role,
    memberstart date DEFAULT now() NOT NULL,
    memberstop date
);


--
-- Name: partymember_partymember_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE partymember_partymember_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: partymember_partymember_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE partymember_partymember_id_seq OWNED BY partymember.partymember_id;


--
-- Name: place_place_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE place_place_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: place_place_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE place_place_id_seq OWNED BY place.place_id;


--
-- Name: place_visit; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW place_visit AS
 SELECT locationevent.locationevent_id,
    locationevent.source_id,
    locationevent.sourceaccessioncode,
    locationevent.accesslevel,
    locationevent.place_visit_id,
    locationevent.parent_id,
    locationevent.location_id,
    locationevent.project_id,
    locationevent.stratum_id,
    locationevent.authoreventcode,
    locationevent.previous_id,
    locationevent.obsstartdate,
    locationevent.obsenddate,
    locationevent.dateaccuracy,
    locationevent.method_id,
    locationevent.temperature_c,
    locationevent.precipitation_m,
    locationevent.autotaxoncover,
    locationevent.originaldata,
    locationevent.effortlevel,
    locationevent.floristicquality,
    locationevent.bryophytequality,
    locationevent.lichenquality,
    locationevent.locationeventnarrative,
    locationevent.landscapenarrative,
    locationevent.homogeneity,
    locationevent.phenologicaspect,
    locationevent.representativeness,
    locationevent.standmaturity,
    locationevent.successionalstatus,
    locationevent.basalarea,
    locationevent.hydrologicregime,
    locationevent.soilmoistureregime,
    locationevent.soildrainage,
    locationevent.watersalinity,
    locationevent.waterdepth_m,
    locationevent.shoredistance,
    locationevent.soildepth,
    locationevent.organicdepth,
    locationevent.soiltaxon_id,
    locationevent.soiltaxonsrc,
    locationevent.percentbedrock,
    locationevent.percentrockgravel,
    locationevent.percentwood,
    locationevent.percentlitter,
    locationevent.percentbaresoil,
    locationevent.percentwater,
    locationevent.percentother,
    locationevent.nameother,
    locationevent.treeht,
    locationevent.shrubht,
    locationevent.fieldht,
    locationevent.nonvascularht,
    locationevent.submergedht,
    locationevent.treecover,
    locationevent.shrubcover,
    locationevent.fieldcover,
    locationevent.nonvascularcover,
    locationevent.floatingcover,
    locationevent.submergedcover,
    locationevent.dominantstratum,
    locationevent.growthform1type,
    locationevent.growthform2type,
    locationevent.growthform3type,
    locationevent.growthform1cover,
    locationevent.growthform2cover,
    locationevent.growthform3cover,
    locationevent.totalcover,
    locationevent.notespublic,
    locationevent.notesmgt,
    locationevent.revisions,
    locationevent.dateentered,
    locationevent.toptaxon1name,
    locationevent.toptaxon2name,
    locationevent.toptaxon3name,
    locationevent.toptaxon4name,
    locationevent.toptaxon5name,
    locationevent.numberoftaxa
   FROM locationevent
  WHERE (locationevent.parent_id IS NULL);


--
-- Name: VIEW place_visit; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON VIEW place_visit IS '
when updating, use * as the column list
';


--
-- Name: placecorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE placecorrelation (
    placecorrelation_id integer NOT NULL,
    parentplace_id integer NOT NULL,
    childplace_id integer NOT NULL,
    placeconvergence text NOT NULL
);


--
-- Name: placecorrelation_placecorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE placecorrelation_placecorrelation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: placecorrelation_placecorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE placecorrelation_placecorrelation_id_seq OWNED BY placecorrelation.placecorrelation_id;


--
-- Name: placename; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE placename (
    placename_id integer NOT NULL,
    parent_id integer,
    rank placerank NOT NULL,
    placename text NOT NULL
);


--
-- Name: TABLE placename; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE placename IS '
An official, named placename. Can be at any level in the geographic hierarchy. Note that the placename stores only one rank (e.g. country) of the full path to the placename. The higher-level ranks are stored in the placename''s chain of parent_id ancestors.

Equivalent to VegBank''s namedPlace table.
';


--
-- Name: placename_ancestor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE placename_ancestor (
    placename_id integer NOT NULL,
    ancestor_id integer NOT NULL
);


--
-- Name: TABLE placename_ancestor; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE placename_ancestor IS '
placename''s ancestor cross link table.
';


--
-- Name: placename_placename_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE placename_placename_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: placename_placename_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE placename_placename_id_seq OWNED BY placename.placename_id;


--
-- Name: plant; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE plant (
    plant_id integer NOT NULL
);


--
-- Name: TABLE plant; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE plant IS '
A physical, tagged plant.
';


--
-- Name: plant_plant_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE plant_plant_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: plant_plant_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE plant_plant_id_seq OWNED BY plant.plant_id;


--
-- Name: plantobservation_plantobservation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE plantobservation_plantobservation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: plantobservation_plantobservation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE plantobservation_plantobservation_id_seq OWNED BY plantobservation.plantobservation_id;


--
-- Name: plot; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW plot AS
 SELECT location.location_id AS plot_id,
    location.source_id,
    location.sourceaccessioncode,
    location.plot_location_id AS plot,
    location.parent_id,
    location.authorlocationcode,
    location.place_id,
    location.accesslevel,
    location.accessconditions,
    location.sublocationxposition_m,
    location.sublocationyposition_m,
    location.iscultivated,
    location.authorzone,
    location.authordatum,
    location.authorlocation,
    location.locationnarrative,
    location.azimuth,
    location.shape,
    location.area_m2,
    location.standsize,
    location.placementmethod,
    location.permanence,
    location.layoutnarrative,
    location.elevation_m,
    location.elevationaccuracy_m,
    location.elevationrange_m,
    location.verbatimelevation,
    location.slopeaspect_deg,
    location.minslopeaspect_deg,
    location.maxslopeaspect_deg,
    location.slopegradient_fraction,
    location.minslopegradient_fraction,
    location.maxslopegradient_fraction,
    location.topoposition,
    location.landform,
    location.surficialdeposits,
    location.rocktype,
    location.submitter_surname,
    location.submitter_givenname,
    location.submitter_email,
    location.notespublic,
    location.notesmgt,
    location.revisions,
    location.dateentered,
    location.locationrationalenarrative
   FROM location
  WHERE (location.parent_id IS NULL);


--
-- Name: VIEW plot; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON VIEW plot IS '
when updating, use * as the column list
';


--
-- Name: project_project_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE project_project_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: project_project_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE project_project_id_seq OWNED BY project.project_id;


--
-- Name: projectcontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE projectcontributor (
    projectcontributor_id integer NOT NULL,
    project_id integer NOT NULL,
    party_id integer NOT NULL,
    role role
);


--
-- Name: projectcontributor_projectcontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE projectcontributor_projectcontributor_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: projectcontributor_projectcontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE projectcontributor_projectcontributor_id_seq OWNED BY projectcontributor.projectcontributor_id;


--
-- Name: provider_count; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE provider_count (
    dataprovider text NOT NULL,
    dataset text NOT NULL,
    records bigint,
    sourcetype sourcetype,
    observationtype observationtype
);


--
-- Name: sourcename; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE sourcename (
    sourcelist_id integer NOT NULL,
    name text NOT NULL,
    matched_source_id integer
);


--
-- Name: provider_count_view; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW provider_count_view AS
        ( SELECT s.dataprovider,
            s.dataset,
            s.records,
            s.sourcetype,
            s.observationtype
           FROM ( SELECT source.shortname AS dataprovider,
                    '(total)'::text AS dataset,
                    ( SELECT count(*) AS count
                           FROM taxonoccurrence
                          WHERE (taxonoccurrence.source_id = source.source_id)) AS records,
                    source.sourcetype,
                    source.observationtype
                   FROM source
                  WHERE (EXISTS ( SELECT NULL::unknown AS unknown
                           FROM taxonoccurrence
                          WHERE (taxonoccurrence.source_id = source.source_id)
                         LIMIT 1))) s
          ORDER BY s.records DESC)
UNION ALL
        ( SELECT dataprovider.shortname AS dataprovider,
            s.dataset,
            s.records,
            dataset.sourcetype,
            COALESCE(dataset.observationtype, dataprovider.observationtype) AS observationtype
           FROM ((( SELECT specimenreplicate.source_id AS dataprovider_id,
                    sourcename.name AS dataset,
                    sourcename.matched_source_id AS dataset_id,
                    count(*) AS records
                   FROM ((specimenreplicate
              JOIN sourcelist ON ((sourcelist.sourcelist_id = specimenreplicate.duplicate_institutions_sourcelist_id)))
         JOIN sourcename USING (sourcelist_id))
        GROUP BY specimenreplicate.source_id, sourcename.name, sourcename.matched_source_id) s
      JOIN source dataprovider ON ((dataprovider.source_id = s.dataprovider_id)))
   LEFT JOIN source dataset ON ((dataset.source_id = s.dataset_id)))
  ORDER BY dataprovider.shortname, s.records DESC, s.dataset);


--
-- Name: range_modeling_input; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW range_modeling_input AS
 SELECT analytical_stem."datasource__@Brad__.identifier_examples@vegpath.org" AS source,
    analytical_stem."[custodial_]institutionCode[s]__@DwC__@vegpath.org" AS first_publisher,
    analytical_stem."decimalLatitude__@DwC__@vegpath.org" AS latitude_deg,
    analytical_stem."decimalLongitude__@DwC__@vegpath.org" AS longitude_deg,
    analytical_stem.geovalid_bien AS geovalid,
    analytical_stem."speciesBinomialWithMorphospecies__@VegCore__@vegpath.org" AS species_taxon_name,
    analytical_stem."[higher_plant_group~]higherClassification__@DwC__@vegpath.org" AS higher_plant_group
   FROM analytical_stem
  WHERE (analytical_stem."[higher_plant_group~]higherClassification__@DwC__@vegpath.org" IS NOT NULL);


--
-- Name: revision; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE revision (
    revision_id integer NOT NULL,
    tablename text NOT NULL,
    tableattribute text NOT NULL,
    tablerecord integer NOT NULL,
    previousvaluetext text NOT NULL,
    previousvaluetype text NOT NULL,
    previousrevision_id integer,
    revisiondate date NOT NULL
);


--
-- Name: revision_revision_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE revision_revision_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: revision_revision_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE revision_revision_id_seq OWNED BY revision.revision_id;


--
-- Name: soilsample; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE soilsample (
    soilsample_id integer NOT NULL,
    locationevent_id integer NOT NULL,
    horizon text DEFAULT 'unknown'::text NOT NULL,
    description text,
    depthtop_m double precision,
    depthbottom_m double precision,
    color text,
    texture text,
    organic_fraction double precision,
    sand_fraction double precision,
    silt_fraction double precision,
    clay_fraction double precision,
    coarse_fraction double precision,
    ph double precision,
    acidity_fraction double precision,
    basesaturation_fraction double precision,
    cationexchangecapacity_cmol_kg double precision,
    conductivity double precision,
    carbon_fraction double precision,
    phosphorus_fraction double precision,
    potassium_fraction double precision,
    magnesium_fraction double precision,
    nitrogen_fraction double precision,
    calcium_fraction double precision,
    sodium_fraction double precision
);


--
-- Name: soilsample_soilsample_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE soilsample_soilsample_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: soilsample_soilsample_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE soilsample_soilsample_id_seq OWNED BY soilsample.soilsample_id;


--
-- Name: soiltaxon; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE soiltaxon (
    soiltaxon_id integer NOT NULL,
    soilcode text,
    soilname text,
    soillevel integer,
    soilparent_id integer,
    soilframework text
);


--
-- Name: soiltaxon_soiltaxon_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE soiltaxon_soiltaxon_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: soiltaxon_soiltaxon_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE soiltaxon_soiltaxon_id_seq OWNED BY soiltaxon.soiltaxon_id;


--
-- Name: source_source_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE source_source_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: source_source_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE source_source_id_seq OWNED BY source.source_id;


--
-- Name: sourcecontributor; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE sourcecontributor (
    sourcecontributor_id integer NOT NULL,
    source_id integer NOT NULL,
    sourceparty_id integer NOT NULL,
    role role,
    "order" integer
);


--
-- Name: sourcecontributor_sourcecontributor_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE sourcecontributor_sourcecontributor_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: sourcecontributor_sourcecontributor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE sourcecontributor_sourcecontributor_id_seq OWNED BY sourcecontributor.sourcecontributor_id;


--
-- Name: sourcelist_sourcelist_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE sourcelist_sourcelist_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: sourcelist_sourcelist_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE sourcelist_sourcelist_id_seq OWNED BY sourcelist.sourcelist_id;


--
-- Name: specimen; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE specimen (
    specimen_id integer NOT NULL
);


--
-- Name: TABLE specimen; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE specimen IS '
A physical specimen collected from a plant. Used to link replicates of the same specimen together.
';


--
-- Name: specimen_specimen_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE specimen_specimen_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: specimen_specimen_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE specimen_specimen_id_seq OWNED BY specimen.specimen_id;


--
-- Name: specimenreplicate_specimenreplicate_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE specimenreplicate_specimenreplicate_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: specimenreplicate_specimenreplicate_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE specimenreplicate_specimenreplicate_id_seq OWNED BY specimenreplicate.specimenreplicate_id;


--
-- Name: stemobservation_stemobservation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE stemobservation_stemobservation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: stemobservation_stemobservation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE stemobservation_stemobservation_id_seq OWNED BY stemobservation.stemobservation_id;


--
-- Name: stratum_stratum_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE stratum_stratum_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: stratum_stratum_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE stratum_stratum_id_seq OWNED BY stratum.stratum_id;


--
-- Name: taxon_trait; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxon_trait (
    "scientificName" text NOT NULL,
    "measurementType" text NOT NULL,
    "measurementValue" text,
    "measurementUnit" text
);


--
-- Name: TABLE taxon_trait; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE taxon_trait IS '
to export:
select * from taxon_trait order by "scientificName", "measurementType"
';


--
-- Name: trait; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE trait (
    trait_id integer NOT NULL,
    taxonoccurrence_id integer NOT NULL,
    name text NOT NULL,
    value text,
    units text
);


--
-- Name: taxon_trait_view; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW taxon_trait_view AS
 SELECT taxon_scrub.scrubbed_taxon_name_no_author AS "scientificName",
    trait.name AS "measurementType",
    trait.value AS "measurementValue",
    trait.units AS "measurementUnit"
   FROM (((((trait
   LEFT JOIN taxonoccurrence USING (taxonoccurrence_id))
   LEFT JOIN taxondetermination ON (((taxondetermination.taxonoccurrence_id = taxonoccurrence.taxonoccurrence_id) AND taxondetermination.iscurrent)))
   LEFT JOIN taxonverbatim USING (taxonverbatim_id))
   LEFT JOIN taxonlabel USING (taxonlabel_id))
   LEFT JOIN "TNRS".taxon_scrub ON ((taxon_scrub."*Name_submitted" = taxonlabel.taxonomicname)))
  WHERE (taxon_scrub.scrubbed_taxon_name_no_author IS NOT NULL);


--
-- Name: taxonalt; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonalt (
    taxonalt_id integer NOT NULL,
    taxondetermination_id integer NOT NULL,
    taxonlabel_id integer NOT NULL,
    taxonaltfit text,
    taxonaltconfidence text,
    taxonaltnotes text
);


--
-- Name: taxonalt_taxonalt_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE taxonalt_taxonalt_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: taxonalt_taxonalt_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE taxonalt_taxonalt_id_seq OWNED BY taxonalt.taxonalt_id;


--
-- Name: taxonconcept; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonconcept (
    taxonlabel_id integer NOT NULL,
    concept_reference_id integer
);


--
-- Name: TABLE taxonconcept; Type: COMMENT; Schema: public; Owner: -
--

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


--
-- Name: COLUMN taxonconcept.concept_reference_id; Type: COMMENT; Schema: public; Owner: -
--

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

Equivalent to "Name sec. x".
';


--
-- Name: taxonconcept_taxonlabel_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE taxonconcept_taxonlabel_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: taxonconcept_taxonlabel_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE taxonconcept_taxonlabel_id_seq OWNED BY taxonconcept.taxonlabel_id;


--
-- Name: taxoncorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxoncorrelation (
    taxoncorrelation_id integer NOT NULL,
    taxonstatus_id integer NOT NULL,
    taxonlabel_id integer NOT NULL,
    plantconvergence text NOT NULL,
    correlationstart date NOT NULL,
    correlationstop date
);


--
-- Name: taxoncorrelation_taxoncorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE taxoncorrelation_taxoncorrelation_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: taxoncorrelation_taxoncorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE taxoncorrelation_taxoncorrelation_id_seq OWNED BY taxoncorrelation.taxoncorrelation_id;


--
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE taxondetermination_taxondetermination_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE taxondetermination_taxondetermination_id_seq OWNED BY taxondetermination.taxondetermination_id;


--
-- Name: taxonlabel_relationship; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonlabel_relationship (
    descendant_id integer NOT NULL,
    ancestor_id integer NOT NULL,
    relationship relationship DEFAULT 'is included in'::relationship NOT NULL
);


--
-- Name: TABLE taxonlabel_relationship; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON TABLE taxonlabel_relationship IS '
Stores the accepted ancestors of a taxonlabel. Auto-populated, so should not be manually modified.
';


--
-- Name: COLUMN taxonlabel_relationship.relationship; Type: COMMENT; Schema: public; Owner: -
--

COMMENT ON COLUMN taxonlabel_relationship.relationship IS '
The type of relationship.
';


--
-- Name: taxonlabel_taxonlabel_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE taxonlabel_taxonlabel_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: taxonlabel_taxonlabel_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE taxonlabel_taxonlabel_id_seq OWNED BY taxonlabel.taxonlabel_id;


--
-- Name: taxonlineage; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonlineage (
    taxonlineage_id integer NOT NULL,
    childtaxonstatus_id integer NOT NULL,
    parenttaxonstatus_id integer NOT NULL
);


--
-- Name: taxonlineage_taxonlineage_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE taxonlineage_taxonlineage_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: taxonlineage_taxonlineage_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE taxonlineage_taxonlineage_id_seq OWNED BY taxonlineage.taxonlineage_id;


--
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE taxonoccurrence_taxonoccurrence_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE taxonoccurrence_taxonoccurrence_id_seq OWNED BY taxonoccurrence.taxonoccurrence_id;


--
-- Name: taxonstatus; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE taxonstatus (
    taxonstatus_id integer NOT NULL,
    taxonlabel_id integer NOT NULL,
    party_id integer,
    taxonlabelstatus text DEFAULT 'undetermined'::text NOT NULL,
    source_id integer,
    plantpartycomments text,
    startdate date,
    stopdate date
);


--
-- Name: taxonstatus_taxonstatus_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE taxonstatus_taxonstatus_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: taxonstatus_taxonstatus_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE taxonstatus_taxonstatus_id_seq OWNED BY taxonstatus.taxonstatus_id;


--
-- Name: taxonverbatim_taxonverbatim_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE taxonverbatim_taxonverbatim_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: taxonverbatim_taxonverbatim_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE taxonverbatim_taxonverbatim_id_seq OWNED BY taxonverbatim.taxonverbatim_id;


--
-- Name: telephone; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE telephone (
    telephone_id integer NOT NULL,
    party_id integer NOT NULL,
    phonenumber text NOT NULL,
    phonetype text NOT NULL
);


--
-- Name: telephone_telephone_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE telephone_telephone_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: telephone_telephone_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE telephone_telephone_id_seq OWNED BY telephone.telephone_id;


--
-- Name: threatened_taxonlabel_view; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW threatened_taxonlabel_view AS
 SELECT DISTINCT accepted_taxonlabel_descendant.descendant_id AS taxonlabel_id
   FROM ((taxonlabel datasource_taxonlabel
   JOIN taxonlabel accepted_taxonlabel ON ((accepted_taxonlabel.taxonlabel_id = datasource_taxonlabel.canon_label_id)))
   JOIN taxonlabel_relationship accepted_taxonlabel_descendant ON ((accepted_taxonlabel_descendant.ancestor_id = accepted_taxonlabel.taxonlabel_id)))
  WHERE (((datasource_taxonlabel.source_id = ( SELECT source_by_shortname('IUCN'::text) AS source_by_shortname)) AND (datasource_taxonlabel.taxonomicname IS NOT NULL)) AND (accepted_taxonlabel.rank >= 'species'::taxonrank));


--
-- Name: tnrs_input_name; Type: VIEW; Schema: public; Owner: -
--

CREATE VIEW tnrs_input_name AS
 SELECT DISTINCT taxonlabel.taxonomicname
   FROM (taxonlabel
   LEFT JOIN "TNRS"."MatchedTaxon" ON (("MatchedTaxon"."*Name_submitted" = taxonlabel.taxonomicname)))
  WHERE (((taxonlabel.taxonomicname IS NOT NULL) AND ("MatchedTaxon"."*Name_submitted" IS NULL)) AND "TNRS".taxon_name_is_safe(taxonlabel.taxonomicname))
  ORDER BY taxonlabel.taxonomicname;


--
-- Name: trait_trait_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE trait_trait_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: trait_trait_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE trait_trait_id_seq OWNED BY trait.trait_id;


--
-- Name: userdefined; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE userdefined (
    userdefined_id integer NOT NULL,
    userdefinedname text NOT NULL,
    userdefinedmetadata text,
    userdefinedcategory text,
    userdefinedtype text DEFAULT 'text'::text NOT NULL,
    tablename text NOT NULL
);


--
-- Name: userdefined_userdefined_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE userdefined_userdefined_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: userdefined_userdefined_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE userdefined_userdefined_id_seq OWNED BY userdefined.userdefined_id;


--
-- Name: voucher; Type: TABLE; Schema: public; Owner: -; Tablespace: 
--

CREATE TABLE voucher (
    voucher_id integer NOT NULL,
    taxonoccurrence_id integer NOT NULL,
    specimenreplicate_id integer NOT NULL
);


--
-- Name: voucher_voucher_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE voucher_voucher_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: voucher_voucher_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE voucher_voucher_id_seq OWNED BY voucher.voucher_id;


SET search_path = public_validations, pg_catalog;

--
-- Name: _plots_01_count_of_projects; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_01_count_of_projects AS
 SELECT count(*) AS projects
   FROM (public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
  WHERE (s.shortname = ("current_schema"())::text);


--
-- Name: _plots_02_list_of_project_names; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_02_list_of_project_names AS
 SELECT p.projectname AS project_name
   FROM (public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
  WHERE (s.shortname = ("current_schema"())::text);


--
-- Name: _plots_03_count_of_all_plots_in_this_source; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_03_count_of_all_plots_in_this_source AS
 SELECT count(*) AS plots
   FROM (((public.plot l
   JOIN public.locationevent le ON ((l.plot_id = le.location_id)))
   JOIN public.project p ON ((p.project_id = le.project_id)))
   JOIN public.source s ON ((p.source_id = s.source_id)))
  WHERE (s.shortname = ("current_schema"())::text);


--
-- Name: _plots_04_count_of_plots_in_each_project_in_this_source; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_04_count_of_plots_in_each_project_in_this_source AS
 SELECT p.projectname AS project_name,
    count(DISTINCT l.plot_id) AS plots
   FROM (((public.plot l
   JOIN public.locationevent le ON ((l.plot_id = le.location_id)))
   JOIN public.project p ON ((p.project_id = le.project_id)))
   JOIN public.source s ON ((p.source_id = s.source_id)))
  WHERE (s.shortname = ("current_schema"())::text)
  GROUP BY p.projectname;


--
-- Name: _plots_05_list_of_plot_codes_by_project; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_05_list_of_plot_codes_by_project AS
 SELECT p.projectname AS project_name,
    l.authorlocationcode AS plot_code
   FROM (((public.plot l
   JOIN public.locationevent le ON ((l.plot_id = le.location_id)))
   JOIN public.project p ON ((p.project_id = le.project_id)))
   JOIN public.source s ON ((p.source_id = s.source_id)))
  WHERE (s.shortname = ("current_schema"())::text);


--
-- Name: _plots_06_list_of_plots_with_stem_measurements; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_06_list_of_plots_with_stem_measurements AS
 SELECT DISTINCT project.projectname AS project_name,
    plot.authorlocationcode AS plot_code
   FROM ((public.plot
   JOIN public.locationevent USING (plot_id))
   LEFT JOIN public.project USING (project_id))
  WHERE ((plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (EXISTS ( SELECT NULL::unknown AS unknown
   FROM ((((public.locationevent locationevent_1
   JOIN public.taxonoccurrence USING (locationevent_id))
   JOIN public.aggregateoccurrence USING (taxonoccurrence_id))
   JOIN public.plantobservation USING (aggregateoccurrence_id))
   JOIN public.stemobservation USING (plantobservation_id))
  WHERE ((locationevent_1.plot_id = plot.plot_id) AND ((stemobservation.sourceaccessioncode IS NOT NULL) OR (stemobservation.authorstemcode IS NOT NULL)))
 LIMIT 1)))
  ORDER BY plot.authorlocationcode;


--
-- Name: _plots_06a_list_of_stems; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_06a_list_of_stems AS
 SELECT project.projectname AS project_name,
    plot.authorlocationcode AS plot_code,
    stemobservation.sourceaccessioncode AS stem_id
   FROM ((((((public.plot
   JOIN public.locationevent USING (plot_id))
   LEFT JOIN public.project USING (project_id))
   JOIN public.taxonoccurrence USING (locationevent_id))
   JOIN public.aggregateoccurrence USING (taxonoccurrence_id))
   JOIN public.plantobservation USING (aggregateoccurrence_id))
   JOIN public.stemobservation USING (plantobservation_id))
  WHERE ((plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND ((stemobservation.sourceaccessioncode IS NOT NULL) OR (stemobservation.authorstemcode IS NOT NULL)))
  ORDER BY project.projectname, plot.authorlocationcode, stemobservation.sourceaccessioncode;


--
-- Name: _plots_07_list_of_plots_which_use_counts_of_indiv_per_species; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_07_list_of_plots_which_use_counts_of_indiv_per_species AS
 SELECT DISTINCT project.projectname AS project_name,
    plot.authorlocationcode AS plot_code
   FROM ((public.plot
   JOIN public.locationevent USING (plot_id))
   LEFT JOIN public.project USING (project_id))
  WHERE ((plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (EXISTS ( SELECT NULL::unknown AS unknown
   FROM ((public.locationevent locationevent_1
   JOIN public.taxonoccurrence USING (locationevent_id))
   JOIN public.aggregateoccurrence USING (taxonoccurrence_id))
  WHERE ((locationevent_1.plot_id = plot.plot_id) AND (aggregateoccurrence.count > 1))
 LIMIT 1)))
  ORDER BY plot.authorlocationcode;


--
-- Name: _plots_08_list_of_plots_which_use_percent_cover; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_08_list_of_plots_which_use_percent_cover AS
 SELECT project.projectname AS project_name,
    plot.authorlocationcode AS plot_code
   FROM ((public.plot
   JOIN public.locationevent USING (plot_id))
   LEFT JOIN public.project USING (project_id))
  WHERE ((plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (EXISTS ( SELECT NULL::unknown AS unknown
   FROM ((public.locationevent locationevent_1
   JOIN public.taxonoccurrence USING (locationevent_id))
   JOIN public.aggregateoccurrence USING (taxonoccurrence_id))
  WHERE ((locationevent_1.plot_id = plot.plot_id) AND (aggregateoccurrence.cover_fraction IS NOT NULL))
 LIMIT 1)))
  ORDER BY plot.authorlocationcode;


--
-- Name: _plots_09_list_of_plots_which_use_line_intercept; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_09_list_of_plots_which_use_line_intercept AS
 SELECT DISTINCT project.projectname AS project_name,
    plot.authorlocationcode AS plot_code
   FROM ((public.plot
   JOIN public.locationevent USING (plot_id))
   LEFT JOIN public.project USING (project_id))
  WHERE ((plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (EXISTS ( SELECT NULL::unknown AS unknown
   FROM ((public.locationevent locationevent_1
   JOIN public.taxonoccurrence USING (locationevent_id))
   JOIN public.aggregateoccurrence USING (taxonoccurrence_id))
  WHERE ((locationevent_1.plot_id = plot.plot_id) AND (aggregateoccurrence.linecover_m IS NOT NULL))
 LIMIT 1)))
  ORDER BY plot.authorlocationcode;


--
-- Name: _plots_10_count_of_individuals_per_plot_in_each_project; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_10_count_of_individuals_per_plot_in_each_project AS
 SELECT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    sum(ao.count) AS individuals
   FROM ((((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.place_visit ON ((p.project_id = place_visit.project_id)))
   JOIN public.locationevent le ON ((place_visit.locationevent_id = le.place_visit_id)))
   JOIN public.plot l ON ((place_visit.location_id = l.plot_id)))
   JOIN public.taxonoccurrence o ON ((le.locationevent_id = o.locationevent_id)))
   JOIN public.aggregateoccurrence ao ON ((o.taxonoccurrence_id = ao.taxonoccurrence_id)))
  WHERE (s.shortname = ("current_schema"())::text)
  GROUP BY p.projectname, l.authorlocationcode
  ORDER BY p.projectname, l.authorlocationcode;


--
-- Name: VIEW _plots_10_count_of_individuals_per_plot_in_each_project; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_10_count_of_individuals_per_plot_in_each_project IS '
Method: count taxonObservations
Note 1: `individuals` should be NULL for plots which use percent cover or line-intercept methods.
Note 2: Does this method requires that plots have 2-level nesting of subplots within plots?
';


--
-- Name: _plots_10a_aggregate_observation_individual_counts; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_10a_aggregate_observation_individual_counts AS
 SELECT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    o.sourceaccessioncode AS individual_id,
    ao.count AS individuals
   FROM ((((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.place_visit ON ((p.project_id = place_visit.project_id)))
   JOIN public.locationevent le ON ((place_visit.locationevent_id = le.place_visit_id)))
   JOIN public.plot l ON ((place_visit.location_id = l.plot_id)))
   JOIN public.taxonoccurrence o ON ((le.locationevent_id = o.locationevent_id)))
   JOIN public.aggregateoccurrence ao ON ((o.taxonoccurrence_id = ao.taxonoccurrence_id)))
  WHERE (s.shortname = ("current_schema"())::text)
  ORDER BY p.projectname, l.authorlocationcode, ao.sourceaccessioncode;


--
-- Name: VIEW _plots_10a_aggregate_observation_individual_counts; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_10a_aggregate_observation_individual_counts IS '
Note 1: `individuals` should be NULL for plots which use percent cover or line-intercept methods.
';


--
-- Name: _plots_11_count_of_stems_per_plot_in_each_project; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_11_count_of_stems_per_plot_in_each_project AS
 SELECT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    count(DISTINCT so.stemobservation_id) AS stems
   FROM ((((((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
   JOIN public.locationevent sub_locationevent ON ((sub_locationevent.parent_id = le.locationevent_id)))
   JOIN public.plot l ON ((le.location_id = l.plot_id)))
   JOIN public.taxonoccurrence o ON ((sub_locationevent.locationevent_id = o.locationevent_id)))
   JOIN public.aggregateoccurrence ao ON ((o.taxonoccurrence_id = ao.taxonoccurrence_id)))
   JOIN public.plantobservation po ON ((po.aggregateoccurrence_id = ao.aggregateoccurrence_id)))
   JOIN public.stemobservation so ON ((so.plantobservation_id = po.plantobservation_id)))
  WHERE (s.shortname = ("current_schema"())::text)
  GROUP BY p.projectname, l.authorlocationcode
  ORDER BY p.projectname, l.authorlocationcode;


--
-- Name: VIEW _plots_11_count_of_stems_per_plot_in_each_project; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_11_count_of_stems_per_plot_in_each_project IS '
Method: count records in stemobservation table
';


--
-- Name: _plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project AS
 SELECT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    count(DISTINCT btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)))) AS taxa
   FROM (((((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
   JOIN public.locationevent sub_locationevent ON ((sub_locationevent.parent_id = le.locationevent_id)))
   JOIN public.plot l ON ((le.location_id = l.plot_id)))
   JOIN public.taxonoccurrence o ON ((sub_locationevent.locationevent_id = o.locationevent_id)))
   JOIN public.taxondetermination td ON ((td.taxonoccurrence_id = o.taxonoccurrence_id)))
   JOIN public.taxonverbatim tv ON ((td.taxonverbatim_id = tv.taxonverbatim_id)))
  WHERE ((s.shortname = ("current_schema"())::text) AND (td.isoriginal = true))
  GROUP BY p.projectname, l.authorlocationcode
  ORDER BY p.projectname, l.authorlocationcode;


--
-- Name: VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_12_count_of_verbatim_taxa_per_plot_in_each_project IS '
Check: join to source db by all columns, returns same number of rows
Note: Must perform equivalent concatenation of taxonomic field in source db.
NOT YET READY, NEED TO INCLUDE SUBSPECIES, IF ANY
';


--
-- Name: _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p AS
 SELECT DISTINCT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text))) AS taxon
   FROM (((((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
   JOIN public.locationevent sub_locationevent ON ((sub_locationevent.parent_id = le.locationevent_id)))
   JOIN public.plot l ON ((le.location_id = l.plot_id)))
   JOIN public.taxonoccurrence o ON ((sub_locationevent.locationevent_id = o.locationevent_id)))
   JOIN public.taxondetermination td ON ((td.taxonoccurrence_id = o.taxonoccurrence_id)))
   JOIN public.taxonverbatim tv ON ((td.taxonverbatim_id = tv.taxonverbatim_id)))
  WHERE ((s.shortname = ("current_schema"())::text) AND (td.isoriginal = true))
  ORDER BY p.projectname, l.authorlocationcode, btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)));


--
-- Name: VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_each_p IS '
Note: Must perform equivalent concatenation of taxonomic field in source db.
';


--
-- Name: _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr AS
 SELECT DISTINCT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text))) AS taxon,
    sum(ao.count) AS individuals
   FROM ((((((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
   JOIN public.locationevent sub_locationevent ON ((sub_locationevent.parent_id = le.locationevent_id)))
   JOIN public.plot l ON ((le.location_id = l.plot_id)))
   JOIN public.taxonoccurrence o ON ((sub_locationevent.locationevent_id = o.locationevent_id)))
   JOIN public.taxondetermination td ON ((td.taxonoccurrence_id = o.taxonoccurrence_id)))
   JOIN public.taxonverbatim tv ON ((td.taxonverbatim_id = tv.taxonverbatim_id)))
   JOIN public.aggregateoccurrence ao ON ((o.taxonoccurrence_id = ao.taxonoccurrence_id)))
  WHERE ((s.shortname = ("current_schema"())::text) AND (td.isoriginal = true))
  GROUP BY p.projectname, l.authorlocationcode, btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)))
  ORDER BY p.projectname, l.authorlocationcode, btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)));


--
-- Name: VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_each_pr IS '
Note: Must do equivalent concatenation of taxonomic field in source db.
';


--
-- Name: _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro AS
 SELECT DISTINCT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text))) AS taxon,
    sum(ci.coverpercent) AS totalpercentcover
   FROM (((((((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
   JOIN public.locationevent sub_locationevent ON ((sub_locationevent.parent_id = le.locationevent_id)))
   JOIN public.plot l ON ((le.location_id = l.plot_id)))
   JOIN public.taxonoccurrence o ON ((sub_locationevent.locationevent_id = o.locationevent_id)))
   JOIN public.taxondetermination td ON ((td.taxonoccurrence_id = o.taxonoccurrence_id)))
   JOIN public.taxonverbatim tv ON ((td.taxonverbatim_id = tv.taxonverbatim_id)))
   JOIN public.aggregateoccurrence ao ON ((o.taxonoccurrence_id = ao.taxonoccurrence_id)))
   JOIN public.coverindex ci ON ((ao.coverindex_id = ci.coverindex_id)))
  WHERE (((s.shortname = ("current_schema"())::text) AND (td.isoriginal = true)) AND (ci.coverpercent IS NOT NULL))
  GROUP BY p.projectname, l.authorlocationcode, btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)))
  ORDER BY p.projectname, l.authorlocationcode, btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)));


--
-- Name: VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_each_pro IS '
Applies to: aggregate-cover plots only
Method: sums percent cover in aggregateoccurrence (as recorded in coverindex)
Check: join to source db by all columns, returns same number of rows
Note: Must do equivalent concatenation of taxonomic field in source db.
';


--
-- Name: _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj AS
 SELECT DISTINCT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text))) AS taxon,
    sum(ao.linecover_m) AS intercept_cm
   FROM ((((((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
   JOIN public.locationevent sub_locationevent ON ((sub_locationevent.parent_id = le.locationevent_id)))
   JOIN public.plot l ON ((le.location_id = l.plot_id)))
   JOIN public.taxonoccurrence o ON ((sub_locationevent.locationevent_id = o.locationevent_id)))
   JOIN public.taxondetermination td ON ((td.taxonoccurrence_id = o.taxonoccurrence_id)))
   JOIN public.taxonverbatim tv ON ((td.taxonverbatim_id = tv.taxonverbatim_id)))
   JOIN public.aggregateoccurrence ao ON ((o.taxonoccurrence_id = ao.taxonoccurrence_id)))
  WHERE (((s.shortname = ("current_schema"())::text) AND (td.isoriginal = true)) AND (ao.linecover_m IS NOT NULL))
  GROUP BY p.projectname, l.authorlocationcode, btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)))
  ORDER BY p.projectname, l.authorlocationcode, btrim((((((((''::text || COALESCE(tv.family, ''::text)) || ' '::text) || COALESCE(tv.genus, ''::text)) || ' '::text) || COALESCE(tv.specific_epithet, ''::text)) || ' '::text) || COALESCE(tv.morphospecies, ''::text)));


--
-- Name: VIEW _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_16_intercepts_for_each_verb_taxon_in_each_plot_each_proj IS '
Note 1: Assumes identical concatenation of taxonomic fields to form verbatim taxon name in origina db
Note 2: Grouping mean cover for entire plot combines plots with subplots (separate cover measure for each species in each subplot) with  plots with strata (separate cover measures for each species in each  stratum) with plots without subplots or strata (one cover measure  per species per plot.
';


--
-- Name: _plots_17_count_of_subplots_per_plot_for_each_project; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_17_count_of_subplots_per_plot_for_each_project AS
 SELECT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    count(DISTINCT sub_locationevent.locationevent_id) AS subplots
   FROM ((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
   JOIN public.locationevent sub_locationevent ON ((sub_locationevent.parent_id = le.locationevent_id)))
   JOIN public.plot l ON ((le.location_id = l.plot_id)))
  WHERE (s.shortname = ("current_schema"())::text)
  GROUP BY p.projectname, l.authorlocationcode
  ORDER BY p.projectname, l.authorlocationcode;


--
-- Name: _plots_18_list_of_subplots_codes_for_each_plot_for_each_project; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project AS
 SELECT p.projectname AS project_name,
    l.authorlocationcode AS plot_code,
    sub_locationevent.authoreventcode AS subplot_code
   FROM ((((public.project p
   JOIN public.source s ON ((p.source_id = s.source_id)))
   JOIN public.locationevent le ON ((p.project_id = le.project_id)))
   JOIN public.locationevent sub_locationevent ON ((sub_locationevent.parent_id = le.locationevent_id)))
   JOIN public.plot l ON ((sub_locationevent.location_id = l.plot_id)))
  WHERE (s.shortname = ("current_schema"())::text)
  ORDER BY p.projectname, l.authorlocationcode;


--
-- Name: VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_18_list_of_subplots_codes_for_each_plot_for_each_project IS '
DOESN''T YET WORK PROPERLY
';


--
-- Name: _plots_19_count_of_censuses_per_plot_in_each_project; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_19_count_of_censuses_per_plot_in_each_project AS
 SELECT project.projectname AS project_name,
    plot.authorlocationcode AS plot_code,
    count(*) AS inventories
   FROM ((public.plot plot(location_id, source_id, sourceaccessioncode, plot, parent_id, authorlocationcode, place_id, accesslevel, accessconditions, sublocationxposition_m, sublocationyposition_m, iscultivated, authorzone, authordatum, authorlocation, locationnarrative, azimuth, shape, area_m2, standsize, placementmethod, permanence, layoutnarrative, elevation_m, elevationaccuracy_m, elevationrange_m, verbatimelevation, slopeaspect_deg, minslopeaspect_deg, maxslopeaspect_deg, slopegradient_fraction, minslopegradient_fraction, maxslopegradient_fraction, topoposition, landform, surficialdeposits, rocktype, submitter_surname, submitter_givenname, submitter_email, notespublic, notesmgt, revisions, dateentered, locationrationalenarrative)
   JOIN public.locationevent USING (location_id))
   LEFT JOIN public.project USING (project_id))
  WHERE (plot.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname))
  GROUP BY project.projectname, plot.authorlocationcode
  ORDER BY project.projectname, plot.authorlocationcode;


--
-- Name: _plots_20_tnrs_names; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _plots_20_tnrs_names AS
 SELECT taxonverbatim.taxonomicname AS verbatim_name_with_author,
    taxonlabel.taxonomicname AS tnrs_input_name,
    taxon_scrub."taxonomicStatus" AS tnrs_taxonomic_status,
    taxon_scrub."*Accepted_name_family" AS tnrs_accepted_name_family,
    taxon_scrub."*Accepted_name" AS tnrs_accepted_name,
    taxon_scrub."*Accepted_name_author" AS tnrs_accepted_name_author,
    taxon_scrub.accepted_morphospecies_binomial AS taxon_morphospecies
   FROM ((public.taxonverbatim
   JOIN public.taxonlabel USING (taxonlabel_id))
   JOIN "TNRS".taxon_scrub ON ((taxon_scrub."*Name_submitted" = taxonlabel.taxonomicname)))
  WHERE (taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname))
  ORDER BY taxonlabel.taxonomicname;


--
-- Name: VIEW _plots_20_tnrs_names; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _plots_20_tnrs_names IS '
The first check is done while checking up on Aaron''s quantitative validations
("comparing the results of the plot output queries run on VegBIEN to the data in
VegBank"). Several input-output queries include verbatim taxon names; if they
pass then Aaron is forming the verbatim name correctly. Even though it concerns
the verbatim name and not the resolved name, this first check is important. If
Aaron is messing up the verbatim name somehow, the resolved name will not be
correct.

The second check should focus on determining if Aaron is reconstructing
morphospecies names correctly. The TNRS stores the morphospecies part of the
name (e.g., "sp.1") in the column "Unmatched_terms"; a bit of additional
manipulation is required to concatenated it with the resolved part of the name
to form the morphospecies string ("Miconia sp.1", "Carex ''fuzzy leaf''"). As I
found out only recently, Aaron does NOT renormalize the resolved names back to
the core database. He simple stores the verbatim TNRS output. Fully formed
morphospecies names are therefore not stored anywhere in the database, but are
reassembled on the fly when generating an analytical extract. Aaron''s rules for
doing this are embedded in a script somewhere, I have no idea where. For Brian
or Bob to assess if Aaron is re-concatenating morphospecies names correctly,
they will need to request analytical extracts for one or two of their plots, and
compare them to the names in their original databases. This second step
shouldn''t take long. If the resolved morphospecies name in Aaron''s analytical
extract looks correct, you''re done.
';


--
-- Name: _specimens_01_count_of_total_records_specimens_in_source_db; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_01_count_of_total_records_specimens_in_source_db AS
 SELECT count(*) AS "totalSpecimenRecords"
   FROM public.taxonoccurrence
  WHERE (taxonoccurrence.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname));


--
-- Name: VIEW _specimens_01_count_of_total_records_specimens_in_source_db; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _specimens_01_count_of_total_records_specimens_in_source_db IS '
Note: character set issues may cause mis-matches. This query is a good way to reveal character set issues, either in source db or in BIEN
';


--
-- Name: _specimens_02_count_of_unique_verbatim_families; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_02_count_of_unique_verbatim_families AS
 SELECT count(DISTINCT taxonverbatim.family) AS families
   FROM public.taxonverbatim
  WHERE ((taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (taxonverbatim.family IS NOT NULL));


--
-- Name: _specimens_03_list_of_verbatim_families; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_03_list_of_verbatim_families AS
 SELECT DISTINCT taxonverbatim.family
   FROM public.taxonverbatim
  WHERE ((taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (taxonverbatim.family IS NOT NULL));


--
-- Name: _specimens_04_count_of_species_binomials; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_04_count_of_species_binomials AS
 SELECT count(DISTINCT concat_ws(' '::text, taxonverbatim.genus, taxonverbatim.specific_epithet)) AS species_binomials
   FROM public.taxonverbatim
  WHERE (((taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (taxonverbatim.genus IS NOT NULL)) AND (taxonverbatim.specific_epithet IS NOT NULL));


--
-- Name: _specimens_05_list_of_species_binomials; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_05_list_of_species_binomials AS
 SELECT DISTINCT concat_ws(' '::text, taxonverbatim.genus, taxonverbatim.specific_epithet) AS species_binomial
   FROM public.taxonverbatim
  WHERE (((taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (taxonverbatim.genus IS NOT NULL)) AND (taxonverbatim.specific_epithet IS NOT NULL));


--
-- Name: _specimens_06_count_of_unique_verb_subsp_taxa_with_author; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_06_count_of_unique_verb_subsp_taxa_with_author AS
 SELECT count(DISTINCT taxonlabel.taxonomicname) AS taxon_names_with_author
   FROM (public.taxonverbatim
   JOIN public.taxonlabel USING (taxonlabel_id))
  WHERE ((taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (taxonverbatim.subspecies IS NOT NULL));


--
-- Name: _specimens_07_list_of_verbatim_subspecific_taxa_with_author; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_07_list_of_verbatim_subspecific_taxa_with_author AS
 SELECT DISTINCT taxonlabel.taxonomicname AS taxon_name_with_author
   FROM (public.taxonverbatim
   JOIN public.taxonlabel USING (taxonlabel_id))
  WHERE ((taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (taxonverbatim.subspecies IS NOT NULL));


--
-- Name: _specimens_08_count_of_unique_verbatim_author_taxa_with_genus; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_08_count_of_unique_verbatim_author_taxa_with_genus AS
 SELECT count(DISTINCT taxonlabel.taxonomicname) AS taxon_names_with_author
   FROM (public.taxonverbatim
   JOIN public.taxonlabel USING (taxonlabel_id))
  WHERE ((taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (taxonverbatim.genus IS NOT NULL));


--
-- Name: _specimens_09_list_of_unique_verbatim_author_taxa_with_genus; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_09_list_of_unique_verbatim_author_taxa_with_genus AS
 SELECT DISTINCT taxonlabel.taxonomicname AS taxon_name_with_author
   FROM (public.taxonverbatim
   JOIN public.taxonlabel USING (taxonlabel_id))
  WHERE ((taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (taxonverbatim.genus IS NOT NULL));


--
-- Name: _specimens_10_count_number_of_records_by_institution; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_10_count_number_of_records_by_institution AS
 SELECT ( SELECT sourcelist.name
           FROM public.sourcelist
          WHERE (sourcelist.sourcelist_id = specimenreplicate.duplicate_institutions_sourcelist_id)) AS specimen_duplicate_institutions,
    count(*) AS records
   FROM public.specimenreplicate
  WHERE (specimenreplicate.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname))
  GROUP BY specimenreplicate.duplicate_institutions_sourcelist_id;


--
-- Name: _specimens_11_list_of_three_standard_political_divisions; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_11_list_of_three_standard_political_divisions AS
 SELECT DISTINCT place.country,
    place.stateprovince AS "stateProvince",
    place.county
   FROM public.place
  WHERE (place.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname));


--
-- Name: VIEW _specimens_11_list_of_three_standard_political_divisions; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _specimens_11_list_of_three_standard_political_divisions IS '
Note: character set issues may cause mis-matches. This query is a good way to reveal character set issues, either in source db or in BIEN
';


--
-- Name: _specimens_12_distinct_collector_name_collect_num_date_w_count; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_12_distinct_collector_name_collect_num_date_w_count AS
 SELECT ( SELECT party.fullname
           FROM public.party
          WHERE (party.party_id = taxonoccurrence.collector_id)) AS "collectorName",
    specimenreplicate.collectionnumber AS "collectionNumber",
    (aggregateoccurrence.collectiondate)::text AS "dateCollected",
    count(*) AS "specimenRecords"
   FROM (((public.taxonoccurrence
   JOIN public.aggregateoccurrence USING (taxonoccurrence_id))
   JOIN public.plantobservation USING (aggregateoccurrence_id))
   JOIN public.specimenreplicate USING (plantobservation_id))
  WHERE (taxonoccurrence.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname))
  GROUP BY ( SELECT party.fullname
   FROM public.party
  WHERE (party.party_id = taxonoccurrence.collector_id)), specimenreplicate.collectionnumber, (aggregateoccurrence.collectiondate)::text
  ORDER BY ( SELECT party.fullname
   FROM public.party
  WHERE (party.party_id = taxonoccurrence.collector_id)), specimenreplicate.collectionnumber, (aggregateoccurrence.collectiondate)::text;


--
-- Name: _specimens_13_count_of_all_verbatim_and_decimal_lat_long; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_13_count_of_all_verbatim_and_decimal_lat_long AS
 SELECT ( SELECT count(DISTINCT ROW(coordinates.latitude_deg, coordinates.longitude_deg, coordinates.verbatimlatitude, coordinates.verbatimlongitude, coordinates.coordsaccuracy_m)) AS count
           FROM public.coordinates
          WHERE ((coordinates.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (((coordinates.verbatimlatitude IS NOT NULL) OR (coordinates.latitude_deg IS NOT NULL)) OR ((coordinates.verbatimlongitude IS NOT NULL) OR (coordinates.longitude_deg IS NOT NULL))))) AS "allLatLongs",
    ( SELECT count(DISTINCT ROW(coordinates.latitude_deg, coordinates.longitude_deg, coordinates.verbatimlatitude, coordinates.verbatimlongitude, coordinates.coordsaccuracy_m)) AS count
           FROM public.coordinates
          WHERE (((coordinates.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (coordinates.latitude_deg IS NOT NULL)) AND (coordinates.longitude_deg IS NOT NULL))) AS "decimalLatLongs";


--
-- Name: _specimens_13a_list_of_all_verbatim_lat_long; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_13a_list_of_all_verbatim_lat_long AS
 SELECT DISTINCT COALESCE(coordinates.verbatimlatitude, (coordinates.latitude_deg)::text) AS "verbatimLatitude",
    COALESCE(coordinates.verbatimlatitude, (coordinates.longitude_deg)::text) AS "verbatimLongitude"
   FROM public.coordinates
  WHERE ((coordinates.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (((coordinates.verbatimlatitude IS NOT NULL) OR (coordinates.latitude_deg IS NOT NULL)) OR ((coordinates.verbatimlongitude IS NOT NULL) OR (coordinates.longitude_deg IS NOT NULL))));


--
-- Name: _specimens_13b_list_of_all_decimal_lat_long; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_13b_list_of_all_decimal_lat_long AS
 SELECT DISTINCT coordinates.latitude_deg AS "decimalLatitude",
    coordinates.longitude_deg AS "decimalLongitude"
   FROM public.coordinates
  WHERE ((coordinates.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND ((coordinates.latitude_deg IS NOT NULL) OR (coordinates.longitude_deg IS NOT NULL)));


--
-- Name: _specimens_14_count_of_all_invalid_verbatim_lat_long; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_14_count_of_all_invalid_verbatim_lat_long AS
 SELECT ( SELECT count(*) AS count
           FROM public.coordinates
          WHERE ((coordinates.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND ((coordinates.latitude_deg > (90)::double precision) OR (coordinates.latitude_deg < ((-90))::double precision)))) AS "badLats",
    ( SELECT count(*) AS count
           FROM public.coordinates
          WHERE ((coordinates.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND ((coordinates.longitude_deg > (180)::double precision) OR (coordinates.longitude_deg < ((-180))::double precision)))) AS "badLongs";


--
-- Name: _specimens_15_list_distinct_locality_descriptions; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_15_list_distinct_locality_descriptions AS
 SELECT DISTINCT location.locationnarrative AS "localityDescription"
   FROM public.location
  WHERE ((location.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (location.locationnarrative IS NOT NULL));


--
-- Name: _specimens_16_list_distinct_specimen_descriptions; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _specimens_16_list_distinct_specimen_descriptions AS
 SELECT DISTINCT aggregateoccurrence.notes AS "specimenDescription"
   FROM public.aggregateoccurrence
  WHERE ((aggregateoccurrence.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname)) AND (aggregateoccurrence.notes IS NOT NULL));


--
-- Name: _traits_01_count_records; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _traits_01_count_records AS
 SELECT count(*) AS "totalRecords"
   FROM (public.trait
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
  WHERE (taxonoccurrence.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname));


--
-- Name: VIEW _traits_01_count_records; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _traits_01_count_records IS 'runtime: 4 min ("222337 ms") @vegbiendev';


--
-- Name: _traits_02_count_trait_names; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _traits_02_count_trait_names AS
 SELECT count(DISTINCT trait.name) AS traits
   FROM (public.trait
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
  WHERE (taxonoccurrence.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname));


--
-- Name: _traits_03_list_trait_names; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _traits_03_list_trait_names AS
 SELECT DISTINCT trait.name AS trait
   FROM (public.trait
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
  WHERE (taxonoccurrence.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname))
  ORDER BY trait.name;


--
-- Name: _traits_04_count_records_per_trait; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _traits_04_count_records_per_trait AS
 SELECT trait.name AS trait,
    count(*) AS measurements
   FROM (public.trait
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
  WHERE (taxonoccurrence.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname))
  GROUP BY trait.name
  ORDER BY trait.name;


--
-- Name: _traits_05_count_taxa; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _traits_05_count_taxa AS
 SELECT count(DISTINCT ROW(taxonverbatim.taxonname, taxonverbatim.author)) AS taxa
   FROM public.taxonverbatim
  WHERE (taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname));


--
-- Name: VIEW _traits_05_count_taxa; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _traits_05_count_taxa IS '
Note: No morphospecies in trait table, therefore count taxon + authority only
';


--
-- Name: _traits_06_list_distinct_taxa; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _traits_06_list_distinct_taxa AS
 SELECT DISTINCT concat_ws(' '::text, taxonverbatim.taxonname, taxonverbatim.author) AS taxonwithauthor
   FROM public.taxonverbatim
  WHERE (taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname))
  ORDER BY concat_ws(' '::text, taxonverbatim.taxonname, taxonverbatim.author);


--
-- Name: VIEW _traits_06_list_distinct_taxa; Type: COMMENT; Schema: public_validations; Owner: -
--

COMMENT ON VIEW _traits_06_list_distinct_taxa IS '
Note 1: No morphospecies in trait table, use taxon + authority 
Note 2: Note formation of taxonCorrected: includes family ONLY if taxon is not determined at least to genus
';


--
-- Name: _traits_07_trait_value_and_units; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _traits_07_trait_value_and_units AS
 SELECT trait.name AS trait,
    trait.value,
    trait.units
   FROM (public.trait
   JOIN public.taxonoccurrence USING (taxonoccurrence_id))
  WHERE (taxonoccurrence.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname))
  ORDER BY trait.name, trait.value, trait.units;


--
-- Name: _traits_08_taxonname_trait_and_value; Type: VIEW; Schema: public_validations; Owner: -
--

CREATE VIEW _traits_08_taxonname_trait_and_value AS
 SELECT concat_ws(' '::text, taxonverbatim.taxonname, taxonverbatim.author) AS taxonwithauthor,
    trait.name AS trait,
    trait.value
   FROM ((public.taxonverbatim
   JOIN public.taxondetermination ON (((taxondetermination.taxonverbatim_id = taxonverbatim.taxonverbatim_id) AND taxondetermination.iscurrent)))
   JOIN public.trait USING (taxonoccurrence_id))
  WHERE (taxonverbatim.source_id = ( SELECT public.source_by_shortname(("current_schema"())::text) AS source_by_shortname))
  ORDER BY taxonverbatim.taxonname;


SET search_path = public, pg_catalog;

--
-- Name: address_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY address ALTER COLUMN address_id SET DEFAULT nextval('address_address_id_seq'::regclass);


--
-- Name: aggregateoccurrence_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY aggregateoccurrence ALTER COLUMN aggregateoccurrence_id SET DEFAULT nextval('aggregateoccurrence_aggregateoccurrence_id_seq'::regclass);


--
-- Name: TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY analytical_stem ALTER COLUMN "TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org" SET DEFAULT nextval('"analytical_stem_TAXONOBSERVATION_ID__@VegBank__.taxonObserv_seq"'::regclass);


--
-- Name: classcontributor_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY classcontributor ALTER COLUMN classcontributor_id SET DEFAULT nextval('classcontributor_classcontributor_id_seq'::regclass);


--
-- Name: commclass_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY commclass ALTER COLUMN commclass_id SET DEFAULT nextval('commclass_commclass_id_seq'::regclass);


--
-- Name: commconcept_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY commconcept ALTER COLUMN commconcept_id SET DEFAULT nextval('commconcept_commconcept_id_seq'::regclass);


--
-- Name: commcorrelation_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY commcorrelation ALTER COLUMN commcorrelation_id SET DEFAULT nextval('commcorrelation_commcorrelation_id_seq'::regclass);


--
-- Name: commdetermination_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY commdetermination ALTER COLUMN commdetermination_id SET DEFAULT nextval('commdetermination_commdetermination_id_seq'::regclass);


--
-- Name: commlineage_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY commlineage ALTER COLUMN commlineage_id SET DEFAULT nextval('commlineage_commlineage_id_seq'::regclass);


--
-- Name: commname_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY commname ALTER COLUMN commname_id SET DEFAULT nextval('commname_commname_id_seq'::regclass);


--
-- Name: commstatus_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY commstatus ALTER COLUMN commstatus_id SET DEFAULT nextval('commstatus_commstatus_id_seq'::regclass);


--
-- Name: commusage_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY commusage ALTER COLUMN commusage_id SET DEFAULT nextval('commusage_commusage_id_seq'::regclass);


--
-- Name: coordinates_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY coordinates ALTER COLUMN coordinates_id SET DEFAULT nextval('coordinates_coordinates_id_seq'::regclass);


--
-- Name: coverindex_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY coverindex ALTER COLUMN coverindex_id SET DEFAULT nextval('coverindex_coverindex_id_seq'::regclass);


--
-- Name: covermethod_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY covermethod ALTER COLUMN covermethod_id SET DEFAULT nextval('covermethod_covermethod_id_seq'::regclass);


--
-- Name: definedvalue_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY definedvalue ALTER COLUMN definedvalue_id SET DEFAULT nextval('definedvalue_definedvalue_id_seq'::regclass);


--
-- Name: disturbanceobs_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY disturbanceobs ALTER COLUMN disturbanceobs_id SET DEFAULT nextval('disturbanceobs_disturbanceobs_id_seq'::regclass);


--
-- Name: graphic_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY graphic ALTER COLUMN graphic_id SET DEFAULT nextval('graphic_graphic_id_seq'::regclass);


--
-- Name: location_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY location ALTER COLUMN location_id SET DEFAULT nextval('location_location_id_seq'::regclass);


--
-- Name: locationevent_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent ALTER COLUMN locationevent_id SET DEFAULT nextval('locationevent_locationevent_id_seq'::regclass);


--
-- Name: locationeventcontributor_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationeventcontributor ALTER COLUMN locationeventcontributor_id SET DEFAULT nextval('locationeventcontributor_locationeventcontributor_id_seq'::regclass);


--
-- Name: locationeventsynonym_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationeventsynonym ALTER COLUMN locationeventsynonym_id SET DEFAULT nextval('locationeventsynonym_locationeventsynonym_id_seq'::regclass);


--
-- Name: locationplace_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationplace ALTER COLUMN locationplace_id SET DEFAULT nextval('locationplace_locationplace_id_seq'::regclass);


--
-- Name: method_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY method ALTER COLUMN method_id SET DEFAULT nextval('method_method_id_seq'::regclass);


--
-- Name: methodtaxonclass_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY methodtaxonclass ALTER COLUMN methodtaxonclass_id SET DEFAULT nextval('methodtaxonclass_methodtaxonclass_id_seq'::regclass);


--
-- Name: note_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY note ALTER COLUMN note_id SET DEFAULT nextval('note_note_id_seq'::regclass);


--
-- Name: notelink_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY notelink ALTER COLUMN notelink_id SET DEFAULT nextval('notelink_notelink_id_seq'::regclass);


--
-- Name: party_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY party ALTER COLUMN party_id SET DEFAULT nextval('party_party_id_seq'::regclass);


--
-- Name: partymember_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY partymember ALTER COLUMN partymember_id SET DEFAULT nextval('partymember_partymember_id_seq'::regclass);


--
-- Name: place_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY place ALTER COLUMN place_id SET DEFAULT nextval('place_place_id_seq'::regclass);


--
-- Name: placecorrelation_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY placecorrelation ALTER COLUMN placecorrelation_id SET DEFAULT nextval('placecorrelation_placecorrelation_id_seq'::regclass);


--
-- Name: placename_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY placename ALTER COLUMN placename_id SET DEFAULT nextval('placename_placename_id_seq'::regclass);


--
-- Name: plant_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY plant ALTER COLUMN plant_id SET DEFAULT nextval('plant_plant_id_seq'::regclass);


--
-- Name: plantobservation_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY plantobservation ALTER COLUMN plantobservation_id SET DEFAULT nextval('plantobservation_plantobservation_id_seq'::regclass);


--
-- Name: project_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY project ALTER COLUMN project_id SET DEFAULT nextval('project_project_id_seq'::regclass);


--
-- Name: projectcontributor_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY projectcontributor ALTER COLUMN projectcontributor_id SET DEFAULT nextval('projectcontributor_projectcontributor_id_seq'::regclass);


--
-- Name: revision_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY revision ALTER COLUMN revision_id SET DEFAULT nextval('revision_revision_id_seq'::regclass);


--
-- Name: soilsample_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY soilsample ALTER COLUMN soilsample_id SET DEFAULT nextval('soilsample_soilsample_id_seq'::regclass);


--
-- Name: soiltaxon_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY soiltaxon ALTER COLUMN soiltaxon_id SET DEFAULT nextval('soiltaxon_soiltaxon_id_seq'::regclass);


--
-- Name: source_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY source ALTER COLUMN source_id SET DEFAULT nextval('source_source_id_seq'::regclass);


--
-- Name: sourcecontributor_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY sourcecontributor ALTER COLUMN sourcecontributor_id SET DEFAULT nextval('sourcecontributor_sourcecontributor_id_seq'::regclass);


--
-- Name: sourcelist_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY sourcelist ALTER COLUMN sourcelist_id SET DEFAULT nextval('sourcelist_sourcelist_id_seq'::regclass);


--
-- Name: specimen_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimen ALTER COLUMN specimen_id SET DEFAULT nextval('specimen_specimen_id_seq'::regclass);


--
-- Name: specimenreplicate_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimenreplicate ALTER COLUMN specimenreplicate_id SET DEFAULT nextval('specimenreplicate_specimenreplicate_id_seq'::regclass);


--
-- Name: stemobservation_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY stemobservation ALTER COLUMN stemobservation_id SET DEFAULT nextval('stemobservation_stemobservation_id_seq'::regclass);


--
-- Name: stratum_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY stratum ALTER COLUMN stratum_id SET DEFAULT nextval('stratum_stratum_id_seq'::regclass);


--
-- Name: taxonalt_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonalt ALTER COLUMN taxonalt_id SET DEFAULT nextval('taxonalt_taxonalt_id_seq'::regclass);


--
-- Name: taxoncorrelation_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxoncorrelation ALTER COLUMN taxoncorrelation_id SET DEFAULT nextval('taxoncorrelation_taxoncorrelation_id_seq'::regclass);


--
-- Name: taxondetermination_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination ALTER COLUMN taxondetermination_id SET DEFAULT nextval('taxondetermination_taxondetermination_id_seq'::regclass);


--
-- Name: taxonlabel_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlabel ALTER COLUMN taxonlabel_id SET DEFAULT nextval('taxonlabel_taxonlabel_id_seq'::regclass);


--
-- Name: taxonlineage_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlineage ALTER COLUMN taxonlineage_id SET DEFAULT nextval('taxonlineage_taxonlineage_id_seq'::regclass);


--
-- Name: taxonoccurrence_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonoccurrence ALTER COLUMN taxonoccurrence_id SET DEFAULT nextval('taxonoccurrence_taxonoccurrence_id_seq'::regclass);


--
-- Name: taxonstatus_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonstatus ALTER COLUMN taxonstatus_id SET DEFAULT nextval('taxonstatus_taxonstatus_id_seq'::regclass);


--
-- Name: taxonverbatim_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonverbatim ALTER COLUMN taxonverbatim_id SET DEFAULT nextval('taxonverbatim_taxonverbatim_id_seq'::regclass);


--
-- Name: telephone_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY telephone ALTER COLUMN telephone_id SET DEFAULT nextval('telephone_telephone_id_seq'::regclass);


--
-- Name: trait_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY trait ALTER COLUMN trait_id SET DEFAULT nextval('trait_trait_id_seq'::regclass);


--
-- Name: userdefined_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY userdefined ALTER COLUMN userdefined_id SET DEFAULT nextval('userdefined_userdefined_id_seq'::regclass);


--
-- Name: voucher_id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY voucher ALTER COLUMN voucher_id SET DEFAULT nextval('voucher_voucher_id_seq'::regclass);


--
-- Data for Name: address; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: address_address_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: aggregateoccurrence; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: aggregateoccurrence_aggregateoccurrence_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: analytical_stem; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: analytical_stem_TAXONOBSERVATION_ID__@VegBank__.taxonObserv_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: classcontributor; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: classcontributor_classcontributor_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: commclass; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: commclass_commclass_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: commconcept; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: commconcept_commconcept_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: commcorrelation; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: commcorrelation_commcorrelation_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: commdetermination; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: commdetermination_commdetermination_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: commlineage; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: commlineage_commlineage_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: commname; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: commname_commname_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: commstatus; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: commstatus_commstatus_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: commusage; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: commusage_commusage_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: coordinates; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: coordinates_coordinates_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: coverindex; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: coverindex_coverindex_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: covermethod; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: covermethod_covermethod_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: cultivated_family_locations; Type: TABLE DATA; Schema: public; Owner: -
--

INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Costa Rica');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Panama');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Colombia');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Venezuela');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Ecuador');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Peru');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Bolivia');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Chile');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Argentina');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Paraguay');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Uruguay');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Brazil');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Guyana');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'French Guiana');
INSERT INTO cultivated_family_locations VALUES ('Pinus', 'Suriname');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Venezuela');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Ecuador');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Peru');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Bolivia');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Chile');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Argentina');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Paraguay');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Uruguay');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Brazil');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Guyana');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'French Guiana');
INSERT INTO cultivated_family_locations VALUES ('Quercus', 'Suriname');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Nicaragua');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Costa Rica');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Panama');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Colombia');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Venezuela');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Ecuador');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Peru');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Bolivia');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Chile');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Argentina');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Paraguay');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Uruguay');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Brazil');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Guyana');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'French Guiana');
INSERT INTO cultivated_family_locations VALUES ('Acer', 'Suriname');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Nicaragua');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Costa Rica');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Panama');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Colombia');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Venezuela');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Ecuador');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Peru');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Bolivia');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Chile');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Argentina');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Paraguay');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Uruguay');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Brazil');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Guyana');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'French Guiana');
INSERT INTO cultivated_family_locations VALUES ('Abies', 'Suriname');
INSERT INTO cultivated_family_locations VALUES ('Arecaceae', 'Canada');


--
-- Name: dba_preassignacccode_dba_requestnumber_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: definedvalue; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: definedvalue_definedvalue_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: disturbanceobs; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: disturbanceobs_disturbanceobs_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: family_higher_plant_group; Type: TABLE DATA; Schema: public; Owner: -
--

INSERT INTO family_higher_plant_group VALUES ('Anthocerotaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Dendrocerotaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Notothyladaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Phymatocerotaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Leiosporocerotaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Polytrichaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Funariaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Dicranaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Ditrichaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Mniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Andreaeaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Sematophyllaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Sphagnaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Hylocomiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Bryaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Tetraphidaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Brachytheciaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pottiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Bartramiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Fissidentaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Hedwigiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Orthotrichaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Amblystegiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Plagiotheciaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Hypnaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Thuidiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Erpodiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Encalyptaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Ptychomitriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Rhabdoweisiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Splachnaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Rhachitheciaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Calymperaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Buxbaumiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Hookeriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Timmiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Leucodontaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Grimmiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Aulacomniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Hypnodendraceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Rhizogoniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Leptostomataceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Meesiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Seligeriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Fontinalaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Neckeraceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pterobryaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Hypopterygiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Climaciaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Schistostegaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Takakiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Leucobryaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Trachylomataceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Prionodontaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Anomodontaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Cryphaeaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Leptodontaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Leskeaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Lembophyllaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Entodontaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Echinodiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Stereophyllaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Daltoniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Fabroniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Lepyrodontaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Meteoriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Myuriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Phyllodrepaniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Phyllogoniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Ptychomniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Rutenbergiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Theliaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Bryoxiphiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Archidiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Andreaeobryaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Racopilaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Drummondiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Diphysciaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Scouleriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Orthodontiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Rhacocarpaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Leucomiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pilotrichaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Rhytidiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pleuroziopsidaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Myriniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pterigynandraceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Helodiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Oedipodiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Gigaspermaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Disceliaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Helicophyllaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Catagoniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Catoscopiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Mitteniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pterobryellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Bruchiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Rigodiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Calliergonaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Bryobartramiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Ambuchananiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Symphyodontaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Eustichiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Orthorrhynchiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Regmatodontaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Serpotortellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pleurophascaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Saulomataceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Schimperobryaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pylaisiadelphaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Braithwaiteaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Flatbergiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Hypodontiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pulchrinodaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Miyabeaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Micromitriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Jungermanniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Lepidoziaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Marchantiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Aytoniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Metzgeriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Haplomitriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Sphaerocarpaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Aneuraceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pelliaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Conocephalaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Ricciaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Scapaniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Calypogeiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Plagiochilaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Trichocoleaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Lunulariaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Monocleaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Fossombroniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Herbertaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Jubulaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Porellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Targioniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Lejeuneaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Ptilidiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pseudolepicoleaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Cephaloziaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Geocalycaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pallaviciniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Oxymitraceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Makinoaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Corsiniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Riellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Treubiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Hymenophytaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Schistochilaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Acrobolbaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Cleveaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Blasiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Adelanthaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Lepidolaenaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Radulaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Lepicoleaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Cyathodiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Exormothecaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Monosoleniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Wiesnerellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Gymnomitriaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Mastigophoraceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Vetaformataceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Balantiopsidaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Goebeliellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Neotrichocoleaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Pleuroziaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Trichotemnomataceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Delavayellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Allisoniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Phyllothalliaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Antheliaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Cephaloziellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Gyrothyraceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Brevianthaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Jackiellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Arnelliaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Calyculariaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Frullaniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Jamesoniellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Mizutaniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Petalophyllaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Neohodgsoniaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Dumortieraceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Moerckiaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Herzogianthaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Perssoniellaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Lophocoleaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Myliaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Blepharidophyllaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Solenostomataceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Endogemmataceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Anastrophyllaceae', 'bryophytes');
INSERT INTO family_higher_plant_group VALUES ('Selaginellaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Lycopodiaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Isoetaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Psilotaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Equisetaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Marattiaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Dicksoniaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Gleicheniaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Polypodiaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Osmundaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Marsileaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Pteridaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Schizaeaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Ophioglossaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Blechnaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Dryopteridaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Thelypteridaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Hymenophyllaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Vittariaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Oleandraceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Cheiropleuriaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Cyatheaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Davalliaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Dennstaedtiaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Dipteridaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Grammitidaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Lindsaeaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Lomariopsidaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Matoniaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Metaxyaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Plagiogyriaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Salviniaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Azollaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Loxsomataceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Aspleniaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Lophosoriaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Hymenophyllopsidaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Woodsiaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Lygodiaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Anemiaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Thyrsopteridaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Cibotiaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Culcitaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Saccolomataceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Onocleaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Tectariaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Cystopteridaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Hemidictyaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Diplaziopsidaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Rhachidosoraceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Athyriaceae', 'ferns and allies');
INSERT INTO family_higher_plant_group VALUES ('Magnoliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Winteraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Canellaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Calycanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lauraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ranunculaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Menispermaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Coriariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Papaveraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ulmaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cannabaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Moraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Urticaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Fagaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Betulaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Casuarinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Phytolaccaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Nyctaginaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Aizoaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Amaranthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Caryophyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Portulacaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Didiereaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Basellaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Molluginaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cactaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Vitaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rhamnaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Polygonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Actinidiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Malvaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Caricaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cucurbitaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Begoniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Passifloraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Salicaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Brassicaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Moringaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sapotaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rosaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cephalotaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cunoniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Crassulaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Saxifragaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Fabaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lythraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Myrtaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Onagraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Combretaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Santalaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Loranthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Olacaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Euphorbiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Simmondsiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Buxaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Linaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Humiriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Anacardiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Burseraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tropaeolaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Geraniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Oxalidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Apiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Araliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Apocynaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Solanaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Convolvulaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hydrophyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lamiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Oleaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Scrophulariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pedaliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Acanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lentibulariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Caprifoliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Adoxaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Asteraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Malpighiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Polygalaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Garryaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Nyssaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Aquifoliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Celastraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Corynocarpaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Dichapetalaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Icacinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Salvadoraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Proteaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Primulaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cyrillaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ericaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sarraceniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Droseraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Nepenthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Campanulaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Daphniphyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Eucommiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Platanaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Trochodendraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Nymphaeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cabombaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Nelumbonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Bataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Plumbaginaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Alismataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Araceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Poaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cyperaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Bromeliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Marantaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cannaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Costaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Musaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Zingiberaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Heliconiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lowiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Strelitziaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Amaryllidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Dioscoreaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hypoxidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Liliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Smilacaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Arecaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pandanaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Typhaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Joinvilleaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Commelinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Orchidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rapateaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Juncaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Restionaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Flagellariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Agavaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Potamogetonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pontederiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Velloziaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Goodeniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Clethraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Myrsinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Theophrastaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Diapensiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cercidiphyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Eupteleaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Juglandaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Aristolochiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Schisandraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Chloranthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Piperaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Saururaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Akaniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Valerianaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ebenaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Styracaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Symplocaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Gentianaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Limnanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Boraginaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Verbenaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hernandiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Monimiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Amborellaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Erythroxylaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Annonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Myristicaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Austrobaileyaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Degeneriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Eupomatiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Himantandraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lactoridaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lardizabalaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sabiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Chrysobalanaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Crossosomataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Grossulariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hydrangeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pittosporaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rutaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sapindaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Simaroubaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Bignoniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Menyanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Polemoniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Fouquieriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Violaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Dilleniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Paeoniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Haloragaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Gunneraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rubiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Achatocarpaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Balanophoraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Balsaminaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Bretschneideraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Bruniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Connaraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cyclanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cymodoceaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Datiscaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Elaeagnaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Elaeocarpaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Eriocaulaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Gesneriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Gyrostemonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hydnoraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hydrocharitaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Iridaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Loganiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Myricaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Neuradaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Nothofagaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Opiliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rafflesiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Resedaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Scheuchzeriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Surianaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Theaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Vochysiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Xanthorrhoeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Zosteraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ceratophyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Loasaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Geissolomataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Escalloniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Aextoxicaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Circaeasteraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Thymelaeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Melastomataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Heteropyxidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Memecylaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Oliniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Penaeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rhizophoraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sarcolaenaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Alzateaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Asparagaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Dipsacaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Dipterocarpaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Colchicaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tetrachondraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Phrymaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Berberidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Calyceraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pentaphragmataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Stylidiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sphenocleaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Stilbaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Martyniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hamamelidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cornaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Curtisiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Griseliniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Helwingiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Acoraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Kirkiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Meliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Zygophyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Philydraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hyacinthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tecophilaeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Turneraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Barbeyaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Burmanniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Stemonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Alseuosmiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Butomaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ruscaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Melanthiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cynomoriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Luzuriagaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Asphodelaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hemerocallidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Blandfordiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Doryanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ixioliriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Asteliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Podostemaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Haemodoraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Grubbiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Marcgraviaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Limnocharitaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Aponogetonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Juncaginaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Posidoniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ruppiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Clusiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ochnaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Alstroemeriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Argophyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Phellinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Columelliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Phyllonomaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Quiinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Medusagynaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Boryaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Philesiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Morinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rhoipteleaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ticodendraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Anisophylleaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ancistrocladaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Dioncophyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Frankeniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rhabdodendraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tamaricaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Physenaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Gomortegaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Bixaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cochlospermaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sphaerosepalaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Krameriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cistaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Caryocaraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Malesherbiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Mayacaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Thurniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Xyridaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Dasypogonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Trigoniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Balanopaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Myrothamnaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Gelsemiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Picramniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Berberidopsidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Melianthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Oncothecaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tofieldiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Stachyuraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Staphyleaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rousseaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ixerbaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Huaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Atherospermataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Trimeniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lanariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Xeronemataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Rhipogonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cytinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Mitrastemonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Altingiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Iteaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Penthoraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pterostemonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tetracarpaeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Setchellanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tovariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pentadiplandraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Koeberliniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Biebersteiniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Nitrariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Muntingiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Vivianiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sarcobataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Diervillaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Linnaeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Plocospermataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Vahliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Orobanchaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Schlegeliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ternstroemiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Roridulaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tetrameristaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Montiniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hanguanaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Centrolepidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ecdeiocoleaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Anarthriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Siparunaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Crypteroniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Achariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Aphloiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ixonanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lacistemataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Asteropeiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Dirachmaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Petrosaviaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Nartheciaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Emblingiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Carlemanniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Polyosmaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pandaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sphenostemonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Bonnetiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cardiopteridaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ctenolophonaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Elatinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lepidobotryaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lophopyxidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Paracryphiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pentaphylacaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Peridiscaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Strasburgeriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Torricelliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Corsiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Calceolariaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Paulowniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Plantaginaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Linderniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Themidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Stemonuraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pennantiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Quillajaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Euphroniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Laxmanniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hydatellaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tapisciaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Dipentodontaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Brunelliaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Tetramelaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Goupiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Triuridaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Barbeuiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Drosophyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Gisekiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Halophytaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Stegnospermataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Misodendraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Aphanopetalaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Parnassiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Putranjivaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Phyllanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Picrodendraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Peganaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Sladeniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Byblidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hydrostachyaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Myodocarpaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Campynemataceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Petermanniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Capparaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cleomaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Apodanthaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Thomandersiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Schoepfiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Metteniusaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hydroleaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Gerrardinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Centroplacaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Erythropalaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Lophiocarpaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Agdestidaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Petiveriaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Guamatelaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Limeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hypericaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Irvingiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Peraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Calophyllaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Talinaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Anacampserotaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Montiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Xanthoceraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Aceraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Hippocastanaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Strombosiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Ximeniaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Coulaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Aptandraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Octoknemaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Comandraceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Thesiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Cervantesiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Nanodeaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Amphorogynaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Viscaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Borthwickiaceae', 'flowering plants');
INSERT INTO family_higher_plant_group VALUES ('Pinaceae', 'gymnosperms (conifers)');
INSERT INTO family_higher_plant_group VALUES ('Podocarpaceae', 'gymnosperms (conifers)');
INSERT INTO family_higher_plant_group VALUES ('Cupressaceae', 'gymnosperms (conifers)');
INSERT INTO family_higher_plant_group VALUES ('Taxaceae', 'gymnosperms (conifers)');
INSERT INTO family_higher_plant_group VALUES ('Araucariaceae', 'gymnosperms (conifers)');
INSERT INTO family_higher_plant_group VALUES ('Cephalotaxaceae', 'gymnosperms (conifers)');
INSERT INTO family_higher_plant_group VALUES ('Sciadopityaceae', 'gymnosperms (conifers)');
INSERT INTO family_higher_plant_group VALUES ('Zamiaceae', 'gymnosperms (non-conifer)');
INSERT INTO family_higher_plant_group VALUES ('Cycadaceae', 'gymnosperms (non-conifer)');
INSERT INTO family_higher_plant_group VALUES ('Stangeriaceae', 'gymnosperms (non-conifer)');
INSERT INTO family_higher_plant_group VALUES ('Ginkgoaceae', 'gymnosperms (non-conifer)');
INSERT INTO family_higher_plant_group VALUES ('Welwitschiaceae', 'gymnosperms (non-conifer)');
INSERT INTO family_higher_plant_group VALUES ('Gnetaceae', 'gymnosperms (non-conifer)');
INSERT INTO family_higher_plant_group VALUES ('Ephedraceae', 'gymnosperms (non-conifer)');
INSERT INTO family_higher_plant_group VALUES ('Porphyridiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhodomelaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gelidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Endocladiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Palmariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dictyotaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ectocarpaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Alariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Scytosiphonaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cryptomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Prorocentraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Vaucheriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tribonemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Fucaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sargassaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chordaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dunaliellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chlamydomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Spondylomoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Volvocaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Oocystaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Scenedesmaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chlorococcaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hydrodictyaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ulvaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Coleochaetaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bryopsidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Codiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dasycladaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chlorokybaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Characeae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Klebsormidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Zygnemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Saprolegniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Peronosporaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pythiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lagenidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trypanosomatidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bodonidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hexamitidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Vahlkampfiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hartmannellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Eimeriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sarcocystidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Halteriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Colpodidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Isotrichidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Colepidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gloeodiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sphacelariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Syringodermataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Theileriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Perkinsidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acanthoecidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Furcellariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phyllophoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Elphidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Thalassiosiraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gigartinaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Haplosporidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Desmidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mesotaeniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Goniomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heterochordariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ralfsiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Desmarestiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bangiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Compsopogonaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acrochaetiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ahnfeltiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bonnemaisoniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Batrachospermaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lemaneaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ceramiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Delesseriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Corallinaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cystocloniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dumontiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gloiosiphoniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hypneaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Kallymeniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Solieriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Plocamiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Halymeniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Polyideaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhizophyllidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sphaerococcaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gracilariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hildenbrandiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Liagoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhodogorgonaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Champiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lomentariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhodymeniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Babesiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chaetophoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Derbesiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Laminariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Erythropeltidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Thraustochytriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cyanophoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gonyaulacaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Eupodiscaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stephanopyxidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhizosoleniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Skeletonemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bacillariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Fragilariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cryptosporidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gregarinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cohnilembidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cyclidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudocohnilembidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Uronematidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trimyemidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Plagiopylidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lessoniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Melosiraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Labyrinthulidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dasyaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Nizymeniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phacelocarpaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gromiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amoebidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pedinomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mesostigmataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chlorodendraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Scourfieldiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Caulerpaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dichotomosiphonaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ostreobiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Udoteaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cladophoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Siphonocladaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Valoniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trentepohliaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ulvellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Aphanochaetaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Schizomeridaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chlorellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Selenastraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Coccomyxaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Eremosphaeraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hypnomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Palmellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tetrasporaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Haematococcaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Elakatotrichaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Paraphysomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Spirostomidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Plasmodiophoridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ctenocladaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trachelocercidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Metopidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Glaucocystaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gloeochaetaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Caulacanthaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tichocarpaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sarcodiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Coscinodiscaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phaeodactylaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhaphoneidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Thalassionemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Botryococcaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ceratiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Crypthecodiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhodophysemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhodothamniellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Euglyphidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Paulinellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Prorodontidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mamiellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pycnococcaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Schizymeniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Proteromonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Thaumatomastigidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heteromitidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cercomonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Oikomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Globigerinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bolivinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Saccamminidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Astrorhizidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Soritidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Peneroplidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Asteromonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tetrabaenaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ophryoscolecidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dinophysiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Astrephomenaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sporolithaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hemidiscaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Aulacoseiraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chaetocerotaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Corethraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cymatosiraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lithodesmiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hemiaulaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lauderiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sebdeniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mychodeaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Globorotaliidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chaetopeltidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phacotaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gonatozygaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sphaeropleaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Treubariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bursariidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Urostylidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Oxytrichidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ostreopsidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Catenulaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Caenomorphidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Strombidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Arthrocladiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gruberellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chrysolepidomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Albuginaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudolithiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Thalassicollidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sphaerozoidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Collosphaeridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chordariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Leptomyxidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ceratocoryaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gymnodiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heterocapsaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Peridiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Noctilucaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Naviculaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trichonymphidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Psilosiphonaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Thoreaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hantkeninidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rotaliidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Discorbidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Glabratellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Balantidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tracheliidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cycloposthiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Macropodiniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pyrophacaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Galaxauraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cladostephaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cutleriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Himanthaliaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phaeothamniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Siluaniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Oodiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Codonosigidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Salpingoecidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Faucheaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pleurochloridellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lankesterellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acanthometridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Kentrophoridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ancyromonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Opisthonectidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Vorticellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tilopteridaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hormosiraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ochromonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amoebophryaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Syndiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Duboscquellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bryophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Woodruffiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Grossglockneriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cyrtolophosididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bryometopidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Suessiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Durvillaeaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Seirococcaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Nyctotheridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Opalinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Vannellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Notheiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gomphonemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pyrsonymphidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Oxymonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chrysoamoebidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hibberdiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chrysocapsaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chromulinaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chrysosphaeraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chrysosaccaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hydruraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phaeoplacaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cladotrichidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amphisiellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Euplotidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gastrocirrhidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Uronychiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhipidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Holomastigotoididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudochordaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sporochnaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Orchitophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Monocystidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ophryocystidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhodochaetaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhizidiomycetaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hyphochytriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stypocaulaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Choristocarpaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Verrucalvaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Balliaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Micractiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Miliolidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Alveolinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phyllariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Peniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Closteriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Neochloridaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phaeosaccionaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Prasiolaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Haliphthoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Monocercomonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Malawimonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Echinamoebidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Flabellulidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stemonitidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Clastodermataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Aspidiscidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phragmonemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Strombidinopsidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Monomasticaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Adenocystaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acrosymphytaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gainiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acinetosporaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Jakobidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Certesiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Monostromataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Nucleariidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Epistylidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lecudinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Eurychasmataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Allogromiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Saccaminidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chaetosphaeridiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Glenodiniineae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Microsporaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amylovoracidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Polycostidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Leptocylindraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ephelotidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Discophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heliophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trochamminidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lituolidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acrotrichaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Characiosiphonaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pelomyxidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tokophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Operculariidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ophrydiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Vaginicolidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Zoothamniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Astylozoidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Apusomonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Balbianiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Naccariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Peyssonneliaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Nemastomataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Calosiphoniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Oxyrrhinaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mastigamoebidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Colpodellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trinematidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cyphoderiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudodifflugiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Vexilliferidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Codonellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trichomonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Strobilidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Metacylididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tintinnidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trachelostylidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Entomoneidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sphenomonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Reticulomyxidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Kornmanniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Collodictyonidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Nonionidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Retortamonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Raphidiophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heterophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acanthocystidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Characiochloridaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heteropediaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pleurochloridaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Centritractaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ophiocytiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mischococcaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Botryidiopsidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Leidyanidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Eunotiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Nummulitidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pleurosigmataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Philasteridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trichodinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amphileptidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Didiniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Enchelyidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trachelophyllidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Litonotidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pleuronematidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tsengiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Paramoebidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Adeleidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hepatozoidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Calcarinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Planorbulinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cassidulinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Planulinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sproplectamminidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Textulariidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Eggerellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudogaudryinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Golenkiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ulotrichaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trichiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bellerocheaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Biddulphiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Striatellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Triceratiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Licmophoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhabdonemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Podolampaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Codonellopsidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Xystonellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhabdonellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Enteridiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Licnophoridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Schizocaryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bathysiphonidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cibicididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lagynidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hormosinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Syringamminidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Buliminidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chilostomellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Uvigerinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cocconeidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lyrellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Achnanthaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Anomoeoneidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pinnulariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sellaphoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cymbellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heliopeltaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cyclophoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Parauronematidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hauerinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Glandulinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Peritromidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stentoridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Folliculinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Blepharismidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Condylostomatidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Climacostomidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Geleiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Spongodiscidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Streblomastigidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Anadyomenaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pulleniatinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hapalidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Selenidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Plagiogrammaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ishigeaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lipotrophidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Syncystidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Clathrulinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Aulosphaeridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Coelodendridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Aulacanthidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Thalassophysidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bicosoecidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cafeteriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chlamydodontidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dysteriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dicranemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Corynomorphaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acinetidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Oxytoxaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Erythrotrichiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Botryochloridaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sticholonchidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Thecamoebidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phaeostrophionaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pihiellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhopalodiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hartmannulidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ellobiopsidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Palavasciaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Eccrinaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amoebidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Symbiodiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acrotylaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Corynocystaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cruoriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cubiculosporaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mychodeophyllaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudoanemoniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rissoellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Wurdemanniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Areschougiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Polykrikaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Isochonidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hemidiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Protoperidiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pyrophaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phaeophilaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cyanidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amphipleuraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hyalodiscaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Attheyaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stauroneidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Scinaiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dorataspididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hexalaspididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amphilithiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Gigartacontidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Anoplophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Theoperidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pterocorythidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Choreocolacaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pterocladiophilaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mesodiniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Calyptrosphaeraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Teranymphidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Staurojoeninidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hoplonymphidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Polyphysaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bromeliophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tetrahymenidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Turaniellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Glaucomidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudourostylidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Coccodiscidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Echinosteliidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cribrariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rzehakinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Polymastigidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Diadesmidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Enteromonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stauraconidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudokeronopsidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Loxocephalidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rosalinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cochliopodiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stainforthiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Botrydiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Microchlamyiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Arcellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Centropyxidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heleoperidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hyalospheniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trigonopyxidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Plagiopyxidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Siphogenerinoididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudoparrellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Vampyrellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Anomalinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Nodosariidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Osangulariidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Alabaminidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Challengeriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Medusettidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Concharidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Katablepharidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Frontoniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Parameciidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Urocentridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lembadionidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Apofrondoniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Urosporidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Aggregatidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Fursenkoinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Orthodonellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhytidocystidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ebriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ethmosphaeridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Plagoniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pyloniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Litheliidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mesosporaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Braarudosphaeraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Spathidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lacrymariidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Homalozoonidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Discosporangiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Buliminellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Buliminoididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudocodiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Halimedaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Scoresbyellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rigidotrichidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Saccinobaculidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Discocephalidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Candeinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chattonidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chlorocystidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Spirofilidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pfiesteriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Epalxellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Loxodidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Collozoidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Actinommidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Costariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Akkesiphycaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Halosiphonaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pleurochrysidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phaeocystaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Calcidiscaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Syracosphaeraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Coccolithaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hymenomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhabdosphaeraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Isochrysidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Noelaerhabdaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Prymnesiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Helicosphaeraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pavlovaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Synuraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mallomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Myxochloridaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stylococcaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Eustigmataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Monodopsidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudocharaciopsidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phytodiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Protoraphidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tabellariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Neidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cavosteliaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ceratiomyxaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Protosteliaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Reticulariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Myzocytiopsidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stylonemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Oxyphysaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Urotrichidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bardeliellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hausmanniellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Marynidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sagittariidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sorogenidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Spirodiniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Paraisotrichidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Guembelitriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Troglodytellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Colpodidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trichosidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhodachlyaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Nassulidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pseudomicrothoracidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Furgasoniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Microthoracidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sainouridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dictyocystidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Anaulaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Foettingeriidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Onslowiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Buetschliidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Blepharocorythidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Robertinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Histiobalantiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Balamuthiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Plagiotropidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Histionidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Holostichidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amphisoleniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Citharistaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heterogloeaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Geminigeraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pyrenomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chroomonadaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hemiselmidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lophodiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Epiclintidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Holophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phyllosiphonaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tontoniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tubiferaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chytriodiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Actinocephalidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hirmocystidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stenophoridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sphaerocystidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stylocephalidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Warnowiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Vacuolariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chattonellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Colaconemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Balanionidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhodellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Parentodiniidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cinetochilidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Placidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hemispeiridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Plesiotrichopidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Paraspathidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Calyptosporidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dinobryaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Parabirojimidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ganymedidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Triparmaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Simplicimonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Honigbergiellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dientamoebidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hexamastigidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lophomonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tritrichomonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hypotrichomonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Spirotrichosomidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Fryeellaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Hymenocladiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Polydiniellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Wrangeliaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Kofoidiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Platyophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Radiophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chlamydophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Deltopylidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Haemeschariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ancistridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phyllostauridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Astrolithidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Kreyellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Meiodiscaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pithophoraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Okellyaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rufusiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Boldiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ethmodiscaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Asterolampraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Bryophidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Valvulinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Globotextulariidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pythiogetonaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cephaloidophoridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Uradiophoridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Porosporidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Salisapiliaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stokesiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ovulinatidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Larnacillidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acropisthiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sarcomeniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ophthalmidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Spiroplectamminidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Clausilocolidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Berkeleyaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Diploneidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Achnanthidiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Scoliotropidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Toxariaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Brachidiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Kareniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Aulacodiscaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acanthocerataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chrysanthemodiscaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Pinguiochrysidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ichthyobodonidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Loboceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Crossocarpaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tintinnidiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Ptychocylididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhabdamminidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Patellinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Trissocyclidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Plagiacanthidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lynnellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dactylosomatidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Haemogregarinidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Glenodiniopsidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cryptodifflugiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Goceviidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tsukubamonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chrysomeridaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Jaoaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lesquereusiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Elaeomyxaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Physaraceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Didymiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Prototrachelocercidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Amphidomataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acanthochiasmidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acanthoplegmidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Diploconidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Lithopteridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Goniodomataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cladopyxidaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Psalteriomonadidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Peranemaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Phacaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Euglenaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Eudubosquellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chrysochromulinaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Guttulinaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Acrasiaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Stephanoecidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Difflugiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Tovelliaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Chilodonellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Sonderiidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Usconophryidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Cyttarocylididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Undellidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Dianemataceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Rhizosphaeridae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Biecheleriaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Heterodiniaceae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Liceidae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Epiplocylididae', NULL);
INSERT INTO family_higher_plant_group VALUES ('Mantamonadidae', NULL);


--
-- Data for Name: geoscrub_input; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Data for Name: graphic; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: graphic_graphic_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: higher_plant_group_nodes; Type: TABLE DATA; Schema: public; Owner: -
--

INSERT INTO higher_plant_group_nodes VALUES ('bryophytes', 'Anthocerotophyta');
INSERT INTO higher_plant_group_nodes VALUES ('bryophytes', 'Marchantiophyta');
INSERT INTO higher_plant_group_nodes VALUES ('bryophytes', 'Bryophyta');
INSERT INTO higher_plant_group_nodes VALUES ('ferns and allies', 'Lycopodiophyta');
INSERT INTO higher_plant_group_nodes VALUES ('ferns and allies', 'Moniliformopses');
INSERT INTO higher_plant_group_nodes VALUES ('flowering plants', 'Magnoliophyta');
INSERT INTO higher_plant_group_nodes VALUES ('gymnosperms (conifers)', 'Coniferophyta');
INSERT INTO higher_plant_group_nodes VALUES ('gymnosperms (non-conifer)', 'Cycadophyta');
INSERT INTO higher_plant_group_nodes VALUES ('gymnosperms (non-conifer)', 'Ginkgophyta');
INSERT INTO higher_plant_group_nodes VALUES ('gymnosperms (non-conifer)', 'Gnetophyta');
INSERT INTO higher_plant_group_nodes VALUES (NULL, 'root');


--
-- Data for Name: iucn_red_list; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Data for Name: location; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: location_location_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: locationevent; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: locationevent_locationevent_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: locationeventcontributor; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: locationeventcontributor_locationeventcontributor_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: locationeventsynonym; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: locationeventsynonym_locationeventsynonym_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: locationplace; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: locationplace_locationplace_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: method; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: method_method_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: methodtaxonclass; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: methodtaxonclass_methodtaxonclass_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: note; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: note_note_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: notelink; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: notelink_notelink_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: party; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: party_party_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: partymember; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: partymember_partymember_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: place; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: place_place_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: placecorrelation; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: placecorrelation_placecorrelation_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: placename; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Data for Name: placename_ancestor; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: placename_placename_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: plant; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: plant_plant_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: plantobservation; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: plantobservation_plantobservation_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: project; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: project_project_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: projectcontributor; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: projectcontributor_projectcontributor_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: provider_count; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Data for Name: revision; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: revision_revision_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: soilsample; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: soilsample_soilsample_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: soiltaxon; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: soiltaxon_soiltaxon_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: source; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: source_source_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: sourcecontributor; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: sourcecontributor_sourcecontributor_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: sourcelist; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: sourcelist_sourcelist_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: sourcename; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Data for Name: specimen; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: specimen_specimen_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: specimenreplicate; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: specimenreplicate_specimenreplicate_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: stemobservation; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: stemobservation_stemobservation_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: stratum; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: stratum_stratum_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: taxon_trait; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Data for Name: taxonalt; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: taxonalt_taxonalt_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: taxonconcept; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: taxonconcept_taxonlabel_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: taxoncorrelation; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: taxoncorrelation_taxoncorrelation_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: taxondetermination; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: taxonlabel; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Data for Name: taxonlabel_relationship; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: taxonlabel_taxonlabel_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: taxonlineage; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: taxonlineage_taxonlineage_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: taxonoccurrence; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: taxonoccurrence_taxonoccurrence_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: taxonstatus; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: taxonstatus_taxonstatus_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: taxonverbatim; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: taxonverbatim_taxonverbatim_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: telephone; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: telephone_telephone_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: trait; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: trait_trait_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: userdefined; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: userdefined_userdefined_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



--
-- Data for Name: voucher; Type: TABLE DATA; Schema: public; Owner: -
--



--
-- Name: voucher_voucher_id_seq; Type: SEQUENCE SET; Schema: public; Owner: -
--



SET search_path = public_validations, pg_catalog;

--
-- Data for Name: ~type._plots_01_count_of_projects; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_02_list_of_project_names; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_03_count_of_all_plots_in_this_source; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_04_count_of_plots_in_each_project_in_this_source; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_05_list_of_plot_codes_by_project; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_06_list_of_plots_with_stem_measurements; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_06a_list_of_stems; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_07_list_of_plots_which_use_counts_of_indiv_per_spe; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_08_list_of_plots_which_use_percent_cover; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_09_list_of_plots_which_use_line_intercept; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_10_count_of_individuals_per_plot_in_each_project; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_10a_aggregate_observation_individual_counts; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_11_count_of_stems_per_plot_in_each_project; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_project; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plot_in_; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot_in_e; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_in_ea; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_16_intercepts_for_each_verb_taxon_in_each_plot_eac; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_17_count_of_subplots_per_plot_for_each_project; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_18_list_of_subplots_codes_for_each_plot_for_each_p; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._plots_19_count_of_censuses_per_plot_in_each_project; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_01_count_of_total_records_specimens_in_source_; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_02_count_of_unique_verbatim_families; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_03_list_of_verbatim_families; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_04_count_of_species_binomials; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_05_list_of_species_binomials; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_06_count_of_unique_verb_subsp_taxa_with_author; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_07_list_of_verbatim_subspecific_taxa_with_auth; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_08_count_of_unique_verbatim_author_taxa_with_g; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_09_list_of_unique_verbatim_author_taxa_with_ge; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_10_count_number_of_records_by_institution; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_11_list_of_three_standard_political_divisions; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_12_distinct_collector_name_collect_num_date_w_; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_13_count_of_all_verbatim_and_decimal_lat_long; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_13a_list_of_all_verbatim_lat_long; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_13b_list_of_all_decimal_lat_long; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_14_count_of_all_invalid_verbatim_lat_long; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_15_list_distinct_locality_descriptions; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._specimens_16_list_distinct_specimen_descriptions; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._traits_01_count_records; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._traits_02_count_trait_names; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._traits_03_list_trait_names; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._traits_04_count_records_per_trait; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._traits_05_count_taxa; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._traits_06_list_distinct_taxa; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._traits_07_trait_value_and_units; Type: TABLE DATA; Schema: public_validations; Owner: -
--



--
-- Data for Name: ~type._traits_08_taxonname_trait_and_value; Type: TABLE DATA; Schema: public_validations; Owner: -
--



SET search_path = public, pg_catalog;

--
-- Name: address_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY address
    ADD CONSTRAINT address_pkey PRIMARY KEY (address_id);


--
-- Name: aggregateoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_pkey PRIMARY KEY (aggregateoccurrence_id);


--
-- Name: analytical_stem_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY analytical_stem
    ADD CONSTRAINT analytical_stem_pkey PRIMARY KEY ("TAXONOBSERVATION_ID__@VegBank__.taxonObservation@vegpath.org");


--
-- Name: classcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY classcontributor
    ADD CONSTRAINT classcontributor_pkey PRIMARY KEY (classcontributor_id);


--
-- Name: commclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commclass
    ADD CONSTRAINT commclass_pkey PRIMARY KEY (commclass_id);


--
-- Name: commconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commconcept
    ADD CONSTRAINT commconcept_pkey PRIMARY KEY (commconcept_id);


--
-- Name: commconcept_unique_commdescription; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commconcept
    ADD CONSTRAINT commconcept_unique_commdescription UNIQUE (commdescription);


--
-- Name: commconcept_unique_commname; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commconcept
    ADD CONSTRAINT commconcept_unique_commname UNIQUE (commname_id);


--
-- Name: commcorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commcorrelation
    ADD CONSTRAINT commcorrelation_pkey PRIMARY KEY (commcorrelation_id);


--
-- Name: commdetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commdetermination
    ADD CONSTRAINT commdetermination_pkey PRIMARY KEY (commdetermination_id);


--
-- Name: commdetermination_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commdetermination
    ADD CONSTRAINT commdetermination_unique UNIQUE (commclass_id, commconcept_id);


--
-- Name: commlineage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commlineage
    ADD CONSTRAINT commlineage_pkey PRIMARY KEY (commlineage_id);


--
-- Name: commname_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commname
    ADD CONSTRAINT commname_pkey PRIMARY KEY (commname_id);


--
-- Name: commname_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commname
    ADD CONSTRAINT commname_unique UNIQUE (commname);


--
-- Name: commstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT commstatus_pkey PRIMARY KEY (commstatus_id);


--
-- Name: commusage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY commusage
    ADD CONSTRAINT commusage_pkey PRIMARY KEY (commusage_id);


--
-- Name: coordinates_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY coordinates
    ADD CONSTRAINT coordinates_pkey PRIMARY KEY (coordinates_id);


--
-- Name: coverindex_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY coverindex
    ADD CONSTRAINT coverindex_pkey PRIMARY KEY (coverindex_id);


--
-- Name: covermethod_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY covermethod
    ADD CONSTRAINT covermethod_pkey PRIMARY KEY (covermethod_id);


--
-- Name: cultivated_family_locations_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY cultivated_family_locations
    ADD CONSTRAINT cultivated_family_locations_pkey PRIMARY KEY (family, country);


--
-- Name: definedvalue_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY definedvalue
    ADD CONSTRAINT definedvalue_pkey PRIMARY KEY (definedvalue_id);


--
-- Name: definedvalue_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY definedvalue
    ADD CONSTRAINT definedvalue_unique UNIQUE (userdefined_id, tablerecord_id);


--
-- Name: disturbanceobs_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY disturbanceobs
    ADD CONSTRAINT disturbanceobs_pkey PRIMARY KEY (disturbanceobs_id);


--
-- Name: family_higher_plant_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY family_higher_plant_group
    ADD CONSTRAINT family_higher_plant_group_pkey PRIMARY KEY (family);


--
-- Name: graphic_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY graphic
    ADD CONSTRAINT graphic_pkey PRIMARY KEY (graphic_id);


--
-- Name: iucn_red_list_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY iucn_red_list
    ADD CONSTRAINT iucn_red_list_pkey PRIMARY KEY (accepted_family, accepted_species_binomial);


--
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY location
    ADD CONSTRAINT location_pkey PRIMARY KEY (location_id);


--
-- Name: locationevent_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_pkey PRIMARY KEY (locationevent_id);


--
-- Name: locationeventcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY locationeventcontributor
    ADD CONSTRAINT locationeventcontributor_pkey PRIMARY KEY (locationeventcontributor_id);


--
-- Name: locationeventcontributor_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY locationeventcontributor
    ADD CONSTRAINT locationeventcontributor_unique UNIQUE (locationevent_id, party_id);


--
-- Name: locationeventsynonym_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY locationeventsynonym
    ADD CONSTRAINT locationeventsynonym_pkey PRIMARY KEY (locationeventsynonym_id);


--
-- Name: locationplace_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY locationplace
    ADD CONSTRAINT locationplace_pkey PRIMARY KEY (locationplace_id);


--
-- Name: method_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY method
    ADD CONSTRAINT method_pkey PRIMARY KEY (method_id);


--
-- Name: methodtaxonclass_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY methodtaxonclass
    ADD CONSTRAINT methodtaxonclass_pkey PRIMARY KEY (methodtaxonclass_id);


--
-- Name: methodtaxonclass_unique_description; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY methodtaxonclass
    ADD CONSTRAINT methodtaxonclass_unique_description UNIQUE (method_id, taxonclass);


--
-- Name: methodtaxonclass_unique_taxonlabel_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY methodtaxonclass
    ADD CONSTRAINT methodtaxonclass_unique_taxonlabel_id UNIQUE (method_id, taxonlabel_id);


--
-- Name: note_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY note
    ADD CONSTRAINT note_pkey PRIMARY KEY (note_id);


--
-- Name: notelink_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY notelink
    ADD CONSTRAINT notelink_pkey PRIMARY KEY (notelink_id);


--
-- Name: party_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY party
    ADD CONSTRAINT party_pkey PRIMARY KEY (party_id);


--
-- Name: partymember_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY partymember
    ADD CONSTRAINT partymember_pkey PRIMARY KEY (partymember_id);


--
-- Name: place_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY place
    ADD CONSTRAINT place_pkey PRIMARY KEY (place_id);


--
-- Name: placecorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY placecorrelation
    ADD CONSTRAINT placecorrelation_pkey PRIMARY KEY (placecorrelation_id);


--
-- Name: placename_ancestor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY placename_ancestor
    ADD CONSTRAINT placename_ancestor_pkey PRIMARY KEY (placename_id, ancestor_id);


--
-- Name: placename_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY placename
    ADD CONSTRAINT placename_pkey PRIMARY KEY (placename_id);


--
-- Name: plant_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY plant
    ADD CONSTRAINT plant_pkey PRIMARY KEY (plant_id);


--
-- Name: plantobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY plantobservation
    ADD CONSTRAINT plantobservation_pkey PRIMARY KEY (plantobservation_id);


--
-- Name: project_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY project
    ADD CONSTRAINT project_pkey PRIMARY KEY (project_id);


--
-- Name: project_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY project
    ADD CONSTRAINT project_unique UNIQUE (source_id, projectname);


--
-- Name: projectcontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY projectcontributor
    ADD CONSTRAINT projectcontributor_pkey PRIMARY KEY (projectcontributor_id);


--
-- Name: projectcontributor_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY projectcontributor
    ADD CONSTRAINT projectcontributor_unique UNIQUE (project_id, party_id);


--
-- Name: provider_count_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY provider_count
    ADD CONSTRAINT provider_count_pkey PRIMARY KEY (dataprovider, dataset);


--
-- Name: revision_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY revision
    ADD CONSTRAINT revision_pkey PRIMARY KEY (revision_id);


--
-- Name: soilsample_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY soilsample
    ADD CONSTRAINT soilsample_pkey PRIMARY KEY (soilsample_id);


--
-- Name: soilsample_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY soilsample
    ADD CONSTRAINT soilsample_unique UNIQUE (locationevent_id);


--
-- Name: soiltaxon_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY soiltaxon
    ADD CONSTRAINT soiltaxon_pkey PRIMARY KEY (soiltaxon_id);


--
-- Name: source_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY source
    ADD CONSTRAINT source_pkey PRIMARY KEY (source_id);


--
-- Name: sourcecontributor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY sourcecontributor
    ADD CONSTRAINT sourcecontributor_pkey PRIMARY KEY (sourcecontributor_id);


--
-- Name: sourcelist_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY sourcelist
    ADD CONSTRAINT sourcelist_pkey PRIMARY KEY (sourcelist_id);


--
-- Name: sourcename_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY sourcename
    ADD CONSTRAINT sourcename_pkey PRIMARY KEY (sourcelist_id, name);


--
-- Name: specimen_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY specimen
    ADD CONSTRAINT specimen_pkey PRIMARY KEY (specimen_id);


--
-- Name: specimenreplicate_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY specimenreplicate
    ADD CONSTRAINT specimenreplicate_pkey PRIMARY KEY (specimenreplicate_id);


--
-- Name: stemobservation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY stemobservation
    ADD CONSTRAINT stemobservation_pkey PRIMARY KEY (stemobservation_id);


--
-- Name: stratum_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY stratum
    ADD CONSTRAINT stratum_pkey PRIMARY KEY (stratum_id);


--
-- Name: stratum_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY stratum
    ADD CONSTRAINT stratum_unique UNIQUE (source_id, stratumname);


--
-- Name: taxonalt_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonalt
    ADD CONSTRAINT taxonalt_pkey PRIMARY KEY (taxonalt_id);


--
-- Name: taxonconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

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


--
-- Name: taxoncorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxoncorrelation
    ADD CONSTRAINT taxoncorrelation_pkey PRIMARY KEY (taxoncorrelation_id);


--
-- Name: taxondetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_pkey PRIMARY KEY (taxondetermination_id);


--
-- Name: taxonlabel_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonlabel
    ADD CONSTRAINT taxonlabel_pkey PRIMARY KEY (taxonlabel_id);


--
-- Name: taxonlabel_relationship_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonlabel_relationship
    ADD CONSTRAINT taxonlabel_relationship_pkey PRIMARY KEY (descendant_id, ancestor_id);


--
-- Name: taxonlineage_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonlineage
    ADD CONSTRAINT taxonlineage_pkey PRIMARY KEY (taxonlineage_id);


--
-- Name: taxonoccurrence_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonoccurrence
    ADD CONSTRAINT taxonoccurrence_pkey PRIMARY KEY (taxonoccurrence_id);


--
-- Name: taxonstatus_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonstatus
    ADD CONSTRAINT taxonstatus_pkey PRIMARY KEY (taxonstatus_id);


--
-- Name: taxonstatus_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonstatus
    ADD CONSTRAINT taxonstatus_unique UNIQUE (taxonlabel_id, party_id);


--
-- Name: taxonverbatim_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY taxonverbatim
    ADD CONSTRAINT taxonverbatim_pkey PRIMARY KEY (taxonverbatim_id);


--
-- Name: telephone_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY telephone
    ADD CONSTRAINT telephone_pkey PRIMARY KEY (telephone_id);


--
-- Name: trait_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY trait
    ADD CONSTRAINT trait_pkey PRIMARY KEY (trait_id);


--
-- Name: userdefined_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY userdefined
    ADD CONSTRAINT userdefined_pkey PRIMARY KEY (userdefined_id);


--
-- Name: userdefined_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY userdefined
    ADD CONSTRAINT userdefined_unique UNIQUE (tablename, userdefinedname);


--
-- Name: voucher_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY voucher
    ADD CONSTRAINT voucher_pkey PRIMARY KEY (voucher_id);


--
-- Name: voucher_unique; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: 
--

ALTER TABLE ONLY voucher
    ADD CONSTRAINT voucher_unique UNIQUE (taxonoccurrence_id, specimenreplicate_id);


--
-- Name: address_organization_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX address_organization_id_idx ON address USING btree (organization_id);


--
-- Name: address_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX address_party_id_idx ON address USING btree (party_id);


--
-- Name: aggregateoccurrence_coverindex_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aggregateoccurrence_coverindex_id_idx ON aggregateoccurrence USING btree (coverindex_id);


--
-- Name: aggregateoccurrence_method_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aggregateoccurrence_method_id_idx ON aggregateoccurrence USING btree (method_id);


--
-- Name: aggregateoccurrence_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aggregateoccurrence_source_id_idx ON aggregateoccurrence USING btree (source_id);


--
-- Name: aggregateoccurrence_stratum_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aggregateoccurrence_stratum_id_idx ON aggregateoccurrence USING btree (stratum_id);


--
-- Name: aggregateoccurrence_taxonoccurrence; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX aggregateoccurrence_taxonoccurrence ON aggregateoccurrence USING btree (taxonoccurrence_id);


--
-- Name: aggregateoccurrence_taxonoccurrence_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX aggregateoccurrence_taxonoccurrence_1_to_1 ON aggregateoccurrence USING btree (taxonoccurrence_id) WHERE (sourceaccessioncode IS NULL);


--
-- Name: aggregateoccurrence_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX aggregateoccurrence_unique_within_creator ON aggregateoccurrence USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: analytical_stem_datasource__@Brad__.identifier_examples@ve_idx1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX "analytical_stem_datasource__@Brad__.identifier_examples@ve_idx1" ON analytical_stem USING btree ("datasource__@Brad__.identifier_examples@vegpath.org", "[custodial_]institutionCode[s]__@DwC__@vegpath.org", "collectionCode__@DwC__@vegpath.org", "catalogNumber__@DwC__@vegpath.org");


--
-- Name: analytical_stem_datasource__@Brad__.identifier_examples@ve_idx2; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX "analytical_stem_datasource__@Brad__.identifier_examples@ve_idx2" ON analytical_stem USING btree ("datasource__@Brad__.identifier_examples@vegpath.org", "projectID__@VegX__.plotObservation@vegpath.org", "locationID__@DwC__@vegpath.org", "eventDate__@DwC__@vegpath.org");


--
-- Name: analytical_stem_datasource__@Brad__.identifier_examples@veg_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX "analytical_stem_datasource__@Brad__.identifier_examples@veg_idx" ON analytical_stem USING btree ("datasource__@Brad__.identifier_examples@vegpath.org", "occurrenceID__@DwC__@vegpath.org");


--
-- Name: analytical_stem_speciesBinomialWithMorphospecies__@VegCore__idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX "analytical_stem_speciesBinomialWithMorphospecies__@VegCore__idx" ON analytical_stem USING btree ("speciesBinomialWithMorphospecies__@VegCore__@vegpath.org");


--
-- Name: classcontributor_commclass_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX classcontributor_commclass_id_idx ON classcontributor USING btree (commclass_id);


--
-- Name: classcontributor_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX classcontributor_party_id_idx ON classcontributor USING btree (party_id);


--
-- Name: commclass_classpublication_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commclass_classpublication_id_idx ON commclass USING btree (classpublication_id);


--
-- Name: commclass_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX commclass_unique ON commclass USING btree (locationevent_id, (COALESCE(classnotes, '\N'::text)));


--
-- Name: commconcept_reference_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commconcept_reference_id_idx ON commconcept USING btree (reference_id);


--
-- Name: commcorrelation_commconcept_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commcorrelation_commconcept_id_idx ON commcorrelation USING btree (commconcept_id);


--
-- Name: commcorrelation_commstatus_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commcorrelation_commstatus_id_idx ON commcorrelation USING btree (commstatus_id);


--
-- Name: commdetermination_commauthority_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commdetermination_commauthority_id_idx ON commdetermination USING btree (commauthority_id);


--
-- Name: commdetermination_commconcept_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commdetermination_commconcept_id_idx ON commdetermination USING btree (commconcept_id);


--
-- Name: commlineage_childcommstatus_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commlineage_childcommstatus_id_idx ON commlineage USING btree (childcommstatus_id);


--
-- Name: commlineage_parentcommstatus_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commlineage_parentcommstatus_id_idx ON commlineage USING btree (parentcommstatus_id);


--
-- Name: commname_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commname_source_id_idx ON commname USING btree (source_id);


--
-- Name: commstatus_commconcept_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commstatus_commconcept_id_idx ON commstatus USING btree (commconcept_id);


--
-- Name: commstatus_commparent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commstatus_commparent_id_idx ON commstatus USING btree (commparent_id);


--
-- Name: commstatus_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commstatus_party_id_idx ON commstatus USING btree (party_id);


--
-- Name: commstatus_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commstatus_source_id_idx ON commstatus USING btree (source_id);


--
-- Name: commusage_commconcept_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_commconcept_id_idx ON commusage USING btree (commconcept_id);


--
-- Name: commusage_commname_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_commname_id_idx ON commusage USING btree (commname_id);


--
-- Name: commusage_commstatus_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_commstatus_id_idx ON commusage USING btree (commstatus_id);


--
-- Name: commusage_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX commusage_party_id_idx ON commusage USING btree (party_id);


--
-- Name: coordinates_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX coordinates_unique ON coordinates USING btree (source_id, latitude_deg, longitude_deg, (COALESCE(verbatimlatitude, '\N'::text)), (COALESCE(verbatimlongitude, '\N'::text)), (COALESCE(verbatimcoordinates, '\N'::text)), (COALESCE(footprintgeometry_dwc, '\N'::text)), (COALESCE(coordsaccuracy_m, 'NaN'::double precision)));


--
-- Name: coverindex_covermethod_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX coverindex_covermethod_id_idx ON coverindex USING btree (covermethod_id);


--
-- Name: covermethod_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX covermethod_source_id_idx ON covermethod USING btree (source_id);


--
-- Name: disturbanceobs_locationevent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX disturbanceobs_locationevent_id_idx ON disturbanceobs USING btree (locationevent_id);


--
-- Name: fki_location_place_id_fkey; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX fki_location_place_id_fkey ON location USING btree (place_id);


--
-- Name: graphic_locationevent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX graphic_locationevent_id_idx ON graphic USING btree (locationevent_id);


--
-- Name: higher_plant_group_nodes_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX higher_plant_group_nodes_unique ON higher_plant_group_nodes USING btree ((COALESCE(higher_plant_group, 'all'::higher_plant_group)), node_name);


--
-- Name: location_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX location_creator ON location USING btree (source_id);


--
-- Name: location_parent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX location_parent ON location USING btree (parent_id);


--
-- Name: location_plot_location_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX location_plot_location_id ON location USING btree (plot_location_id);


--
-- Name: location_unique_within_creator_by_authorlocationcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX location_unique_within_creator_by_authorlocationcode ON location USING btree (source_id, (COALESCE(authorlocationcode, '\N'::text))) WHERE (((authorlocationcode IS NOT NULL) AND (parent_id IS NULL)) AND (sourceaccessioncode IS NULL));


--
-- Name: location_unique_within_creator_by_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX location_unique_within_creator_by_sourceaccessioncode ON location USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: location_unique_within_parent_by_authorlocationcode_position; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX location_unique_within_parent_by_authorlocationcode_position ON location USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(authorlocationcode, '\N'::text)), (COALESCE(sublocationxposition_m, 'NaN'::double precision)), (COALESCE(sublocationyposition_m, 'NaN'::double precision))) WHERE ((parent_id IS NOT NULL) AND (authorlocationcode IS NOT NULL));


--
-- Name: locationevent__stratum_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent__stratum_id ON locationevent USING btree (stratum_id);


--
-- Name: locationevent_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_location ON locationevent USING btree (location_id);


--
-- Name: locationevent_method_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_method_id_idx ON locationevent USING btree (method_id);


--
-- Name: locationevent_parent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_parent_id_idx ON locationevent USING btree (parent_id);


--
-- Name: locationevent_place_visit_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_place_visit_id ON locationevent USING btree (place_visit_id);


--
-- Name: locationevent_plot_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_plot_id ON locationevent USING btree (plot_id);


--
-- Name: locationevent_previous_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_previous_id_idx ON locationevent USING btree (previous_id);


--
-- Name: locationevent_project_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_project_id_idx ON locationevent USING btree (project_id);


--
-- Name: locationevent_soiltaxon_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_soiltaxon_id_idx ON locationevent USING btree (soiltaxon_id);


--
-- Name: locationevent_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationevent_source_id_idx ON locationevent USING btree (source_id);


--
-- Name: locationevent_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX locationevent_unique_within_creator ON locationevent USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text)), (COALESCE(stratum_id, 2147483647))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: locationevent_unique_within_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX locationevent_unique_within_location ON locationevent USING btree ((COALESCE(location_id, 2147483647)), (COALESCE(authoreventcode, '\N'::text)), (COALESCE(obsstartdate, 'infinity'::date)), (COALESCE(stratum_id, 2147483647))) WHERE ((parent_id IS NULL) AND (sourceaccessioncode IS NULL));


--
-- Name: locationevent_unique_within_parent_by_authoreventcode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX locationevent_unique_within_parent_by_authoreventcode ON locationevent USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(authoreventcode, '\N'::text)), (COALESCE(stratum_id, 2147483647))) WHERE ((parent_id IS NOT NULL) AND (authoreventcode IS NOT NULL));


--
-- Name: locationevent_unique_within_parent_by_location; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX locationevent_unique_within_parent_by_location ON locationevent USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(location_id, 2147483647)), (COALESCE(stratum_id, 2147483647))) WHERE ((parent_id IS NOT NULL) AND (location_id IS NOT NULL));


--
-- Name: locationevent_unique_within_project; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX locationevent_unique_within_project ON locationevent USING btree ((COALESCE(project_id, 2147483647)), (COALESCE(authoreventcode, '\N'::text)), (COALESCE(obsstartdate, 'infinity'::date)), (COALESCE(stratum_id, 2147483647))) WHERE ((((parent_id IS NULL) AND (project_id IS NOT NULL)) AND (authoreventcode IS NOT NULL)) AND (obsstartdate IS NOT NULL));


--
-- Name: locationeventcontributor_locationevent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventcontributor_locationevent_id_idx ON locationeventcontributor USING btree (locationevent_id);


--
-- Name: locationeventcontributor_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventcontributor_party_id_idx ON locationeventcontributor USING btree (party_id);


--
-- Name: locationeventsynonym_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventsynonym_party_id_idx ON locationeventsynonym USING btree (party_id);


--
-- Name: locationeventsynonym_primarylocationevent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventsynonym_primarylocationevent_id_idx ON locationeventsynonym USING btree (primarylocationevent_id);


--
-- Name: locationeventsynonym_synonymlocationevent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationeventsynonym_synonymlocationevent_id_idx ON locationeventsynonym USING btree (synonymlocationevent_id);


--
-- Name: locationplace_identifier_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationplace_identifier_id_idx ON locationplace USING btree (identifier_id);


--
-- Name: locationplace_place_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX locationplace_place_id_idx ON locationplace USING btree (place_id);


--
-- Name: locationplace_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX locationplace_unique ON locationplace USING btree (location_id, place_id, (COALESCE(identifier_id, 2147483647)));


--
-- Name: method_covermethod_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX method_covermethod_id_idx ON method USING btree (covermethod_id);


--
-- Name: method_subplotmethod_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX method_subplotmethod_id_idx ON method USING btree (subplotmethod_id);


--
-- Name: method_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX method_unique ON method USING btree (source_id, (COALESCE(name, '\N'::text)), (COALESCE(description, '\N'::text)), (COALESCE(observationmeasure, '\N'::text)));


--
-- Name: methodtaxonclass_submethod_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX methodtaxonclass_submethod_id_idx ON methodtaxonclass USING btree (submethod_id);


--
-- Name: methodtaxonclass_taxonlabel_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX methodtaxonclass_taxonlabel_id_idx ON methodtaxonclass USING btree (taxonlabel_id);


--
-- Name: note_notelink_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX note_notelink_id_idx ON note USING btree (notelink_id);


--
-- Name: note_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX note_party_id_idx ON note USING btree (party_id);


--
-- Name: party_currentname_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX party_currentname_id_idx ON party USING btree (currentname_id);


--
-- Name: party_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX party_source_id_idx ON party USING btree (source_id);


--
-- Name: party_unique_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX party_unique_name ON party USING btree (source_id, (COALESCE(organizationname, '\N'::text)), (COALESCE(fullname, '\N'::text)), (COALESCE(surname, '\N'::text)), (COALESCE(givenname, '\N'::text)), (COALESCE(middlename, '\N'::text)), (COALESCE(suffix, '\N'::text))) WHERE (sourceaccessioncode IS NULL);


--
-- Name: party_unique_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX party_unique_sourceaccessioncode ON party USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: partymember_childparty_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX partymember_childparty_id_idx ON partymember USING btree (childparty_id);


--
-- Name: partymember_parentparty_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX partymember_parentparty_id_idx ON partymember USING btree (parentparty_id);


--
-- Name: place_canon_place_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX place_canon_place_id_idx ON place USING btree (canon_place_id);


--
-- Name: place_coordinates_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX place_coordinates_id_idx ON place USING btree (coordinates_id);


--
-- Name: place_matched_place_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX place_matched_place_id_idx ON place USING btree (matched_place_id);


--
-- Name: place_placename_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX place_placename_id_idx ON place USING btree (placename_id);


--
-- Name: place_unique_within_creator_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX place_unique_within_creator_by_name ON place USING btree (source_id, (COALESCE(continent, '\N'::text)), (COALESCE(country, '\N'::text)), (COALESCE(stateprovince, '\N'::text)), (COALESCE(county, '\N'::text)), (COALESCE(coordinates_id, 2147483647)));


--
-- Name: placecorrelation_childplace_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX placecorrelation_childplace_id_idx ON placecorrelation USING btree (childplace_id);


--
-- Name: placecorrelation_parentplace_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX placecorrelation_parentplace_id_idx ON placecorrelation USING btree (parentplace_id);


--
-- Name: placename_ancestor_ancestor_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX placename_ancestor_ancestor_id_idx ON placename_ancestor USING btree (ancestor_id);


--
-- Name: placename_parent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX placename_parent_id_idx ON placename USING btree (parent_id);


--
-- Name: placename_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX placename_unique ON placename USING btree ((COALESCE(parent_id, 2147483647)), placename, rank);


--
-- Name: plantobservation_aggregateoccurrence_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX plantobservation_aggregateoccurrence_1_to_1 ON plantobservation USING btree (aggregateoccurrence_id);


--
-- Name: plantobservation_plant_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantobservation_plant_id_idx ON plantobservation USING btree (plant_id);


--
-- Name: plantobservation_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plantobservation_source_id_idx ON plantobservation USING btree (source_id);


--
-- Name: plantobservation_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX plantobservation_unique_within_creator ON plantobservation USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: plot_source_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX plot_source_id ON location USING btree (source_id) WHERE (parent_id IS NULL);


--
-- Name: project_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX project_source_id_idx ON project USING btree (source_id);


--
-- Name: project_unique_name_date; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX project_unique_name_date ON project USING btree (source_id, (COALESCE(projectname, '\N'::text)), (COALESCE(startdate, 'infinity'::date))) WHERE (sourceaccessioncode IS NULL);


--
-- Name: project_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX project_unique_within_creator ON project USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: projectcontributor_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX projectcontributor_party_id_idx ON projectcontributor USING btree (party_id);


--
-- Name: projectcontributor_project_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX projectcontributor_project_id_idx ON projectcontributor USING btree (project_id);


--
-- Name: revision_previousrevision_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX revision_previousrevision_id_idx ON revision USING btree (previousrevision_id);


--
-- Name: soiltaxon_soilparent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX soiltaxon_soilparent_id_idx ON soiltaxon USING btree (soilparent_id);


--
-- Name: source_matched_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX source_matched_source_id_idx ON source USING btree (matched_source_id);


--
-- Name: source_parent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX source_parent_id_idx ON source USING btree (parent_id);


--
-- Name: source_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX source_unique ON source USING btree (shortname);


--
-- Name: sourcecontributor_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX sourcecontributor_source_id_idx ON sourcecontributor USING btree (source_id);


--
-- Name: sourcecontributor_sourceparty_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX sourcecontributor_sourceparty_id_idx ON sourcecontributor USING btree (sourceparty_id);


--
-- Name: sourcelist_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX sourcelist_unique ON sourcelist USING btree (source_id, name);


--
-- Name: sourcename_matched_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX sourcename_matched_source_id_idx ON sourcename USING btree (matched_source_id);


--
-- Name: specimenreplicate_duplicate_institutions_sourcelist_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX specimenreplicate_duplicate_institutions_sourcelist_id_idx ON specimenreplicate USING btree (duplicate_institutions_sourcelist_id);


--
-- Name: specimenreplicate_plantobservation; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX specimenreplicate_plantobservation ON specimenreplicate USING btree (plantobservation_id);


--
-- Name: specimenreplicate_plantobservation_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX specimenreplicate_plantobservation_1_to_1 ON specimenreplicate USING btree ((COALESCE(plantobservation_id, 2147483647))) WHERE (((plantobservation_id IS NOT NULL) AND (sourceaccessioncode IS NULL)) AND (catalognumber_dwc IS NULL));


--
-- Name: specimenreplicate_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX specimenreplicate_source_id_idx ON specimenreplicate USING btree (source_id);


--
-- Name: specimenreplicate_specimen_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX specimenreplicate_specimen_id_idx ON specimenreplicate USING btree (specimen_id);


--
-- Name: specimenreplicate_unique_catalognumber; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX specimenreplicate_unique_catalognumber ON specimenreplicate USING btree (source_id, (COALESCE(duplicate_institutions_sourcelist_id, 2147483647)), (COALESCE(collectioncode_dwc, '\N'::text)), (COALESCE(catalognumber_dwc, '\N'::text)), (COALESCE(plantobservation_id, 2147483647))) WHERE ((catalognumber_dwc IS NOT NULL) AND (sourceaccessioncode IS NULL));


--
-- Name: specimenreplicate_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX specimenreplicate_unique_within_creator ON specimenreplicate USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: stemobservation_plantobservation_1_to_1; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX stemobservation_plantobservation_1_to_1 ON stemobservation USING btree (plantobservation_id) WHERE ((sourceaccessioncode IS NULL) AND (authorstemcode IS NULL));


--
-- Name: stemobservation_plantobservation_id; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stemobservation_plantobservation_id ON stemobservation USING btree (plantobservation_id);


--
-- Name: stemobservation_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stemobservation_source_id_idx ON stemobservation USING btree (source_id);


--
-- Name: stemobservation_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX stemobservation_unique_within_creator ON stemobservation USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: stemobservation_unique_within_plantobservation; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX stemobservation_unique_within_plantobservation ON stemobservation USING btree (plantobservation_id, (COALESCE(authorstemcode, '\N'::text)), (COALESCE(tag, '\N'::text))) WHERE (sourceaccessioncode IS NULL);


--
-- Name: stratum_method_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX stratum_method_id_idx ON stratum USING btree (method_id);


--
-- Name: taxon_trait_scientificName_measurementType_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX "taxon_trait_scientificName_measurementType_idx" ON taxon_trait USING btree ("scientificName", "measurementType");


--
-- Name: taxonalt_taxondetermination_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonalt_taxondetermination_id_idx ON taxonalt USING btree (taxondetermination_id);


--
-- Name: taxonalt_taxonlabel_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonalt_taxonlabel_id_idx ON taxonalt USING btree (taxonlabel_id);


--
-- Name: taxonconcept_concept_reference_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonconcept_concept_reference_id_idx ON taxonconcept USING btree (concept_reference_id);


--
-- Name: taxoncorrelation_taxonlabel_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxoncorrelation_taxonlabel_id_idx ON taxoncorrelation USING btree (taxonlabel_id);


--
-- Name: taxoncorrelation_taxonstatus_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxoncorrelation_taxonstatus_id_idx ON taxoncorrelation USING btree (taxonstatus_id);


--
-- Name: taxondetermination_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_party_id_idx ON taxondetermination USING btree (party_id);


--
-- Name: taxondetermination_reference_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_reference_id_idx ON taxondetermination USING btree (reference_id);


--
-- Name: taxondetermination_single_accepted_determination; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxondetermination_single_accepted_determination ON taxondetermination USING btree (taxonoccurrence_id) WHERE (determinationtype = 'accepted'::text);


--
-- Name: taxondetermination_single_current_determination; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxondetermination_single_current_determination ON taxondetermination USING btree (taxonoccurrence_id) WHERE iscurrent;


--
-- Name: taxondetermination_single_matched_determination; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxondetermination_single_matched_determination ON taxondetermination USING btree (taxonoccurrence_id) WHERE (determinationtype = 'matched'::text);


--
-- Name: taxondetermination_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_source_id_idx ON taxondetermination USING btree (source_id);


--
-- Name: taxondetermination_taxonverbatim_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxondetermination_taxonverbatim_id_idx ON taxondetermination USING btree (taxonverbatim_id);


--
-- Name: taxondetermination_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxondetermination_unique ON taxondetermination USING btree (taxonoccurrence_id, source_id, (COALESCE(determinationtype, '\N'::text)), isoriginal, role, (COALESCE(party_id, 2147483647)), taxonverbatim_id);


--
-- Name: taxonlabel_0_unique_identifying_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxonlabel_0_unique_identifying_name ON taxonlabel USING btree (source_id, (COALESCE(taxonomicname, '\N'::text))) WHERE (taxonomicname IS NOT NULL);


--
-- Name: taxonlabel_1_unique_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxonlabel_1_unique_sourceaccessioncode ON taxonlabel USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: taxonlabel_canon_label_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonlabel_canon_label_id_idx ON taxonlabel USING btree (canon_label_id);


--
-- Name: taxonlabel_matched_label_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonlabel_matched_label_id_idx ON taxonlabel USING btree (matched_label_id);


--
-- Name: taxonlabel_parent_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonlabel_parent_id_idx ON taxonlabel USING btree (parent_id);


--
-- Name: taxonlabel_relationship_descendants; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonlabel_relationship_descendants ON taxonlabel_relationship USING btree (ancestor_id, descendant_id);


--
-- Name: taxonlabel_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonlabel_source_id_idx ON taxonlabel USING btree (source_id);


--
-- Name: taxonlabel_taxonomicname_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonlabel_taxonomicname_idx ON taxonlabel USING btree (taxonomicname) WHERE ((taxonomicname IS NOT NULL) AND "TNRS".taxon_name_is_safe(taxonomicname));


--
-- Name: taxonlabel_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxonlabel_unique ON taxonlabel USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(taxonepithet, '\N'::text)), (COALESCE(rank, 'unknown'::taxonrank)), source_id, (COALESCE(sourceaccessioncode, '\N'::text)), (COALESCE(taxonomicname, '\N'::text)));


--
-- Name: taxonlineage_childtaxonstatus_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonlineage_childtaxonstatus_id_idx ON taxonlineage USING btree (childtaxonstatus_id);


--
-- Name: taxonlineage_parenttaxonstatus_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonlineage_parenttaxonstatus_id_idx ON taxonlineage USING btree (parenttaxonstatus_id);


--
-- Name: taxonoccurrence_collector_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonoccurrence_collector_id_idx ON taxonoccurrence USING btree (collector_id);


--
-- Name: taxonoccurrence_locationevent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonoccurrence_locationevent ON taxonoccurrence USING btree (locationevent_id);


--
-- Name: taxonoccurrence_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonoccurrence_source_id_idx ON taxonoccurrence USING btree (source_id);


--
-- Name: taxonoccurrence_unique_within_creator; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxonoccurrence_unique_within_creator ON taxonoccurrence USING btree (source_id, (COALESCE(sourceaccessioncode, '\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);


--
-- Name: taxonoccurrence_unique_within_locationevent; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxonoccurrence_unique_within_locationevent ON taxonoccurrence USING btree ((COALESCE(locationevent_id, 2147483647)), (COALESCE(authortaxoncode, '\N'::text))) WHERE (sourceaccessioncode IS NULL);


--
-- Name: taxonstatus_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonstatus_party_id_idx ON taxonstatus USING btree (party_id);


--
-- Name: taxonstatus_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonstatus_source_id_idx ON taxonstatus USING btree (source_id);


--
-- Name: taxonverbatim_source_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonverbatim_source_id_idx ON taxonverbatim USING btree (source_id);


--
-- Name: taxonverbatim_taxonlabel_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX taxonverbatim_taxonlabel_id_idx ON taxonverbatim USING btree (taxonlabel_id);


--
-- Name: taxonverbatim_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX taxonverbatim_unique ON taxonverbatim USING btree ((COALESCE(taxonlabel_id, 2147483647)), (COALESCE(morphospecies, '\N'::text)), (COALESCE(morphoname, '\N'::text)));


--
-- Name: telephone_party_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX telephone_party_id_idx ON telephone USING btree (party_id);


--
-- Name: trait_unique; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE UNIQUE INDEX trait_unique ON trait USING btree (taxonoccurrence_id, name);


--
-- Name: voucher_specimenreplicate_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace: 
--

CREATE INDEX voucher_specimenreplicate_id_idx ON voucher USING btree (specimenreplicate_id);


--
-- Name: location__pull_forward_from_parent; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER location__pull_forward_from_parent BEFORE INSERT OR UPDATE OF location_id, parent_id ON location FOR EACH ROW WHEN ((new.parent_id IS NOT NULL)) EXECUTE PROCEDURE location__pull_forward_from_parent();


--
-- Name: location_set_plot_location_id; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER location_set_plot_location_id BEFORE INSERT OR UPDATE OF location_id, plot_location_id, parent_id ON location FOR EACH ROW EXECUTE PROCEDURE location_set_plot_location_id();


--
-- Name: locationevent_pull_forward_from_parent; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER locationevent_pull_forward_from_parent BEFORE INSERT OR UPDATE OF locationevent_id, parent_id ON locationevent FOR EACH ROW WHEN ((new.parent_id IS NOT NULL)) EXECUTE PROCEDURE locationevent_pull_forward_from_parent();


--
-- Name: locationevent_pull_forward_from_parent_for_stratum; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER locationevent_pull_forward_from_parent_for_stratum BEFORE INSERT OR UPDATE OF locationevent_id, parent_id ON locationevent FOR EACH ROW WHEN (((new.parent_id IS NOT NULL) AND (new.stratum_id IS NOT NULL))) EXECUTE PROCEDURE locationevent_pull_forward_from_parent_for_stratum();


--
-- Name: locationevent_set_place_visit_id; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER locationevent_set_place_visit_id BEFORE INSERT OR UPDATE OF locationevent_id, place_visit_id, parent_id ON locationevent FOR EACH ROW EXECUTE PROCEDURE locationevent_set_place_visit_id();


--
-- Name: locationevent_set_plot_id; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER locationevent_set_plot_id BEFORE INSERT OR UPDATE OF locationevent_id, plot_id, location_id ON locationevent FOR EACH ROW EXECUTE PROCEDURE locationevent_set_plot_id();


--
-- Name: locationplace__set_location_current_place; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER locationplace__set_location_current_place AFTER INSERT ON locationplace FOR EACH ROW EXECUTE PROCEDURE locationplace__set_location_current_place();


--
-- Name: party_source_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER party_source_id_self_ref BEFORE INSERT OR UPDATE ON party FOR EACH ROW EXECUTE PROCEDURE party_source_id_self_ref();


--
-- Name: place_matched_place_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER place_matched_place_id_self_ref BEFORE INSERT OR UPDATE ON place FOR EACH ROW EXECUTE PROCEDURE place_matched_place_id_self_ref();


--
-- Name: place_set_canon_place_id_on_insert; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER place_set_canon_place_id_on_insert BEFORE INSERT ON place FOR EACH ROW EXECUTE PROCEDURE place_set_canon_place_id_on_insert();


--
-- Name: place_set_canon_place_id_on_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER place_set_canon_place_id_on_update BEFORE UPDATE ON place FOR EACH ROW EXECUTE PROCEDURE place_set_canon_place_id_on_update();


--
-- Name: placename_update_ancestors; Type: TRIGGER; Schema: public; Owner: -
--

CREATE CONSTRAINT TRIGGER placename_update_ancestors AFTER INSERT OR UPDATE ON placename DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE PROCEDURE placename_update_ancestors();


--
-- Name: plantobservation_aggregateoccurrence_count_1; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER plantobservation_aggregateoccurrence_count_1 AFTER INSERT OR UPDATE ON plantobservation FOR EACH ROW EXECUTE PROCEDURE plantobservation_aggregateoccurrence_count_1();


--
-- Name: sourcename_set_matched_source_id; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER sourcename_set_matched_source_id BEFORE INSERT OR UPDATE ON sourcename FOR EACH ROW EXECUTE PROCEDURE sourcename_set_matched_source_id();


--
-- Name: taxondetermination_set_iscurrent_on_delete; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER taxondetermination_set_iscurrent_on_delete AFTER DELETE ON taxondetermination FOR EACH ROW EXECUTE PROCEDURE taxondetermination_set_iscurrent_on_delete();


--
-- Name: taxondetermination_set_iscurrent_on_insert; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER taxondetermination_set_iscurrent_on_insert AFTER INSERT ON taxondetermination FOR EACH ROW EXECUTE PROCEDURE taxondetermination_set_iscurrent_on_insert();


--
-- Name: taxonlabel_0_matched_label_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER taxonlabel_0_matched_label_id_self_ref BEFORE INSERT OR UPDATE ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_0_matched_label_id_self_ref();


--
-- Name: taxonlabel_2_set_canon_label_id_on_insert; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER taxonlabel_2_set_canon_label_id_on_insert BEFORE INSERT ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_2_set_canon_label_id_on_insert();


--
-- Name: taxonlabel_2_set_canon_label_id_on_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER taxonlabel_2_set_canon_label_id_on_update BEFORE UPDATE ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_2_set_canon_label_id_on_update();


--
-- Name: taxonlabel_3_parent_id_avoid_self_ref; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER taxonlabel_3_parent_id_avoid_self_ref BEFORE INSERT OR UPDATE ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_3_parent_id_avoid_self_ref();


--
-- Name: taxonlabel_update_ancestors_on_insert; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER taxonlabel_update_ancestors_on_insert AFTER INSERT ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_update_ancestors_on_insert();


--
-- Name: taxonlabel_update_ancestors_on_update; Type: TRIGGER; Schema: public; Owner: -
--

CREATE TRIGGER taxonlabel_update_ancestors_on_update AFTER UPDATE ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_update_ancestors_on_update();


--
-- Name: address_organization_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY address
    ADD CONSTRAINT address_organization_id_fkey FOREIGN KEY (organization_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: address_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY address
    ADD CONSTRAINT address_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: aggregateoccurrence_coverindex_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_coverindex_id_fkey FOREIGN KEY (coverindex_id) REFERENCES coverindex(coverindex_id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: aggregateoccurrence_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_method_id_fkey FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: aggregateoccurrence_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: aggregateoccurrence_stratum_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_stratum_id_fkey FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: aggregateoccurrence_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY aggregateoccurrence
    ADD CONSTRAINT aggregateoccurrence_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: classcontributor_commclass_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY classcontributor
    ADD CONSTRAINT classcontributor_commclass_id_fkey FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: classcontributor_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY classcontributor
    ADD CONSTRAINT classcontributor_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commclass_classpublication_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commclass
    ADD CONSTRAINT commclass_classpublication_id_fkey FOREIGN KEY (classpublication_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commclass_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commclass
    ADD CONSTRAINT commclass_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commconcept_commname_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commconcept
    ADD CONSTRAINT commconcept_commname_id_fkey FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commconcept_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commconcept
    ADD CONSTRAINT commconcept_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commcorrelation_commconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commcorrelation
    ADD CONSTRAINT commcorrelation_commconcept_id_fkey FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commcorrelation_commstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commcorrelation
    ADD CONSTRAINT commcorrelation_commstatus_id_fkey FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commdetermination_commauthority_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commdetermination
    ADD CONSTRAINT commdetermination_commauthority_id_fkey FOREIGN KEY (commauthority_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commdetermination_commclass_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commdetermination
    ADD CONSTRAINT commdetermination_commclass_id_fkey FOREIGN KEY (commclass_id) REFERENCES commclass(commclass_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commdetermination_commconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commdetermination
    ADD CONSTRAINT commdetermination_commconcept_id_fkey FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commlineage_childcommstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commlineage
    ADD CONSTRAINT commlineage_childcommstatus_id_fkey FOREIGN KEY (childcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commlineage_parentcommstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commlineage
    ADD CONSTRAINT commlineage_parentcommstatus_id_fkey FOREIGN KEY (parentcommstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commname_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commname
    ADD CONSTRAINT commname_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commstatus_commconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT commstatus_commconcept_id_fkey FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commstatus_commparent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT commstatus_commparent_id_fkey FOREIGN KEY (commparent_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commstatus_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT commstatus_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commstatus_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commstatus
    ADD CONSTRAINT commstatus_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commusage_commconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commusage
    ADD CONSTRAINT commusage_commconcept_id_fkey FOREIGN KEY (commconcept_id) REFERENCES commconcept(commconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commusage_commname_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commusage
    ADD CONSTRAINT commusage_commname_id_fkey FOREIGN KEY (commname_id) REFERENCES commname(commname_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commusage_commstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commusage
    ADD CONSTRAINT commusage_commstatus_id_fkey FOREIGN KEY (commstatus_id) REFERENCES commstatus(commstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: commusage_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY commusage
    ADD CONSTRAINT commusage_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: coordinates_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY coordinates
    ADD CONSTRAINT coordinates_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: coverindex_covermethod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY coverindex
    ADD CONSTRAINT coverindex_covermethod_id_fkey FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: covermethod_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY covermethod
    ADD CONSTRAINT covermethod_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: definedvalue_userdefined_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY definedvalue
    ADD CONSTRAINT definedvalue_userdefined_id_fkey FOREIGN KEY (userdefined_id) REFERENCES userdefined(userdefined_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: disturbanceobs_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY disturbanceobs
    ADD CONSTRAINT disturbanceobs_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: graphic_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY graphic
    ADD CONSTRAINT graphic_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: location_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY location
    ADD CONSTRAINT location_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: location_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY location
    ADD CONSTRAINT location_place_id_fkey FOREIGN KEY (place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: location_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY location
    ADD CONSTRAINT location_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_location_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_location_id_fkey FOREIGN KEY (location_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_method_id_fkey FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_place_visit_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_place_visit_id_fkey FOREIGN KEY (place_visit_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_plot_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_plot_id_fkey FOREIGN KEY (plot_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_previous_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_previous_id_fkey FOREIGN KEY (previous_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_soiltaxon_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_soiltaxon_id_fkey FOREIGN KEY (soiltaxon_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationevent_stratum_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationevent
    ADD CONSTRAINT locationevent_stratum_id_fkey FOREIGN KEY (stratum_id) REFERENCES stratum(stratum_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventcontributor_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationeventcontributor
    ADD CONSTRAINT locationeventcontributor_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventcontributor_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationeventcontributor
    ADD CONSTRAINT locationeventcontributor_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventsynonym_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationeventsynonym
    ADD CONSTRAINT locationeventsynonym_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventsynonym_primarylocationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationeventsynonym
    ADD CONSTRAINT locationeventsynonym_primarylocationevent_id_fkey FOREIGN KEY (primarylocationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationeventsynonym_synonymlocationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationeventsynonym
    ADD CONSTRAINT locationeventsynonym_synonymlocationevent_id_fkey FOREIGN KEY (synonymlocationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationplace_identifier_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationplace
    ADD CONSTRAINT locationplace_identifier_id_fkey FOREIGN KEY (identifier_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationplace_location_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationplace
    ADD CONSTRAINT locationplace_location_id_fkey FOREIGN KEY (location_id) REFERENCES location(location_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: locationplace_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY locationplace
    ADD CONSTRAINT locationplace_place_id_fkey FOREIGN KEY (place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: method_covermethod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY method
    ADD CONSTRAINT method_covermethod_id_fkey FOREIGN KEY (covermethod_id) REFERENCES covermethod(covermethod_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: method_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY method
    ADD CONSTRAINT method_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: method_subplotmethod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY method
    ADD CONSTRAINT method_subplotmethod_id_fkey FOREIGN KEY (subplotmethod_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: methodtaxonclass_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY methodtaxonclass
    ADD CONSTRAINT methodtaxonclass_method_id_fkey FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: methodtaxonclass_submethod_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY methodtaxonclass
    ADD CONSTRAINT methodtaxonclass_submethod_id_fkey FOREIGN KEY (submethod_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE SET NULL;


--
-- Name: methodtaxonclass_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY methodtaxonclass
    ADD CONSTRAINT methodtaxonclass_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: note_notelink_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY note
    ADD CONSTRAINT note_notelink_id_fkey FOREIGN KEY (notelink_id) REFERENCES notelink(notelink_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: note_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY note
    ADD CONSTRAINT note_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: party_currentname_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY party
    ADD CONSTRAINT party_currentname_id_fkey FOREIGN KEY (currentname_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: party_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY party
    ADD CONSTRAINT party_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: partymember_childparty_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY partymember
    ADD CONSTRAINT partymember_childparty_id_fkey FOREIGN KEY (childparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: partymember_parentparty_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY partymember
    ADD CONSTRAINT partymember_parentparty_id_fkey FOREIGN KEY (parentparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: place_canon_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY place
    ADD CONSTRAINT place_canon_place_id_fkey FOREIGN KEY (canon_place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: place_coordinates_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY place
    ADD CONSTRAINT place_coordinates_id_fkey FOREIGN KEY (coordinates_id) REFERENCES coordinates(coordinates_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: place_matched_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY place
    ADD CONSTRAINT place_matched_place_id_fkey FOREIGN KEY (matched_place_id) REFERENCES place(place_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: place_placename_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY place
    ADD CONSTRAINT place_placename_id_fkey FOREIGN KEY (placename_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: place_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY place
    ADD CONSTRAINT place_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: placecorrelation_childplace_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY placecorrelation
    ADD CONSTRAINT placecorrelation_childplace_id_fkey FOREIGN KEY (childplace_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: placecorrelation_parentplace_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY placecorrelation
    ADD CONSTRAINT placecorrelation_parentplace_id_fkey FOREIGN KEY (parentplace_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: placename_ancestor_ancestor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY placename_ancestor
    ADD CONSTRAINT placename_ancestor_ancestor_id_fkey FOREIGN KEY (ancestor_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: placename_ancestor_place_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY placename_ancestor
    ADD CONSTRAINT placename_ancestor_place_id_fkey FOREIGN KEY (placename_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: placename_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY placename
    ADD CONSTRAINT placename_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES placename(placename_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantobservation_aggregateoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plantobservation
    ADD CONSTRAINT plantobservation_aggregateoccurrence_id_fkey FOREIGN KEY (aggregateoccurrence_id) REFERENCES aggregateoccurrence(aggregateoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantobservation_plant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plantobservation
    ADD CONSTRAINT plantobservation_plant_id_fkey FOREIGN KEY (plant_id) REFERENCES plant(plant_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: plantobservation_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY plantobservation
    ADD CONSTRAINT plantobservation_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: project_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY project
    ADD CONSTRAINT project_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: projectcontributor_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY projectcontributor
    ADD CONSTRAINT projectcontributor_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: projectcontributor_project_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY projectcontributor
    ADD CONSTRAINT projectcontributor_project_id_fkey FOREIGN KEY (project_id) REFERENCES project(project_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: revision_previousrevision_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY revision
    ADD CONSTRAINT revision_previousrevision_id_fkey FOREIGN KEY (previousrevision_id) REFERENCES revision(revision_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: soilsample_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY soilsample
    ADD CONSTRAINT soilsample_locationevent_id_fkey FOREIGN KEY (locationevent_id) REFERENCES locationevent(locationevent_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: soiltaxon_soilparent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY soiltaxon
    ADD CONSTRAINT soiltaxon_soilparent_id_fkey FOREIGN KEY (soilparent_id) REFERENCES soiltaxon(soiltaxon_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: source_matched_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY source
    ADD CONSTRAINT source_matched_source_id_fkey FOREIGN KEY (matched_source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: source_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY source
    ADD CONSTRAINT source_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sourcecontributor_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY sourcecontributor
    ADD CONSTRAINT sourcecontributor_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sourcecontributor_sourceparty_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY sourcecontributor
    ADD CONSTRAINT sourcecontributor_sourceparty_id_fkey FOREIGN KEY (sourceparty_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sourcelist_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY sourcelist
    ADD CONSTRAINT sourcelist_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sourcename_matched_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY sourcename
    ADD CONSTRAINT sourcename_matched_source_id_fkey FOREIGN KEY (matched_source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: sourcename_sourcelist_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY sourcename
    ADD CONSTRAINT sourcename_sourcelist_id_fkey FOREIGN KEY (sourcelist_id) REFERENCES sourcelist(sourcelist_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimenreplicate_duplicate_institutions_sourcelist_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimenreplicate
    ADD CONSTRAINT specimenreplicate_duplicate_institutions_sourcelist_id_fkey FOREIGN KEY (duplicate_institutions_sourcelist_id) REFERENCES sourcelist(sourcelist_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimenreplicate_plantobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimenreplicate
    ADD CONSTRAINT specimenreplicate_plantobservation_id_fkey FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimenreplicate_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimenreplicate
    ADD CONSTRAINT specimenreplicate_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: specimenreplicate_specimen_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY specimenreplicate
    ADD CONSTRAINT specimenreplicate_specimen_id_fkey FOREIGN KEY (specimen_id) REFERENCES specimen(specimen_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stemobservation_plantobservation_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY stemobservation
    ADD CONSTRAINT stemobservation_plantobservation_id_fkey FOREIGN KEY (plantobservation_id) REFERENCES plantobservation(plantobservation_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stemobservation_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY stemobservation
    ADD CONSTRAINT stemobservation_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stratum_method_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY stratum
    ADD CONSTRAINT stratum_method_id_fkey FOREIGN KEY (method_id) REFERENCES method(method_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: stratum_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY stratum
    ADD CONSTRAINT stratum_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonalt_taxondetermination_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonalt
    ADD CONSTRAINT taxonalt_taxondetermination_id_fkey FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonalt_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonalt
    ADD CONSTRAINT taxonalt_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonconcept_concept_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonconcept
    ADD CONSTRAINT taxonconcept_concept_reference_id_fkey FOREIGN KEY (concept_reference_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonconcept_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

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


--
-- Name: taxoncorrelation_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxoncorrelation
    ADD CONSTRAINT taxoncorrelation_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxoncorrelation_taxonstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxoncorrelation
    ADD CONSTRAINT taxoncorrelation_taxonstatus_id_fkey FOREIGN KEY (taxonstatus_id) REFERENCES taxonstatus(taxonstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxondetermination_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

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


--
-- Name: taxondetermination_taxonverbatim_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxondetermination
    ADD CONSTRAINT taxondetermination_taxonverbatim_id_fkey FOREIGN KEY (taxonverbatim_id) REFERENCES taxonverbatim(taxonverbatim_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonlabel_canon_label_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlabel
    ADD CONSTRAINT taxonlabel_canon_label_id_fkey FOREIGN KEY (canon_label_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonlabel_matched_label_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlabel
    ADD CONSTRAINT taxonlabel_matched_label_id_fkey FOREIGN KEY (matched_label_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonlabel_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlabel
    ADD CONSTRAINT taxonlabel_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonlabel_relationship_ancestor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlabel_relationship
    ADD CONSTRAINT taxonlabel_relationship_ancestor_id_fkey FOREIGN KEY (ancestor_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonlabel_relationship_descendant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlabel_relationship
    ADD CONSTRAINT taxonlabel_relationship_descendant_id_fkey FOREIGN KEY (descendant_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonlabel_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlabel
    ADD CONSTRAINT taxonlabel_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonlineage_childtaxonstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlineage
    ADD CONSTRAINT taxonlineage_childtaxonstatus_id_fkey FOREIGN KEY (childtaxonstatus_id) REFERENCES taxonstatus(taxonstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonlineage_parenttaxonstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonlineage
    ADD CONSTRAINT taxonlineage_parenttaxonstatus_id_fkey FOREIGN KEY (parenttaxonstatus_id) REFERENCES taxonstatus(taxonstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonoccurrence_collector_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonoccurrence
    ADD CONSTRAINT taxonoccurrence_collector_id_fkey FOREIGN KEY (collector_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonoccurrence_locationevent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

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


--
-- Name: taxonoccurrence_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonoccurrence
    ADD CONSTRAINT taxonoccurrence_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonstatus_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonstatus
    ADD CONSTRAINT taxonstatus_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonstatus_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonstatus
    ADD CONSTRAINT taxonstatus_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonstatus_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonstatus
    ADD CONSTRAINT taxonstatus_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonverbatim_source_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonverbatim
    ADD CONSTRAINT taxonverbatim_source_id_fkey FOREIGN KEY (source_id) REFERENCES source(source_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: taxonverbatim_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY taxonverbatim
    ADD CONSTRAINT taxonverbatim_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: telephone_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY telephone
    ADD CONSTRAINT telephone_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: trait_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY trait
    ADD CONSTRAINT trait_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: voucher_specimenreplicate_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY voucher
    ADD CONSTRAINT voucher_specimenreplicate_id_fkey FOREIGN KEY (specimenreplicate_id) REFERENCES specimenreplicate(specimenreplicate_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: voucher_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY voucher
    ADD CONSTRAINT voucher_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;


--
-- Name: public; Type: ACL; Schema: -; Owner: -
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM bien;
GRANT ALL ON SCHEMA public TO bien;
GRANT USAGE ON SCHEMA public TO bien_read;
GRANT USAGE ON SCHEMA public TO public_;


--
-- Name: public_validations; Type: ACL; Schema: -; Owner: -
--

REVOKE ALL ON SCHEMA public_validations FROM PUBLIC;
REVOKE ALL ON SCHEMA public_validations FROM bien;
GRANT ALL ON SCHEMA public_validations TO bien;
GRANT USAGE ON SCHEMA public_validations TO bien_read;
GRANT USAGE ON SCHEMA public_validations TO public_;


--
-- Name: place; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE place FROM PUBLIC;
REVOKE ALL ON TABLE place FROM bien;
GRANT ALL ON TABLE place TO bien;
GRANT SELECT ON TABLE place TO bien_read;


--
-- Name: taxonlabel; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxonlabel FROM PUBLIC;
REVOKE ALL ON TABLE taxonlabel FROM bien;
GRANT ALL ON TABLE taxonlabel TO bien;
GRANT SELECT ON TABLE taxonlabel TO bien_read;


--
-- Name: analytical_stem; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE analytical_stem FROM PUBLIC;
REVOKE ALL ON TABLE analytical_stem FROM bien;
GRANT ALL ON TABLE analytical_stem TO bien;
GRANT SELECT ON TABLE analytical_stem TO bien_read;


--
-- Name: 2013-10-18.Brian_Enquist.Canadensys; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE "2013-10-18.Brian_Enquist.Canadensys" FROM PUBLIC;
REVOKE ALL ON TABLE "2013-10-18.Brian_Enquist.Canadensys" FROM bien;
GRANT ALL ON TABLE "2013-10-18.Brian_Enquist.Canadensys" TO bien;
GRANT SELECT ON TABLE "2013-10-18.Brian_Enquist.Canadensys" TO bien_read;


--
-- Name: 2013-7-10.Naia.range_limiting_factors; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE "2013-7-10.Naia.range_limiting_factors" FROM PUBLIC;
REVOKE ALL ON TABLE "2013-7-10.Naia.range_limiting_factors" FROM bien;
GRANT ALL ON TABLE "2013-7-10.Naia.range_limiting_factors" TO bien;
GRANT SELECT ON TABLE "2013-7-10.Naia.range_limiting_factors" TO bien_read;


--
-- Name: 2014-3-11.Jeff_Ott.climatic_range_determinants; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE "2014-3-11.Jeff_Ott.climatic_range_determinants" FROM PUBLIC;
REVOKE ALL ON TABLE "2014-3-11.Jeff_Ott.climatic_range_determinants" FROM bien;
GRANT ALL ON TABLE "2014-3-11.Jeff_Ott.climatic_range_determinants" TO bien;
GRANT SELECT ON TABLE "2014-3-11.Jeff_Ott.climatic_range_determinants" TO bien_read;


--
-- Name: 2014-6-12.Jeff_Ott.climatic_range_determinants; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE "2014-6-12.Jeff_Ott.climatic_range_determinants" FROM PUBLIC;
REVOKE ALL ON TABLE "2014-6-12.Jeff_Ott.climatic_range_determinants" FROM bien;
GRANT ALL ON TABLE "2014-6-12.Jeff_Ott.climatic_range_determinants" TO bien;
GRANT SELECT ON TABLE "2014-6-12.Jeff_Ott.climatic_range_determinants" TO bien_read;


--
-- Name: source; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE source FROM PUBLIC;
REVOKE ALL ON TABLE source FROM bien;
GRANT ALL ON TABLE source TO bien;
GRANT SELECT ON TABLE source TO bien_read;
GRANT SELECT ON TABLE source TO public_;


--
-- Name: 2014-6-4.Iara_Lacher.reserve_prioritization; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE "2014-6-4.Iara_Lacher.reserve_prioritization" FROM PUBLIC;
REVOKE ALL ON TABLE "2014-6-4.Iara_Lacher.reserve_prioritization" FROM bien;
GRANT ALL ON TABLE "2014-6-4.Iara_Lacher.reserve_prioritization" TO bien;
GRANT SELECT ON TABLE "2014-6-4.Iara_Lacher.reserve_prioritization" TO bien_read;


--
-- Name: address; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE address FROM PUBLIC;
REVOKE ALL ON TABLE address FROM bien;
GRANT ALL ON TABLE address TO bien;
GRANT SELECT ON TABLE address TO bien_read;


--
-- Name: aggregateoccurrence; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE aggregateoccurrence FROM PUBLIC;
REVOKE ALL ON TABLE aggregateoccurrence FROM bien;
GRANT ALL ON TABLE aggregateoccurrence TO bien;
GRANT SELECT ON TABLE aggregateoccurrence TO bien_read;


--
-- Name: analytical_plot; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE analytical_plot FROM PUBLIC;
REVOKE ALL ON TABLE analytical_plot FROM bien;
GRANT ALL ON TABLE analytical_plot TO bien;
GRANT SELECT ON TABLE analytical_plot TO bien_read;


--
-- Name: analytical_specimen; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE analytical_specimen FROM PUBLIC;
REVOKE ALL ON TABLE analytical_specimen FROM bien;
GRANT ALL ON TABLE analytical_specimen TO bien;
GRANT SELECT ON TABLE analytical_specimen TO bien_read;


--
-- Name: coordinates; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE coordinates FROM PUBLIC;
REVOKE ALL ON TABLE coordinates FROM bien;
GRANT ALL ON TABLE coordinates TO bien;
GRANT SELECT ON TABLE coordinates TO bien_read;


--
-- Name: cultivated_family_locations; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE cultivated_family_locations FROM PUBLIC;
REVOKE ALL ON TABLE cultivated_family_locations FROM bien;
GRANT ALL ON TABLE cultivated_family_locations TO bien;
GRANT SELECT ON TABLE cultivated_family_locations TO bien_read;
GRANT SELECT ON TABLE cultivated_family_locations TO public_;


--
-- Name: family_higher_plant_group; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE family_higher_plant_group FROM PUBLIC;
REVOKE ALL ON TABLE family_higher_plant_group FROM bien;
GRANT ALL ON TABLE family_higher_plant_group TO bien;
GRANT SELECT ON TABLE family_higher_plant_group TO bien_read;


--
-- Name: location; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE location FROM PUBLIC;
REVOKE ALL ON TABLE location FROM bien;
GRANT ALL ON TABLE location TO bien;
GRANT SELECT ON TABLE location TO bien_read;


--
-- Name: locationevent; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE locationevent FROM PUBLIC;
REVOKE ALL ON TABLE locationevent FROM bien;
GRANT ALL ON TABLE locationevent TO bien;
GRANT SELECT ON TABLE locationevent TO bien_read;


--
-- Name: method; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE method FROM PUBLIC;
REVOKE ALL ON TABLE method FROM bien;
GRANT ALL ON TABLE method TO bien;
GRANT SELECT ON TABLE method TO bien_read;


--
-- Name: party; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE party FROM PUBLIC;
REVOKE ALL ON TABLE party FROM bien;
GRANT ALL ON TABLE party TO bien;
GRANT SELECT ON TABLE party TO bien_read;


--
-- Name: plantobservation; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE plantobservation FROM PUBLIC;
REVOKE ALL ON TABLE plantobservation FROM bien;
GRANT ALL ON TABLE plantobservation TO bien;
GRANT SELECT ON TABLE plantobservation TO bien_read;


--
-- Name: project; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE project FROM PUBLIC;
REVOKE ALL ON TABLE project FROM bien;
GRANT ALL ON TABLE project TO bien;
GRANT SELECT ON TABLE project TO bien_read;


--
-- Name: stratum; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE stratum FROM PUBLIC;
REVOKE ALL ON TABLE stratum FROM bien;
GRANT ALL ON TABLE stratum TO bien;
GRANT SELECT ON TABLE stratum TO bien_read;


--
-- Name: plot.**; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE "plot.**" FROM PUBLIC;
REVOKE ALL ON TABLE "plot.**" FROM bien;
GRANT ALL ON TABLE "plot.**" TO bien;
GRANT SELECT ON TABLE "plot.**" TO bien_read;


--
-- Name: sourcelist; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE sourcelist FROM PUBLIC;
REVOKE ALL ON TABLE sourcelist FROM bien;
GRANT ALL ON TABLE sourcelist TO bien;
GRANT SELECT ON TABLE sourcelist TO bien_read;


--
-- Name: specimenreplicate; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE specimenreplicate FROM PUBLIC;
REVOKE ALL ON TABLE specimenreplicate FROM bien;
GRANT ALL ON TABLE specimenreplicate TO bien;
GRANT SELECT ON TABLE specimenreplicate TO bien_read;


--
-- Name: stemobservation; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE stemobservation FROM PUBLIC;
REVOKE ALL ON TABLE stemobservation FROM bien;
GRANT ALL ON TABLE stemobservation TO bien;
GRANT SELECT ON TABLE stemobservation TO bien_read;


--
-- Name: taxondetermination; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxondetermination FROM PUBLIC;
REVOKE ALL ON TABLE taxondetermination FROM bien;
GRANT ALL ON TABLE taxondetermination TO bien;
GRANT SELECT ON TABLE taxondetermination TO bien_read;


--
-- Name: taxonoccurrence; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxonoccurrence FROM PUBLIC;
REVOKE ALL ON TABLE taxonoccurrence FROM bien;
GRANT ALL ON TABLE taxonoccurrence TO bien;
GRANT SELECT ON TABLE taxonoccurrence TO bien_read;


--
-- Name: taxonverbatim; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxonverbatim FROM PUBLIC;
REVOKE ALL ON TABLE taxonverbatim FROM bien;
GRANT ALL ON TABLE taxonverbatim TO bien;
GRANT SELECT ON TABLE taxonverbatim TO bien_read;


--
-- Name: analytical_stem_view; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE analytical_stem_view FROM PUBLIC;
REVOKE ALL ON TABLE analytical_stem_view FROM bien;
GRANT ALL ON TABLE analytical_stem_view TO bien;
GRANT SELECT ON TABLE analytical_stem_view TO bien_read;


--
-- Name: classcontributor; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE classcontributor FROM PUBLIC;
REVOKE ALL ON TABLE classcontributor FROM bien;
GRANT ALL ON TABLE classcontributor TO bien;
GRANT SELECT ON TABLE classcontributor TO bien_read;


--
-- Name: collected_dates; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE collected_dates FROM PUBLIC;
REVOKE ALL ON TABLE collected_dates FROM bien;
GRANT ALL ON TABLE collected_dates TO bien;
GRANT SELECT ON TABLE collected_dates TO bien_read;
GRANT SELECT ON TABLE collected_dates TO public_;


--
-- Name: commclass; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE commclass FROM PUBLIC;
REVOKE ALL ON TABLE commclass FROM bien;
GRANT ALL ON TABLE commclass TO bien;
GRANT SELECT ON TABLE commclass TO bien_read;


--
-- Name: commconcept; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE commconcept FROM PUBLIC;
REVOKE ALL ON TABLE commconcept FROM bien;
GRANT ALL ON TABLE commconcept TO bien;
GRANT SELECT ON TABLE commconcept TO bien_read;


--
-- Name: commcorrelation; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE commcorrelation FROM PUBLIC;
REVOKE ALL ON TABLE commcorrelation FROM bien;
GRANT ALL ON TABLE commcorrelation TO bien;
GRANT SELECT ON TABLE commcorrelation TO bien_read;


--
-- Name: commdetermination; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE commdetermination FROM PUBLIC;
REVOKE ALL ON TABLE commdetermination FROM bien;
GRANT ALL ON TABLE commdetermination TO bien;
GRANT SELECT ON TABLE commdetermination TO bien_read;


--
-- Name: commlineage; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE commlineage FROM PUBLIC;
REVOKE ALL ON TABLE commlineage FROM bien;
GRANT ALL ON TABLE commlineage TO bien;
GRANT SELECT ON TABLE commlineage TO bien_read;


--
-- Name: commname; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE commname FROM PUBLIC;
REVOKE ALL ON TABLE commname FROM bien;
GRANT ALL ON TABLE commname TO bien;
GRANT SELECT ON TABLE commname TO bien_read;


--
-- Name: commstatus; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE commstatus FROM PUBLIC;
REVOKE ALL ON TABLE commstatus FROM bien;
GRANT ALL ON TABLE commstatus TO bien;
GRANT SELECT ON TABLE commstatus TO bien_read;


--
-- Name: commusage; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE commusage FROM PUBLIC;
REVOKE ALL ON TABLE commusage FROM bien;
GRANT ALL ON TABLE commusage TO bien;
GRANT SELECT ON TABLE commusage TO bien_read;


--
-- Name: coverindex; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE coverindex FROM PUBLIC;
REVOKE ALL ON TABLE coverindex FROM bien;
GRANT ALL ON TABLE coverindex TO bien;
GRANT SELECT ON TABLE coverindex TO bien_read;


--
-- Name: covermethod; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE covermethod FROM PUBLIC;
REVOKE ALL ON TABLE covermethod FROM bien;
GRANT ALL ON TABLE covermethod TO bien;
GRANT SELECT ON TABLE covermethod TO bien_read;


--
-- Name: definedvalue; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE definedvalue FROM PUBLIC;
REVOKE ALL ON TABLE definedvalue FROM bien;
GRANT ALL ON TABLE definedvalue TO bien;
GRANT SELECT ON TABLE definedvalue TO bien_read;


--
-- Name: disturbanceobs; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE disturbanceobs FROM PUBLIC;
REVOKE ALL ON TABLE disturbanceobs FROM bien;
GRANT ALL ON TABLE disturbanceobs TO bien;
GRANT SELECT ON TABLE disturbanceobs TO bien_read;


--
-- Name: geoscrub_input; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE geoscrub_input FROM PUBLIC;
REVOKE ALL ON TABLE geoscrub_input FROM bien;
GRANT ALL ON TABLE geoscrub_input TO bien;
GRANT SELECT ON TABLE geoscrub_input TO bien_read;


--
-- Name: geoscrub_input_new; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE geoscrub_input_new FROM PUBLIC;
REVOKE ALL ON TABLE geoscrub_input_new FROM bien;
GRANT ALL ON TABLE geoscrub_input_new TO bien;
GRANT SELECT ON TABLE geoscrub_input_new TO bien_read;


--
-- Name: geoscrub_input_view; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE geoscrub_input_view FROM PUBLIC;
REVOKE ALL ON TABLE geoscrub_input_view FROM bien;
GRANT ALL ON TABLE geoscrub_input_view TO bien;
GRANT SELECT ON TABLE geoscrub_input_view TO bien_read;


--
-- Name: graphic; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE graphic FROM PUBLIC;
REVOKE ALL ON TABLE graphic FROM bien;
GRANT ALL ON TABLE graphic TO bien;
GRANT SELECT ON TABLE graphic TO bien_read;


--
-- Name: higher_plant_group_nodes; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE higher_plant_group_nodes FROM PUBLIC;
REVOKE ALL ON TABLE higher_plant_group_nodes FROM bien;
GRANT ALL ON TABLE higher_plant_group_nodes TO bien;
GRANT SELECT ON TABLE higher_plant_group_nodes TO bien_read;
GRANT SELECT ON TABLE higher_plant_group_nodes TO public_;


--
-- Name: iucn_red_list_view; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE iucn_red_list_view FROM PUBLIC;
REVOKE ALL ON TABLE iucn_red_list_view FROM bien;
GRANT ALL ON TABLE iucn_red_list_view TO bien;
GRANT SELECT ON TABLE iucn_red_list_view TO bien_read;


--
-- Name: locationeventcontributor; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE locationeventcontributor FROM PUBLIC;
REVOKE ALL ON TABLE locationeventcontributor FROM bien;
GRANT ALL ON TABLE locationeventcontributor TO bien;
GRANT SELECT ON TABLE locationeventcontributor TO bien_read;


--
-- Name: locationeventsynonym; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE locationeventsynonym FROM PUBLIC;
REVOKE ALL ON TABLE locationeventsynonym FROM bien;
GRANT ALL ON TABLE locationeventsynonym TO bien;
GRANT SELECT ON TABLE locationeventsynonym TO bien_read;


--
-- Name: locationplace; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE locationplace FROM PUBLIC;
REVOKE ALL ON TABLE locationplace FROM bien;
GRANT ALL ON TABLE locationplace TO bien;
GRANT SELECT ON TABLE locationplace TO bien_read;


--
-- Name: methodtaxonclass; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE methodtaxonclass FROM PUBLIC;
REVOKE ALL ON TABLE methodtaxonclass FROM bien;
GRANT ALL ON TABLE methodtaxonclass TO bien;
GRANT SELECT ON TABLE methodtaxonclass TO bien_read;


--
-- Name: note; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE note FROM PUBLIC;
REVOKE ALL ON TABLE note FROM bien;
GRANT ALL ON TABLE note TO bien;
GRANT SELECT ON TABLE note TO bien_read;


--
-- Name: notelink; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE notelink FROM PUBLIC;
REVOKE ALL ON TABLE notelink FROM bien;
GRANT ALL ON TABLE notelink TO bien;
GRANT SELECT ON TABLE notelink TO bien_read;


--
-- Name: partymember; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE partymember FROM PUBLIC;
REVOKE ALL ON TABLE partymember FROM bien;
GRANT ALL ON TABLE partymember TO bien;
GRANT SELECT ON TABLE partymember TO bien_read;


--
-- Name: place_visit; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE place_visit FROM PUBLIC;
REVOKE ALL ON TABLE place_visit FROM bien;
GRANT ALL ON TABLE place_visit TO bien;
GRANT SELECT ON TABLE place_visit TO bien_read;


--
-- Name: placecorrelation; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE placecorrelation FROM PUBLIC;
REVOKE ALL ON TABLE placecorrelation FROM bien;
GRANT ALL ON TABLE placecorrelation TO bien;
GRANT SELECT ON TABLE placecorrelation TO bien_read;


--
-- Name: placename; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE placename FROM PUBLIC;
REVOKE ALL ON TABLE placename FROM bien;
GRANT ALL ON TABLE placename TO bien;
GRANT SELECT ON TABLE placename TO bien_read;


--
-- Name: placename_ancestor; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE placename_ancestor FROM PUBLIC;
REVOKE ALL ON TABLE placename_ancestor FROM bien;
GRANT ALL ON TABLE placename_ancestor TO bien;
GRANT SELECT ON TABLE placename_ancestor TO bien_read;


--
-- Name: plant; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE plant FROM PUBLIC;
REVOKE ALL ON TABLE plant FROM bien;
GRANT ALL ON TABLE plant TO bien;
GRANT SELECT ON TABLE plant TO bien_read;


--
-- Name: plot; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE plot FROM PUBLIC;
REVOKE ALL ON TABLE plot FROM bien;
GRANT ALL ON TABLE plot TO bien;
GRANT SELECT ON TABLE plot TO bien_read;


--
-- Name: projectcontributor; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE projectcontributor FROM PUBLIC;
REVOKE ALL ON TABLE projectcontributor FROM bien;
GRANT ALL ON TABLE projectcontributor TO bien;
GRANT SELECT ON TABLE projectcontributor TO bien_read;


--
-- Name: provider_count; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE provider_count FROM PUBLIC;
REVOKE ALL ON TABLE provider_count FROM bien;
GRANT ALL ON TABLE provider_count TO bien;
GRANT SELECT ON TABLE provider_count TO bien_read;
GRANT SELECT ON TABLE provider_count TO public_;


--
-- Name: sourcename; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE sourcename FROM PUBLIC;
REVOKE ALL ON TABLE sourcename FROM bien;
GRANT ALL ON TABLE sourcename TO bien;
GRANT SELECT ON TABLE sourcename TO bien_read;
GRANT SELECT ON TABLE sourcename TO public_;


--
-- Name: provider_count_view; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE provider_count_view FROM PUBLIC;
REVOKE ALL ON TABLE provider_count_view FROM bien;
GRANT ALL ON TABLE provider_count_view TO bien;
GRANT SELECT ON TABLE provider_count_view TO bien_read;
GRANT SELECT ON TABLE provider_count_view TO public_;


--
-- Name: range_modeling_input; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE range_modeling_input FROM PUBLIC;
REVOKE ALL ON TABLE range_modeling_input FROM bien;
GRANT ALL ON TABLE range_modeling_input TO bien;
GRANT SELECT ON TABLE range_modeling_input TO bien_read;


--
-- Name: revision; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE revision FROM PUBLIC;
REVOKE ALL ON TABLE revision FROM bien;
GRANT ALL ON TABLE revision TO bien;
GRANT SELECT ON TABLE revision TO bien_read;


--
-- Name: soilsample; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE soilsample FROM PUBLIC;
REVOKE ALL ON TABLE soilsample FROM bien;
GRANT ALL ON TABLE soilsample TO bien;
GRANT SELECT ON TABLE soilsample TO bien_read;


--
-- Name: soiltaxon; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE soiltaxon FROM PUBLIC;
REVOKE ALL ON TABLE soiltaxon FROM bien;
GRANT ALL ON TABLE soiltaxon TO bien;
GRANT SELECT ON TABLE soiltaxon TO bien_read;


--
-- Name: sourcecontributor; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE sourcecontributor FROM PUBLIC;
REVOKE ALL ON TABLE sourcecontributor FROM bien;
GRANT ALL ON TABLE sourcecontributor TO bien;
GRANT SELECT ON TABLE sourcecontributor TO bien_read;


--
-- Name: specimen; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE specimen FROM PUBLIC;
REVOKE ALL ON TABLE specimen FROM bien;
GRANT ALL ON TABLE specimen TO bien;
GRANT SELECT ON TABLE specimen TO bien_read;


--
-- Name: taxon_trait; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxon_trait FROM PUBLIC;
REVOKE ALL ON TABLE taxon_trait FROM bien;
GRANT ALL ON TABLE taxon_trait TO bien;
GRANT SELECT ON TABLE taxon_trait TO bien_read;


--
-- Name: trait; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE trait FROM PUBLIC;
REVOKE ALL ON TABLE trait FROM bien;
GRANT ALL ON TABLE trait TO bien;
GRANT SELECT ON TABLE trait TO bien_read;


--
-- Name: taxon_trait_view; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxon_trait_view FROM PUBLIC;
REVOKE ALL ON TABLE taxon_trait_view FROM bien;
GRANT ALL ON TABLE taxon_trait_view TO bien;
GRANT SELECT ON TABLE taxon_trait_view TO bien_read;


--
-- Name: taxonalt; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxonalt FROM PUBLIC;
REVOKE ALL ON TABLE taxonalt FROM bien;
GRANT ALL ON TABLE taxonalt TO bien;
GRANT SELECT ON TABLE taxonalt TO bien_read;


--
-- Name: taxonconcept; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxonconcept FROM PUBLIC;
REVOKE ALL ON TABLE taxonconcept FROM bien;
GRANT ALL ON TABLE taxonconcept TO bien;
GRANT SELECT ON TABLE taxonconcept TO bien_read;


--
-- Name: taxoncorrelation; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxoncorrelation FROM PUBLIC;
REVOKE ALL ON TABLE taxoncorrelation FROM bien;
GRANT ALL ON TABLE taxoncorrelation TO bien;
GRANT SELECT ON TABLE taxoncorrelation TO bien_read;


--
-- Name: taxonlabel_relationship; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxonlabel_relationship FROM PUBLIC;
REVOKE ALL ON TABLE taxonlabel_relationship FROM bien;
GRANT ALL ON TABLE taxonlabel_relationship TO bien;
GRANT SELECT ON TABLE taxonlabel_relationship TO bien_read;


--
-- Name: taxonlineage; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxonlineage FROM PUBLIC;
REVOKE ALL ON TABLE taxonlineage FROM bien;
GRANT ALL ON TABLE taxonlineage TO bien;
GRANT SELECT ON TABLE taxonlineage TO bien_read;


--
-- Name: taxonstatus; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE taxonstatus FROM PUBLIC;
REVOKE ALL ON TABLE taxonstatus FROM bien;
GRANT ALL ON TABLE taxonstatus TO bien;
GRANT SELECT ON TABLE taxonstatus TO bien_read;


--
-- Name: telephone; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE telephone FROM PUBLIC;
REVOKE ALL ON TABLE telephone FROM bien;
GRANT ALL ON TABLE telephone TO bien;
GRANT SELECT ON TABLE telephone TO bien_read;


--
-- Name: threatened_taxonlabel_view; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE threatened_taxonlabel_view FROM PUBLIC;
REVOKE ALL ON TABLE threatened_taxonlabel_view FROM bien;
GRANT ALL ON TABLE threatened_taxonlabel_view TO bien;
GRANT SELECT ON TABLE threatened_taxonlabel_view TO bien_read;


--
-- Name: tnrs_input_name; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE tnrs_input_name FROM PUBLIC;
REVOKE ALL ON TABLE tnrs_input_name FROM bien;
GRANT ALL ON TABLE tnrs_input_name TO bien;
GRANT SELECT ON TABLE tnrs_input_name TO bien_read;


--
-- Name: userdefined; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE userdefined FROM PUBLIC;
REVOKE ALL ON TABLE userdefined FROM bien;
GRANT ALL ON TABLE userdefined TO bien;
GRANT SELECT ON TABLE userdefined TO bien_read;


--
-- Name: voucher; Type: ACL; Schema: public; Owner: -
--

REVOKE ALL ON TABLE voucher FROM PUBLIC;
REVOKE ALL ON TABLE voucher FROM bien;
GRANT ALL ON TABLE voucher TO bien;
GRANT SELECT ON TABLE voucher TO bien_read;


--
-- PostgreSQL database dump complete
--

