Project

General

Profile

1 5423 aaronmk
--
2
-- PostgreSQL database dump
3
--
4
5
SET statement_timeout = 0;
6
SET client_encoding = 'UTF8';
7 9493 aaronmk
SET standard_conforming_strings = on;
8 5423 aaronmk
SET check_function_bodies = false;
9
SET client_min_messages = warning;
10
11
--
12
-- Name: TNRS; Type: SCHEMA; Schema: -; Owner: bien
13
--
14
15
CREATE SCHEMA "TNRS";
16
17
18
ALTER SCHEMA "TNRS" OWNER TO bien;
19
20
SET search_path = "TNRS", pg_catalog;
21
22 5804 aaronmk
--
23 10786 aaronmk
-- Name: batch__fill(); Type: FUNCTION; Schema: TNRS; Owner: bien
24
--
25
26
CREATE FUNCTION batch__fill() RETURNS trigger
27
    LANGUAGE plpgsql
28
    AS $$
29
BEGIN
30
	new.id_by_time = new.time_submitted;
31
	new.id = COALESCE(new.id, new.id_by_time);
32
	RETURN new;
33
END;
34
$$;
35
36
37
ALTER FUNCTION "TNRS".batch__fill() OWNER TO bien;
38
39
--
40 10395 aaronmk
-- Name: family_is_homonym(text); Type: FUNCTION; Schema: TNRS; Owner: bien
41
--
42
43
CREATE FUNCTION family_is_homonym(family text) RETURNS boolean
44
    LANGUAGE sql STABLE STRICT
45
    AS $_$
46
SELECT EXISTS(SELECT * FROM "IRMNG".family_homonym_epithet WHERE "taxonNameOrEpithet" = $1)
47
$_$;
48
49
50
ALTER FUNCTION "TNRS".family_is_homonym(family text) OWNER TO bien;
51
52
--
53
-- Name: genus_is_homonym(text); Type: FUNCTION; Schema: TNRS; Owner: bien
54
--
55
56
CREATE FUNCTION genus_is_homonym(genus text) RETURNS boolean
57
    LANGUAGE sql STABLE STRICT
58
    AS $_$
59
SELECT EXISTS(SELECT * FROM "IRMNG".genus_homonym_epithet WHERE "taxonNameOrEpithet" = $1)
60
$_$;
61
62
63
ALTER FUNCTION "TNRS".genus_is_homonym(genus text) OWNER TO bien;
64
65
--
66 9493 aaronmk
-- Name: score_ok(double precision); Type: FUNCTION; Schema: TNRS; Owner: bien
67 5804 aaronmk
--
68
69 9493 aaronmk
CREATE FUNCTION score_ok(score double precision) RETURNS boolean
70 10395 aaronmk
    LANGUAGE sql IMMUTABLE STRICT
71 5804 aaronmk
    AS $_$
72 9493 aaronmk
SELECT $1 >= 0.8
73 5804 aaronmk
$_$;
74
75
76 9493 aaronmk
ALTER FUNCTION "TNRS".score_ok(score double precision) OWNER TO bien;
77 5804 aaronmk
78 9493 aaronmk
--
79 9529 aaronmk
-- Name: tnrs_populate_fields(); Type: FUNCTION; Schema: TNRS; Owner: bien
80 9493 aaronmk
--
81
82 9529 aaronmk
CREATE FUNCTION tnrs_populate_fields() RETURNS trigger
83 9493 aaronmk
    LANGUAGE plpgsql
84
    AS $$
85 9972 aaronmk
DECLARE
86
    "Specific_epithet_is_plant" boolean :=
87
        (CASE
88
        WHEN   new."Infraspecific_epithet_matched"   IS NOT NULL
89
            OR new."Infraspecific_epithet_2_matched" IS NOT NULL
90
            OR new."Specific_epithet_score" >= 0.9 -- fuzzy match
91
            THEN true
92
        ELSE NULL -- ambiguous
93
        END);
94 10395 aaronmk
    never_homonym boolean = COALESCE(new."Author_score" >= 0.6, false); -- author disambiguates
95
    family_is_homonym boolean = NOT never_homonym AND "TNRS".family_is_homonym(new."Family_matched");
96
    genus_is_homonym  boolean = NOT never_homonym AND "TNRS".genus_is_homonym( new."Genus_matched" );
97 9493 aaronmk
BEGIN
98
    new."Accepted_scientific_name" = NULLIF(concat_ws(' '
99 9762 aaronmk
        , NULLIF(NULLIF(new."Accepted_name_family", 'Unknown'), new."Accepted_name")
100 9493 aaronmk
        , new."Accepted_name"
101
        , new."Accepted_name_author"
102
    ), '');
103
    new."Max_score" = GREATEST(
104 9972 aaronmk
          new."Overall_score"
105
        , new."Family_score"
106
        , new."Genus_score"
107
        , new."Specific_epithet_score"
108 9493 aaronmk
    );
109 10395 aaronmk
    new."Is_homonym" = COALESCE(genus_is_homonym, family_is_homonym);
110 9972 aaronmk
    new."Is_plant" = (CASE
111 10395 aaronmk
        WHEN new."Family_score" = 1 AND NOT family_is_homonym -- exact match
112
            THEN true
113
        ELSE -- consider genus
114 9972 aaronmk
            (CASE
115
            WHEN new."Genus_score" =  1    -- exact match
116 10395 aaronmk
                THEN
117
                (CASE
118
                WHEN NOT genus_is_homonym THEN true
119
                ELSE "Specific_epithet_is_plant"
120
                END)
121 9972 aaronmk
            WHEN new."Genus_score" >= 0.85 -- fuzzy match
122
                THEN "Specific_epithet_is_plant"
123
            ELSE NULL -- ambiguous
124
            END)
125
        END);
