Revision 5748
Added by Aaron Marcuse-Kubitza about 12 years ago
schemas/vegbien.my.sql | ||
---|---|---|
965 | 965 |
|
966 | 966 |
|
967 | 967 |
-- |
968 |
-- Name: stemobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
969 |
-- |
|
970 |
|
|
971 |
CREATE TABLE stemobservation ( |
|
972 |
stemobservation_id int(11) NOT NULL, |
|
973 |
creator_id int(11) NOT NULL, |
|
974 |
sourceaccessioncode text, |
|
975 |
plantobservation_id int(11) NOT NULL, |
|
976 |
authorstemcode text, |
|
977 |
tag text, |
|
978 |
tags text, |
|
979 |
xposition_m double precision, |
|
980 |
yposition_m double precision, |
|
981 |
diameterbreastheight_m double precision, |
|
982 |
basaldiameter_m double precision, |
|
983 |
diameteraccuracy_m double precision, |
|
984 |
height_m double precision, |
|
985 |
heightfirstbranch_m double precision, |
|
986 |
heightaccuracy_m double precision, |
|
987 |
health text, |
|
988 |
age double precision, |
|
989 |
accessioncode text |
|
990 |
); |
|
991 |
|
|
992 |
|
|
993 |
-- |
|
994 |
-- Name: TABLE stemobservation; Type: COMMENT; Schema: public; Owner: - |
|
995 |
-- |
|
996 |
|
|
997 |
|
|
998 |
|
|
999 |
|
|
1000 |
-- |
|
1001 |
-- Name: COLUMN stemobservation.tags; Type: COMMENT; Schema: public; Owner: - |
|
1002 |
-- |
|
1003 |
|
|
1004 |
|
|
1005 |
|
|
1006 |
|
|
1007 |
-- |
|
968 | 1008 |
-- Name: taxondetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: |
969 | 1009 |
-- |
970 | 1010 |
|
... | ... | |
1131 | 1171 |
-- |
1132 | 1172 |
|
1133 | 1173 |
CREATE VIEW analytical_db_view AS |
1134 |
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], CAST(' ' AS 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 (((((((((((((((party datasource JOIN location ON ((location.creator_id = datasource.party_id))) 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 taxonverbatim USING (taxonverbatim_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)) WHERE (datasource.organizationname IS NOT NULL);
|
|
1174 |
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], CAST(' ' AS 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`, stemobservation.xposition_m, stemobservation.yposition_m FROM ((((((((((((((((party datasource JOIN location ON ((location.creator_id = datasource.party_id))) 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 taxonverbatim USING (taxonverbatim_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 stemobservation USING (plantobservation_id)) LEFT JOIN specimenreplicate USING (plantobservation_id)) WHERE (datasource.organizationname IS NOT NULL);
|
|
1135 | 1175 |
|
1136 | 1176 |
|
1137 | 1177 |
-- |
... | ... | |
2330 | 2370 |
|
2331 | 2371 |
|
2332 | 2372 |
-- |
2333 |
-- Name: stemobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
2334 |
-- |
|
2335 |
|
|
2336 |
CREATE TABLE stemobservation ( |
|
2337 |
stemobservation_id int(11) NOT NULL, |
|
2338 |
creator_id int(11) NOT NULL, |
|
2339 |
sourceaccessioncode text, |
|
2340 |
plantobservation_id int(11) NOT NULL, |
|
2341 |
authorstemcode text, |
|
2342 |
tag text, |
|
2343 |
tags text, |
|
2344 |
xposition_m double precision, |
|
2345 |
yposition_m double precision, |
|
2346 |
diameterbreastheight_m double precision, |
|
2347 |
basaldiameter_m double precision, |
|
2348 |
diameteraccuracy_m double precision, |
|
2349 |
height_m double precision, |
|
2350 |
heightfirstbranch_m double precision, |
|
2351 |
heightaccuracy_m double precision, |
|
2352 |
health text, |
|
2353 |
age double precision, |
|
2354 |
accessioncode text |
|
2355 |
); |
|
2356 |
|
|
2357 |
|
|
2358 |
-- |
|
2359 |
-- Name: TABLE stemobservation; Type: COMMENT; Schema: public; Owner: - |
|
2360 |
-- |
|
2361 |
|
|
2362 |
|
|
2363 |
|
|
2364 |
|
|
2365 |
-- |
|
2366 |
-- Name: COLUMN stemobservation.tags; Type: COMMENT; Schema: public; Owner: - |
|
2367 |
-- |
|
2368 |
|
|
2369 |
|
|
2370 |
|
|
2371 |
|
|
2372 |
-- |
|
2373 | 2373 |
-- Name: stemobservation_stemobservation_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
2374 | 2374 |
-- |
2375 | 2375 |
|
schemas/vegbien.sql | ||
---|---|---|
1443 | 1443 |
|
1444 | 1444 |
|
1445 | 1445 |
-- |
1446 |
-- Name: stemobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
1447 |
-- |
|
1448 |
|
|
1449 |
CREATE TABLE stemobservation ( |
|
1450 |
stemobservation_id integer NOT NULL, |
|
1451 |
creator_id integer NOT NULL, |
|
1452 |
sourceaccessioncode text, |
|
1453 |
plantobservation_id integer NOT NULL, |
|
1454 |
authorstemcode text, |
|
1455 |
tag text, |
|
1456 |
tags text, |
|
1457 |
xposition_m double precision, |
|
1458 |
yposition_m double precision, |
|
1459 |
diameterbreastheight_m double precision, |
|
1460 |
basaldiameter_m double precision, |
|
1461 |
diameteraccuracy_m double precision, |
|
1462 |
height_m double precision, |
|
1463 |
heightfirstbranch_m double precision, |
|
1464 |
heightaccuracy_m double precision, |
|
1465 |
health text, |
|
1466 |
age double precision, |
|
1467 |
accessioncode text |
|
1468 |
); |
|
1469 |
|
|
1470 |
|
|
1471 |
-- |
|
1472 |
-- Name: TABLE stemobservation; Type: COMMENT; Schema: public; Owner: - |
|
1473 |
-- |
|
1474 |
|
|
1475 |
COMMENT ON TABLE stemobservation IS 'Equivalent to VegBank''s stemlocation table.'; |
|
1476 |
|
|
1477 |
|
|
1478 |
-- |
|
1479 |
-- Name: COLUMN stemobservation.tags; Type: COMMENT; Schema: public; Owner: - |
|
1480 |
-- |
|
1481 |
|
|
1482 |
COMMENT ON COLUMN stemobservation.tags IS 'Stores all tags when multiple tags provided. Older tags go first.'; |
|
1483 |
|
|
1484 |
|
|
1485 |
-- |
|
1446 | 1486 |
-- Name: taxondetermination; Type: TABLE; Schema: public; Owner: -; Tablespace: |
1447 | 1487 |
-- |
1448 | 1488 |
|
... | ... | |
1613 | 1653 |
-- |
1614 | 1654 |
|
1615 | 1655 |
CREATE VIEW analytical_db_view AS |
1616 |
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 (((((((((((((((party datasource JOIN location ON ((location.creator_id = datasource.party_id))) 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 taxonverbatim USING (taxonverbatim_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)) WHERE (datasource.organizationname IS NOT NULL);
|
|
1656 |
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", stemobservation.xposition_m, stemobservation.yposition_m FROM ((((((((((((((((party datasource JOIN location ON ((location.creator_id = datasource.party_id))) 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 taxonverbatim USING (taxonverbatim_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 stemobservation USING (plantobservation_id)) LEFT JOIN specimenreplicate USING (plantobservation_id)) WHERE (datasource.organizationname IS NOT NULL);
|
|
1617 | 1657 |
|
1618 | 1658 |
|
1619 | 1659 |
-- |
... | ... | |
3036 | 3076 |
|
3037 | 3077 |
|
3038 | 3078 |
-- |
3039 |
-- Name: stemobservation; Type: TABLE; Schema: public; Owner: -; Tablespace: |
|
3040 |
-- |
|
3041 |
|
|
3042 |
CREATE TABLE stemobservation ( |
|
3043 |
stemobservation_id integer NOT NULL, |
|
3044 |
creator_id integer NOT NULL, |
|
3045 |
sourceaccessioncode text, |
|
3046 |
plantobservation_id integer NOT NULL, |
|
3047 |
authorstemcode text, |
|
3048 |
tag text, |
|
3049 |
tags text, |
|
3050 |
xposition_m double precision, |
|
3051 |
yposition_m double precision, |
|
3052 |
diameterbreastheight_m double precision, |
|
3053 |
basaldiameter_m double precision, |
|
3054 |
diameteraccuracy_m double precision, |
|
3055 |
height_m double precision, |
|
3056 |
heightfirstbranch_m double precision, |
|
3057 |
heightaccuracy_m double precision, |
|
3058 |
health text, |
|
3059 |
age double precision, |
|
3060 |
accessioncode text |
|
3061 |
); |
|
3062 |
|
|
3063 |
|
|
3064 |
-- |
|
3065 |
-- Name: TABLE stemobservation; Type: COMMENT; Schema: public; Owner: - |
|
3066 |
-- |
|
3067 |
|
|
3068 |
COMMENT ON TABLE stemobservation IS 'Equivalent to VegBank''s stemlocation table.'; |
|
3069 |
|
|
3070 |
|
|
3071 |
-- |
|
3072 |
-- Name: COLUMN stemobservation.tags; Type: COMMENT; Schema: public; Owner: - |
|
3073 |
-- |
|
3074 |
|
|
3075 |
COMMENT ON COLUMN stemobservation.tags IS 'Stores all tags when multiple tags provided. Older tags go first.'; |
|
3076 |
|
|
3077 |
|
|
3078 |
-- |
|
3079 | 3079 |
-- Name: stemobservation_stemobservation_id_seq; Type: SEQUENCE; Schema: public; Owner: - |
3080 | 3080 |
-- |
3081 | 3081 |
|
Also available in: Unified diff
analytical_db_view: Added stemobservation.xposition_m, yposition_m