Revision 4965
Added by Aaron Marcuse-Kubitza about 12 years ago
vegbien.sql | ||
---|---|---|
1107 | 1107 |
plantcode text, |
1108 | 1108 |
canon_taxonpath_id integer, |
1109 | 1109 |
taxon_id integer, |
1110 |
scientificname text,
|
|
1110 |
taxonomicname text,
|
|
1111 | 1111 |
author text, |
1112 |
scientificnamewithauthor text,
|
|
1112 |
taxonomicnamewithauthor text,
|
|
1113 | 1113 |
domain text, |
1114 | 1114 |
kingdom text, |
1115 | 1115 |
phylum text, |
... | ... | |
1159 | 1159 |
|
1160 | 1160 |
|
1161 | 1161 |
-- |
1162 |
-- Name: COLUMN taxonpath.scientificname; Type: COMMENT; Schema: public; Owner: -
|
|
1162 |
-- Name: COLUMN taxonpath.taxonomicname; Type: COMMENT; Schema: public; Owner: -
|
|
1163 | 1163 |
-- |
1164 | 1164 |
|
1165 |
COMMENT ON COLUMN taxonpath.scientificname IS 'The concatenated taxonomic name which uniquely identifies this taxon. Does not include the author of the name.
|
|
1165 |
COMMENT ON COLUMN taxonpath.taxonomicname IS 'The concatenated taxonomic name which uniquely identifies this taxon. Does not include the author of the name.
|
|
1166 | 1166 |
|
1167 | 1167 |
Equivalent to Darwin Core''s scientificName.'; |
1168 | 1168 |
|
... | ... | |
1171 | 1171 |
-- Name: COLUMN taxonpath.author; Type: COMMENT; Schema: public; Owner: - |
1172 | 1172 |
-- |
1173 | 1173 |
|
1174 |
COMMENT ON COLUMN taxonpath.author IS 'The author of the scientific name.';
|
|
1174 |
COMMENT ON COLUMN taxonpath.author IS 'The author of the taxonomic name.';
|
|
1175 | 1175 |
|
1176 | 1176 |
|
1177 | 1177 |
-- |
1178 |
-- Name: COLUMN taxonpath.scientificnamewithauthor; Type: COMMENT; Schema: public; Owner: -
|
|
1178 |
-- Name: COLUMN taxonpath.taxonomicnamewithauthor; Type: COMMENT; Schema: public; Owner: -
|
|
1179 | 1179 |
-- |
1180 | 1180 |
|
1181 |
COMMENT ON COLUMN taxonpath.scientificnamewithauthor IS 'The concatenated taxonomic name which uniquely identifies this taxon, plus the author of that name.
|
|
1181 |
COMMENT ON COLUMN taxonpath.taxonomicnamewithauthor IS 'The concatenated taxonomic name which uniquely identifies this taxon, plus the author of that name.
|
|
1182 | 1182 |
|
1183 | 1183 |
Equivalent to Darwin Core''s scientificName + scientificNameAuthorship. |
1184 | 1184 |
Equivalent to "Name sec. x".'; |
... | ... | |
1287 | 1287 |
-- |
1288 | 1288 |
|
1289 | 1289 |
CREATE VIEW analytical_db_view AS |
1290 |
SELECT datasource.organizationname AS "dataSourceName", taxonpath.family, taxonpath.genus, taxonpath.species, COALESCE(taxonpath.scientificnamewithauthor, taxonpath.scientificname) AS taxon, taxonpath.author AS "taxonAuthor", taxonpath.variety AS "taxonMorphospecies", placepath.country, placepath.stateprovince AS "stateProvince", placepath.county AS "countyParish", taxonoccurrence.verbatimcollectorname AS collector, plantobservation.collectionnumber AS "collectionNumber", array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], ' '::text) AS "identifiedBy", aggregateoccurrence.collectiondate AS "observationDate", location.authorlocationcode AS "plotCode", functions._m2_to_ha(location.area_m2) AS "plotAreaHa", method.name AS "plotMethod", locationcoords.latitude_deg AS latitude, locationcoords.longitude_deg AS longitude, location.elevation_m, taxonoccurrence.iscultivated AS "isCultivated", taxonoccurrence.cultivatedbasis AS "isCultivatedReason", functions._fraction_to_percent(aggregateoccurrence.cover_fraction) AS "pctCover" FROM (((((((((((((location JOIN party datasource ON (((datasource.party_id = location.datasource_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonpath USING (taxonpath_id)) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
|
|
1290 |
SELECT datasource.organizationname AS "dataSourceName", taxonpath.family, taxonpath.genus, taxonpath.species, COALESCE(taxonpath.taxonomicnamewithauthor, taxonpath.taxonomicname) AS taxon, taxonpath.author AS "taxonAuthor", taxonpath.variety AS "taxonMorphospecies", placepath.country, placepath.stateprovince AS "stateProvince", placepath.county AS "countyParish", taxonoccurrence.verbatimcollectorname AS collector, plantobservation.collectionnumber AS "collectionNumber", array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], ' '::text) AS "identifiedBy", aggregateoccurrence.collectiondate AS "observationDate", location.authorlocationcode AS "plotCode", functions._m2_to_ha(location.area_m2) AS "plotAreaHa", method.name AS "plotMethod", locationcoords.latitude_deg AS latitude, locationcoords.longitude_deg AS longitude, location.elevation_m, taxonoccurrence.iscultivated AS "isCultivated", taxonoccurrence.cultivatedbasis AS "isCultivatedReason", functions._fraction_to_percent(aggregateoccurrence.cover_fraction) AS "pctCover" FROM (((((((((((((location JOIN party datasource ON (((datasource.party_id = location.datasource_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonpath USING (taxonpath_id)) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
|
|
1291 | 1291 |
|
1292 | 1292 |
|
1293 | 1293 |
-- |
... | ... | |
4700 | 4700 |
-- Name: taxonpath_unique_within_datasource_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: |
4701 | 4701 |
-- |
4702 | 4702 |
|
4703 |
CREATE UNIQUE INDEX taxonpath_unique_within_datasource_by_name ON taxonpath USING btree (datasource_id, (COALESCE(taxon_id, 2147483647)), (COALESCE(scientificname, '\\N'::text)), (COALESCE(author, '\\N'::text)), (COALESCE(scientificnamewithauthor, '\\N'::text)), (COALESCE(domain, '\\N'::text)), (COALESCE(kingdom, '\\N'::text)), (COALESCE(phylum, '\\N'::text)), (COALESCE(class, '\\N'::text)), (COALESCE("order", '\\N'::text)), (COALESCE(family, '\\N'::text)), (COALESCE(genus, '\\N'::text)), (COALESCE(species, '\\N'::text)), (COALESCE(subspecies, '\\N'::text)), (COALESCE(variety, '\\N'::text)), (COALESCE(forma, '\\N'::text)), (COALESCE(cultivar, '\\N'::text)), (COALESCE(otherranks, ARRAY[]::rankedtaxonname[])), (COALESCE(scope_id, 2147483647))) WHERE (plantcode IS NULL);
|
|
4703 |
CREATE UNIQUE INDEX taxonpath_unique_within_datasource_by_name ON taxonpath USING btree (datasource_id, (COALESCE(taxon_id, 2147483647)), (COALESCE(taxonomicname, '\\N'::text)), (COALESCE(author, '\\N'::text)), (COALESCE(taxonomicnamewithauthor, '\\N'::text)), (COALESCE(domain, '\\N'::text)), (COALESCE(kingdom, '\\N'::text)), (COALESCE(phylum, '\\N'::text)), (COALESCE(class, '\\N'::text)), (COALESCE("order", '\\N'::text)), (COALESCE(family, '\\N'::text)), (COALESCE(genus, '\\N'::text)), (COALESCE(species, '\\N'::text)), (COALESCE(subspecies, '\\N'::text)), (COALESCE(variety, '\\N'::text)), (COALESCE(forma, '\\N'::text)), (COALESCE(cultivar, '\\N'::text)), (COALESCE(otherranks, ARRAY[]::rankedtaxonname[])), (COALESCE(scope_id, 2147483647))) WHERE (plantcode IS NULL);
|
|
4704 | 4704 |
|
4705 | 4705 |
|
4706 | 4706 |
-- |
Also available in: Unified diff
schemas/vegbien.sql: Replaced "scientific name" with "taxonomic name" for schema-wide consistency and for consistency with the taxon/taxonomic name vocabulary