Project

General

Profile

« Previous | Next » 

Revision 11645

bugfix: schemas/vegbien.sql: scrubbed_morphospecies_binomial: only append the morphospecies suffix if there is not a scrubbed specific epithet

View differences:

vegbien.sql
2760 2760
--
2761 2761

  
2762 2762
CREATE VIEW analytical_stem_view AS
2763
    SELECT "plot.**".datasource, "plot.**".country, "plot.**"."stateProvince", "plot.**".county, "plot.**".locality, "plot.**"."decimalLatitude", "plot.**"."decimalLongitude", "plot.**"."coordinateUncertaintyInMeters", "plot.**"."coordinateSource_bien", "plot.**"."georeferenceProtocol_bien", "plot.**".geovalid_bien, "plot.**"."isNewWorld_bien", "plot.**"."projectID", "plot.**"."locationID", "plot.**"."locationName", "plot.**".subplot, "plot.**".location__cultivated__bien, "plot.**".locationevent__pkey, "plot.**"."eventDate", "plot.**"."elevationInMeters", "plot.**"."slopeAspect", "plot.**"."slopeGradient", "plot.**"."plotArea_ha", "plot.**"."samplingProtocol", "plot.**"."temperature_C", "plot.**".precipitation_m, "plot.**".stratum__name, "plot.**".communities, "plot.**".plot__collectors, sourcelist.name AS "specimenHolderInstitutions", specimenreplicate.collectioncode_dwc AS collection, specimenreplicate.catalognumber_dwc AS "accessionNumber", specimenreplicate.sourceaccessioncode AS "occurrenceID", collector.fullname AS "recordedBy", plantobservation.authorplantcode AS "recordNumber", COALESCE(aggregateoccurrence.collectiondate, "plot.**"."eventDate") AS "dateCollected", taxonverbatim.family AS family_verbatim, COALESCE(taxonverbatim.taxonomicname, NULLIF(pg_catalog.concat_ws(' '::text, taxonverbatim.taxonname, taxonverbatim.author), ''::text), taxonlabel.taxonomicname) AS "scientificName_verbatim", identifiedby.fullname AS "identifiedBy", taxondetermination.determinationdate AS "dateIdentified", taxondetermination.notes AS "identificationRemarks", taxon_scrub."matchedFamily" AS family_matched, taxon_scrub."matchedTaxonName" AS "taxonName_matched", taxon_scrub."matchedScientificNameAuthorship" AS "scientificNameAuthorship_matched", family_higher_plant_group.higher_plant_group AS "higherPlantGroup_bien", taxon_scrub.scrubbed_family, taxon_scrub.scrubbed_genus, NULLIF(pg_catalog.concat_ws(' '::text, COALESCE(taxon_scrub.scrubbed_genus, taxon_scrub.scrubbed_family), taxon_scrub.scrubbed_specific_epithet, taxon_scrub."morphospeciesSuffix"), ''::text) AS scrubbed_morphospecies_binomial, taxon_scrub.scrubbed_taxon_name_no_author, COALESCE(taxon_scrub.scrubbed_author) AS scrubbed_author, taxonoccurrence.growthform AS "growthForm", plantobservation.reproductivecondition AS "reproductiveCondition", ((threatened_taxonlabel.taxonlabel_id IS NOT NULL))::integer AS threatened_bien, (((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", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "coverPercent", _m_to_cm(stemobservation.diameterbreastheight_m) AS "diameterBreastHeight_cm", stemobservation.height_m, stemobservation.tag, stemobservation.xposition_m AS "organismX_m", stemobservation.yposition_m AS "organismY_m", taxonoccurrence.sourceaccessioncode AS "taxonOccurrenceID", taxonoccurrence.authortaxoncode AS "authorTaxonCode", aggregateoccurrence.sourceaccessioncode AS "aggregateOrganismObservationID", plantobservation.sourceaccessioncode AS "individualObservationID", plantobservation.authorplantcode AS "individualCode", aggregateoccurrence.count AS "individualCount", stemobservation.authorstemcode AS "authorStemCode" FROM ((((((((((((((("plot.**" LEFT JOIN taxonoccurrence ON ((taxonoccurrence.locationevent_id = "plot.**".locationevent__pkey))) 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.institution_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."concatenatedScientificName" = 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)))) LEFT JOIN threatened_taxonlabel USING (taxonlabel_id));
2763
    SELECT "plot.**".datasource, "plot.**".country, "plot.**"."stateProvince", "plot.**".county, "plot.**".locality, "plot.**"."decimalLatitude", "plot.**"."decimalLongitude", "plot.**"."coordinateUncertaintyInMeters", "plot.**"."coordinateSource_bien", "plot.**"."georeferenceProtocol_bien", "plot.**".geovalid_bien, "plot.**"."isNewWorld_bien", "plot.**"."projectID", "plot.**"."locationID", "plot.**"."locationName", "plot.**".subplot, "plot.**".location__cultivated__bien, "plot.**".locationevent__pkey, "plot.**"."eventDate", "plot.**"."elevationInMeters", "plot.**"."slopeAspect", "plot.**"."slopeGradient", "plot.**"."plotArea_ha", "plot.**"."samplingProtocol", "plot.**"."temperature_C", "plot.**".precipitation_m, "plot.**".stratum__name, "plot.**".communities, "plot.**".plot__collectors, sourcelist.name AS "specimenHolderInstitutions", specimenreplicate.collectioncode_dwc AS collection, specimenreplicate.catalognumber_dwc AS "accessionNumber", specimenreplicate.sourceaccessioncode AS "occurrenceID", collector.fullname AS "recordedBy", plantobservation.authorplantcode AS "recordNumber", COALESCE(aggregateoccurrence.collectiondate, "plot.**"."eventDate") AS "dateCollected", taxonverbatim.family AS family_verbatim, COALESCE(taxonverbatim.taxonomicname, NULLIF(pg_catalog.concat_ws(' '::text, taxonverbatim.taxonname, taxonverbatim.author), ''::text), taxonlabel.taxonomicname) AS "scientificName_verbatim", identifiedby.fullname AS "identifiedBy", taxondetermination.determinationdate AS "dateIdentified", taxondetermination.notes AS "identificationRemarks", taxon_scrub."matchedFamily" AS family_matched, taxon_scrub."matchedTaxonName" AS "taxonName_matched", taxon_scrub."matchedScientificNameAuthorship" AS "scientificNameAuthorship_matched", family_higher_plant_group.higher_plant_group AS "higherPlantGroup_bien", taxon_scrub.scrubbed_family, taxon_scrub.scrubbed_genus, NULLIF(pg_catalog.concat_ws(' '::text, COALESCE(taxon_scrub.scrubbed_genus, taxon_scrub.scrubbed_family), COALESCE(taxon_scrub.scrubbed_specific_epithet, taxon_scrub."morphospeciesSuffix")), ''::text) AS scrubbed_morphospecies_binomial, taxon_scrub.scrubbed_taxon_name_no_author, COALESCE(taxon_scrub.scrubbed_author) AS scrubbed_author, taxonoccurrence.growthform AS "growthForm", plantobservation.reproductivecondition AS "reproductiveCondition", ((threatened_taxonlabel.taxonlabel_id IS NOT NULL))::integer AS threatened_bien, (((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", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "coverPercent", _m_to_cm(stemobservation.diameterbreastheight_m) AS "diameterBreastHeight_cm", stemobservation.height_m, stemobservation.tag, stemobservation.xposition_m AS "organismX_m", stemobservation.yposition_m AS "organismY_m", taxonoccurrence.sourceaccessioncode AS "taxonOccurrenceID", taxonoccurrence.authortaxoncode AS "authorTaxonCode", aggregateoccurrence.sourceaccessioncode AS "aggregateOrganismObservationID", plantobservation.sourceaccessioncode AS "individualObservationID", plantobservation.authorplantcode AS "individualCode", aggregateoccurrence.count AS "individualCount", stemobservation.authorstemcode AS "authorStemCode" FROM ((((((((((((((("plot.**" LEFT JOIN taxonoccurrence ON ((taxonoccurrence.locationevent_id = "plot.**".locationevent__pkey))) 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.institution_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."concatenatedScientificName" = 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)))) LEFT JOIN threatened_taxonlabel USING (taxonlabel_id));
2764 2764

  
2765 2765

  
2766 2766
--

Also available in: Unified diff