Project

General

Profile

« Previous | Next » 

Revision 4621

mappings/VegCore-VegBIEN.csv: Added /_simplifyPath:[next=parent_id]/path to root so the returned subplot location will be its parent location if there is no subplot name or ID (indicating that that particular plot did not have subplots). Note that this also causes the parent_id forwarding effect to occur for all other tables containing parent_id, which will help prevent similar issues with subplot events, etc. This will hopefully fix the SALVIAS.plotObservations bug where some organisms did not have a subplot #, causing the subplot location to become NULL and causing the corresponding locationevent rows not to match the locationevent_unique_within_location index filter condition (which requires a parent_id), which caused multiple output table pkeys to be returned for those rows, violating the locationevent_pkeys temp table's primary key.

View differences:

test.xml.ref
1 1
Put template:
2 2
<VegBIEN>
3
    <location id="-1">
4
        <authorlocationcode>
5
            <_alt>
6
                <1>$UniqueNYInternalRecordNumber</1>
7
                <2>
8
                    <_join>
9
                        <1>$InstitutionCode</1>
10
                        <2>$CollectionCode</2>
11
                        <3>$CatalogNumber</3>
12
                    </_join>
13
                </2>
14
            </_alt>
15
        </authorlocationcode>
16
        <elevation>
17
            <_avg>
18
                <max>
19
                    <_units>
20
                        <default>m</default>
21
                        <to>m</to>
22
                        <to></to>
23
                        <value>
24
                            <_replace>
25
                                <\bca\.?></\bca\.?>
26
                                <value>$MaximumElevation</value>
27
                            </_replace>
28
                        </value>
29
                    </_units>
30
                </max>
31
                <min>
32
                    <_units>
33
                        <default>m</default>
34
                        <to>m</to>
35
                        <to></to>
36
                        <value>
37
                            <_rangeStart>
3
    <_simplifyPath id="-1">
4
        <next>parent_id</next>
5
        <path>
6
            <location>
7
                <authorlocationcode>
8
                    <_alt>
9
                        <1>$UniqueNYInternalRecordNumber</1>
10
                        <2>
11
                            <_join>
12
                                <1>$InstitutionCode</1>
13
                                <2>$CollectionCode</2>
14
                                <3>$CatalogNumber</3>
15
                            </_join>
16
                        </2>
17
                    </_alt>
18
                </authorlocationcode>
19
                <elevation>
20
                    <_avg>
21
                        <max>
22
                            <_units>
23
                                <default>m</default>
24
                                <to>m</to>
25
                                <to></to>
38 26
                                <value>
39 27
                                    <_replace>
40 28
                                        <\bca\.?></\bca\.?>
41
                                        <value>
42
                                            <_nullIf>
43
                                                <null>.</null>
44
                                                <value>$MinimumElevation</value>
45
                                            </_nullIf>
46
                                        </value>
29
                                        <value>$MaximumElevation</value>
47 30
                                    </_replace>
48 31
                                </value>
49
                            </_rangeStart>
50
                        </value>
51
                    </_units>
52
                </min>
53
            </_avg>
54
        </elevation>
55
        <elevationrange>
56
            <_range>
57
                <from>
58
                    <_units>
59
                        <default>m</default>
60
                        <to>m</to>
61
                        <to></to>
62
                        <value>
63
                            <_rangeStart>
32
                            </_units>
33
                        </max>
34
                        <min>
35
                            <_units>
36
                                <default>m</default>
37
                                <to>m</to>
38
                                <to></to>
64 39
                                <value>
65
                                    <_replace>
66
                                        <\bca\.?></\bca\.?>
40
                                    <_rangeStart>
67 41
                                        <value>
68
                                            <_nullIf>
69
                                                <null>.</null>
70
                                                <value>$MinimumElevation</value>
71
                                            </_nullIf>
42
                                            <_replace>
43
                                                <\bca\.?></\bca\.?>
44
                                                <value>
45
                                                    <_nullIf>
46
                                                        <null>.</null>
47
                                                        <value>$MinimumElevation</value>
48
                                                    </_nullIf>
49
                                                </value>
