Project

General

Profile

« Previous | Next » 

Revision 14423

inputs/.TNRS/schema.sql: taxon_scrub: use taxon_match derived columns instead of the incorrect values in taxon_scrub.scrubbed_unique_taxon_name.* (which does not work with the multi-match strategy)

View differences:

vegbien.sql
21702 21702

  
21703 21703

  
21704 21704
--
21705
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
21706
--
21707

  
21708
CREATE VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" AS
21709
 SELECT taxon_match."*Name_submitted" AS scrubbed_unique_taxon_name,
21710
    taxon_match."*Name_matched_rank" AS scrubbed_taxon_rank,
21711
    COALESCE(taxon_match."*Name_matched_accepted_family", taxon_match."*Family_matched") AS scrubbed_family,
21712
    taxon_match."*Genus_matched" AS scrubbed_genus,
21713
    taxon_match."*Specific_epithet_matched" AS scrubbed_specific_epithet,
21714
    taxon_match."*Infraspecific_rank" AS scrubbed_infraspecific_rank,
21715
    taxon_match."*Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet,
21716
    taxon_match."*Name_matched_author" AS scrubbed_author,
21717
    taxon_match."*Name_matched" AS scrubbed_taxon_name_no_author,
21718
    (taxon_match."*Name_matched" || COALESCE((' '::text || taxon_match."*Name_matched_author"), ''::text)) AS scrubbed_taxon_name_with_author
21719
   FROM taxon_match;
21720

  
21721

  
21722
--
21723
-- Name: VIEW "taxon_scrub.scrubbed_unique_taxon_name.*"; Type: COMMENT; Schema: TNRS; Owner: -
21724
--
21725

  
21726
COMMENT ON VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" IS '
21727
to modify:
21728
SELECT util.recreate_view(''"TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*"'', $$
21729
SELECT __
21730
$$);
21731

  
21732
scrubbed_family: Name_matched_accepted_family was missing from the TNRS results at one point, so Family_matched is used as a workaround to populate this. the workaround is for *accepted names only*, as no opinion names do not have an Accepted_name_family to prepend to the scrubbed name to parse.
21733
';
21734

  
21735

  
21736
--
21737 21705
-- Name: taxon_scrub; Type: VIEW; Schema: TNRS; Owner: -
21738 21706
--
21739 21707

  
......
21807 21775
    "ValidMatchedTaxon"."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org",
21808 21776
    "ValidMatchedTaxon"."taxonomicStatus",
21809 21777
    "ValidMatchedTaxon".accepted_morphospecies_binomial,
21810
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank,
21811
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family,
21812
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus,
21813
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet,
21814
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_rank,
21815
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_epithet,
21816
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_author,
21817
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author,
21818
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_with_author,
21819 21778
        CASE
21779
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]taxonRank__@DwC__@vegpath.org"
21780
            ELSE NULL::text
21781
        END AS scrubbed_taxon_rank,
21782
        CASE
21783
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org"
21784
            ELSE NULL::text
21785
        END AS scrubbed_family,
21786
        CASE
21787
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]genus__@DwC__@vegpath.org"
21788
            ELSE NULL::text
21789
        END AS scrubbed_genus,
21790
        CASE
21791
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]specificEpithet__@DwC__@vegpath.org"
21792
            ELSE NULL::text
21793
        END AS scrubbed_specific_epithet,
21794
        CASE
21795
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
21796
            ELSE NULL::text
21797
        END AS scrubbed_infraspecific_rank,
21798
        CASE
21799
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org"
21800
            ELSE NULL::text
21801
        END AS scrubbed_infraspecific_epithet,
21802
        CASE
21803
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org"
21804
            ELSE NULL::text
21805
        END AS scrubbed_author,
21806
        CASE
21807
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org"
21808
            ELSE NULL::text
21809
        END AS scrubbed_taxon_name_no_author,
21810
        CASE
21811
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org"
21812
            ELSE NULL::text
21813
        END AS scrubbed_taxon_name_with_author,
21814
        CASE
21820 21815
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org"
21821 21816
            ELSE NULL::text
21822 21817
        END AS scrubbed_morphospecies_binomial
21823
   FROM ("ValidMatchedTaxon"
21824
   LEFT JOIN "taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name));
21818
   FROM "ValidMatchedTaxon";
21825 21819

  
21826 21820

  
21827 21821
--
......
21836 21830
';
21837 21831

  
21838 21832

  
21833
--
21834
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
21835
--
21836

  
21837
CREATE VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" AS
21838
 SELECT taxon_match."*Name_submitted" AS scrubbed_unique_taxon_name,
21839
    taxon_match."*Name_matched_rank" AS scrubbed_taxon_rank,
21840
    COALESCE(taxon_match."*Name_matched_accepted_family", taxon_match."*Family_matched") AS scrubbed_family,
21841
    taxon_match."*Genus_matched" AS scrubbed_genus,
21842
    taxon_match."*Specific_epithet_matched" AS scrubbed_specific_epithet,
21843
    taxon_match."*Infraspecific_rank" AS scrubbed_infraspecific_rank,
21844
    taxon_match."*Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet,
21845
    taxon_match."*Name_matched_author" AS scrubbed_author,
21846
    taxon_match."*Name_matched" AS scrubbed_taxon_name_no_author,
21847
    (taxon_match."*Name_matched" || COALESCE((' '::text || taxon_match."*Name_matched_author"), ''::text)) AS scrubbed_taxon_name_with_author
21848
   FROM taxon_match;
21849

  
21850

  
21851
--
21852
-- Name: VIEW "taxon_scrub.scrubbed_unique_taxon_name.*"; Type: COMMENT; Schema: TNRS; Owner: -
21853
--
21854

  
21855
COMMENT ON VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" IS '
21856
to modify:
21857
SELECT util.recreate_view(''"TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*"'', $$
21858
SELECT __
21859
$$);
21860

  
21861
scrubbed_family: Name_matched_accepted_family was missing from the TNRS results at one point, so Family_matched is used as a workaround to populate this. the workaround is for *accepted names only*, as no opinion names do not have an Accepted_name_family to prepend to the scrubbed name to parse.
21862
';
21863

  
21864

  
21839 21865
SET search_path = geoscrub, pg_catalog;
21840 21866

  
21841 21867
--
......
22110 22136

  
22111 22137

  
22112 22138
--
22139
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
22140
--
22141

  
22142
REVOKE ALL ON TABLE taxon_scrub FROM PUBLIC;
22143
REVOKE ALL ON TABLE taxon_scrub FROM bien;
22144
GRANT ALL ON TABLE taxon_scrub TO bien;
22145
GRANT SELECT ON TABLE taxon_scrub TO bien_read;
22146

  
22147

  
22148
--
22113 22149
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: ACL; Schema: TNRS; Owner: -
22114 22150
--
22115 22151

  
......
22120 22156

  
22121 22157

  
22122 22158
--
22123
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
22124
--
22125

  
22126
REVOKE ALL ON TABLE taxon_scrub FROM PUBLIC;
22127
REVOKE ALL ON TABLE taxon_scrub FROM bien;
22128
GRANT ALL ON TABLE taxon_scrub TO bien;
22129
GRANT SELECT ON TABLE taxon_scrub TO bien_read;
22130

  
22131

  
22132
--
22133 22159
-- PostgreSQL database dump complete
22134 22160
--
22135 22161

  

Also available in: Unified diff