Project

General

Profile

« Previous | Next » 

Revision 6265

schemas/vegbien.sql: place: Removed placecode to prevent datasources from creating duplicate entries for the same place, with different placecodes. This was a problem with the original BIEN2 geoscrub dataset, which contained duplicates.

View differences:

inputs/.geoscrub/geoscrub_output/VegBIEN.csv
11 11
countryvalidity,"/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geovalid/_first/2/_and/1/_map:[""-1""=,./{0,1,2}=false,3=true]/value",
12 12
stateprovincevalidity,"/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geovalid/_first/2/_and/2/_map:[""-1""=,./{0,1,2}=false,3=true]/value",
13 13
stateprovince,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/stateprovince/_first/2,
14
countryvalidity,"/location/locationplace/*_id/place/placecode/_if[@name=""if geovalidation""]/cond/_exists/_map:[""-1""=,./{0,1,2}=false,3=true]/value",
15 14
stateprovince,/location/locationplace/*_id/place/stateprovince,
16 15
county,,** No non-empty join mapping for OMIT ** Not yet used by VegBIEN (would prevent the places from matching up)
17 16
countystd,,** No join mapping for *countystd ** 
schemas/vegbien.my.sql
287 287
CREATE TABLE place (
288 288
    place_id int(11) NOT NULL,
289 289
    source_id int(11) NOT NULL,
290
    placecode text,
291 290
    canon_place_id int(11),
292 291
    matched_place_id int(11),
293 292
    coordinates_id int(11),
......
5013 5012

  
5014 5013

  
5015 5014
--
5016
-- Name: place_unique_within_creator_by_code; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5017
--
5018

  
5019

  
5020

  
5021

  
5022
--
5023 5015
-- Name: place_unique_within_creator_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
5024 5016
--
5025 5017

  
schemas/vegbien.sql
628 628
CREATE TABLE place (
629 629
    place_id integer NOT NULL,
630 630
    source_id integer NOT NULL,
631
    placecode text,
632 631
    canon_place_id integer,
633 632
    matched_place_id integer,
634 633
    coordinates_id integer,
......
641 640
    geovalid boolean,
642 641
    distance_to_country_m double precision,
643 642
    distance_to_state_m double precision,
644
    CONSTRAINT place_required_key CHECK (((((((placecode IS NOT NULL) OR (coordinates_id IS NOT NULL)) OR (continent IS NOT NULL)) OR (country IS NOT NULL)) OR (stateprovince IS NOT NULL)) OR (county IS NOT NULL)))
643
    CONSTRAINT place_required_key CHECK ((((((coordinates_id IS NOT NULL) OR (continent IS NOT NULL)) OR (country IS NOT NULL)) OR (stateprovince IS NOT NULL)) OR (county IS NOT NULL)))
645 644
);
646 645

  
647 646

  
......
6004 6003

  
6005 6004

  
6006 6005
--
6007
-- Name: place_unique_within_creator_by_code; Type: INDEX; Schema: public; Owner: -; Tablespace: 
6008
--
6009

  
6010
CREATE UNIQUE INDEX place_unique_within_creator_by_code ON place USING btree (source_id, (COALESCE(placecode, '\N'::text))) WHERE (placecode IS NOT NULL);
6011

  
6012

  
6013
--
6014 6006
-- Name: place_unique_within_creator_by_name; Type: INDEX; Schema: public; Owner: -; Tablespace: 
6015 6007
--
6016 6008

  
6017
CREATE UNIQUE INDEX place_unique_within_creator_by_name ON place USING btree (source_id, (COALESCE(continent, '\N'::text)), (COALESCE(country, '\N'::text)), (COALESCE(stateprovince, '\N'::text)), (COALESCE(county, '\N'::text)), (COALESCE(coordinates_id, 2147483647))) WHERE (placecode IS NULL);
6009
CREATE UNIQUE INDEX place_unique_within_creator_by_name ON place USING btree (source_id, (COALESCE(continent, '\N'::text)), (COALESCE(country, '\N'::text)), (COALESCE(stateprovince, '\N'::text)), (COALESCE(county, '\N'::text)), (COALESCE(coordinates_id, 2147483647)));
6018 6010

  
6019 6011

  
6020 6012
--
mappings/VegCore-VegBIEN.csv
338 338
latLongInCountry,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geovalid/_first/2/_and/1,
339 339
latLongInStateProvince,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geovalid/_first/2/_and/2,
340 340
stateProvince,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/stateprovince/_first/2,
341
georeferenceValid,"/location/locationplace/*_id/place/placecode/_if[@name=""if geovalidation""]/cond/_exists",
342
latLongInCountry,"/location/locationplace/*_id/place/placecode/_if[@name=""if geovalidation""]/cond/_exists",
343
locationID,"/location/locationplace/*_id/place/placecode/_if[@name=""if geovalidation""]/then",
344 341
stateProvince,/location/locationplace/*_id/place/stateprovince,
345 342
plotNotes,/location/notespublic,
346 343
parentPlotName,/location/parent_id/location/authorlocationcode,
mappings/for_review/VegCore-VegBIEN.csv
338 338
latLongInCountry,//place/geovalid,
339 339
latLongInStateProvince,//place/geovalid,
340 340
stateProvince,//place/stateprovince,
341
georeferenceValid,"//place/placecode/_if[@name=""if geovalidation""]/cond/_exists",
342
latLongInCountry,"//place/placecode/_if[@name=""if geovalidation""]/cond/_exists",
343
locationID,"//place/placecode/_if[@name=""if geovalidation""]/then",
344 341
stateProvince,//place/stateprovince,
345 342
plotNotes,//location/notespublic,
346 343
parentPlotName,//location/authorlocationcode,

Also available in: Unified diff