Project

General

Profile

« Previous | Next » 

Revision 10597

inputs/U/: switched to new-style import, using the steps at http://wiki.vegpath.org/Adding_new-style_import_to_a_datasource

View differences:

inputs/U/Specimen/postprocess.sql
2 2

  
3 3

  
4 4
SELECT mk_derived_col((:table_str, 'county'),
5
$$_alt("Gazetteer", "Newgazett")$$)
5
$$_alt("county.main", "county.alt")$$)
6 6
; -- runtime: 0.5 s ("Time: 610.516 ms") @starscream
7 7

  
8 8
SELECT mk_derived_col((:table_str, 'recordedBy'),
9
$$_join("Collector", "Addcoll")$$)
9
$$_join("recordedBy_primary", "recordedBy_additional")$$)
10 10
; -- runtime: 2 s ("Time: 2273.582 ms") @starscream
inputs/U/Specimen/run
1
#!/bin/bash -e
2
. "$(dirname "${BASH_SOURCE[0]}")"/../table.run
0 3

  
inputs/U/Specimen/map.csv
32 32
Phenology,reproductiveCondition,,
33 33
Notes,occurrenceRemarks,,
34 34
:U,specimenHolderInstitutions,,
35
county,county,,
36
recordedBy,recordedBy,,
inputs/U/Specimen/test.xml.ref
9 9
                    <location>
10 10
                        <authorlocationcode>
11 11
                            <_alt>
12
                                <1>$ID</1>
12
                                <1>$dataProviderRecordID</1>
13 13
                                <2>
14 14
                                    <_join>
15 15
                                        <1>U</1>
16
                                        <3>$Barcode</3>
16
                                        <3>$accessionNumber</3>
17 17
                                    </_join>
18 18
                                </2>
19 19
                            </_alt>
......
22 22
                            <_locationnarrative_is_cultivated>
23 23
                                <locationnarrative>
24 24
                                    <_join>
25
                                        <2>$Locnotes</2>
26
                                        <3>$Ecology</3>
25
                                        <2>$verbatimLocality</2>
26
                                        <3>$habitat</3>
27 27
                                    </_join>
28 28
                                </locationnarrative>
29 29
                            </_locationnarrative_is_cultivated>
......
37 37
                                                <_nullIf>
38 38
                                                    <null>0</null>
39 39
                                                    <type>float</type>
40
                                                    <value>$Colldd</value>
40
                                                    <value>$dayCollected</value>
41 41
                                                </_nullIf>
42 42
                                            </day>
43 43
                                            <month>
44 44
                                                <_nullIf>
45 45
                                                    <null>0</null>
46 46
                                                    <type>float</type>
47
                                                    <value>$Collmm</value>
47
                                                    <value>$monthCollected</value>
48 48
                                                </_nullIf>
49 49
                                            </month>
50 50
                                            <year>
51 51
                                                <_nullIf>
52 52
                                                    <null>0</null>
53 53
                                                    <type>float</type>
54
                                                    <value>$Collyy</value>
54
                                                    <value>$yearCollected</value>
55 55
                                                </_nullIf>
56 56
                                            </year>
57 57
                                        </_date>
58 58
                                    </collectiondate>
59
                                    <notes>$Notes</notes>
59
                                    <notes>$occurrenceRemarks</notes>
60 60
                                    <plantobservation>
61
                                        <authorplantcode>$Number</authorplantcode>
62
                                        <reproductivecondition>$Phenology</reproductivecondition>
61
                                        <authorplantcode>$collectorNumber</authorplantcode>
62
                                        <reproductivecondition>$reproductiveCondition</reproductivecondition>
63 63
                                        <specimenreplicate>
64
                                            <catalognumber_dwc>$Barcode</catalognumber_dwc>
65
                                            <collectionnumber>$Number</collectionnumber>
64
                                            <catalognumber_dwc>$accessionNumber</catalognumber_dwc>
65
                                            <collectionnumber>$collectorNumber</collectionnumber>
66 66
                                            <institution_id>
67 67
                                                <sourcelist>
68 68
                                                    <name>U</name>
......
76 76
                                                    </sourcename>
77 77
                                                </sourcelist>
78 78
                                            </institution_id>
79
                                            <sourceaccessioncode>$ID</sourceaccessioncode>