50
                                            </_replace>
72 51
                                        </value>
73
                                    </_replace>
52
                                    </_rangeStart>
74 53
                                </value>
75
                            </_rangeStart>
76
                        </value>
77
                    </_units>
78
                </from>
79
                <to>
80
                    <_units>
81
                        <default>m</default>
82
                        <to>m</to>
83
                        <to></to>
84
                        <value>
85
                            <_alt>
86
                                <1>
87
                                    <_replace>
88
                                        <\bca\.?></\bca\.?>
89
                                        <value>$MaximumElevation</value>
90
                                    </_replace>
91
                                </1>
92
                                <2>
93
                                    <_rangeEnd>
54
                            </_units>
55
                        </min>
56
                    </_avg>
57
                </elevation>
58
                <elevationrange>
59
                    <_range>
60
                        <from>
61
                            <_units>
62
                                <default>m</default>
63
                                <to>m</to>
64
                                <to></to>
65
                                <value>
66
                                    <_rangeStart>
94 67
                                        <value>
95 68
                                            <_replace>
96 69
                                                <\bca\.?></\bca\.?>
......
102 75
                                                </value>
103 76
                                            </_replace>
104 77
                                        </value>
105
                                    </_rangeEnd>
106
                                </2>
107
                            </_alt>
108
                        </value>
109
                    </_units>
110
                </to>
111
            </_range>
112
        </elevationrange>
113
        <locationdetermination>
114
            <coordsaccuracy><_noCV><value>$CoordinatePrecision</value></_noCV></coordsaccuracy>
115
            <footprintgeometry_dwc>$BoundingBox</footprintgeometry_dwc>
116
            <latitude>
117
                <_nullIf>
118
                    <null>0</null>
119
                    <type>float</type>
120
                    <value>$Latitude</value>
121
                </_nullIf>
122
            </latitude>
123
            <longitude>
124
                <_nullIf>
125
                    <null>0</null>
126
                    <type>float</type>
127
                    <value>$Longitude</value>
128
                </_nullIf>
129
            </longitude>
130
            <namedplace_id>
131
                <_simplifyPath>
132
                    <next>parent_id</next>
133
                    <path>
134
                        <namedplace>
135
                            <rank>county</rank>
136
                            <placename>$County</placename>
137
                            <parent_id>
78
                                    </_rangeStart>
79
                                </value>
80
                            </_units>
81
                        </from>
82
                        <to>
83
                            <_units>
84
                                <default>m</default>
85
                                <to>m</to>
86
                                <to></to>
87
                                <value>
88
                                    <_alt>
89
                                        <1>
90
                                            <_replace>
91
                                                <\bca\.?></\bca\.?>
92
                                                <value>$MaximumElevation</value>
93
                                            </_replace>
94
                                        </1>
95
                                        <2>
96
                                            <_rangeEnd>
97
                                                <value>
98
                                                    <_replace>
99
                                                        <\bca\.?></\bca\.?>
100
                                                        <value>
101
                                                            <_nullIf>
102
                                                                <null>.</null>
103
                                                                <value>$MinimumElevation</value>
104
                                                            </_nullIf>
105
                                                        </value>
106
                                                    </_replace>
107
                                                </value>
108
                                            </_rangeEnd>
109
                                        </2>
110
                                    </_alt>
111
                                </value>
112
                            </_units>
113
                        </to>
114
                    </_range>
115
                </elevationrange>
116
                <locationdetermination>
117
                    <coordsaccuracy><_noCV><value>$CoordinatePrecision</value></_noCV></coordsaccuracy>
118
                    <footprintgeometry_dwc>$BoundingBox</footprintgeometry_dwc>
119
                    <latitude>
120
                        <_nullIf>
121
                            <null>0</null>
122
                            <type>float</type>
123
                            <value>$Latitude</value>
124
                        </_nullIf>
125
                    </latitude>
126
                    <longitude>
127
                        <_nullIf>
128
                            <null>0</null>
129
                            <type>float</type>
130
                            <value>$Longitude</value>
131
                        </_nullIf>
132
                    </longitude>
133
                    <namedplace_id>
