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:

trunk/inputs/.TNRS/schema.sql
1780 1780

  
1781 1781

  
1782 1782
--
1783
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
1784
--
1785

  
1786
CREATE VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" AS
1787
 SELECT taxon_match."*Name_submitted" AS scrubbed_unique_taxon_name,
1788
    taxon_match."*Name_matched_rank" AS scrubbed_taxon_rank,
1789
    COALESCE(taxon_match."*Name_matched_accepted_family", taxon_match."*Family_matched") AS scrubbed_family,
1790
    taxon_match."*Genus_matched" AS scrubbed_genus,
1791
    taxon_match."*Specific_epithet_matched" AS scrubbed_specific_epithet,
1792
    taxon_match."*Infraspecific_rank" AS scrubbed_infraspecific_rank,
1793
    taxon_match."*Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet,
1794
    taxon_match."*Name_matched_author" AS scrubbed_author,
1795
    taxon_match."*Name_matched" AS scrubbed_taxon_name_no_author,
1796
    (taxon_match."*Name_matched" || COALESCE((' '::text || taxon_match."*Name_matched_author"), ''::text)) AS scrubbed_taxon_name_with_author
1797
   FROM taxon_match;
1798

  
1799

  
1800
--
1801
-- Name: VIEW "taxon_scrub.scrubbed_unique_taxon_name.*"; Type: COMMENT; Schema: TNRS; Owner: -
1802
--
1803

  
1804
COMMENT ON VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" IS '
1805
to modify:
1806
SELECT util.recreate_view(''"TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*"'', $$
1807
SELECT __
1808
$$);
1809

  
1810
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.
1811
';
1812

  
1813

  
1814
--
1815 1783
-- Name: taxon_scrub; Type: VIEW; Schema: TNRS; Owner: -
1816 1784
--
1817 1785

  
......
1885 1853
    "ValidMatchedTaxon"."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org",
1886 1854
    "ValidMatchedTaxon"."taxonomicStatus",
1887 1855
    "ValidMatchedTaxon".accepted_morphospecies_binomial,
1888
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank,
1889
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family,
1890
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus,
1891
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet,
1892
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_rank,
1893
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_epithet,
1894
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_author,
1895
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author,
1896
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_with_author,
1897 1856
        CASE
1857
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]taxonRank__@DwC__@vegpath.org"
1858
            ELSE NULL::text
1859
        END AS scrubbed_taxon_rank,
1860
        CASE
1861
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org"
1862
            ELSE NULL::text
1863
        END AS scrubbed_family,
1864
        CASE
1865
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]genus__@DwC__@vegpath.org"
1866
            ELSE NULL::text
1867
        END AS scrubbed_genus,
1868
        CASE
1869
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]specificEpithet__@DwC__@vegpath.org"
1870
            ELSE NULL::text
1871
        END AS scrubbed_specific_epithet,
1872
        CASE
1873
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
1874
            ELSE NULL::text
1875
        END AS scrubbed_infraspecific_rank,
1876
        CASE
1877
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org"
1878
            ELSE NULL::text
1879
        END AS scrubbed_infraspecific_epithet,
1880
        CASE
1881
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org"
1882
            ELSE NULL::text
1883
        END AS scrubbed_author,
1884
        CASE
1885
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org"
1886
            ELSE NULL::text
1887
        END AS scrubbed_taxon_name_no_author,
1888
        CASE
1889
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org"
1890
            ELSE NULL::text
1891
        END AS scrubbed_taxon_name_with_author,
1892
        CASE
1898 1893
            WHEN true THEN "ValidMatchedTaxon"."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org"
1899 1894
            ELSE NULL::text
1900 1895
        END AS scrubbed_morphospecies_binomial
