Project

General

Profile

1
CREATE TABLE tnrs
2
(
3
  "Name_number" text,
4
  "Name_submitted" text NOT NULL,
5
  "Overall_score" text,
6
  "Name_matched" text,
7
  "Name_matched_rank" text,
8
  "Name_score" text,
9
  "Name_matched_author" text,
10
  "Name_matched_url" text,
11
  "Author_matched" text,
12
  "Author_score" text,
13
  "Family_matched" text,
14
  "Family_score" text,
15
  "Name_matched_accepted_family" text,
16
  "Genus_matched" text,
17
  "Genus_score" text,
18
  "Specific_epithet_matched" text,
19
  "Specific_epithet_score" text,
20
  "Infraspecific_rank" text,
21
  "Infraspecific_epithet_matched" text,
22
  "Infraspecific_epithet_score" text,
23
  "Infraspecific_rank_2" text,
24
  "Infraspecific_epithet_2_matched" text,
25
  "Infraspecific_epithet_2_score" text,
26
  "Annotations" text,
27
  "Unmatched_terms" text,
28
  "Taxonomic_status" text,
29
  "Accepted_name" text,
30
  "Accepted_name_author" text,
31
  "Accepted_name_rank" text,
32
  "Accepted_name_url" text,
33
  "Accepted_name_species" text,
34
  "Accepted_name_family" text,
35
  "Selected" text,
36
  "Source" text,
37
  "Warnings" text,
38
  "Accepted_name_lsid" text,
39
  CONSTRAINT tnrs_pkey PRIMARY KEY ("Name_submitted" )
40
)
41
WITH (
42
  OIDS=FALSE
43
);
44
COMMENT ON TABLE "TNRS".tnrs
45
  IS 'tnrs_accepted_names sorts accepted names first (note that false sorts before true). Accepted names are defined as names that scrub to themselves.
46

    
47
Accepted names must be processed before any names that resolve to them, because the entry for the accepted name contains all the ranks parsed out but the resolved name of another entry contains just some ranks and the taxonomic name. Column-based import will do this automatically when the total # of rows is <= the partition_size (because _taxonconcept_set_matched_concept_id()''s accepted taxonconcept is created after the main taxonconcept), but TNRS has more rows than this so sorting is needed to ensure that all the accepted names are processed in the first partitions.';
48

    
49
CREATE INDEX tnrs_accepted_names
50
  ON tnrs
51
  USING btree
52
  ((NOT "Name_submitted" = ("Accepted_name" || COALESCE(' '::text || "Accepted_name_author", ''::text))) , "Name_submitted" );
53
ALTER TABLE tnrs CLUSTER ON tnrs_accepted_names;
(2-2/2)