Revision 5655
Added by Aaron Marcuse-Kubitza about 12 years ago
vegbien.sql | ||
---|---|---|
547 | 547 |
parent_id integer, |
548 | 548 |
taxonepithet text, |
549 | 549 |
rank taxonrank, |
550 |
verbatimrank text, |
|
551 | 550 |
identifyingtaxonomicname text, |
552 |
binomial text, |
|
553 |
author text, |
|
554 |
taxonomicname text, |
|
555 |
morphospecies text, |
|
556 |
family text, |
|
557 |
genus text, |
|
558 |
species text, |
|
559 |
description text, |
|
560 | 551 |
accessioncode text, |
561 | 552 |
CONSTRAINT taxonlabel_matched_label_fit_fraction_range CHECK (((matched_label_fit_fraction >= (0)::double precision) AND (matched_label_fit_fraction <= (1)::double precision))), |
562 | 553 |
CONSTRAINT taxonlabel_required_key CHECK (((taxonepithet IS NOT NULL) OR (identifyingtaxonomicname IS NOT NULL))) |
... | ... | |
648 | 639 |
|
649 | 640 |
|
650 | 641 |
-- |
651 |
-- Name: COLUMN taxonlabel.verbatimrank; Type: COMMENT; Schema: public; Owner: - |
|
652 |
-- |
|
653 |
|
|
654 |
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.'; |
|
655 |
|
|
656 |
|
|
657 |
-- |
|
658 | 642 |
-- Name: COLUMN taxonlabel.identifyingtaxonomicname; Type: COMMENT; Schema: public; Owner: - |
659 | 643 |
-- |
660 | 644 |
|
... | ... | |
662 | 646 |
|
663 | 647 |
|
664 | 648 |
-- |
665 |
-- Name: COLUMN taxonlabel.binomial; Type: COMMENT; Schema: public; Owner: - |
|
666 |
-- |
|
667 |
|
|
668 |
COMMENT ON COLUMN taxonlabel.binomial IS 'The taxonomic name without the author.'; |
|
669 |
|
|
670 |
|
|
671 |
-- |
|
672 |
-- Name: COLUMN taxonlabel.author; Type: COMMENT; Schema: public; Owner: - |
|
673 |
-- |
|
674 |
|
|
675 |
COMMENT ON COLUMN taxonlabel.author IS 'The author of the taxonomic name. |
|
676 |
|
|
677 |
Equivalent to Darwin Core''s scientificNameAuthorship.'; |
|
678 |
|
|
679 |
|
|
680 |
-- |
|
681 |
-- Name: COLUMN taxonlabel.taxonomicname; Type: COMMENT; Schema: public; Owner: - |
|
682 |
-- |
|
683 |
|
|
684 |
COMMENT ON COLUMN taxonlabel.taxonomicname IS 'The concatenated taxonomic name which uniquely identifies this taxon, including the author of that name. |
|
685 |
|
|
686 |
Equivalent to Darwin Core''s scientificName.'; |
|
687 |
|
|
688 |
|
|
689 |
-- |
|
690 |
-- Name: COLUMN taxonlabel.family; Type: COMMENT; Schema: public; Owner: - |
|
691 |
-- |
|
692 |
|
|
693 |
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.'; |
|
694 |
|
|
695 |
|
|
696 |
-- |
|
697 |
-- Name: COLUMN taxonlabel.genus; Type: COMMENT; Schema: public; Owner: - |
|
698 |
-- |
|
699 |
|
|
700 |
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.'; |
|
701 |
|
|
702 |
|
|
703 |
-- |
|
704 |
-- Name: COLUMN taxonlabel.species; Type: COMMENT; Schema: public; Owner: - |
|
705 |
-- |
|
706 |
|
|
707 |
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.'; |
|
708 |
|
|
709 |
|
|
710 |
-- |
|
711 | 649 |
-- Name: taxonlabel_update_ancestors(taxonlabel, integer); Type: FUNCTION; Schema: public; Owner: - |
712 | 650 |
-- |
713 | 651 |
|
... | ... | |
1539 | 1477 |
|
1540 | 1478 |
|
1541 | 1479 |
-- |
1480 |
-- Name: taxonverbatim; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1481 |
-- |
|
1482 |
|
|
1483 |
CREATE TABLE taxonverbatim ( |
|
1484 |
taxonlabel_id integer NOT NULL, |
|
1485 |
verbatimrank text, |
|
1486 |
taxonomicname text, |
|
1487 |
binomial text, |
|
1488 |
author text, |
|
1489 |
family text, |
|
1490 |
genus text, |
|
1491 |
species text, |
|
1492 |
morphospecies text, |
|
1493 |
description text |
|
1494 |
); |
|
1495 |
|
|
1496 |
|
|
1497 |
-- |
|
1498 |
-- Name: TABLE taxonverbatim; Type: COMMENT; Schema: public; Owner: - |
|
1499 |
-- |
|
1500 |
|
|
1501 |
COMMENT ON TABLE taxonverbatim IS 'Component parts of the taxonlabel. Contains the datasource''s original taxonomic name components, as well as any parsed components produced by name resolution.'; |
|
1502 |
|
|
1503 |
|
|
1504 |
-- |
|
1505 |
-- Name: COLUMN taxonverbatim.verbatimrank; Type: COMMENT; Schema: public; Owner: - |
|
1506 |
-- |
|
1507 |
|
|
1508 |
COMMENT ON COLUMN taxonverbatim.verbatimrank IS 'The taxonlabel''s verbatim level in the taxonomic hierarchy. Does not need to be in the taxonrank closed list.'; |
|
1509 |
|
|
1510 |
|
|
1511 |
-- |
|
1512 |
-- Name: COLUMN taxonverbatim.taxonomicname; Type: COMMENT; Schema: public; Owner: - |
|
1513 |
-- |
|
1514 |
|
|
1515 |
COMMENT ON COLUMN taxonverbatim.taxonomicname IS 'The concatenated taxonomic name which uniquely identifies this taxon, including the author of that name. |
|
1516 |
|
|
1517 |
Equivalent to Darwin Core''s scientificName.'; |
|
1518 |
|
|
1519 |
|
|
1520 |
-- |
|
1521 |
-- Name: COLUMN taxonverbatim.binomial; Type: COMMENT; Schema: public; Owner: - |
|
1522 |
-- |
|
1523 |
|
|
1524 |
COMMENT ON COLUMN taxonverbatim.binomial IS 'The taxonomic name without the author.'; |
|
1525 |
|
|
1526 |
|
|
1527 |
-- |
|
1528 |
-- Name: COLUMN taxonverbatim.author; Type: COMMENT; Schema: public; Owner: - |
|
1529 |
-- |
|
1530 |
|
|
1531 |
COMMENT ON COLUMN taxonverbatim.author IS 'The author of the taxonomic name. |
|
1532 |
|
|
1533 |
Equivalent to Darwin Core''s scientificNameAuthorship.'; |
|
1534 |
|
|
1535 |
|
|
1536 |
-- |
|
1537 |
-- Name: COLUMN taxonverbatim.family; Type: COMMENT; Schema: public; Owner: - |
|
1538 |
-- |
|
1539 |
|
|
1540 |
COMMENT ON COLUMN taxonverbatim.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.'; |
|
1541 |
|
|
1542 |
|
|
1543 |
-- |
|
1544 |
-- Name: COLUMN taxonverbatim.genus; Type: COMMENT; Schema: public; Owner: - |
|
1545 |
-- |
|
1546 |
|
|
1547 |
COMMENT ON COLUMN taxonverbatim.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.'; |
|
1548 |
|
|
1549 |
|
|
1550 |
-- |
|
1551 |
-- Name: COLUMN taxonverbatim.species; Type: COMMENT; Schema: public; Owner: - |
|
1552 |
-- |
|
1553 |
|
|
1554 |
COMMENT ON COLUMN taxonverbatim.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.'; |
|
1555 |
|
|
1556 |
|
|
1557 |
-- |
|
1542 | 1558 |
-- Name: analytical_db_view; Type: VIEW; Schema: public; Owner: - |
1543 | 1559 |
-- |
1544 | 1560 |
|
1545 | 1561 |
CREATE VIEW analytical_db_view AS |
1546 |
SELECT datasource.organizationname AS "dataSourceName", accepted_taxonlabel.family, accepted_taxonlabel.genus, accepted_taxonlabel.species, COALESCE(accepted_taxonlabel.taxonomicname, accepted_taxonlabel.binomial) 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.canon_label_id))) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
|
|
1562 |
SELECT datasource.organizationname AS "dataSourceName", taxonverbatim.family, taxonverbatim.genus, taxonverbatim.species, COALESCE(taxonverbatim.taxonomicname, taxonverbatim.binomial) AS taxon, taxonverbatim.author AS "taxonAuthor", taxonverbatim.morphospecies 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.canon_label_id))) JOIN taxonverbatim ON ((taxonverbatim.taxonlabel_id = accepted_taxonlabel.taxonlabel_id))) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN specimenreplicate USING (plantobservation_id));
|
|
1547 | 1563 |
|
1548 | 1564 |
|
1549 | 1565 |
-- |
... | ... | |
4378 | 4394 |
|
4379 | 4395 |
|
4380 | 4396 |
-- |
4397 |
-- Name: taxonverbatim_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
|
4398 |
-- |
|
4399 |
|
|
4400 |
ALTER TABLE ONLY taxonverbatim |
|
4401 |
ADD CONSTRAINT taxonverbatim_pkey PRIMARY KEY (taxonlabel_id); |
|
4402 |
|
|
4403 |
|
|
4404 |
-- |
|
4381 | 4405 |
-- Name: telephone_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace: |
4382 | 4406 |
-- |
4383 | 4407 |
|
... | ... | |
5881 | 5905 |
|
5882 | 5906 |
|
5883 | 5907 |
-- |
5908 |
-- Name: taxonverbatim_taxonlabel_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
|
5909 |
-- |
|
5910 |
|
|
5911 |
ALTER TABLE ONLY taxonverbatim |
|
5912 |
ADD CONSTRAINT taxonverbatim_taxonlabel_id_fkey FOREIGN KEY (taxonlabel_id) REFERENCES taxonlabel(taxonlabel_id) ON UPDATE CASCADE ON DELETE CASCADE; |
|
5913 |
|
|
5914 |
|
|
5915 |
-- |
|
5884 | 5916 |
-- Name: telephone_party_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: - |
5885 | 5917 |
-- |
5886 | 5918 |
|
Also available in: Unified diff
schemas/vegbien.sql: taxonlabel: Moved non-scoping fields to new taxonverbatim subclass table, which contains the component parts of the taxonlabel