Revision 5608
Added by Aaron Marcuse-Kubitza almost 12 years ago
vegbien.sql | ||
---|---|---|
261 | 261 |
|
262 | 262 |
|
263 | 263 |
-- |
264 |
-- Name: _taxonconcept_set_matched_concept_id(integer, integer, double precision); Type: FUNCTION; Schema: public; Owner: -
|
|
264 |
-- Name: _taxonlabel_set_matched_label_id(integer, integer, double precision); Type: FUNCTION; Schema: public; Owner: -
|
|
265 | 265 |
-- |
266 | 266 |
|
267 |
CREATE FUNCTION _taxonconcept_set_matched_concept_id(taxonconcept_id integer, matched_concept_id integer, matched_concept_fit_fraction double precision DEFAULT NULL::double precision) RETURNS integer
|
|
267 |
CREATE FUNCTION _taxonlabel_set_matched_label_id(taxonlabel_id integer, matched_label_id integer, matched_label_fit_fraction double precision DEFAULT NULL::double precision) RETURNS integer
|
|
268 | 268 |
LANGUAGE sql |
269 | 269 |
AS $_$ |
270 |
UPDATE taxonconcept SET
|
|
271 |
matched_concept_id = $2
|
|
272 |
, matched_concept_fit_fraction = $3
|
|
273 |
WHERE taxonconcept_id = $1
|
|
274 |
RETURNING taxonconcept_id
|
|
270 |
UPDATE taxonlabel SET
|
|
271 |
matched_label_id = $2
|
|
272 |
, matched_label_fit_fraction = $3
|
|
273 |
WHERE taxonlabel_id = $1
|
|
274 |
RETURNING taxonlabel_id
|
|
275 | 275 |
$_$; |
276 | 276 |
|
277 | 277 |
|
278 | 278 |
-- |
279 |
-- Name: _taxonconcept_set_parent_id(integer, integer); Type: FUNCTION; Schema: public; Owner: -
|
|
279 |
-- Name: _taxonlabel_set_parent_id(integer, integer); Type: FUNCTION; Schema: public; Owner: -
|
|
280 | 280 |
-- |
281 | 281 |
|
282 |
CREATE FUNCTION _taxonconcept_set_parent_id(taxonconcept_id integer, parent_id integer) RETURNS integer
|
|
282 |
CREATE FUNCTION _taxonlabel_set_parent_id(taxonlabel_id integer, parent_id integer) RETURNS integer
|
|
283 | 283 |
LANGUAGE sql |
284 | 284 |
AS $_$ |
285 |
UPDATE taxonconcept SET parent_id = $2 WHERE taxonconcept_id = $1
|
|
286 |
RETURNING taxonconcept_id
|
|
285 |
UPDATE taxonlabel SET parent_id = $2 WHERE taxonlabel_id = $1
|
|
286 |
RETURNING taxonlabel_id
|
|
287 | 287 |
$_$; |
288 | 288 |
|
289 | 289 |
|
... | ... | |
404 | 404 |
|
405 | 405 |
|
406 | 406 |
-- |
407 |
-- Name: taxonconcept_0_matched_concept_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
|
|
407 |
-- Name: taxonlabel_0_matched_label_id_self_ref(); Type: FUNCTION; Schema: public; Owner: -
|
|
408 | 408 |
-- |
409 | 409 |
|
410 |
CREATE FUNCTION taxonconcept_0_matched_concept_id_self_ref() RETURNS trigger
|
|
410 |
CREATE FUNCTION taxonlabel_0_matched_label_id_self_ref() RETURNS trigger
|
|
411 | 411 |
LANGUAGE plpgsql |
412 | 412 |
AS $$ |
413 | 413 |
BEGIN |
414 |
IF new.taxonconcept_id IS NULL THEN -- prepopulate taxonconcept_id
|
|
415 |
new.taxonconcept_id = nextval('taxonconcept_taxonconcept_id_seq'::regclass);
|
|
414 |
IF new.taxonlabel_id IS NULL THEN -- prepopulate taxonlabel_id
|
|
415 |
new.taxonlabel_id = nextval('taxonlabel_taxonlabel_id_seq'::regclass);
|
|
416 | 416 |
END IF; |
417 |
IF new.matched_concept_id = 0 THEN -- make self-reference
|
|
418 |
new.matched_concept_id = new.taxonconcept_id;
|
|
417 |
IF new.matched_label_id = 0 THEN -- make self-reference
|
|
418 |
new.matched_label_id = new.taxonlabel_id;
|
|
419 | 419 |
END IF; |
420 | 420 |
RETURN new; |
421 | 421 |
END; |
... | ... | |
423 | 423 |
|
424 | 424 |
|
425 | 425 |
-- |
426 |
-- Name: taxonconcept_1_matched_concept_min_fit(); Type: FUNCTION; Schema: public; Owner: -
|
|
426 |
-- Name: taxonlabel_1_matched_label_min_fit(); Type: FUNCTION; Schema: public; Owner: -
|
|
427 | 427 |
-- |
428 | 428 |
|
429 |
CREATE FUNCTION taxonconcept_1_matched_concept_min_fit() RETURNS trigger
|
|
429 |
CREATE FUNCTION taxonlabel_1_matched_label_min_fit() RETURNS trigger
|
|
430 | 430 |
LANGUAGE plpgsql |
431 | 431 |
AS $$ |
432 | 432 |
BEGIN |
433 |
IF new.matched_concept_id IS NOT NULL
|
|
434 |
AND new.matched_concept_fit_fraction < 0.8 THEN -- insufficient match
|
|
435 |
new.matched_concept_id = NULL;
|
|
436 |
new.matched_concept_fit_fraction = NULL;
|
|
433 |
IF new.matched_label_id IS NOT NULL
|
|
434 |
AND new.matched_label_fit_fraction < 0.8 THEN -- insufficient match
|
|
435 |
new.matched_label_id = NULL;
|
|
436 |
new.matched_label_fit_fraction = NULL;
|
|
437 | 437 |
END IF; |
438 | 438 |
RETURN new; |
439 | 439 |
END; |
... | ... | |
441 | 441 |
|
442 | 442 |
|
443 | 443 |
-- |
444 |
-- Name: taxonconcept_2_propagate_accepted_concept_id(); Type: FUNCTION; Schema: public; Owner: -
|
|
444 |
-- Name: taxonlabel_2_propagate_accepted_label_id(); Type: FUNCTION; Schema: public; Owner: -
|
|
445 | 445 |
-- |
446 | 446 |
|
447 |
CREATE FUNCTION taxonconcept_2_propagate_accepted_concept_id() RETURNS trigger
|
|
447 |
CREATE FUNCTION taxonlabel_2_propagate_accepted_label_id() RETURNS trigger
|
|
448 | 448 |
LANGUAGE plpgsql |
449 | 449 |
AS $$ |
450 | 450 |
BEGIN |
451 |
IF new.matched_concept_id IS NOT NULL THEN
|
|
452 |
IF new.matched_concept_id = new.taxonconcept_id THEN -- self-reference
|
|
453 |
new.accepted_concept_id = new.taxonconcept_id;-- make self-reference
|
|
454 |
ELSE -- propagate from matched concept
|
|
455 |
new.accepted_concept_id = (
|
|
456 |
SELECT accepted_concept_id
|
|
457 |
FROM taxonconcept
|
|
458 |
WHERE taxonconcept_id = new.matched_concept_id
|
|
451 |
IF new.matched_label_id IS NOT NULL THEN
|
|
452 |
IF new.matched_label_id = new.taxonlabel_id THEN -- self-reference
|
|
453 |
new.accepted_label_id = new.taxonlabel_id;-- make self-reference
|
|
454 |
ELSE -- propagate from matched label
|
|
455 |
new.accepted_label_id = (
|
|
456 |
SELECT accepted_label_id
|
|
457 |
FROM taxonlabel
|
|
458 |
WHERE taxonlabel_id = new.matched_label_id
|
|
459 | 459 |
); |
460 | 460 |
END IF; |
461 | 461 |
|
462 |
-- Update accepted_concept_id on concepts that resolve to this concept
|
|
463 |
UPDATE taxonconcept
|
|
464 |
SET accepted_concept_id = new.accepted_concept_id
|
|
465 |
WHERE matched_concept_id = new.taxonconcept_id
|
|
466 |
AND taxonconcept_id != new.taxonconcept_id -- avoid infinite recursion
|
|
462 |
-- Update accepted_label_id on labels that resolve to this label
|
|
463 |
UPDATE taxonlabel
|
|
464 |
SET accepted_label_id = new.accepted_label_id
|
|
465 |
WHERE matched_label_id = new.taxonlabel_id
|
|
466 |
AND taxonlabel_id != new.taxonlabel_id -- avoid infinite recursion
|
|
467 | 467 |
; |
468 | 468 |
END IF; |
469 | 469 |
RETURN new; |
... | ... | |
472 | 472 |
|
473 | 473 |
|
474 | 474 |
-- |
475 |
-- Name: taxonconcept_3_parent_id_avoid_self_ref(); Type: FUNCTION; Schema: public; Owner: -
|
|
475 |
-- Name: taxonlabel_3_parent_id_avoid_self_ref(); Type: FUNCTION; Schema: public; Owner: -
|
|
476 | 476 |
-- |
477 | 477 |
|
478 |
CREATE FUNCTION taxonconcept_3_parent_id_avoid_self_ref() RETURNS trigger
|
|
478 |
CREATE FUNCTION taxonlabel_3_parent_id_avoid_self_ref() RETURNS trigger
|
|
479 | 479 |
LANGUAGE plpgsql |
480 | 480 |
AS $$ |
481 | 481 |
BEGIN |
482 |
new.parent_id = nullif(new.parent_id, new.taxonconcept_id);
|
|
482 |
new.parent_id = nullif(new.parent_id, new.taxonlabel_id);
|
|
483 | 483 |
RETURN new; |
484 | 484 |
END; |
485 | 485 |
$$; |
... | ... | |
490 | 490 |
SET default_with_oids = false; |
491 | 491 |
|
492 | 492 |
-- |
493 |
-- Name: taxonconcept; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
493 |
-- Name: taxonlabel; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
494 | 494 |
-- |
495 | 495 |
|
496 |
CREATE TABLE taxonconcept (
|
|
497 |
taxonconcept_id integer NOT NULL,
|
|
496 |
CREATE TABLE taxonlabel (
|
|
497 |
taxonlabel_id integer NOT NULL,
|
|
498 | 498 |
creator_id integer NOT NULL, |
499 | 499 |
sourceaccessioncode text, |
500 | 500 |
creationdate date, |
501 |
accepted_concept_id integer,
|
|
502 |
matched_concept_id integer,
|
|
503 |
matched_concept_fit_fraction double precision,
|
|
501 |
accepted_label_id integer,
|
|
502 |
matched_label_id integer,
|
|
503 |
matched_label_fit_fraction double precision,
|
|
504 | 504 |
parent_id integer, |
505 | 505 |
taxonepithet text, |
506 | 506 |
rank taxonrank, |
... | ... | |
514 | 514 |
species text, |
515 | 515 |
description text, |
516 | 516 |
accessioncode text, |
517 |
CONSTRAINT taxonconcept_matched_concept_fit_fraction_range CHECK (((matched_concept_fit_fraction >= (0)::double precision) AND (matched_concept_fit_fraction <= (1)::double precision))),
|
|
518 |
CONSTRAINT taxonconcept_required_key CHECK (((((((sourceaccessioncode IS NOT NULL) OR (taxonepithet IS NOT NULL)) OR (identifyingtaxonomicname IS NOT NULL)) OR (taxonomicname IS NOT NULL)) OR (taxonomicnamewithauthor IS NOT NULL)) OR ((parent_id IS NOT NULL) AND ((creationdate IS NOT NULL) OR (author IS NOT NULL)))))
|
|
517 |
CONSTRAINT taxonlabel_matched_label_fit_fraction_range CHECK (((matched_label_fit_fraction >= (0)::double precision) AND (matched_label_fit_fraction <= (1)::double precision))),
|
|
518 |
CONSTRAINT taxonlabel_required_key CHECK (((((((sourceaccessioncode IS NOT NULL) OR (taxonepithet IS NOT NULL)) OR (identifyingtaxonomicname IS NOT NULL)) OR (taxonomicname IS NOT NULL)) OR (taxonomicnamewithauthor IS NOT NULL)) OR ((parent_id IS NOT NULL) AND ((creationdate IS NOT NULL) OR (author IS NOT NULL)))))
|
|
519 | 519 |
); |
520 | 520 |
|
521 | 521 |
|
522 | 522 |
-- |
523 |
-- Name: TABLE taxonconcept; Type: COMMENT; Schema: public; Owner: -
|
|
523 |
-- Name: TABLE taxonlabel; Type: COMMENT; Schema: public; Owner: -
|
|
524 | 524 |
-- |
525 | 525 |
|
526 |
COMMENT ON TABLE taxonconcept IS 'A taxon concept defined by an entity. Can be at any level in the taxonomic hierarchy. Can be either verbatim or accepted.
|
|
526 |
COMMENT ON TABLE taxonlabel IS 'A taxon label defined by an entity. Can be at any level in the taxonomic hierarchy. Can be either verbatim or accepted.
|
|
527 | 527 |
|
528 | 528 |
"A taxon (plural: taxa) is a group of one (or more) populations of organism(s), which a taxonomist adjudges to be a unit" (http://en.wikipedia.org/wiki/Taxon) |
529 | 529 |
|
530 |
Note that taxonepithet stores only one rank (e.g. family) of the full taxonomic name. The higher-level ranks are stored in the taxon concept''s chain of parent_id ancestors.
|
|
530 |
Note that taxonepithet stores only one rank (e.g. family) of the full taxonomic name. The higher-level ranks are stored in the taxon label''s chain of parent_id ancestors.
|
|
531 | 531 |
|
532 |
To include a taxon name at a rank with no explicit column, create a parent taxonconcept for it and point to it using parent_id. To include multiple such names, chain the taxonconcepts together using parent_id. Note that lower-level taxa should point to higher-level taxa.
|
|
532 |
To include a taxon name at a rank with no explicit column, create a parent taxonlabel for it and point to it using parent_id. To include multiple such names, chain the taxonlabels together using parent_id. Note that lower-level taxa should point to higher-level taxa.
|
|
533 | 533 |
|
534 | 534 |
Equivalent to VegBank''s plantConcept and plantName tables, plus plantParent_ID and plantLevel from plantStatus.'; |
535 | 535 |
|
536 | 536 |
|
537 | 537 |
-- |
538 |
-- Name: COLUMN taxonconcept.creator_id; Type: COMMENT; Schema: public; Owner: -
|
|
538 |
-- Name: COLUMN taxonlabel.creator_id; Type: COMMENT; Schema: public; Owner: -
|
|
539 | 539 |
-- |
540 | 540 |
|
541 |
COMMENT ON COLUMN taxonconcept.creator_id IS 'The entity that created the taxon concept. This is the concept reference for a taxon concept with an "according to", or the identifier''s name for a nominal concept.
|
|
541 |
COMMENT ON COLUMN taxonlabel.creator_id IS 'The entity that created the taxon label. This is the label reference for a taxon label with an "according to", or the identifier''s name for a nominal label.
|
|
542 | 542 |
|
543 | 543 |
Equivalent to "Name sec. x".'; |
544 | 544 |
|
545 | 545 |
|
546 | 546 |
-- |
547 |
-- Name: COLUMN taxonconcept.sourceaccessioncode; Type: COMMENT; Schema: public; Owner: -
|
|
547 |
-- Name: COLUMN taxonlabel.sourceaccessioncode; Type: COMMENT; Schema: public; Owner: -
|
|
548 | 548 |
-- |
549 | 549 |
|
550 |
COMMENT ON COLUMN taxonconcept.sourceaccessioncode IS 'The datasource''s identifier for the taxonconcept.';
|
|
550 |
COMMENT ON COLUMN taxonlabel.sourceaccessioncode IS 'The datasource''s identifier for the taxonlabel.';
|
|
551 | 551 |
|
552 | 552 |
|
553 | 553 |
-- |
554 |
-- Name: COLUMN taxonconcept.creationdate; Type: COMMENT; Schema: public; Owner: -
|
|
554 |
-- Name: COLUMN taxonlabel.creationdate; Type: COMMENT; Schema: public; Owner: -
|
|
555 | 555 |
-- |
556 | 556 |
|
557 |
COMMENT ON COLUMN taxonconcept.creationdate IS 'The date the taxonconcept was created or defined. For a taxonconcept applied in a taxondetermination, this is the date the determination was made.';
|
|
557 |
COMMENT ON COLUMN taxonlabel.creationdate IS 'The date the taxonlabel was created or defined. For a taxonlabel applied in a taxondetermination, this is the date the determination was made.';
|
|
558 | 558 |
|
559 | 559 |
|
560 | 560 |
-- |
561 |
-- Name: COLUMN taxonconcept.accepted_concept_id; Type: COMMENT; Schema: public; Owner: -
|
|
561 |
-- Name: COLUMN taxonlabel.accepted_label_id; Type: COMMENT; Schema: public; Owner: -
|
|
562 | 562 |
-- |
563 | 563 |
|
564 |
COMMENT ON COLUMN taxonconcept.accepted_concept_id IS 'The accepted synonym of the taxonconcept.';
|
|
564 |
COMMENT ON COLUMN taxonlabel.accepted_label_id IS 'The accepted synonym of the taxonlabel.';
|
|
565 | 565 |
|
566 | 566 |
|
567 | 567 |
-- |
568 |
-- Name: COLUMN taxonconcept.matched_concept_id; Type: COMMENT; Schema: public; Owner: -
|
|
568 |
-- Name: COLUMN taxonlabel.matched_label_id; Type: COMMENT; Schema: public; Owner: -
|
|
569 | 569 |
-- |
570 | 570 |
|
571 |
COMMENT ON COLUMN taxonconcept.matched_concept_id IS 'The taxonconcept containing the closest match to this taxonconcept. taxonconcepts should be linked in a four-level hierarchy of datasource concept -> parsed concept -> matched concept -> accepted concept. A previously-accepted name''s concept should be further linked to the synonym that has replaced it.
|
|
571 |
COMMENT ON COLUMN taxonlabel.matched_label_id IS 'The taxonlabel containing the closest match to this taxonlabel. taxonlabels should be linked in a four-level hierarchy of datasource label -> parsed label -> matched label -> accepted label. A previously-accepted name''s label should be further linked to the synonym that has replaced it.
|
|
572 | 572 |
|
573 |
To indicate a synonym between taxonconcepts of different sources, choose one taxonconcept to be authoritative and point the other taxonconcept to it using this field.
|
|
573 |
To indicate a synonym between taxonlabels of different sources, choose one taxonlabel to be authoritative and point the other taxonlabel to it using this field.
|
|
574 | 574 |
|
575 | 575 |
An accepted name should point to itself in this field. This will happen automatically by setting it to the special value 0.'; |
576 | 576 |
|
577 | 577 |
|
578 | 578 |
-- |
579 |
-- Name: COLUMN taxonconcept.matched_concept_fit_fraction; Type: COMMENT; Schema: public; Owner: -
|
|
579 |
-- Name: COLUMN taxonlabel.matched_label_fit_fraction; Type: COMMENT; Schema: public; Owner: -
|
|
580 | 580 |
-- |
581 | 581 |
|
582 |
COMMENT ON COLUMN taxonconcept.matched_concept_fit_fraction IS 'The closeness of fit of the matched_concept.';
|
|
582 |
COMMENT ON COLUMN taxonlabel.matched_label_fit_fraction IS 'The closeness of fit of the matched label.';
|
|
583 | 583 |
|
584 | 584 |
|
585 | 585 |
-- |
586 |
-- Name: COLUMN taxonconcept.parent_id; Type: COMMENT; Schema: public; Owner: -
|
|
586 |
-- Name: COLUMN taxonlabel.parent_id; Type: COMMENT; Schema: public; Owner: -
|
|
587 | 587 |
-- |
588 | 588 |
|
589 |
COMMENT ON COLUMN taxonconcept.parent_id IS 'The parent taxonconcept. Note that while a taxon *name* may have multiple parents, a taxon *concept* has only one, based on the creator''s opinion of where that taxonconcept goes in the taxonomic hierarchy.';
|
|
589 |
COMMENT ON COLUMN taxonlabel.parent_id IS 'The parent taxonlabel. Note that while a taxon *name* may have multiple parents, a taxon *label* has only one, based on the creator''s opinion of where that taxonlabel goes in the taxonomic hierarchy.';
|
|
590 | 590 |
|
591 | 591 |
|
592 | 592 |
-- |
593 |
-- Name: COLUMN taxonconcept.taxonepithet; Type: COMMENT; Schema: public; Owner: -
|
|
593 |
-- Name: COLUMN taxonlabel.taxonepithet; Type: COMMENT; Schema: public; Owner: -
|
|
594 | 594 |
-- |
595 | 595 |
|
596 |
COMMENT ON COLUMN taxonconcept.taxonepithet IS 'The epithet of the taxon within its parent taxon. This is the lowest-rank portion of this taxonconcept''s full taxonomic name, if it has one.
|
|
596 |
COMMENT ON COLUMN taxonlabel.taxonepithet IS 'The epithet of the taxon within its parent taxon. This is the lowest-rank portion of this taxonlabel''s full taxonomic name, if it has one.
|
|
597 | 597 |
|
598 | 598 |
The morphospecies suffix goes in this field.'; |
599 | 599 |
|
600 | 600 |
|
601 | 601 |
-- |
602 |
-- Name: COLUMN taxonconcept.rank; Type: COMMENT; Schema: public; Owner: -
|
|
602 |
-- Name: COLUMN taxonlabel.rank; Type: COMMENT; Schema: public; Owner: -
|
|
603 | 603 |
-- |
604 | 604 |
|
605 |
COMMENT ON COLUMN taxonconcept.rank IS 'The taxonconcept''s level in the taxonomic hierarchy, standardized to a closed list. Even if you specify a custom verbatimrank, you should also specify a closest-match rank from the taxonrank closed list.';
|
|
605 |
COMMENT ON COLUMN taxonlabel.rank IS 'The taxonlabel''s level in the taxonomic hierarchy, standardized to a closed list. Even if you specify a custom verbatimrank, you should also specify a closest-match rank from the taxonrank closed list.';
|
|
606 | 606 |
|
607 | 607 |
|
608 | 608 |
-- |
609 |
-- Name: COLUMN taxonconcept.verbatimrank; Type: COMMENT; Schema: public; Owner: -
|
|
609 |
-- Name: COLUMN taxonlabel.verbatimrank; Type: COMMENT; Schema: public; Owner: -
|
|
610 | 610 |
-- |
611 | 611 |
|
612 |
COMMENT ON COLUMN taxonconcept.verbatimrank IS 'The taxonconcept''s verbatim level in the taxonomic hierarchy. Does not need to be in the taxonrank closed list.';
|
|
612 |
COMMENT ON COLUMN taxonlabel.verbatimrank IS 'The taxonlabel''s verbatim level in the taxonomic hierarchy. Does not need to be in the taxonrank closed list.';
|
|
613 | 613 |
|
614 | 614 |
|
615 | 615 |
-- |
616 |
-- Name: COLUMN taxonconcept.identifyingtaxonomicname; Type: COMMENT; Schema: public; Owner: -
|
|
616 |
-- Name: COLUMN taxonlabel.identifyingtaxonomicname; Type: COMMENT; Schema: public; Owner: -
|
|
617 | 617 |
-- |
618 | 618 |
|
619 |
COMMENT ON COLUMN taxonconcept.identifyingtaxonomicname IS 'The taxonomic name that uniquely identifies this taxonconcept. If set, the other fields will not be used in duplicate elimination.';
|
|
619 |
COMMENT ON COLUMN taxonlabel.identifyingtaxonomicname IS 'The taxonomic name that uniquely identifies this taxonlabel. If set, the other fields will not be used in duplicate elimination.';
|
|
620 | 620 |
|
621 | 621 |
|
622 | 622 |
-- |
623 |
-- Name: COLUMN taxonconcept.taxonomicname; Type: COMMENT; Schema: public; Owner: -
|
|
623 |
-- Name: COLUMN taxonlabel.taxonomicname; Type: COMMENT; Schema: public; Owner: -
|
|
624 | 624 |
-- |
625 | 625 |
|
626 |
COMMENT ON COLUMN taxonconcept.taxonomicname IS 'The concatenated taxonomic name which uniquely identifies this taxon. Does not include the author of the name.
|
|
626 |
COMMENT ON COLUMN taxonlabel.taxonomicname IS 'The concatenated taxonomic name which uniquely identifies this taxon. Does not include the author of the name.
|
|
627 | 627 |
|
628 | 628 |
Equivalent to Darwin Core''s scientificName.'; |
629 | 629 |
|
630 | 630 |
|
631 | 631 |
-- |
632 |
-- Name: COLUMN taxonconcept.author; Type: COMMENT; Schema: public; Owner: -
|
|
632 |
-- Name: COLUMN taxonlabel.author; Type: COMMENT; Schema: public; Owner: -
|
|
633 | 633 |
-- |
634 | 634 |
|
635 |
COMMENT ON COLUMN taxonconcept.author IS 'The author of the taxonomic name.
|
|
635 |
COMMENT ON COLUMN taxonlabel.author IS 'The author of the taxonomic name.
|
|
636 | 636 |
|
637 | 637 |
Equivalent to Darwin Core''s scientificNameAuthorship.'; |
638 | 638 |
|
639 | 639 |
|
640 | 640 |
-- |
641 |
-- Name: COLUMN taxonconcept.taxonomicnamewithauthor; Type: COMMENT; Schema: public; Owner: -
|
|
641 |
-- Name: COLUMN taxonlabel.taxonomicnamewithauthor; Type: COMMENT; Schema: public; Owner: -
|
|
642 | 642 |
-- |
643 | 643 |
|
644 |
COMMENT ON COLUMN taxonconcept.taxonomicnamewithauthor IS 'The concatenated taxonomic name which uniquely identifies this taxon, plus the author of that name.
|
|
644 |
COMMENT ON COLUMN taxonlabel.taxonomicnamewithauthor IS 'The concatenated taxonomic name which uniquely identifies this taxon, plus the author of that name.
|
|
645 | 645 |
|
646 | 646 |
Equivalent to Darwin Core''s scientificName + scientificNameAuthorship. |
647 | 647 |
Equivalent to "Name sec. x".'; |
648 | 648 |
|
649 | 649 |
|
650 | 650 |
-- |
651 |
-- Name: COLUMN taxonconcept.family; Type: COMMENT; Schema: public; Owner: -
|
|
651 |
-- Name: COLUMN taxonlabel.family; Type: COMMENT; Schema: public; Owner: -
|
|
652 | 652 |
-- |
653 | 653 |
|
654 |
COMMENT ON COLUMN taxonconcept.family IS 'The family of the taxonomic name. This is a cached field for easy querying; the identifying version of this field is stored in the chain of parent_id ancestors.';
|
|
654 |
COMMENT ON COLUMN taxonlabel.family IS 'The family of the taxonomic name. This is a cached field for easy querying; the identifying version of this field is stored in the chain of parent_id ancestors.';
|
|
655 | 655 |
|
656 | 656 |
|
657 | 657 |
-- |
658 |
-- Name: COLUMN taxonconcept.genus; Type: COMMENT; Schema: public; Owner: -
|
|
658 |
-- Name: COLUMN taxonlabel.genus; Type: COMMENT; Schema: public; Owner: -
|
|
659 | 659 |
-- |
660 | 660 |
|
661 |
COMMENT ON COLUMN taxonconcept.genus IS 'The genus portion of the taxonomic name. This is a cached field for easy querying; the identifying version of this field is stored in the chain of parent_id ancestors.';
|
|
661 |
COMMENT ON COLUMN taxonlabel.genus IS 'The genus portion of the taxonomic name. This is a cached field for easy querying; the identifying version of this field is stored in the chain of parent_id ancestors.';
|
|
662 | 662 |
|
663 | 663 |
|
664 | 664 |
-- |
665 |
-- Name: COLUMN taxonconcept.species; Type: COMMENT; Schema: public; Owner: -
|
|
665 |
-- Name: COLUMN taxonlabel.species; Type: COMMENT; Schema: public; Owner: -
|
|
666 | 666 |
-- |
667 | 667 |
|
668 |
COMMENT ON COLUMN taxonconcept.species IS 'The species portion of the taxonomic name. This is a cached field for easy querying; the identifying version of this field is stored in the chain of parent_id ancestors.';
|
|
668 |
COMMENT ON COLUMN taxonlabel.species IS 'The species portion of the taxonomic name. This is a cached field for easy querying; the identifying version of this field is stored in the chain of parent_id ancestors.';
|
|
669 | 669 |
|
670 | 670 |
|
671 | 671 |
-- |
672 |
-- Name: taxonconcept_update_ancestors(taxonconcept, integer); Type: FUNCTION; Schema: public; Owner: -
|
|
672 |
-- Name: taxonlabel_update_ancestors(taxonlabel, integer); Type: FUNCTION; Schema: public; Owner: -
|
|
673 | 673 |
-- |
674 | 674 |
|
675 |
CREATE FUNCTION taxonconcept_update_ancestors(new taxonconcept, old_parent_id integer DEFAULT NULL::integer) RETURNS void
|
|
675 |
CREATE FUNCTION taxonlabel_update_ancestors(new taxonlabel, old_parent_id integer DEFAULT NULL::integer) RETURNS void
|
|
676 | 676 |
LANGUAGE plpgsql |
677 | 677 |
AS $$ |
678 | 678 |
DECLARE |
679 |
-- Use matched_concept_id's ancestors instead if available
|
|
680 |
parent_id_ taxonconcept.taxonconcept_id%TYPE := COALESCE(
|
|
681 |
NULLIF(new.matched_concept_id, new.taxonconcept_id), new.parent_id);
|
|
679 |
-- Use matched_label_id's ancestors instead if available
|
|
680 |
parent_id_ taxonlabel.taxonlabel_id%TYPE := COALESCE(
|
|
681 |
NULLIF(new.matched_label_id, new.taxonlabel_id), new.parent_id);
|
|
682 | 682 |
BEGIN |
683 | 683 |
IF parent_id_ IS DISTINCT FROM old_parent_id THEN |
684 | 684 |
DECLARE |
685 | 685 |
-- These include the parent itself |
686 | 686 |
old_ancestors integer[] := ( |
687 |
SELECT array_agg(ancestor_id) FROM taxonconcept_ancestor
|
|
687 |
SELECT array_agg(ancestor_id) FROM taxonlabel_ancestor
|
|
688 | 688 |
WHERE descendant_id = old_parent_id |
689 | 689 |
); |
690 | 690 |
new_ancestors integer[] := ( |
691 |
SELECT array_agg(ancestor_id) FROM taxonconcept_ancestor
|
|
691 |
SELECT array_agg(ancestor_id) FROM taxonlabel_ancestor
|
|
692 | 692 |
WHERE descendant_id = parent_id_ |
693 | 693 |
); |
694 | 694 |
descendant_id_ integer; |
695 | 695 |
BEGIN |
696 | 696 |
FOR descendant_id_ IN -- also includes self |
697 | 697 |
SELECT descendant_id |
698 |
FROM taxonconcept_ancestor
|
|
699 |
WHERE ancestor_id = new.taxonconcept_id
|
|
698 |
FROM taxonlabel_ancestor
|
|
699 |
WHERE ancestor_id = new.taxonlabel_id
|
|
700 | 700 |
LOOP |
701 | 701 |
-- Delete old parent's ancestors |
702 |
DELETE FROM taxonconcept_ancestor
|
|
702 |
DELETE FROM taxonlabel_ancestor
|
|
703 | 703 |
WHERE descendant_id = descendant_id_ |
704 | 704 |
AND ancestor_id = ANY (old_ancestors) |
705 | 705 |
; |
706 | 706 |
|
707 | 707 |
-- Add new parent's ancestors |
708 |
INSERT INTO taxonconcept_ancestor
|
|
708 |
INSERT INTO taxonlabel_ancestor
|
|
709 | 709 |
(descendant_id, ancestor_id) |
710 | 710 |
SELECT descendant_id_, unnest(new_ancestors) |
711 | 711 |
; |
... | ... | |
715 | 715 |
|
716 | 716 |
/* Note: We don't need an ON DELETE trigger to update the descendants' |
717 | 717 |
ancestors when a node is deleted, because the |
718 |
taxonconcept_ancestor.ancestor_id foreign key is ON DELETE CASCADE. */
|
|
718 |
taxonlabel_ancestor.ancestor_id foreign key is ON DELETE CASCADE. */
|
|
719 | 719 |
END; |
720 | 720 |
$$; |
721 | 721 |
|
722 | 722 |
|
723 | 723 |
-- |
724 |
-- Name: taxonconcept_update_ancestors_on_insert(); Type: FUNCTION; Schema: public; Owner: -
|
|
724 |
-- Name: taxonlabel_update_ancestors_on_insert(); Type: FUNCTION; Schema: public; Owner: -
|
|
725 | 725 |
-- |
726 | 726 |
|
727 |
CREATE FUNCTION taxonconcept_update_ancestors_on_insert() RETURNS trigger
|
|
727 |
CREATE FUNCTION taxonlabel_update_ancestors_on_insert() RETURNS trigger
|
|
728 | 728 |
LANGUAGE plpgsql |
729 | 729 |
AS $$ |
730 | 730 |
BEGIN |
... | ... | |
732 | 732 |
don't have to separately test if the leaf node is the one you're looking |
733 | 733 |
for, in addition to that leaf node's ancestors. */ |
734 | 734 |
INSERT |
735 |
INTO taxonconcept_ancestor
|
|
735 |
INTO taxonlabel_ancestor
|
|
736 | 736 |
(descendant_id, ancestor_id) |
737 |
VALUES (new.taxonconcept_id, new.taxonconcept_id)
|
|
737 |
VALUES (new.taxonlabel_id, new.taxonlabel_id)
|
|
738 | 738 |
; |
739 | 739 |
|
740 |
PERFORM taxonconcept_update_ancestors(new);
|
|
740 |
PERFORM taxonlabel_update_ancestors(new);
|
|
741 | 741 |
|
742 | 742 |
RETURN new; |
743 | 743 |
END; |
... | ... | |
745 | 745 |
|
746 | 746 |
|
747 | 747 |
-- |
748 |
-- Name: taxonconcept_update_ancestors_on_update(); Type: FUNCTION; Schema: public; Owner: -
|
|
748 |
-- Name: taxonlabel_update_ancestors_on_update(); Type: FUNCTION; Schema: public; Owner: -
|
|
749 | 749 |
-- |
750 | 750 |
|
751 |
CREATE FUNCTION taxonconcept_update_ancestors_on_update() RETURNS trigger
|
|
751 |
CREATE FUNCTION taxonlabel_update_ancestors_on_update() RETURNS trigger
|
|
752 | 752 |
LANGUAGE plpgsql |
753 | 753 |
AS $$ |
754 | 754 |
BEGIN |
755 |
PERFORM taxonconcept_update_ancestors(new, COALESCE(
|
|
756 |
NULLIF(old.matched_concept_id, old.taxonconcept_id), old.parent_id));
|
|
755 |
PERFORM taxonlabel_update_ancestors(new, COALESCE(
|
|
756 |
NULLIF(old.matched_label_id, old.taxonlabel_id), old.parent_id));
|
|
757 | 757 |
|
758 | 758 |
RETURN new; |
759 | 759 |
END; |
... | ... | |
1426 | 1426 |
CREATE TABLE taxondetermination ( |
1427 | 1427 |
taxondetermination_id integer NOT NULL, |
1428 | 1428 |
taxonoccurrence_id integer NOT NULL, |
1429 |
taxonconcept_id integer NOT NULL,
|
|
1429 |
taxonlabel_id integer NOT NULL,
|
|
1430 | 1430 |
party_id integer, |
1431 | 1431 |
role role DEFAULT 'unknown'::role NOT NULL, |
1432 | 1432 |
determinationtype text, |
... | ... | |
1504 | 1504 |
-- |
1505 | 1505 |
|
1506 | 1506 |
CREATE VIEW analytical_db_view AS |
1507 |
SELECT datasource.organizationname AS "dataSourceName", accepted_taxonconcept.family, accepted_taxonconcept.genus, accepted_taxonconcept.species, COALESCE(accepted_taxonconcept.taxonomicnamewithauthor, accepted_taxonconcept.taxonomicname) AS taxon, accepted_taxonconcept.author AS "taxonAuthor", accepted_taxonconcept.taxonepithet AS "taxonMorphospecies", placepath.country, placepath.stateprovince AS "stateProvince", placepath.county AS "countyParish", taxonoccurrence.verbatimcollectorname AS collector, plantobservation.collectionnumber AS "collectionNumber", array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], ' '::text) AS "identifiedBy", aggregateoccurrence.collectiondate AS "observationDate", location.authorlocationcode AS "plotCode", functions._m2_to_ha(location.area_m2) AS "plotAreaHa", method.name AS "plotMethod", locationcoords.latitude_deg AS latitude, locationcoords.longitude_deg AS longitude, location.elevation_m, taxonoccurrence.iscultivated AS "isCultivated", taxonoccurrence.cultivatedbasis AS "isCultivatedReason", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "pctCover" FROM ((((((((((((((location JOIN party datasource ON (((datasource.party_id = location.creator_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonconcept datasource_taxonconcept USING (taxonconcept_id)) JOIN taxonconcept accepted_taxonconcept ON ((accepted_taxonconcept.taxonconcept_id = datasource_taxonconcept.accepted_concept_id))) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
|
|
1507 |
SELECT datasource.organizationname AS "dataSourceName", accepted_taxonlabel.family, accepted_taxonlabel.genus, accepted_taxonlabel.species, COALESCE(accepted_taxonlabel.taxonomicnamewithauthor, accepted_taxonlabel.taxonomicname) AS taxon, accepted_taxonlabel.author AS "taxonAuthor", accepted_taxonlabel.taxonepithet AS "taxonMorphospecies", placepath.country, placepath.stateprovince AS "stateProvince", placepath.county AS "countyParish", taxonoccurrence.verbatimcollectorname AS collector, plantobservation.collectionnumber AS "collectionNumber", array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], ' '::text) AS "identifiedBy", aggregateoccurrence.collectiondate AS "observationDate", location.authorlocationcode AS "plotCode", functions._m2_to_ha(location.area_m2) AS "plotAreaHa", method.name AS "plotMethod", locationcoords.latitude_deg AS latitude, locationcoords.longitude_deg AS longitude, location.elevation_m, taxonoccurrence.iscultivated AS "isCultivated", taxonoccurrence.cultivatedbasis AS "isCultivatedReason", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "pctCover" FROM ((((((((((((((location JOIN party datasource ON (((datasource.party_id = location.creator_id) AND (datasource.organizationname IS NOT NULL)))) LEFT JOIN locationcoords USING (location_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN placepath USING (placepath_id)) JOIN locationevent USING (location_id)) LEFT JOIN method USING (method_id)) JOIN taxonoccurrence USING (locationevent_id)) JOIN taxondetermination USING (taxonoccurrence_id)) LEFT JOIN party identifiedby ON ((identifiedby.party_id = taxondetermination.party_id))) JOIN taxonlabel datasource_taxonlabel USING (taxonlabel_id)) JOIN taxonlabel accepted_taxonlabel ON ((accepted_taxonlabel.taxonlabel_id = datasource_taxonlabel.accepted_label_id))) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
|
|
1508 | 1508 |
|
1509 | 1509 |
|
1510 | 1510 |
-- |
... | ... | |
2171 | 2171 |
CREATE TABLE methodtaxonclass ( |
2172 | 2172 |
methodtaxonclass_id integer NOT NULL, |
2173 | 2173 |
method_id integer NOT NULL, |
2174 |
taxonconcept_id integer,
|
|
2174 |
taxonlabel_id integer,
|
|
2175 | 2175 |
included boolean NOT NULL, |
2176 | 2176 |
submethod_id integer, |
2177 | 2177 |
taxonclass taxonclass, |
2178 |
CONSTRAINT methodtaxonclass_key_required CHECK (((taxonconcept_id IS NOT NULL) OR (taxonclass IS NOT NULL)))
|
|
2178 |
CONSTRAINT methodtaxonclass_key_required CHECK (((taxonlabel_id IS NOT NULL) OR (taxonclass IS NOT NULL)))
|
|
2179 | 2179 |
); |
2180 | 2180 |
|
2181 | 2181 |
|
... | ... | |
3026 | 3026 |
CREATE TABLE taxonalt ( |
3027 | 3027 |
taxonalt_id integer NOT NULL, |
3028 | 3028 |
taxondetermination_id integer NOT NULL, |
3029 |
taxonconcept_id integer NOT NULL,
|
|
3029 |
taxonlabel_id integer NOT NULL,
|
|
3030 | 3030 |
taxonaltfit text, |
3031 | 3031 |
taxonaltconfidence text, |
3032 | 3032 |
taxonaltnotes text |
... | ... | |
3053 | 3053 |
|
3054 | 3054 |
|
3055 | 3055 |
-- |
3056 |
-- Name: taxonconcept_ancestor; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
3056 |
-- Name: taxoncorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
3057 | 3057 |
-- |
3058 | 3058 |
|
3059 |
CREATE TABLE taxonconcept_ancestor ( |
|
3060 |
descendant_id integer NOT NULL, |
|
3061 |
ancestor_id integer NOT NULL |
|
3059 |
CREATE TABLE taxoncorrelation ( |
|
3060 |
taxoncorrelation_id integer NOT NULL, |
|
3061 |
taxonstatus_id integer NOT NULL, |
|
3062 |
taxonlabel_id integer NOT NULL, |
|
3063 |
plantconvergence text NOT NULL, |
|
3064 |
correlationstart date NOT NULL, |
|
3065 |
correlationstop date |
|
3062 | 3066 |
); |
3063 | 3067 |
|
3064 | 3068 |
|
3065 | 3069 |
-- |
3066 |
-- Name: TABLE taxonconcept_ancestor; Type: COMMENT; Schema: public; Owner: -
|
|
3070 |
-- Name: taxoncorrelation_taxoncorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
3067 | 3071 |
-- |
3068 | 3072 |
|
3069 |
COMMENT ON TABLE taxonconcept_ancestor IS 'Stores the accepted ancestors of a taxonconcept. Auto-populated, so should not be manually modified.'; |
|
3073 |
CREATE SEQUENCE taxoncorrelation_taxoncorrelation_id_seq |
|
3074 |
START WITH 1 |
|
3075 |
INCREMENT BY 1 |
|
3076 |
NO MINVALUE |
|
3077 |
NO MAXVALUE |
|
3078 |
CACHE 1; |
|
3070 | 3079 |
|
3071 | 3080 |
|
3072 | 3081 |
-- |
3073 |
-- Name: taxonconcept_taxonconcept_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
3082 |
-- Name: taxoncorrelation_taxoncorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
3074 | 3083 |
-- |
3075 | 3084 |
|
3076 |
CREATE SEQUENCE taxonconcept_taxonconcept_id_seq |
|
3085 |
ALTER SEQUENCE taxoncorrelation_taxoncorrelation_id_seq OWNED BY taxoncorrelation.taxoncorrelation_id; |
|
3086 |
|
|
3087 |
|
|
3088 |
-- |
|
3089 |
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
|
3090 |
-- |
|
3091 |
|
|
3092 |
CREATE SEQUENCE taxondetermination_taxondetermination_id_seq |
|
3077 | 3093 |
START WITH 1 |
3078 | 3094 |
INCREMENT BY 1 |
3079 | 3095 |
NO MINVALUE |
... | ... | |
3082 | 3098 |
|
3083 | 3099 |
|
3084 | 3100 |
-- |
3085 |
-- Name: taxonconcept_taxonconcept_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
3101 |
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
3086 | 3102 |
-- |
3087 | 3103 |
|
3088 |
ALTER SEQUENCE taxonconcept_taxonconcept_id_seq OWNED BY taxonconcept.taxonconcept_id;
|
|
3104 |
ALTER SEQUENCE taxondetermination_taxondetermination_id_seq OWNED BY taxondetermination.taxondetermination_id;
|
|
3089 | 3105 |
|
3090 | 3106 |
|
3091 | 3107 |
-- |
3092 |
-- Name: taxoncorrelation; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
3108 |
-- Name: taxonlabel_ancestor; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
|
3093 | 3109 |
-- |
3094 | 3110 |
|
3095 |
CREATE TABLE taxoncorrelation ( |
|
3096 |
taxoncorrelation_id integer NOT NULL, |
|
3097 |
taxonstatus_id integer NOT NULL, |
|
3098 |
taxonconcept_id integer NOT NULL, |
|
3099 |
plantconvergence text NOT NULL, |
|
3100 |
correlationstart date NOT NULL, |
|
3101 |
correlationstop date |
|
3111 |
CREATE TABLE taxonlabel_ancestor ( |
|
3112 |
descendant_id integer NOT NULL, |
|
3113 |
ancestor_id integer NOT NULL |
|
3102 | 3114 |
); |
3103 | 3115 |
|
3104 | 3116 |
|
3105 | 3117 |
-- |
3106 |
-- Name: taxoncorrelation_taxoncorrelation_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
3118 |
-- Name: TABLE taxonlabel_ancestor; Type: COMMENT; Schema: public; Owner: -
|
|
3107 | 3119 |
-- |
3108 | 3120 |
|
3109 |
CREATE SEQUENCE taxoncorrelation_taxoncorrelation_id_seq |
|
3110 |
START WITH 1 |
|
3111 |
INCREMENT BY 1 |
|
3112 |
NO MINVALUE |
|
3113 |
NO MAXVALUE |
|
3114 |
CACHE 1; |
|
3121 |
COMMENT ON TABLE taxonlabel_ancestor IS 'Stores the accepted ancestors of a taxonlabel. Auto-populated, so should not be manually modified.'; |
|
3115 | 3122 |
|
3116 | 3123 |
|
3117 | 3124 |
-- |
3118 |
-- Name: taxoncorrelation_taxoncorrelation_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
3125 |
-- Name: taxonlabel_taxonlabel_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
3119 | 3126 |
-- |
3120 | 3127 |
|
3121 |
ALTER SEQUENCE taxoncorrelation_taxoncorrelation_id_seq OWNED BY taxoncorrelation.taxoncorrelation_id; |
|
3122 |
|
|
3123 |
|
|
3124 |
-- |
|
3125 |
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
|
3126 |
-- |
|
3127 |
|
|
3128 |
CREATE SEQUENCE taxondetermination_taxondetermination_id_seq |
|
3128 |
CREATE SEQUENCE taxonlabel_taxonlabel_id_seq |
|
3129 | 3129 |
START WITH 1 |
3130 | 3130 |
INCREMENT BY 1 |
3131 | 3131 |
NO MINVALUE |
... | ... | |
3134 | 3134 |
|
3135 | 3135 |
|
3136 | 3136 |
-- |
3137 |
-- Name: taxondetermination_taxondetermination_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
3137 |
-- Name: taxonlabel_taxonlabel_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
3138 | 3138 |
-- |
3139 | 3139 |
|
3140 |
ALTER SEQUENCE taxondetermination_taxondetermination_id_seq OWNED BY taxondetermination.taxondetermination_id;
|
|
3140 |
ALTER SEQUENCE taxonlabel_taxonlabel_id_seq OWNED BY taxonlabel.taxonlabel_id;
|
|
3141 | 3141 |
|
3142 | 3142 |
|
3143 | 3143 |
-- |
... | ... | |
3195 | 3195 |
|
3196 | 3196 |
CREATE TABLE taxonstatus ( |
3197 | 3197 |
taxonstatus_id integer NOT NULL, |
3198 |
taxonconcept_id integer NOT NULL,
|
|
3198 |
taxonlabel_id integer NOT NULL,
|
|
3199 | 3199 |
party_id integer, |
3200 |
taxonconceptstatus text DEFAULT 'undetermined'::text NOT NULL,
|
|
3200 |
taxonlabelstatus text DEFAULT 'undetermined'::text NOT NULL,
|
|
3201 | 3201 |
reference_id integer, |
3202 | 3202 |
plantpartycomments text, |
3203 | 3203 |
startdate date, |
... | ... | |
3231 | 3231 |
|
3232 | 3232 |
CREATE TABLE taxonusage ( |
3233 | 3233 |
taxonusage_id integer NOT NULL, |
3234 |
taxonconcept_id integer NOT NULL,
|
|
3234 |
taxonlabel_id integer NOT NULL,
|
|
3235 | 3235 |
taxonstatus text, |
3236 | 3236 |
taxon text, |
3237 | 3237 |
classsystem text, |
... | ... | |
3725 | 3725 |
|
3726 | 3726 |
|
3727 | 3727 |
-- |
3728 |
-- Name: taxonconcept_id; Type: DEFAULT; Schema: public; Owner: -
|
|
3728 |
-- Name: taxoncorrelation_id; Type: DEFAULT; Schema: public; Owner: -
|
|
3729 | 3729 |
-- |
3730 | 3730 |
|
3731 |
ALTER TABLE taxonconcept ALTER COLUMN taxonconcept_id SET DEFAULT nextval('taxonconcept_taxonconcept_id_seq'::regclass);
|
|
3731 |
ALTER TABLE taxoncorrelation ALTER COLUMN taxoncorrelation_id SET DEFAULT nextval('taxoncorrelation_taxoncorrelation_id_seq'::regclass);
|
|
3732 | 3732 |
|
3733 | 3733 |
|
3734 | 3734 |
-- |
3735 |
-- Name: taxoncorrelation_id; Type: DEFAULT; Schema: public; Owner: -
|
|
3735 |
-- Name: taxondetermination_id; Type: DEFAULT; Schema: public; Owner: -
|
|
3736 | 3736 |
-- |
3737 | 3737 |
|
3738 |
ALTER TABLE taxoncorrelation ALTER COLUMN taxoncorrelation_id SET DEFAULT nextval('taxoncorrelation_taxoncorrelation_id_seq'::regclass);
|
|
3738 |
ALTER TABLE taxondetermination ALTER COLUMN taxondetermination_id SET DEFAULT nextval('taxondetermination_taxondetermination_id_seq'::regclass);
|
|
3739 | 3739 |
|
3740 | 3740 |
|
3741 | 3741 |
-- |
3742 |
-- Name: taxondetermination_id; Type: DEFAULT; Schema: public; Owner: -
|
|
3742 |
-- Name: taxonlabel_id; Type: DEFAULT; Schema: public; Owner: -
|
|
3743 | 3743 |
-- |
3744 | 3744 |
|
3745 |
ALTER TABLE taxondetermination ALTER COLUMN taxondetermination_id SET DEFAULT nextval('taxondetermination_taxondetermination_id_seq'::regclass);
|
|
3745 |
ALTER TABLE taxonlabel ALTER COLUMN taxonlabel_id SET DEFAULT nextval('taxonlabel_taxonlabel_id_seq'::regclass);
|
|
3746 | 3746 |
|
3747 | 3747 |
|
3748 | 3748 |
-- |
... | ... | |
4034 | 4034 |
|
4035 | 4035 |
|
4036 | 4036 |
-- |
4037 |
-- Name: methodtaxonclass_unique_taxonconcept_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4037 |
-- Name: methodtaxonclass_unique_taxonlabel_id; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4038 | 4038 |
-- |
4039 | 4039 |
|
4040 | 4040 |
ALTER TABLE ONLY methodtaxonclass |
4041 |
ADD CONSTRAINT methodtaxonclass_unique_taxonconcept_id UNIQUE (method_id, taxonconcept_id);
|
|
4041 |
ADD CONSTRAINT methodtaxonclass_unique_taxonlabel_id UNIQUE (method_id, taxonlabel_id);
|
|
4042 | 4042 |
|
4043 | 4043 |
|
4044 | 4044 |
-- |
... | ... | |
4258 | 4258 |
|
4259 | 4259 |
|
4260 | 4260 |
-- |
4261 |
-- Name: taxonconcept_ancestor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4261 |
-- Name: taxoncorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4262 | 4262 |
-- |
4263 | 4263 |
|
4264 |
ALTER TABLE ONLY taxonconcept_ancestor
|
|
4265 |
ADD CONSTRAINT taxonconcept_ancestor_pkey PRIMARY KEY (descendant_id, ancestor_id);
|
|
4264 |
ALTER TABLE ONLY taxoncorrelation
|
|
4265 |
ADD CONSTRAINT taxoncorrelation_pkey PRIMARY KEY (taxoncorrelation_id);
|
|
4266 | 4266 |
|
4267 | 4267 |
|
4268 | 4268 |
-- |
4269 |
-- Name: taxonconcept_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4269 |
-- Name: taxondetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4270 | 4270 |
-- |
4271 | 4271 |
|
4272 |
ALTER TABLE ONLY taxonconcept
|
|
4273 |
ADD CONSTRAINT taxonconcept_pkey PRIMARY KEY (taxonconcept_id);
|
|
4272 |
ALTER TABLE ONLY taxondetermination
|
|
4273 |
ADD CONSTRAINT taxondetermination_pkey PRIMARY KEY (taxondetermination_id);
|
|
4274 | 4274 |
|
4275 | 4275 |
|
4276 | 4276 |
-- |
4277 |
-- Name: taxoncorrelation_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4277 |
-- Name: taxonlabel_ancestor_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4278 | 4278 |
-- |
4279 | 4279 |
|
4280 |
ALTER TABLE ONLY taxoncorrelation
|
|
4281 |
ADD CONSTRAINT taxoncorrelation_pkey PRIMARY KEY (taxoncorrelation_id);
|
|
4280 |
ALTER TABLE ONLY taxonlabel_ancestor
|
|
4281 |
ADD CONSTRAINT taxonlabel_ancestor_pkey PRIMARY KEY (descendant_id, ancestor_id);
|
|
4282 | 4282 |
|
4283 | 4283 |
|
4284 | 4284 |
-- |
4285 |
-- Name: taxondetermination_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4285 |
-- Name: taxonlabel_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
|
|
4286 | 4286 |
-- |
4287 | 4287 |
|
4288 |
ALTER TABLE ONLY taxondetermination
|
|
4289 |
ADD CONSTRAINT taxondetermination_pkey PRIMARY KEY (taxondetermination_id);
|
|
4288 |
ALTER TABLE ONLY taxonlabel
|
|
4289 |
ADD CONSTRAINT taxonlabel_pkey PRIMARY KEY (taxonlabel_id);
|
|
4290 | 4290 |
|
4291 | 4291 |
|
4292 | 4292 |
-- |
... | ... | |
4318 | 4318 |
-- |
4319 | 4319 |
|
4320 | 4320 |
ALTER TABLE ONLY taxonstatus |
4321 |
ADD CONSTRAINT taxonstatus_unique UNIQUE (taxonconcept_id, party_id);
|
|
4321 |
ADD CONSTRAINT taxonstatus_unique UNIQUE (taxonlabel_id, party_id);
|
|
4322 | 4322 |
|
4323 | 4323 |
|
4324 | 4324 |
-- |
... | ... | |
4721 | 4721 |
|
4722 | 4722 |
|
4723 | 4723 |
-- |
4724 |
-- Name: taxonconcept_0_unique_identifying_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4724 |
-- Name: taxondetermination_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4725 | 4725 |
-- |
4726 | 4726 |
|
4727 |
CREATE UNIQUE INDEX taxonconcept_0_unique_identifying_name ON taxonconcept USING btree (creator_id, (COALESCE(identifyingtaxonomicname, '\\N'::text))) WHERE (identifyingtaxonomicname IS NOT NULL);
|
|
4727 |
CREATE UNIQUE INDEX taxondetermination_accessioncode_index ON taxondetermination USING btree (accessioncode);
|
|
4728 | 4728 |
|
4729 | 4729 |
|
4730 | 4730 |
-- |
4731 |
-- Name: taxonconcept_1_unique_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4731 |
-- Name: taxondetermination_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4732 | 4732 |
-- |
4733 | 4733 |
|
4734 |
CREATE UNIQUE INDEX taxonconcept_1_unique_sourceaccessioncode ON taxonconcept USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
4734 |
CREATE UNIQUE INDEX taxondetermination_unique ON taxondetermination USING btree (taxonoccurrence_id, isoriginal, role, (COALESCE(party_id, 2147483647)), taxonlabel_id);
|
|
4735 | 4735 |
|
4736 | 4736 |
|
4737 | 4737 |
-- |
4738 |
-- Name: taxonconcept_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4738 |
-- Name: taxonlabel_0_unique_identifying_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4739 | 4739 |
-- |
4740 | 4740 |
|
4741 |
CREATE UNIQUE INDEX taxonconcept_accessioncode_index ON taxonconcept USING btree (accessioncode);
|
|
4741 |
CREATE UNIQUE INDEX taxonlabel_0_unique_identifying_name ON taxonlabel USING btree (creator_id, (COALESCE(identifyingtaxonomicname, '\\N'::text))) WHERE (identifyingtaxonomicname IS NOT NULL);
|
|
4742 | 4742 |
|
4743 | 4743 |
|
4744 | 4744 |
-- |
4745 |
-- Name: taxonconcept_ancestor_descendants; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4745 |
-- Name: taxonlabel_1_unique_sourceaccessioncode; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4746 | 4746 |
-- |
4747 | 4747 |
|
4748 |
CREATE INDEX taxonconcept_ancestor_descendants ON taxonconcept_ancestor USING btree (ancestor_id, descendant_id);
|
|
4748 |
CREATE UNIQUE INDEX taxonlabel_1_unique_sourceaccessioncode ON taxonlabel USING btree (creator_id, (COALESCE(sourceaccessioncode, '\\N'::text))) WHERE (sourceaccessioncode IS NOT NULL);
|
|
4749 | 4749 |
|
4750 | 4750 |
|
4751 | 4751 |
-- |
4752 |
-- Name: taxonconcept_matched_concept_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4752 |
-- Name: taxonlabel_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4753 | 4753 |
-- |
4754 | 4754 |
|
4755 |
CREATE INDEX taxonconcept_matched_concept_id_idx ON taxonconcept USING btree (matched_concept_id);
|
|
4755 |
CREATE UNIQUE INDEX taxonlabel_accessioncode_index ON taxonlabel USING btree (accessioncode);
|
|
4756 | 4756 |
|
4757 | 4757 |
|
4758 | 4758 |
-- |
4759 |
-- Name: taxonconcept_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4759 |
-- Name: taxonlabel_ancestor_descendants; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4760 | 4760 |
-- |
4761 | 4761 |
|
4762 |
CREATE UNIQUE INDEX taxonconcept_unique ON taxonconcept USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(taxonepithet, '\\N'::text)), (COALESCE(rank, 'unknown'::taxonrank)), creator_id, (COALESCE(sourceaccessioncode, '\\N'::text)), (COALESCE(creationdate, 'infinity'::date)), (COALESCE(identifyingtaxonomicname, '\\N'::text)), (COALESCE(taxonomicname, '\\N'::text)), (COALESCE(author, '\\N'::text)), (COALESCE(taxonomicnamewithauthor, '\\N'::text)));
|
|
4762 |
CREATE INDEX taxonlabel_ancestor_descendants ON taxonlabel_ancestor USING btree (ancestor_id, descendant_id);
|
|
4763 | 4763 |
|
4764 | 4764 |
|
4765 | 4765 |
-- |
4766 |
-- Name: taxondetermination_accessioncode_index; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4766 |
-- Name: taxonlabel_matched_label_id_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4767 | 4767 |
-- |
4768 | 4768 |
|
4769 |
CREATE UNIQUE INDEX taxondetermination_accessioncode_index ON taxondetermination USING btree (accessioncode);
|
|
4769 |
CREATE INDEX taxonlabel_matched_label_id_idx ON taxonlabel USING btree (matched_label_id);
|
|
4770 | 4770 |
|
4771 | 4771 |
|
4772 | 4772 |
-- |
4773 |
-- Name: taxondetermination_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4773 |
-- Name: taxonlabel_unique; Type: INDEX; Schema: public; Owner: -; Tablespace:
|
|
4774 | 4774 |
-- |
4775 | 4775 |
|
4776 |
CREATE UNIQUE INDEX taxondetermination_unique ON taxondetermination USING btree (taxonoccurrence_id, isoriginal, role, (COALESCE(party_id, 2147483647)), taxonconcept_id);
|
|
4776 |
CREATE UNIQUE INDEX taxonlabel_unique ON taxonlabel USING btree ((COALESCE(parent_id, 2147483647)), (COALESCE(taxonepithet, '\\N'::text)), (COALESCE(rank, 'unknown'::taxonrank)), creator_id, (COALESCE(sourceaccessioncode, '\\N'::text)), (COALESCE(creationdate, 'infinity'::date)), (COALESCE(identifyingtaxonomicname, '\\N'::text)), (COALESCE(taxonomicname, '\\N'::text)), (COALESCE(author, '\\N'::text)), (COALESCE(taxonomicnamewithauthor, '\\N'::text)));
|
|
4777 | 4777 |
|
4778 | 4778 |
|
4779 | 4779 |
-- |
... | ... | |
4847 | 4847 |
|
4848 | 4848 |
|
4849 | 4849 |
-- |
4850 |
-- Name: taxonconcept_0_matched_concept_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
|
|
4850 |
-- Name: taxonlabel_0_matched_label_id_self_ref; Type: TRIGGER; Schema: public; Owner: -
|
|
4851 | 4851 |
-- |
4852 | 4852 |
|
4853 |
CREATE TRIGGER taxonconcept_0_matched_concept_id_self_ref BEFORE INSERT OR UPDATE ON taxonconcept FOR EACH ROW EXECUTE PROCEDURE taxonconcept_0_matched_concept_id_self_ref();
|
|
4853 |
CREATE TRIGGER taxonlabel_0_matched_label_id_self_ref BEFORE INSERT OR UPDATE ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_0_matched_label_id_self_ref();
|
|
4854 | 4854 |
|
4855 | 4855 |
|
4856 | 4856 |
-- |
4857 |
-- Name: taxonconcept_1_matched_concept_min_fit; Type: TRIGGER; Schema: public; Owner: -
|
|
4857 |
-- Name: taxonlabel_1_matched_label_min_fit; Type: TRIGGER; Schema: public; Owner: -
|
|
4858 | 4858 |
-- |
4859 | 4859 |
|
4860 |
CREATE TRIGGER taxonconcept_1_matched_concept_min_fit BEFORE INSERT OR UPDATE ON taxonconcept FOR EACH ROW EXECUTE PROCEDURE taxonconcept_1_matched_concept_min_fit();
|
|
4860 |
CREATE TRIGGER taxonlabel_1_matched_label_min_fit BEFORE INSERT OR UPDATE ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_1_matched_label_min_fit();
|
|
4861 | 4861 |
|
4862 | 4862 |
|
4863 | 4863 |
-- |
4864 |
-- Name: taxonconcept_2_propagate_accepted_concept_id; Type: TRIGGER; Schema: public; Owner: -
|
|
4864 |
-- Name: taxonlabel_2_propagate_accepted_label_id; Type: TRIGGER; Schema: public; Owner: -
|
|
4865 | 4865 |
-- |
4866 | 4866 |
|
4867 |
CREATE TRIGGER taxonconcept_2_propagate_accepted_concept_id BEFORE INSERT OR UPDATE ON taxonconcept FOR EACH ROW EXECUTE PROCEDURE taxonconcept_2_propagate_accepted_concept_id();
|
|
4867 |
CREATE TRIGGER taxonlabel_2_propagate_accepted_label_id BEFORE INSERT OR UPDATE ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_2_propagate_accepted_label_id();
|
|
4868 | 4868 |
|
4869 | 4869 |
|
4870 | 4870 |
-- |
4871 |
-- Name: taxonconcept_3_parent_id_avoid_self_ref; Type: TRIGGER; Schema: public; Owner: -
|
|
4871 |
-- Name: taxonlabel_3_parent_id_avoid_self_ref; Type: TRIGGER; Schema: public; Owner: -
|
|
4872 | 4872 |
-- |
4873 | 4873 |
|
4874 |
CREATE TRIGGER taxonconcept_3_parent_id_avoid_self_ref BEFORE INSERT OR UPDATE ON taxonconcept FOR EACH ROW EXECUTE PROCEDURE taxonconcept_3_parent_id_avoid_self_ref();
|
|
4874 |
CREATE TRIGGER taxonlabel_3_parent_id_avoid_self_ref BEFORE INSERT OR UPDATE ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_3_parent_id_avoid_self_ref();
|
|
4875 | 4875 |
|
4876 | 4876 |
|
4877 | 4877 |
-- |
4878 |
-- Name: taxonconcept_update_ancestors_on_insert; Type: TRIGGER; Schema: public; Owner: -
|
|
4878 |
-- Name: taxonlabel_update_ancestors_on_insert; Type: TRIGGER; Schema: public; Owner: -
|
|
4879 | 4879 |
-- |
4880 | 4880 |
|
4881 |
CREATE TRIGGER taxonconcept_update_ancestors_on_insert AFTER INSERT ON taxonconcept FOR EACH ROW EXECUTE PROCEDURE taxonconcept_update_ancestors_on_insert();
|
|
4881 |
CREATE TRIGGER taxonlabel_update_ancestors_on_insert AFTER INSERT ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_update_ancestors_on_insert();
|
|
4882 | 4882 |
|
4883 | 4883 |
|
4884 | 4884 |
-- |
4885 |
-- Name: taxonconcept_update_ancestors_on_update; Type: TRIGGER; Schema: public; Owner: -
|
|
4885 |
-- Name: taxonlabel_update_ancestors_on_update; Type: TRIGGER; Schema: public; Owner: -
|
|
4886 | 4886 |
-- |
4887 | 4887 |
|
4888 |
CREATE TRIGGER taxonconcept_update_ancestors_on_update AFTER UPDATE ON taxonconcept FOR EACH ROW EXECUTE PROCEDURE taxonconcept_update_ancestors_on_update();
|
|
4888 |
CREATE TRIGGER taxonlabel_update_ancestors_on_update AFTER UPDATE ON taxonlabel FOR EACH ROW EXECUTE PROCEDURE taxonlabel_update_ancestors_on_update();
|
|
4889 | 4889 |
|
4890 | 4890 |
|
4891 | 4891 |
-- |
... | ... | |
5353 | 5353 |
|
5354 | 5354 |
|
5355 | 5355 |
-- |
5356 |
-- Name: methodtaxonclass_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5356 |
-- Name: methodtaxonclass_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5357 | 5357 |
-- |
5358 | 5358 |
|
5359 | 5359 |
ALTER TABLE ONLY methodtaxonclass |
5360 |
ADD CONSTRAINT methodtaxonclass_taxonconcept_id_fkey FOREIGN KEY (taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5360 |
ADD CONSTRAINT methodtaxonclass_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5361 | 5361 |
|
5362 | 5362 |
|
5363 | 5363 |
-- |
... | ... | |
5649 | 5649 |
|
5650 | 5650 |
|
5651 | 5651 |
-- |
5652 |
-- Name: taxonalt_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5652 |
-- Name: taxonalt_taxondetermination_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5653 | 5653 |
-- |
5654 | 5654 |
|
5655 | 5655 |
ALTER TABLE ONLY taxonalt |
5656 |
ADD CONSTRAINT taxonalt_taxonconcept_id_fkey FOREIGN KEY (taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5656 |
ADD CONSTRAINT taxonalt_taxondetermination_id_fkey FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5657 | 5657 |
|
5658 | 5658 |
|
5659 | 5659 |
-- |
5660 |
-- Name: taxonalt_taxondetermination_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5660 |
-- Name: taxonalt_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5661 | 5661 |
-- |
5662 | 5662 |
|
5663 | 5663 |
ALTER TABLE ONLY taxonalt |
5664 |
ADD CONSTRAINT taxonalt_taxondetermination_id_fkey FOREIGN KEY (taxondetermination_id) REFERENCES taxondetermination(taxondetermination_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5664 |
ADD CONSTRAINT taxonalt_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5665 | 5665 |
|
5666 | 5666 |
|
5667 | 5667 |
-- |
5668 |
-- Name: taxonconcept_accepted_concept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5668 |
-- Name: taxoncorrelation_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5669 | 5669 |
-- |
5670 | 5670 |
|
5671 |
ALTER TABLE ONLY taxonconcept
|
|
5672 |
ADD CONSTRAINT taxonconcept_accepted_concept_id_fkey FOREIGN KEY (accepted_concept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5671 |
ALTER TABLE ONLY taxoncorrelation
|
|
5672 |
ADD CONSTRAINT taxoncorrelation_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5673 | 5673 |
|
5674 | 5674 |
|
5675 | 5675 |
-- |
5676 |
-- Name: taxonconcept_ancestor_ancestor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5676 |
-- Name: taxoncorrelation_taxonstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5677 | 5677 |
-- |
5678 | 5678 |
|
5679 |
ALTER TABLE ONLY taxonconcept_ancestor
|
|
5680 |
ADD CONSTRAINT taxonconcept_ancestor_ancestor_id_fkey FOREIGN KEY (ancestor_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5679 |
ALTER TABLE ONLY taxoncorrelation
|
|
5680 |
ADD CONSTRAINT taxoncorrelation_taxonstatus_id_fkey FOREIGN KEY (taxonstatus_id) REFERENCES taxonstatus(taxonstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5681 | 5681 |
|
5682 | 5682 |
|
5683 | 5683 |
-- |
5684 |
-- Name: taxonconcept_ancestor_descendant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5684 |
-- Name: taxondetermination_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5685 | 5685 |
-- |
5686 | 5686 |
|
5687 |
ALTER TABLE ONLY taxonconcept_ancestor
|
|
5688 |
ADD CONSTRAINT taxonconcept_ancestor_descendant_id_fkey FOREIGN KEY (descendant_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5687 |
ALTER TABLE ONLY taxondetermination
|
|
5688 |
ADD CONSTRAINT taxondetermination_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5689 | 5689 |
|
5690 | 5690 |
|
5691 | 5691 |
-- |
5692 |
-- Name: taxonconcept_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5692 |
-- Name: taxondetermination_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5693 | 5693 |
-- |
5694 | 5694 |
|
5695 |
ALTER TABLE ONLY taxonconcept
|
|
5696 |
ADD CONSTRAINT taxonconcept_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5695 |
ALTER TABLE ONLY taxondetermination
|
|
5696 |
ADD CONSTRAINT taxondetermination_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5697 | 5697 |
|
5698 | 5698 |
|
5699 | 5699 |
-- |
5700 |
-- Name: taxonconcept_matched_concept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5700 |
-- Name: taxondetermination_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5701 | 5701 |
-- |
5702 | 5702 |
|
5703 |
ALTER TABLE ONLY taxonconcept
|
|
5704 |
ADD CONSTRAINT taxonconcept_matched_concept_id_fkey FOREIGN KEY (matched_concept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5703 |
ALTER TABLE ONLY taxondetermination
|
|
5704 |
ADD CONSTRAINT taxondetermination_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5705 | 5705 |
|
5706 | 5706 |
|
5707 | 5707 |
-- |
5708 |
-- Name: taxonconcept_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5708 |
-- Name: taxondetermination_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5709 | 5709 |
-- |
5710 | 5710 |
|
5711 |
ALTER TABLE ONLY taxonconcept
|
|
5712 |
ADD CONSTRAINT taxonconcept_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5711 |
ALTER TABLE ONLY taxondetermination
|
|
5712 |
ADD CONSTRAINT taxondetermination_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5713 | 5713 |
|
5714 | 5714 |
|
5715 | 5715 |
-- |
5716 |
-- Name: taxoncorrelation_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5716 |
-- Name: taxonlabel_accepted_label_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5717 | 5717 |
-- |
5718 | 5718 |
|
5719 |
ALTER TABLE ONLY taxoncorrelation
|
|
5720 |
ADD CONSTRAINT taxoncorrelation_taxonconcept_id_fkey FOREIGN KEY (taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5719 |
ALTER TABLE ONLY taxonlabel
|
|
5720 |
ADD CONSTRAINT taxonlabel_accepted_label_id_fkey FOREIGN KEY (accepted_label_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5721 | 5721 |
|
5722 | 5722 |
|
5723 | 5723 |
-- |
5724 |
-- Name: taxoncorrelation_taxonstatus_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5724 |
-- Name: taxonlabel_ancestor_ancestor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5725 | 5725 |
-- |
5726 | 5726 |
|
5727 |
ALTER TABLE ONLY taxoncorrelation
|
|
5728 |
ADD CONSTRAINT taxoncorrelation_taxonstatus_id_fkey FOREIGN KEY (taxonstatus_id) REFERENCES taxonstatus(taxonstatus_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5727 |
ALTER TABLE ONLY taxonlabel_ancestor
|
|
5728 |
ADD CONSTRAINT taxonlabel_ancestor_ancestor_id_fkey FOREIGN KEY (ancestor_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5729 | 5729 |
|
5730 | 5730 |
|
5731 | 5731 |
-- |
5732 |
-- Name: taxondetermination_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5732 |
-- Name: taxonlabel_ancestor_descendant_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5733 | 5733 |
-- |
5734 | 5734 |
|
5735 |
ALTER TABLE ONLY taxondetermination
|
|
5736 |
ADD CONSTRAINT taxondetermination_party_id_fkey FOREIGN KEY (party_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5735 |
ALTER TABLE ONLY taxonlabel_ancestor
|
|
5736 |
ADD CONSTRAINT taxonlabel_ancestor_descendant_id_fkey FOREIGN KEY (descendant_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5737 | 5737 |
|
5738 | 5738 |
|
5739 | 5739 |
-- |
5740 |
-- Name: taxondetermination_reference_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5740 |
-- Name: taxonlabel_creator_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5741 | 5741 |
-- |
5742 | 5742 |
|
5743 |
ALTER TABLE ONLY taxondetermination
|
|
5744 |
ADD CONSTRAINT taxondetermination_reference_id_fkey FOREIGN KEY (reference_id) REFERENCES reference(reference_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5743 |
ALTER TABLE ONLY taxonlabel
|
|
5744 |
ADD CONSTRAINT taxonlabel_creator_id_fkey FOREIGN KEY (creator_id) REFERENCES party(party_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5745 | 5745 |
|
5746 | 5746 |
|
5747 | 5747 |
-- |
5748 |
-- Name: taxondetermination_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5748 |
-- Name: taxonlabel_matched_label_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5749 | 5749 |
-- |
5750 | 5750 |
|
5751 |
ALTER TABLE ONLY taxondetermination
|
|
5752 |
ADD CONSTRAINT taxondetermination_taxonconcept_id_fkey FOREIGN KEY (taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5751 |
ALTER TABLE ONLY taxonlabel
|
|
5752 |
ADD CONSTRAINT taxonlabel_matched_label_id_fkey FOREIGN KEY (matched_label_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5753 | 5753 |
|
5754 | 5754 |
|
5755 | 5755 |
-- |
5756 |
-- Name: taxondetermination_taxonoccurrence_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5756 |
-- Name: taxonlabel_parent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5757 | 5757 |
-- |
5758 | 5758 |
|
5759 |
ALTER TABLE ONLY taxondetermination
|
|
5760 |
ADD CONSTRAINT taxondetermination_taxonoccurrence_id_fkey FOREIGN KEY (taxonoccurrence_id) REFERENCES taxonoccurrence(taxonoccurrence_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5759 |
ALTER TABLE ONLY taxonlabel
|
|
5760 |
ADD CONSTRAINT taxonlabel_parent_id_fkey FOREIGN KEY (parent_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5761 | 5761 |
|
5762 | 5762 |
|
5763 | 5763 |
-- |
... | ... | |
5809 | 5809 |
|
5810 | 5810 |
|
5811 | 5811 |
-- |
5812 |
-- Name: taxonstatus_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5812 |
-- Name: taxonstatus_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5813 | 5813 |
-- |
5814 | 5814 |
|
5815 | 5815 |
ALTER TABLE ONLY taxonstatus |
5816 |
ADD CONSTRAINT taxonstatus_taxonconcept_id_fkey FOREIGN KEY (taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5816 |
ADD CONSTRAINT taxonstatus_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5817 | 5817 |
|
5818 | 5818 |
|
5819 | 5819 |
-- |
... | ... | |
5825 | 5825 |
|
5826 | 5826 |
|
5827 | 5827 |
-- |
5828 |
-- Name: taxonusage_taxonconcept_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5828 |
-- Name: taxonusage_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
|
|
5829 | 5829 |
-- |
5830 | 5830 |
|
5831 | 5831 |
ALTER TABLE ONLY taxonusage |
5832 |
ADD CONSTRAINT taxonusage_taxonconcept_id_fkey FOREIGN KEY (taxonconcept_id) REFERENCES taxonconcept(taxonconcept_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5832 |
ADD CONSTRAINT taxonusage_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE;
|
|
5833 | 5833 |
|
5834 | 5834 |
|
5835 | 5835 |
-- |
Also available in: Unified diff
schemas/vegbien.sql: Renamed taxonconcept to taxonlabel per today's conference call, where it was decided that taxonconcept contained too many unrelated fields to be purely a taxon concept