Revision 10569
Added by Aaron Marcuse-Kubitza over 11 years ago
inputs/NCU/Specimen/postprocess.sql | ||
---|---|---|
3 | 3 |
|
4 | 4 |
-- cultivated can only be true or NULL, not false |
5 | 5 |
SELECT mk_derived_col((:table_str, 'cultivated'), |
6 |
$$_map('0=>NULL, -1=>true, *=>*', "Cultivated")$$)
|
|
6 |
$$_map('0=>NULL, -1=>true, *=>*', "cultivated_verbatim")$$)
|
|
7 | 7 |
; -- runtime: 4 s ("Time: 3768.112 ms") @starscream |
inputs/NCU/Specimen/run | ||
---|---|---|
1 |
#!/bin/bash -e |
|
2 |
. "$(dirname "${BASH_SOURCE[0]}")"/../table.run |
|
0 | 3 |
inputs/NCU/Specimen/map.csv | ||
---|---|---|
37 | 37 |
LastAnnotationDateVerbatim,*LastAnnotationDateVerbatim,, |
38 | 38 |
LastAnnotationRemarks,*LastAnnotationRemarks,, |
39 | 39 |
lastAnnotationAgent,*lastAnnotationAgent,, |
40 |
cultivated,cultivated,, |
inputs/NCU/Specimen/test.xml.ref | ||
---|---|---|
9 | 9 |
<location> |
10 | 10 |
<authorlocationcode> |
11 | 11 |
<_alt> |
12 |
<1>$SpecimenPK</1>
|
|
12 |
<1>$occurrenceID</1>
|
|
13 | 13 |
<2> |
14 | 14 |
<_join> |
15 |
<1>$CatalogSeriesPrefix</1>
|
|
16 |
<2>$CollectionGUID</2>
|
|
17 |
<3>$CatalogNumber</3>
|
|
15 |
<1>$specimenHolderInstitutions</1>
|
|
16 |
<2>$collectionURL</2>
|
|
17 |
<3>$accessionNumber</3>
|
|
18 | 18 |
</_join> |
19 | 19 |
</2> |
20 | 20 |
</_alt> |
21 | 21 |
</authorlocationcode> |
22 |
<iscultivated><_locationnarrative_is_cultivated><locationnarrative>$VerbatimLocality</locationnarrative></_locationnarrative_is_cultivated></iscultivated>
|
|
22 |
<iscultivated><_locationnarrative_is_cultivated><locationnarrative>$verbatimLocality</locationnarrative></_locationnarrative_is_cultivated></iscultivated>
|
|
23 | 23 |
<locationevent> |
24 | 24 |
<taxonoccurrence> |
25 | 25 |
<aggregateoccurrence> |
26 |
<collectiondate>$CollectionDate</collectiondate>
|
|
27 |
<notes>$Description</notes>
|
|
26 |
<collectiondate>$dateCollected</collectiondate>
|
|
27 |
<notes>$occurrenceRemarks</notes>
|
|
28 | 28 |
<plantobservation> |
29 |
<authorplantcode>$firstCollectorRemarks</authorplantcode>
|
|
29 |
<authorplantcode>$collectorNumber</authorplantcode>
|
|
30 | 30 |
<specimenreplicate> |
31 |
<catalognumber_dwc>$CatalogNumber</catalognumber_dwc>
|
|
32 |
<collectioncode_dwc>$CollectionGUID</collectioncode_dwc>
|
|
33 |
<collectionnumber>$firstCollectorRemarks</collectionnumber>
|
|
31 |
<catalognumber_dwc>$accessionNumber</catalognumber_dwc>
|
|
32 |
<collectioncode_dwc>$collectionURL</collectioncode_dwc>
|
|
33 |
<collectionnumber>$collectorNumber</collectionnumber>
|
|
34 | 34 |
<institution_id> |
35 | 35 |
<sourcelist> |
36 |
<name>$CatalogSeriesPrefix</name>
|
|
36 |
<name>$specimenHolderInstitutions</name>
|
|
37 | 37 |
<sourcename> |
38 | 38 |
<name> |
39 | 39 |
<_split> |
40 | 40 |
<separator>[,;] *</separator> |
41 |
<value>$CatalogSeriesPrefix</value>
|
|
41 |
<value>$specimenHolderInstitutions</value>
|
|
42 | 42 |
</_split> |
43 | 43 |
</name> |
44 | 44 |
</sourcename> |
45 | 45 |
</sourcelist> |
46 | 46 |
</institution_id> |
47 |
<sourceaccessioncode>$SpecimenPK</sourceaccessioncode>
|
|
47 |
<sourceaccessioncode>$occurrenceID</sourceaccessioncode>
|
|
48 | 48 |
</specimenreplicate> |
49 | 49 |
</plantobservation> |
50 | 50 |
</aggregateoccurrence> |
51 |
<collector_id><party><fullname>$firstCollectorName</fullname></party></collector_id>
|
|
51 |
<collector_id><party><fullname>$recordedBy</fullname></party></collector_id>
|
|
52 | 52 |
<iscultivated>$cultivated</iscultivated> |
53 |
<sourceaccessioncode>$SpecimenPK</sourceaccessioncode>
|
|
53 |
<sourceaccessioncode>$occurrenceID</sourceaccessioncode>
|
|
54 | 54 |
<taxondetermination> |
55 | 55 |
<taxonverbatim_id> |
56 | 56 |
<taxonverbatim> |
... | ... | |
58 | 58 |
<taxonlabel> |
59 | 59 |
<taxonomicname> |
60 | 60 |
<_alt> |
61 |
<1>$CurrentScientificNameWithAuthor</1>
|
|
62 |
<2>$CurrentScientificName</2>
|
|
61 |
<1>$scientificName</1>
|
|
62 |
<2>$taxonName</2>
|
|
63 | 63 |
</_alt> |
64 | 64 |
</taxonomicname> |
65 | 65 |
</taxonlabel> |
66 | 66 |
</taxonlabel_id> |
67 |
<taxonname>$CurrentScientificName</taxonname>
|
|
68 |
<taxonomicname>$CurrentScientificNameWithAuthor</taxonomicname>
|
|
67 |
<taxonname>$taxonName</taxonname>
|
|
68 |
<taxonomicname>$scientificName</taxonomicname>
|
|
69 | 69 |
</taxonverbatim> |
70 | 70 |
</taxonverbatim_id> |
71 | 71 |
</taxondetermination> |
72 | 72 |
<taxondetermination> |
73 | 73 |
<isoriginal>true</isoriginal> |
74 |
<taxonverbatim_id><taxonverbatim><taxonomicname>$OriginalTaxonLabel</taxonomicname></taxonverbatim></taxonverbatim_id>
|
|
74 |
<taxonverbatim_id><taxonverbatim><taxonomicname>$originalScientificName</taxonomicname></taxonverbatim></taxonverbatim_id>
|
|
75 | 75 |
</taxondetermination> |
76 | 76 |
</taxonoccurrence> |
77 | 77 |
</locationevent> |
78 |
<locationnarrative>$VerbatimLocality</locationnarrative>
|
|
78 |
<locationnarrative>$verbatimLocality</locationnarrative>
|
|
79 | 79 |
<locationplace> |
80 | 80 |
<place_id> |
81 | 81 |
<place> |
... | ... | |
85 | 85 |
<_nullIf> |
86 | 86 |
<null>0</null> |
87 | 87 |
<type>float</type> |
88 |
<value>$Latitude1</value>
|
|
88 |
<value>$decimalLatitude</value>
|
|
89 | 89 |
</_nullIf> |
90 | 90 |
</latitude_deg> |
91 | 91 |
<longitude_deg> |
92 | 92 |
<_nullIf> |
93 | 93 |
<null>0</null> |
94 | 94 |
<type>float</type> |
95 |
<value>$Longitude1</value>
|
|
95 |
<value>$decimalLongitude</value>
|
|
96 | 96 |
</_nullIf> |
97 | 97 |
</longitude_deg> |
98 |
<verbatimlatitude>$Loc_AltN</verbatimlatitude>
|
|
99 |
<verbatimlongitude>$Loc_AltE</verbatimlongitude>
|
|
98 |
<verbatimlatitude>$verbatimLatitude</verbatimlatitude>
|
|
99 |
<verbatimlongitude>$verbatimLongitude</verbatimlongitude>
|
|
100 | 100 |
</coordinates> |
101 | 101 |
</coordinates_id> |
102 | 102 |
<placename_id> |
103 | 103 |
<placename> |
104 | 104 |
<rank>municipality</rank> |
105 |
<placename>$CityLocality</placename>
|
|
105 |
<placename>$municipality</placename>
|
|
106 | 106 |
</placename> |
107 | 107 |
</placename_id> |
108 |
<country>$Country</country>
|
|
108 |
<country>$country</country>
|
|
109 | 109 |
<county>$county</county> |
110 | 110 |
<matched_place_id> |
111 | 111 |
<place> |
... | ... | |
117 | 117 |
<_nullIf> |
118 | 118 |
<null>0</null> |
119 | 119 |
<type>float</type> |
120 |
<value>$Latitude1</value>
|
|
120 |
<value>$decimalLatitude</value>
|
|
121 | 121 |
</_nullIf> |
122 | 122 |
</latitude_deg> |
123 | 123 |
<longitude_deg> |
124 | 124 |
<_nullIf> |
125 | 125 |
<null>0</null> |
126 | 126 |
<type>float</type> |
127 |
<value>$Longitude1</value>
|
|
127 |
<value>$decimalLongitude</value>
|
|
128 | 128 |
</_nullIf> |
129 | 129 |
</longitude_deg> |
130 | 130 |
</coordinates> |
131 | 131 |
</coordinates_id> |
132 |
<country>$Country</country>
|
|
132 |
<country>$country</country>
|
|
133 | 133 |
<county>$county</county> |
134 |
<stateprovince>$State</stateprovince>
|
|
134 |
<stateprovince>$stateProvince</stateprovince>
|
|
135 | 135 |
</place> |
136 | 136 |
</matched_place_id> |
137 |
<stateprovince>$State</stateprovince>
|
|
137 |
<stateprovince>$stateProvince</stateprovince>
|
|
138 | 138 |
</place> |
139 | 139 |
</place_id> |
140 | 140 |
</locationplace> |
inputs/NCU/Specimen/VegBIEN.csv | ||
---|---|---|
1 |
NCU,VegBIEN:/_setDefault:[source_id/source/shortname/_env:[name=source]]/path/_simplifyPath:[next=parent_id]/path,Comments |
|
2 |
CatalogNumber,"/_if[@name=""if specimen""]/cond/_exists", |
|
3 |
SpecimenPK,"/_if[@name=""if specimen""]/cond/_exists", |
|
4 |
CatalogSeriesPrefix,"/_if[@name=""if specimen""]/else/source/shortname/_first/1",= specimen.orig_collection.institution.acronym, specimen.specimenholder_institutions(0).acronym |
|
5 |
SpecimenPK,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/1", |
|
6 |
CatalogNumber,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/cond/_exists", |
|
7 |
CatalogNumber,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/then/_join/1/_if[@name=""if specimen""]/cond/_exists", |
|
8 |
SpecimenPK,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/then/_join/1/_if[@name=""if specimen""]/cond/_exists", |
|
9 |
CatalogSeriesPrefix,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/then/_join/1/_if[@name=""if specimen""]/then/_first/2",= specimen.orig_collection.institution.acronym, specimen.specimenholder_institutions(0).acronym |
|
10 |
CollectionGUID,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/then/_join/2/_join/2", |
|
11 |
CatalogNumber,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/then/_join/3/_if[@name=""if indirect voucher""]/else", |
|
12 |
SpecimenPK,"/location/iscultivated/_or/1/_if[@name=""if TaxonOccurrence""]/cond/_exists", |
|
13 |
firstCollectorRemarks,"/location/iscultivated/_or/1/_if[@name=""if TaxonOccurrence""]/cond/_exists","Actually the collector's number, not remarks" |
|
14 |
cultivated,"/location/iscultivated/_or/1/_if[@name=""if TaxonOccurrence""]/else/_first/1", |
|
15 |
VerbatimLocality,/location/iscultivated/_or/2/_locationnarrative_is_cultivated/locationnarrative/_join/2, |
|
16 |
CollectionDate,/location/locationevent/taxonoccurrence/aggregateoccurrence/collectiondate/_alt/1, |
|
17 |
Description,/location/locationevent/taxonoccurrence/aggregateoccurrence/notes/_join/1, |
|
18 |
firstCollectorRemarks,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/authorplantcode/_first/2,"Actually the collector's number, not remarks" |
|
19 |
CatalogNumber,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/catalognumber_dwc/_if[@name=""if indirect voucher""]/else", |
|
20 |
CollectionGUID,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/collectioncode_dwc/_alt/2, |
|
21 |
firstCollectorRemarks,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/collectionnumber/_if[@name=""if indirect voucher""]/else","Actually the collector's number, not remarks" |
|
22 |
CatalogNumber,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/institution_id/sourcelist/_if[@name=""if specimen""]/cond/_exists", |
|
23 |
SpecimenPK,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/institution_id/sourcelist/_if[@name=""if specimen""]/cond/_exists", |
|
24 |
CatalogSeriesPrefix,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/institution_id/sourcelist/_if[@name=""if specimen""]/then/name/_first/2",= specimen.orig_collection.institution.acronym, specimen.specimenholder_institutions(0).acronym |
|
25 |
CatalogSeriesPrefix,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/institution_id/sourcelist/_if[@name=""if specimen""]/then/sourcename/name/_first/2/_split:[separator=""[,;] *""]/value",= specimen.orig_collection.institution.acronym, specimen.specimenholder_institutions(0).acronym |
|
26 |
SpecimenPK,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/sourceaccessioncode, |
|
27 |
firstCollectorRemarks,"/location/locationevent/taxonoccurrence/authortaxoncode/_if[@name=""if in plot""]/then/_first/2/_first/3","Actually the collector's number, not remarks" |
|
28 |
CurrentScientificNameWithAuthor,"/location/locationevent/taxonoccurrence/authortaxoncode/_if[@name=""if in plot""]/then/_first/3/_first/2", |
|
29 |
CurrentScientificName,"/location/locationevent/taxonoccurrence/authortaxoncode/_if[@name=""if in plot""]/then/_first/3/_first/3", |
|
30 |
firstCollectorName,/location/locationevent/taxonoccurrence/collector_id/party/fullname, |
|
31 |
SpecimenPK,"/location/locationevent/taxonoccurrence/iscultivated/_alt/1/_if[@name=""if TaxonOccurrence""]/cond/_exists", |
|
32 |
firstCollectorRemarks,"/location/locationevent/taxonoccurrence/iscultivated/_alt/1/_if[@name=""if TaxonOccurrence""]/cond/_exists","Actually the collector's number, not remarks" |
|
33 |
cultivated,"/location/locationevent/taxonoccurrence/iscultivated/_alt/1/_if[@name=""if TaxonOccurrence""]/then/_first/1", |
|
34 |
SpecimenPK,/location/locationevent/taxonoccurrence/sourceaccessioncode/_first/3, |
|
35 |
CurrentScientificNameWithAuthor,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/1, |
|
36 |
CurrentScientificName,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/1/_alt/1, |
|
37 |
CurrentScientificName,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/taxonname, |
|
38 |
CurrentScientificNameWithAuthor,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/taxonomicname, |
|
39 |
OriginalTaxonLabel,/location/locationevent/taxonoccurrence/taxondetermination[isoriginal=true]/*_id/taxonverbatim/taxonomicname, |
|
40 |
CatalogNumber,"/location/locationevent/taxonoccurrence/voucher/*_id/specimenreplicate/catalognumber_dwc/_if[@name=""if indirect voucher""]/then", |
|
41 |
firstCollectorRemarks,"/location/locationevent/taxonoccurrence/voucher/*_id/specimenreplicate/collectionnumber/_if[@name=""if indirect voucher""]/then","Actually the collector's number, not remarks" |
|
42 |
VerbatimLocality,/location/locationnarrative/_merge/2, |
|
43 |
Latitude1,"/location/locationplace/*_id/place/*_id/coordinates/latitude_deg/_nullIf:[null=0,type=float]/value", |
|
44 |
Longitude1,"/location/locationplace/*_id/place/*_id/coordinates/longitude_deg/_nullIf:[null=0,type=float]/value", |
|
45 |
Loc_AltN,/location/locationplace/*_id/place/*_id/coordinates/verbatimlatitude, |
|
46 |
Loc_AltE,/location/locationplace/*_id/place/*_id/coordinates/verbatimlongitude, |
|
47 |
CityLocality,/location/locationplace/*_id/place/*_id/placename[rank=municipality]/placename, |
|
48 |
Country,/location/locationplace/*_id/place/country, |
|
49 |
county,/location/locationplace/*_id/place/county, |
|
50 |
Latitude1,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/latitude_deg/_nullIf:[null=0,type=float]/value",""".,"" sorts it with other coordinates mappings" |
|
51 |
Longitude1,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/longitude_deg/_nullIf:[null=0,type=float]/value",""".,"" sorts it with other coordinates mappings" |
|
52 |
Country,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/country/_first/2, |
|
53 |
county,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/county/_first/2, |
|
54 |
State,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/stateprovince/_first/2, |
|
55 |
State,/location/locationplace/*_id/place/stateprovince, |
|
56 |
BarCode,,"** No non-empty join mapping for OMIT#BarCode ** Omitted because this isn't specified on all rows, but SpecimenPK is" |
|
57 |
BlockLocationReason,,** No join mapping for *BlockLocationReason ** |
|
58 |
BlockSpecificLocation,,** No join mapping for *BlockSpecificLocation ** |
|
59 |
CollectionObjectID,,** No join mapping for *CollectionObjectID ** |
|
60 |
CollectionObjectTypeID,,** No join mapping for *CollectionObjectTypeID ** |
|
61 |
Cultivated,,** No join mapping for cultivated_verbatim ** |
|
62 |
DerivedFromID,,** No join mapping for *DerivedFromID ** |
|
63 |
EventRemarks,,** No join mapping for eventRemarks ** |
|
64 |
FIPSStateCounty,,** No join mapping for *FIPSStateCounty ** |
|
65 |
LandOwner,,** No join mapping for *LandOwner ** |
|
66 |
LastAnnotationDateVerbatim,,** No join mapping for *LastAnnotationDateVerbatim ** |
|
67 |
LastAnnotationLabelTaxon,,** No join mapping for *LastAnnotationLabelTaxon ** |
|
68 |
LastAnnotationRemarks,,** No join mapping for *LastAnnotationRemarks ** |
|
69 |
OwnerInstitution,,** No join mapping for specimenOwner ** = specimen.owner_collection.institution.name |
|
70 |
TypeStatus,,** No join mapping for typeStatus ** |
|
71 |
database,,** No join mapping for *database ** |
|
72 |
lastAnnotationAgent,,** No join mapping for *lastAnnotationAgent ** |
|
73 |
row_num,,** No join mapping for *row_num ** |
|
1 |
link ../../../mappings/VegCore-VegBIEN.csv |
|
74 | 2 |
inputs/NCU/Specimen/new_terms.csv | ||
---|---|---|
5 | 5 |
CurrentScientificName,taxonName,, |
6 | 6 |
CurrentScientificNameWithAuthor,scientificName,, |
7 | 7 |
CollectionDate,dateCollected,, |
8 |
CatalogSeriesPrefix,specimenHolderInstitutions,,= specimen.orig_collection.institution.acronym, specimen.specimenholder_institutions(0).acronym
|
|
8 |
CatalogSeriesPrefix,specimenHolderInstitutions,,"= specimen.orig_collection.institution.acronym, specimen.specimenholder_institutions(0).acronym"
|
|
9 | 9 |
Description,occurrenceRemarks,, |
10 | 10 |
CityLocality,municipality,, |
11 | 11 |
Latitude1,decimalLatitude,, |
inputs/NCU/run | ||
---|---|---|
1 |
#!/bin/bash -e |
|
2 |
. "$(dirname "${BASH_SOURCE[0]}")"/../../lib/runscripts/datasrc_dir.run |
|
0 | 3 |
Also available in: Unified diff
inputs/NCU/: switched to new-style import, using the steps at http://wiki.vegpath.org/Adding_new-style_import_to_a_datasource