Project

General

Profile

1
--
2
-- PostgreSQL database dump
3
--
4

    
5
SET statement_timeout = 0;
6
SET lock_timeout = 0;
7
SET client_encoding = 'UTF8';
8
SET standard_conforming_strings = on;
9
SET check_function_bodies = false;
10
SET client_min_messages = warning;
11

    
12
--
13
-- Name: TNRS; Type: SCHEMA; Schema: -; Owner: bien
14
--
15

    
16
CREATE SCHEMA "TNRS";
17

    
18

    
19
ALTER SCHEMA "TNRS" OWNER TO bien;
20

    
21
--
22
-- Name: SCHEMA "TNRS"; Type: COMMENT; Schema: -; Owner: bien
23
--
24

    
25
COMMENT ON SCHEMA "TNRS" IS '
26
IMPORTANT: when changing this schema, you must also make the same changes on vegbiendev:
27
on vegbiendev:
28
# back up existing TNRS schema (in case of an accidental incorrect change):
29
$ make backups/TNRS.backup-remake # runtime: 3 min ("real 2m44.277s")
30
$ svn up
31
$ svn di
32
# make the changes shown in the diff
33
## to change column types:
34
SELECT util.set_col_types(''"TNRS".tnrs_match'', ARRAY[
35
  (''col'', ''new_type'')
36
]::util.col_cast[]); -- runtime: 9 min ("531282 ms")
37
$ rm=1 inputs/.TNRS/schema.sql.run
38
# repeat until `svn di` shows no diff
39
# back up new TNRS schema:
40
$ make backups/TNRS.backup-remake # runtime: 3 min ("real 2m44.277s")
41
';
42

    
43

    
44
SET search_path = "TNRS", pg_catalog;
45

    
46
--
47
-- Name: batch__fill(); Type: FUNCTION; Schema: TNRS; Owner: bien
48
--
49

    
50
CREATE FUNCTION batch__fill() RETURNS trigger
51
    LANGUAGE plpgsql
52
    AS $$
53
BEGIN
54
	new.id_by_time = new.time_submitted;
55
	new.id = COALESCE(new.id, new.id_by_time);
56
	RETURN new;
57
END;
58
$$;
59

    
60

    
61
ALTER FUNCTION "TNRS".batch__fill() OWNER TO bien;
62

    
63
--
64
-- Name: family_is_homonym(text); Type: FUNCTION; Schema: TNRS; Owner: bien
65
--
66

    
67
CREATE FUNCTION family_is_homonym(family text) RETURNS boolean
68
    LANGUAGE sql STABLE STRICT
69
    AS $_$
70
SELECT EXISTS(SELECT * FROM "IRMNG".family_homonym_epithet WHERE "taxonNameOrEpithet" = $1)
71
$_$;
72

    
73

    
74
ALTER FUNCTION "TNRS".family_is_homonym(family text) OWNER TO bien;
75

    
76
--
77
-- Name: genus_is_homonym(text); Type: FUNCTION; Schema: TNRS; Owner: bien
78
--
79

    
80
CREATE FUNCTION genus_is_homonym(genus text) RETURNS boolean
81
    LANGUAGE sql STABLE STRICT
82
    AS $_$
83
SELECT EXISTS(SELECT * FROM "IRMNG".genus_homonym_epithet WHERE "taxonNameOrEpithet" = $1)
84
$_$;
85

    
86

    
87
ALTER FUNCTION "TNRS".genus_is_homonym(genus text) OWNER TO bien;
88

    
89
--
90
-- Name: map_taxonomic_status(text, text); Type: FUNCTION; Schema: TNRS; Owner: bien
91
--
92

    
93
CREATE FUNCTION map_taxonomic_status(taxonomic_status_verbatim text, accepted_taxon_name_no_author text) RETURNS text
94
    LANGUAGE sql IMMUTABLE
95
    AS $_$
96
/* from http://wiki.vegpath.org/2013-11-14_conference_call#taxonomic-fields:
97
"taxonomic_status should be accepted instead of synonym when an accepted name is
98
available (this is not always the case when a name is marked as a synonym)" */
99
SELECT CASE WHEN $2 IS NOT NULL THEN 'accepted' ELSE lower($1) END
100
$_$;
101

    
102

    
103
ALTER FUNCTION "TNRS".map_taxonomic_status(taxonomic_status_verbatim text, accepted_taxon_name_no_author text) OWNER TO bien;
104

    
105
--
106
-- Name: taxon_name_is_safe(text); Type: FUNCTION; Schema: TNRS; Owner: bien
107
--
108

    
109
CREATE FUNCTION taxon_name_is_safe(taxon_name text) RETURNS boolean
110
    LANGUAGE sql IMMUTABLE
111
    AS $_$
112
SELECT NOT ($1 = ANY("TNRS".unsafe_taxon_names()))
113
$_$;
114

    
115

    
116
ALTER FUNCTION "TNRS".taxon_name_is_safe(taxon_name text) OWNER TO bien;
117

    
118
--
119
-- Name: tnrs__batch_begin(); Type: FUNCTION; Schema: TNRS; Owner: bien
120
--
121

    
122
CREATE FUNCTION tnrs__batch_begin() RETURNS trigger
123
    LANGUAGE plpgsql
124
    AS $$
125
BEGIN
126
	PERFORM util.seq__reset('pg_temp.tnrs__match_num__seq', 0);
127
	RETURN NULL;
128
END;
129
$$;
130

    
131

    
132
ALTER FUNCTION "TNRS".tnrs__batch_begin() OWNER TO bien;
133

    
134
--
135
-- Name: tnrs__match_num__fill(); Type: FUNCTION; Schema: TNRS; Owner: bien
136
--
137

    
138
CREATE FUNCTION tnrs__match_num__fill() RETURNS trigger
139
    LANGUAGE plpgsql
140
    AS $$
141
BEGIN
142
	IF new.match_num IS NULL THEN
143
		new.match_num = "TNRS".tnrs__match_num__next();
144
	END IF;
145
	RETURN new;
146
END;
147
$$;
148

    
149

    
150
ALTER FUNCTION "TNRS".tnrs__match_num__fill() OWNER TO bien;
151

    
152
--
153
-- Name: tnrs__match_num__next(); Type: FUNCTION; Schema: TNRS; Owner: bien
154
--
155

    
156
CREATE FUNCTION tnrs__match_num__next() RETURNS bigint
157
    LANGUAGE sql
158
    AS $$
159
SELECT nextval('pg_temp.tnrs__match_num__seq');
160
$$;
161

    
162

    
163
ALTER FUNCTION "TNRS".tnrs__match_num__next() OWNER TO bien;
164

    
165
--
166
-- Name: tnrs_populate_fields(); Type: FUNCTION; Schema: TNRS; Owner: bien
167
--
168

    
169
CREATE FUNCTION tnrs_populate_fields() RETURNS trigger
170
    LANGUAGE plpgsql
171
    AS $$
172
DECLARE
173
	"Specific_epithet_is_plant" boolean :=
174
		(CASE
175
		WHEN   new."Infraspecific_epithet_matched"	 IS NOT NULL
176
			OR new."Infraspecific_epithet_2_matched" IS NOT NULL
177
			OR new."Specific_epithet_score" >= 0.9 -- fuzzy match
178
			THEN true
179
		ELSE NULL -- ambiguous
180
		END);
181
	never_homonym boolean = COALESCE(new."Author_score" >= 0.6, false);
182
		-- author disambiguates
183
	family_is_homonym boolean = NOT never_homonym
184
		AND "TNRS".family_is_homonym(new."Family_matched");
185
	genus_is_homonym  boolean = NOT never_homonym
186
		AND "TNRS".genus_is_homonym(new."Genus_matched");
187
	matched_taxon_name_with_author text = NULLIF(concat_ws(' '
188
		, NULLIF(NULLIF(new."Name_matched_accepted_family", 'Unknown'),
189
			new."Name_matched")
190
		, NULLIF(new."Name_matched", 'No suitable matches found.')
191
		, new."Name_matched_author"
192
		), '');
193
	accepted_taxon_name_with_author text = NULLIF(concat_ws(' '
194
		, NULLIF(NULLIF(new."Accepted_name_family", 'Unknown'),
195
			new."Accepted_name")
196
		, new."Accepted_name"
197
		, new."Accepted_name_author"
198
		), '');
199
BEGIN
200
	/* exclude homonyms because these are not valid matches (i.e. TNRS provides
201
	a name, but the name is not meaningful because it is not unambiguous). */
202
	new.is_valid_match = new."Taxonomic_status" != 'Invalid'
203
		AND COALESCE(CASE
204
		WHEN new."Family_score" = 1 AND NOT family_is_homonym -- exact match
205
			THEN true
206
		ELSE -- consider genus
207
			(CASE
208
			WHEN new."Genus_score" =  1	   -- exact match
209
				THEN
210
				(CASE
211
				WHEN NOT genus_is_homonym THEN true
212
				ELSE "Specific_epithet_is_plant"
213
				END)
214
			WHEN new."Genus_score" >= 0.85 -- fuzzy match
215
				THEN "Specific_epithet_is_plant"
216
			ELSE NULL -- ambiguous
217
			END)
218
		END, false);
219
	new.scrubbed_unique_taxon_name = COALESCE(
220
		accepted_taxon_name_with_author, matched_taxon_name_with_author);
221
	
222
	RETURN new;
223
END;
224
$$;
225

    
226

    
227
ALTER FUNCTION "TNRS".tnrs_populate_fields() OWNER TO bien;
228

    
229
--
230
-- Name: FUNCTION tnrs_populate_fields(); Type: COMMENT; Schema: TNRS; Owner: bien
231
--
232

    
233
COMMENT ON FUNCTION tnrs_populate_fields() IS '
234
IMPORTANT: when changing this function, you must regenerate the derived cols:
235
UPDATE "TNRS".tnrs_match SET "Name_submitted" = "Name_submitted"
236
runtime: 30 min ("5564082 rows affected, 1918900 ms execution time")
237
VACUUM ANALYZE "TNRS".tnrs_match -- to remove previous rows
238
runtime: 1.5 min ("92633 ms")
239
';
240

    
241

    
242
--
243
-- Name: unsafe_taxon_names(); Type: FUNCTION; Schema: TNRS; Owner: bien
244
--
245

    
246
CREATE FUNCTION unsafe_taxon_names() RETURNS text[]
247
    LANGUAGE sql IMMUTABLE
248
    AS $$
249
SELECT ARRAY[
250
]::text[]
251
$$;
252

    
253

    
254
ALTER FUNCTION "TNRS".unsafe_taxon_names() OWNER TO bien;
255

    
256
SET default_tablespace = '';
257

    
258
SET default_with_oids = false;
259

    
260
--
261
-- Name: tnrs_match; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace: 
262
--
263

    
264
CREATE TABLE tnrs_match (
265
    batch text DEFAULT now() NOT NULL,
266
    match_num integer NOT NULL,
267
    "Name_number" integer NOT NULL,
268
    "Name_submitted" text NOT NULL,
269
    "Overall_score" double precision,
270
    "Name_matched" text,
271
    "Name_matched_rank" text,
272
    "Name_score" double precision,
273
    "Name_matched_author" text,
274
    "Name_matched_url" text,
275
    "Author_matched" text,
276
    "Author_score" double precision,
277
    "Family_matched" text,
278
    "Family_score" double precision,
279
    "Name_matched_accepted_family" text,
280
    "Genus_matched" text,
281
    "Genus_score" double precision,
282
    "Specific_epithet_matched" text,
283
    "Specific_epithet_score" double precision,
284
    "Infraspecific_rank" text,
285
    "Infraspecific_epithet_matched" text,
286
    "Infraspecific_epithet_score" double precision,
287
    "Infraspecific_rank_2" text,
288
    "Infraspecific_epithet_2_matched" text,
289
    "Infraspecific_epithet_2_score" double precision,
290
    "Annotations" text,
291
    "Unmatched_terms" text,
292
    "Taxonomic_status" text,
293
    "Accepted_name" text,
294
    "Accepted_name_author" text,
295
    "Accepted_name_rank" text,
296
    "Accepted_name_url" text,
297
    "Accepted_name_species" text,
298
    "Accepted_name_family" text,
299
    "Selected" text,
300
    "Source" text,
301
    "Warnings" text,
302
    "Accepted_name_lsid" text,
303
    is_valid_match boolean NOT NULL,
304
    scrubbed_unique_taxon_name text
305
);
306

    
307

    
308
ALTER TABLE "TNRS".tnrs_match OWNER TO bien;
309

    
310
--
311
-- Name: TABLE tnrs_match; Type: COMMENT; Schema: TNRS; Owner: bien
312
--
313

    
314
COMMENT ON TABLE tnrs_match IS '
315
to remove columns or add columns at the end:
316
$ rm=1 inputs/.TNRS/data.sql.run
317
$ make schemas/remake
318

    
319
to add columns in the middle:
320
make the changes in inputs/.TNRS/schema.sql
321
$ inputs/.TNRS/data.sql.run refresh # re-run TNRS
322
$ make schemas/remake
323

    
324
to populate a new column:
325
ALTER TABLE "TNRS".tnrs_match DISABLE TRIGGER tnrs_populate_fields; --speeds up update
326
UPDATE "TNRS".tnrs_match SET "col" = value;
327
	-- runtime: 30 min ("5564201 rows affected, 1624829 ms execution time")
328
ALTER TABLE "TNRS".tnrs_match ENABLE TRIGGER tnrs_populate_fields;
329
VACUUM ANALYZE "TNRS".tnrs_match --remove previous rows; runtime: 1.5 min ("92633 ms")
330

    
331
to add a constraint: runtime: 3 min ("173620 ms")
332
';
333

    
334

    
335
--
336
-- Name: MatchedTaxon; Type: VIEW; Schema: TNRS; Owner: bien
337
--
338

    
339
CREATE VIEW "MatchedTaxon" AS
340
 SELECT s."*Name_matched.batch",
341
    s."concatenatedScientificName",
342
    s."matchedTaxonName",
343
    s."matchedTaxonRank",
344
    s."*Name_matched.Name_score",
345
    s."matchedScientificNameAuthorship",
346
    s."matchedScientificNameID",
347
    s."*Name_matched.Author_score",
348
    s."matchedFamilyConfidence_fraction",
349
    s."matchedFamily",
350
    s."matchedGenus",
351
    s."matchedGenusConfidence_fraction",
352
    s."matchedSpecificEpithet",
353
    s."matchedSpeciesConfidence_fraction",
354
    s."matchedInfraspecificEpithet",
