Project

General

Profile

« Previous | Next » 

Revision 9981

bugfix: inputs/.TNRS/schema.sql: tnrs_populate_fields(): *_is_homonym: also need to check that there was no Author_matched (i.e. that it could be a homonym). Is_homonym: use new never_homonym var.

View differences:

inputs/.TNRS/schema.sql
81 81
            THEN true
82 82
        ELSE NULL -- ambiguous
83 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");
84
    never_homonym boolean = new."Author_matched" IS NOT NULL; -- author disambiguates
85
    family_is_homonym boolean = NOT never_homonym AND EXISTS(SELECT * FROM "IRMNG".family_homonym_epithet WHERE "taxonNameOrEpithet" = new."Family_matched");
86
    genus_is_homonym  boolean = NOT never_homonym AND EXISTS(SELECT * FROM "IRMNG".genus_homonym_epithet  WHERE "taxonNameOrEpithet" = new."Genus_matched");
86 87
BEGIN
87 88
    new."Accepted_scientific_name" = NULLIF(concat_ws(' '
88 89
        , NULLIF(NULLIF(new."Accepted_name_family", 'Unknown'), new."Accepted_name")
......
95 96
        , new."Genus_score"
96 97
        , new."Specific_epithet_score"
97 98
    );
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);
99
    new."Is_homonym" = family_is_homonym OR genus_is_homonym;
102 100
    new."Is_plant" = (CASE
103 101
        WHEN new."Family_score" = 1 AND NOT family_is_homonym -- exact match
104 102
            THEN true

Also available in: Unified diff