1 |
10778
|
aaronmk
|
--
|
2 |
|
|
-- PostgreSQL database dump
|
3 |
|
|
--
|
4 |
10737
|
aaronmk
|
|
5 |
10778
|
aaronmk
|
SET statement_timeout = 0;
|
6 |
11708
|
aaronmk
|
SET lock_timeout = 0;
|
7 |
10778
|
aaronmk
|
SET client_encoding = 'UTF8';
|
8 |
|
|
SET standard_conforming_strings = on;
|
9 |
|
|
SET check_function_bodies = false;
|
10 |
|
|
SET client_min_messages = warning;
|
11 |
|
|
|
12 |
10737
|
aaronmk
|
--
|
13 |
10778
|
aaronmk
|
-- Name: TNRS; Type: SCHEMA; Schema: -; Owner: -
|
14 |
|
|
--
|
15 |
10737
|
aaronmk
|
|
16 |
10778
|
aaronmk
|
--CREATE SCHEMA "TNRS";
|
17 |
10725
|
aaronmk
|
|
18 |
|
|
|
19 |
11614
|
aaronmk
|
--
|
20 |
|
|
-- Name: SCHEMA "TNRS"; Type: COMMENT; Schema: -; Owner: -
|
21 |
|
|
--
|
22 |
|
|
|
23 |
13575
|
aaronmk
|
COMMENT ON SCHEMA "TNRS" IS '
|
24 |
|
|
IMPORTANT: when changing this schema, you must also make the same changes on vegbiendev:
|
25 |
11617
|
aaronmk
|
on vegbiendev:
|
26 |
|
|
# back up existing TNRS schema (in case of an accidental incorrect change):
|
27 |
11614
|
aaronmk
|
$ make backups/TNRS.backup-remake # runtime: 3 min ("real 2m44.277s")
|
28 |
11616
|
aaronmk
|
$ svn up
|
29 |
|
|
$ svn di
|
30 |
|
|
# make the changes shown in the diff
|
31 |
|
|
## to change column types:
|
32 |
13861
|
aaronmk
|
SELECT util.set_col_types(''"TNRS".taxon_match'', ARRAY[
|
33 |
11614
|
aaronmk
|
(''col'', ''new_type'')
|
34 |
11616
|
aaronmk
|
]::util.col_cast[]); -- runtime: 9 min ("531282 ms")
|
35 |
11617
|
aaronmk
|
$ rm=1 inputs/.TNRS/schema.sql.run
|
36 |
|
|
# repeat until `svn di` shows no diff
|
37 |
|
|
# back up new TNRS schema:
|
38 |
13575
|
aaronmk
|
$ make backups/TNRS.backup-remake # runtime: 3 min ("real 2m44.277s")
|
39 |
|
|
';
|
40 |
11614
|
aaronmk
|
|
41 |
|
|
|
42 |
10778
|
aaronmk
|
SET search_path = "TNRS", pg_catalog;
|
43 |
|
|
|
44 |
|
|
--
|
45 |
|
|
-- Name: batch__fill(); Type: FUNCTION; Schema: TNRS; Owner: -
|
46 |
|
|
--
|
47 |
|
|
|
48 |
|
|
CREATE FUNCTION batch__fill() RETURNS trigger
|
49 |
|
|
LANGUAGE plpgsql
|
50 |
|
|
AS $$
|
51 |
10728
|
aaronmk
|
BEGIN
|
52 |
|
|
new.id_by_time = new.time_submitted;
|
53 |
|
|
new.id = COALESCE(new.id, new.id_by_time);
|
54 |
|
|
RETURN new;
|
55 |
|
|
END;
|
56 |
10778
|
aaronmk
|
$$;
|
57 |
10728
|
aaronmk
|
|
58 |
|
|
|
59 |
|
|
--
|
60 |
10778
|
aaronmk
|
-- Name: family_is_homonym(text); Type: FUNCTION; Schema: TNRS; Owner: -
|
61 |
|
|
--
|
62 |
10728
|
aaronmk
|
|
63 |
10778
|
aaronmk
|
CREATE FUNCTION family_is_homonym(family text) RETURNS boolean
|
64 |
|
|
LANGUAGE sql STABLE STRICT
|
65 |
|
|
AS $_$
|
66 |
|
|
SELECT EXISTS(SELECT * FROM "IRMNG".family_homonym_epithet WHERE "taxonNameOrEpithet" = $1)
|
67 |
|
|
$_$;
|
68 |
10736
|
aaronmk
|
|
69 |
10778
|
aaronmk
|
|
70 |
10736
|
aaronmk
|
--
|
71 |
10778
|
aaronmk
|
-- Name: genus_is_homonym(text); Type: FUNCTION; Schema: TNRS; Owner: -
|
72 |
|
|
--
|
73 |
10736
|
aaronmk
|
|
74 |
10778
|
aaronmk
|
CREATE FUNCTION genus_is_homonym(genus text) RETURNS boolean
|
75 |
|
|
LANGUAGE sql STABLE STRICT
|
76 |
|
|
AS $_$
|
77 |
|
|
SELECT EXISTS(SELECT * FROM "IRMNG".genus_homonym_epithet WHERE "taxonNameOrEpithet" = $1)
|
78 |
|
|
$_$;
|
79 |
7844
|
aaronmk
|
|
80 |
9985
|
aaronmk
|
|
81 |
10778
|
aaronmk
|
--
|
82 |
11709
|
aaronmk
|
-- Name: map_taxonomic_status(text, text); Type: FUNCTION; Schema: TNRS; Owner: -
|
83 |
|
|
--
|
84 |
|
|
|
85 |
13503
|
aaronmk
|
CREATE FUNCTION map_taxonomic_status(taxonomic_status_verbatim text, accepted_taxon_name_no_author text) RETURNS text
|
86 |
11709
|
aaronmk
|
LANGUAGE sql IMMUTABLE
|
87 |
|
|
AS $_$
|
88 |
13503
|
aaronmk
|
/* from http://wiki.vegpath.org/2013-11-14_conference_call#taxonomic-fields:
|
89 |
|
|
"taxonomic_status should be accepted instead of synonym when an accepted name is
|
90 |
|
|
available (this is not always the case when a name is marked as a synonym)" */
|
91 |
11709
|
aaronmk
|
SELECT CASE WHEN $2 IS NOT NULL THEN 'accepted' ELSE lower($1) END
|
92 |
|
|
$_$;
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
--
|
96 |
14356
|
aaronmk
|
-- Name: remove_prefix(text, text, boolean, boolean); Type: FUNCTION; Schema: TNRS; Owner: -
|
97 |
14347
|
aaronmk
|
--
|
98 |
|
|
|
99 |
14356
|
aaronmk
|
CREATE FUNCTION remove_prefix(prefix text, str text, require boolean DEFAULT true, case_sensitive boolean DEFAULT true) RETURNS text
|
100 |
14347
|
aaronmk
|
LANGUAGE sql IMMUTABLE
|
101 |
|
|
AS $$
|
102 |
14358
|
aaronmk
|
SELECT util.remove_prefix(prefix, str, require, case_sensitive)
|
103 |
14347
|
aaronmk
|
$$;
|
104 |
|
|
|
105 |
|
|
|
106 |
|
|
--
|
107 |
14356
|
aaronmk
|
-- Name: FUNCTION remove_prefix(prefix text, str text, require boolean, case_sensitive boolean); Type: COMMENT; Schema: TNRS; Owner: -
|
108 |
14347
|
aaronmk
|
--
|
109 |
|
|
|
110 |
14356
|
aaronmk
|
COMMENT ON FUNCTION remove_prefix(prefix text, str text, require boolean, case_sensitive boolean) IS '
|
111 |
14347
|
aaronmk
|
wrapper that prevents views from getting dropped when the util schema is reinstalled
|
112 |
|
|
';
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
--
|
116 |
13868
|
aaronmk
|
-- Name: taxon_match__batch_begin(); Type: FUNCTION; Schema: TNRS; Owner: -
|
117 |
13866
|
aaronmk
|
--
|
118 |
|
|
|
119 |
13868
|
aaronmk
|
CREATE FUNCTION taxon_match__batch_begin() RETURNS trigger
|
120 |
13866
|
aaronmk
|
LANGUAGE plpgsql
|
121 |
|
|
AS $$
|
122 |
|
|
BEGIN
|
123 |
13869
|
aaronmk
|
PERFORM util.seq__reset('pg_temp.taxon_match__match_num__seq', 0);
|
124 |
13567
|
aaronmk
|
RETURN NULL;
|
125 |
|
|
END;
|
126 |
|
|
$$;
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
--
|
130 |
13868
|
aaronmk
|
-- Name: taxon_match__fill(); Type: FUNCTION; Schema: TNRS; Owner: -
|
131 |
13578
|
aaronmk
|
--
|
132 |
|
|
|
133 |
13868
|
aaronmk
|
CREATE FUNCTION taxon_match__fill() RETURNS trigger
|
134 |
13578
|
aaronmk
|
LANGUAGE plpgsql
|
135 |
|
|
AS $$
|
136 |
11643
|
aaronmk
|
BEGIN
|
137 |
13871
|
aaronmk
|
DECLARE
|
138 |
|
|
"Specific_epithet_is_plant" boolean :=
|
139 |
11628
|
aaronmk
|
(CASE
|
140 |
14111
|
aaronmk
|
WHEN new."*Infraspecific_epithet_matched" IS NOT NULL
|
141 |
|
|
OR new."*Infraspecific_epithet_2_matched" IS NOT NULL
|
142 |
|
|
OR new."*Specific_epithet_score" >= 0.9 -- fuzzy match
|
143 |
13871
|
aaronmk
|
THEN true
|
144 |
|
|
ELSE NULL -- ambiguous
|
145 |
|
|
END);
|
146 |
14111
|
aaronmk
|
never_homonym boolean = COALESCE(new."*Author_score" >= 0.6, false);
|
147 |
13871
|
aaronmk
|
-- author disambiguates
|
148 |
|
|
family_is_homonym boolean = NOT never_homonym
|
149 |
14111
|
aaronmk
|
AND "TNRS".family_is_homonym(new."*Family_matched");
|
150 |
13871
|
aaronmk
|
genus_is_homonym boolean = NOT never_homonym
|
151 |
14111
|
aaronmk
|
AND "TNRS".genus_is_homonym(new."*Genus_matched");
|
152 |
13871
|
aaronmk
|
BEGIN
|
153 |
|
|
/* exclude homonyms because these are not valid matches (TNRS provides a
|
154 |
|
|
name, but the name is not meaningful because it is not unambiguous) */
|
155 |
14111
|
aaronmk
|
new.is_valid_match = new."*Taxonomic_status" != 'Invalid'
|
156 |
13871
|
aaronmk
|
AND COALESCE(CASE
|
157 |
14111
|
aaronmk
|
WHEN new."*Family_score" = 1 AND NOT family_is_homonym -- exact match
|
158 |
13871
|
aaronmk
|
THEN true
|
159 |
|
|
ELSE -- consider genus
|
160 |
11628
|
aaronmk
|
(CASE
|
161 |
14111
|
aaronmk
|
WHEN new."*Genus_score" = 1 -- exact match
|
162 |
13871
|
aaronmk
|
THEN
|
163 |
|
|
(CASE
|
164 |
|
|
WHEN NOT genus_is_homonym THEN true
|
165 |
|
|
ELSE "Specific_epithet_is_plant"
|
166 |
|
|
END)
|
167 |
14111
|
aaronmk
|
WHEN new."*Genus_score" >= 0.85 -- fuzzy match
|
168 |
13871
|
aaronmk
|
THEN "Specific_epithet_is_plant"
|
169 |
|
|
ELSE NULL -- ambiguous
|
170 |
11628
|
aaronmk
|
END)
|
171 |
13871
|
aaronmk
|
END, false);
|
172 |
|
|
END;
|
173 |
11628
|
aaronmk
|
|
174 |
13871
|
aaronmk
|
DECLARE
|
175 |
|
|
matched_taxon_name_with_author text = NULLIF(concat_ws(' '
|
176 |
14111
|
aaronmk
|
, NULLIF(NULLIF(new."*Name_matched_accepted_family", 'Unknown'),
|
177 |
|
|
new."*Name_matched")
|
178 |
|
|
, NULLIF(new."*Name_matched", 'No suitable matches found.')
|
179 |
|
|
, new."*Name_matched_author"
|
180 |
13871
|
aaronmk
|
), '');
|
181 |
|
|
accepted_taxon_name_with_author text = NULLIF(concat_ws(' '
|
182 |
14111
|
aaronmk
|
, NULLIF(NULLIF(new."*Accepted_name_family", 'Unknown'),
|
183 |
|
|
new."*Accepted_name")
|
184 |
|
|
, new."*Accepted_name"
|
185 |
|
|
, new."*Accepted_name_author"
|
186 |
13871
|
aaronmk
|
), '');
|
187 |
|
|
BEGIN
|
188 |
|
|
new.scrubbed_unique_taxon_name = COALESCE(
|
189 |
|
|
accepted_taxon_name_with_author, matched_taxon_name_with_author);
|
190 |
|
|
END;
|
191 |
|
|
|
192 |
11628
|
aaronmk
|
RETURN new;
|
193 |
7134
|
aaronmk
|
END;
|
194 |
10778
|
aaronmk
|
$$;
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
--
|
198 |
13868
|
aaronmk
|
-- Name: FUNCTION taxon_match__fill(); Type: COMMENT; Schema: TNRS; Owner: -
|
199 |
10778
|
aaronmk
|
--
|
200 |
|
|
|
201 |
13868
|
aaronmk
|
COMMENT ON FUNCTION taxon_match__fill() IS '
|
202 |
13575
|
aaronmk
|
IMPORTANT: when changing this function, you must regenerate the derived cols:
|
203 |
13861
|
aaronmk
|
UPDATE "TNRS".taxon_match SET "Name_submitted" = "Name_submitted"
|
204 |
11715
|
aaronmk
|
runtime: 30 min ("5564082 rows affected, 1918900 ms execution time")
|
205 |
13861
|
aaronmk
|
VACUUM ANALYZE "TNRS".taxon_match -- to remove previous rows
|
206 |
13575
|
aaronmk
|
runtime: 1.5 min ("92633 ms")
|
207 |
|
|
';
|
208 |
7134
|
aaronmk
|
|
209 |
7251
|
aaronmk
|
|
210 |
13631
|
aaronmk
|
--
|
211 |
14122
|
aaronmk
|
-- Name: taxon_match__fill_derived(); Type: FUNCTION; Schema: TNRS; Owner: -
|
212 |
|
|
--
|
213 |
|
|
|
214 |
|
|
CREATE FUNCTION taxon_match__fill_derived() RETURNS trigger
|
215 |
|
|
LANGUAGE plpgsql
|
216 |
|
|
AS $$
|
217 |
|
|
BEGIN
|
218 |
14309
|
aaronmk
|
-- clear derived cols so old values won't be used in calculations
|
219 |
14311
|
aaronmk
|
new."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" = NULL;
|
220 |
14309
|
aaronmk
|
new."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
|
221 |
14330
|
aaronmk
|
new."matched~Name[_no_author]___@TNRS__@vegpath.org" = NULL;
|
222 |
14309
|
aaronmk
|
new."[matched_]scientificName[_with_author]__@DwC__@vegpath.org" = NULL;
|
223 |
|
|
new.matched_has_accepted = NULL;
|
224 |
14318
|
aaronmk
|
new."Accepted_family__@TNRS__@vegpath.org" = NULL;
|
225 |
14366
|
aaronmk
|
new."Accepted_species[_binomial]__@TNRS__@vegpath.org" = NULL;
|
226 |
14376
|
aaronmk
|
new."__accepted_{genus,specific_epithet,infra_{rank,epithet}}" = NULL;
|
227 |
14309
|
aaronmk
|
new."[accepted_]genus__@DwC__@vegpath.org" = NULL;
|
228 |
|
|
new."[accepted_]specificEpithet__@DwC__@vegpath.org" = NULL;
|
229 |
14311
|
aaronmk
|
new."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" = NULL;
|
230 |
14309
|
aaronmk
|
new.__accepted_infraspecific_label = NULL;
|
231 |
|
|
new."__accepted_infraspecific_{rank,epithet}" = NULL;
|
232 |
|
|
new."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = NULL;
|
233 |
|
|
new."[accepted_]infraspecificEpithet__@DwC__@vegpath.org" = NULL;
|
234 |
|
|
new."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" = NULL;
|
235 |
14328
|
aaronmk
|
new."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" = NULL;
|
236 |
14309
|
aaronmk
|
new."[scrubbed_]taxonRank__@DwC__@vegpath.org" = NULL;
|
237 |
|
|
new."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
|
238 |
|
|
new."[scrubbed_]genus__@DwC__@vegpath.org" = NULL;
|
239 |
|
|
new."[scrubbed_]specificEpithet__@DwC__@vegpath.org" = NULL;
|
240 |
|
|
new."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
|
241 |
14328
|
aaronmk
|
new."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" = NULL;
|
242 |
14309
|
aaronmk
|
new."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = NULL;
|
243 |
|
|
new."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" = NULL;
|
244 |
|
|
new."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
|
245 |
|
|
new."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" = NULL;
|
246 |
|
|
new."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" = NULL;
|
247 |
|
|
|
248 |
|
|
-- populate derived cols
|
249 |
14311
|
aaronmk
|
new."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" = (SELECT "*Unmatched_terms" FROM (SELECT new.*) new);
|
250 |
14308
|
aaronmk
|
new."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT ("*Genus_matched" || ' '::text) || "*Specific_epithet_matched" FROM (SELECT new.*) new);
|
251 |
14330
|
aaronmk
|
new."matched~Name[_no_author]___@TNRS__@vegpath.org" = (SELECT NULLIF("*Name_matched", 'No suitable matches found.'::text) FROM (SELECT new.*) new);
|
252 |
|
|
new."[matched_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT "matched~Name[_no_author]___@TNRS__@vegpath.org" || COALESCE((' '::text || "*Name_matched_author"), ''::text) FROM (SELECT new.*) new);
|
253 |
14308
|
aaronmk
|
new.matched_has_accepted = (SELECT "*Accepted_name" IS NOT NULL FROM (SELECT new.*) new);
|
254 |
14318
|
aaronmk
|
new."Accepted_family__@TNRS__@vegpath.org" = (SELECT COALESCE("*Accepted_name_family",
|
255 |
|
|
CASE
|
256 |
|
|
WHEN ("*Accepted_name_rank" = 'family'::text) THEN "*Accepted_name"
|
257 |
|
|
ELSE NULL::text
|
258 |
|
|
END) FROM (SELECT new.*) new);
|
259 |
14366
|
aaronmk
|
new."Accepted_species[_binomial]__@TNRS__@vegpath.org" = (SELECT rtrim("*Accepted_name_species", ' '::text) FROM (SELECT new.*) new);
|
260 |
14376
|
aaronmk
|
new."__accepted_{genus,specific_epithet,infra_{rank,epithet}}" = (SELECT regexp_split_to_array("*Accepted_name", ' '::text) FROM (SELECT new.*) new);
|
261 |
14377
|
aaronmk
|
new."[accepted_]genus__@DwC__@vegpath.org" = (SELECT "__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[1] FROM (SELECT new.*) new);
|
262 |
14376
|
aaronmk
|
new."[accepted_]specificEpithet__@DwC__@vegpath.org" = (SELECT "__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[2] FROM (SELECT new.*) new);
|
263 |
14311
|
aaronmk
|
new."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" = (SELECT CASE
|
264 |
14323
|
aaronmk
|
WHEN ("*Accepted_name_rank" = 'family'::text) THEN concat_ws(' '::text, "Accepted_family__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
265 |
14327
|
aaronmk
|
WHEN ("*Accepted_name_rank" = 'genus'::text) THEN concat_ws(' '::text, "[accepted_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
266 |
14367
|
aaronmk
|
ELSE "Accepted_species[_binomial]__@TNRS__@vegpath.org"
|
267 |
14311
|
aaronmk
|
END FROM (SELECT new.*) new);
|
268 |
14367
|
aaronmk
|
new.__accepted_infraspecific_label = (SELECT ltrim(NULLIF("TNRS".remove_prefix("Accepted_species[_binomial]__@TNRS__@vegpath.org", "*Accepted_name", require := true, case_sensitive := false), ''::text), ' '::text) FROM (SELECT new.*) new);
|
269 |
14378
|
aaronmk
|
new."__accepted_infraspecific_{rank,epithet}" = (SELECT NULLIF("__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[3:4], '{}'::text[]) FROM (SELECT new.*) new);
|
270 |
14308
|
aaronmk
|
new."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = (SELECT "__accepted_infraspecific_{rank,epithet}"[1] FROM (SELECT new.*) new);
|
271 |
|
|
new."[accepted_]infraspecificEpithet__@DwC__@vegpath.org" = (SELECT "__accepted_infraspecific_{rank,epithet}"[2] FROM (SELECT new.*) new);
|
272 |
|
|
new."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT "*Accepted_name" || COALESCE((' '::text || "*Accepted_name_author"), ''::text) FROM (SELECT new.*) new);
|
273 |
14328
|
aaronmk
|
new."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" = (SELECT "TNRS".map_taxonomic_status("*Taxonomic_status", "*Accepted_name") FROM (SELECT new.*) new);
|
274 |
14308
|
aaronmk
|
new."[scrubbed_]taxonRank__@DwC__@vegpath.org" = (SELECT CASE
|
275 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "*Accepted_name_rank"
|
276 |
|
|
ELSE "*Name_matched_rank"
|
277 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
278 |
|
|
new."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT CASE
|
279 |
14323
|
aaronmk
|
WHEN matched_has_accepted THEN "Accepted_family__@TNRS__@vegpath.org"
|
280 |
14282
|
aaronmk
|
ELSE "*Name_matched_accepted_family"
|
281 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
282 |
|
|
new."[scrubbed_]genus__@DwC__@vegpath.org" = (SELECT CASE
|
283 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
|
284 |
|
|
ELSE "*Genus_matched"
|
285 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
286 |
|
|
new."[scrubbed_]specificEpithet__@DwC__@vegpath.org" = (SELECT CASE
|
287 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
|
288 |
|
|
ELSE "*Specific_epithet_matched"
|
289 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
290 |
|
|
new."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT CASE
|
291 |
14367
|
aaronmk
|
WHEN matched_has_accepted THEN "Accepted_species[_binomial]__@TNRS__@vegpath.org"
|
292 |
14282
|
aaronmk
|
ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
|
293 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
294 |
14328
|
aaronmk
|
new."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" = (SELECT CASE
|
295 |
|
|
WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = 'family'::text) THEN concat_ws(' '::text, "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
296 |
|
|
WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = 'genus'::text) THEN concat_ws(' '::text, "[scrubbed_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
297 |
|
|
ELSE "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"
|
298 |
|
|
END FROM (SELECT new.*) new);
|
299 |
14308
|
aaronmk
|
new."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" = (SELECT CASE
|
300 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
|
301 |
|
|
ELSE "*Infraspecific_rank"
|
302 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
303 |
|
|
new."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" = (SELECT CASE
|
304 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
|
305 |
|
|
ELSE "*Infraspecific_epithet_matched"
|
306 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
307 |
|
|
new."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT CASE
|
308 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "*Accepted_name"
|
309 |
14330
|
aaronmk
|
ELSE "matched~Name[_no_author]___@TNRS__@vegpath.org"
|
310 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
311 |
|
|
new."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" = (SELECT CASE
|
312 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "*Accepted_name_author"
|
313 |
|
|
ELSE "*Name_matched_author"
|
314 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
315 |
|
|
new."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" = (SELECT CASE
|
316 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
|
317 |
|
|
ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
|
318 |
14308
|
aaronmk
|
END FROM (SELECT new.*) new);
|
319 |
14304
|
aaronmk
|
|
320 |
14122
|
aaronmk
|
RETURN new;
|
321 |
|
|
END;
|
322 |
|
|
$$;
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
--
|
326 |
14254
|
aaronmk
|
-- Name: FUNCTION taxon_match__fill_derived(); Type: COMMENT; Schema: TNRS; Owner: -
|
327 |
|
|
--
|
328 |
|
|
|
329 |
|
|
COMMENT ON FUNCTION taxon_match__fill_derived() IS '
|
330 |
|
|
autogenerated, do not edit
|
331 |
|
|
|
332 |
|
|
to regenerate:
|
333 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
334 |
|
|
';
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
--
|
338 |
13868
|
aaronmk
|
-- Name: taxon_match__match_num__fill(); Type: FUNCTION; Schema: TNRS; Owner: -
|
339 |
|
|
--
|
340 |
|
|
|
341 |
|
|
CREATE FUNCTION taxon_match__match_num__fill() RETURNS trigger
|
342 |
|
|
LANGUAGE plpgsql
|
343 |
|
|
AS $$
|
344 |
|
|
BEGIN
|
345 |
|
|
IF new.match_num IS NULL THEN
|
346 |
13869
|
aaronmk
|
new.match_num = "TNRS".taxon_match__match_num__next();
|
347 |
13868
|
aaronmk
|
END IF;
|
348 |
|
|
RETURN new;
|
349 |
|
|
END;
|
350 |
|
|
$$;
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
--
|
354 |
13869
|
aaronmk
|
-- Name: taxon_match__match_num__next(); Type: FUNCTION; Schema: TNRS; Owner: -
|
355 |
|
|
--
|
356 |
|
|
|
357 |
|
|
CREATE FUNCTION taxon_match__match_num__next() RETURNS bigint
|
358 |
|
|
LANGUAGE sql
|
359 |
|
|
AS $$
|
360 |
|
|
SELECT nextval('pg_temp.taxon_match__match_num__seq');
|
361 |
|
|
$$;
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
--
|
365 |
13868
|
aaronmk
|
-- Name: taxon_match_input__copy_to__insert(); Type: FUNCTION; Schema: TNRS; Owner: -
|
366 |
|
|
--
|
367 |
|
|
|
368 |
|
|
CREATE FUNCTION taxon_match_input__copy_to__insert() RETURNS trigger
|
369 |
|
|
LANGUAGE plpgsql
|
370 |
|
|
AS $$
|
371 |
|
|
BEGIN
|
372 |
|
|
INSERT INTO "TNRS".taxon_match_input SELECT new.*;
|
373 |
|
|
RETURN NULL;
|
374 |
|
|
END;
|
375 |
|
|
$$;
|
376 |
|
|
|
377 |
|
|
|
378 |
|
|
--
|
379 |
|
|
-- Name: taxon_name_is_safe(text); Type: FUNCTION; Schema: TNRS; Owner: -
|
380 |
|
|
--
|
381 |
|
|
|
382 |
|
|
CREATE FUNCTION taxon_name_is_safe(taxon_name text) RETURNS boolean
|
383 |
|
|
LANGUAGE sql IMMUTABLE
|
384 |
|
|
AS $_$
|
385 |
|
|
SELECT NOT ($1 = ANY("TNRS".unsafe_taxon_names()))
|
386 |
|
|
$_$;
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
--
|
390 |
13631
|
aaronmk
|
-- Name: unsafe_taxon_names(); Type: FUNCTION; Schema: TNRS; Owner: -
|
391 |
|
|
--
|
392 |
|
|
|
393 |
|
|
CREATE FUNCTION unsafe_taxon_names() RETURNS text[]
|
394 |
|
|
LANGUAGE sql IMMUTABLE
|
395 |
|
|
AS $$
|
396 |
|
|
SELECT ARRAY[
|
397 |
13686
|
aaronmk
|
]::text[]
|
398 |
13631
|
aaronmk
|
$$;
|
399 |
|
|
|
400 |
|
|
|
401 |
10778
|
aaronmk
|
SET default_tablespace = '';
|
402 |
|
|
|
403 |
|
|
SET default_with_oids = false;
|
404 |
|
|
|
405 |
10728
|
aaronmk
|
--
|
406 |
13861
|
aaronmk
|
-- Name: taxon_match; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
|
407 |
10778
|
aaronmk
|
--
|
408 |
7251
|
aaronmk
|
|
409 |
13861
|
aaronmk
|
CREATE TABLE taxon_match (
|
410 |
10778
|
aaronmk
|
batch text DEFAULT now() NOT NULL,
|
411 |
13580
|
aaronmk
|
match_num integer NOT NULL,
|
412 |
14111
|
aaronmk
|
"*Name_number" integer NOT NULL,
|
413 |
|
|
"*Name_submitted" text NOT NULL,
|
414 |
|
|
"*Overall_score" double precision,
|
415 |
|
|
"*Name_matched" text,
|
416 |
|
|
"*Name_matched_rank" text,
|
417 |
|
|
"*Name_score" double precision,
|
418 |
|
|
"*Name_matched_author" text,
|
419 |
|
|
"*Name_matched_url" text,
|
420 |
|
|
"*Author_matched" text,
|
421 |
|
|
"*Author_score" double precision,
|
422 |
|
|
"*Family_matched" text,
|
423 |
|
|
"*Family_score" double precision,
|
424 |
|
|
"*Name_matched_accepted_family" text,
|
425 |
|
|
"*Genus_matched" text,
|
426 |
|
|
"*Genus_score" double precision,
|
427 |
|
|
"*Specific_epithet_matched" text,
|
428 |
|
|
"*Specific_epithet_score" double precision,
|
429 |
|
|
"*Infraspecific_rank" text,
|
430 |
|
|
"*Infraspecific_epithet_matched" text,
|
431 |
|
|
"*Infraspecific_epithet_score" double precision,
|
432 |
|
|
"*Infraspecific_rank_2" text,
|
433 |
|
|
"*Infraspecific_epithet_2_matched" text,
|
434 |
|
|
"*Infraspecific_epithet_2_score" double precision,
|
435 |
|
|
"*Annotations" text,
|
436 |
|
|
"*Unmatched_terms" text,
|
437 |
|
|
"*Taxonomic_status" text,
|
438 |
|
|
"*Accepted_name" text,
|
439 |
|
|
"*Accepted_name_author" text,
|
440 |
|
|
"*Accepted_name_rank" text,
|
441 |
|
|
"*Accepted_name_url" text,
|
442 |
|
|
"*Accepted_name_species" text,
|
443 |
|
|
"*Accepted_name_family" text,
|
444 |
|
|
"*Selected" text,
|
445 |
|
|
"*Source" text,
|
446 |
|
|
"*Warnings" text,
|
447 |
|
|
"*Accepted_name_lsid" text,
|
448 |
11628
|
aaronmk
|
is_valid_match boolean NOT NULL,
|
449 |
14122
|
aaronmk
|
scrubbed_unique_taxon_name text,
|
450 |
14310
|
aaronmk
|
"[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" text,
|
451 |
14279
|
aaronmk
|
"[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" text,
|
452 |
14329
|
aaronmk
|
"matched~Name[_no_author]___@TNRS__@vegpath.org" text,
|
453 |
14279
|
aaronmk
|
"[matched_]scientificName[_with_author]__@DwC__@vegpath.org" text,
|
454 |
|
|
matched_has_accepted boolean,
|
455 |
14318
|
aaronmk
|
"Accepted_family__@TNRS__@vegpath.org" text,
|
456 |
14366
|
aaronmk
|
"Accepted_species[_binomial]__@TNRS__@vegpath.org" text,
|
457 |
14376
|
aaronmk
|
"__accepted_{genus,specific_epithet,infra_{rank,epithet}}" text[],
|
458 |
14257
|
aaronmk
|
"[accepted_]genus__@DwC__@vegpath.org" text,
|
459 |
|
|
"[accepted_]specificEpithet__@DwC__@vegpath.org" text,
|
460 |
14310
|
aaronmk
|
"[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" text,
|
461 |
14264
|
aaronmk
|
__accepted_infraspecific_label text,
|
462 |
14265
|
aaronmk
|
"__accepted_infraspecific_{rank,epithet}" text[],
|
463 |
14266
|
aaronmk
|
"[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" text,
|
464 |
|
|
"[accepted_]infraspecificEpithet__@DwC__@vegpath.org" text,
|
465 |
14267
|
aaronmk
|
"[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" text,
|
466 |
14328
|
aaronmk
|
"[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" text,
|
467 |
14281
|
aaronmk
|
"[scrubbed_]taxonRank__@DwC__@vegpath.org" text,
|
468 |
|
|
"[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" text,
|
469 |
|
|
"[scrubbed_]genus__@DwC__@vegpath.org" text,
|
470 |
|
|
"[scrubbed_]specificEpithet__@DwC__@vegpath.org" text,
|
471 |
|
|
"[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" text,
|
472 |
14328
|
aaronmk
|
"[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" text,
|
473 |
14281
|
aaronmk
|
"[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" text,
|
474 |
|
|
"[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" text,
|
475 |
|
|
"[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" text,
|
476 |
|
|
"[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" text,
|
477 |
|
|
"[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" text,
|
478 |
14318
|
aaronmk
|
CONSTRAINT "Accepted_family__@TNRS__@vegpath.org" CHECK ((NOT ("Accepted_family__@TNRS__@vegpath.org" IS DISTINCT FROM COALESCE("*Accepted_name_family",
|
479 |
|
|
CASE
|
480 |
|
|
WHEN ("*Accepted_name_rank" = 'family'::text) THEN "*Accepted_name"
|
481 |
|
|
ELSE NULL::text
|
482 |
|
|
END)))),
|
483 |
14366
|
aaronmk
|
CONSTRAINT "Accepted_species[_binomial]__@TNRS__@vegpath.org" CHECK ((NOT ("Accepted_species[_binomial]__@TNRS__@vegpath.org" IS DISTINCT FROM rtrim("*Accepted_name_species", ' '::text)))),
|
484 |
14266
|
aaronmk
|
CONSTRAINT "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" CHECK ((NOT ("[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS DISTINCT FROM "__accepted_infraspecific_{rank,epithet}"[1]))),
|
485 |
14377
|
aaronmk
|
CONSTRAINT "[accepted_]genus__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]genus__@DwC__@vegpath.org" IS DISTINCT FROM "__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[1]))),
|
486 |
14266
|
aaronmk
|
CONSTRAINT "[accepted_]infraspecificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]infraspecificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM "__accepted_infraspecific_{rank,epithet}"[2]))),
|
487 |
14304
|
aaronmk
|
CONSTRAINT "[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" CHECK ((NOT ("[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" IS DISTINCT FROM
|
488 |
|
|
CASE
|
489 |
14323
|
aaronmk
|
WHEN ("*Accepted_name_rank" = 'family'::text) THEN concat_ws(' '::text, "Accepted_family__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
490 |
14327
|
aaronmk
|
WHEN ("*Accepted_name_rank" = 'genus'::text) THEN concat_ws(' '::text, "[accepted_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
491 |
14367
|
aaronmk
|
ELSE "Accepted_species[_binomial]__@TNRS__@vegpath.org"
|
492 |
14304
|
aaronmk
|
END))),
|
493 |
14267
|
aaronmk
|
CONSTRAINT "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" IS DISTINCT FROM ("*Accepted_name" || COALESCE((' '::text || "*Accepted_name_author"), ''::text))))),
|
494 |
14376
|
aaronmk
|
CONSTRAINT "[accepted_]specificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[accepted_]specificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM "__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[2]))),
|
495 |
14330
|
aaronmk
|
CONSTRAINT "[matched_]scientificName[_with_author]__@DwC__@vegpath.org" CHECK ((NOT ("[matched_]scientificName[_with_author]__@DwC__@vegpath.org" IS DISTINCT FROM ("matched~Name[_no_author]___@TNRS__@vegpath.org" || COALESCE((' '::text || "*Name_matched_author"), ''::text))))),
|
496 |
14278
|
aaronmk
|
CONSTRAINT "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM (("*Genus_matched" || ' '::text) || "*Specific_epithet_matched")))),
|
497 |
14303
|
aaronmk
|
CONSTRAINT "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" CHECK ((NOT ("[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" IS DISTINCT FROM "*Unmatched_terms"))),
|
498 |
14281
|
aaronmk
|
CONSTRAINT "[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS DISTINCT FROM
|
499 |
|
|
CASE
|
500 |
|
|
WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
|
501 |
|
|
ELSE "*Infraspecific_rank"
|
502 |
|
|
END))),
|
503 |
|
|
CONSTRAINT "[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM
|
504 |
|
|
CASE
|
505 |
|
|
WHEN matched_has_accepted THEN "*Accepted_name_author"
|
506 |
|
|
ELSE "*Name_matched_author"
|
507 |
|
|
END))),
|
508 |
|
|
CONSTRAINT "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM
|
509 |
|
|
CASE
|
510 |
14323
|
aaronmk
|
WHEN matched_has_accepted THEN "Accepted_family__@TNRS__@vegpath.org"
|
511 |
14281
|
aaronmk
|
ELSE "*Name_matched_accepted_family"
|
512 |
|
|
END))),
|
513 |
|
|
CONSTRAINT "[scrubbed_]genus__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]genus__@DwC__@vegpath.org" IS DISTINCT FROM
|
514 |
|
|
CASE
|
515 |
|
|
WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
|
516 |
|
|
ELSE "*Genus_matched"
|
517 |
|
|
END))),
|
518 |
|
|
CONSTRAINT "[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM
|
519 |
|
|
CASE
|
520 |
|
|
WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
|
521 |
|
|
ELSE "*Infraspecific_epithet_matched"
|
522 |
|
|
END))),
|
523 |
14326
|
aaronmk
|
CONSTRAINT "[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" CHECK ((NOT ("[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" IS DISTINCT FROM
|
524 |
|
|
CASE
|
525 |
|
|
WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = 'family'::text) THEN concat_ws(' '::text, "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
526 |
|
|
WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = 'genus'::text) THEN concat_ws(' '::text, "[scrubbed_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
527 |
|
|
ELSE "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"
|
528 |
|
|
END))),
|
529 |
14281
|
aaronmk
|
CONSTRAINT "[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM
|
530 |
|
|
CASE
|
531 |
|
|
WHEN matched_has_accepted THEN "*Accepted_name"
|
532 |
14330
|
aaronmk
|
ELSE "matched~Name[_no_author]___@TNRS__@vegpath.org"
|
533 |
14281
|
aaronmk
|
END))),
|
534 |
|
|
CONSTRAINT "[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" IS DISTINCT FROM
|
535 |
|
|
CASE
|
536 |
|
|
WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
|
537 |
|
|
ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
|
538 |
|
|
END))),
|
539 |
|
|
CONSTRAINT "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" CHECK ((NOT ("[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" IS DISTINCT FROM
|
540 |
|
|
CASE
|
541 |
14367
|
aaronmk
|
WHEN matched_has_accepted THEN "Accepted_species[_binomial]__@TNRS__@vegpath.org"
|
542 |
14281
|
aaronmk
|
ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
|
543 |
|
|
END))),
|
544 |
|
|
CONSTRAINT "[scrubbed_]specificEpithet__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]specificEpithet__@DwC__@vegpath.org" IS DISTINCT FROM
|
545 |
|
|
CASE
|
546 |
|
|
WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
|
547 |
|
|
ELSE "*Specific_epithet_matched"
|
548 |
|
|
END))),
|
549 |
|
|
CONSTRAINT "[scrubbed_]taxonRank__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]taxonRank__@DwC__@vegpath.org" IS DISTINCT FROM
|
550 |
|
|
CASE
|
551 |
|
|
WHEN matched_has_accepted THEN "*Accepted_name_rank"
|
552 |
|
|
ELSE "*Name_matched_rank"
|
553 |
|
|
END))),
|
554 |
14324
|
aaronmk
|
CONSTRAINT "[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" CHECK ((NOT ("[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" IS DISTINCT FROM map_taxonomic_status("*Taxonomic_status", "*Accepted_name")))),
|
555 |
14367
|
aaronmk
|
CONSTRAINT __accepted_infraspecific_label CHECK ((NOT (__accepted_infraspecific_label IS DISTINCT FROM ltrim(NULLIF(remove_prefix("Accepted_species[_binomial]__@TNRS__@vegpath.org", "*Accepted_name", require := true, case_sensitive := false), ''::text), ' '::text)))),
|
556 |
14378
|
aaronmk
|
CONSTRAINT "__accepted_infraspecific_{rank,epithet}" CHECK ((NOT ("__accepted_infraspecific_{rank,epithet}" IS DISTINCT FROM NULLIF("__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[3:4], '{}'::text[])))),
|
557 |
14376
|
aaronmk
|
CONSTRAINT "__accepted_{genus,specific_epithet,infra_{rank,epithet}}" CHECK ((NOT ("__accepted_{genus,specific_epithet,infra_{rank,epithet}}" IS DISTINCT FROM regexp_split_to_array("*Accepted_name", ' '::text)))),
|
558 |
14329
|
aaronmk
|
CONSTRAINT matched_has_accepted CHECK ((NOT (matched_has_accepted IS DISTINCT FROM ("*Accepted_name" IS NOT NULL)))),
|
559 |
|
|
CONSTRAINT "matched~Name[_no_author]___@TNRS__@vegpath.org" CHECK ((NOT ("matched~Name[_no_author]___@TNRS__@vegpath.org" IS DISTINCT FROM NULLIF("*Name_matched", 'No suitable matches found.'::text))))
|
560 |
10778
|
aaronmk
|
);
|
561 |
7823
|
aaronmk
|
|
562 |
9759
|
aaronmk
|
|
563 |
10778
|
aaronmk
|
--
|
564 |
13861
|
aaronmk
|
-- Name: TABLE taxon_match; Type: COMMENT; Schema: TNRS; Owner: -
|
565 |
10778
|
aaronmk
|
--
|
566 |
7823
|
aaronmk
|
|
567 |
13861
|
aaronmk
|
COMMENT ON TABLE taxon_match IS '
|
568 |
14161
|
aaronmk
|
whenever columns are renamed:
|
569 |
14312
|
aaronmk
|
SELECT util.derived_cols_update(''"TNRS".taxon_match'');
|
570 |
14161
|
aaronmk
|
|
571 |
14332
|
aaronmk
|
to port derived column changes to vegbiendev:
|
572 |
|
|
SELECT util.derived_cols_export(''"TNRS".taxon_match'');
|
573 |
|
|
# run the returned SQL on vegbiendev
|
574 |
14364
|
aaronmk
|
-- runtime: 30 min ("5564201 rows affected, 1624829 ms execution time")
|
575 |
14361
|
aaronmk
|
SELECT util.recreate_view(''"TNRS".taxon_best_match'');
|
576 |
14332
|
aaronmk
|
|
577 |
14364
|
aaronmk
|
to add a new derived column:
|
578 |
|
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''col''), $$
|
579 |
|
|
expr
|
580 |
|
|
$$));
|
581 |
|
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match'');
|
582 |
14361
|
aaronmk
|
SELECT util.recreate_view(''"TNRS".taxon_best_match'');
|
583 |
13577
|
aaronmk
|
$ make schemas/remake
|
584 |
|
|
|
585 |
14365
|
aaronmk
|
to remove a column:
|
586 |
|
|
SELECT util.recreate_view(''"TNRS".taxon_best_match'');
|
587 |
|
|
$ make schemas/remake
|
588 |
|
|
|
589 |
|
|
to move a derived column to the middle or to add a non-derived column:
|
590 |
13577
|
aaronmk
|
make the changes in inputs/.TNRS/schema.sql
|
591 |
14368
|
aaronmk
|
$ inputs/.TNRS/data.sql.run refresh # re-run TNRS; runtime: 1 min ("1m2.629s")
|
592 |
14313
|
aaronmk
|
SELECT util.derived_cols_update(''"TNRS".taxon_match'');
|
593 |
14317
|
aaronmk
|
SELECT util.derived_cols_repopulate(''"TNRS".taxon_match'');
|
594 |
14361
|
aaronmk
|
SELECT util.recreate_view(''"TNRS".taxon_best_match'');
|
595 |
13577
|
aaronmk
|
$ make schemas/remake
|
596 |
13582
|
aaronmk
|
|
597 |
13584
|
aaronmk
|
to add a constraint: runtime: 3 min ("173620 ms")
|
598 |
13575
|
aaronmk
|
';
|
599 |
10778
|
aaronmk
|
|
600 |
|
|
|
601 |
|
|
--
|
602 |
14311
|
aaronmk
|
-- Name: COLUMN taxon_match."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
603 |
|
|
--
|
604 |
|
|
|
605 |
|
|
COMMENT ON COLUMN taxon_match."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org" IS '
|
606 |
|
|
= "*Unmatched_terms"
|
607 |
|
|
|
608 |
|
|
derived column
|
609 |
|
|
|
610 |
|
|
to modify expr:
|
611 |
|
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org'')::util.col, $$"*Unmatched_terms"$$)::util.derived_col_def);
|
612 |
|
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
613 |
|
|
|
614 |
|
|
to rename:
|
615 |
|
|
# rename column
|
616 |
|
|
# rename CHECK constraint
|
617 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
618 |
14379
|
aaronmk
|
|
619 |
|
|
to drop:
|
620 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org'')::util.col);
|
621 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
622 |
14311
|
aaronmk
|
';
|
623 |
|
|
|
624 |
|
|
|
625 |
|
|
--
|
626 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
627 |
14254
|
aaronmk
|
--
|
628 |
|
|
|
629 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
|
630 |
14283
|
aaronmk
|
= ("*Genus_matched" || '' ''::text) || "*Specific_epithet_matched"
|
631 |
14254
|
aaronmk
|
|
632 |
14283
|
aaronmk
|
derived column
|
633 |
|
|
|
634 |
14275
|
aaronmk
|
to modify expr:
|
635 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$("*Genus_matched" || '' ''::text) || "*Specific_epithet_matched"$$)::util.derived_col_def);
|
636 |
14258
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
637 |
14275
|
aaronmk
|
|
638 |
|
|
to rename:
|
639 |
|
|
# rename column
|
640 |
|
|
# rename CHECK constraint
|
641 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
642 |
14379
|
aaronmk
|
|
643 |
|
|
to drop:
|
644 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col);
|
645 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
646 |
14254
|
aaronmk
|
';
|
647 |
|
|
|
648 |
|
|
|
649 |
|
|
--
|
650 |
14329
|
aaronmk
|
-- Name: COLUMN taxon_match."matched~Name[_no_author]___@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
651 |
|
|
--
|
652 |
|
|
|
653 |
|
|
COMMENT ON COLUMN taxon_match."matched~Name[_no_author]___@TNRS__@vegpath.org" IS '
|
654 |
|
|
= NULLIF("*Name_matched", ''No suitable matches found.''::text)
|
655 |
|
|
|
656 |
|
|
derived column
|
657 |
|
|
|
658 |
|
|
to modify expr:
|
659 |
|
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''matched~Name[_no_author]___@TNRS__@vegpath.org'')::util.col, $$NULLIF("*Name_matched", ''No suitable matches found.''::text)$$)::util.derived_col_def);
|
660 |
|
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
661 |
|
|
|
662 |
|
|
to rename:
|
663 |
|
|
# rename column
|
664 |
|
|
# rename CHECK constraint
|
665 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
666 |
14379
|
aaronmk
|
|
667 |
|
|
to drop:
|
668 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''matched~Name[_no_author]___@TNRS__@vegpath.org'')::util.col);
|
669 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
670 |
14329
|
aaronmk
|
';
|
671 |
|
|
|
672 |
|
|
|
673 |
|
|
--
|
674 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
675 |
14257
|
aaronmk
|
--
|
676 |
|
|
|
677 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
|
678 |
14330
|
aaronmk
|
= "matched~Name[_no_author]___@TNRS__@vegpath.org" || COALESCE(('' ''::text || "*Name_matched_author"), ''''::text)
|
679 |
14257
|
aaronmk
|
|
680 |
14283
|
aaronmk
|
derived column
|
681 |
|
|
|
682 |
14275
|
aaronmk
|
to modify expr:
|
683 |
14330
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[matched_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$"matched~Name[_no_author]___@TNRS__@vegpath.org" || COALESCE(('' ''::text || "*Name_matched_author"), ''''::text)$$)::util.derived_col_def);
|
684 |
14258
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
685 |
14275
|
aaronmk
|
|
686 |
|
|
to rename:
|
687 |
|
|
# rename column
|
688 |
|
|
# rename CHECK constraint
|
689 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
690 |
14379
|
aaronmk
|
|
691 |
|
|
to drop:
|
692 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[matched_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col);
|
693 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
694 |
14257
|
aaronmk
|
';
|
695 |
|
|
|
696 |
|
|
|
697 |
|
|
--
|
698 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match.matched_has_accepted; Type: COMMENT; Schema: TNRS; Owner: -
|
699 |
14257
|
aaronmk
|
--
|
700 |
|
|
|
701 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match.matched_has_accepted IS '
|
702 |
14283
|
aaronmk
|
= "*Accepted_name" IS NOT NULL
|
703 |
14257
|
aaronmk
|
|
704 |
14283
|
aaronmk
|
derived column
|
705 |
|
|
|
706 |
14275
|
aaronmk
|
to modify expr:
|
707 |
14279
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''matched_has_accepted'')::util.col, $$"*Accepted_name" IS NOT NULL$$)::util.derived_col_def);
|
708 |
14258
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
709 |
14275
|
aaronmk
|
|
710 |
|
|
to rename:
|
711 |
|
|
# rename column
|
712 |
|
|
# rename CHECK constraint
|
713 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
714 |
14379
|
aaronmk
|
|
715 |
|
|
to drop:
|
716 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''matched_has_accepted'')::util.col);
|
717 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
718 |
14257
|
aaronmk
|
';
|
719 |
|
|
|
720 |
|
|
|
721 |
|
|
--
|
722 |
14318
|
aaronmk
|
-- Name: COLUMN taxon_match."Accepted_family__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
723 |
|
|
--
|
724 |
|
|
|
725 |
|
|
COMMENT ON COLUMN taxon_match."Accepted_family__@TNRS__@vegpath.org" IS '
|
726 |
|
|
= COALESCE("*Accepted_name_family",
|
727 |
|
|
CASE
|
728 |
|
|
WHEN ("*Accepted_name_rank" = ''family''::text) THEN "*Accepted_name"
|
729 |
|
|
ELSE NULL::text
|
730 |
|
|
END)
|
731 |
|
|
|
732 |
|
|
derived column
|
733 |
|
|
|
734 |
|
|
to modify expr:
|
735 |
|
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''Accepted_family__@TNRS__@vegpath.org'')::util.col, $$COALESCE("*Accepted_name_family",
|
736 |
|
|
CASE
|
737 |
|
|
WHEN ("*Accepted_name_rank" = ''family''::text) THEN "*Accepted_name"
|
738 |
|
|
ELSE NULL::text
|
739 |
|
|
END)$$)::util.derived_col_def);
|
740 |
|
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
741 |
|
|
|
742 |
|
|
to rename:
|
743 |
|
|
# rename column
|
744 |
|
|
# rename CHECK constraint
|
745 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
746 |
14379
|
aaronmk
|
|
747 |
|
|
to drop:
|
748 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''Accepted_family__@TNRS__@vegpath.org'')::util.col);
|
749 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
750 |
14318
|
aaronmk
|
';
|
751 |
|
|
|
752 |
|
|
|
753 |
|
|
--
|
754 |
14366
|
aaronmk
|
-- Name: COLUMN taxon_match."Accepted_species[_binomial]__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
755 |
|
|
--
|
756 |
|
|
|
757 |
|
|
COMMENT ON COLUMN taxon_match."Accepted_species[_binomial]__@TNRS__@vegpath.org" IS '
|
758 |
|
|
= rtrim("*Accepted_name_species", '' ''::text)
|
759 |
|
|
|
760 |
|
|
derived column
|
761 |
|
|
|
762 |
|
|
to modify expr:
|
763 |
|
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''Accepted_species[_binomial]__@TNRS__@vegpath.org'')::util.col, $$rtrim("*Accepted_name_species", '' ''::text)$$)::util.derived_col_def);
|
764 |
|
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
765 |
|
|
|
766 |
|
|
to rename:
|
767 |
|
|
# rename column
|
768 |
|
|
# rename CHECK constraint
|
769 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
770 |
14379
|
aaronmk
|
|
771 |
|
|
to drop:
|
772 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''Accepted_species[_binomial]__@TNRS__@vegpath.org'')::util.col);
|
773 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
774 |
14366
|
aaronmk
|
';
|
775 |
|
|
|
776 |
|
|
|
777 |
|
|
--
|
778 |
14376
|
aaronmk
|
-- Name: COLUMN taxon_match."__accepted_{genus,specific_epithet,infra_{rank,epithet}}"; Type: COMMENT; Schema: TNRS; Owner: -
|
779 |
14264
|
aaronmk
|
--
|
780 |
|
|
|
781 |
14376
|
aaronmk
|
COMMENT ON COLUMN taxon_match."__accepted_{genus,specific_epithet,infra_{rank,epithet}}" IS '
|
782 |
14375
|
aaronmk
|
= regexp_split_to_array("*Accepted_name", '' ''::text)
|
783 |
14264
|
aaronmk
|
|
784 |
14283
|
aaronmk
|
derived column
|
785 |
|
|
|
786 |
14275
|
aaronmk
|
to modify expr:
|
787 |
14376
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''__accepted_{genus,specific_epithet,infra_{rank,epithet}}'')::util.col, $$regexp_split_to_array("*Accepted_name", '' ''::text)$$)::util.derived_col_def);
|
788 |
14264
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
789 |
14275
|
aaronmk
|
|
790 |
|
|
to rename:
|
791 |
|
|
# rename column
|
792 |
|
|
# rename CHECK constraint
|
793 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
794 |
14379
|
aaronmk
|
|
795 |
|
|
to drop:
|
796 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''__accepted_{genus,specific_epithet,infra_{rank,epithet}}'')::util.col);
|
797 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
798 |
14264
|
aaronmk
|
';
|
799 |
|
|
|
800 |
|
|
|
801 |
|
|
--
|
802 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match."[accepted_]genus__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
803 |
14265
|
aaronmk
|
--
|
804 |
|
|
|
805 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match."[accepted_]genus__@DwC__@vegpath.org" IS '
|
806 |
14377
|
aaronmk
|
= "__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[1]
|
807 |
14265
|
aaronmk
|
|
808 |
14283
|
aaronmk
|
derived column
|
809 |
|
|
|
810 |
14275
|
aaronmk
|
to modify expr:
|
811 |
14377
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]genus__@DwC__@vegpath.org'')::util.col, $$"__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[1]$$)::util.derived_col_def);
|
812 |
14265
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
813 |
14275
|
aaronmk
|
|
814 |
|
|
to rename:
|
815 |
|
|
# rename column
|
816 |
|
|
# rename CHECK constraint
|
817 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
818 |
14379
|
aaronmk
|
|
819 |
|
|
to drop:
|
820 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[accepted_]genus__@DwC__@vegpath.org'')::util.col);
|
821 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
822 |
14265
|
aaronmk
|
';
|
823 |
|
|
|
824 |
|
|
|
825 |
|
|
--
|
826 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match."[accepted_]specificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
827 |
14266
|
aaronmk
|
--
|
828 |
|
|
|
829 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match."[accepted_]specificEpithet__@DwC__@vegpath.org" IS '
|
830 |
14376
|
aaronmk
|
= "__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[2]
|
831 |
14266
|
aaronmk
|
|
832 |
14283
|
aaronmk
|
derived column
|
833 |
|
|
|
834 |
14275
|
aaronmk
|
to modify expr:
|
835 |
14376
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]specificEpithet__@DwC__@vegpath.org'')::util.col, $$"__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[2]$$)::util.derived_col_def);
|
836 |
14266
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
837 |
14275
|
aaronmk
|
|
838 |
|
|
to rename:
|
839 |
|
|
# rename column
|
840 |
|
|
# rename CHECK constraint
|
841 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
842 |
14379
|
aaronmk
|
|
843 |
|
|
to drop:
|
844 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[accepted_]specificEpithet__@DwC__@vegpath.org'')::util.col);
|
845 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
846 |
14266
|
aaronmk
|
';
|
847 |
|
|
|
848 |
|
|
|
849 |
|
|
--
|
850 |
14311
|
aaronmk
|
-- Name: COLUMN taxon_match."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
851 |
|
|
--
|
852 |
|
|
|
853 |
|
|
COMMENT ON COLUMN taxon_match."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" IS '
|
854 |
|
|
= CASE
|
855 |
14323
|
aaronmk
|
WHEN ("*Accepted_name_rank" = ''family''::text) THEN concat_ws('' ''::text, "Accepted_family__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
856 |
14327
|
aaronmk
|
WHEN ("*Accepted_name_rank" = ''genus''::text) THEN concat_ws('' ''::text, "[accepted_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
857 |
14367
|
aaronmk
|
ELSE "Accepted_species[_binomial]__@TNRS__@vegpath.org"
|
858 |
14311
|
aaronmk
|
END
|
859 |
|
|
|
860 |
|
|
derived column
|
861 |
|
|
|
862 |
|
|
to modify expr:
|
863 |
|
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org'')::util.col, $$CASE
|
864 |
14323
|
aaronmk
|
WHEN ("*Accepted_name_rank" = ''family''::text) THEN concat_ws('' ''::text, "Accepted_family__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
865 |
14327
|
aaronmk
|
WHEN ("*Accepted_name_rank" = ''genus''::text) THEN concat_ws('' ''::text, "[accepted_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
866 |
14367
|
aaronmk
|
ELSE "Accepted_species[_binomial]__@TNRS__@vegpath.org"
|
867 |
14311
|
aaronmk
|
END$$)::util.derived_col_def);
|
868 |
|
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
869 |
|
|
|
870 |
|
|
to rename:
|
871 |
|
|
# rename column
|
872 |
|
|
# rename CHECK constraint
|
873 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
874 |
14379
|
aaronmk
|
|
875 |
|
|
to drop:
|
876 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org'')::util.col);
|
877 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
878 |
14311
|
aaronmk
|
';
|
879 |
|
|
|
880 |
|
|
|
881 |
|
|
--
|
882 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match.__accepted_infraspecific_label; Type: COMMENT; Schema: TNRS; Owner: -
|
883 |
14266
|
aaronmk
|
--
|
884 |
|
|
|
885 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match.__accepted_infraspecific_label IS '
|
886 |
14367
|
aaronmk
|
= ltrim(NULLIF("TNRS".remove_prefix("Accepted_species[_binomial]__@TNRS__@vegpath.org", "*Accepted_name", require := true, case_sensitive := false), ''''::text), '' ''::text)
|
887 |
14266
|
aaronmk
|
|
888 |
14283
|
aaronmk
|
derived column
|
889 |
|
|
|
890 |
14275
|
aaronmk
|
to modify expr:
|
891 |
14367
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''__accepted_infraspecific_label'')::util.col, $$ltrim(NULLIF("TNRS".remove_prefix("Accepted_species[_binomial]__@TNRS__@vegpath.org", "*Accepted_name", require := true, case_sensitive := false), ''''::text), '' ''::text)$$)::util.derived_col_def);
|
892 |
14266
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
893 |
14275
|
aaronmk
|
|
894 |
|
|
to rename:
|
895 |
|
|
# rename column
|
896 |
|
|
# rename CHECK constraint
|
897 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
898 |
14379
|
aaronmk
|
|
899 |
|
|
to drop:
|
900 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''__accepted_infraspecific_label'')::util.col);
|
901 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
902 |
14266
|
aaronmk
|
';
|
903 |
|
|
|
904 |
|
|
|
905 |
|
|
--
|
906 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match."__accepted_infraspecific_{rank,epithet}"; Type: COMMENT; Schema: TNRS; Owner: -
|
907 |
14267
|
aaronmk
|
--
|
908 |
|
|
|
909 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match."__accepted_infraspecific_{rank,epithet}" IS '
|
910 |
14378
|
aaronmk
|
= NULLIF("__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[3:4], ''{}''::text[])
|
911 |
14267
|
aaronmk
|
|
912 |
14283
|
aaronmk
|
derived column
|
913 |
|
|
|
914 |
14275
|
aaronmk
|
to modify expr:
|
915 |
14378
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''__accepted_infraspecific_{rank,epithet}'')::util.col, $$NULLIF("__accepted_{genus,specific_epithet,infra_{rank,epithet}}"[3:4], ''{}''::text[])$$)::util.derived_col_def);
|
916 |
14267
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
917 |
14275
|
aaronmk
|
|
918 |
|
|
to rename:
|
919 |
|
|
# rename column
|
920 |
|
|
# rename CHECK constraint
|
921 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
922 |
14379
|
aaronmk
|
|
923 |
|
|
to drop:
|
924 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''__accepted_infraspecific_{rank,epithet}'')::util.col);
|
925 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
926 |
14267
|
aaronmk
|
';
|
927 |
|
|
|
928 |
|
|
|
929 |
|
|
--
|
930 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
931 |
14267
|
aaronmk
|
--
|
932 |
|
|
|
933 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS '
|
934 |
14283
|
aaronmk
|
= "__accepted_infraspecific_{rank,epithet}"[1]
|
935 |
14267
|
aaronmk
|
|
936 |
14283
|
aaronmk
|
derived column
|
937 |
|
|
|
938 |
14275
|
aaronmk
|
to modify expr:
|
939 |
14279
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col, $$"__accepted_infraspecific_{rank,epithet}"[1]$$)::util.derived_col_def);
|
940 |
14267
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
941 |
14275
|
aaronmk
|
|
942 |
|
|
to rename:
|
943 |
|
|
# rename column
|
944 |
|
|
# rename CHECK constraint
|
945 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
946 |
14379
|
aaronmk
|
|
947 |
|
|
to drop:
|
948 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col);
|
949 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
950 |
14267
|
aaronmk
|
';
|
951 |
|
|
|
952 |
|
|
|
953 |
|
|
--
|
954 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
955 |
14269
|
aaronmk
|
--
|
956 |
|
|
|
957 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org" IS '
|
958 |
14283
|
aaronmk
|
= "__accepted_infraspecific_{rank,epithet}"[2]
|
959 |
14269
|
aaronmk
|
|
960 |
14283
|
aaronmk
|
derived column
|
961 |
|
|
|
962 |
14275
|
aaronmk
|
to modify expr:
|
963 |
14279
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col, $$"__accepted_infraspecific_{rank,epithet}"[2]$$)::util.derived_col_def);
|
964 |
14269
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
965 |
14275
|
aaronmk
|
|
966 |
|
|
to rename:
|
967 |
|
|
# rename column
|
968 |
|
|
# rename CHECK constraint
|
969 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
970 |
14379
|
aaronmk
|
|
971 |
|
|
to drop:
|
972 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[accepted_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col);
|
973 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
974 |
14269
|
aaronmk
|
';
|
975 |
|
|
|
976 |
|
|
|
977 |
|
|
--
|
978 |
14279
|
aaronmk
|
-- Name: COLUMN taxon_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
979 |
14278
|
aaronmk
|
--
|
980 |
|
|
|
981 |
14279
|
aaronmk
|
COMMENT ON COLUMN taxon_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
|
982 |
14283
|
aaronmk
|
= "*Accepted_name" || COALESCE(('' ''::text || "*Accepted_name_author"), ''''::text)
|
983 |
14278
|
aaronmk
|
|
984 |
14283
|
aaronmk
|
derived column
|
985 |
|
|
|
986 |
14278
|
aaronmk
|
to modify expr:
|
987 |
14279
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[accepted_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$"*Accepted_name" || COALESCE(('' ''::text || "*Accepted_name_author"), ''''::text)$$)::util.derived_col_def);
|
988 |
14278
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
989 |
|
|
|
990 |
|
|
to rename:
|
991 |
|
|
# rename column
|
992 |
|
|
# rename CHECK constraint
|
993 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
994 |
14379
|
aaronmk
|
|
995 |
|
|
to drop:
|
996 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[accepted_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col);
|
997 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
998 |
14278
|
aaronmk
|
';
|
999 |
|
|
|
1000 |
|
|
|
1001 |
|
|
--
|
1002 |
14328
|
aaronmk
|
-- Name: COLUMN taxon_match."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1003 |
|
|
--
|
1004 |
|
|
|
1005 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org" IS '
|
1006 |
|
|
= "TNRS".map_taxonomic_status("*Taxonomic_status", "*Accepted_name")
|
1007 |
|
|
|
1008 |
|
|
derived column
|
1009 |
|
|
|
1010 |
|
|
to modify expr:
|
1011 |
|
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]taxonomicStatus__@DwC__@vegpath.org'')::util.col, $$"TNRS".map_taxonomic_status("*Taxonomic_status", "*Accepted_name")$$)::util.derived_col_def);
|
1012 |
|
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1013 |
|
|
|
1014 |
|
|
to rename:
|
1015 |
|
|
# rename column
|
1016 |
|
|
# rename CHECK constraint
|
1017 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1018 |
14379
|
aaronmk
|
|
1019 |
|
|
to drop:
|
1020 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]taxonomicStatus__@DwC__@vegpath.org'')::util.col);
|
1021 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1022 |
14328
|
aaronmk
|
';
|
1023 |
|
|
|
1024 |
|
|
|
1025 |
|
|
--
|
1026 |
14281
|
aaronmk
|
-- Name: COLUMN taxon_match."[scrubbed_]taxonRank__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1027 |
|
|
--
|
1028 |
|
|
|
1029 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]taxonRank__@DwC__@vegpath.org" IS '
|
1030 |
14283
|
aaronmk
|
= CASE
|
1031 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "*Accepted_name_rank"
|
1032 |
|
|
ELSE "*Name_matched_rank"
|
1033 |
|
|
END
|
1034 |
14281
|
aaronmk
|
|
1035 |
14283
|
aaronmk
|
derived column
|
1036 |
|
|
|
1037 |
14281
|
aaronmk
|
to modify expr:
|
1038 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]taxonRank__@DwC__@vegpath.org'')::util.col, $$CASE
|
1039 |
|
|
WHEN matched_has_accepted THEN "*Accepted_name_rank"
|
1040 |
|
|
ELSE "*Name_matched_rank"
|
1041 |
|
|
END$$)::util.derived_col_def);
|
1042 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1043 |
|
|
|
1044 |
|
|
to rename:
|
1045 |
|
|
# rename column
|
1046 |
|
|
# rename CHECK constraint
|
1047 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1048 |
14379
|
aaronmk
|
|
1049 |
|
|
to drop:
|
1050 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]taxonRank__@DwC__@vegpath.org'')::util.col);
|
1051 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1052 |
14281
|
aaronmk
|
';
|
1053 |
|
|
|
1054 |
|
|
|
1055 |
|
|
--
|
1056 |
|
|
-- Name: COLUMN taxon_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1057 |
|
|
--
|
1058 |
|
|
|
1059 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org" IS '
|
1060 |
14283
|
aaronmk
|
= CASE
|
1061 |
14323
|
aaronmk
|
WHEN matched_has_accepted THEN "Accepted_family__@TNRS__@vegpath.org"
|
1062 |
14282
|
aaronmk
|
ELSE "*Name_matched_accepted_family"
|
1063 |
|
|
END
|
1064 |
14281
|
aaronmk
|
|
1065 |
14283
|
aaronmk
|
derived column
|
1066 |
|
|
|
1067 |
14281
|
aaronmk
|
to modify expr:
|
1068 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
|
1069 |
14323
|
aaronmk
|
WHEN matched_has_accepted THEN "Accepted_family__@TNRS__@vegpath.org"
|
1070 |
14282
|
aaronmk
|
ELSE "*Name_matched_accepted_family"
|
1071 |
|
|
END$$)::util.derived_col_def);
|
1072 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1073 |
|
|
|
1074 |
|
|
to rename:
|
1075 |
|
|
# rename column
|
1076 |
|
|
# rename CHECK constraint
|
1077 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1078 |
14379
|
aaronmk
|
|
1079 |
|
|
to drop:
|
1080 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col);
|
1081 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1082 |
14281
|
aaronmk
|
';
|
1083 |
|
|
|
1084 |
|
|
|
1085 |
|
|
--
|
1086 |
|
|
-- Name: COLUMN taxon_match."[scrubbed_]genus__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1087 |
|
|
--
|
1088 |
|
|
|
1089 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]genus__@DwC__@vegpath.org" IS '
|
1090 |
14283
|
aaronmk
|
= CASE
|
1091 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
|
1092 |
|
|
ELSE "*Genus_matched"
|
1093 |
|
|
END
|
1094 |
14281
|
aaronmk
|
|
1095 |
14283
|
aaronmk
|
derived column
|
1096 |
|
|
|
1097 |
14281
|
aaronmk
|
to modify expr:
|
1098 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]genus__@DwC__@vegpath.org'')::util.col, $$CASE
|
1099 |
|
|
WHEN matched_has_accepted THEN "[accepted_]genus__@DwC__@vegpath.org"
|
1100 |
|
|
ELSE "*Genus_matched"
|
1101 |
|
|
END$$)::util.derived_col_def);
|
1102 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1103 |
|
|
|
1104 |
|
|
to rename:
|
1105 |
|
|
# rename column
|
1106 |
|
|
# rename CHECK constraint
|
1107 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1108 |
14379
|
aaronmk
|
|
1109 |
|
|
to drop:
|
1110 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]genus__@DwC__@vegpath.org'')::util.col);
|
1111 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1112 |
14281
|
aaronmk
|
';
|
1113 |
|
|
|
1114 |
|
|
|
1115 |
|
|
--
|
1116 |
|
|
-- Name: COLUMN taxon_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1117 |
|
|
--
|
1118 |
|
|
|
1119 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org" IS '
|
1120 |
14283
|
aaronmk
|
= CASE
|
1121 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
|
1122 |
|
|
ELSE "*Specific_epithet_matched"
|
1123 |
|
|
END
|
1124 |
14281
|
aaronmk
|
|
1125 |
14283
|
aaronmk
|
derived column
|
1126 |
|
|
|
1127 |
14281
|
aaronmk
|
to modify expr:
|
1128 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]specificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE
|
1129 |
|
|
WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
|
1130 |
|
|
ELSE "*Specific_epithet_matched"
|
1131 |
|
|
END$$)::util.derived_col_def);
|
1132 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1133 |
|
|
|
1134 |
|
|
to rename:
|
1135 |
|
|
# rename column
|
1136 |
|
|
# rename CHECK constraint
|
1137 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1138 |
14379
|
aaronmk
|
|
1139 |
|
|
to drop:
|
1140 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]specificEpithet__@DwC__@vegpath.org'')::util.col);
|
1141 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1142 |
14281
|
aaronmk
|
';
|
1143 |
|
|
|
1144 |
|
|
|
1145 |
|
|
--
|
1146 |
|
|
-- Name: COLUMN taxon_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1147 |
|
|
--
|
1148 |
|
|
|
1149 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
|
1150 |
14283
|
aaronmk
|
= CASE
|
1151 |
14367
|
aaronmk
|
WHEN matched_has_accepted THEN "Accepted_species[_binomial]__@TNRS__@vegpath.org"
|
1152 |
14282
|
aaronmk
|
ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
|
1153 |
|
|
END
|
1154 |
14281
|
aaronmk
|
|
1155 |
14283
|
aaronmk
|
derived column
|
1156 |
|
|
|
1157 |
14281
|
aaronmk
|
to modify expr:
|
1158 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
|
1159 |
14367
|
aaronmk
|
WHEN matched_has_accepted THEN "Accepted_species[_binomial]__@TNRS__@vegpath.org"
|
1160 |
14282
|
aaronmk
|
ELSE "[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org"
|
1161 |
|
|
END$$)::util.derived_col_def);
|
1162 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1163 |
|
|
|
1164 |
|
|
to rename:
|
1165 |
|
|
# rename column
|
1166 |
|
|
# rename CHECK constraint
|
1167 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1168 |
14379
|
aaronmk
|
|
1169 |
|
|
to drop:
|
1170 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col);
|
1171 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1172 |
14281
|
aaronmk
|
';
|
1173 |
|
|
|
1174 |
|
|
|
1175 |
|
|
--
|
1176 |
14328
|
aaronmk
|
-- Name: COLUMN taxon_match."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1177 |
|
|
--
|
1178 |
|
|
|
1179 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org" IS '
|
1180 |
|
|
= CASE
|
1181 |
|
|
WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = ''family''::text) THEN concat_ws('' ''::text, "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
1182 |
|
|
WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = ''genus''::text) THEN concat_ws('' ''::text, "[scrubbed_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
1183 |
|
|
ELSE "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"
|
1184 |
|
|
END
|
1185 |
|
|
|
1186 |
|
|
derived column
|
1187 |
|
|
|
1188 |
|
|
to modify expr:
|
1189 |
|
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org'')::util.col, $$CASE
|
1190 |
|
|
WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = ''family''::text) THEN concat_ws('' ''::text, "[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
1191 |
|
|
WHEN ("[scrubbed_]taxonRank__@DwC__@vegpath.org" = ''genus''::text) THEN concat_ws('' ''::text, "[scrubbed_]genus__@DwC__@vegpath.org", "[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org")
|
1192 |
|
|
ELSE "[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org"
|
1193 |
|
|
END$$)::util.derived_col_def);
|
1194 |
|
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1195 |
|
|
|
1196 |
|
|
to rename:
|
1197 |
|
|
# rename column
|
1198 |
|
|
# rename CHECK constraint
|
1199 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1200 |
14379
|
aaronmk
|
|
1201 |
|
|
to drop:
|
1202 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org'')::util.col);
|
1203 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1204 |
14328
|
aaronmk
|
';
|
1205 |
|
|
|
1206 |
|
|
|
1207 |
|
|
--
|
1208 |
14281
|
aaronmk
|
-- Name: COLUMN taxon_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1209 |
|
|
--
|
1210 |
|
|
|
1211 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org" IS '
|
1212 |
14283
|
aaronmk
|
= CASE
|
1213 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
|
1214 |
|
|
ELSE "*Infraspecific_rank"
|
1215 |
|
|
END
|
1216 |
14281
|
aaronmk
|
|
1217 |
14283
|
aaronmk
|
derived column
|
1218 |
|
|
|
1219 |
14281
|
aaronmk
|
to modify expr:
|
1220 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col, $$CASE
|
1221 |
|
|
WHEN matched_has_accepted THEN "[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org"
|
1222 |
|
|
ELSE "*Infraspecific_rank"
|
1223 |
|
|
END$$)::util.derived_col_def);
|
1224 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1225 |
|
|
|
1226 |
|
|
to rename:
|
1227 |
|
|
# rename column
|
1228 |
|
|
# rename CHECK constraint
|
1229 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1230 |
14379
|
aaronmk
|
|
1231 |
|
|
to drop:
|
1232 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org'')::util.col);
|
1233 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1234 |
14281
|
aaronmk
|
';
|
1235 |
|
|
|
1236 |
|
|
|
1237 |
|
|
--
|
1238 |
|
|
-- Name: COLUMN taxon_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1239 |
|
|
--
|
1240 |
|
|
|
1241 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org" IS '
|
1242 |
14283
|
aaronmk
|
= CASE
|
1243 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
|
1244 |
|
|
ELSE "*Infraspecific_epithet_matched"
|
1245 |
|
|
END
|
1246 |
14281
|
aaronmk
|
|
1247 |
14283
|
aaronmk
|
derived column
|
1248 |
|
|
|
1249 |
14281
|
aaronmk
|
to modify expr:
|
1250 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col, $$CASE
|
1251 |
|
|
WHEN matched_has_accepted THEN "[accepted_]specificEpithet__@DwC__@vegpath.org"
|
1252 |
|
|
ELSE "*Infraspecific_epithet_matched"
|
1253 |
|
|
END$$)::util.derived_col_def);
|
1254 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1255 |
|
|
|
1256 |
|
|
to rename:
|
1257 |
|
|
# rename column
|
1258 |
|
|
# rename CHECK constraint
|
1259 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1260 |
14379
|
aaronmk
|
|
1261 |
|
|
to drop:
|
1262 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org'')::util.col);
|
1263 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1264 |
14281
|
aaronmk
|
';
|
1265 |
|
|
|
1266 |
|
|
|
1267 |
|
|
--
|
1268 |
|
|
-- Name: COLUMN taxon_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1269 |
|
|
--
|
1270 |
|
|
|
1271 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org" IS '
|
1272 |
14283
|
aaronmk
|
= CASE
|
1273 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "*Accepted_name"
|
1274 |
14330
|
aaronmk
|
ELSE "matched~Name[_no_author]___@TNRS__@vegpath.org"
|
1275 |
14282
|
aaronmk
|
END
|
1276 |
14281
|
aaronmk
|
|
1277 |
14283
|
aaronmk
|
derived column
|
1278 |
|
|
|
1279 |
14281
|
aaronmk
|
to modify expr:
|
1280 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
|
1281 |
|
|
WHEN matched_has_accepted THEN "*Accepted_name"
|
1282 |
14330
|
aaronmk
|
ELSE "matched~Name[_no_author]___@TNRS__@vegpath.org"
|
1283 |
14282
|
aaronmk
|
END$$)::util.derived_col_def);
|
1284 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1285 |
|
|
|
1286 |
|
|
to rename:
|
1287 |
|
|
# rename column
|
1288 |
|
|
# rename CHECK constraint
|
1289 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1290 |
14379
|
aaronmk
|
|
1291 |
|
|
to drop:
|
1292 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col);
|
1293 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1294 |
14281
|
aaronmk
|
';
|
1295 |
|
|
|
1296 |
|
|
|
1297 |
|
|
--
|
1298 |
|
|
-- Name: COLUMN taxon_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1299 |
|
|
--
|
1300 |
|
|
|
1301 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org" IS '
|
1302 |
14283
|
aaronmk
|
= CASE
|
1303 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "*Accepted_name_author"
|
1304 |
|
|
ELSE "*Name_matched_author"
|
1305 |
|
|
END
|
1306 |
14281
|
aaronmk
|
|
1307 |
14283
|
aaronmk
|
derived column
|
1308 |
|
|
|
1309 |
14281
|
aaronmk
|
to modify expr:
|
1310 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col, $$CASE
|
1311 |
|
|
WHEN matched_has_accepted THEN "*Accepted_name_author"
|
1312 |
|
|
ELSE "*Name_matched_author"
|
1313 |
|
|
END$$)::util.derived_col_def);
|
1314 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1315 |
|
|
|
1316 |
|
|
to rename:
|
1317 |
|
|
# rename column
|
1318 |
|
|
# rename CHECK constraint
|
1319 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1320 |
14379
|
aaronmk
|
|
1321 |
|
|
to drop:
|
1322 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org'')::util.col);
|
1323 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1324 |
14281
|
aaronmk
|
';
|
1325 |
|
|
|
1326 |
|
|
|
1327 |
|
|
--
|
1328 |
|
|
-- Name: COLUMN taxon_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org"; Type: COMMENT; Schema: TNRS; Owner: -
|
1329 |
|
|
--
|
1330 |
|
|
|
1331 |
|
|
COMMENT ON COLUMN taxon_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org" IS '
|
1332 |
14283
|
aaronmk
|
= CASE
|
1333 |
14282
|
aaronmk
|
WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
|
1334 |
|
|
ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
|
1335 |
|
|
END
|
1336 |
14281
|
aaronmk
|
|
1337 |
14283
|
aaronmk
|
derived column
|
1338 |
|
|
|
1339 |
14281
|
aaronmk
|
to modify expr:
|
1340 |
14282
|
aaronmk
|
SELECT util.derived_col_update(((''"TNRS".taxon_match'', ''[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col, $$CASE
|
1341 |
|
|
WHEN matched_has_accepted THEN "[accepted_]scientificName[_with_author]__@DwC__@vegpath.org"
|
1342 |
|
|
ELSE "[matched_]scientificName[_with_author]__@DwC__@vegpath.org"
|
1343 |
|
|
END$$)::util.derived_col_def);
|
1344 |
14281
|
aaronmk
|
SELECT util.derived_cols_populate(''"TNRS".taxon_match''::regclass);
|
1345 |
|
|
|
1346 |
|
|
to rename:
|
1347 |
|
|
# rename column
|
1348 |
|
|
# rename CHECK constraint
|
1349 |
|
|
SELECT util.derived_cols_update(''"TNRS".taxon_match''::regclass);
|
1350 |
14379
|
aaronmk
|
|
1351 |
|
|
to drop:
|
1352 |
|
|
SELECT util.drop_derived_col((''"TNRS".taxon_match'', ''[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org'')::util.col);
|
1353 |
|
|
-- DROP __ CASCADE doesn''t work when there are dependent views
|
1354 |
14281
|
aaronmk
|
';
|
1355 |
|
|
|
1356 |
|
|
|
1357 |
|
|
--
|
1358 |
13878
|
aaronmk
|
-- Name: taxon_best_match; Type: VIEW; Schema: TNRS; Owner: -
|
1359 |
|
|
--
|
1360 |
|
|
|
1361 |
|
|
CREATE VIEW taxon_best_match AS
|
1362 |
|
|
SELECT taxon_match.batch,
|
1363 |
|
|
taxon_match.match_num,
|
1364 |
14111
|
aaronmk
|
taxon_match."*Name_number",
|
1365 |
|
|
taxon_match."*Name_submitted",
|
1366 |
|
|
taxon_match."*Overall_score",
|
1367 |
|
|
taxon_match."*Name_matched",
|
1368 |
|
|
taxon_match."*Name_matched_rank",
|
1369 |
|
|
taxon_match."*Name_score",
|
1370 |
|
|
taxon_match."*Name_matched_author",
|
1371 |
|
|
taxon_match."*Name_matched_url",
|
1372 |
|
|
taxon_match."*Author_matched",
|
1373 |
|
|
taxon_match."*Author_score",
|
1374 |
|
|
taxon_match."*Family_matched",
|
1375 |
|
|
taxon_match."*Family_score",
|
1376 |
|
|
taxon_match."*Name_matched_accepted_family",
|
1377 |
|
|
taxon_match."*Genus_matched",
|
1378 |
|
|
taxon_match."*Genus_score",
|
1379 |
|
|
taxon_match."*Specific_epithet_matched",
|
1380 |
|
|
taxon_match."*Specific_epithet_score",
|
1381 |
|
|
taxon_match."*Infraspecific_rank",
|
1382 |
|
|
taxon_match."*Infraspecific_epithet_matched",
|
1383 |
|
|
taxon_match."*Infraspecific_epithet_score",
|
1384 |
|
|
taxon_match."*Infraspecific_rank_2",
|
1385 |
|
|
taxon_match."*Infraspecific_epithet_2_matched",
|
1386 |
|
|
taxon_match."*Infraspecific_epithet_2_score",
|
1387 |
|
|
taxon_match."*Annotations",
|
1388 |
|
|
taxon_match."*Unmatched_terms",
|
1389 |
|
|
taxon_match."*Taxonomic_status",
|
1390 |
|
|
taxon_match."*Accepted_name",
|
1391 |
|
|
taxon_match."*Accepted_name_author",
|
1392 |
|
|
taxon_match."*Accepted_name_rank",
|
1393 |
|
|
taxon_match."*Accepted_name_url",
|
1394 |
|
|
taxon_match."*Accepted_name_species",
|
1395 |
|
|
taxon_match."*Accepted_name_family",
|
1396 |
|
|
taxon_match."*Selected",
|
1397 |
|
|
taxon_match."*Source",
|
1398 |
|
|
taxon_match."*Warnings",
|
1399 |
|
|
taxon_match."*Accepted_name_lsid",
|
1400 |
13878
|
aaronmk
|
taxon_match.is_valid_match,
|
1401 |
14268
|
aaronmk
|
taxon_match.scrubbed_unique_taxon_name,
|
1402 |
14359
|
aaronmk
|
taxon_match."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org",
|
1403 |
14284
|
aaronmk
|
taxon_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1404 |
14359
|
aaronmk
|
taxon_match."matched~Name[_no_author]___@TNRS__@vegpath.org",
|
1405 |
14284
|
aaronmk
|
taxon_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1406 |
|
|
taxon_match.matched_has_accepted,
|
1407 |
14359
|
aaronmk
|
taxon_match."Accepted_family__@TNRS__@vegpath.org",
|
1408 |
14366
|
aaronmk
|
taxon_match."Accepted_species[_binomial]__@TNRS__@vegpath.org",
|
1409 |
14388
|
aaronmk
|
taxon_match."__accepted_{genus,specific_epithet,infra_{rank,epithet}}",
|
1410 |
14268
|
aaronmk
|
taxon_match."[accepted_]genus__@DwC__@vegpath.org",
|
1411 |
|
|
taxon_match."[accepted_]specificEpithet__@DwC__@vegpath.org",
|
1412 |
14359
|
aaronmk
|
taxon_match."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org",
|
1413 |
14268
|
aaronmk
|
taxon_match.__accepted_infraspecific_label,
|
1414 |
|
|
taxon_match."__accepted_infraspecific_{rank,epithet}",
|
1415 |
|
|
taxon_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
|
1416 |
|
|
taxon_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
|
1417 |
14284
|
aaronmk
|
taxon_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1418 |
14359
|
aaronmk
|
taxon_match."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org",
|
1419 |
14284
|
aaronmk
|
taxon_match."[scrubbed_]taxonRank__@DwC__@vegpath.org",
|
1420 |
|
|
taxon_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org",
|
1421 |
|
|
taxon_match."[scrubbed_]genus__@DwC__@vegpath.org",
|
1422 |
|
|
taxon_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org",
|
1423 |
|
|
taxon_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1424 |
14359
|
aaronmk
|
taxon_match."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org",
|
1425 |
14284
|
aaronmk
|
taxon_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
|
1426 |
|
|
taxon_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org",
|
1427 |
|
|
taxon_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1428 |
|
|
taxon_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org",
|
1429 |
|
|
taxon_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org"
|
1430 |
13878
|
aaronmk
|
FROM taxon_match
|
1431 |
14111
|
aaronmk
|
WHERE (taxon_match."*Selected" = 'true'::text);
|
1432 |
13878
|
aaronmk
|
|
1433 |
|
|
|
1434 |
|
|
--
|
1435 |
|
|
-- Name: VIEW taxon_best_match; Type: COMMENT; Schema: TNRS; Owner: -
|
1436 |
|
|
--
|
1437 |
|
|
|
1438 |
|
|
COMMENT ON VIEW taxon_best_match IS '
|
1439 |
|
|
to modify:
|
1440 |
|
|
SELECT util.recreate_view(''"TNRS"."taxon_best_match"'', $$
|
1441 |
|
|
SELECT __
|
1442 |
|
|
$$);
|
1443 |
|
|
';
|
1444 |
|
|
|
1445 |
|
|
|
1446 |
|
|
--
|
1447 |
10778
|
aaronmk
|
-- Name: MatchedTaxon; Type: VIEW; Schema: TNRS; Owner: -
|
1448 |
|
|
--
|
1449 |
|
|
|
1450 |
|
|
CREATE VIEW "MatchedTaxon" AS
|
1451 |
14110
|
aaronmk
|
SELECT taxon_best_match.batch,
|
1452 |
|
|
taxon_best_match.match_num,
|
1453 |
14111
|
aaronmk
|
taxon_best_match."*Name_number",
|
1454 |
|
|
taxon_best_match."*Name_submitted",
|
1455 |
|
|
taxon_best_match."*Overall_score",
|
1456 |
|
|
taxon_best_match."*Name_matched",
|
1457 |
|
|
taxon_best_match."*Name_matched_rank",
|
1458 |
|
|
taxon_best_match."*Name_score",
|
1459 |
|
|
taxon_best_match."*Name_matched_author",
|
1460 |
|
|
taxon_best_match."*Name_matched_url",
|
1461 |
|
|
taxon_best_match."*Author_matched",
|
1462 |
|
|
taxon_best_match."*Author_score",
|
1463 |
|
|
taxon_best_match."*Family_matched",
|
1464 |
|
|
taxon_best_match."*Family_score",
|
1465 |
|
|
taxon_best_match."*Name_matched_accepted_family",
|
1466 |
|
|
taxon_best_match."*Genus_matched",
|
1467 |
|
|
taxon_best_match."*Genus_score",
|
1468 |
|
|
taxon_best_match."*Specific_epithet_matched",
|
1469 |
|
|
taxon_best_match."*Specific_epithet_score",
|
1470 |
|
|
taxon_best_match."*Infraspecific_rank",
|
1471 |
|
|
taxon_best_match."*Infraspecific_epithet_matched",
|
1472 |
|
|
taxon_best_match."*Infraspecific_epithet_score",
|
1473 |
|
|
taxon_best_match."*Infraspecific_rank_2",
|
1474 |
|
|
taxon_best_match."*Infraspecific_epithet_2_matched",
|
1475 |
|
|
taxon_best_match."*Infraspecific_epithet_2_score",
|
1476 |
|
|
taxon_best_match."*Annotations",
|
1477 |
|
|
taxon_best_match."*Unmatched_terms",
|
1478 |
|
|
taxon_best_match."*Taxonomic_status",
|
1479 |
|
|
taxon_best_match."*Accepted_name",
|
1480 |
|
|
taxon_best_match."*Accepted_name_author",
|
1481 |
|
|
taxon_best_match."*Accepted_name_rank",
|
1482 |
|
|
taxon_best_match."*Accepted_name_url",
|
1483 |
|
|
taxon_best_match."*Accepted_name_species",
|
1484 |
|
|
taxon_best_match."*Accepted_name_family",
|
1485 |
|
|
taxon_best_match."*Selected",
|
1486 |
|
|
taxon_best_match."*Source",
|
1487 |
|
|
taxon_best_match."*Warnings",
|
1488 |
|
|
taxon_best_match."*Accepted_name_lsid",
|
1489 |
14110
|
aaronmk
|
taxon_best_match.is_valid_match,
|
1490 |
|
|
taxon_best_match.scrubbed_unique_taxon_name,
|
1491 |
14359
|
aaronmk
|
taxon_best_match."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org",
|
1492 |
14284
|
aaronmk
|
taxon_best_match."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1493 |
14359
|
aaronmk
|
taxon_best_match."matched~Name[_no_author]___@TNRS__@vegpath.org",
|
1494 |
14284
|
aaronmk
|
taxon_best_match."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1495 |
|
|
taxon_best_match.matched_has_accepted,
|
1496 |
14359
|
aaronmk
|
taxon_best_match."Accepted_family__@TNRS__@vegpath.org",
|
1497 |
14366
|
aaronmk
|
taxon_best_match."Accepted_species[_binomial]__@TNRS__@vegpath.org",
|
1498 |
14388
|
aaronmk
|
taxon_best_match."__accepted_{genus,specific_epithet,infra_{rank,epithet}}",
|
1499 |
14268
|
aaronmk
|
taxon_best_match."[accepted_]genus__@DwC__@vegpath.org",
|
1500 |
|
|
taxon_best_match."[accepted_]specificEpithet__@DwC__@vegpath.org",
|
1501 |
14359
|
aaronmk
|
taxon_best_match."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org",
|
1502 |
14268
|
aaronmk
|
taxon_best_match.__accepted_infraspecific_label,
|
1503 |
|
|
taxon_best_match."__accepted_infraspecific_{rank,epithet}",
|
1504 |
|
|
taxon_best_match."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
|
1505 |
|
|
taxon_best_match."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
|
1506 |
|
|
taxon_best_match."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1507 |
14359
|
aaronmk
|
taxon_best_match."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org",
|
1508 |
14284
|
aaronmk
|
taxon_best_match."[scrubbed_]taxonRank__@DwC__@vegpath.org",
|
1509 |
|
|
taxon_best_match."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org",
|
1510 |
|
|
taxon_best_match."[scrubbed_]genus__@DwC__@vegpath.org",
|
1511 |
|
|
taxon_best_match."[scrubbed_]specificEpithet__@DwC__@vegpath.org",
|
1512 |
|
|
taxon_best_match."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1513 |
14359
|
aaronmk
|
taxon_best_match."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org",
|
1514 |
14284
|
aaronmk
|
taxon_best_match."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
|
1515 |
|
|
taxon_best_match."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org",
|
1516 |
|
|
taxon_best_match."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1517 |
|
|
taxon_best_match."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org",
|
1518 |
|
|
taxon_best_match."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1519 |
14111
|
aaronmk
|
map_taxonomic_status(taxon_best_match."*Taxonomic_status", taxon_best_match."*Accepted_name") AS "taxonomicStatus",
|
1520 |
13498
|
aaronmk
|
CASE
|
1521 |
14111
|
aaronmk
|
WHEN (taxon_best_match."*Accepted_name_rank" = 'family'::text) THEN concat_ws(' '::text, taxon_best_match."*Accepted_name_family", taxon_best_match."*Unmatched_terms")
|
1522 |
|
|
WHEN (taxon_best_match."*Accepted_name_rank" = 'genus'::text) THEN concat_ws(' '::text, taxon_best_match."*Accepted_name", taxon_best_match."*Unmatched_terms")
|
1523 |
|
|
ELSE taxon_best_match."*Accepted_name_species"
|
1524 |
13498
|
aaronmk
|
END AS accepted_morphospecies_binomial
|
1525 |
14110
|
aaronmk
|
FROM taxon_best_match;
|
1526 |
10778
|
aaronmk
|
|
1527 |
|
|
|
1528 |
|
|
--
|
1529 |
13498
|
aaronmk
|
-- Name: VIEW "MatchedTaxon"; Type: COMMENT; Schema: TNRS; Owner: -
|
1530 |
|
|
--
|
1531 |
|
|
|
1532 |
|
|
COMMENT ON VIEW "MatchedTaxon" IS '
|
1533 |
13501
|
aaronmk
|
to modify:
|
1534 |
13845
|
aaronmk
|
SELECT util.recreate_view(''"TNRS"."MatchedTaxon"'', $$
|
1535 |
13647
|
aaronmk
|
SELECT __
|
1536 |
13501
|
aaronmk
|
$$);
|
1537 |
13498
|
aaronmk
|
';
|
1538 |
|
|
|
1539 |
|
|
|
1540 |
|
|
--
|
1541 |
10778
|
aaronmk
|
-- Name: ValidMatchedTaxon; Type: VIEW; Schema: TNRS; Owner: -
|
1542 |
|
|
--
|
1543 |
|
|
|
1544 |
|
|
CREATE VIEW "ValidMatchedTaxon" AS
|
1545 |
14108
|
aaronmk
|
SELECT "MatchedTaxon".batch,
|
1546 |
14105
|
aaronmk
|
"MatchedTaxon".match_num,
|
1547 |
14111
|
aaronmk
|
"MatchedTaxon"."*Name_number",
|
1548 |
|
|
"MatchedTaxon"."*Name_submitted",
|
1549 |
|
|
"MatchedTaxon"."*Overall_score",
|
1550 |
|
|
"MatchedTaxon"."*Name_matched",
|
1551 |
|
|
"MatchedTaxon"."*Name_matched_rank",
|
1552 |
|
|
"MatchedTaxon"."*Name_score",
|
1553 |
|
|
"MatchedTaxon"."*Name_matched_author",
|
1554 |
|
|
"MatchedTaxon"."*Name_matched_url",
|
1555 |
|
|
"MatchedTaxon"."*Author_matched",
|
1556 |
|
|
"MatchedTaxon"."*Author_score",
|
1557 |
|
|
"MatchedTaxon"."*Family_matched",
|
1558 |
|
|
"MatchedTaxon"."*Family_score",
|
1559 |
|
|
"MatchedTaxon"."*Name_matched_accepted_family",
|
1560 |
|
|
"MatchedTaxon"."*Genus_matched",
|
1561 |
|
|
"MatchedTaxon"."*Genus_score",
|
1562 |
|
|
"MatchedTaxon"."*Specific_epithet_matched",
|
1563 |
|
|
"MatchedTaxon"."*Specific_epithet_score",
|
1564 |
|
|
"MatchedTaxon"."*Infraspecific_rank",
|
1565 |
|
|
"MatchedTaxon"."*Infraspecific_epithet_matched",
|
1566 |
|
|
"MatchedTaxon"."*Infraspecific_epithet_score",
|
1567 |
|
|
"MatchedTaxon"."*Infraspecific_rank_2",
|
1568 |
|
|
"MatchedTaxon"."*Infraspecific_epithet_2_matched",
|
1569 |
|
|
"MatchedTaxon"."*Infraspecific_epithet_2_score",
|
1570 |
|
|
"MatchedTaxon"."*Annotations",
|
1571 |
|
|
"MatchedTaxon"."*Unmatched_terms",
|
1572 |
|
|
"MatchedTaxon"."*Taxonomic_status",
|
1573 |
|
|
"MatchedTaxon"."*Accepted_name",
|
1574 |
|
|
"MatchedTaxon"."*Accepted_name_author",
|
1575 |
|
|
"MatchedTaxon"."*Accepted_name_rank",
|
1576 |
|
|
"MatchedTaxon"."*Accepted_name_url",
|
1577 |
|
|
"MatchedTaxon"."*Accepted_name_species",
|
1578 |
|
|
"MatchedTaxon"."*Accepted_name_family",
|
1579 |
|
|
"MatchedTaxon"."*Selected",
|
1580 |
|
|
"MatchedTaxon"."*Source",
|
1581 |
|
|
"MatchedTaxon"."*Warnings",
|
1582 |
|
|
"MatchedTaxon"."*Accepted_name_lsid",
|
1583 |
14108
|
aaronmk
|
"MatchedTaxon".is_valid_match,
|
1584 |
13800
|
aaronmk
|
"MatchedTaxon".scrubbed_unique_taxon_name,
|
1585 |
14359
|
aaronmk
|
"MatchedTaxon"."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org",
|
1586 |
14284
|
aaronmk
|
"MatchedTaxon"."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1587 |
14359
|
aaronmk
|
"MatchedTaxon"."matched~Name[_no_author]___@TNRS__@vegpath.org",
|
1588 |
14284
|
aaronmk
|
"MatchedTaxon"."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1589 |
|
|
"MatchedTaxon".matched_has_accepted,
|
1590 |
14359
|
aaronmk
|
"MatchedTaxon"."Accepted_family__@TNRS__@vegpath.org",
|
1591 |
14366
|
aaronmk
|
"MatchedTaxon"."Accepted_species[_binomial]__@TNRS__@vegpath.org",
|
1592 |
14388
|
aaronmk
|
"MatchedTaxon"."__accepted_{genus,specific_epithet,infra_{rank,epithet}}",
|
1593 |
14268
|
aaronmk
|
"MatchedTaxon"."[accepted_]genus__@DwC__@vegpath.org",
|
1594 |
|
|
"MatchedTaxon"."[accepted_]specificEpithet__@DwC__@vegpath.org",
|
1595 |
14359
|
aaronmk
|
"MatchedTaxon"."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org",
|
1596 |
14268
|
aaronmk
|
"MatchedTaxon".__accepted_infraspecific_label,
|
1597 |
|
|
"MatchedTaxon"."__accepted_infraspecific_{rank,epithet}",
|
1598 |
|
|
"MatchedTaxon"."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
|
1599 |
|
|
"MatchedTaxon"."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
|
1600 |
|
|
"MatchedTaxon"."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1601 |
14359
|
aaronmk
|
"MatchedTaxon"."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org",
|
1602 |
14284
|
aaronmk
|
"MatchedTaxon"."[scrubbed_]taxonRank__@DwC__@vegpath.org",
|
1603 |
|
|
"MatchedTaxon"."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org",
|
1604 |
|
|
"MatchedTaxon"."[scrubbed_]genus__@DwC__@vegpath.org",
|
1605 |
|
|
"MatchedTaxon"."[scrubbed_]specificEpithet__@DwC__@vegpath.org",
|
1606 |
|
|
"MatchedTaxon"."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1607 |
14359
|
aaronmk
|
"MatchedTaxon"."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org",
|
1608 |
14284
|
aaronmk
|
"MatchedTaxon"."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
|
1609 |
|
|
"MatchedTaxon"."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org",
|
1610 |
|
|
"MatchedTaxon"."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1611 |
|
|
"MatchedTaxon"."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org",
|
1612 |
|
|
"MatchedTaxon"."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1613 |
14103
|
aaronmk
|
"MatchedTaxon"."taxonomicStatus",
|
1614 |
13498
|
aaronmk
|
"MatchedTaxon".accepted_morphospecies_binomial
|
1615 |
11708
|
aaronmk
|
FROM "MatchedTaxon"
|
1616 |
14108
|
aaronmk
|
WHERE "MatchedTaxon".is_valid_match;
|
1617 |
10778
|
aaronmk
|
|
1618 |
|
|
|
1619 |
|
|
--
|
1620 |
|
|
-- Name: VIEW "ValidMatchedTaxon"; Type: COMMENT; Schema: TNRS; Owner: -
|
1621 |
|
|
--
|
1622 |
|
|
|
1623 |
13443
|
aaronmk
|
COMMENT ON VIEW "ValidMatchedTaxon" IS '
|
1624 |
|
|
to update, use * as the column list
|
1625 |
|
|
';
|
1626 |
10778
|
aaronmk
|
|
1627 |
|
|
|
1628 |
|
|
--
|
1629 |
|
|
-- Name: batch; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
|
1630 |
|
|
--
|
1631 |
|
|
|
1632 |
|
|
CREATE TABLE batch (
|
1633 |
|
|
id text NOT NULL,
|
1634 |
|
|
id_by_time text,
|
1635 |
|
|
time_submitted timestamp with time zone DEFAULT now(),
|
1636 |
|
|
client_version text
|
1637 |
|
|
);
|
1638 |
|
|
|
1639 |
|
|
|
1640 |
|
|
--
|
1641 |
|
|
-- Name: batch_download_settings; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
|
1642 |
|
|
--
|
1643 |
|
|
|
1644 |
|
|
CREATE TABLE batch_download_settings (
|
1645 |
|
|
id text NOT NULL,
|
1646 |
|
|
"E-mail" text,
|
1647 |
|
|
"Id" text,
|
1648 |
|
|
"Job type" text,
|
1649 |
|
|
"Contains Id" boolean,
|
1650 |
|
|
"Start time" text,
|
1651 |
|
|
"Finish time" text,
|
1652 |
|
|
"TNRS version" text,
|
1653 |
|
|
"Sources selected" text,
|
1654 |
|
|
"Match threshold" double precision,
|
1655 |
|
|
"Classification" text,
|
1656 |
|
|
"Allow partial matches?" boolean,
|
1657 |
|
|
"Sort by source" boolean,
|
1658 |
|
|
"Constrain by higher taxonomy" boolean
|
1659 |
|
|
);
|
1660 |
|
|
|
1661 |
|
|
|
1662 |
|
|
--
|
1663 |
|
|
-- Name: TABLE batch_download_settings; Type: COMMENT; Schema: TNRS; Owner: -
|
1664 |
|
|
--
|
1665 |
|
|
|
1666 |
13575
|
aaronmk
|
COMMENT ON TABLE batch_download_settings IS '
|
1667 |
|
|
stores data from http://tnrs.iplantcollaborative.org/TNRSapp.html > Submit List > results section > Download settings > settings.txt
|
1668 |
|
|
';
|
1669 |
10778
|
aaronmk
|
|
1670 |
|
|
|
1671 |
|
|
--
|
1672 |
|
|
-- Name: client_version; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
|
1673 |
|
|
--
|
1674 |
|
|
|
1675 |
|
|
CREATE TABLE client_version (
|
1676 |
|
|
id text NOT NULL,
|
1677 |
|
|
global_rev integer NOT NULL,
|
1678 |
|
|
"/lib/tnrs.py rev" integer,
|
1679 |
|
|
"/bin/tnrs_db rev" integer
|
1680 |
|
|
);
|
1681 |
|
|
|
1682 |
|
|
|
1683 |
|
|
--
|
1684 |
|
|
-- Name: TABLE client_version; Type: COMMENT; Schema: TNRS; Owner: -
|
1685 |
|
|
--
|
1686 |
|
|
|
1687 |
13575
|
aaronmk
|
COMMENT ON TABLE client_version IS '
|
1688 |
|
|
contains svn revisions
|
1689 |
|
|
';
|
1690 |
10778
|
aaronmk
|
|
1691 |
|
|
|
1692 |
|
|
--
|
1693 |
|
|
-- Name: COLUMN client_version.global_rev; Type: COMMENT; Schema: TNRS; Owner: -
|
1694 |
|
|
--
|
1695 |
|
|
|
1696 |
13575
|
aaronmk
|
COMMENT ON COLUMN client_version.global_rev IS '
|
1697 |
|
|
from `svn info .` > Last Changed Rev
|
1698 |
|
|
';
|
1699 |
10778
|
aaronmk
|
|
1700 |
|
|
|
1701 |
|
|
--
|
1702 |
|
|
-- Name: COLUMN client_version."/lib/tnrs.py rev"; Type: COMMENT; Schema: TNRS; Owner: -
|
1703 |
|
|
--
|
1704 |
|
|
|
1705 |
13575
|
aaronmk
|
COMMENT ON COLUMN client_version."/lib/tnrs.py rev" IS '
|
1706 |
|
|
from `svn info lib/tnrs.py` > Last Changed Rev
|
1707 |
|
|
';
|
1708 |
10778
|
aaronmk
|
|
1709 |
|
|
|
1710 |
|
|
--
|
1711 |
|
|
-- Name: COLUMN client_version."/bin/tnrs_db rev"; Type: COMMENT; Schema: TNRS; Owner: -
|
1712 |
|
|
--
|
1713 |
|
|
|
1714 |
13575
|
aaronmk
|
COMMENT ON COLUMN client_version."/bin/tnrs_db rev" IS '
|
1715 |
|
|
from `svn info bin/tnrs_db` > Last Changed Rev
|
1716 |
|
|
';
|
1717 |
10778
|
aaronmk
|
|
1718 |
|
|
|
1719 |
|
|
--
|
1720 |
13866
|
aaronmk
|
-- Name: taxon_match_input; Type: VIEW; Schema: TNRS; Owner: -
|
1721 |
|
|
--
|
1722 |
|
|
|
1723 |
|
|
CREATE VIEW taxon_match_input AS
|
1724 |
14111
|
aaronmk
|
SELECT taxon_match."*Name_number" AS "Name_number",
|
1725 |
|
|
taxon_match."*Name_submitted" AS "Name_submitted",
|
1726 |
|
|
taxon_match."*Overall_score" AS "Overall_score",
|
1727 |
|
|
taxon_match."*Name_matched" AS "Name_matched",
|
1728 |
|
|
taxon_match."*Name_matched_rank" AS "Name_matched_rank",
|
1729 |
|
|
taxon_match."*Name_score" AS "Name_score",
|
1730 |
|
|
taxon_match."*Name_matched_author" AS "Name_matched_author",
|
1731 |
|
|
taxon_match."*Name_matched_url" AS "Name_matched_url",
|
1732 |
|
|
taxon_match."*Author_matched" AS "Author_matched",
|
1733 |
|
|
taxon_match."*Author_score" AS "Author_score",
|
1734 |
|
|
taxon_match."*Family_matched" AS "Family_matched",
|
1735 |
|
|
taxon_match."*Family_score" AS "Family_score",
|
1736 |
|
|
taxon_match."*Name_matched_accepted_family" AS "Name_matched_accepted_family",
|
1737 |
|
|
taxon_match."*Genus_matched" AS "Genus_matched",
|
1738 |
|
|
taxon_match."*Genus_score" AS "Genus_score",
|
1739 |
|
|
taxon_match."*Specific_epithet_matched" AS "Specific_epithet_matched",
|
1740 |
|
|
taxon_match."*Specific_epithet_score" AS "Specific_epithet_score",
|
1741 |
|
|
taxon_match."*Infraspecific_rank" AS "Infraspecific_rank",
|
1742 |
|
|
taxon_match."*Infraspecific_epithet_matched" AS "Infraspecific_epithet_matched",
|
1743 |
|
|
taxon_match."*Infraspecific_epithet_score" AS "Infraspecific_epithet_score",
|
1744 |
|
|
taxon_match."*Infraspecific_rank_2" AS "Infraspecific_rank_2",
|
1745 |
|
|
taxon_match."*Infraspecific_epithet_2_matched" AS "Infraspecific_epithet_2_matched",
|
1746 |
|
|
taxon_match."*Infraspecific_epithet_2_score" AS "Infraspecific_epithet_2_score",
|
1747 |
|
|
taxon_match."*Annotations" AS "Annotations",
|
1748 |
|
|
taxon_match."*Unmatched_terms" AS "Unmatched_terms",
|
1749 |
|
|
taxon_match."*Taxonomic_status" AS "Taxonomic_status",
|
1750 |
|
|
taxon_match."*Accepted_name" AS "Accepted_name",
|
1751 |
|
|
taxon_match."*Accepted_name_author" AS "Accepted_name_author",
|
1752 |
|
|
taxon_match."*Accepted_name_rank" AS "Accepted_name_rank",
|
1753 |
|
|
taxon_match."*Accepted_name_url" AS "Accepted_name_url",
|
1754 |
|
|
taxon_match."*Accepted_name_species" AS "Accepted_name_species",
|
1755 |
|
|
taxon_match."*Accepted_name_family" AS "Accepted_name_family",
|
1756 |
|
|
taxon_match."*Selected" AS "Selected",
|
1757 |
|
|
taxon_match."*Source" AS "Source",
|
1758 |
|
|
taxon_match."*Warnings" AS "Warnings",
|
1759 |
|
|
taxon_match."*Accepted_name_lsid" AS "Accepted_name_lsid"
|
1760 |
13866
|
aaronmk
|
FROM taxon_match;
|
1761 |
|
|
|
1762 |
|
|
|
1763 |
|
|
--
|
1764 |
|
|
-- Name: taxon_match_input__copy_to; Type: TABLE; Schema: TNRS; Owner: -; Tablespace:
|
1765 |
|
|
--
|
1766 |
|
|
|
1767 |
|
|
CREATE TABLE taxon_match_input__copy_to (
|
1768 |
|
|
"Name_number" integer,
|
1769 |
|
|
"Name_submitted" text,
|
1770 |
|
|
"Overall_score" double precision,
|
1771 |
|
|
"Name_matched" text,
|
1772 |
|
|
"Name_matched_rank" text,
|
1773 |
|
|
"Name_score" double precision,
|
1774 |
|
|
"Name_matched_author" text,
|
1775 |
|
|
"Name_matched_url" text,
|
1776 |
|
|
"Author_matched" text,
|
1777 |
|
|
"Author_score" double precision,
|
1778 |
|
|
"Family_matched" text,
|
1779 |
|
|
"Family_score" double precision,
|
1780 |
|
|
"Name_matched_accepted_family" text,
|
1781 |
|
|
"Genus_matched" text,
|
1782 |
|
|
"Genus_score" double precision,
|
1783 |
|
|
"Specific_epithet_matched" text,
|
1784 |
|
|
"Specific_epithet_score" double precision,
|
1785 |
|
|
"Infraspecific_rank" text,
|
1786 |
|
|
"Infraspecific_epithet_matched" text,
|
1787 |
|
|
"Infraspecific_epithet_score" double precision,
|
1788 |
|
|
"Infraspecific_rank_2" text,
|
1789 |
|
|
"Infraspecific_epithet_2_matched" text,
|
1790 |
|
|
"Infraspecific_epithet_2_score" double precision,
|
1791 |
|
|
"Annotations" text,
|
1792 |
|
|
"Unmatched_terms" text,
|
1793 |
|
|
"Taxonomic_status" text,
|
1794 |
|
|
"Accepted_name" text,
|
1795 |
|
|
"Accepted_name_author" text,
|
1796 |
|
|
"Accepted_name_rank" text,
|
1797 |
|
|
"Accepted_name_url" text,
|
1798 |
|
|
"Accepted_name_species" text,
|
1799 |
|
|
"Accepted_name_family" text,
|
1800 |
|
|
"Selected" text,
|
1801 |
|
|
"Source" text,
|
1802 |
|
|
"Warnings" text,
|
1803 |
|
|
"Accepted_name_lsid" text
|
1804 |
|
|
);
|
1805 |
|
|
|
1806 |
|
|
|
1807 |
|
|
--
|
1808 |
11964
|
aaronmk
|
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
|
1809 |
|
|
--
|
1810 |
|
|
|
1811 |
|
|
CREATE VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" AS
|
1812 |
14111
|
aaronmk
|
SELECT taxon_match."*Name_submitted" AS scrubbed_unique_taxon_name,
|
1813 |
|
|
taxon_match."*Name_matched_rank" AS scrubbed_taxon_rank,
|
1814 |
|
|
COALESCE(taxon_match."*Name_matched_accepted_family", taxon_match."*Family_matched") AS scrubbed_family,
|
1815 |
|
|
taxon_match."*Genus_matched" AS scrubbed_genus,
|
1816 |
|
|
taxon_match."*Specific_epithet_matched" AS scrubbed_specific_epithet,
|
1817 |
|
|
taxon_match."*Infraspecific_rank" AS scrubbed_infraspecific_rank,
|
1818 |
|
|
taxon_match."*Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet,
|
1819 |
|
|
taxon_match."*Name_matched_author" AS scrubbed_author,
|
1820 |
|
|
taxon_match."*Name_matched" AS scrubbed_taxon_name_no_author,
|
1821 |
|
|
(taxon_match."*Name_matched" || COALESCE((' '::text || taxon_match."*Name_matched_author"), ''::text)) AS scrubbed_taxon_name_with_author
|
1822 |
13861
|
aaronmk
|
FROM taxon_match;
|
1823 |
11964
|
aaronmk
|
|
1824 |
|
|
|
1825 |
|
|
--
|
1826 |
11965
|
aaronmk
|
-- Name: VIEW "taxon_scrub.scrubbed_unique_taxon_name.*"; Type: COMMENT; Schema: TNRS; Owner: -
|
1827 |
|
|
--
|
1828 |
|
|
|
1829 |
13575
|
aaronmk
|
COMMENT ON VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" IS '
|
1830 |
13846
|
aaronmk
|
to modify:
|
1831 |
|
|
SELECT util.recreate_view(''"TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*"'', $$
|
1832 |
|
|
SELECT __
|
1833 |
|
|
$$);
|
1834 |
|
|
|
1835 |
13575
|
aaronmk
|
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.
|
1836 |
|
|
';
|
1837 |
11965
|
aaronmk
|
|
1838 |
|
|
|
1839 |
|
|
--
|
1840 |
11964
|
aaronmk
|
-- Name: taxon_scrub; Type: VIEW; Schema: TNRS; Owner: -
|
1841 |
|
|
--
|
1842 |
|
|
|
1843 |
|
|
CREATE VIEW taxon_scrub AS
|
1844 |
13800
|
aaronmk
|
SELECT "ValidMatchedTaxon".scrubbed_unique_taxon_name,
|
1845 |
14108
|
aaronmk
|
"ValidMatchedTaxon".batch,
|
1846 |
14105
|
aaronmk
|
"ValidMatchedTaxon".match_num,
|
1847 |
14111
|
aaronmk
|
"ValidMatchedTaxon"."*Name_number",
|
1848 |
|
|
"ValidMatchedTaxon"."*Name_submitted",
|
1849 |
|
|
"ValidMatchedTaxon"."*Overall_score",
|
1850 |
|
|
"ValidMatchedTaxon"."*Name_matched",
|
1851 |
|
|
"ValidMatchedTaxon"."*Name_matched_rank",
|
1852 |
|
|
"ValidMatchedTaxon"."*Name_score",
|
1853 |
|
|
"ValidMatchedTaxon"."*Name_matched_author",
|
1854 |
|
|
"ValidMatchedTaxon"."*Name_matched_url",
|
1855 |
|
|
"ValidMatchedTaxon"."*Author_matched",
|
1856 |
|
|
"ValidMatchedTaxon"."*Author_score",
|
1857 |
|
|
"ValidMatchedTaxon"."*Family_matched",
|
1858 |
|
|
"ValidMatchedTaxon"."*Family_score",
|
1859 |
|
|
"ValidMatchedTaxon"."*Name_matched_accepted_family",
|
1860 |
|
|
"ValidMatchedTaxon"."*Genus_matched",
|
1861 |
|
|
"ValidMatchedTaxon"."*Genus_score",
|
1862 |
|
|
"ValidMatchedTaxon"."*Specific_epithet_matched",
|
1863 |
|
|
"ValidMatchedTaxon"."*Specific_epithet_score",
|
1864 |
|
|
"ValidMatchedTaxon"."*Infraspecific_rank",
|
1865 |
|
|
"ValidMatchedTaxon"."*Infraspecific_epithet_matched",
|
1866 |
|
|
"ValidMatchedTaxon"."*Infraspecific_epithet_score",
|
1867 |
|
|
"ValidMatchedTaxon"."*Infraspecific_rank_2",
|
1868 |
|
|
"ValidMatchedTaxon"."*Infraspecific_epithet_2_matched",
|
1869 |
|
|
"ValidMatchedTaxon"."*Infraspecific_epithet_2_score",
|
1870 |
|
|
"ValidMatchedTaxon"."*Annotations",
|
1871 |
|
|
"ValidMatchedTaxon"."*Unmatched_terms",
|
1872 |
|
|
"ValidMatchedTaxon"."*Taxonomic_status",
|
1873 |
|
|
"ValidMatchedTaxon"."*Accepted_name",
|
1874 |
|
|
"ValidMatchedTaxon"."*Accepted_name_author",
|
1875 |
|
|
"ValidMatchedTaxon"."*Accepted_name_rank",
|
1876 |
|
|
"ValidMatchedTaxon"."*Accepted_name_url",
|
1877 |
|
|
"ValidMatchedTaxon"."*Accepted_name_species",
|
1878 |
|
|
"ValidMatchedTaxon"."*Accepted_name_family",
|
1879 |
|
|
"ValidMatchedTaxon"."*Selected",
|
1880 |
|
|
"ValidMatchedTaxon"."*Source",
|
1881 |
|
|
"ValidMatchedTaxon"."*Warnings",
|
1882 |
|
|
"ValidMatchedTaxon"."*Accepted_name_lsid",
|
1883 |
14108
|
aaronmk
|
"ValidMatchedTaxon".is_valid_match,
|
1884 |
14359
|
aaronmk
|
"ValidMatchedTaxon"."[parsed_]morphospecies[_suffix]__@Brad__.morphosp@vegpath.org",
|
1885 |
14284
|
aaronmk
|
"ValidMatchedTaxon"."[matched_]species[_binomial]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1886 |
14359
|
aaronmk
|
"ValidMatchedTaxon"."matched~Name[_no_author]___@TNRS__@vegpath.org",
|
1887 |
14284
|
aaronmk
|
"ValidMatchedTaxon"."[matched_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1888 |
|
|
"ValidMatchedTaxon".matched_has_accepted,
|
1889 |
14359
|
aaronmk
|
"ValidMatchedTaxon"."Accepted_family__@TNRS__@vegpath.org",
|
1890 |
14366
|
aaronmk
|
"ValidMatchedTaxon"."Accepted_species[_binomial]__@TNRS__@vegpath.org",
|
1891 |
14388
|
aaronmk
|
"ValidMatchedTaxon"."__accepted_{genus,specific_epithet,infra_{rank,epithet}}",
|
1892 |
14268
|
aaronmk
|
"ValidMatchedTaxon"."[accepted_]genus__@DwC__@vegpath.org",
|
1893 |
|
|
"ValidMatchedTaxon"."[accepted_]specificEpithet__@DwC__@vegpath.org",
|
1894 |
14359
|
aaronmk
|
"ValidMatchedTaxon"."[accepted_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org",
|
1895 |
14268
|
aaronmk
|
"ValidMatchedTaxon".__accepted_infraspecific_label,
|
1896 |
|
|
"ValidMatchedTaxon"."__accepted_infraspecific_{rank,epithet}",
|
1897 |
|
|
"ValidMatchedTaxon"."[accepted_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
|
1898 |
|
|
"ValidMatchedTaxon"."[accepted_]infraspecificEpithet__@DwC__@vegpath.org",
|
1899 |
|
|
"ValidMatchedTaxon"."[accepted_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1900 |
14359
|
aaronmk
|
"ValidMatchedTaxon"."[scrubbed_]taxonomicStatus__@DwC__@vegpath.org",
|
1901 |
14284
|
aaronmk
|
"ValidMatchedTaxon"."[scrubbed_]taxonRank__@DwC__@vegpath.org",
|
1902 |
|
|
"ValidMatchedTaxon"."[scrubbed_]family~(-Accepted_-)__@TNRS__@vegpath.org",
|
1903 |
|
|
"ValidMatchedTaxon"."[scrubbed_]genus__@DwC__@vegpath.org",
|
1904 |
|
|
"ValidMatchedTaxon"."[scrubbed_]specificEpithet__@DwC__@vegpath.org",
|
1905 |
|
|
"ValidMatchedTaxon"."[scrubbed_]species[_binom]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1906 |
14359
|
aaronmk
|
"ValidMatchedTaxon"."[scrubbed_]morphospecies[_binomial]__@Brad__.TNRS@vegpath.org",
|
1907 |
14284
|
aaronmk
|
"ValidMatchedTaxon"."[scrubbed_]Infraspecific_rank[_abbr]__@TNRS__@vegpath.org",
|
1908 |
|
|
"ValidMatchedTaxon"."[scrubbed_]infraspecificEpithet__@DwC__@vegpath.org",
|
1909 |
|
|
"ValidMatchedTaxon"."[scrubbed_]name[_no_author]~(-Accepted_-)__@TNRS__@vegpath.org",
|
1910 |
|
|
"ValidMatchedTaxon"."[scrubbed_]author~(-Accepted_-)__@TNRS__@vegpath.org",
|
1911 |
|
|
"ValidMatchedTaxon"."[scrubbed_]scientificName[_with_author]__@DwC__@vegpath.org",
|
1912 |
14103
|
aaronmk
|
"ValidMatchedTaxon"."taxonomicStatus",
|
1913 |
13800
|
aaronmk
|
"ValidMatchedTaxon".accepted_morphospecies_binomial,
|
1914 |
|
|
"taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank,
|
1915 |
|
|
"taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family,
|
1916 |
|
|
"taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus,
|
1917 |
|
|
"taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet,
|
1918 |
|
|
"taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_rank,
|
1919 |
|
|
"taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_epithet,
|
1920 |
|
|
"taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_author,
|
1921 |
|
|
"taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author,
|
1922 |
|
|
"taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_with_author,
|
1923 |
13532
|
aaronmk
|
CASE
|
1924 |
14111
|
aaronmk
|
WHEN ("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'family'::text) THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family, "ValidMatchedTaxon"."*Unmatched_terms")
|
1925 |
|
|
WHEN ("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank = 'genus'::text) THEN concat_ws(' '::text, "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author, "ValidMatchedTaxon"."*Unmatched_terms")
|
1926 |
13532
|
aaronmk
|
ELSE (("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus || ' '::text) || "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet)
|
1927 |
|
|
END AS scrubbed_morphospecies_binomial
|
1928 |
11964
|
aaronmk
|
FROM ("ValidMatchedTaxon"
|
1929 |
|
|
LEFT JOIN "taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name));
|
1930 |
|
|
|
1931 |
|
|
|
1932 |
|
|
--
|
1933 |
|
|
-- Name: VIEW taxon_scrub; Type: COMMENT; Schema: TNRS; Owner: -
|
1934 |
|
|
--
|
1935 |
|
|
|
1936 |
13443
|
aaronmk
|
COMMENT ON VIEW taxon_scrub IS '
|
1937 |
13531
|
aaronmk
|
to modify:
|
1938 |
13845
|
aaronmk
|
SELECT util.recreate_view(''"TNRS".taxon_scrub'', $$
|
1939 |
13647
|
aaronmk
|
SELECT __
|
1940 |
13531
|
aaronmk
|
$$);
|
1941 |
13443
|
aaronmk
|
';
|
1942 |
11964
|
aaronmk
|
|
1943 |
|
|
|
1944 |
|
|
--
|
1945 |
10778
|
aaronmk
|
-- Name: batch_download_settings_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
|
1946 |
|
|
--
|
1947 |
|
|
|
1948 |
|
|
ALTER TABLE ONLY batch_download_settings
|
1949 |
|
|
ADD CONSTRAINT batch_download_settings_pkey PRIMARY KEY (id);
|
1950 |
|
|
|
1951 |
|
|
|
1952 |
|
|
--
|
1953 |
|
|
-- Name: batch_id_by_time_key; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
|
1954 |
|
|
--
|
1955 |
|
|
|
1956 |
|
|
ALTER TABLE ONLY batch
|
1957 |
|
|
ADD CONSTRAINT batch_id_by_time_key UNIQUE (id_by_time);
|
1958 |
|
|
|
1959 |
|
|
|
1960 |
|
|
--
|
1961 |
|
|
-- Name: batch_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
|
1962 |
|
|
--
|
1963 |
|
|
|
1964 |
|
|
ALTER TABLE ONLY batch
|
1965 |
|
|
ADD CONSTRAINT batch_pkey PRIMARY KEY (id);
|
1966 |
|
|
|
1967 |
|
|
|
1968 |
|
|
--
|
1969 |
|
|
-- Name: client_version_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
|
1970 |
|
|
--
|
1971 |
|
|
|
1972 |
|
|
ALTER TABLE ONLY client_version
|
1973 |
|
|
ADD CONSTRAINT client_version_pkey PRIMARY KEY (id);
|
1974 |
|
|
|
1975 |
|
|
|
1976 |
|
|
--
|
1977 |
13868
|
aaronmk
|
-- Name: taxon_match_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace:
|
1978 |
10778
|
aaronmk
|
--
|
1979 |
|
|
|
1980 |
13861
|
aaronmk
|
ALTER TABLE ONLY taxon_match
|
1981 |
13868
|
aaronmk
|
ADD CONSTRAINT taxon_match_pkey PRIMARY KEY (batch, match_num);
|
1982 |
10778
|
aaronmk
|
|
1983 |
14125
|
aaronmk
|
ALTER TABLE taxon_match CLUSTER ON taxon_match_pkey;
|
1984 |
10778
|
aaronmk
|
|
1985 |
14125
|
aaronmk
|
|
1986 |
10778
|
aaronmk
|
--
|
1987 |
10793
|
aaronmk
|
-- Name: batch_client_version_idx; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
|
1988 |
|
|
--
|
1989 |
|
|
|
1990 |
|
|
CREATE INDEX batch_client_version_idx ON batch USING btree (client_version);
|
1991 |
|
|
|
1992 |
|
|
|
1993 |
|
|
--
|
1994 |
13879
|
aaronmk
|
-- Name: taxon_best_match__valid_match; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
|
1995 |
13589
|
aaronmk
|
--
|
1996 |
|
|
|
1997 |
14111
|
aaronmk
|
CREATE INDEX taxon_best_match__valid_match ON taxon_match USING btree ("*Name_submitted") WHERE (("*Selected" = 'true'::text) AND is_valid_match);
|
1998 |
13589
|
aaronmk
|
|
1999 |
|
|
|
2000 |
|
|
--
|
2001 |
13879
|
aaronmk
|
-- Name: taxon_match_Name_submitted_idx; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
|
2002 |
13874
|
aaronmk
|
--
|
2003 |
|
|
|
2004 |
14111
|
aaronmk
|
CREATE INDEX "taxon_match_Name_submitted_idx" ON taxon_match USING btree ("*Name_submitted");
|
2005 |
13874
|
aaronmk
|
|
2006 |
|
|
|
2007 |
|
|
--
|
2008 |
13879
|
aaronmk
|
-- Name: taxon_match__one_selected_match; Type: INDEX; Schema: TNRS; Owner: -; Tablespace:
|
2009 |
11607
|
aaronmk
|
--
|
2010 |
|
|
|
2011 |
14111
|
aaronmk
|
CREATE UNIQUE INDEX taxon_match__one_selected_match ON taxon_match USING btree (batch, "*Name_number") WHERE ("*Selected" = 'true'::text);
|
2012 |
11607
|
aaronmk
|
|
2013 |
|
|
|
2014 |
|
|
--
|
2015 |
10778
|
aaronmk
|
-- Name: batch__fill; Type: TRIGGER; Schema: TNRS; Owner: -
|
2016 |
|
|
--
|
2017 |
|
|
|
2018 |
|
|
CREATE TRIGGER batch__fill BEFORE INSERT OR UPDATE ON batch FOR EACH ROW EXECUTE PROCEDURE batch__fill();
|
2019 |
|
|
|
2020 |
|
|
|
2021 |
|
|
--
|
2022 |
13868
|
aaronmk
|
-- Name: taxon_match__batch_begin; Type: TRIGGER; Schema: TNRS; Owner: -
|
2023 |
13866
|
aaronmk
|
--
|
2024 |
|
|
|
2025 |
13868
|
aaronmk
|
CREATE TRIGGER taxon_match__batch_begin BEFORE INSERT ON taxon_match_input__copy_to FOR EACH STATEMENT EXECUTE PROCEDURE taxon_match__batch_begin();
|
2026 |
13866
|
aaronmk
|
|
2027 |
|
|
|
2028 |
|
|
--
|
2029 |
13868
|
aaronmk
|
-- Name: taxon_match__fill; Type: TRIGGER; Schema: TNRS; Owner: -
|
2030 |
13567
|
aaronmk
|
--
|
2031 |
|
|
|
2032 |
13868
|
aaronmk
|
CREATE TRIGGER taxon_match__fill BEFORE INSERT OR UPDATE ON taxon_match FOR EACH ROW EXECUTE PROCEDURE taxon_match__fill();
|
2033 |
13567
|
aaronmk
|
|
2034 |
|
|
|
2035 |
|
|
--
|
2036 |
14122
|
aaronmk
|
-- Name: taxon_match__fill_derived; Type: TRIGGER; Schema: TNRS; Owner: -
|
2037 |
|
|
--
|
2038 |
|
|
|
2039 |
|
|
CREATE TRIGGER taxon_match__fill_derived BEFORE INSERT OR UPDATE ON taxon_match FOR EACH ROW EXECUTE PROCEDURE taxon_match__fill_derived();
|
2040 |
|
|
|
2041 |
|
|
|
2042 |
|
|
--
|
2043 |
13868
|
aaronmk
|
-- Name: taxon_match__match_num__fill; Type: TRIGGER; Schema: TNRS; Owner: -
|
2044 |
13578
|
aaronmk
|
--
|
2045 |
|
|
|
2046 |
13868
|
aaronmk
|
CREATE TRIGGER taxon_match__match_num__fill BEFORE INSERT ON taxon_match FOR EACH ROW EXECUTE PROCEDURE taxon_match__match_num__fill();
|
2047 |
13578
|
aaronmk
|
|
2048 |
|
|
|
2049 |
|
|
--
|
2050 |
13868
|
aaronmk
|
-- Name: taxon_match_input__copy_to__insert; Type: TRIGGER; Schema: TNRS; Owner: -
|
2051 |
10778
|
aaronmk
|
--
|
2052 |
|
|
|
2053 |
13868
|
aaronmk
|
CREATE TRIGGER taxon_match_input__copy_to__insert BEFORE INSERT ON taxon_match_input__copy_to FOR EACH ROW EXECUTE PROCEDURE taxon_match_input__copy_to__insert();
|
2054 |
10778
|
aaronmk
|
|
2055 |
|
|
|
2056 |
|
|
--
|
2057 |
|
|
-- Name: batch_client_version_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
|
2058 |
|
|
--
|
2059 |
|
|
|
2060 |
|
|
ALTER TABLE ONLY batch
|
2061 |
|
|
ADD CONSTRAINT batch_client_version_fkey FOREIGN KEY (client_version) REFERENCES client_version(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
2062 |
|
|
|
2063 |
|
|
|
2064 |
|
|
--
|
2065 |
|
|
-- Name: batch_download_settings_id_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
|
2066 |
|
|
--
|
2067 |
|
|
|
2068 |
|
|
ALTER TABLE ONLY batch_download_settings
|
2069 |
|
|
ADD CONSTRAINT batch_download_settings_id_fkey FOREIGN KEY (id) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
2070 |
|
|
|
2071 |
|
|
|
2072 |
|
|
--
|
2073 |
13868
|
aaronmk
|
-- Name: taxon_match_batch_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
|
2074 |
10778
|
aaronmk
|
--
|
2075 |
|
|
|
2076 |
13861
|
aaronmk
|
ALTER TABLE ONLY taxon_match
|
2077 |
13868
|
aaronmk
|
ADD CONSTRAINT taxon_match_batch_fkey FOREIGN KEY (batch) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
|
2078 |
10778
|
aaronmk
|
|
2079 |
|
|
|
2080 |
|
|
--
|
2081 |
|
|
-- Name: TNRS; Type: ACL; Schema: -; Owner: -
|
2082 |
|
|
--
|
2083 |
|
|
|
2084 |
|
|
REVOKE ALL ON SCHEMA "TNRS" FROM PUBLIC;
|
2085 |
|
|
REVOKE ALL ON SCHEMA "TNRS" FROM bien;
|
2086 |
|
|
GRANT ALL ON SCHEMA "TNRS" TO bien;
|
2087 |
|
|
GRANT USAGE ON SCHEMA "TNRS" TO bien_read;
|
2088 |
|
|
|
2089 |
|
|
|
2090 |
|
|
--
|
2091 |
13861
|
aaronmk
|
-- Name: taxon_match; Type: ACL; Schema: TNRS; Owner: -
|
2092 |
10778
|
aaronmk
|
--
|
2093 |
|
|
|
2094 |
13861
|
aaronmk
|
REVOKE ALL ON TABLE taxon_match FROM PUBLIC;
|
2095 |
|
|
REVOKE ALL ON TABLE taxon_match FROM bien;
|
2096 |
|
|
GRANT ALL ON TABLE taxon_match TO bien;
|
2097 |
|
|
GRANT SELECT ON TABLE taxon_match TO bien_read;
|
2098 |
10778
|
aaronmk
|
|
2099 |
|
|
|
2100 |
|
|
--
|
2101 |
13878
|
aaronmk
|
-- Name: taxon_best_match; Type: ACL; Schema: TNRS; Owner: -
|
2102 |
|
|
--
|
2103 |
|
|
|
2104 |
|
|
REVOKE ALL ON TABLE taxon_best_match FROM PUBLIC;
|
2105 |
|
|
REVOKE ALL ON TABLE taxon_best_match FROM bien;
|
2106 |
|
|
GRANT ALL ON TABLE taxon_best_match TO bien;
|
2107 |
|
|
GRANT SELECT ON TABLE taxon_best_match TO bien_read;
|
2108 |
|
|
|
2109 |
|
|
|
2110 |
|
|
--
|
2111 |
11912
|
aaronmk
|
-- Name: MatchedTaxon; Type: ACL; Schema: TNRS; Owner: -
|
2112 |
|
|
--
|
2113 |
|
|
|
2114 |
|
|
REVOKE ALL ON TABLE "MatchedTaxon" FROM PUBLIC;
|
2115 |
|
|
REVOKE ALL ON TABLE "MatchedTaxon" FROM bien;
|
2116 |
|
|
GRANT ALL ON TABLE "MatchedTaxon" TO bien;
|
2117 |
|
|
GRANT SELECT ON TABLE "MatchedTaxon" TO bien_read;
|
2118 |
|
|
|
2119 |
|
|
|
2120 |
|
|
--
|
2121 |
|
|
-- Name: ValidMatchedTaxon; Type: ACL; Schema: TNRS; Owner: -
|
2122 |
|
|
--
|
2123 |
|
|
|
2124 |
|
|
REVOKE ALL ON TABLE "ValidMatchedTaxon" FROM PUBLIC;
|
2125 |
|
|
REVOKE ALL ON TABLE "ValidMatchedTaxon" FROM bien;
|
2126 |
|
|
GRANT ALL ON TABLE "ValidMatchedTaxon" TO bien;
|
2127 |
|
|
GRANT SELECT ON TABLE "ValidMatchedTaxon" TO bien_read;
|
2128 |
|
|
|
2129 |
|
|
|
2130 |
|
|
--
|
2131 |
13866
|
aaronmk
|
-- Name: taxon_match_input; Type: ACL; Schema: TNRS; Owner: -
|
2132 |
|
|
--
|
2133 |
|
|
|
2134 |
|
|
REVOKE ALL ON TABLE taxon_match_input FROM PUBLIC;
|
2135 |
|
|
REVOKE ALL ON TABLE taxon_match_input FROM bien;
|
2136 |
|
|
GRANT ALL ON TABLE taxon_match_input TO bien;
|
2137 |
|
|
GRANT SELECT ON TABLE taxon_match_input TO bien_read;
|
2138 |
|
|
|
2139 |
|
|
|
2140 |
|
|
--
|
2141 |
11912
|
aaronmk
|
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: ACL; Schema: TNRS; Owner: -
|
2142 |
|
|
--
|
2143 |
|
|
|
2144 |
|
|
REVOKE ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" FROM PUBLIC;
|
2145 |
|
|
REVOKE ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" FROM bien;
|
2146 |
|
|
GRANT ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" TO bien;
|
2147 |
|
|
GRANT SELECT ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" TO bien_read;
|
2148 |
|
|
|
2149 |
|
|
|
2150 |
|
|
--
|
2151 |
|
|
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
|
2152 |
|
|
--
|
2153 |
|
|
|
2154 |
|
|
REVOKE ALL ON TABLE taxon_scrub FROM PUBLIC;
|
2155 |
|
|
REVOKE ALL ON TABLE taxon_scrub FROM bien;
|
2156 |
|
|
GRANT ALL ON TABLE taxon_scrub TO bien;
|
2157 |
|
|
GRANT SELECT ON TABLE taxon_scrub TO bien_read;
|
2158 |
|
|
|
2159 |
|
|
|
2160 |
|
|
--
|
2161 |
10778
|
aaronmk
|
-- PostgreSQL database dump complete
|
2162 |
|
|
--
|