355
    s."*Name_matched.Infraspecific_epithet_score",
356
    s."identificationQualifier",
357
    s."morphospeciesSuffix",
358
    s."taxonomicStatus",
359
    s.accepted_taxon_name_no_author,
360
    s.accepted_author,
361
    s.accepted_taxon_rank,
362
    s."acceptedScientificNameID",
363
    s.accepted_species_binomial,
364
    s.accepted_family,
365
    s."*Name_matched.Selected",
366
    s."*Name_matched.Source",
367
    s."*Name_matched.Warnings",
368
    s."*Name_matched.Accepted_name_lsid",
369
    s.taxon_scrub__is_valid_match,
370
    s.scrubbed_unique_taxon_name,
371
        CASE
372
            WHEN (s.accepted_taxon_rank = 'family'::text) THEN concat_ws(' '::text, s.accepted_family, s."morphospeciesSuffix")
373
            WHEN (s.accepted_taxon_rank = 'genus'::text) THEN concat_ws(' '::text, s.accepted_taxon_name_no_author, s."morphospeciesSuffix")
374
            ELSE s.accepted_species_binomial
375
        END AS accepted_morphospecies_binomial
376
   FROM ( SELECT tnrs_match.batch AS "*Name_matched.batch",
377
            tnrs_match."Name_submitted" AS "concatenatedScientificName",
378
            tnrs_match."Name_matched" AS "matchedTaxonName",
379
            tnrs_match."Name_matched_rank" AS "matchedTaxonRank",
380
            tnrs_match."Name_score" AS "*Name_matched.Name_score",
381
            tnrs_match."Name_matched_author" AS "matchedScientificNameAuthorship",
382
            tnrs_match."Name_matched_url" AS "matchedScientificNameID",
383
            tnrs_match."Author_score" AS "*Name_matched.Author_score",
384
            tnrs_match."Family_score" AS "matchedFamilyConfidence_fraction",
385
            COALESCE(tnrs_match."Name_matched_accepted_family", tnrs_match."Accepted_name_family") AS "matchedFamily",
386
            tnrs_match."Genus_matched" AS "matchedGenus",
387
            tnrs_match."Genus_score" AS "matchedGenusConfidence_fraction",
388
            tnrs_match."Specific_epithet_matched" AS "matchedSpecificEpithet",
389
            tnrs_match."Specific_epithet_score" AS "matchedSpeciesConfidence_fraction",
390
            tnrs_match."Infraspecific_epithet_matched" AS "matchedInfraspecificEpithet",
391
            tnrs_match."Infraspecific_epithet_score" AS "*Name_matched.Infraspecific_epithet_score",
392
            tnrs_match."Annotations" AS "identificationQualifier",
393
            tnrs_match."Unmatched_terms" AS "morphospeciesSuffix",
394
            map_taxonomic_status(tnrs_match."Taxonomic_status", tnrs_match."Accepted_name") AS "taxonomicStatus",
395
            tnrs_match."Accepted_name" AS accepted_taxon_name_no_author,
396
            tnrs_match."Accepted_name_author" AS accepted_author,
397
            tnrs_match."Accepted_name_rank" AS accepted_taxon_rank,
398
            tnrs_match."Accepted_name_url" AS "acceptedScientificNameID",
399
            tnrs_match."Accepted_name_species" AS accepted_species_binomial,
400
            tnrs_match."Accepted_name_family" AS accepted_family,
401
            tnrs_match."Selected" AS "*Name_matched.Selected",
402
            tnrs_match."Source" AS "*Name_matched.Source",
403
            tnrs_match."Warnings" AS "*Name_matched.Warnings",
404
            tnrs_match."Accepted_name_lsid" AS "*Name_matched.Accepted_name_lsid",
405
            tnrs_match.is_valid_match AS taxon_scrub__is_valid_match,
406
            tnrs_match.scrubbed_unique_taxon_name
407
           FROM tnrs_match) s;
408

    
409

    
410
ALTER TABLE "TNRS"."MatchedTaxon" OWNER TO bien;
411

    
412
--
413
-- Name: VIEW "MatchedTaxon"; Type: COMMENT; Schema: TNRS; Owner: bien
414
--
415

    
416
COMMENT ON VIEW "MatchedTaxon" IS '
417
to modify:
418
SELECT util.recreate_view(''"TNRS"."MatchedTaxon"'', $$
419
SELECT __
420
$$);
421
';
422

    
423

    
424
--
425
-- Name: Source; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace: 
426
--
427

    
428
CREATE TABLE "Source" (
429
    "*row_num" integer NOT NULL,
430
    "sourceType" text DEFAULT 'aggregator'::text NOT NULL,
431
    "datasetURL" text DEFAULT 'http://tnrs.iplantcollaborative.org/TNRSapp.html'::text NOT NULL,
432
    CONSTRAINT nulls_mapped CHECK (true)
433
);
434

    
435

    
436
ALTER TABLE "TNRS"."Source" OWNER TO bien;
437

    
438
--
439
-- Name: COLUMN "Source"."sourceType"; Type: COMMENT; Schema: TNRS; Owner: bien
440
--
441

    
442
COMMENT ON COLUMN "Source"."sourceType" IS '
443
constant
444
';
445

    
446

    
447
--
448
-- Name: COLUMN "Source"."datasetURL"; Type: COMMENT; Schema: TNRS; Owner: bien
449
--
450

    
451
COMMENT ON COLUMN "Source"."datasetURL" IS '
452
constant
453
';
454

    
455

    
456
--
457
-- Name: ValidMatchedTaxon; Type: VIEW; Schema: TNRS; Owner: bien
458
--
459

    
460
CREATE VIEW "ValidMatchedTaxon" AS
461
 SELECT "MatchedTaxon"."*Name_matched.batch",
462
    "MatchedTaxon"."concatenatedScientificName",
463
    "MatchedTaxon"."matchedTaxonName",
464
    "MatchedTaxon"."matchedTaxonRank",
465
    "MatchedTaxon"."*Name_matched.Name_score",
466
    "MatchedTaxon"."matchedScientificNameAuthorship",
467
    "MatchedTaxon"."matchedScientificNameID",
468
    "MatchedTaxon"."*Name_matched.Author_score",
469
    "MatchedTaxon"."matchedFamilyConfidence_fraction",
470
    "MatchedTaxon"."matchedFamily",
471
    "MatchedTaxon"."matchedGenus",
472
    "MatchedTaxon"."matchedGenusConfidence_fraction",
473
    "MatchedTaxon"."matchedSpecificEpithet",
474
    "MatchedTaxon"."matchedSpeciesConfidence_fraction",
475
    "MatchedTaxon"."matchedInfraspecificEpithet",
476
    "MatchedTaxon"."*Name_matched.Infraspecific_epithet_score",
477
    "MatchedTaxon"."identificationQualifier",
478
    "MatchedTaxon"."morphospeciesSuffix",
479
    "MatchedTaxon"."taxonomicStatus",
480
    "MatchedTaxon".accepted_taxon_name_no_author,
481
    "MatchedTaxon".accepted_author,
482
    "MatchedTaxon".accepted_taxon_rank,
483
    "MatchedTaxon"."acceptedScientificNameID",
484
    "MatchedTaxon".accepted_species_binomial,
485
    "MatchedTaxon".accepted_family,
486
    "MatchedTaxon"."*Name_matched.Selected",