126 9493 aaronmk
127
    RETURN new;
128
END;
129
$$;
130
131
132 9529 aaronmk
ALTER FUNCTION "TNRS".tnrs_populate_fields() OWNER TO bien;
133 9493 aaronmk
134 10786 aaronmk
--
135
-- Name: FUNCTION tnrs_populate_fields(); Type: COMMENT; Schema: TNRS; Owner: bien
136
--
137
138
COMMENT ON FUNCTION tnrs_populate_fields() IS 'IMPORTANT: when changing this function, you must regenerate the derived cols:
139
UPDATE "TNRS".tnrs SET "Name_submitted" = "Name_submitted"
140
runtime: 25 min ("5221748 rows affected, 1524228 ms execution time")
141
VACUUM ANALYZE "TNRS".tnrs -- to remove previous rows
142
runtime: 1 min ("62350 ms")';
143
144
145 5423 aaronmk
SET default_tablespace = '';
146
147
SET default_with_oids = false;
148
149
--
150
-- Name: tnrs; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace:
151
--
152
153
CREATE TABLE tnrs (
154 10786 aaronmk
    batch text DEFAULT now() NOT NULL,
155 9972 aaronmk
    "Name_number" integer NOT NULL,
156 5423 aaronmk
    "Name_submitted" text NOT NULL,
157 9972 aaronmk
    "Overall_score" double precision,
158 5423 aaronmk
    "Name_matched" text,
159
    "Name_matched_rank" text,
160 9972 aaronmk
    "Name_score" double precision,
161 5423 aaronmk
    "Name_matched_author" text,
162
    "Name_matched_url" text,
163
    "Author_matched" text,
164 9972 aaronmk
    "Author_score" double precision,
165 5423 aaronmk
    "Family_matched" text,
166 9972 aaronmk
    "Family_score" double precision,
167 9529 aaronmk
    "Name_matched_accepted_family" text,
168 5423 aaronmk
    "Genus_matched" text,
169 9972 aaronmk
    "Genus_score" double precision,
170 5423 aaronmk
    "Specific_epithet_matched" text,
171 9972 aaronmk
    "Specific_epithet_score" double precision,
172 5423 aaronmk
    "Infraspecific_rank" text,
173
    "Infraspecific_epithet_matched" text,
174 9972 aaronmk
    "Infraspecific_epithet_score" double precision,
175 5423 aaronmk
    "Infraspecific_rank_2" text,
176
    "Infraspecific_epithet_2_matched" text,
177 9972 aaronmk
    "Infraspecific_epithet_2_score" double precision,
178 5423 aaronmk
    "Annotations" text,
179
    "Unmatched_terms" text,
180
    "Taxonomic_status" text,
181
    "Accepted_name" text,
182
    "Accepted_name_author" text,
183
    "Accepted_name_rank" text,
184
    "Accepted_name_url" text,
185 9762 aaronmk
    "Accepted_name_species" text,
186
    "Accepted_name_family" text,
187 5423 aaronmk
    "Selected" text,
188
    "Source" text,
189
    "Warnings" text,
190 9493 aaronmk
    "Accepted_name_lsid" text,
191
    "Accepted_scientific_name" text,
192 9972 aaronmk
    "Max_score" double precision,
193
    "Is_homonym" boolean,
194
    "Is_plant" boolean
195 5423 aaronmk
);
196
197
198
ALTER TABLE "TNRS".tnrs OWNER TO bien;
199
200
--
201 10786 aaronmk
-- Name: TABLE tnrs; Type: COMMENT; Schema: TNRS; Owner: bien
202
--
203
204
COMMENT ON TABLE tnrs IS 'IMPORTANT: when changing this table''s schema, you must regenerate data.sql:
205
$ <this_file>/../test_taxonomic_names/test_scrub
206
you must also make the same changes on vegbiendev: e.g.
207
$ make backups/TNRS.backup-remake # runtime: 3 min ("real 2m44.277s")
208
SELECT util.set_col_types(''"TNRS".tnrs'', ARRAY[
209
  (''col'', ''new_type'')
210
]::util.col_cast[]);
211
runtime: 9 min ("531282 ms")';
212
213
214
--
215 9493 aaronmk
-- Name: AcceptedTaxon; Type: VIEW; Schema: TNRS; Owner: bien
216 5423 aaronmk
--
217
218 9493 aaronmk
CREATE VIEW "AcceptedTaxon" AS
219 10786 aaronmk
    SELECT tnrs.batch AS "*Accepted_name.batch", tnrs."Name_submitted" AS "acceptedScientificName", tnrs."Genus_matched" AS "acceptedGenus", tnrs."Specific_epithet_matched" AS "acceptedSpecificEpithet", tnrs."Infraspecific_epithet_matched" AS "acceptedInfraspecificEpithet", tnrs."Taxonomic_status" AS "acceptedTaxonomicStatus", tnrs."Selected" AS "*Accepted_name.Selected", tnrs."Source" AS "*Accepted_name.Source", tnrs."Warnings" AS "*Accepted_name.Warnings", tnrs."Accepted_name_lsid" AS "*Accepted_name.Accepted_name_lsid" FROM tnrs;