79
                                            <sourceaccessioncode>$dataProviderRecordID</sourceaccessioncode>
80 80
                                        </specimenreplicate>
81 81
                                    </plantobservation>
82 82
                                </aggregateoccurrence>
83 83
                                <collector_id><party><fullname>$recordedBy</fullname></party></collector_id>
84
                                <sourceaccessioncode>$ID</sourceaccessioncode>
84
                                <sourceaccessioncode>$dataProviderRecordID</sourceaccessioncode>
85 85
                                <taxondetermination>
86
                                    <party_id><party><fullname>$Detby</fullname></party></party_id>
86
                                    <party_id><party><fullname>$identifiedBy</fullname></party></party_id>
87 87
                                    <taxonverbatim_id>
88 88
                                        <taxonverbatim>
89 89
                                            <taxonlabel_id>
......
108 108
                                                                                                    <parent_id>
109 109
                                                                                                        <taxonlabel>
110 110
                                                                                                            <rank>genus</rank>
111
                                                                                                            <taxonepithet>$Genus</taxonepithet>
111
                                                                                                            <taxonepithet>$genus</taxonepithet>
112 112
                                                                                                            <parent_id>
113 113
                                                                                                                <taxonlabel>
114 114
                                                                                                                    <rank>family</rank>
115
                                                                                                                    <taxonepithet>$Family</taxonepithet>
115
                                                                                                                    <taxonepithet>$family</taxonepithet>
116 116
                                                                                                                </taxonlabel>
117 117
                                                                                                            </parent_id>
118 118
                                                                                                        </taxonlabel>
......
131 131
                                                    </parent_id>
132 132
                                                    <taxonomicname>
133 133
                                                        <_merge_prefix>
134
                                                            <prefix><_taxon_family_require_std><family>$Family</family></_taxon_family_require_std></prefix>
135
                                                            <value><_filter_genus><value>$Genus</value></_filter_genus></value>
134
                                                            <prefix><_taxon_family_require_std><family>$family</family></_taxon_family_require_std></prefix>
135
                                                            <value><_filter_genus><value>$genus</value></_filter_genus></value>
136 136
                                                        </_merge_prefix>
137 137
                                                    </taxonomicname>
138 138
                                                </taxonlabel>
139 139
                                            </taxonlabel_id>
140
                                            <family>$Family</family>
141
                                            <genus>$Genus</genus>
140
                                            <family>$family</family>
141
                                            <genus>$genus</genus>
142 142
                                        </taxonverbatim>
143 143
                                    </taxonverbatim_id>
144 144
                                    <determinationdate>
......
147 147
                                                <_nullIf>
148 148
                                                    <null>0</null>
149 149
                                                    <type>float</type>
150
                                                    <value>$Detyy</value>
150
                                                    <value>$yearIdentified</value>
151 151
                                                </_nullIf>
152 152
                                            </year>
153 153
                                        </_date>
154 154
                                    </determinationdate>
155
                                    <taxonfit>$cf</taxonfit>
155
                                    <taxonfit>$identificationQualifier</taxonfit>
156 156
                                </taxondetermination>
157 157
                            </taxonoccurrence>
158 158
                        </locationevent>
159 159
                        <locationnarrative>
160 160
                            <_merge>
161
                                <2>$Locnotes</2>
161
                                <2>$verbatimLocality</2>
162 162
                                <3>
163 163
                                    <_label>
164 164
                                        <label>habitat</label>
165
                                        <value>$Ecology</value>
165
                                        <value>$habitat</value>
166 166
                                    </_label>
167 167
                                </3>
168 168
                            </_merge>
......
176 176
                                                <_nullIf>
177 177
                                                    <null>0</null>
178 178
                                                    <type>float</type>
179
                                                    <value>$Lat</value>
179
                                                    <value>$decimalLatitude</value>
180 180
                                                </_nullIf>
181 181
                                            </latitude_deg>
182 182
                                            <longitude_deg>
183 183
                                                <_nullIf>
184 184
                                                    <null>0</null>
185 185
                                                    <type>float</type>
186
                                                    <value>$Long</value>
186
                                                    <value>$decimalLongitude</value>
187 187
                                                </_nullIf>
188 188
                                            </longitude_deg>
189 189
                                        </coordinates>
190 190
                                    </coordinates_id>
191
                                    <country>$Country</country>
191
                                    <country>$country</country>
192 192
                                    <county>$county</county>
193 193
                                    <matched_place_id>
194 194
                                        <place>
......
200 200
                                                        <_nullIf>
201 201
                                                            <null>0</null>
202 202
                                                            <type>float</type>
203
                                                            <value>$Lat</value>
203
                                                            <value>$decimalLatitude</value>
204 204
                                                        </_nullIf>
205 205
                                                    </latitude_deg>
206 206
                                                    <longitude_deg>
207 207
                                                        <_nullIf>
208 208
                                                            <null>0</null>
209 209
                                                            <type>float</type>
210
                                                            <value>$Long</value>
210
                                                            <value>$decimalLongitude</value>
211 211
                                                        </_nullIf>
212 212
                                                    </longitude_deg>
213 213
                                                </coordinates>
214 214
                                            </coordinates_id>
215
                                            <country>$Country</country>
215
                                            <country>$country</country>
216 216
                                            <county>$county</county>
217
                                            <stateprovince>$Majorarea</stateprovince>
217
                                            <stateprovince>$stateProvince</stateprovince>
218 218
                                        </place>
219 219
                                    </matched_place_id>
220
                                    <stateprovince>$Majorarea</stateprovince>
220
                                    <stateprovince>$stateProvince</stateprovince>
221 221
                                </place>
222 222
                            </place_id>
223 223
                        </locationplace>
inputs/U/Specimen/VegBIEN.csv
1
U,VegBIEN:/_setDefault:[source_id/source/shortname/_env:[name=source]]/path/_simplifyPath:[next=parent_id]/path,Comments
2
Barcode,"/_if[@name=""if specimen""]/cond/_exists",
3
ID,"/_if[@name=""if specimen""]/cond/_exists",
4
:U,"/_if[@name=""if specimen""]/else/source/shortname/_first/1",
5
ID,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/1",
6
Barcode,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/cond/_exists",
7
Barcode,"/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
ID,"/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
:U,"/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",
10
Barcode,"/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",
11
Number,"/location/iscultivated/_or/1/_if[@name=""if TaxonOccurrence""]/cond/_exists",
12
Locnotes,/location/iscultivated/_or/2/_locationnarrative_is_cultivated/locationnarrative/_join/2,
13
Ecology,/location/iscultivated/_or/2/_locationnarrative_is_cultivated/locationnarrative/_join/3,
14
Detyy,"/location/locationevent/taxonoccurrence/_if[@name=""if has accepted name""]/then/taxondetermination:[determinationtype=accepted]/determinationdate/_alt/2/_date/year/_nullIf:[null=0,type=float]/value",
15
cf,"/location/locationevent/taxonoccurrence/_if[@name=""if has accepted name""]/then/taxondetermination:[determinationtype=accepted]/taxonfit",
16
Colldd,"/location/locationevent/taxonoccurrence/aggregateoccurrence/collectiondate/_alt/2/_date/day/_nullIf:[null=0,type=float]/value",
17
Collmm,"/location/locationevent/taxonoccurrence/aggregateoccurrence/collectiondate/_alt/2/_date/month/_nullIf:[null=0,type=float]/value",
18
Collyy,"/location/locationevent/taxonoccurrence/aggregateoccurrence/collectiondate/_alt/2/_date/year/_nullIf:[null=0,type=float]/value",
19
Notes,/location/locationevent/taxonoccurrence/aggregateoccurrence/notes/_join/1,
20
Number,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/authorplantcode/_first/2,
21
Phenology,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/reproductivecondition,
22
Barcode,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/catalognumber_dwc/_if[@name=""if indirect voucher""]/else",
23
Number,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/collectionnumber/_if[@name=""if indirect voucher""]/else",
24
Barcode,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/institution_id/sourcelist/_if[@name=""if specimen""]/cond/_exists",
25
ID,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/institution_id/sourcelist/_if[@name=""if specimen""]/cond/_exists",
26
:U,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/institution_id/sourcelist/_if[@name=""if specimen""]/then/name/_first/2",
27
:U,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/institution_id/sourcelist/_if[@name=""if specimen""]/then/sourcename/name/_first/2/_split:[separator=""[,;] *""]/value",
28
ID,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/sourceaccessioncode,
29
Number,"/location/locationevent/taxonoccurrence/authortaxoncode/_if[@name=""if in plot""]/then/_first/2/_first/3",
30
recordedBy,/location/locationevent/taxonoccurrence/collector_id/party/fullname,
31
ID,"/location/locationevent/taxonoccurrence/iscultivated/_alt/1/_if[@name=""if TaxonOccurrence""]/cond/_exists",
32
Number,"/location/locationevent/taxonoccurrence/iscultivated/_alt/1/_if[@name=""if TaxonOccurrence""]/cond/_exists",
33
ID,/location/locationevent/taxonoccurrence/sourceaccessioncode/_first/3,
34
Detby,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/party/fullname,
35
Genus,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/parent_id/taxonlabel/parent_id/_forEach:[in:[cultivar,forma,variety,subspecies,species,],do=""taxonlabel[rank=_val]/parent_id""]/taxonlabel[rank=genus]/taxonepithet",
36
Family,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/parent_id/taxonlabel/parent_id/_forEach:[in:[cultivar,forma,variety,subspecies,species,genus,],do=""taxonlabel[rank=_val]/parent_id""]/taxonlabel[rank=family]/taxonepithet",
37
Family,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/prefix/_taxon_family_require_std/family,
38
Genus,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/1/_alt/2/_join_words/2/_filter_genus/value,
39
Family,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/family,
40
Genus,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/genus,
41
Detyy,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/determinationdate/_alt/2/_date/year/_nullIf:[null=0,type=float]/value",
42
cf,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/taxonfit,
43
Barcode,"/location/locationevent/taxonoccurrence/voucher/*_id/specimenreplicate/catalognumber_dwc/_if[@name=""if indirect voucher""]/then",
44
Number,"/location/locationevent/taxonoccurrence/voucher/*_id/specimenreplicate/collectionnumber/_if[@name=""if indirect voucher""]/then",
45
Locnotes,/location/locationnarrative/_merge/2,
46
Ecology,"/location/locationnarrative/_merge/3/_label[label=""habitat""]/value","Brad: Free-text description of vegetation community where collected, frequently redundane wrt 'Vegetation'. Bob, Nick: keep as user defined or create special element?"
47
Lat,"/location/locationplace/*_id/place/*_id/coordinates/latitude_deg/_nullIf:[null=0,type=float]/value",
48
Long,"/location/locationplace/*_id/place/*_id/coordinates/longitude_deg/_nullIf:[null=0,type=float]/value",
49
Country,/location/locationplace/*_id/place/country,
50
county,/location/locationplace/*_id/place/county,
51
Lat,"/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"
52
Long,"/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"
53
Country,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/country/_first/2,
54
county,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/county/_first/2,
55
Majorarea,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/stateprovince/_first/2,closest equivalent for Guyana/Suriname
56
Majorarea,/location/locationplace/*_id/place/stateprovince,closest equivalent for Guyana/Suriname
57
Addcoll,,** No join mapping for recordedBy_additional ** additional collectors
58
Alt,,** No join mapping for *Alt ** What is this?
59
Alt2,,** No join mapping for *Alt2 ** What is this?
60
Collector,,** No join mapping for recordedBy_primary ** the primary collector
61
Coorsyst,,** No join mapping for *Coorsyst ** 
62
DateInfo,,** No non-empty join mapping for UNUSED#DateInfo ** 
63
EW,,** No join mapping for *EW ** 
64
Gazetteer,,** No join mapping for county.main ** closest equivalent for Guyana/Suriname
65
NS,,** No join mapping for *NS ** 
66
Newgazett,,"** No join mapping for county.alt ** only used in 1 row. only one of Gazetteer, Newgazett is ever populated."
67
Prefix,,** No non-empty join mapping for UNUSED#Prefix ** 
68
Suffix,,** No non-empty join mapping for UNUSED#Suffix ** 
69
row_num,,** No join mapping for *row_num ** 
1
link ../../../mappings/VegCore-VegBIEN.csv
70 2

  
inputs/U/run
1
#!/bin/bash -e
2
. "$(dirname "${BASH_SOURCE[0]}")"/../../lib/runscripts/datasrc_dir.run
0 3

  

Also available in: Unified diff