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