1901
   FROM ("ValidMatchedTaxon"
1902
   LEFT JOIN "taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name));
1896
   FROM "ValidMatchedTaxon";
1903 1897

  
1904 1898

  
1905 1899
--
......
1915 1909

  
1916 1910

  
1917 1911
--
1912
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
1913
--
1914

  
1915
CREATE VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" AS
1916
 SELECT taxon_match."*Name_submitted" AS scrubbed_unique_taxon_name,
1917
    taxon_match."*Name_matched_rank" AS scrubbed_taxon_rank,
1918
    COALESCE(taxon_match."*Name_matched_accepted_family", taxon_match."*Family_matched") AS scrubbed_family,
1919
    taxon_match."*Genus_matched" AS scrubbed_genus,
1920
    taxon_match."*Specific_epithet_matched" AS scrubbed_specific_epithet,
1921
    taxon_match."*Infraspecific_rank" AS scrubbed_infraspecific_rank,
1922
    taxon_match."*Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet,
1923
    taxon_match."*Name_matched_author" AS scrubbed_author,
1924
    taxon_match."*Name_matched" AS scrubbed_taxon_name_no_author,
1925
    (taxon_match."*Name_matched" || COALESCE((' '::text || taxon_match."*Name_matched_author"), ''::text)) AS scrubbed_taxon_name_with_author
1926
   FROM taxon_match;
1927

  
1928

  
1929
--
1930
-- Name: VIEW "taxon_scrub.scrubbed_unique_taxon_name.*"; Type: COMMENT; Schema: TNRS; Owner: -
1931
--
1932

  
1933
COMMENT ON VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" IS '
1934
to modify:
1935
SELECT util.recreate_view(''"TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*"'', $$
1936
SELECT __
1937
$$);
1938

  
1939
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.
1940
';
1941

  
1942

  
1943
--
1918 1944
-- Name: batch_download_settings_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace: 
1919 1945
--
1920 1946

  
......
2111 2137

  
2112 2138

  
2113 2139
--
2140
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
2141
--
2142

  
2143
REVOKE ALL ON TABLE taxon_scrub FROM PUBLIC;
2144
REVOKE ALL ON TABLE taxon_scrub FROM bien;
2145
GRANT ALL ON TABLE taxon_scrub TO bien;
2146
GRANT SELECT ON TABLE taxon_scrub TO bien_read;
2147

  
2148

  
2149
--
2114 2150
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: ACL; Schema: TNRS; Owner: -
2115 2151
--
2116 2152

  
......
2121 2157

  
2122 2158

  
2123 2159
--
2124
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
2125
--
2126

  
2127
REVOKE ALL ON TABLE taxon_scrub FROM PUBLIC;
2128
REVOKE ALL ON TABLE taxon_scrub FROM bien;
2129
GRANT ALL ON TABLE taxon_scrub TO bien;
2130
GRANT SELECT ON TABLE taxon_scrub TO bien_read;
2131

  
2132

  
2133
--
2134 2160
-- PostgreSQL database dump complete
2135 2161
--
2136 2162

  
trunk/schemas/vegbien.my.sql
16462 16462

  
16463 16463

  
16464 16464
--
16465
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
16465
-- Name: taxon_scrub; Type: VIEW; Schema: TNRS; Owner: -
16466 16466
--
16467 16467

  
16468 16468

  
16469 16469

  
16470 16470

  
16471 16471
--
16472
-- Name: VIEW `taxon_scrub.scrubbed_unique_taxon_name.*`; Type: COMMENT; Schema: TNRS; Owner: -
16472
-- Name: VIEW taxon_scrub; Type: COMMENT; Schema: TNRS; Owner: -
16473 16473
--
16474 16474

  
16475 16475

  
16476 16476

  
16477 16477

  
16478 16478
--
16479
-- Name: taxon_scrub; Type: VIEW; Schema: TNRS; Owner: -
16479
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
16480 16480
--
16481 16481

  
16482 16482

  
16483 16483

  
16484 16484

  
16485 16485
--
16486
-- Name: VIEW taxon_scrub; Type: COMMENT; Schema: TNRS; Owner: -
16486
-- Name: VIEW `taxon_scrub.scrubbed_unique_taxon_name.*`; Type: COMMENT; Schema: TNRS; Owner: -
16487 16487
--
16488 16488

  
16489 16489

  
......
16761 16761

  
16762 16762

  
16763 16763
--
16764
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: ACL; Schema: TNRS; Owner: -
16764
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
16765 16765
--
16766 16766

  
16767 16767

  
......
16771 16771

  
16772 16772

  
16773 16773
--
16774
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
16774
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: ACL; Schema: TNRS; Owner: -
16775 16775
--
16776 16776

  
16777 16777

  
trunk/schemas/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