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