220 5423 aaronmk
221
222 9493 aaronmk
ALTER TABLE "TNRS"."AcceptedTaxon" OWNER TO bien;
223 5606 aaronmk
224 5423 aaronmk
--
225 9493 aaronmk
-- Name: MatchedTaxon; Type: VIEW; Schema: TNRS; Owner: bien
226 5917 aaronmk
--
227
228 9493 aaronmk
CREATE VIEW "MatchedTaxon" AS
229 10786 aaronmk
    SELECT tnrs.batch AS "*Name_matched.batch", tnrs."Name_submitted" AS "concatenatedScientificName", tnrs."Name_matched" AS "matchedTaxonName", tnrs."Name_matched_rank" AS "matchedTaxonRank", tnrs."Name_score" AS "*Name_matched.Name_score", tnrs."Name_matched_author" AS "matchedScientificNameAuthorship", tnrs."Name_matched_url" AS "matchedScientificNameID", tnrs."Author_score" AS "*Name_matched.Author_score", tnrs."Family_score" AS "matchedFamilyConfidence_fraction", COALESCE(tnrs."Name_matched_accepted_family", tnrs."Accepted_name_family") AS "matchedFamily", tnrs."Genus_matched" AS "matchedGenus", tnrs."Genus_score" AS "matchedGenusConfidence_fraction", tnrs."Specific_epithet_matched" AS "matchedSpecificEpithet", tnrs."Specific_epithet_score" AS "matchedSpeciesConfidence_fraction", tnrs."Infraspecific_epithet_matched" AS "matchedInfraspecificEpithet", tnrs."Infraspecific_epithet_score" AS "*Name_matched.Infraspecific_epithet_score", tnrs."Annotations" AS "identificationQualifier", tnrs."Unmatched_terms" AS "morphospeciesSuffix", tnrs."Taxonomic_status" AS "taxonomicStatus", tnrs."Accepted_name" AS "acceptedTaxonName", tnrs."Accepted_name_author" AS "acceptedScientificNameAuthorship", tnrs."Accepted_name_rank" AS "acceptedTaxonRank", tnrs."Accepted_name_url" AS "acceptedScientificNameID", tnrs."Accepted_name_species" AS "*Name_matched.Accepted_name_species", tnrs."Accepted_name_family" AS "acceptedFamily", tnrs."Selected" AS "*Name_matched.Selected", tnrs."Source" AS "*Name_matched.Source", tnrs."Warnings" AS "*Name_matched.Warnings", tnrs."Accepted_name_lsid" AS "*Name_matched.Accepted_name_lsid", tnrs."Accepted_scientific_name" AS "acceptedScientificName", tnrs."Max_score" AS "matchedTaxonConfidence_fraction" FROM tnrs;
230 5917 aaronmk
231
232 9493 aaronmk
ALTER TABLE "TNRS"."MatchedTaxon" OWNER TO bien;
233 5917 aaronmk
234
--
235 9762 aaronmk
-- Name: ValidMatchedTaxon; Type: VIEW; Schema: TNRS; Owner: bien
236
--
237
238
CREATE VIEW "ValidMatchedTaxon" AS
239 10786 aaronmk
    SELECT "MatchedTaxon"."*Name_matched.batch", "MatchedTaxon"."concatenatedScientificName", "MatchedTaxon"."matchedTaxonName", "MatchedTaxon"."matchedTaxonRank", "MatchedTaxon"."*Name_matched.Name_score", "MatchedTaxon"."matchedScientificNameAuthorship", "MatchedTaxon"."matchedScientificNameID", "MatchedTaxon"."*Name_matched.Author_score", "MatchedTaxon"."matchedFamilyConfidence_fraction", "MatchedTaxon"."matchedFamily", "MatchedTaxon"."matchedGenus", "MatchedTaxon"."matchedGenusConfidence_fraction", "MatchedTaxon"."matchedSpecificEpithet", "MatchedTaxon"."matchedSpeciesConfidence_fraction", "MatchedTaxon"."matchedInfraspecificEpithet", "MatchedTaxon"."*Name_matched.Infraspecific_epithet_score", "MatchedTaxon"."identificationQualifier", "MatchedTaxon"."morphospeciesSuffix", "MatchedTaxon"."taxonomicStatus", "MatchedTaxon"."acceptedTaxonName", "MatchedTaxon"."acceptedScientificNameAuthorship", "MatchedTaxon"."acceptedTaxonRank", "MatchedTaxon"."acceptedScientificNameID", "MatchedTaxon"."*Name_matched.Accepted_name_species", "MatchedTaxon"."acceptedFamily", "MatchedTaxon"."*Name_matched.Selected", "MatchedTaxon"."*Name_matched.Source", "MatchedTaxon"."*Name_matched.Warnings", "MatchedTaxon"."*Name_matched.Accepted_name_lsid", "MatchedTaxon"."acceptedScientificName", "MatchedTaxon"."matchedTaxonConfidence_fraction" FROM "MatchedTaxon" WHERE score_ok("MatchedTaxon"."matchedTaxonConfidence_fraction");
