Project

General

Profile

« Previous | Next » 

Revision 13154

schemas/Makefile: vegbien.sql: also include geoscrub, TNRS schemas, as requested in the 2014-04-10 conference call (wiki.vegpath.org/2014-04-10_conference_call#VegBIEN-schema). this involves having a separate public_.sql file for restoring the public schema.

View differences:

trunk/schemas/Makefile
10 10

  
11 11
##### General targets
12 12

  
13
all = vegbien.sql vegbien.my.sql util.sql py_util.sql
13
all = public_.sql vegbien.sql vegbien.my.sql util.sql py_util.sql
14 14

  
15 15
all: _always $(all) ;
16 16

  
......
31 31
psqlNoSearchPath := env no_search_path=1 ../bin/psql_script_vegbien
32 32
psql_verbose := env no_search_path=1 ../bin/psql_verbose_vegbien
33 33

  
34
# Must come before `%/install: vegbien.sql` to override it
34
# Must come before `%/install: public_.sql` to override it
35 35
%/install: %.sql _always
36 36
	-<$< $(psqlNoSearchPath)
37 37
# ignore errors if schema exists
......
53 53
# Installs a version of the public schema
54 54
# usage: make schemas/public/reinstall
55 55
#        make schemas/r#/reinstall
56
%/install: vegbien.sql _always
56
%/install: public_.sql _always
57 57
	echo $(call mkSchemaCmd,$*)\
58 58
"COMMENT ON SCHEMA \"$*\" IS 'Version: $* ($(date))';"|$(psqlNoSearchPath)
59 59
	# create a custom *_validation schema for *each* public schema, rather than
......
64 64
's/( |::)public(_[[:alnum:]_]+)?([.,;]| [^[:lower:]])/\1$(*q)$*\2$(*q)\3/g'\
65 65
|$(psqlNoSearchPath) # [[:alnum:]_]+, not ...*, because public_ is a username
66 66

  
67
%/uninstall: vegbien.sql _always
67
%/uninstall: public_.sql _always
68 68
	$(call confirmRmPublicSchema,$*)
69 69
	# don't use public.rm(), because when the public schema is incompletely
70 70
	# imported, this function will not yet exist
......
102 102

  
103 103
pg_dump = env schema= ../bin/pg_dump_vegbien $(1) >$@
104 104

  
105
vegbien.sql:
105
public_.sql:
106 106
	# include schemas that depend on `public` so they are restored along with it
107 107
	unset version dump_opts; $(call pg_dump,public --schema='public_*')
108 108

  
109
vegbien.sql: public_.sql
110
	(cat public_.sql; schema=1 ../bin/pg_dump_vegbien all --schema='geoscrub' \
111
--schema='"TNRS"' --exclude-table='*."~"*' --exclude-table='*."Source"') >$@
112
# `all`: prevents auto-adding a --schema entry
113

  
109 114
py_util.sql:
110 115
	env owners=1 $(call pg_dump,py_util)
111 116

  
trunk/schemas/vegbien.my.sql
13074 13074
-- PostgreSQL database dump complete
13075 13075
--
13076 13076

  
13077
--
13078
-- PostgreSQL database dump
13079
--
13080

  
13081

  
13082

  
13083

  
13084

  
13085

  
13086

  
13087

  
13088
--
13089
-- Name: TNRS; Type: SCHEMA; Schema: -; Owner: -
13090
--
13091

  
13092
CREATE SCHEMA `TNRS`;
13093

  
13094

  
13095
--
13096
-- Name: SCHEMA `TNRS`; Type: COMMENT; Schema: -; Owner: -
13097
--
13098

  
13099

  
13100

  
13101

  
13102
--
13103
-- Name: geoscrub; Type: SCHEMA; Schema: -; Owner: -
13104
--
13105

  
13106
CREATE SCHEMA geoscrub;
13107

  
13108

  
13109

  
13110

  
13111
--
13112
-- Name: batch__fill(); Type: FUNCTION; Schema: TNRS; Owner: -
13113
--
13114

  
13115

  
13116

  
13117

  
13118
--
13119
-- Name: family_is_homonym(varchar(255)); Type: FUNCTION; Schema: TNRS; Owner: -
13120
--
13121

  
13122

  
13123

  
13124

  
13125
--
13126
-- Name: genus_is_homonym(varchar(255)); Type: FUNCTION; Schema: TNRS; Owner: -
13127
--
13128

  
13129

  
13130

  
13131

  
13132
--
13133
-- Name: map_taxonomic_status(varchar(255), varchar(255)); Type: FUNCTION; Schema: TNRS; Owner: -
13134
--
13135

  
13136

  
13137

  
13138

  
13139
--
13140
-- Name: tnrs_populate_fields(); Type: FUNCTION; Schema: TNRS; Owner: -
13141
--
13142

  
13143

  
13144

  
13145

  
13146
--
13147
-- Name: FUNCTION tnrs_populate_fields(); Type: COMMENT; Schema: TNRS; Owner: -
13148
--
13149

  
13150

  
13151

  
13152

  
13153

  
13154

  
13155
--
13156
-- Name: map_coord_validity(int(11)); Type: FUNCTION; Schema: geoscrub; Owner: -
13157
--
13158

  
13159

  
13160

  
13161

  
13162
--
13163
-- Name: map_geovalidity(int(11)); Type: FUNCTION; Schema: geoscrub; Owner: -
13164
--
13165

  
13166

  
13167

  
13168

  
13169

  
13170

  
13171

  
13172

  
13173

  
13174

  
13175
--
13176
-- Name: tnrs; Type: TABLE; Schema: TNRS; Owner: -; Tablespace: 
13177
--
13178

  
13179
CREATE TABLE tnrs (
13180
    batch varchar(255)  NOT NULL,
13181
    `Name_number` int(11) NOT NULL,
13182
    `Name_submitted` varchar(255) NOT NULL,
13183
    `Overall_score` double precision,
13184
    `Name_matched` varchar(255),
13185
    `Name_matched_rank` varchar(255),
13186
    `Name_score` double precision,
13187
    `Name_matched_author` varchar(255),
13188
    `Name_matched_url` varchar(255),
13189
    `Author_matched` varchar(255),
13190
    `Author_score` double precision,
13191
    `Family_matched` varchar(255),
13192
    `Family_score` double precision,
13193
    `Name_matched_accepted_family` varchar(255),
13194
    `Genus_matched` varchar(255),
13195
    `Genus_score` double precision,
13196
    `Specific_epithet_matched` varchar(255),
13197
    `Specific_epithet_score` double precision,
13198
    `Infraspecific_rank` varchar(255),
13199
    `Infraspecific_epithet_matched` varchar(255),
13200
    `Infraspecific_epithet_score` double precision,
13201
    `Infraspecific_rank_2` varchar(255),
13202
    `Infraspecific_epithet_2_matched` varchar(255),
13203
    `Infraspecific_epithet_2_score` double precision,
13204
    `Annotations` varchar(255),
13205
    `Unmatched_terms` varchar(255),
13206
    `Taxonomic_status` varchar(255),
13207
    `Accepted_name` varchar(255),
13208
    `Accepted_name_author` varchar(255),
13209
    `Accepted_name_rank` varchar(255),
13210
    `Accepted_name_url` varchar(255),
13211
    `Accepted_name_species` varchar(255),
13212
    `Accepted_name_family` varchar(255),
13213
    `Selected` varchar(255),
13214
    `Source` varchar(255),
13215
    `Warnings` varchar(255),
13216
    `Accepted_name_lsid` varchar(255),
13217
    is_valid_match int(1) NOT NULL,
13218
    scrubbed_unique_taxon_name varchar(255)
13219
);
13220

  
13221

  
13222
--
13223
-- Name: TABLE tnrs; Type: COMMENT; Schema: TNRS; Owner: -
13224
--
13225

  
13226

  
13227

  
13228

  
13229
--
13230
-- Name: MatchedTaxon; Type: VIEW; Schema: TNRS; Owner: -
13231
--
13232

  
13233

  
13234

  
13235

  
13236
--
13237
-- Name: ValidMatchedTaxon; Type: VIEW; Schema: TNRS; Owner: -
13238
--
13239

  
13240

  
13241

  
13242

  
13243
--
13244
-- Name: VIEW `ValidMatchedTaxon`; Type: COMMENT; Schema: TNRS; Owner: -
13245
--
13246

  
13247

  
13248

  
13249

  
13250
--
13251
-- Name: batch; Type: TABLE; Schema: TNRS; Owner: -; Tablespace: 
13252
--
13253

  
13254
CREATE TABLE batch (
13255
    id varchar(255) NOT NULL,
13256
    id_by_time varchar(255),
13257
    time_submitted timestamp NULL ,
13258
    client_version varchar(255)
13259
);
13260

  
13261

  
13262
--
13263
-- Name: batch_download_settings; Type: TABLE; Schema: TNRS; Owner: -; Tablespace: 
13264
--
13265

  
13266
CREATE TABLE batch_download_settings (
13267
    id varchar(255) NOT NULL,
13268
    `E-mail` varchar(255),
13269
    `Id` varchar(255),
13270
    `Job type` varchar(255),
13271
    `Contains Id` int(1),
13272
    `Start time` varchar(255),
13273
    `Finish time` varchar(255),
13274
    `TNRS version` varchar(255),
13275
    `Sources selected` varchar(255),
13276
    `Match threshold` double precision,
13277
    `Classification` varchar(255),
13278
    `Allow partial matches?` int(1),
13279
    `Sort by source` int(1),
13280
    `Constrain by higher taxonomy` int(1)
13281
);
13282

  
13283

  
13284
--
13285
-- Name: TABLE batch_download_settings; Type: COMMENT; Schema: TNRS; Owner: -
13286
--
13287

  
13288

  
13289

  
13290

  
13291
--
13292
-- Name: client_version; Type: TABLE; Schema: TNRS; Owner: -; Tablespace: 
13293
--
13294

  
13295
CREATE TABLE client_version (
13296
    id varchar(255) NOT NULL,
13297
    global_rev int(11) NOT NULL,
13298
    `/lib/tnrs.py rev` int(11),
13299
    `/bin/tnrs_db rev` int(11)
13300
);
13301

  
13302

  
13303
--
13304
-- Name: TABLE client_version; Type: COMMENT; Schema: TNRS; Owner: -
13305
--
13306

  
13307

  
13308

  
13309

  
13310
--
13311
-- Name: COLUMN client_version.global_rev; Type: COMMENT; Schema: TNRS; Owner: -
13312
--
13313

  
13314

  
13315

  
13316

  
13317
--
13318
-- Name: COLUMN client_version.`/lib/tnrs.py rev`; Type: COMMENT; Schema: TNRS; Owner: -
13319
--
13320

  
13321

  
13322

  
13323

  
13324
--
13325
-- Name: COLUMN client_version.`/bin/tnrs_db rev`; Type: COMMENT; Schema: TNRS; Owner: -
13326
--
13327

  
13328

  
13329

  
13330

  
13331
--
13332
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: VIEW; Schema: TNRS; Owner: -
13333
--
13334

  
13335

  
13336

  
13337

  
13338
--
13339
-- Name: VIEW `taxon_scrub.scrubbed_unique_taxon_name.*`; Type: COMMENT; Schema: TNRS; Owner: -
13340
--
13341

  
13342

  
13343

  
13344

  
13345
--
13346
-- Name: taxon_scrub; Type: VIEW; Schema: TNRS; Owner: -
13347
--
13348

  
13349

  
13350

  
13351

  
13352
--
13353
-- Name: VIEW taxon_scrub; Type: COMMENT; Schema: TNRS; Owner: -
13354
--
13355

  
13356

  
13357

  
13358

  
13359

  
13360

  
13361
--
13362
-- Name: county_centroids; Type: TABLE; Schema: geoscrub; Owner: -; Tablespace: 
13363
--
13364

  
13365
CREATE TABLE county_centroids (
13366
    `*row_num` int(11) NOT NULL,
13367
    `stateProvince` varchar(255),
13368
    county varchar(255),
13369
    `decimalLatitude` double precision,
13370
    `decimalLongitude` double precision,
13371
    `*error_km` double precision
13372
);
13373

  
13374

  
13375
--
13376
-- Name: geoscrub_output; Type: TABLE; Schema: geoscrub; Owner: -; Tablespace: 
13377
--
13378

  
13379
CREATE TABLE geoscrub_output (
13380
    `*row_num` int(11) NOT NULL,
13381
    `decimalLatitude` double precision NOT NULL,
13382
    `decimalLongitude` double precision NOT NULL,
13383
    country varchar(255),
13384
    `stateProvince` varchar(255),
13385
    county varchar(255),
13386
    `acceptedCountry` varchar(255),
13387
    `acceptedStateProvince` varchar(255),
13388
    `acceptedCounty` varchar(255),
13389
    `latLongDomainValid_verbatim` int(11),
13390
    `latLongInCountry_verbatim` int(11),
13391
    `latLongInStateProvince_verbatim` int(11),
13392
    `latLongInCounty_verbatim` int(11),
13393
    `latLongDomainValid` int(1),
13394
    `latLongInCountry` int(1),
13395
    `latLongInStateProvince` int(1),
13396
    `latLongInCounty` int(1),
13397
    geovalid int(1)
13398
);
13399

  
13400

  
13401

  
13402

  
13403
--
13404
-- Name: batch_download_settings_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace: 
13405
--
13406

  
13407
ALTER TABLE batch_download_settings
13408
    ADD CONSTRAINT batch_download_settings_pkey PRIMARY KEY (id);
13409

  
13410

  
13411
--
13412
-- Name: batch_id_by_time_key; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace: 
13413
--
13414

  
13415
ALTER TABLE batch
13416
    ADD CONSTRAINT batch_id_by_time_key UNIQUE (id_by_time);
13417

  
13418

  
13419
--
13420
-- Name: batch_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace: 
13421
--
13422

  
13423
ALTER TABLE batch
13424
    ADD CONSTRAINT batch_pkey PRIMARY KEY (id);
13425

  
13426

  
13427
--
13428
-- Name: client_version_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace: 
13429
--
13430

  
13431
ALTER TABLE client_version
13432
    ADD CONSTRAINT client_version_pkey PRIMARY KEY (id);
13433

  
13434

  
13435
--
13436
-- Name: tnrs_Name_submitted_key; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace: 
13437
--
13438

  
13439
ALTER TABLE tnrs
13440
    ADD CONSTRAINT `tnrs_Name_submitted_key` UNIQUE (`Name_submitted`);
13441

  
13442

  
13443
--
13444
-- Name: tnrs_pkey; Type: CONSTRAINT; Schema: TNRS; Owner: -; Tablespace: 
13445
--
13446

  
13447
ALTER TABLE tnrs
13448
    ADD CONSTRAINT tnrs_pkey PRIMARY KEY (batch, `Name_number`);
13449

  
13450

  
13451

  
13452

  
13453
--
13454
-- Name: county_centroids_pkey; Type: CONSTRAINT; Schema: geoscrub; Owner: -; Tablespace: 
13455
--
13456

  
13457
ALTER TABLE county_centroids
13458
    ADD CONSTRAINT county_centroids_pkey PRIMARY KEY (`*row_num`);
13459

  
13460

  
13461
--
13462
-- Name: geoscrub_output_pkey; Type: CONSTRAINT; Schema: geoscrub; Owner: -; Tablespace: 
13463
--
13464

  
13465
ALTER TABLE geoscrub_output
13466
    ADD CONSTRAINT geoscrub_output_pkey PRIMARY KEY (`*row_num`);
13467

  
13468

  
13469

  
13470

  
13471
--
13472
-- Name: batch_client_version_idx; Type: INDEX; Schema: TNRS; Owner: -; Tablespace: 
13473
--
13474

  
13475
CREATE INDEX batch_client_version_idx ON batch  (client_version);
13476

  
13477

  
13478
--
13479
-- Name: tnrs__valid_match; Type: INDEX; Schema: TNRS; Owner: -; Tablespace: 
13480
--
13481

  
13482

  
13483

  
13484

  
13485

  
13486

  
13487
--
13488
-- Name: geoscrub_output__unique; Type: INDEX; Schema: geoscrub; Owner: -; Tablespace: 
13489
--
13490

  
13491

  
13492

  
13493

  
13494

  
13495

  
13496
--
13497
-- Name: batch__fill; Type: TRIGGER; Schema: TNRS; Owner: -
13498
--
13499

  
13500

  
13501

  
13502

  
13503
--
13504
-- Name: tnrs_populate_fields; Type: TRIGGER; Schema: TNRS; Owner: -
13505
--
13506

  
13507

  
13508

  
13509

  
13510
--
13511
-- Name: batch_client_version_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
13512
--
13513

  
13514
ALTER TABLE batch
13515
    ADD CONSTRAINT batch_client_version_fkey FOREIGN KEY (client_version) REFERENCES client_version(id) ON UPDATE CASCADE ON DELETE CASCADE;
13516

  
13517

  
13518
--
13519
-- Name: batch_download_settings_id_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
13520
--
13521

  
13522
ALTER TABLE batch_download_settings
13523
    ADD CONSTRAINT batch_download_settings_id_fkey FOREIGN KEY (id) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
13524

  
13525

  
13526
--
13527
-- Name: tnrs_batch_fkey; Type: FK CONSTRAINT; Schema: TNRS; Owner: -
13528
--
13529

  
13530
ALTER TABLE tnrs
13531
    ADD CONSTRAINT tnrs_batch_fkey FOREIGN KEY (batch) REFERENCES batch(id) ON UPDATE CASCADE ON DELETE CASCADE;
13532

  
13533

  
13534
--
13535
-- Name: TNRS; Type: ACL; Schema: -; Owner: -
13536
--
13537

  
13538

  
13539

  
13540

  
13541

  
13542

  
13543

  
13544
--
13545
-- Name: tnrs; Type: ACL; Schema: TNRS; Owner: -
13546
--
13547

  
13548

  
13549

  
13550

  
13551

  
13552

  
13553

  
13554
--
13555
-- Name: MatchedTaxon; Type: ACL; Schema: TNRS; Owner: -
13556
--
13557

  
13558

  
13559

  
13560

  
13561

  
13562

  
13563

  
13564
--
13565
-- Name: ValidMatchedTaxon; Type: ACL; Schema: TNRS; Owner: -
13566
--
13567

  
13568

  
13569

  
13570

  
13571

  
13572

  
13573

  
13574
--
13575
-- Name: taxon_scrub.scrubbed_unique_taxon_name.*; Type: ACL; Schema: TNRS; Owner: -
13576
--
13577

  
13578

  
13579

  
13580

  
13581

  
13582

  
13583

  
13584
--
13585
-- Name: taxon_scrub; Type: ACL; Schema: TNRS; Owner: -
13586
--
13587

  
13588

  
13589

  
13590

  
13591

  
13592

  
13593

  
13594
--
13595
-- PostgreSQL database dump complete
13596
--
13597

  
trunk/schemas/public_.sql
1
--
2
-- PostgreSQL database dump
3
--
4

  
5
SET statement_timeout = 0;
6
SET lock_timeout = 0;
7
SET client_encoding = 'UTF8';
8
SET standard_conforming_strings = on;
9
SET check_function_bodies = false;
10
SET client_min_messages = warning;
11

  
12
--
13
-- Name: public_validations; Type: SCHEMA; Schema: -; Owner: -
14
--
15

  
16
CREATE SCHEMA public_validations;
17

  
18

  
19
--
20
-- Name: SCHEMA public_validations; Type: COMMENT; Schema: -; Owner: -
21
--
22

  
23
COMMENT ON SCHEMA public_validations IS '
24
aggregating validations queries
25

  
26
to run the validations on all datasources:
27
SELECT public_validations.remake_diff_tables();
28

  
29
to run the validations on a particular datasource:
30
SELECT public_validations.remake_diff_tables(''datasource'');
31

  
32
to run a particular validations query for a datasource:
33
SELECT public_validations.remake_diff_table(''"datasource"._view_name'');
34

  
35
to reset the queries to what''s in schemas/vegbien.sql:
36
SELECT public_validations.rm_output_queries();
37
run the portion of schemas/vegbien.sql from
38
SET search_path = public_validations, pg_catalog;
39
to the last _* view
40
**IMPORTANT**: run every `CREATE TYPE` with a comment containing "custom"
41

  
42
to remove a validations query so its columns can be changed:
43
SELECT public_validations.rm_output_queries(''public_validations._view_name'');
44
	-- not rm_query_view() because that also removes input queries
45

  
46
to change the key and value columns for a validations query:
47
DROP   TYPE public_validations."keys_~type._view_name"    CASCADE;
48
CREATE TYPE public_validations."keys_~type._view_name"    AS (key_cols);
49
DROP   TYPE public_validations."values__~type._view_name" CASCADE;
50
CREATE TYPE public_validations."values__~type._view_name" AS (value_cols);
51
SELECT public_validations.remake_diff_table(''"datasource"._view_name'');
52

  
53
to reset the key and value columns for all validations queries:
54
SELECT public_validations.rm_output_queries();
55
reset the queries to what''s in schemas/vegbien.sql, as described above
56
SELECT public_validations.remake_diff_tables();
57
';
58

  
59

  
60
SET search_path = public, pg_catalog;
61

  
62
--
63
-- Name: accesslevel; Type: TYPE; Schema: public; Owner: -
64
--
65

  
66
CREATE TYPE accesslevel AS ENUM (
67
    'private',
68
    'metadata only',
69
    'data by request',
70
    'public'
71
);
72

  
73

  
74
--
75
-- Name: coordinatesource; Type: TYPE; Schema: public; Owner: -
76
--
77

  
78
CREATE TYPE coordinatesource AS ENUM (
79
    'source data',
80
    'GPS',
81
    'georeferencing'
82
);
83

  
84

  
85
--
86
-- Name: TYPE coordinatesource; Type: COMMENT; Schema: public; Owner: -
87
--
88

  
89
COMMENT ON TYPE coordinatesource IS '
90
From <https://projects.nceas.ucsb.edu/nceas/projects/bien/wiki/VegCore_data_dictionary#coordinateSource>
91
';
92

  
93

  
94
--
95
-- Name: establishmentmeans_dwc; Type: TYPE; Schema: public; Owner: -
96
--
97

  
98
CREATE TYPE establishmentmeans_dwc AS ENUM (
99
    'cultivated',
100
    'wild',
101
    'native',
102
    'exotic',
103
    'invasive',
104
    'escaped from captivity'
105
);
106

  
107

  
108
--
109
-- Name: TYPE establishmentmeans_dwc; Type: COMMENT; Schema: public; Owner: -
110
--
111

  
112
COMMENT ON TYPE establishmentmeans_dwc IS '
113
See <http://rs.tdwg.org/dwc/terms/#establishmentMeans>
114
';
115

  
116

  
117
--
118
-- Name: growthform; Type: TYPE; Schema: public; Owner: -
119
--
120

  
121
CREATE TYPE growthform AS ENUM (
122
    'tree',
123
    'shrub',
124
    'liana',
125
    'vine',
126
    'herb',
127
    'hemiepiphyte',
128
    'epiphyte',
129
    'grass',
130
    'forb',
131
    'moss',
132
    'lichen',
133
    'fungus',
134
    'floating aquatic',
135
    'submerged aquatic'
136
);
137

  
138

  
139
--
140
-- Name: higher_plant_group; Type: TYPE; Schema: public; Owner: -
141
--
142

  
143
CREATE TYPE higher_plant_group AS ENUM (
144
    'all',
145
    'bryophytes',
146
    'ferns and allies',
147
    'flowering plants',
148
    'gymnosperms (conifers)',
149
    'gymnosperms (non-conifer)'
150
);
151

  
152

  
153
--
154
-- Name: observationtype; Type: TYPE; Schema: public; Owner: -
155
--
156

  
157
CREATE TYPE observationtype AS ENUM (
158
    'plot',
159
    'specimen'
160
);
161

  
162

  
163
--
164
-- Name: occurrencestatus_dwc; Type: TYPE; Schema: public; Owner: -
165
--
166

  
167
CREATE TYPE occurrencestatus_dwc AS ENUM (
168
    'present',
169
    'absent',
170
    'common',
171
    'irregular',
172
    'rare',
173
    'doubtful'
174
);
175

  
176

  
177
--
178
-- Name: placerank; Type: TYPE; Schema: public; Owner: -
179
--
180

  
181
CREATE TYPE placerank AS ENUM (
182
    'continent',
183
    'waterBody',
184
    'islandGroup',
185
    'island',
186
    'country',
187
    'territory',
188
    'region',
189
    'stateProvince',
190
    'county',
191
    'municipality',
192
    'village',
193
    'site'
194
);
195

  
196

  
197
--
198
-- Name: TYPE placerank; Type: COMMENT; Schema: public; Owner: -
199
--
200

  
201
COMMENT ON TYPE placerank IS '
202
county = parish, canton
203
municipality = city
204

  
205
From <http://rs.tdwg.org/dwc/terms/#dcindex#dcterms:Location>, <http://vegbank.org/vegbank/views/dba_fielddescription_detail.jsp?view=detail&wparam=1415&entity=dba_fielddescription&params=1415>
206
';
207

  
208

  
209
--
210
-- Name: rankedplacename; Type: TYPE; Schema: public; Owner: -
211
--
212

  
213
CREATE TYPE rankedplacename AS (
214
	rank placerank,
215
	verbatimrank text,
216
	placename text
217
);
218

  
219

  
220
--
221
-- Name: taxonrank; Type: TYPE; Schema: public; Owner: -
222
--
223

  
224
CREATE TYPE taxonrank AS ENUM (
225
    'unknown',
226
    'suprageneric',
227
    'domain',
228
    'superkingdom',
229
    'kingdom',
230
    'subkingdom',
231
    'infrakingdom',
232
    'superphylum',
233
    'phylum',
234
    'subphylum',
235
    'infraphylum',
236
    'superclass',
237
    'class',
238
    'subclass',
239
    'infraclass',
240
    'superorder',
241
    'order',
242
    'suborder',
243
    'infraorder',
244
    'family group',
245
    'superfamily',
246
    'family',
247
    'subfamily',
248
    'infrafamily',
249
    'family subdivision',
250
    'supertribe',
251
    'tribe',
252
    'subtribe',
253
    'infratribe',
254
    'genus group',
255
    'genus',
256
    'subgenus',
257
    'infragenus',
258
    'genus subdivision',
259
    'section',
260
    'subsection',
261
    'series',
262
    'subseries',
263
    'infrageneric',
264
    'species aggregate',
265
    'species group',
266
    'species',
267
    'subspecies',
268
    'subspecific aggregate',
269
    'below subspecies',
270
    'infraspecies',
271
    'biovariety',
272
    'pathovariety',
273
    'variety',
274
    'subvariety',
275
    'subsubvariety',
276
    'forma',
277
    'subforma',
278
    'subsubforma',
279
    'special forma',
280
    'infraspecific',
281
    'candidate',
282
    'cultivated plants',
283
    'cultivar',
284
    'convar',
285
    'grex',
286
    'cultivar group',
287
    'graft-chimaera',
288
    'denomination class'
289
);
290

  
291

  
292
--
293
-- Name: TYPE taxonrank; Type: COMMENT; Schema: public; Owner: -
294
--
295

  
296
COMMENT ON TYPE taxonrank IS '
297
From <http://www.tdwg.org/standards/117/download/>
298
';
299

  
300

  
301
--
302
-- Name: rankedtaxonname; Type: TYPE; Schema: public; Owner: -
303
--
304

  
305
CREATE TYPE rankedtaxonname AS (
306
	rank taxonrank,
307
	verbatimrank text,
308
	taxonname text
309
);
310

  
311

  
312
--
313
-- Name: relationship; Type: TYPE; Schema: public; Owner: -
314
--
315

  
316
CREATE TYPE relationship AS ENUM (
317
    'is congruent to',
318
    'is not congruent to',
319
    'is included in',
320
    'is not included in',
321
    'overlaps',
322
    'does not overlap',
323
    'is child taxon of',
324
    'is anamorph of',
325
    'is teleomorph of',
326
    'is hybrid child of',
327
    'is ambiregnal of',
328
    'is vernacular for'
329
);
330

  
331

  
332
--
333
-- Name: role; Type: TYPE; Schema: public; Owner: -
334
--
335

  
336
CREATE TYPE role AS ENUM (
337
    'unknown',
338
    'advisor',
339
    'author',
340
    'co-principal investigator',
341
    'collector',
342
    'computer',
343
    'contact',
344
    'contributor',
345
    'custodian/steward',
346
    'editor',
347
    'identifier',
348
    'originator',
349
    'performer',
350
    'principal investigator',
351
    'recipient',
352
    'reviewer',
353
    'technician'
354
);
355

  
356

  
357
--
358
-- Name: TYPE role; Type: COMMENT; Schema: public; Owner: -
359
--
360

  
361
COMMENT ON TYPE role IS '
362
From <http://vegbank.org/vegbank/views/dba_fielddescription_detail.jsp?view=detail&wparam=1331&entity=dba_fielddescription&params=1331>, <http://vegbank.org/vegbank/views/dba_tabledescription_detail.jsp?view=detail&wparam=projectcontributor&entity=dba_tabledescription&where=where_tablename#ROLE_ID>, and misc terms.
363
';
364

  
365

  
366
--
367
-- Name: schema_anchor; Type: TYPE; Schema: public; Owner: -
368
--
369

  
370
CREATE TYPE schema_anchor AS (
371
);
372

  
373

  
374
--
375
-- Name: TYPE schema_anchor; Type: COMMENT; Schema: public; Owner: -
376
--
377

  
378
COMMENT ON TYPE schema_anchor IS 'used with schema_anchor params';
379

  
380

  
381
--
382
-- Name: sourcetype; Type: TYPE; Schema: public; Owner: -
383
--
384

  
385
CREATE TYPE sourcetype AS ENUM (
386
    'herbarium',
387
    'primary database',
388
    'aggregator',
389
    'book',
390
    'article',
391
    'chapter',
392
    'conference proceedings',
393
    'dissertation',
394
    'edited book',
395
    'generic',
396
    'journal',
397
    'manuscript',
398
    'personal communication',
399
    'presentation',
400
    'report',
401
    'thesis',
402
    'website'
403
);
404

  
405

  
406
--
407
-- Name: TYPE sourcetype; Type: COMMENT; Schema: public; Owner: -
408
--
409

  
410
COMMENT ON TYPE sourcetype IS '
411
From <https://projects.nceas.ucsb.edu/nceas/attachments/download/428/bien_web_datasource_schema.sql>, <http://vegbank.org/vegbank/views/dba_fielddescription_detail.jsp?view=detail&wparam=1300&entity=dba_fielddescription&params=1300>, <http://vegbiendev.nceas.ucsb.edu/phppgadmin/display.php?server=localhost%3A5432%3Aallow&database=vegbien&schema=VegBank&table=source&subject=table#sourcetype>
412
';
413

  
414

  
415
--
416
-- Name: taxonclass; Type: TYPE; Schema: public; Owner: -
417
--
418

  
419
CREATE TYPE taxonclass AS ENUM (
420
    'tree',
421
    'shrub',
422
    'liana',
423
    'vine',
424
    'herb',
425
    'hemiepiphyte',
426
    'epiphyte',
427
    'grass',
428
    'forb',
429
    'moss',
430
    'lichen',
431
    'fungus',
432
    'floating aquatic',
433
    'submerged aquatic',
434
    'cultivated',
435
    'wild',
436
    'native',
437
    'exotic',
438
    'invasive',
439
    'escaped from captivity',
440
    'dominant',
441
    'vascular',
442
    'woody'
443
);
444

  
445

  
446
--
447
-- Name: TYPE taxonclass; Type: COMMENT; Schema: public; Owner: -
448
--
449

  
450
COMMENT ON TYPE taxonclass IS '
451
= growthform + establishmentmeans_dwc + some others
452
';
453

  
454

  
455
--
456
-- Name: taxonomic_status; Type: TYPE; Schema: public; Owner: -
457
--
458

  
459
CREATE TYPE taxonomic_status AS ENUM (
460
    'No opinion',
461
    'Accepted',
462
    'Synonym',
463
    'Illegitimate',
464
    'Invalid'
465
);
466

  
467

  
468
--
469
-- Name: TYPE taxonomic_status; Type: COMMENT; Schema: public; Owner: -
470
--
471

  
472
COMMENT ON TYPE taxonomic_status IS '
473
See <http://tnrs.iplantcollaborative.org/instructions.html#Status>
474
';
475

  
476

  
477
SET search_path = public_validations, pg_catalog;
478

  
479
--
480
-- Name: keys_~type._plots_01_count_of_projects; Type: TYPE; Schema: public_validations; Owner: -
481
--
482

  
483
CREATE TYPE "keys_~type._plots_01_count_of_projects" AS (
484
);
485

  
486

  
487
--
488
-- Name: keys_~type._plots_02_list_of_project_names; Type: TYPE; Schema: public_validations; Owner: -
489
--
490

  
491
CREATE TYPE "keys_~type._plots_02_list_of_project_names" AS (
492
	project_name text
493
);
494

  
495

  
496
--
497
-- Name: keys_~type._plots_03_count_of_all_plots_in_this_source; Type: TYPE; Schema: public_validations; Owner: -
498
--
499

  
500
CREATE TYPE "keys_~type._plots_03_count_of_all_plots_in_this_source" AS (
501
);
502

  
503

  
504
--
505
-- Name: keys_~type._plots_04_count_of_plots_in_each_project_in_this_sou; Type: TYPE; Schema: public_validations; Owner: -
506
--
507

  
508
CREATE TYPE "keys_~type._plots_04_count_of_plots_in_each_project_in_this_sou" AS (
509
	project_name text
510
);
511

  
512

  
513
--
514
-- Name: keys_~type._plots_05_list_of_plot_codes_by_project; Type: TYPE; Schema: public_validations; Owner: -
515
--
516

  
517
CREATE TYPE "keys_~type._plots_05_list_of_plot_codes_by_project" AS (
518
	project_name text,
519
	plot_code text
520
);
521

  
522

  
523
--
524
-- Name: keys_~type._plots_06_list_of_plots_with_stem_measurements; Type: TYPE; Schema: public_validations; Owner: -
525
--
526

  
527
CREATE TYPE "keys_~type._plots_06_list_of_plots_with_stem_measurements" AS (
528
	project_name text,
529
	plot_code text
530
);
531

  
532

  
533
--
534
-- Name: keys_~type._plots_06a_list_of_stems; Type: TYPE; Schema: public_validations; Owner: -
535
--
536

  
537
CREATE TYPE "keys_~type._plots_06a_list_of_stems" AS (
538
	project_name text,
539
	plot_code text,
540
	stem_id text
541
);
542

  
543

  
544
--
545
-- Name: keys_~type._plots_07_list_of_plots_which_use_counts_of_indiv_pe; Type: TYPE; Schema: public_validations; Owner: -
546
--
547

  
548
CREATE TYPE "keys_~type._plots_07_list_of_plots_which_use_counts_of_indiv_pe" AS (
549
	project_name text,
550
	plot_code text
551
);
552

  
553

  
554
--
555
-- Name: keys_~type._plots_08_list_of_plots_which_use_percent_cover; Type: TYPE; Schema: public_validations; Owner: -
556
--
557

  
558
CREATE TYPE "keys_~type._plots_08_list_of_plots_which_use_percent_cover" AS (
559
	project_name text,
560
	plot_code text
561
);
562

  
563

  
564
--
565
-- Name: keys_~type._plots_09_list_of_plots_which_use_line_intercept; Type: TYPE; Schema: public_validations; Owner: -
566
--
567

  
568
CREATE TYPE "keys_~type._plots_09_list_of_plots_which_use_line_intercept" AS (
569
	project_name text,
570
	plot_code text
571
);
572

  
573

  
574
--
575
-- Name: keys_~type._plots_10_count_of_individuals_per_plot_in_each_proj; Type: TYPE; Schema: public_validations; Owner: -
576
--
577

  
578
CREATE TYPE "keys_~type._plots_10_count_of_individuals_per_plot_in_each_proj" AS (
579
	project_name text,
580
	plot_code text
581
);
582

  
583

  
584
--
585
-- Name: keys_~type._plots_10a_aggregate_observation_individual_counts; Type: TYPE; Schema: public_validations; Owner: -
586
--
587

  
588
CREATE TYPE "keys_~type._plots_10a_aggregate_observation_individual_counts" AS (
589
	project_name text,
590
	plot_code text,
591
	individual_id text
592
);
593

  
594

  
595
--
596
-- Name: keys_~type._plots_11_count_of_stems_per_plot_in_each_project; Type: TYPE; Schema: public_validations; Owner: -
597
--
598

  
599
CREATE TYPE "keys_~type._plots_11_count_of_stems_per_plot_in_each_project" AS (
600
	project_name text,
601
	plot_code text
602
);
603

  
604

  
605
--
606
-- Name: keys_~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_pr; Type: TYPE; Schema: public_validations; Owner: -
607
--
608

  
609
CREATE TYPE "keys_~type._plots_12_count_of_verbatim_taxa_per_plot_in_each_pr" AS (
610
	project_name text,
611
	plot_code text
612
);
613

  
614

  
615
--
616
-- Name: keys_~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plo; Type: TYPE; Schema: public_validations; Owner: -
617
--
618

  
619
CREATE TYPE "keys_~type._plots_13_list_of_distinct_verbatim_taxa_in_each_plo" AS (
620
	project_name text,
621
	plot_code text,
622
	taxon text
623
);
624

  
625

  
626
--
627
-- Name: keys_~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot; Type: TYPE; Schema: public_validations; Owner: -
628
--
629

  
630
CREATE TYPE "keys_~type._plots_14_count_of_indiv_per_verbatim_taxon_per_plot" AS (
631
	project_name text,
632
	plot_code text,
633
	taxon text
634
);
635

  
636

  
637
--
638
-- Name: keys_~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_; Type: TYPE; Schema: public_validations; Owner: -
639
--
640

  
641
CREATE TYPE "keys_~type._plots_15_pct_cover_of_each_verb_taxon_in_each_plot_" AS (
642
	project_name text,
643
	plot_code text,
644
	taxon text,
645
	totalpercentcover double precision
646
);
647

  
648

  
649
--
650
-- Name: keys_~type._plots_16_intercepts_for_each_verb_taxon_in_each_plo; Type: TYPE; Schema: public_validations; Owner: -
651
--
652

  
653
CREATE TYPE "keys_~type._plots_16_intercepts_for_each_verb_taxon_in_each_plo" AS (
654
	project_name text,
655
	plot_code text,
656
	taxon text
657
);
658

  
659

  
660
--
661
-- Name: keys_~type._plots_17_count_of_subplots_per_plot_for_each_projec; Type: TYPE; Schema: public_validations; Owner: -
662
--
663

  
664
CREATE TYPE "keys_~type._plots_17_count_of_subplots_per_plot_for_each_projec" AS (
665
	project_name text,
666
	plot_code text
667
);
668

  
669

  
670
--
671
-- Name: keys_~type._plots_18_list_of_subplots_codes_for_each_plot_for_e; Type: TYPE; Schema: public_validations; Owner: -
672
--
673

  
674
CREATE TYPE "keys_~type._plots_18_list_of_subplots_codes_for_each_plot_for_e" AS (
675
	project_name text,
676
	plot_code text,
677
	subplot_code text
678
);
679

  
680

  
681
--
682
-- Name: keys_~type._plots_19_count_of_censuses_per_plot_in_each_project; Type: TYPE; Schema: public_validations; Owner: -
683
--
684

  
685
CREATE TYPE "keys_~type._plots_19_count_of_censuses_per_plot_in_each_project" AS (
686
	project_name text,
687
	plot_code text
688
);
689

  
690

  
691
--
692
-- Name: TYPE "keys_~type._plots_19_count_of_censuses_per_plot_in_each_project"; Type: COMMENT; Schema: public_validations; Owner: -
693
--
694

  
695
COMMENT ON TYPE "keys_~type._plots_19_count_of_censuses_per_plot_in_each_project" IS '
696
autogenerated
697
';
698

  
699

  
700
--
701
-- Name: keys_~type._specimens_01_count_of_total_records_specimens_in_so; Type: TYPE; Schema: public_validations; Owner: -
702
--
703

  
704
CREATE TYPE "keys_~type._specimens_01_count_of_total_records_specimens_in_so" AS (
705
);
706

  
707

  
708
--
709
-- Name: TYPE "keys_~type._specimens_01_count_of_total_records_specimens_in_so"; Type: COMMENT; Schema: public_validations; Owner: -
710
--
711

  
712
COMMENT ON TYPE "keys_~type._specimens_01_count_of_total_records_specimens_in_so" IS '
713
autogenerated
714
';
715

  
716

  
717
--
718
-- Name: keys_~type._specimens_02_count_of_unique_verbatim_families; Type: TYPE; Schema: public_validations; Owner: -
719
--
720

  
721
CREATE TYPE "keys_~type._specimens_02_count_of_unique_verbatim_families" AS (
722
);
723

  
724

  
725
--
726
-- Name: TYPE "keys_~type._specimens_02_count_of_unique_verbatim_families"; Type: COMMENT; Schema: public_validations; Owner: -
727
--
728

  
729
COMMENT ON TYPE "keys_~type._specimens_02_count_of_unique_verbatim_families" IS '
730
autogenerated
731
';
732

  
733

  
734
--
735
-- Name: keys_~type._specimens_03_list_of_verbatim_families; Type: TYPE; Schema: public_validations; Owner: -
736
--
737

  
738
CREATE TYPE "keys_~type._specimens_03_list_of_verbatim_families" AS (
739
	family text
740
);
741

  
742

  
743
--
744
-- Name: TYPE "keys_~type._specimens_03_list_of_verbatim_families"; Type: COMMENT; Schema: public_validations; Owner: -
745
--
746

  
747
COMMENT ON TYPE "keys_~type._specimens_03_list_of_verbatim_families" IS '
748
autogenerated
749
';
750

  
751

  
752
--
753
-- Name: keys_~type._specimens_04_count_of_species_binomials; Type: TYPE; Schema: public_validations; Owner: -
754
--
755

  
756
CREATE TYPE "keys_~type._specimens_04_count_of_species_binomials" AS (
757
);
758

  
759

  
760
--
761
-- Name: TYPE "keys_~type._specimens_04_count_of_species_binomials"; Type: COMMENT; Schema: public_validations; Owner: -
762
--
763

  
764
COMMENT ON TYPE "keys_~type._specimens_04_count_of_species_binomials" IS '
765
autogenerated
766
';
767

  
768

  
769
--
770
-- Name: keys_~type._specimens_05_list_of_species_binomials; Type: TYPE; Schema: public_validations; Owner: -
771
--
772

  
773
CREATE TYPE "keys_~type._specimens_05_list_of_species_binomials" AS (
774
	species_binomial text
775
);
776

  
777

  
778
--
779
-- Name: TYPE "keys_~type._specimens_05_list_of_species_binomials"; Type: COMMENT; Schema: public_validations; Owner: -
780
--
781

  
782
COMMENT ON TYPE "keys_~type._specimens_05_list_of_species_binomials" IS '
783
autogenerated
784
';
785

  
786

  
787
--
788
-- Name: keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a; Type: TYPE; Schema: public_validations; Owner: -
789
--
790

  
791
CREATE TYPE "keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a" AS (
792
);
793

  
794

  
795
--
796
-- Name: TYPE "keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a"; Type: COMMENT; Schema: public_validations; Owner: -
797
--
798

  
799
COMMENT ON TYPE "keys_~type._specimens_06_count_of_unique_verb_subsp_taxa_with_a" IS '
800
autogenerated
801
';
802

  
803

  
804
--
805
-- Name: keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with; Type: TYPE; Schema: public_validations; Owner: -
806
--
807

  
808
CREATE TYPE "keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with" AS (
809
	taxon_name_with_author text
810
);
811

  
812

  
813
--
814
-- Name: TYPE "keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with"; Type: COMMENT; Schema: public_validations; Owner: -
815
--
816

  
817
COMMENT ON TYPE "keys_~type._specimens_07_list_of_verbatim_subspecific_taxa_with" IS '
818
autogenerated
819
';
820

  
821

  
822
--
823
-- Name: keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w; Type: TYPE; Schema: public_validations; Owner: -
824
--
825

  
826
CREATE TYPE "keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w" AS (
827
);
828

  
829

  
830
--
831
-- Name: TYPE "keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w"; Type: COMMENT; Schema: public_validations; Owner: -
832
--
833

  
834
COMMENT ON TYPE "keys_~type._specimens_08_count_of_unique_verbatim_author_taxa_w" IS '
835
autogenerated
836
';
837

  
838

  
839
--
840
-- Name: keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi; Type: TYPE; Schema: public_validations; Owner: -
841
--
842

  
843
CREATE TYPE "keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi" AS (
844
	taxon_name_with_author text
845
);
846

  
847

  
848
--
849
-- Name: TYPE "keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi"; Type: COMMENT; Schema: public_validations; Owner: -
850
--
851

  
852
COMMENT ON TYPE "keys_~type._specimens_09_list_of_unique_verbatim_author_taxa_wi" IS '
853
autogenerated
854
';
855

  
856

  
857
--
858
-- Name: keys_~type._specimens_10_count_number_of_records_by_institution; Type: TYPE; Schema: public_validations; Owner: -
859
--
860

  
861
CREATE TYPE "keys_~type._specimens_10_count_number_of_records_by_institution" AS (
862
	specimen_duplicate_institutions text
863
);
864

  
865

  
866
--
867
-- Name: TYPE "keys_~type._specimens_10_count_number_of_records_by_institution"; Type: COMMENT; Schema: public_validations; Owner: -
868
--
869

  
870
COMMENT ON TYPE "keys_~type._specimens_10_count_number_of_records_by_institution" IS '
871
autogenerated
872
';
873

  
874

  
875
--
876
-- Name: keys_~type._specimens_11_list_of_three_standard_political_divis; Type: TYPE; Schema: public_validations; Owner: -
877
--
878

  
879
CREATE TYPE "keys_~type._specimens_11_list_of_three_standard_political_divis" AS (
880
	country text,
881
	"stateProvince" text,
882
	county text
883
);
884

  
885

  
886
--
887
-- Name: TYPE "keys_~type._specimens_11_list_of_three_standard_political_divis"; Type: COMMENT; Schema: public_validations; Owner: -
888
--
889

  
890
COMMENT ON TYPE "keys_~type._specimens_11_list_of_three_standard_political_divis" IS '
891
autogenerated
892
';
893

  
894

  
895
--
896
-- Name: keys_~type._specimens_12_distinct_collector_name_collect_num_da; Type: TYPE; Schema: public_validations; Owner: -
897
--
898

  
899
CREATE TYPE "keys_~type._specimens_12_distinct_collector_name_collect_num_da" AS (
900
	"collectorName" text,
901
	"collectionNumber" text,
902
	"dateCollected" text
903
);
904

  
905

  
906
--
907
-- Name: TYPE "keys_~type._specimens_12_distinct_collector_name_collect_num_da"; Type: COMMENT; Schema: public_validations; Owner: -
908
--
909

  
910
COMMENT ON TYPE "keys_~type._specimens_12_distinct_collector_name_collect_num_da" IS '
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff