Revision 9972
Added by Aaron Marcuse-Kubitza over 11 years ago
schema.sql | ||
---|---|---|
50 | 50 |
"Accepted_name_lsid" text, |
51 | 51 |
"Accepted_scientific_name" text, |
52 | 52 |
"Max_score" double precision, |
53 |
"Is_homonym" boolean, |
|
53 | 54 |
"Is_plant" boolean, |
54 | 55 |
CONSTRAINT tnrs_pkey PRIMARY KEY ("Time_submitted" , "Name_number" ), |
55 | 56 |
CONSTRAINT "tnrs_Name_submitted_key" UNIQUE ("Name_submitted" ) |
... | ... | |
80 | 81 |
THEN true |
81 | 82 |
ELSE NULL -- ambiguous |
82 | 83 |
END); |
84 |
family_is_homonym boolean = EXISTS(SELECT * FROM "IRMNG".family_homonym_epithet WHERE "taxonNameOrEpithet" = new."Family_matched"); |
|
85 |
genus_is_homonym boolean = EXISTS(SELECT * FROM "IRMNG".genus_homonym_epithet WHERE "taxonNameOrEpithet" = new."Genus_matched"); |
|
83 | 86 |
BEGIN |
84 | 87 |
new."Accepted_scientific_name" = NULLIF(concat_ws(' ' |
85 | 88 |
, NULLIF(NULLIF(new."Accepted_name_family", 'Unknown'), new."Accepted_name") |
... | ... | |
92 | 95 |
, new."Genus_score" |
93 | 96 |
, new."Specific_epithet_score" |
94 | 97 |
); |
98 |
new."Is_homonym" = (CASE |
|
99 |
WHEN new."Author_matched" IS NOT NULL THEN false -- author disambiguates |
|
100 |
ELSE family_is_homonym OR genus_is_homonym |
|
101 |
END); |
|
95 | 102 |
new."Is_plant" = (CASE |
96 | 103 |
WHEN new."Family_score" = 1 THEN true -- exact match |
97 | 104 |
ELSE -- Family_matched IS NULL |
Also available in: Unified diff
inputs/.TNRS/schema.sql: tnrs: added Is_homonym derived col (uses IRMNG.family_homonym_epithet, genus_homonym_epithet)