240 9762 aaronmk
241
242
ALTER TABLE "TNRS"."ValidMatchedTaxon" OWNER TO bien;
243
244
--
245 10786 aaronmk
-- Name: VIEW "ValidMatchedTaxon"; Type: COMMENT; Schema: TNRS; Owner: bien
246
--
247
248
COMMENT ON VIEW "ValidMatchedTaxon" IS 'to update, use * as the column list';
249
250
251
--
252 9493 aaronmk
-- Name: ScrubbedTaxon; Type: VIEW; Schema: TNRS; Owner: bien
253 5423 aaronmk
--
254
255 9493 aaronmk
CREATE VIEW "ScrubbedTaxon" AS
256 10786 aaronmk
    SELECT "ValidMatchedTaxon"."acceptedScientificName", "ValidMatchedTaxon"."*Name_matched.batch", "ValidMatchedTaxon"."concatenatedScientificName", "ValidMatchedTaxon"."matchedTaxonName", "ValidMatchedTaxon"."matchedTaxonRank", "ValidMatchedTaxon"."*Name_matched.Name_score", "ValidMatchedTaxon"."matchedScientificNameAuthorship", "ValidMatchedTaxon"."matchedScientificNameID", "ValidMatchedTaxon"."*Name_matched.Author_score", "ValidMatchedTaxon"."matchedFamilyConfidence_fraction", "ValidMatchedTaxon"."matchedFamily", "ValidMatchedTaxon"."matchedGenus", "ValidMatchedTaxon"."matchedGenusConfidence_fraction", "ValidMatchedTaxon"."matchedSpecificEpithet", "ValidMatchedTaxon"."matchedSpeciesConfidence_fraction", "ValidMatchedTaxon"."matchedInfraspecificEpithet", "ValidMatchedTaxon"."*Name_matched.Infraspecific_epithet_score", "ValidMatchedTaxon"."identificationQualifier", "ValidMatchedTaxon"."morphospeciesSuffix", "ValidMatchedTaxon"."taxonomicStatus", "ValidMatchedTaxon"."acceptedTaxonName", "ValidMatchedTaxon"."acceptedScientificNameAuthorship", "ValidMatchedTaxon"."acceptedTaxonRank", "ValidMatchedTaxon"."acceptedScientificNameID", "ValidMatchedTaxon"."*Name_matched.Accepted_name_species", "ValidMatchedTaxon"."acceptedFamily", "ValidMatchedTaxon"."*Name_matched.Selected", "ValidMatchedTaxon"."*Name_matched.Source", "ValidMatchedTaxon"."*Name_matched.Warnings", "ValidMatchedTaxon"."*Name_matched.Accepted_name_lsid", "ValidMatchedTaxon"."matchedTaxonConfidence_fraction", "AcceptedTaxon"."*Accepted_name.batch", "AcceptedTaxon"."acceptedGenus", "AcceptedTaxon"."acceptedSpecificEpithet", "AcceptedTaxon"."acceptedInfraspecificEpithet", "AcceptedTaxon"."acceptedTaxonomicStatus", "AcceptedTaxon"."*Accepted_name.Selected", "AcceptedTaxon"."*Accepted_name.Source", "AcceptedTaxon"."*Accepted_name.Warnings", "AcceptedTaxon"."*Accepted_name.Accepted_name_lsid" FROM ("ValidMatchedTaxon" NATURAL LEFT JOIN "AcceptedTaxon");