487
    "MatchedTaxon"."*Name_matched.Source",
488
    "MatchedTaxon"."*Name_matched.Warnings",
489
    "MatchedTaxon"."*Name_matched.Accepted_name_lsid",
490
    "MatchedTaxon".taxon_scrub__is_valid_match,
491
    "MatchedTaxon".scrubbed_unique_taxon_name,
492
    "MatchedTaxon".accepted_morphospecies_binomial
493
   FROM "MatchedTaxon"
494
  WHERE "MatchedTaxon".taxon_scrub__is_valid_match;
495

    
496

    
497
ALTER TABLE "TNRS"."ValidMatchedTaxon" OWNER TO bien;
498

    
499
--
500
-- Name: VIEW "ValidMatchedTaxon"; Type: COMMENT; Schema: TNRS; Owner: bien
501
--
502

    
503
COMMENT ON VIEW "ValidMatchedTaxon" IS '
504
to update, use * as the column list
505
';
506

    
507

    
508
--
509
-- Name: batch; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace: 
510
--
511

    
512
CREATE TABLE batch (
513
    id text NOT NULL,
514
    id_by_time text,
515
    time_submitted timestamp with time zone DEFAULT now(),
516
    client_version text
517
);
518

    
519

    
520
ALTER TABLE "TNRS".batch OWNER TO bien;
521

    
522
--
523
-- Name: batch_download_settings; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace: 
524
--
525

    
526
CREATE TABLE batch_download_settings (
527
    id text NOT NULL,
528
    "E-mail" text,
529
    "Id" text,
530
    "Job type" text,
531
    "Contains Id" boolean,
532
    "Start time" text,
533
    "Finish time" text,
534
    "TNRS version" text,
535
    "Sources selected" text,
536
    "Match threshold" double precision,
537
    "Classification" text,
538
    "Allow partial matches?" boolean,
539
    "Sort by source" boolean,
540
    "Constrain by higher taxonomy" boolean
541
);
542

    
543

    
544
ALTER TABLE "TNRS".batch_download_settings OWNER TO bien;
545

    
546
--
547
-- Name: TABLE batch_download_settings; Type: COMMENT; Schema: TNRS; Owner: bien
548
--
549

    
550
COMMENT ON TABLE batch_download_settings IS '
551
stores data from http://tnrs.iplantcollaborative.org/TNRSapp.html > Submit List > results section > Download settings > settings.txt
552
';
553

    
554

    
555
--
556
-- Name: client_version; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace: 
557
--
558

    
559
CREATE TABLE client_version (
560
    id text NOT NULL,
561
    global_rev integer NOT NULL,
562
    "/lib/tnrs.py rev" integer,
563
    "/bin/tnrs_db rev" integer
564
);
565

    
566

    
567
ALTER TABLE "TNRS".client_version OWNER TO bien;
568

    
569
--
570
-- Name: TABLE client_version; Type: COMMENT; Schema: TNRS; Owner: bien
571
--
572

    
573
COMMENT ON TABLE client_version IS '
574
contains svn revisions
575
';
576

    
577

    
578
--
579
-- Name: COLUMN client_version.global_rev; Type: COMMENT; Schema: TNRS; Owner: bien
580
--
581

    
582
COMMENT ON COLUMN client_version.global_rev IS '
583
from `svn info .` > Last Changed Rev
584
';
585

    
586

    
587
--
588
-- Name: COLUMN client_version."/lib/tnrs.py rev"; Type: COMMENT; Schema: TNRS; Owner: bien
589
--
590

    
591
COMMENT ON COLUMN client_version."/lib/tnrs.py rev" IS '
592
from `svn info lib/tnrs.py` > Last Changed Rev
593
';
594

    
595

    
596
--
597
-- Name: COLUMN client_version."/bin/tnrs_db rev"; Type: COMMENT; Schema: TNRS; Owner: bien
598
--
599

    
600
COMMENT ON COLUMN client_version."/bin/tnrs_db rev" IS '
601
from `svn info bin/tnrs_db` > Last Changed Rev
602
';
603

    
604

    
605
--
606
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: bien
607
--
608

    
609
CREATE VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" AS
610
 SELECT tnrs_match."Name_submitted" AS scrubbed_unique_taxon_name,
611
    tnrs_match."Name_matched_rank" AS scrubbed_taxon_rank,
612
    COALESCE(tnrs_match."Name_matched_accepted_family", tnrs_match."Family_matched") AS scrubbed_family,
613
    tnrs_match."Genus_matched" AS scrubbed_genus,
614
    tnrs_match."Specific_epithet_matched" AS scrubbed_specific_epithet,
615
    tnrs_match."Infraspecific_rank" AS scrubbed_infraspecific_rank,
616
    tnrs_match."Infraspecific_epithet_matched" AS scrubbed_infraspecific_epithet,
617
    tnrs_match."Name_matched_author" AS scrubbed_author,
618
    tnrs_match."Name_matched" AS scrubbed_taxon_name_no_author,
619
    (tnrs_match."Name_matched" || COALESCE((' '::text || tnrs_match."Name_matched_author"), ''::text)) AS scrubbed_taxon_name_with_author
620
   FROM tnrs_match;
621

    
622

    
623
ALTER TABLE "TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*" OWNER TO bien;
624

    
625
--
626
-- Name: VIEW "taxon_scrub.scrubbed_unique_taxon_name.*"; Type: COMMENT; Schema: TNRS; Owner: bien
627
--
628

    
629
COMMENT ON VIEW "taxon_scrub.scrubbed_unique_taxon_name.*" IS '
630
to modify:
631
SELECT util.recreate_view(''"TNRS"."taxon_scrub.scrubbed_unique_taxon_name.*"'', $$
632
SELECT __
633
$$);
634

    
635
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.
636
';
637

    
638

    
639
--
640
-- Name: taxon_scrub; Type: VIEW; Schema: TNRS; Owner: bien
641
--
642

    
643
CREATE VIEW taxon_scrub AS
644
 SELECT "ValidMatchedTaxon".scrubbed_unique_taxon_name,
645
    "ValidMatchedTaxon"."*Name_matched.batch",
646
    "ValidMatchedTaxon"."concatenatedScientificName",
647
    "ValidMatchedTaxon"."matchedTaxonName",
648
    "ValidMatchedTaxon"."matchedTaxonRank",
649
    "ValidMatchedTaxon"."*Name_matched.Name_score",
650
    "ValidMatchedTaxon"."matchedScientificNameAuthorship",
651
    "ValidMatchedTaxon"."matchedScientificNameID",
652
    "ValidMatchedTaxon"."*Name_matched.Author_score",
653
    "ValidMatchedTaxon"."matchedFamilyConfidence_fraction",
654
    "ValidMatchedTaxon"."matchedFamily",
655
    "ValidMatchedTaxon"."matchedGenus",
656
    "ValidMatchedTaxon"."matchedGenusConfidence_fraction",
657
    "ValidMatchedTaxon"."matchedSpecificEpithet",
658
    "ValidMatchedTaxon"."matchedSpeciesConfidence_fraction",
659
    "ValidMatchedTaxon"."matchedInfraspecificEpithet",
660
    "ValidMatchedTaxon"."*Name_matched.Infraspecific_epithet_score",
661
    "ValidMatchedTaxon"."identificationQualifier",
662
    "ValidMatchedTaxon"."morphospeciesSuffix",