134
                        <_simplifyPath>
135
                            <next>parent_id</next>
136
                            <path>
138 137
                                <namedplace>
139
                                    <rank>stateProvince</rank>
140
                                    <placename>$StateProvince</placename>
138
                                    <rank>county</rank>
139
                                    <placename>$County</placename>
141 140
                                    <parent_id>
142 141
                                        <namedplace>
143
                                            <rank>country</rank>
144
                                            <placename>$Country</placename>
142
                                            <rank>stateProvince</rank>
143
                                            <placename>$StateProvince</placename>
145 144
                                            <parent_id>
146 145
                                                <namedplace>
147
                                                    <rank>continent</rank>
148
                                                    <placename>$ContinentOcean</placename>
146
                                                    <rank>country</rank>
147
                                                    <placename>$Country</placename>
148
                                                    <parent_id>
149
                                                        <namedplace>
150
                                                            <rank>continent</rank>
151
                                                            <placename>$ContinentOcean</placename>
152
                                                        </namedplace>
153
                                                    </parent_id>
149 154
                                                </namedplace>
150 155
                                            </parent_id>
151 156
                                        </namedplace>
152 157
                                    </parent_id>
153 158
                                </namedplace>
154
                            </parent_id>
155
                        </namedplace>
156
                    </path>
157
                </_simplifyPath>
158
            </namedplace_id>
159
        </locationdetermination>
160
        <locationevent>
161
            <taxonoccurrence>
162
                <aggregateoccurrence>
163
                    <collectiondate>
164
                        <_date>
165
                            <day>
166
                                <_nullIf>
167
                                    <null>0</null>
168
                                    <type>float</type>
169
                                    <value>$DayCollected</value>
170
                                </_nullIf>
171
                            </day>
172
                            <month>
173
                                <_nullIf>
174
                                    <null>0</null>
175
                                    <type>float</type>
176
                                    <value>$MonthCollected</value>
177
                                </_nullIf>
178
                            </month>
179
                            <year>
180
                                <_nullIf>
181
                                    <null>0</null>
182
                                    <type>float</type>
183
                                    <value>$YearCollected</value>
184
                                </_nullIf>
185
                            </year>
186
                        </_date>
187
                    </collectiondate>
188
                    <count>$IndividualCount</count>
189
                    <notes>
190
                        <_merge>
191
                            <1>$Notes</1>
192
                            <2>
193
                                <_label>
194
                                    <label>plant fungus</label>
195
                                    <value>$PlantFungusDescription</value>
196
                                </_label>
197
                            </2>
198
                        </_merge>
199
                    </notes>
200
                    <plantobservation>
201
                        <collectionnumber>$FieldNumber</collectionnumber>
202
                        <definedvalue fkey="tablerecord_id">
203
                            <userdefined_id>
204
                                <userdefined>
205
                                    <tablename>plantobservation</tablename>
206
                                    <userdefinedname>sex</userdefinedname>
207
                                </userdefined>
208
                            </userdefined_id>
209
                            <definedvalue>$Sex</definedvalue>
210
                        </definedvalue>
211
                        <specimenreplicate>
212
                            <catalognumber_dwc>$CatalogNumber</catalognumber_dwc>
213
                            <collectioncode_dwc>$CollectionCode</collectioncode_dwc>
214
                            <institution_id><party><organizationname>$InstitutionCode</organizationname></party></institution_id>
215
                            <sourceaccessioncode>$UniqueNYInternalRecordNumber</sourceaccessioncode>
216
                        </specimenreplicate>
217
                    </plantobservation>
218
                </aggregateoccurrence>
219
                <authortaxoncode>
220
                    <_alt>
221
                        <1>$FieldNumber</1>
222
                        <2>$ScientificName</2>
223
                    </_alt>
224
                </authortaxoncode>
225
                <taxondetermination>
226
                    <party_id>
227
                        <party>
228
                            <givenname><_namePart><first>$IdentifiedBy</first></_namePart></givenname>
229
                            <middlename><_namePart><middle>$IdentifiedBy</middle></_namePart></middlename>