257 5423 aaronmk
258
259 9493 aaronmk
ALTER TABLE "TNRS"."ScrubbedTaxon" OWNER TO bien;
260 5423 aaronmk
261
--
262 10786 aaronmk
-- Name: VIEW "ScrubbedTaxon"; Type: COMMENT; Schema: TNRS; Owner: bien
263
--
264
265
COMMENT ON VIEW "ScrubbedTaxon" IS 'to update, use * as the column list';
266
267
268
--
269 10395 aaronmk
-- Name: Source; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace:
270
--
271
272
CREATE TABLE "Source" (
273
    "*row_num" integer NOT NULL,
274 10786 aaronmk
    "sourceType" text DEFAULT 'aggregator'::text NOT NULL,
275
    "datasetURL" text DEFAULT 'http://tnrs.iplantcollaborative.org/TNRSapp.html'::text NOT NULL
276 10395 aaronmk
);
277
278
279
ALTER TABLE "TNRS"."Source" OWNER TO bien;
280
281
--
282
-- Name: COLUMN "Source"."sourceType"; Type: COMMENT; Schema: TNRS; Owner: bien
283
--
284
285
COMMENT ON COLUMN "Source"."sourceType" IS 'constant';
286
287
288
--
289 10786 aaronmk
-- Name: COLUMN "Source"."datasetURL"; Type: COMMENT; Schema: TNRS; Owner: bien
290
--
291
292
COMMENT ON COLUMN "Source"."datasetURL" IS 'constant';
293
294
295
--
296
-- Name: batch; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace:
297
--
298
299
CREATE TABLE batch (
300
    id text NOT NULL,
301
    id_by_time text,
302
    time_submitted timestamp with time zone DEFAULT now(),
303
    client_version text
304
);
305
306
307
ALTER TABLE "TNRS".batch OWNER TO bien;
308
309
--
310
-- Name: batch_download_settings; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace:
311
--
312
313
CREATE TABLE batch_download_settings (
314
    id text NOT NULL,
315
    "E-mail" text,
316
    "Id" text,
317
    "Job type" text,
318
    "Contains Id" boolean,
319
    "Start time" text,
320
    "Finish time" text,
321
    "TNRS version" text,
322
    "Sources selected" text,
323
    "Match threshold" double precision,
324
    "Classification" text,
325
    "Allow partial matches?" boolean,
326
    "Sort by source" boolean,
327
    "Constrain by higher taxonomy" boolean
328
);
329
330
331
ALTER TABLE "TNRS".batch_download_settings OWNER TO bien;
332
333
--
334
-- Name: TABLE batch_download_settings; Type: COMMENT; Schema: TNRS; Owner: bien
335
--
336
337
COMMENT ON TABLE batch_download_settings IS 'stores data from http://tnrs.iplantcollaborative.org/TNRSapp.html > Submit List > results section > Download settings > settings.txt';
338
339
340
--
341
-- Name: client_version; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace:
342
--
343
344
CREATE TABLE client_version (
345
    id text NOT NULL,
346
    global_rev integer NOT NULL,
347
    "/lib/tnrs.py rev" integer,
348
    "/bin/tnrs_db rev" integer
349
);
350
351
352
ALTER TABLE "TNRS".client_version OWNER TO bien;
353
354
--
355
-- Name: TABLE client_version; Type: COMMENT; Schema: TNRS; Owner: bien
356
--
357
358
COMMENT ON TABLE client_version IS 'contains svn revisions';
359
360
361
--
362
-- Name: COLUMN client_version.global_rev; Type: COMMENT; Schema: TNRS; Owner: bien
363
--
364
365
COMMENT ON COLUMN client_version.global_rev IS 'from `svn info .` > Last Changed Rev';
366
367
368
--
369
-- Name: COLUMN client_version."/lib/tnrs.py rev"; Type: COMMENT; Schema: TNRS; Owner: bien
370
--
371
372
COMMENT ON COLUMN client_version."/lib/tnrs.py rev" IS 'from `svn info lib/tnrs.py` > Last Changed Rev';
373
374
375
--
376
-- Name: COLUMN client_version."/bin/tnrs_db rev"; Type: COMMENT; Schema: TNRS; Owner: bien
377
--
378
379
COMMENT ON COLUMN client_version."/bin/tnrs_db rev" IS 'from `svn info bin/tnrs_db` > Last Changed Rev';
380
381
382
--
383 10395 aaronmk
-- Name: ~Source.map; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace:
384
--
385
386
CREATE TABLE "~Source.map" (
387
    "from" text NOT NULL,
388
    "to" text,
389
    filter text,
390
    notes text
391
);
392
393
394
ALTER TABLE "TNRS"."~Source.map" OWNER TO bien;
395
396
--
397
-- Data for Name: Source; Type: TABLE DATA; Schema: TNRS; Owner: bien
398
--
399
400 10786 aaronmk
COPY "Source" ("*row_num", "sourceType", "datasetURL") FROM stdin;
401 10395 aaronmk
\.
402
403
404
--
405 10786 aaronmk
-- Data for Name: batch; Type: TABLE DATA; Schema: TNRS; Owner: bien
406
--
407
408
COPY batch (id, id_by_time, time_submitted, client_version) FROM stdin;
409
2013-08-27 22:02:36.042579-07	2013-08-27 22:02:36.042579-07	2013-08-27 22:02:36.042579-07	\N
410
2013-08-27 22:02:41.03229-07	2013-08-27 22:02:41.03229-07	2013-08-27 22:02:41.03229-07	\N
411
2013-08-27 22:02:43.024394-07	2013-08-27 22:02:43.024394-07	2013-08-27 22:02:43.024394-07	\N
412
\.
413
414
415
--
416
-- Data for Name: batch_download_settings; Type: TABLE DATA; Schema: TNRS; Owner: bien
417
--
418
419
COPY batch_download_settings (id, "E-mail", "Id", "Job type", "Contains Id", "Start time", "Finish time", "TNRS version", "Sources selected", "Match threshold", "Classification", "Allow partial matches?", "Sort by source", "Constrain by higher taxonomy") FROM stdin;
420
\.
421
422
423
--
424
-- Data for Name: client_version; Type: TABLE DATA; Schema: TNRS; Owner: bien
425
--
426
427
COPY client_version (id, global_rev, "/lib/tnrs.py rev", "/bin/tnrs_db rev") FROM stdin;
428
\.
429
430
431
--
432 9493 aaronmk
-- Data for Name: tnrs; Type: TABLE DATA; Schema: TNRS; Owner: bien
433 5423 aaronmk
--
434
435 10786 aaronmk
COPY tnrs (batch, "Name_number", "Name_submitted", "Overall_score", "Name_matched", "Name_matched_rank", "Name_score", "Name_matched_author", "Name_matched_url", "Author_matched", "Author_score", "Family_matched", "Family_score", "Name_matched_accepted_family", "Genus_matched", "Genus_score", "Specific_epithet_matched", "Specific_epithet_score", "Infraspecific_rank", "Infraspecific_epithet_matched", "Infraspecific_epithet_score", "Infraspecific_rank_2", "Infraspecific_epithet_2_matched", "Infraspecific_epithet_2_score", "Annotations", "Unmatched_terms", "Taxonomic_status", "Accepted_name", "Accepted_name_author", "Accepted_name_rank", "Accepted_name_url", "Accepted_name_species", "Accepted_name_family", "Selected", "Source", "Warnings", "Accepted_name_lsid", "Accepted_scientific_name", "Max_score", "Is_homonym", "Is_plant") FROM stdin;
436
2013-08-27 22:02:36.042579-07	0	Fam_indet. Boyle#6501	0	No suitable matches found.	\N	0	\N	\N	\N	0	\N	0	\N	\N	0	\N	0	\N	\N	0	\N	\N	0	\N	\N	\N	\N	\N	\N	\N	\N	\N	true	\N	 	\N	\N	0	\N	\N
437
2013-08-27 22:02:36.042579-07	1	Poa annua var. eriolepis	1	Poa annua var. eriolepis	variety	1	E. Desv.	http://www.tropicos.org/Name/50119145	\N	\N	\N	\N	Poaceae	Poa	1	annua	1	var.	eriolepis	1	\N	\N	\N	\N	\N	Synonym	Poa annua	L.	species	http://www.tropicos.org/Name/25509881	Poa annua	Poaceae	true	tropicos	 	\N	Poaceae Poa annua L.	1	f	t
438
2013-08-27 22:02:36.042579-07	2	Poa annua	1	Poa annua	species	1	L.	http://www.tropicos.org/Name/25509881	\N	\N	\N	\N	Poaceae	Poa	1	annua	1	\N	\N	\N	\N	\N	\N	\N	\N	Accepted	Poa annua	L.	species	http://www.tropicos.org/Name/25509881	Poa annua	Poaceae	true	tropicos	 	\N	Poaceae Poa annua L.	1	f	t
439
2013-08-27 22:02:36.042579-07	3	Silene scouleri Hook. subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire var. grisea C.L. Hitchc. & Maguire	0.770000000000000018	Silene scouleri subsp. pringlei	subspecies	0.770000000000000018	(S. Watson) C.L. Hitchc. & Maguire	http://www.tropicos.org/Name/6303627	\N	\N	\N	\N	Caryophyllaceae	Silene	1	scouleri	1	subsp.	pringlei	1	\N	\N	\N	\N	var. grisea	Accepted	Silene scouleri subsp. pringlei	(S. Watson) C.L. Hitchc. & Maguire	subspecies	http://www.tropicos.org/Name/6303627	Silene scouleri	Caryophyllaceae	true	tropicos	 [Partial match] 	\N	Caryophyllaceae Silene scouleri subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire	1	t	t
440
2013-08-27 22:02:36.042579-07	4	Fabaceae Boyle#6500	0.900000000000000022	Fabaceae	family	1	Lindl.	http://www.tropicos.org/Name/42000184	\N	\N	Fabaceae	1	Fabaceae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Boyle#6500	Accepted	Fabaceae	Lindl.	family	http://www.tropicos.org/Name/42000184	\N	Fabaceae	true	tropicos	 	\N	Fabaceae Lindl.	1	f	t
441
2013-08-27 22:02:36.042579-07	5	Poa annua subsp. exilis	1	Poa annua subsp. exilis	subspecies	1	(Tomm. ex Freyn) Asch. & Graebn.	http://www.tropicos.org/Name/50063800	\N	\N	\N	\N	Poaceae	Poa	1	annua	1	subsp.	exilis	1	\N	\N	\N	\N	\N	Synonym	Poa infirma	Kunth	species	http://www.tropicos.org/Name/25514158	Poa infirma	Poaceae	true	tropicos	 	\N	Poaceae Poa infirma Kunth	1	f	t
442
2013-08-27 22:02:36.042579-07	6	Poa annua ssp. exilis	1	Poa annua subsp. exilis	subspecies	1	(Tomm. ex Freyn) Asch. & Graebn.	http://www.tropicos.org/Name/50063800	\N	\N	\N	\N	Poaceae	Poa	1	annua	1	subsp.	exilis	1	\N	\N	\N	\N	\N	Synonym	Poa infirma	Kunth	species	http://www.tropicos.org/Name/25514158	Poa infirma	Poaceae	true	tropicos	 	\N	Poaceae Poa infirma Kunth	1	f	t
443
2013-08-27 22:02:36.042579-07	7	Poa annua subvar. minima	1	Poa annua subvar. minima	subvariety	1	(Schur) Asch. & Graebn.	http://www.tropicos.org/Name/50158097	\N	\N	\N	\N	Poaceae	Poa	1	annua	1	subvar.	minima	1	\N	\N	\N	\N	\N	Accepted	Poa annua subvar. minima	(Schur) Asch. & Graebn.	subvariety	http://www.tropicos.org/Name/50158097	Poa annua	Poaceae	true	tropicos	 	\N	Poaceae Poa annua subvar. minima (Schur) Asch. & Graebn.	1	f	t
444
2013-08-27 22:02:36.042579-07	8	Poa annua L.	1	Poa annua	species	1	L.	http://www.tropicos.org/Name/25509881	L.	1	\N	\N	Poaceae	Poa	1	annua	1	\N	\N	\N	\N	\N	\N	\N	\N	Accepted	Poa annua	L.	species	http://www.tropicos.org/Name/25509881	Poa annua	Poaceae	true	tropicos	 	\N	Poaceae Poa annua L.	1	f	t
445
2013-08-27 22:02:36.042579-07	9	Compositae indet. sp.1	0.900000000000000022	Compositae	family	1	Giseke	http://www.tropicos.org/Name/50255940	\N	\N	Compositae	1	Compositae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	indet. sp.1	Synonym	Asteraceae	Bercht. & J. Presl	family	http://www.tropicos.org/Name/50307371	\N	Asteraceae	true	tropicos	 	\N	Asteraceae Bercht. & J. Presl	1	f	t
446
2013-08-27 22:02:36.042579-07	10	Poa annua fo. lanuginosa	1	Poa annua fo. lanuginosa	forma	1	Sennen	http://www.tropicos.org/Name/50267771	\N	\N	\N	\N	Poaceae	Poa	1	annua	1	fo.	lanuginosa	1	\N	\N	\N	\N	\N	Synonym	Poa annua var. annua	\N	variety	http://www.tropicos.org/Name/25517736	Poa annua	Poaceae	true	tropicos	 	\N	Poaceae Poa annua var. annua	1	f	t
447
2013-08-27 22:02:36.042579-07	11	Silene scouleri subsp. pringlei var. grisea C.L. Hitchc. & Maguire	0.770000000000000018	Silene scouleri subsp. pringlei	subspecies	0.770000000000000018	(S. Watson) C.L. Hitchc. & Maguire	http://www.tropicos.org/Name/6303627	\N	\N	\N	\N	Caryophyllaceae	Silene	1	scouleri	1	subsp.	pringlei	1	\N	\N	\N	\N	var. grisea	Accepted	Silene scouleri subsp. pringlei	(S. Watson) C.L. Hitchc. & Maguire	subspecies	http://www.tropicos.org/Name/6303627	Silene scouleri	Caryophyllaceae	true	tropicos	 [Partial match] 	\N	Caryophyllaceae Silene scouleri subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire	1	t	t
448
2013-08-27 22:02:36.042579-07	12	Fabaceae Inga "fuzzy leaf"	0.900000000000000022	Inga	genus	1	Mill.	http://www.tropicos.org/Name/40031040	\N	\N	Fabaceae	1	Fabaceae	Inga	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	"fuzzy leaf"	Accepted	Inga	Mill.	genus	http://www.tropicos.org/Name/40031040	\N	Fabaceae	true	tropicos	 	\N	Fabaceae Inga Mill.	1	t	t
449
2013-08-27 22:02:36.042579-07	13	Fabaceae Inga sp.3	0.900000000000000022	Inga	genus	1	Mill.	http://www.tropicos.org/Name/40031040	\N	\N	Fabaceae	1	Fabaceae	Inga	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	sp.3	Accepted	Inga	Mill.	genus	http://www.tropicos.org/Name/40031040	\N	Fabaceae	true	tropicos	 	\N	Fabaceae Inga Mill.	1	t	t
450
2013-08-27 22:02:36.042579-07	14	Fabaceae unknown #2	0.900000000000000022	Fabaceae	family	1	Lindl.	http://www.tropicos.org/Name/42000184	\N	\N	Fabaceae	1	Fabaceae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	unknown #2	Accepted	Fabaceae	Lindl.	family	http://www.tropicos.org/Name/42000184	\N	Fabaceae	true	tropicos	 	\N	Fabaceae Lindl.	1	f	t
451
2013-08-27 22:02:41.03229-07	0	Poaceae Poa infirma Kunth	1	Poa infirma	species	1	Kunth	http://www.tropicos.org/Name/25514158	Kunth	1	Poaceae	1	Poaceae	Poa	1	infirma	1	\N	\N	\N	\N	\N	\N	\N	\N	Accepted	Poa infirma	Kunth	species	http://www.tropicos.org/Name/25514158	Poa infirma	Poaceae	true	tropicos	 	\N	Poaceae Poa infirma Kunth	1	f	t
452
2013-08-27 22:02:41.03229-07	1	Fabaceae Lindl.	0.5	Fabaceae	family	0.5	Lindl.	http://www.tropicos.org/Name/42000184	\N	\N	Fabaceae	1	Fabaceae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Lindl.	Accepted	Fabaceae	Lindl.	family	http://www.tropicos.org/Name/42000184	\N	Fabaceae	true	tropicos	 [Partial match] 	\N	Fabaceae Lindl.	1	f	t
453
2013-08-27 22:02:41.03229-07	2	Poaceae Poa annua subvar. minima (Schur) Asch. & Graebn.	1	Poa annua subvar. minima	subvariety	1	(Schur) Asch. & Graebn.	http://www.tropicos.org/Name/50158097	(Schur) Asch. & Graebn.	1	Poaceae	1	Poaceae	Poa	1	annua	1	subvar.	minima	1	\N	\N	\N	\N	\N	Accepted	Poa annua subvar. minima	(Schur) Asch. & Graebn.	subvariety	http://www.tropicos.org/Name/50158097	Poa annua	Poaceae	true	tropicos	 	\N	Poaceae Poa annua subvar. minima (Schur) Asch. & Graebn.	1	f	t
454
2013-08-27 22:02:41.03229-07	3	Fabaceae Inga Mill.	1	Inga	genus	1	Mill.	http://www.tropicos.org/Name/40031040	Mill.	1	Fabaceae	1	Fabaceae	Inga	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Accepted	Inga	Mill.	genus	http://www.tropicos.org/Name/40031040	\N	Fabaceae	true	tropicos	 	\N	Fabaceae Inga Mill.	1	f	t
455
2013-08-27 22:02:41.03229-07	4	Caryophyllaceae Silene scouleri subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire	1	Silene scouleri subsp. pringlei	subspecies	1	(S. Watson) C.L. Hitchc. & Maguire	http://www.tropicos.org/Name/6303627	(S. Watson) C.L. Hitchc. & Maguire	1	Caryophyllaceae	1	Caryophyllaceae	Silene	1	scouleri	1	subsp.	pringlei	1	\N	\N	\N	\N	\N	Accepted	Silene scouleri subsp. pringlei	(S. Watson) C.L. Hitchc. & Maguire	subspecies	http://www.tropicos.org/Name/6303627	Silene scouleri	Caryophyllaceae	true	tropicos	 	\N	Caryophyllaceae Silene scouleri subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire	1	f	t
456
2013-08-27 22:02:41.03229-07	5	Poaceae Poa annua L.	1	Poa annua	species	1	L.	http://www.tropicos.org/Name/25509881	L.	1	Poaceae	1	Poaceae	Poa	1	annua	1	\N	\N	\N	\N	\N	\N	\N	\N	Accepted	Poa annua	L.	species	http://www.tropicos.org/Name/25509881	Poa annua	Poaceae	true	tropicos	 	\N	Poaceae Poa annua L.	1	f	t
457
2013-08-27 22:02:41.03229-07	6	Asteraceae Bercht. & J. Presl	0.400000000000000022	Asteraceae	family	0.5	\N	http://compositae.landcareresearch.co.nz/default.aspx	\N	\N	Asteraceae	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Bercht. & J. Presl	Accepted	Asteraceae	\N	family	http://compositae.landcareresearch.co.nz/default.aspx	\N	\N	true	gcc	 [Partial match] 	\N	Asteraceae	1	f	t
458
2013-08-27 22:02:41.03229-07	7	Poaceae Poa annua var. annua	1	Poa annua var. annua	variety	1	\N	http://www.tropicos.org/Name/25517736	\N	\N	Poaceae	1	Poaceae	Poa	1	annua	1	var.	annua	1	\N	\N	\N	\N	\N	Accepted	Poa annua var. annua	\N	variety	http://www.tropicos.org/Name/25517736	Poa annua	Poaceae	true	tropicos	 	\N	Poaceae Poa annua var. annua	1	f	t
459
2013-08-27 22:02:43.024394-07	0	Asteraceae	1	Asteraceae	family	1	\N	http://compositae.landcareresearch.co.nz/default.aspx	\N	\N	Asteraceae	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Accepted	Asteraceae	\N	family	http://compositae.landcareresearch.co.nz/default.aspx	\N	\N	true	gcc	 	\N	Asteraceae	1	f	t
460 5917 aaronmk
\.
461 5423 aaronmk
462
463 5917 aaronmk
--
464 10395 aaronmk
-- Data for Name: ~Source.map; Type: TABLE DATA; Schema: TNRS; Owner: bien
465
--
466
467
COPY "~Source.map" ("from", "to", filter, notes) FROM stdin;
468
row_num	*row_num	\N	\N
469
:aggregator	sourceType	\N	\N
470 10786 aaronmk
:http://tnrs.iplantcollaborative.org/TNRSapp.html	datasetURL	\N	\N
471 10395 aaronmk
\.
472
473
474
--
475
-- Name: Source_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace:
476
--
477
478
ALTER TABLE ONLY "Source"
479
    ADD CONSTRAINT "Source_pkey" PRIMARY KEY ("*row_num");
