Revision 5482
Added by Aaron Marcuse-Kubitza over 12 years ago
inputs/test_taxonomic_names/_scrub/public.sql | ||
---|---|---|
268 | 268 |
|
269 | 269 |
|
270 | 270 |
-- |
271 |
-- Name: _fraction_to_percent(double precision); Type: FUNCTION; Schema: public; Owner: bien |
|
272 |
-- |
|
273 |
|
|
274 |
CREATE FUNCTION _fraction_to_percent(value double precision) RETURNS double precision |
|
275 |
LANGUAGE sql IMMUTABLE STRICT |
|
276 |
AS $_$ |
|
277 |
SELECT $1*100. |
|
278 |
$_$; |
|
279 |
|
|
280 |
|
|
281 |
ALTER FUNCTION public._fraction_to_percent(value double precision) OWNER TO bien; |
|
282 |
|
|
283 |
-- |
|
271 | 284 |
-- Name: _set_matched_taxonconcept(integer, integer, double precision); Type: FUNCTION; Schema: public; Owner: bien |
272 | 285 |
-- |
273 | 286 |
|
... | ... | |
1501 | 1514 |
-- |
1502 | 1515 |
|
1503 | 1516 |
CREATE VIEW analytical_db_view AS |
1504 |
SELECT datasource.organizationname AS "dataSourceName", taxonconcept.family, taxonconcept.genus, taxonconcept.species, COALESCE(taxonconcept.taxonomicnamewithauthor, taxonconcept.taxonomicname) AS taxon, taxonconcept.author AS "taxonAuthor", taxonconcept.taxonname 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.creator_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonconcept USING (taxonconcept_id)) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
|
|
1517 |
SELECT datasource.organizationname AS "dataSourceName", taxonconcept.family, taxonconcept.genus, taxonconcept.species, COALESCE(taxonconcept.taxonomicnamewithauthor, taxonconcept.taxonomicname) AS taxon, taxonconcept.author AS "taxonAuthor", taxonconcept.taxonname 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", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "pctCover" FROM (((((((((((((location JOIN party datasource ON (((datasource.party_id = location.creator_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonconcept USING (taxonconcept_id)) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id)); |
|
1505 | 1518 |
|
1506 | 1519 |
|
1507 | 1520 |
ALTER TABLE public.analytical_db_view OWNER TO bien; |
... | ... | |
4860 | 4873 |
646 1 \N \N 588 588 1 \N var. grisea \N subsp. Silene scouleri subsp. pringlei var. grisea C.L. Hitchc. & Maguire Silene scouleri subsp. pringlei \N \N \N Silene scouleri \N \N |
4861 | 4874 |
664 1 \N \N \N \N \N \N \N \N \N No suitable matches found. No suitable matches found. \N \N \N \N \N \N \N |
4862 | 4875 |
684 1 \N \N \N \N \N \N \N \N \N Fam_indet. Boyle#6501 No suitable matches found. \N \N \N \N \N \N \N |
4863 |
725 2 \N \N 18 380 \N \N \N \N \N \N Poa annua \N \N \N \N \N \N \N
|
|
4864 |
728 2 \N \N 18 18 \N \N \N \N \N \N Poa annua L. \N \N \N \N \N \N \N
|
|
4865 |
731 2 \N \N 18 570 \N \N \N \N \N \N Poa annua var. eriolepis \N \N \N \N \N \N \N
|
|
4866 |
734 2 \N \N 94 494 \N \N \N \N \N \N Poa annua subsp. exilis \N \N \N \N \N \N \N
|
|
4867 |
737 2 \N \N 94 456 \N \N \N \N \N \N Poa annua ssp. exilis \N \N \N \N \N \N \N
|
|
4868 |
740 2 \N \N 512 532 \N \N \N \N \N \N Poa annua subvar. minima \N \N \N \N \N \N \N
|
|
4869 |
743 2 \N \N 56 418 \N \N \N \N \N \N Poa annua fo. lanuginosa \N \N \N \N \N \N \N
|
|
4870 |
746 2 \N \N 588 646 \N \N \N \N \N \N Silene scouleri subsp. pringlei var. grisea C.L. Hitchc. & Maguire \N \N \N \N \N \N \N
|
|
4871 |
749 2 \N \N 588 608 \N \N \N \N \N \N Silene scouleri Hook. subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire var. grisea C.L. Hitchc. & Maguire \N \N \N \N \N \N \N
|
|
4872 |
752 2 \N \N 246 304 \N \N \N \N \N \N Fabaceae Inga sp.3 \N \N \N \N \N \N \N
|
|
4873 |
755 2 \N \N 246 266 \N \N \N \N \N \N Fabaceae Inga "fuzzy leaf" \N \N \N \N \N \N \N
|
|
4874 |
758 2 \N \N 208 342 \N \N \N \N \N \N Fabaceae unknown #2 \N \N \N \N \N \N \N
|
|
4875 |
761 2 \N \N 208 228 \N \N \N \N \N \N Fabaceae Boyle#6500 \N \N \N \N \N \N \N
|
|
4876 |
764 2 \N \N \N 684 \N \N \N \N \N \N Fam_indet. Boyle#6501 \N \N \N \N \N \N \N
|
|
4877 |
767 2 \N \N 132 190 \N \N \N \N \N \N Compositae indet. sp.1 \N \N \N \N \N \N \N
|
|
4876 |
725 2 1 \N 18 380 \N \N \N \N \N \N Poa annua \N \N \N \N \N \N \N
|
|
4877 |
728 2 2 \N 18 18 \N \N \N \N \N \N Poa annua L. \N \N \N \N \N \N \N
|
|
4878 |
731 2 3 \N 18 570 \N \N \N \N \N \N Poa annua var. eriolepis \N \N \N \N \N \N \N
|
|
4879 |
734 2 4 \N 94 494 \N \N \N \N \N \N Poa annua subsp. exilis \N \N \N \N \N \N \N
|
|
4880 |
737 2 5 \N 94 456 \N \N \N \N \N \N Poa annua ssp. exilis \N \N \N \N \N \N \N
|
|
4881 |
740 2 6 \N 512 532 \N \N \N \N \N \N Poa annua subvar. minima \N \N \N \N \N \N \N
|
|
4882 |
743 2 7 \N 56 418 \N \N \N \N \N \N Poa annua fo. lanuginosa \N \N \N \N \N \N \N
|
|
4883 |
746 2 8 \N 588 646 \N \N \N \N \N \N Silene scouleri subsp. pringlei var. grisea C.L. Hitchc. & Maguire \N \N \N \N \N \N \N
|
|
4884 |
749 2 9 \N 588 608 \N \N \N \N \N \N Silene scouleri Hook. subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire var. grisea C.L. Hitchc. & Maguire \N \N \N \N \N \N \N
|
|
4885 |
752 2 10 \N 246 304 \N \N \N \N \N \N Fabaceae Inga sp.3 \N \N \N \N \N \N \N
|
|
4886 |
755 2 11 \N 246 266 \N \N \N \N \N \N Fabaceae Inga "fuzzy leaf" \N \N \N \N \N \N \N
|
|
4887 |
758 2 12 \N 208 342 \N \N \N \N \N \N Fabaceae unknown #2 \N \N \N \N \N \N \N
|
|
4888 |
761 2 13 \N 208 228 \N \N \N \N \N \N Fabaceae Boyle#6500 \N \N \N \N \N \N \N
|
|
4889 |
764 2 14 \N \N 684 \N \N \N \N \N \N Fam_indet. Boyle#6501 \N \N \N \N \N \N \N
|
|
4890 |
767 2 15 \N 132 190 \N \N \N \N \N \N Compositae indet. sp.1 \N \N \N \N \N \N \N
|
|
4878 | 4891 |
\. |
4879 | 4892 |
|
4880 | 4893 |
|
Also available in: Unified diff
inputs/test_taxonomic_names/_scrub/public.sql: Regenerated with schema changes