230
                            <surname><_namePart><last>$IdentifiedBy</last></_namePart></surname>
231
                        </party>
232
                    </party_id>
233
                    <plantconcept_id>
234
                        <plantconcept>
235
                            <plantname_id>
236
                                <_simplifyPath>
237
                                    <next>parent_id</next>
238
                                    <path>
239
                                        <plantname>
240
                                            <rank>binomial</rank>
241
                                            <plantname>$ScientificName</plantname>
242
                                            <parent_id>
159
                            </path>
160
                        </_simplifyPath>
161
                    </namedplace_id>
162
                </locationdetermination>
163
                <locationevent>
164
                    <taxonoccurrence>
165
                        <aggregateoccurrence>
166
                            <collectiondate>
167
                                <_date>
168
                                    <day>
169
                                        <_nullIf>
170
                                            <null>0</null>
171
                                            <type>float</type>
172
                                            <value>$DayCollected</value>
173
                                        </_nullIf>
174
                                    </day>
175
                                    <month>
176
                                        <_nullIf>
177
                                            <null>0</null>
178
                                            <type>float</type>
179
                                            <value>$MonthCollected</value>
180
                                        </_nullIf>
181
                                    </month>
182
                                    <year>
183
                                        <_nullIf>
184
                                            <null>0</null>
185
                                            <type>float</type>
186
                                            <value>$YearCollected</value>
187
                                        </_nullIf>
188
                                    </year>
189
                                </_date>
190
                            </collectiondate>
191
                            <count>$IndividualCount</count>
192
                            <notes>
193
                                <_merge>
194
                                    <1>$Notes</1>
195
                                    <2>
196
                                        <_label>
197
                                            <label>plant fungus</label>
198
                                            <value>$PlantFungusDescription</value>
199
                                        </_label>
200
                                    </2>
201
                                </_merge>
202
                            </notes>
203
                            <plantobservation>
204
                                <collectionnumber>$FieldNumber</collectionnumber>
205
                                <definedvalue fkey="tablerecord_id">
206
                                    <userdefined_id>
207
                                        <userdefined>
208
                                            <tablename>plantobservation</tablename>
209
                                            <userdefinedname>sex</userdefinedname>
210
                                        </userdefined>
211
                                    </userdefined_id>
212
                                    <definedvalue>$Sex</definedvalue>
213
                                </definedvalue>
214
                                <specimenreplicate>
215
                                    <catalognumber_dwc>$CatalogNumber</catalognumber_dwc>
216
                                    <collectioncode_dwc>$CollectionCode</collectioncode_dwc>
217
                                    <institution_id><party><organizationname>$InstitutionCode</organizationname></party></institution_id>
218
                                    <sourceaccessioncode>$UniqueNYInternalRecordNumber</sourceaccessioncode>
219
                                </specimenreplicate>
220
                            </plantobservation>
221
                        </aggregateoccurrence>
222
                        <authortaxoncode>
223
                            <_alt>
224
                                <1>$FieldNumber</1>
225
                                <2>$ScientificName</2>
226
                            </_alt>
227
                        </authortaxoncode>
228
                        <taxondetermination>
229
                            <party_id>
230
                                <party>
231
                                    <givenname><_namePart><first>$IdentifiedBy</first></_namePart></givenname>
232
                                    <middlename><_namePart><middle>$IdentifiedBy</middle></_namePart></middlename>
233
                                    <surname><_namePart><last>$IdentifiedBy</last></_namePart></surname>
234
                                </party>
235
                            </party_id>
236
                            <plantconcept_id>
237
                                <plantconcept>
238
                                    <plantname_id>
239
                                        <_simplifyPath>
240
                                            <next>parent_id</next>
241
                                            <path>
243 242
                                                <plantname>
244
                                                    <rank>authority</rank>
245
                                                    <plantname>$ScientificNameAuthor</plantname>
243
                                                    <rank>binomial</rank>
244
                                                    <plantname>$ScientificName</plantname>
246 245
                                                    <parent_id>
247 246
                                                        <plantname>
248
                                                            <rank>subspecies</rank>
249
                                                            <plantname>$Subspecies</plantname>