480
481
482
--
483 10786 aaronmk
-- Name: batch_download_settings_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace:
484
--
485
486
ALTER TABLE ONLY batch_download_settings
487
    ADD CONSTRAINT batch_download_settings_pkey PRIMARY KEY (id);
488
489
490
--
491
-- Name: batch_id_by_time_key; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace:
492
--
493
494
ALTER TABLE ONLY batch
495
    ADD CONSTRAINT batch_id_by_time_key UNIQUE (id_by_time);
496
497
498
--
499
-- Name: batch_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace:
500
--
501
502
ALTER TABLE ONLY batch
503
    ADD CONSTRAINT batch_pkey PRIMARY KEY (id);
504
505
506
--
507
-- Name: client_version_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace:
508
--
509
510
ALTER TABLE ONLY client_version
511
    ADD CONSTRAINT client_version_pkey PRIMARY KEY (id);
512
513
514
--
515 9972 aaronmk
-- Name: tnrs_Name_submitted_key; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace:
516
--
517
518
ALTER TABLE ONLY tnrs
519
    ADD CONSTRAINT "tnrs_Name_submitted_key" UNIQUE ("Name_submitted");
520
521
522
--
523 9493 aaronmk
-- Name: tnrs_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace:
524 5917 aaronmk
--
525 5423 aaronmk
526 9493 aaronmk
ALTER TABLE ONLY tnrs
527 10786 aaronmk
    ADD CONSTRAINT tnrs_pkey PRIMARY KEY (batch, "Name_number");
528 5917 aaronmk
529
530 5423 aaronmk
--
531 10395 aaronmk
-- Name: ~Source.map_from_key; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace:
532
--
533
534
ALTER TABLE ONLY "~Source.map"
535
    ADD CONSTRAINT "~Source.map_from_key" UNIQUE ("from");
536
537
538
--
539
-- Name: ~Source.map_to_key; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace:
540
--
541
542
ALTER TABLE ONLY "~Source.map"
543
    ADD CONSTRAINT "~Source.map_to_key" UNIQUE ("to");
544
545
546
--
547 9493 aaronmk
-- Name: tnrs_score_ok; Type: INDEX; Schema: TNRS; Owner: bien; Tablespace:
548 5917 aaronmk
--
549
550 9493 aaronmk
CREATE UNIQUE INDEX tnrs_score_ok ON tnrs USING btree ("Name_submitted") WHERE score_ok("Max_score");
551 5917 aaronmk
552
553
--
554 10786 aaronmk
-- Name: batch__fill; Type: TRIGGER; Schema: TNRS; Owner: bien
555
--
556
557
CREATE TRIGGER batch__fill BEFORE INSERT OR UPDATE ON batch FOR EACH ROW EXECUTE PROCEDURE batch__fill();
558
559
560
--
561 10395 aaronmk
-- Name: map_filter_insert; Type: TRIGGER; Schema: TNRS; Owner: bien
562
--
563
564
CREATE TRIGGER map_filter_insert BEFORE INSERT ON "~Source.map" FOR EACH ROW EXECUTE PROCEDURE util.map_filter_insert();
565
566
ALTER TABLE "~Source.map" DISABLE TRIGGER map_filter_insert;
567
568
569
--
570 9529 aaronmk
-- Name: tnrs_populate_fields; Type: TRIGGER; Schema: TNRS; Owner: bien
571 5917 aaronmk
--
572
573 9529 aaronmk
CREATE TRIGGER tnrs_populate_fields BEFORE INSERT OR UPDATE ON tnrs FOR EACH ROW EXECUTE PROCEDURE tnrs_populate_fields();
574 5917 aaronmk
575
576
--
577 10786 aaronmk
-- Name: batch_client_version_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: bien
578
--
579
580
ALTER TABLE ONLY batch
581
    ADD CONSTRAINT batch_client_version_fkey FOREIGN KEY (client_version) REFERENCES client_version(id) ON UPDATE CASCADE ON DELETE CASCADE;
