Project

General

Profile

« Previous | Next » 

Revision 6185

schemas/vegbien.sql: place: Renamed geosource_valid to geovalid. (It had gotten renamed in the reference -> source rename.)

View differences:

inputs/.geoscrub/geoscrub_cleaned_unique/VegBIEN.csv
14 14
distErrStateProvince,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/distance_to_state_m/_km_to_m/value,"Assuming units based on the range of values and the circumference of the Earth [1].
15 15

  
16 16
[1] ""Circumference 40,075.017 km"" (http://en.wikipedia.org/wiki/Earth)"
17
isInCountry,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geosource_valid/_first/2/_and/1,
18
isInStateProvince,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geosource_valid/_first/2/_and/2,
17
isInCountry,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geovalid/_first/2/_and/1,
18
isInStateProvince,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geovalid/_first/2/_and/2,
19 19
stateProvinceVerbatim,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/stateprovince/_first/2,
20 20
isInCountry,"/location/locationplace/*_id/place/placecode/_if[@name=""if geovalidation""]/cond/_exists",
21 21
stateProvinceVerbatim,/location/locationplace/*_id/place/stateprovince,
inputs/.geoscrub/geoscrub_cleaned_unique/test.xml.ref
53 53
                                    <stateprovince>$stateProvinceStd</stateprovince>
54 54
                                    <distance_to_country_m><_km_to_m><value>$distErrCountry</value></_km_to_m></distance_to_country_m>
55 55
                                    <distance_to_state_m><_km_to_m><value>$distErrStateProvince</value></_km_to_m></distance_to_state_m>
56
                                    <geosource_valid>
56
                                    <geovalid>
57 57
                                        <_and>
58 58
                                            <1>$isInCountry</1>
59 59
                                            <2>$isInStateProvince</2>
60 60
                                        </_and>
61
                                    </geosource_valid>
61
                                    </geovalid>
62 62
                                </place>
63 63
                            </matched_place_id>
64 64
                            <stateprovince>$stateProvinceVerbatim</stateprovince>
schemas/vegbien.my.sql
298 298
    stateprovince text,
299 299
    county text,
300 300
    description text,
301
    geosource_valid int(1),
301
    geovalid int(1),
302 302
    distance_to_country_m double precision,
303 303
    distance_to_state_m double precision
304 304
);
schemas/vegbien.sql
638 638
    stateprovince text,
639 639
    county text,
640 640
    description text,
641
    geosource_valid boolean,
641
    geovalid boolean,
642 642
    distance_to_country_m double precision,
643 643
    distance_to_state_m double precision,
644 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)))
......
2119 2119
--
2120 2120

  
2121 2121
CREATE VIEW analytical_stem_view AS
2122
    SELECT source.shortname AS "institutionCode", canon_place.country, canon_place.stateprovince AS "stateProvince", datasource_place.county, coordinates.latitude_deg AS "decimalLatitude", coordinates.longitude_deg AS "decimalLongitude", canon_place.geosource_valid AS "geosourceValid", "newWorldCountries"."isNewWorld", _m_to_km(canon_place.distance_to_country_m) AS "distanceToCountry_km", _m_to_km(canon_place.distance_to_state_m) AS "distanceToStateProvince_km", location.sourceaccessioncode AS "plotName", location.elevation_m AS "elevationInMeters", _m2_to_ha(location.area_m2) AS "plotArea_ha", method.name AS "samplingProtocol", aggregateoccurrence.collectiondate AS "dateCollected", family_higher_plant_group.higher_plant_group AS "higherPlantGroup", accepted_taxonverbatim.family, accepted_taxonverbatim.genus, ((accepted_taxonverbatim.genus || ' '::text) || accepted_taxonverbatim.specific_epithet) AS "speciesBinomial", COALESCE(accepted_taxonverbatim.taxonomicname, accepted_taxonverbatim.taxonname) AS "scientificName", accepted_taxonverbatim.author AS "scientificNameAuthorship", NULLIF(array_to_string(ARRAY[accepted_taxonlabel.taxonomicname, parsed_taxonverbatim.morphospecies], ' '::text), ''::text) AS "scientificNameWithMorphospecies", (threatened_taxonlabel.taxonlabel_id IS NOT NULL) AS threatened, NULLIF(array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], ' '::text), ''::text) AS "identifiedBy", taxonoccurrence.growthform AS "growthForm", COALESCE(taxonoccurrence.iscultivated, (geoscrub_cultivated."isCultivated")::boolean) AS cultivated, CASE WHEN (taxonoccurrence.iscultivated IS NOT NULL) THEN taxonoccurrence.cultivatedbasis ELSE (geoscrub_cultivated."isCultivatedReason" || ''::text) END AS "cultivatedBasis", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "coverPercent", _m_to_cm(stemobservation.diameterbreastheight_m) AS "diameterBreastHeight_cm", stemobservation.height_m, stemobservation.tag, stemobservation.xposition_m AS "organismX_m", stemobservation.yposition_m AS "organismY_m", taxonoccurrence.collector_id AS "recordedBy", plantobservation.collectionnumber AS "recordNumber" FROM (((((((((((((((((((((((source JOIN location USING (source_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN place datasource_place USING (place_id)) LEFT JOIN place canon_place ON ((canon_place.place_id = datasource_place.canon_place_id))) LEFT JOIN coordinates ON ((coordinates.coordinates_id = canon_place.coordinates_id))) LEFT JOIN geoscrub.geoscrub_cultivated ON (((geoscrub_cultivated."latitudeDecimalVerbatim" = coordinates.latitude_deg) AND (geoscrub_cultivated."longitudeDecimalVerbatim" = coordinates.longitude_deg)))) LEFT JOIN "newWorld"."newWorldCountries" ON (("newWorldCountries"."countryNameStd" = canon_place.country))) 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 datasource_taxonverbatim USING (taxonverbatim_id)) JOIN taxonlabel datasource_taxonlabel USING (taxonlabel_id)) LEFT JOIN taxonlabel parsed_taxonlabel ON ((parsed_taxonlabel.taxonlabel_id = datasource_taxonlabel.matched_label_id))) LEFT JOIN taxonverbatim parsed_taxonverbatim ON ((parsed_taxonverbatim.taxonlabel_id = parsed_taxonlabel.taxonlabel_id))) LEFT JOIN taxonlabel accepted_taxonlabel ON ((accepted_taxonlabel.taxonlabel_id = datasource_taxonlabel.canon_label_id))) LEFT JOIN taxonverbatim accepted_taxonverbatim ON ((accepted_taxonverbatim.taxonlabel_id = accepted_taxonlabel.taxonlabel_id))) LEFT JOIN threatened_taxonlabel ON ((threatened_taxonlabel.taxonlabel_id = accepted_taxonlabel.taxonlabel_id))) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN family_higher_plant_group ON ((family_higher_plant_group.family = accepted_taxonverbatim.family))) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN stemobservation USING (plantobservation_id)) WHERE (NOT taxondetermination.isoriginal);
2122
    SELECT source.shortname AS "institutionCode", canon_place.country, canon_place.stateprovince AS "stateProvince", datasource_place.county, coordinates.latitude_deg AS "decimalLatitude", coordinates.longitude_deg AS "decimalLongitude", canon_place.geovalid AS "geosourceValid", "newWorldCountries"."isNewWorld", _m_to_km(canon_place.distance_to_country_m) AS "distanceToCountry_km", _m_to_km(canon_place.distance_to_state_m) AS "distanceToStateProvince_km", location.sourceaccessioncode AS "plotName", location.elevation_m AS "elevationInMeters", _m2_to_ha(location.area_m2) AS "plotArea_ha", method.name AS "samplingProtocol", aggregateoccurrence.collectiondate AS "dateCollected", family_higher_plant_group.higher_plant_group AS "higherPlantGroup", accepted_taxonverbatim.family, accepted_taxonverbatim.genus, ((accepted_taxonverbatim.genus || ' '::text) || accepted_taxonverbatim.specific_epithet) AS "speciesBinomial", COALESCE(accepted_taxonverbatim.taxonomicname, accepted_taxonverbatim.taxonname) AS "scientificName", accepted_taxonverbatim.author AS "scientificNameAuthorship", NULLIF(array_to_string(ARRAY[accepted_taxonlabel.taxonomicname, parsed_taxonverbatim.morphospecies], ' '::text), ''::text) AS "scientificNameWithMorphospecies", (threatened_taxonlabel.taxonlabel_id IS NOT NULL) AS threatened, NULLIF(array_to_string(ARRAY[identifiedby.givenname, identifiedby.middlename, identifiedby.surname], ' '::text), ''::text) AS "identifiedBy", taxonoccurrence.growthform AS "growthForm", COALESCE(taxonoccurrence.iscultivated, (geoscrub_cultivated."isCultivated")::boolean) AS cultivated, CASE WHEN (taxonoccurrence.iscultivated IS NOT NULL) THEN taxonoccurrence.cultivatedbasis ELSE (geoscrub_cultivated."isCultivatedReason" || ''::text) END AS "cultivatedBasis", _fraction_to_percent(aggregateoccurrence.cover_fraction) AS "coverPercent", _m_to_cm(stemobservation.diameterbreastheight_m) AS "diameterBreastHeight_cm", stemobservation.height_m, stemobservation.tag, stemobservation.xposition_m AS "organismX_m", stemobservation.yposition_m AS "organismY_m", taxonoccurrence.collector_id AS "recordedBy", plantobservation.collectionnumber AS "recordNumber" FROM (((((((((((((((((((((((source JOIN location USING (source_id)) LEFT JOIN locationplace USING (location_id)) LEFT JOIN place datasource_place USING (place_id)) LEFT JOIN place canon_place ON ((canon_place.place_id = datasource_place.canon_place_id))) LEFT JOIN coordinates ON ((coordinates.coordinates_id = canon_place.coordinates_id))) LEFT JOIN geoscrub.geoscrub_cultivated ON (((geoscrub_cultivated."latitudeDecimalVerbatim" = coordinates.latitude_deg) AND (geoscrub_cultivated."longitudeDecimalVerbatim" = coordinates.longitude_deg)))) LEFT JOIN "newWorld"."newWorldCountries" ON (("newWorldCountries"."countryNameStd" = canon_place.country))) 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 datasource_taxonverbatim USING (taxonverbatim_id)) JOIN taxonlabel datasource_taxonlabel USING (taxonlabel_id)) LEFT JOIN taxonlabel parsed_taxonlabel ON ((parsed_taxonlabel.taxonlabel_id = datasource_taxonlabel.matched_label_id))) LEFT JOIN taxonverbatim parsed_taxonverbatim ON ((parsed_taxonverbatim.taxonlabel_id = parsed_taxonlabel.taxonlabel_id))) LEFT JOIN taxonlabel accepted_taxonlabel ON ((accepted_taxonlabel.taxonlabel_id = datasource_taxonlabel.canon_label_id))) LEFT JOIN taxonverbatim accepted_taxonverbatim ON ((accepted_taxonverbatim.taxonlabel_id = accepted_taxonlabel.taxonlabel_id))) LEFT JOIN threatened_taxonlabel ON ((threatened_taxonlabel.taxonlabel_id = accepted_taxonlabel.taxonlabel_id))) LEFT JOIN aggregateoccurrence USING (taxonoccurrence_id)) LEFT JOIN family_higher_plant_group ON ((family_higher_plant_group.family = accepted_taxonverbatim.family))) LEFT JOIN plantobservation USING (aggregateoccurrence_id)) LEFT JOIN stemobservation USING (plantobservation_id)) WHERE (NOT taxondetermination.isoriginal);
2123 2123

  
2124 2124

  
2125 2125
--
mappings/VegCore-VegBIEN.csv
334 334
country,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/country/_first/2,
335 335
distanceToCountry_km,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/distance_to_country_m/_km_to_m/value,
336 336
distanceToStateProvince_km,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/distance_to_state_m/_km_to_m/value,
337
georeferenceValid,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geosource_valid/_first/1,
338
latLongInCountry,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geosource_valid/_first/2/_and/1,
339
latLongInStateProvince,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geosource_valid/_first/2/_and/2,
337
georeferenceValid,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geovalid/_first/1,
338
latLongInCountry,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/geovalid/_first/2/_and/1,
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 341
georeferenceValid,"/location/locationplace/*_id/place/placecode/_if[@name=""if geovalidation""]/cond/_exists",
342 342
latLongInCountry,"/location/locationplace/*_id/place/placecode/_if[@name=""if geovalidation""]/cond/_exists",
mappings/for_review/VegCore-VegBIEN.csv
334 334
country,//place/country,
335 335
distanceToCountry_km,//place/distance_to_country_m/_km_to_m/value,
336 336
distanceToStateProvince_km,//place/distance_to_state_m/_km_to_m/value,
337
georeferenceValid,//place/geosource_valid,
338
latLongInCountry,//place/geosource_valid,
339
latLongInStateProvince,//place/geosource_valid,
337
georeferenceValid,//place/geovalid,
338
latLongInCountry,//place/geovalid,
339
latLongInStateProvince,//place/geovalid,
340 340
stateProvince,//place/stateprovince,
341 341
georeferenceValid,"//place/placecode/_if[@name=""if geovalidation""]/cond/_exists",
342 342
latLongInCountry,"//place/placecode/_if[@name=""if geovalidation""]/cond/_exists",

Also available in: Unified diff