247
                                                            <rank>authority</rank>
248
                                                            <plantname>$ScientificNameAuthor</plantname>
250 249
                                                            <parent_id>
251 250
                                                                <plantname>
252
                                                                    <rank>species</rank>
253
                                                                    <plantname>$Species</plantname>
251
                                                                    <rank>subspecies</rank>
252
                                                                    <plantname>$Subspecies</plantname>
254 253
                                                                    <parent_id>
255 254
                                                                        <plantname>
256
                                                                            <rank>genus</rank>
257
                                                                            <plantname>$Genus</plantname>
255
                                                                            <rank>species</rank>
256
                                                                            <plantname>$Species</plantname>
258 257
                                                                            <parent_id>
259 258
                                                                                <plantname>
260
                                                                                    <rank>family</rank>
261
                                                                                    <plantname>$Family</plantname>
259
                                                                                    <rank>genus</rank>
260
                                                                                    <plantname>$Genus</plantname>
262 261
                                                                                    <parent_id>
263 262
                                                                                        <plantname>
264
                                                                                            <rank>order</rank>
265
                                                                                            <plantname>$Order</plantname>
263
                                                                                            <rank>family</rank>
264
                                                                                            <plantname>$Family</plantname>
266 265
                                                                                            <parent_id>
267 266
                                                                                                <plantname>
268
                                                                                                    <rank>class</rank>
269
                                                                                                    <plantname>$Class</plantname>
267
                                                                                                    <rank>order</rank>
268
                                                                                                    <plantname>$Order</plantname>
270 269
                                                                                                    <parent_id>
271 270
                                                                                                        <plantname>
272
                                                                                                            <rank>subkingdom</rank>
273
                                                                                                            <plantname>$Phylum</plantname>
271
                                                                                                            <rank>class</rank>
272
                                                                                                            <plantname>$Class</plantname>
274 273
                                                                                                            <parent_id>
275 274
                                                                                                                <plantname>
276
                                                                                                                    <rank>kingdom</rank>
277
                                                                                                                    <plantname>$Kingdom</plantname>
275
                                                                                                                    <rank>subkingdom</rank>
276
                                                                                                                    <plantname>$Phylum</plantname>
277
                                                                                                                    <parent_id>
278
                                                                                                                        <plantname>
279
                                                                                                                            <rank>kingdom</rank>
280
                                                                                                                            <plantname>$Kingdom</plantname>
281
                                                                                                                        </plantname>
282
                                                                                                                    </parent_id>
278 283
                                                                                                                </plantname>
279 284
                                                                                                            </parent_id>
280 285
                                                                                                        </plantname>
......
292 297
                                                        </plantname>
293 298
                                                    </parent_id>
294 299
                                                </plantname>
295
                                            </parent_id>
296
                                        </plantname>
297
                                    </path>
298
                                </_simplifyPath>
299
                            </plantname_id>
300
                        </plantconcept>
301
                    </plantconcept_id>
302
                    <determinationdate>
303
                        <_date>
304
                            <day>
305
                                <_nullIf>
306
                                    <null>0</null>
307
                                    <type>float</type>
308
                                    <value>$DayIdentified</value>
309
                                </_nullIf>
310
                            </day>
311
                            <month>
312
                                <_nullIf>
313
                                    <null>0</null>
314
                                    <type>float</type>
315
                                    <value>$MonthIdentified</value>
316
                                </_nullIf>
317
                            </month>
318
                            <year>
319
                                <_nullIf>
320
                                    <null>0</null>
321
                                    <type>float</type>
322
                                    <value>$YearIdentified</value>
323
                                </_nullIf>
324
                            </year>
325
                        </_date>
326
                    </determinationdate>
327
                </taxondetermination>
328
                <verbatimcollectorname>$Collector</verbatimcollectorname>
329
            </taxonoccurrence>
330
            <waterdepth>
331
                <_avg>
332
                    <max>
333
                        <_units>
334
                            <default>m</default>
335
                            <to>m</to>
336
                            <to></to>
337
                            <value>
338
                                <_replace>
339
                                    <\bca\.?></\bca\.?>