582
583
584
--
585
-- Name: batch_download_settings_id_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: bien
586
--
587
588
ALTER TABLE ONLY batch_download_settings
589
    ADD CONSTRAINT batch_download_settings_id_fkey FOREIGN KEY (id) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
590
591
592
--
593
-- Name: tnrs_batch_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: bien
594
--
595
596
ALTER TABLE ONLY tnrs
597
    ADD CONSTRAINT tnrs_batch_fkey FOREIGN KEY (batch) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
598
599
600
--
601 10395 aaronmk
-- Name: TNRS; Type: ACL; Schema: -; Owner: bien
602
--
603
604
REVOKE ALL ON SCHEMA "TNRS" FROM PUBLIC;
605
REVOKE ALL ON SCHEMA "TNRS" FROM bien;
606
GRANT ALL ON SCHEMA "TNRS" TO bien;
607
GRANT USAGE ON SCHEMA "TNRS" TO bien_read;
608
609
610
--
611
-- Name: tnrs; Type: ACL; Schema: TNRS; Owner: bien
612
--
613
614
REVOKE ALL ON TABLE tnrs FROM PUBLIC;
615
REVOKE ALL ON TABLE tnrs FROM bien;
616
GRANT ALL ON TABLE tnrs TO bien;
617
GRANT SELECT ON TABLE tnrs TO bien_read;
618
619
620
--
621 5423 aaronmk
-- PostgreSQL database dump complete
622
--