Project

General

Profile

« Previous | Next » 

Revision 5412

schemas/vegbien.sql: taxonconcept: Added taxonconcept_canon_concept_min_fit() trigger to remove the canon_concept_id link from insufficient matches. These occur when e.g. a name in another language is approximated to a latin name or when the input name is not a proper taxon but TNRS provides a best-guess match anyway.

View differences:

schemas/vegbien.my.sql
152 152

  
153 153

  
154 154
--
155
-- Name: taxonconcept_canon_concept_min_fit(); Type: FUNCTION; Schema: public; Owner: -
156
--
157

  
158

  
159

  
160

  
161
--
155 162
-- Name: taxonconcept_update_ancestors(); Type: FUNCTION; Schema: public; Owner: -
156 163
--
157 164

  
......
4018 4025

  
4019 4026

  
4020 4027
--
4028
-- Name: taxonconcept_canon_concept_min_fit; Type: TRIGGER; Schema: public; Owner: -
4029
--
4030

  
4031

  
4032

  
4033

  
4034
--
4021 4035
-- Name: taxonconcept_update_ancestors; Type: TRIGGER; Schema: public; Owner: -
4022 4036
--
4023 4037

  
schemas/vegbien.sql
399 399

  
400 400

  
401 401
--
402
-- Name: taxonconcept_canon_concept_min_fit(); Type: FUNCTION; Schema: public; Owner: -
403
--
404

  
405
CREATE FUNCTION taxonconcept_canon_concept_min_fit() RETURNS trigger
406
    LANGUAGE plpgsql
407
    AS $$
408
BEGIN
409
    IF new.canon_concept_id IS NOT NULL
410
        AND new.canon_concept_fit_fraction < 0.8 THEN -- insufficient match
411
        new.canon_concept_id = NULL;
412
        new.canon_concept_fit_fraction = NULL;
413
    END IF;
414
    RETURN new;
415
END;
416
$$;
417

  
418

  
419
--
402 420
-- Name: taxonconcept_update_ancestors(); Type: FUNCTION; Schema: public; Owner: -
403 421
--
404 422

  
......
4672 4690

  
4673 4691

  
4674 4692
--
4693
-- Name: taxonconcept_canon_concept_min_fit; Type: TRIGGER; Schema: public; Owner: -
4694
--
4695

  
4696
CREATE TRIGGER taxonconcept_canon_concept_min_fit BEFORE INSERT OR UPDATE ON taxonconcept FOR EACH ROW EXECUTE PROCEDURE taxonconcept_canon_concept_min_fit();
4697

  
4698

  
4699
--
4675 4700
-- Name: taxonconcept_update_ancestors; Type: TRIGGER; Schema: public; Owner: -
4676 4701
--
4677 4702

  

Also available in: Unified diff