340
                                    <value>$MaximumDepth</value>
341
                                </_replace>
342
                            </value>
343
                        </_units>
344
                    </max>
345
                    <min>
346
                        <_units>
347
                            <default>m</default>
348
                            <to>m</to>
349
                            <to></to>
350
                            <value>
351
                                <_replace>
352
                                    <\bca\.?></\bca\.?>
353
                                    <value>$MinimumDepth</value>
354
                                </_replace>
355
                            </value>
356
                        </_units>
357
                    </min>
358
                </_avg>
359
            </waterdepth>
360
        </locationevent>
361
        <locationnarrative>
362
            <_merge>
363
                <1>
300
                                            </path>
301
                                        </_simplifyPath>
302
                                    </plantname_id>
303
                                </plantconcept>
304
                            </plantconcept_id>
305
                            <determinationdate>
306
                                <_date>
307
                                    <day>
308
                                        <_nullIf>
309
                                            <null>0</null>
310
                                            <type>float</type>
311
                                            <value>$DayIdentified</value>
312
                                        </_nullIf>
313
                                    </day>
314
                                    <month>
315
                                        <_nullIf>
316
                                            <null>0</null>
317
                                            <type>float</type>
318
                                            <value>$MonthIdentified</value>
319
                                        </_nullIf>
320
                                    </month>
321
                                    <year>
322
                                        <_nullIf>
323
                                            <null>0</null>
324
                                            <type>float</type>
325
                                            <value>$YearIdentified</value>
326
                                        </_nullIf>
327
                                    </year>
328
                                </_date>
329
                            </determinationdate>
330
                        </taxondetermination>
331
                        <verbatimcollectorname>$Collector</verbatimcollectorname>
332
                    </taxonoccurrence>
333
                    <waterdepth>
334
                        <_avg>
335
                            <max>
336
                                <_units>
337
                                    <default>m</default>
338
                                    <to>m</to>
339
                                    <to></to>
340
                                    <value>
341
                                        <_replace>
342
                                            <\bca\.?></\bca\.?>
343
                                            <value>$MaximumDepth</value>
344
                                        </_replace>
345
                                    </value>
346
                                </_units>
347
                            </max>
348
                            <min>
349
                                <_units>
350
                                    <default>m</default>
351
                                    <to>m</to>
352
                                    <to></to>
353
                                    <value>
354
                                        <_replace>
355
                                            <\bca\.?></\bca\.?>
356
                                            <value>$MinimumDepth</value>
357
                                        </_replace>
358
                                    </value>
359
                                </_units>
360
                            </min>
361
                        </_avg>
362
                    </waterdepth>
363
                </locationevent>
364
                <locationnarrative>
364 365
                    <_merge>
365
                        <1>$Locality</1>
366
                        <2>
367
                            <_label>
368
                                <label>substrate</label>
369
                                <value>$Substrate</value>
370
                            </_label>
371
                        </2>
366
                        <1>
367
                            <_merge>
368
                                <1>$Locality</1>
369
                                <2>
370
                                    <_label>
371
                                        <label>substrate</label>
372
                                        <value>$Substrate</value>
373
                                    </_label>
374
                                </2>
375
                                <3>
376
                                    <_label>
377
                                        <label>vegetation</label>
378
                                        <value>$Vegetation</value>
379
                                    </_label>
380
                                </3>
381
                            </_merge>
382
                        </1>
372 383
                        <3>
373 384
                            <_label>
374
                                <label>vegetation</label>
375
                                <value>$Vegetation</value>
385
                                <label>habitat</label>
386
                                <value>$Habitat</value>
376 387
                            </_label>
377 388
                        </3>
378 389
                    </_merge>
379
                </1>
380
                <3>
381
                    <_label>
382
                        <label>habitat</label>
383
                        <value>$Habitat</value>
384
                    </_label>
385
                </3>
386
            </_merge>
387
        </locationnarrative>
388
    </location>
390
                </locationnarrative>
391
            </location>
392
        </path>
393
    </_simplifyPath>
389 394
</VegBIEN>
390 395
Inserted 39 new rows into database

Also available in: Unified diff