663
    "ValidMatchedTaxon"."taxonomicStatus",
664
    "ValidMatchedTaxon".accepted_taxon_name_no_author,
665
    "ValidMatchedTaxon".accepted_author,
666
    "ValidMatchedTaxon".accepted_taxon_rank,
667
    "ValidMatchedTaxon"."acceptedScientificNameID",
668
    "ValidMatchedTaxon".accepted_species_binomial,
669
    "ValidMatchedTaxon".accepted_family,
670
    "ValidMatchedTaxon"."*Name_matched.Selected",
671
    "ValidMatchedTaxon"."*Name_matched.Source",
672
    "ValidMatchedTaxon"."*Name_matched.Warnings",
673
    "ValidMatchedTaxon"."*Name_matched.Accepted_name_lsid",
674
    "ValidMatchedTaxon".taxon_scrub__is_valid_match,
675
    "ValidMatchedTaxon".accepted_morphospecies_binomial,
676
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_rank,
677
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_family,
678
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus,
679
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet,
680
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_rank,
681
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_infraspecific_epithet,
682
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_author,
683
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_no_author,
684
    "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_taxon_name_with_author,
685
        CASE
686
            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"."morphospeciesSuffix")
687
            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"."morphospeciesSuffix")
688
            ELSE (("taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_genus || ' '::text) || "taxon_scrub.scrubbed_unique_taxon_name.*".scrubbed_specific_epithet)
689
        END AS scrubbed_morphospecies_binomial
690
   FROM ("ValidMatchedTaxon"
691
   LEFT JOIN "taxon_scrub.scrubbed_unique_taxon_name.*" USING (scrubbed_unique_taxon_name));
692

    
693

    
694
ALTER TABLE "TNRS".taxon_scrub OWNER TO bien;
695

    
696
--
697
-- Name: VIEW taxon_scrub; Type: COMMENT; Schema: TNRS; Owner: bien
698
--
699

    
700
COMMENT ON VIEW taxon_scrub IS '
701
to modify:
702
SELECT util.recreate_view(''"TNRS".taxon_scrub'', $$
703
SELECT __
704
$$);
705
';
706

    
707

    
708
--
709
-- Name: ~Source.map; Type: TABLE; Schema: TNRS; Owner: bien; Tablespace: 
710
--
711

    
712
CREATE TABLE "~Source.map" (
713
    "from" text NOT NULL,
714
    "to" text,
715
    filter text,
716
    notes text
717
);
718

    
719

    
720
ALTER TABLE "TNRS"."~Source.map" OWNER TO bien;
721

    
722
--
723
-- Data for Name: Source; Type: TABLE DATA; Schema: TNRS; Owner: bien
724
--
725

    
726
COPY "Source" ("*row_num", "sourceType", "datasetURL") FROM stdin;
727
1	aggregator	http://tnrs.iplantcollaborative.org/TNRSapp.html
728
\.
729

    
730

    
731
--
732
-- Data for Name: batch; Type: TABLE DATA; Schema: TNRS; Owner: bien
733
--
734

    
735
COPY batch (id, id_by_time, time_submitted, client_version) FROM stdin;
736
2014-06-25 16:26:37.716529-07	2014-06-25 16:26:37.716529-07	2014-06-25 16:26:37.716529-07	\N
737
\.
738

    
739

    
740
--
741
-- Data for Name: batch_download_settings; Type: TABLE DATA; Schema: TNRS; Owner: bien
742
--
743

    
744
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;
745
\.
746

    
747

    
748
--
749
-- Data for Name: client_version; Type: TABLE DATA; Schema: TNRS; Owner: bien
750
--
751

    
752
COPY client_version (id, global_rev, "/lib/tnrs.py rev", "/bin/tnrs_db rev") FROM stdin;
753
\.
754

    
755

    
756
--
757
-- Data for Name: tnrs_match; Type: TABLE DATA; Schema: TNRS; Owner: bien
758
--
759

    
760
COPY tnrs_match (batch, match_num, "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", is_valid_match, scrubbed_unique_taxon_name) FROM stdin;
761
2014-06-25 16:26:37.716529-07	0	0	Compositae indet. sp.1	0.900000000000000022	Compositae	family	1	\N	http://www.theplantlist.org/1.1/browse/A/Compositae/	\N	\N	Compositae	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	indet. sp.1	Accepted	Compositae	\N	family	http://www.theplantlist.org/1.1/browse/A/Compositae/	\N	\N	true	tpl	 [Ambiguous match] 	\N	t	Compositae
762
2014-06-25 16:26:37.716529-07	1	0	Compositae indet. sp.1	0.900000000000000022	Compositae	family	1	\N	\N	\N	\N	Compositae	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	indet. sp.1	Accepted	Compositae	\N	family	\N	\N	\N	false	tpl	 [Ambiguous match] 	\N	t	Compositae
763
2014-06-25 16:26:37.716529-07	2	0	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	false	tropicos	 	\N	t	Asteraceae Bercht. & J. Presl
764
2014-06-25 16:26:37.716529-07	3	1	Fabaceae Boyle#6500	0.839999999999999969	Fagaceae	family	0.939999999999999947	\N	;http://plants.usda.gov/java/nameSearch	\N	\N	Fagaceae	0.880000000000000004	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Boyle#6500	Accepted	Fagaceae	\N	family	;http://plants.usda.gov/java/nameSearch	\N	\N	true	tpl;usda	 	\N	f	Fagaceae
765
2014-06-25 16:26:37.716529-07	4	1	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	t	Fabaceae Lindl.
766
2014-06-25 16:26:37.716529-07	5	1	Fabaceae Boyle#6500	0.839999999999999969	Fagaceae	family	0.939999999999999947	Dumort.	http://www.tropicos.org/Name/42000062	\N	\N	Fagaceae	0.880000000000000004	Fagaceae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Boyle#6500	Accepted	Fagaceae	Dumort.	family	http://www.tropicos.org/Name/42000062	\N	Fagaceae	false	tropicos	 	\N	f	Fagaceae Dumort.
767
2014-06-25 16:26:37.716529-07	6	1	Fabaceae Boyle#6500	0.67000000000000004	Ficaceae	family	0.770000000000000018	Bercht. & J. Presl	http://www.tropicos.org/Name/100353631	\N	\N	Ficaceae	0.75	Ficaceae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Boyle#6500	No opinion	\N	\N	\N	\N	\N	\N	false	tropicos	 	\N	f	Ficaceae Bercht. & J. Presl
768
2014-06-25 16:26:37.716529-07	7	1	Fabaceae Boyle#6500	0.67000000000000004	Fucaceae	family	0.770000000000000018	\N	http://www.tropicos.org/Name/100371040	\N	\N	Fucaceae	0.75	Fucaceae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Boyle#6500	No opinion	\N	\N	\N	\N	\N	\N	false	tropicos	 	\N	f	Fucaceae
769
2014-06-25 16:26:37.716529-07	8	1	Fabaceae Boyle#6500	0.900000000000000022	Fabaceae	family	1	\N	http://plants.usda.gov/java/nameSearch	\N	\N	Fabaceae	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	Boyle#6500	Accepted	Fabaceae	\N	family	http://plants.usda.gov/java/nameSearch	\N	\N	false	usda	 	\N	t	Fabaceae
770
2014-06-25 16:26:37.716529-07	9	2	Fabaceae Inga "fuzzy leaf"	0.900000000000000022	Inga	genus	1	\N	http://www.theplantlist.org/1.1/browse/A/Leguminosae/Inga/;http://plants.usda.gov/java/profile?symbol=INGA	\N	\N	Fabaceae	1	Fabaceae	Inga	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	"fuzzy leaf"	Accepted	Inga	\N	genus	http://www.theplantlist.org/1.1/browse/A/Leguminosae/Inga/;http://plants.usda.gov/java/profile?symbol=INGA	\N	Fabaceae	true	tpl;usda	 	\N	t	Fabaceae Inga
771
2014-06-25 16:26:37.716529-07	10	2	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	false	tropicos	 	\N	t	Fabaceae Inga Mill.
772
2014-06-25 16:26:37.716529-07	11	2	Fabaceae Inga "fuzzy leaf"	0.900000000000000022	Inga	genus	1	Scop.	http://www.tropicos.org/Name/50215121	\N	\N	Fabaceae	1	Fabaceae	Inga	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	"fuzzy leaf"	Illegitimate	\N	\N	\N	\N	\N	\N	false	tropicos	 	\N	t	Fabaceae Inga Scop.
773
2014-06-25 16:26:37.716529-07	12	3	Fabaceae Inga sp.3	0.900000000000000022	Inga	genus	1	\N	http://www.theplantlist.org/1.1/browse/A/Leguminosae/Inga/;http://plants.usda.gov/java/profile?symbol=INGA	\N	\N	Fabaceae	1	Fabaceae	Inga	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	sp.3	Accepted	Inga	\N	genus	http://www.theplantlist.org/1.1/browse/A/Leguminosae/Inga/;http://plants.usda.gov/java/profile?symbol=INGA	\N	Fabaceae	true	tpl;usda	 	\N	t	Fabaceae Inga
774
2014-06-25 16:26:37.716529-07	13	3	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	false	tropicos	 	\N	t	Fabaceae Inga Mill.
775
2014-06-25 16:26:37.716529-07	14	3	Fabaceae Inga sp.3	0.900000000000000022	Inga	genus	1	Scop.	http://www.tropicos.org/Name/50215121	\N	\N	Fabaceae	1	Fabaceae	Inga	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	sp.3	Illegitimate	\N	\N	\N	\N	\N	\N	false	tropicos	 	\N	t	Fabaceae Inga Scop.
776
2014-06-25 16:26:37.716529-07	15	4	Fabaceae unknown #2	0.839999999999999969	Fagaceae	family	0.939999999999999947	\N	;http://plants.usda.gov/java/nameSearch	\N	\N	Fagaceae	0.880000000000000004	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	unknown #2	Accepted	Fagaceae	\N	family	;http://plants.usda.gov/java/nameSearch	\N	\N	true	tpl;usda	 	\N	f	Fagaceae
777
2014-06-25 16:26:37.716529-07	16	4	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	t	Fabaceae Lindl.
778
2014-06-25 16:26:37.716529-07	17	4	Fabaceae unknown #2	0.839999999999999969	Fagaceae	family	0.939999999999999947	Dumort.	http://www.tropicos.org/Name/42000062	\N	\N	Fagaceae	0.880000000000000004	Fagaceae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	unknown #2	Accepted	Fagaceae	Dumort.	family	http://www.tropicos.org/Name/42000062	\N	Fagaceae	false	tropicos	 	\N	f	Fagaceae Dumort.
779
2014-06-25 16:26:37.716529-07	18	4	Fabaceae unknown #2	0.67000000000000004	Ficaceae	family	0.770000000000000018	Bercht. & J. Presl	http://www.tropicos.org/Name/100353631	\N	\N	Ficaceae	0.75	Ficaceae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	unknown #2	No opinion	\N	\N	\N	\N	\N	\N	false	tropicos	 	\N	f	Ficaceae Bercht. & J. Presl
780
2014-06-25 16:26:37.716529-07	19	4	Fabaceae unknown #2	0.67000000000000004	Fucaceae	family	0.770000000000000018	\N	http://www.tropicos.org/Name/100371040	\N	\N	Fucaceae	0.75	Fucaceae	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	unknown #2	No opinion	\N	\N	\N	\N	\N	\N	false	tropicos	 	\N	f	Fucaceae
781
2014-06-25 16:26:37.716529-07	20	4	Fabaceae unknown #2	0.900000000000000022	Fabaceae	family	1	\N	http://plants.usda.gov/java/nameSearch	\N	\N	Fabaceae	1	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	unknown #2	Accepted	Fabaceae	\N	family	http://plants.usda.gov/java/nameSearch	\N	\N	false	usda	 	\N	t	Fabaceae
782
2014-06-25 16:26:37.716529-07	21	5	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	f	\N
783
2014-06-25 16:26:37.716529-07	22	6	Poa annua	1	Poa annua	species	1	L.	http://www.theplantlist.org/tpl1.1/record/kew-435194;http://www.tropicos.org/Name/25509881;http://plants.usda.gov/java/profile?symbol=POAN	\N	\N	\N	\N	Poaceae	Poa	1	annua	1	\N	\N	\N	\N	\N	\N	\N	\N	Accepted	Poa annua	L.	species	http://www.theplantlist.org/tpl1.1/record/kew-435194;http://www.tropicos.org/Name/25509881;http://plants.usda.gov/java/profile?symbol=POAN	Poa annua	Poaceae	true	tpl;tropicos;usda	 	\N	t	Poaceae Poa annua L.
784
2014-06-25 16:26:37.716529-07	23	6	Poa annua	1	Poa annua	species	1	Cham. & Schltdl.	http://www.theplantlist.org/tpl1.1/record/kew-435195	\N	\N	\N	\N	Poaceae	Poa	1	annua	1	\N	\N	\N	\N	\N	\N	\N	\N	Synonym	Poa infirma	Kunth	species	http://www.theplantlist.org/tpl1.1/record/kew-436189	Poa infirma	Poaceae	false	tpl	 	\N	t	Poaceae Poa infirma Kunth
785
2014-06-25 16:26:37.716529-07	24	7	Poa annua L.	1	Poa annua	species	1	L.	http://www.theplantlist.org/tpl1.1/record/kew-435194;http://www.tropicos.org/Name/25509881;http://plants.usda.gov/java/profile?symbol=POAN	L.	1	\N	\N	Poaceae	Poa	1	annua	1	\N	\N	\N	\N	\N	\N	\N	\N	Accepted	Poa annua	L.	species	http://www.theplantlist.org/tpl1.1/record/kew-435194;http://www.tropicos.org/Name/25509881;http://plants.usda.gov/java/profile?symbol=POAN	Poa annua	Poaceae	true	tpl;tropicos;usda	 	\N	t	Poaceae Poa annua L.
786
2014-06-25 16:26:37.716529-07	25	7	Poa annua L.	0.800000000000000044	Poa annua	species	1	Cham. & Schltdl.	http://www.theplantlist.org/tpl1.1/record/kew-435195	Cham. & Schltdl.	0	\N	\N	Poaceae	Poa	1	annua	1	\N	\N	\N	\N	\N	\N	\N	\N	Synonym	Poa infirma	Kunth	species	http://www.theplantlist.org/tpl1.1/record/kew-436189	Poa infirma	Poaceae	false	tpl	 	\N	t	Poaceae Poa infirma Kunth
787
2014-06-25 16:26:37.716529-07	26	8	Poa annua fo. lanuginosa	1	Poa annua fo. lanuginosa	fo.	1	Sennen	http://www.theplantlist.org/tpl1.1/record/tro-50267771	\N	\N	\N	\N	\N	Poa	1	annua	1	fo.	lanuginosa	1	\N	\N	\N	\N	\N	Synonym	Poa annua	L.	species	http://www.theplantlist.org/tpl1.1/record/kew-435194	Poa annua	Poaceae	true	tpl	 	\N	t	Poaceae Poa annua L.
788
2014-06-25 16:26:37.716529-07	27	8	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	false	tropicos	 	\N	t	Poaceae Poa annua var. annua
789
2014-06-25 16:26:37.716529-07	28	9	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	t	Poaceae Poa infirma Kunth
790
2014-06-25 16:26:37.716529-07	29	9	Poa annua ssp. exilis	0.959999999999999964	Poa annua var. exilis	variety	0.959999999999999964	Tomm. ex Freyn	http://www.tropicos.org/Name/25547854	\N	\N	\N	\N	Poaceae	Poa	1	annua	1	var.	exilis	0.699999999999999956	\N	\N	\N	\N	\N	Synonym	Poa infirma	Kunth	species	http://www.tropicos.org/Name/25514158	Poa infirma	Poaceae	false	tropicos	 	\N	t	Poaceae Poa infirma Kunth
791
2014-06-25 16:26:37.716529-07	30	10	Poa annua subsp. exilis	1	Poa annua subsp. exilis	subsp.	1	(Tomm. ex Freyn.) Asch. & Graebn.	http://www.theplantlist.org/tpl1.1/record/kew-435202	\N	\N	\N	\N	\N	Poa	1	annua	1	subsp.	exilis	1	\N	\N	\N	\N	\N	Synonym	Poa infirma	Kunth	species	http://www.theplantlist.org/tpl1.1/record/kew-436189	Poa infirma	Poaceae	true	tpl	 	\N	t	Poaceae Poa infirma Kunth
792
2014-06-25 16:26:37.716529-07	31	10	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	false	tropicos	 	\N	t	Poaceae Poa infirma Kunth
793
2014-06-25 16:26:37.716529-07	32	11	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	t	Poaceae Poa annua subvar. minima (Schur) Asch. & Graebn.
794
2014-06-25 16:26:37.716529-07	33	12	Poa annua var. eriolepis	1	Poa annua var. eriolepis	var.	1	̉ۡ.Desv.	http://www.theplantlist.org/tpl1.1/record/kew-435206	\N	\N	\N	\N	\N	Poa	1	annua	1	var.	eriolepis	1	\N	\N	\N	\N	\N	Synonym	Poa annua	L.	species	http://www.theplantlist.org/tpl1.1/record/kew-435194	Poa annua	Poaceae	true	tpl	 	\N	t	Poaceae Poa annua L.
795
2014-06-25 16:26:37.716529-07	34	12	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	false	tropicos	 	\N	t	Poaceae Poa annua L.
796
2014-06-25 16:26:37.716529-07	35	13	Silene scouleri Hook. subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire var. grisea C.L. Hitchc. & Maguire	0.770000000000000018	Silene scouleri subsp. pringlei	subsp.	0.770000000000000018	(S. Watson) C.L. Hitchc. & Maguire	http://www.theplantlist.org/tpl1.1/record/tro-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	subsp.	http://www.theplantlist.org/tpl1.1/record/tro-6303627	Silene scouleri	Caryophyllaceae	true	tpl	 [Partial match] 	\N	t	Caryophyllaceae Silene scouleri subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire
797
2014-06-25 16:26:37.716529-07	36	13	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	false	tropicos	 [Partial match] 	\N	t	Caryophyllaceae Silene scouleri subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire
798
2014-06-25 16:26:37.716529-07	37	13	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://plants.usda.gov/java/profile?symbol=SISCP	\N	\N	\N	\N	Caryophyllaceae	Silene	1	scouleri	1	subsp.	pringlei	1	\N	\N	\N	\N	var. grisea	Accepted	Silene scouleri ssp. pringlei	(S. Watson) C.L. Hitchc. & Maguire	subspecies	http://plants.usda.gov/java/profile?symbol=SISCP	Silene scouleri	Caryophyllaceae	false	usda	 [Partial match] 	\N	t	Caryophyllaceae Silene scouleri ssp. pringlei (S. Watson) C.L. Hitchc. & Maguire
799
2014-06-25 16:26:37.716529-07	38	14	Silene scouleri subsp. pringlei var. grisea C.L. Hitchc. & Maguire	0.770000000000000018	Silene scouleri subsp. pringlei	subsp.	0.770000000000000018	(S. Watson) C.L. Hitchc. & Maguire	http://www.theplantlist.org/tpl1.1/record/tro-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	subsp.	http://www.theplantlist.org/tpl1.1/record/tro-6303627	Silene scouleri	Caryophyllaceae	true	tpl	 [Partial match] 	\N	t	Caryophyllaceae Silene scouleri subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire
800
2014-06-25 16:26:37.716529-07	39	14	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	false	tropicos	 [Partial match] 	\N	t	Caryophyllaceae Silene scouleri subsp. pringlei (S. Watson) C.L. Hitchc. & Maguire
801
2014-06-25 16:26:37.716529-07	40	14	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://plants.usda.gov/java/profile?symbol=SISCP	\N	\N	\N	\N	Caryophyllaceae	Silene	1	scouleri	1	subsp.	pringlei	1	\N	\N	\N	\N	var. grisea	Accepted	Silene scouleri ssp. pringlei	(S. Watson) C.L. Hitchc. & Maguire	subspecies	http://plants.usda.gov/java/profile?symbol=SISCP	Silene scouleri	Caryophyllaceae	false	usda	 [Partial match] 	\N	t	Caryophyllaceae Silene scouleri ssp. pringlei (S. Watson) C.L. Hitchc. & Maguire
802
\.
803

    
804

    
805
--
806
-- Data for Name: ~Source.map; Type: TABLE DATA; Schema: TNRS; Owner: bien
807
--
808

    
809
COPY "~Source.map" ("from", "to", filter, notes) FROM stdin;
810
row_num	*row_num	\N	\N
811
:aggregator	sourceType	\N	\N
812
:http://tnrs.iplantcollaborative.org/TNRSapp.html	datasetURL	\N	\N
813
\.
814

    
815

    
816
--
817
-- Name: Source_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace: 
818
--
819

    
820
ALTER TABLE ONLY "Source"
821
    ADD CONSTRAINT "Source_pkey" PRIMARY KEY ("*row_num");
822

    
823

    
824
--
825
-- Name: batch_download_settings_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace: 
826
--
827

    
828
ALTER TABLE ONLY batch_download_settings
829
    ADD CONSTRAINT batch_download_settings_pkey PRIMARY KEY (id);
830

    
831

    
832
--
833
-- Name: batch_id_by_time_key; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace: 
834
--
835

    
836
ALTER TABLE ONLY batch
837
    ADD CONSTRAINT batch_id_by_time_key UNIQUE (id_by_time);
838

    
839

    
840
--
841
-- Name: batch_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace: 
842
--
843

    
844
ALTER TABLE ONLY batch
845
    ADD CONSTRAINT batch_pkey PRIMARY KEY (id);
846

    
847

    
848
--
849
-- Name: client_version_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace: 
850
--
851

    
852
ALTER TABLE ONLY client_version
853
    ADD CONSTRAINT client_version_pkey PRIMARY KEY (id);
854

    
855

    
856
--
857
-- Name: tnrs_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace: 
858
--
859

    
860
ALTER TABLE ONLY tnrs_match
861
    ADD CONSTRAINT tnrs_pkey PRIMARY KEY (batch, match_num);
862

    
863

    
864
--
865
-- Name: ~Source.map_from_key; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace: 
866
--
867

    
868
ALTER TABLE ONLY "~Source.map"
869
    ADD CONSTRAINT "~Source.map_from_key" UNIQUE ("from");
870

    
871

    
872
--
873
-- Name: ~Source.map_to_key; Type: CONSTRAINT; Schema: TNRS; Owner: bien; Tablespace: 
874
--
875

    
876
ALTER TABLE ONLY "~Source.map"
877
    ADD CONSTRAINT "~Source.map_to_key" UNIQUE ("to");
878

    
879

    
880
--
881
-- Name: batch_client_version_idx; Type: INDEX; Schema: TNRS; Owner: bien; Tablespace: 
882
--
883

    
884
CREATE INDEX batch_client_version_idx ON batch USING btree (client_version);
885

    
886

    
887
--
888
-- Name: tnrs_Name_submitted_idx; Type: INDEX; Schema: TNRS; Owner: bien; Tablespace: 
889
--
890

    
891
CREATE INDEX "tnrs_Name_submitted_idx" ON tnrs_match USING btree ("Name_submitted");
892

    
893

    
894
--
895
-- Name: tnrs__valid_match; Type: INDEX; Schema: TNRS; Owner: bien; Tablespace: 
896
--
897

    
898
CREATE INDEX tnrs__valid_match ON tnrs_match USING btree ("Name_submitted") WHERE is_valid_match;
899

    
900

    
901
--
902
-- Name: batch__fill; Type: TRIGGER; Schema: TNRS; Owner: bien
903
--
904

    
905
CREATE TRIGGER batch__fill BEFORE INSERT OR UPDATE ON batch FOR EACH ROW EXECUTE PROCEDURE batch__fill();
906

    
907

    
908
--
909
-- Name: map_filter_insert; Type: TRIGGER; Schema: TNRS; Owner: bien
910
--
911

    
912
CREATE TRIGGER map_filter_insert BEFORE INSERT ON "~Source.map" FOR EACH ROW EXECUTE PROCEDURE util.map_filter_insert();
913

    
914
ALTER TABLE "~Source.map" DISABLE TRIGGER map_filter_insert;
915

    
916

    
917
--
918
-- Name: tnrs__batch_begin; Type: TRIGGER; Schema: TNRS; Owner: bien
919
--
920

    
921
CREATE TRIGGER tnrs__batch_begin BEFORE INSERT ON tnrs_match FOR EACH STATEMENT EXECUTE PROCEDURE tnrs__batch_begin();
922

    
923

    
924
--
925
-- Name: tnrs__match_num__fill; Type: TRIGGER; Schema: TNRS; Owner: bien
926
--
927

    
928
CREATE TRIGGER tnrs__match_num__fill BEFORE INSERT ON tnrs_match FOR EACH ROW EXECUTE PROCEDURE tnrs__match_num__fill();
929

    
930

    
931
--
932
-- Name: tnrs_populate_fields; Type: TRIGGER; Schema: TNRS; Owner: bien
933
--
934

    
935
CREATE TRIGGER tnrs_populate_fields BEFORE INSERT OR UPDATE ON tnrs_match FOR EACH ROW EXECUTE PROCEDURE tnrs_populate_fields();
936

    
937

    
938
--
939
-- Name: batch_client_version_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: bien
940
--
941

    
942
ALTER TABLE ONLY batch
943
    ADD CONSTRAINT batch_client_version_fkey FOREIGN KEY (client_version) REFERENCES client_version(id) ON UPDATE CASCADE ON DELETE CASCADE;
944

    
945

    
946
--
947
-- Name: batch_download_settings_id_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: bien
948
--
949

    
950
ALTER TABLE ONLY batch_download_settings
951
    ADD CONSTRAINT batch_download_settings_id_fkey FOREIGN KEY (id) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
952

    
953

    
954
--
955
-- Name: tnrs_batch_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: bien
956
--
957

    
958
ALTER TABLE ONLY tnrs_match
959
    ADD CONSTRAINT tnrs_batch_fkey FOREIGN KEY (batch) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
960

    
961

    
962
--
963
-- Name: TNRS; Type: ACL; Schema: -; Owner: bien
964
--
965

    
966
REVOKE ALL ON SCHEMA "TNRS" FROM PUBLIC;
967
REVOKE ALL ON SCHEMA "TNRS" FROM bien;
968
GRANT ALL ON SCHEMA "TNRS" TO bien;
969
GRANT USAGE ON SCHEMA "TNRS" TO bien_read;
970

    
971

    
972
--
973
-- Name: tnrs_match; Type: ACL; Schema: TNRS; Owner: bien
974
--
975

    
976
REVOKE ALL ON TABLE tnrs_match FROM PUBLIC;
977
REVOKE ALL ON TABLE tnrs_match FROM bien;
978
GRANT ALL ON TABLE tnrs_match TO bien;
979
GRANT SELECT ON TABLE tnrs_match TO bien_read;
980

    
981

    
982
--
983
-- Name: MatchedTaxon; Type: ACL; Schema: TNRS; Owner: bien
984
--
985

    
986
REVOKE ALL ON TABLE "MatchedTaxon" FROM PUBLIC;
987
REVOKE ALL ON TABLE "MatchedTaxon" FROM bien;
988
GRANT ALL ON TABLE "MatchedTaxon" TO bien;
989
GRANT SELECT ON TABLE "MatchedTaxon" TO bien_read;
990

    
991

    
992
--
993
-- Name: ValidMatchedTaxon; Type: ACL; Schema: TNRS; Owner: bien
994
--
995

    
996
REVOKE ALL ON TABLE "ValidMatchedTaxon" FROM PUBLIC;
997
REVOKE ALL ON TABLE "ValidMatchedTaxon" FROM bien;
998
GRANT ALL ON TABLE "ValidMatchedTaxon" TO bien;
999
GRANT SELECT ON TABLE "ValidMatchedTaxon" TO bien_read;
1000

    
1001

    
1002
--
1003
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: ACL; Schema: TNRS; Owner: bien
1004
--
1005

    
1006
REVOKE ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" FROM PUBLIC;
1007
REVOKE ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" FROM bien;
1008
GRANT ALL ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" TO bien;
1009
GRANT SELECT ON TABLE "taxon_scrub.scrubbed_unique_taxon_name.*" TO bien_read;
1010

    
1011

    
1012
--
1013
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: bien
1014
--
1015

    
1016
REVOKE ALL ON TABLE taxon_scrub FROM PUBLIC;
1017
REVOKE ALL ON TABLE taxon_scrub FROM bien;
1018
GRANT ALL ON TABLE taxon_scrub TO bien;
1019
GRANT SELECT ON TABLE taxon_scrub TO bien_read;
1020

    
1021

    
1022
--
1023
-- PostgreSQL database dump complete
1024
--
1025

    
(1-1/10)