Project

General

Profile

« Previous | Next » 

Revision 10625

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

View differences:

inputs/TEX/Specimen/postprocess.sql
2 2

  
3 3

  
4 4
SELECT mk_derived_col((:table_str, 'dateCollected'),
5
$$_alt("COLL. DATE (EXACT)", "COLL. DATE (GENERAL)")$$)
5
$$_alt("dateCollected__scrubbed", "dateCollected__verbatim")$$)
6 6
; -- runtime: 2 s ("Time: 1734.640 ms") @starscream
inputs/TEX/Specimen/run
1
#!/bin/bash -e
2
. "$(dirname "${BASH_SOURCE[0]}")"/../table.run
0 3

  
inputs/TEX/Specimen/map.csv
36 36
DATA ENTRY BY,*DATA ENTRY BY,,
37 37
DATA ENTRY DATE,*DATA ENTRY DATE,,
38 38
DATA EDITED DATE,modified,,
39
dateCollected,dateCollected,,
inputs/TEX/Specimen/test.xml.ref
9 9
                    <location>
10 10
                        <authorlocationcode>
11 11
                            <_join>
12
                                <2>$HERBARIUM</2>
13
                                <3>$ACCESSION NO.</3>
12
                                <2>$collection</2>
13
                                <3>$accessionNumber</3>
14 14
                            </_join>
15 15
                        </authorlocationcode>
16 16
                        <elevation_m>
17 17
                            <_units>
18 18
                                <to>m</to>
19 19
                                <to></to>
20
                                <value>$ELEVATION</value>
20
                                <value>$verbatimElevation</value>
21 21
                            </_units>
22 22
                        </elevation_m>
23 23
                        <iscultivated>
24 24
                            <_locationnarrative_is_cultivated>
25 25
                                <locationnarrative>
26 26
                                    <_join>
27
                                        <1>$LOCATION</1>
28
                                        <3>$ECOLOGICAL INFORMATION</3>
27
                                        <1>$locality</1>
28
                                        <3>$habitat</3>
29 29
                                    </_join>
30 30
                                </locationnarrative>
31 31
                            </_locationnarrative_is_cultivated>
......
34 34
                            <taxonoccurrence>
35 35
                                <aggregateoccurrence>
36 36
                                    <collectiondate>$dateCollected</collectiondate>
37
                                    <notes>$SPECIMEN NOTES</notes>
37
                                    <notes>$occurrenceRemarks</notes>
38 38
                                    <plantobservation>
39
                                        <authorplantcode>$COLLECTOR NUMBER</authorplantcode>
40
                                        <reproductivecondition>$PHENOLOGY</reproductivecondition>
39
                                        <authorplantcode>$collectorNumber</authorplantcode>
40
                                        <reproductivecondition>$reproductiveCondition</reproductivecondition>
41 41
                                        <specimenreplicate>
42
                                            <catalognumber_dwc>$ACCESSION NO.</catalognumber_dwc>
43
                                            <collectioncode_dwc>$HERBARIUM</collectioncode_dwc>
44
                                            <collectionnumber>$COLLECTOR NUMBER</collectionnumber>
42
                                            <catalognumber_dwc>$accessionNumber</catalognumber_dwc>
43
                                            <collectioncode_dwc>$collection</collectioncode_dwc>
44
                                            <collectionnumber>$collectorNumber</collectionnumber>
45 45
                                        </specimenreplicate>
46 46
                                    </plantobservation>
47 47
                                </aggregateoccurrence>
48
                                <collector_id><party><fullname>$COLLECTOR NAME(S)</fullname></party></collector_id>
48
                                <collector_id><party><fullname>$recordedBy</fullname></party></collector_id>
49 49
                                <iscultivated>
50 50
                                    <_map>
51 51
                                        <cultivated>t</cultivated>
52 52
                                        <wild>f</wild>
53 53
                                        <*></*>
54
                                        <value>$ORIGIN</value>
54
                                        <value>$establishmentMeans</value>
55 55
                                    </_map>
56 56
                                </iscultivated>
57 57
                                <isnative>
......
59 59
                                        <native>t</native>
60 60
                                        <exotic>f</exotic>
61 61
                                        <*></*>
62
                                        <value>$ORIGIN</value>
62
                                        <value>$establishmentMeans</value>
63 63
                                    </_map>
64 64
                                </isnative>
65 65
                                <taxondetermination>
66
                                    <party_id><party><fullname>$DETERMINED BY</fullname></party></party_id>
66
                                    <party_id><party><fullname>$identifiedBy</fullname></party></party_id>
67 67
                                    <taxonverbatim_id>
68 68
                                        <taxonverbatim>
69 69
                                            <taxonlabel_id>
......
85 85
                                                                                            <parent_id>
86 86
                                                                                                <taxonlabel>
87 87
                                                                                                    <rank>species</rank>
88
                                                                                                    <taxonepithet>$SPECIES</taxonepithet>
88
                                                                                                    <taxonepithet>$specificEpithet</taxonepithet>
89 89
                                                                                                    <parent_id>
90 90
                                                                                                        <taxonlabel>
91 91
                                                                                                            <rank>genus</rank>
92
                                                                                                            <taxonepithet>$GENUS</taxonepithet>
92
                                                                                                            <taxonepithet>$genus</taxonepithet>
93 93
                                                                                                            <parent_id>
94 94
                                                                                                                <taxonlabel>
95 95
                                                                                                                    <rank>family</rank>
96
                                                                                                                    <taxonepithet>$FAMILY</taxonepithet>
96
                                                                                                                    <taxonepithet>$family</taxonepithet>
97 97
                                                                                                                </taxonlabel>
98 98
                                                                                                            </parent_id>
99 99
                                                                                                        </taxonlabel>
......
108 108
                                                                    </parent_id>
109 109
                                                                </taxonlabel>
110 110
                                                            </parent_id>
111
                                                            <taxonepithet>$INFRA NAME</taxonepithet>
111
                                                            <taxonepithet>$infraspecificEpithet</taxonepithet>
112 112
                                                        </taxonlabel>
113 113
                                                    </parent_id>
114 114
                                                    <taxonomicname>
115 115
                                                        <_merge_prefix>
116
                                                            <prefix><_taxon_family_require_std><family>$FAMILY</family></_taxon_family_require_std></prefix>
116
                                                            <prefix><_taxon_family_require_std><family>$family</family></_taxon_family_require_std></prefix>
117 117
                                                            <value>
118 118
                                                                <_join_words>
119 119
                                                                    <1>
120 120
                                                                        <_join_words>
121
                                                                            <2><_filter_genus><value>$GENUS</value></_filter_genus></2>
122
                                                                            <3>$SPECIES</3>
123
                                                                            <5>$INFRA NAME</5>
121
                                                                            <2><_filter_genus><value>$genus</value></_filter_genus></2>
122
                                                                            <3>$specificEpithet</3>
123
                                                                            <5>$infraspecificEpithet</5>
124 124
                                                                        </_join_words>
125 125
                                                                    </1>
126
                                                                    <2>$AUTHORITY</2>
126
                                                                    <2>$scientificNameAuthorship</2>
127 127
                                                                </_join_words>
128 128
                                                            </value>
129 129
                                                        </_merge_prefix>
130 130
                                                    </taxonomicname>
131 131
                                                </taxonlabel>
132 132
                                            </taxonlabel_id>
133
                                            <author>$AUTHORITY</author>
134
                                            <family>$FAMILY</family>
135
                                            <genus>$GENUS</genus>
136
                                            <specific_epithet>$SPECIES</specific_epithet>
133
                                            <author>$scientificNameAuthorship</author>
134
                                            <family>$family</family>
135
                                            <genus>$genus</genus>
136
                                            <specific_epithet>$specificEpithet</specific_epithet>
137 137
                                        </taxonverbatim>
138 138
                                    </taxonverbatim_id>
139 139
                                </taxondetermination>
......
141 141
                        </locationevent>
142 142
                        <locationnarrative>
143 143
                            <_merge>
144
                                <1>$LOCATION</1>
144
                                <1>$locality</1>
145 145
                                <3>
146 146
                                    <_label>
147 147
                                        <label>habitat</label>
148
                                        <value>$ECOLOGICAL INFORMATION</value>
148
                                        <value>$habitat</value>
149 149
                                    </_label>
150 150
                                </3>
151 151
                            </_merge>
......
157 157
                                        <coordinates>
158 158
                                            <latitude_deg>
159 159
                                                <_dms_to_dd>
160
                                                    <deg>$LAT DEGREES</deg>
161
                                                    <min>$LAT MINUTES</min>
162
                                                    <sec>$LAT SECONDS</sec>
160
                                                    <deg>$latitude_deg</deg>
161
                                                    <min>$latitude_min</min>
162
                                                    <sec>$latitude_sec</sec>
163 163
                                                </_dms_to_dd>
164 164
                                            </latitude_deg>
165 165
                                            <longitude_deg>
166 166
                                                <_dms_to_dd>
167
                                                    <deg>$LONG DEGREES</deg>
168
                                                    <min>$LONG MINUTES</min>
169
                                                    <sec>$LONG SECONDS</sec>
167
                                                    <deg>$longitude_deg</deg>
168
                                                    <min>$longitude_min</min>
169
                                                    <sec>$longitude_sec</sec>
170 170
                                                </_dms_to_dd>
171 171
                                            </longitude_deg>
172 172
                                        </coordinates>
173 173
                                    </coordinates_id>
174
                                    <county>$COUNTY</county>
174
                                    <county>$county</county>
175 175
                                    <matched_place_id>
176 176
                                        <place>
177 177
                                            <source_id><source><shortname>geoscrub</shortname></source></source_id>
......
180 180
                                                    <source_id><source><shortname>geoscrub</shortname></source></source_id>
181 181
                                                    <latitude_deg>
182 182
                                                        <_dms_to_dd>
183
                                                            <deg>$LAT DEGREES</deg>
184
                                                            <min>$LAT MINUTES</min>
185
                                                            <sec>$LAT SECONDS</sec>
183
                                                            <deg>$latitude_deg</deg>
184
                                                            <min>$latitude_min</min>
185
                                                            <sec>$latitude_sec</sec>
186 186
                                                        </_dms_to_dd>
187 187
                                                    </latitude_deg>
188 188
                                                    <longitude_deg>
189 189
                                                        <_dms_to_dd>
190
                                                            <deg>$LONG DEGREES</deg>
191
                                                            <min>$LONG MINUTES</min>
192
                                                            <sec>$LONG SECONDS</sec>
190
                                                            <deg>$longitude_deg</deg>
191
                                                            <min>$longitude_min</min>
192
                                                            <sec>$longitude_sec</sec>
193 193
                                                        </_dms_to_dd>
194 194
                                                    </longitude_deg>
195 195
                                                </coordinates>
196 196
                                            </coordinates_id>
197
                                            <county>$COUNTY</county>
198
                                            <stateprovince>$STATE</stateprovince>
197
                                            <county>$county</county>
198
                                            <stateprovince>$stateProvince</stateprovince>
199 199
                                        </place>
200 200
                                    </matched_place_id>
201
                                    <stateprovince>$STATE</stateprovince>
201
                                    <stateprovince>$stateProvince</stateprovince>
202 202
                                </place>
203 203
                            </place_id>
204 204
                        </locationplace>
205
                        <verbatimelevation>$ELEVATION</verbatimelevation>
205
                        <verbatimelevation>$verbatimElevation</verbatimelevation>
206 206
                    </location>
207 207
                </path>
208 208
            </_simplifyPath>
inputs/TEX/Specimen/VegBIEN.csv
1
TEX,VegBIEN:/_setDefault:[source_id/source/shortname/_env:[name=source]]/path/_simplifyPath:[next=parent_id]/path,Comments
2
ACCESSION NO.,"/_if[@name=""if specimen""]/cond/_exists",
3
ACCESSION NO.,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/cond/_exists",
4
ACCESSION NO.,"/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",
5
HERBARIUM,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/then/_join/2/_join/1",
6
ACCESSION NO.,"/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",
7
ELEVATION,"/location/elevation_m/_alt/1/_units:[to=m,to=]/value",
8
COLLECTOR NUMBER,"/location/iscultivated/_or/1/_if[@name=""if TaxonOccurrence""]/cond/_exists",
9
LOCATION,/location/iscultivated/_or/2/_locationnarrative_is_cultivated/locationnarrative/_join/1,
10
ECOLOGICAL INFORMATION,/location/iscultivated/_or/2/_locationnarrative_is_cultivated/locationnarrative/_join/3,
11
dateCollected,/location/locationevent/taxonoccurrence/aggregateoccurrence/collectiondate/_alt/1,
12
SPECIMEN NOTES,/location/locationevent/taxonoccurrence/aggregateoccurrence/notes/_join/1,
13
COLLECTOR NUMBER,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/authorplantcode/_first/2,
14
PHENOLOGY,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/reproductivecondition,
15
ACCESSION NO.,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/catalognumber_dwc/_if[@name=""if indirect voucher""]/else",
16
HERBARIUM,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/collectioncode_dwc/_alt/1,Brad: Not sure if mapping correct. DwC element; code for entire collection; often same as InstitutionCode; Aaron: Combining with InstitutionCode to create collection name
17
COLLECTOR NUMBER,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/collectionnumber/_if[@name=""if indirect voucher""]/else",
18
ACCESSION NO.,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/institution_id/sourcelist/_if[@name=""if specimen""]/cond/_exists",
19
COLLECTOR NUMBER,"/location/locationevent/taxonoccurrence/authortaxoncode/_if[@name=""if in plot""]/then/_first/2/_first/3",
20
COLLECTOR NAME(S),/location/locationevent/taxonoccurrence/collector_id/party/fullname,
21
COLLECTOR NUMBER,"/location/locationevent/taxonoccurrence/iscultivated/_alt/1/_if[@name=""if TaxonOccurrence""]/cond/_exists",
22
ORIGIN,"/location/locationevent/taxonoccurrence/iscultivated/_alt/2/_map:[cultivated=t,wild=f,*=]/value",
23
ORIGIN,"/location/locationevent/taxonoccurrence/isnative/_map:[native=t,exotic=f,*=]/value",
24
DETERMINED BY,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/party/fullname,
25
SPECIES,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/parent_id/taxonlabel/parent_id/_forEach:[in:[cultivar,forma,variety,subspecies,],do=""taxonlabel[rank=_val]/parent_id""]/taxonlabel[rank=species]/taxonepithet",
26
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",
27
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",
28
INFRA NAME,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/parent_id/taxonlabel/taxonepithet,
29
FAMILY,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/prefix/_taxon_family_require_std/family,
30
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,
31
SPECIES,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/1/_alt/2/_join_words/3/_join_words/1,
32
INFRA NAME,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/1/_alt/2/_join_words/5/_join_words/1/_if[@name=""if has infraspecificEpithet""]/cond",
33
INFRA NAME,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/1/_alt/2/_join_words/5/_join_words/2,
34
AUTHORITY,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/2,
35
AUTHORITY,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/author,
36
FAMILY,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/family,
37
GENUS,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/genus,
38
SPECIES,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/specific_epithet,
39
ACCESSION NO.,"/location/locationevent/taxonoccurrence/voucher/*_id/specimenreplicate/catalognumber_dwc/_if[@name=""if indirect voucher""]/then",
40
COLLECTOR NUMBER,"/location/locationevent/taxonoccurrence/voucher/*_id/specimenreplicate/collectionnumber/_if[@name=""if indirect voucher""]/then",
41
LOCATION,/location/locationnarrative/_merge/1,
42
ECOLOGICAL INFORMATION,"/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?"
43
LAT DEGREES,/location/locationplace/*_id/place/*_id/coordinates/latitude_deg/_dms_to_dd/deg,
44
LAT MINUTES,/location/locationplace/*_id/place/*_id/coordinates/latitude_deg/_dms_to_dd/min,
45
LAT SECONDS,/location/locationplace/*_id/place/*_id/coordinates/latitude_deg/_dms_to_dd/sec,
46
LONG DEGREES,/location/locationplace/*_id/place/*_id/coordinates/longitude_deg/_dms_to_dd/deg,
47
LONG MINUTES,/location/locationplace/*_id/place/*_id/coordinates/longitude_deg/_dms_to_dd/min,
48
LONG SECONDS,/location/locationplace/*_id/place/*_id/coordinates/longitude_deg/_dms_to_dd/sec,
49
COUNTY,/location/locationplace/*_id/place/county,
50
LAT DEGREES,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/latitude_deg/_dms_to_dd/deg",
51
LAT MINUTES,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/latitude_deg/_dms_to_dd/min",
52
LAT SECONDS,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/latitude_deg/_dms_to_dd/sec",
53
LONG DEGREES,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/longitude_deg/_dms_to_dd/deg",
54
LONG MINUTES,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/longitude_deg/_dms_to_dd/min",
55
LONG SECONDS,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/longitude_deg/_dms_to_dd/sec",
56
COUNTY,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/county/_first/2,
57
STATE,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/stateprovince/_first/2,
58
STATE,/location/locationplace/*_id/place/stateprovince,
59
ELEVATION,/location/verbatimelevation,
60
COLL. DATE (EXACT),,** No join mapping for dateCollected__scrubbed ** 
61
COLL. DATE (GENERAL),,** No join mapping for dateCollected__verbatim ** 
62
DATA EDITED DATE,,** No join mapping for modified ** 
63
DATA ENTRY BY,,** No join mapping for *DATA ENTRY BY ** 
64
DATA ENTRY DATE,,** No join mapping for *DATA ENTRY DATE ** 
65
DET NOTES,,** No join mapping for identificationRemarks ** 
66
INFRA AUTHORITY,,** No join mapping for *INFRA AUTHORITY ** 
67
INFRA RANK,,** No join mapping for infraspecificRank ** 
68
LAT NS,,** No join mapping for *LAT NS ** 
69
LONG EW,,** No join mapping for *LONG EW ** 
70
SOURCE OF LATLONG,,** No join mapping for *SOURCE OF LATLONG ** 
71
UTM,,** No join mapping for *UTM ** 
72
row_num,,** No join mapping for *row_num ** 
1
link ../../../mappings/VegCore-VegBIEN.csv
73 2

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

  
inputs/TEX/Specimen2/postprocess.sql
2 2

  
3 3

  
4 4
SELECT mk_derived_col((:table_str, 'dateCollected'),
5
$$_alt("EXACT DATE", "GENERAL DATE")$$)
5
$$_alt("dateCollected__scrubbed", "dateCollected__verbatim")$$)
6 6
; -- runtime: 0.3 s ("Time: 283.170 ms") @starscream
7 7

  
8 8

  
9 9
SELECT mk_derived_col((:table_str, 'recordedBy__primary'),
10
$$_join_words("COLLECTOR 1 FIRST NAME", "COLLECTOR 1 LAST NAME")$$)
10
$$_join_words("recordedBy__primary__first", "recordedBy__primary__last")$$)
11 11
; -- runtime: 0.2 s ("Time: 154.234 ms") @starscream
12 12

  
13 13
SELECT mk_derived_col((:table_str, 'recordedBy__additional__1'),
14
$$_join_words("COLLECTOR 2 FIRST NAME", "COLLECTOR 2 LAST NAME")$$)
14
$$_join_words("recordedBy__additional__1__first", "recordedBy__additional__1__last")$$)
15 15
; -- runtime: 0.1 s ("Time: 135.107 ms") @starscream
16 16

  
17 17
SELECT mk_derived_col((:table_str, 'recordedBy__additional__2'),
18
$$_join_words("COLLECTOR 3 FIRST NAME", "COLLECTOR 3 LAST NAME")$$)
18
$$_join_words("recordedBy__additional__2__first", "recordedBy__additional__2__last")$$)
19 19
; -- runtime: 0.1 s ("Time: 133.670 ms") @starscream
20 20

  
21 21
SELECT mk_derived_col((:table_str, 'recordedBy__additional__3'),
22
$$_join_words("COLLECTOR 4 FIRST NAME", "COLLECTOR 4 LAST NAME")$$)
22
$$_join_words("recordedBy__additional__3__first", "recordedBy__additional__3__last")$$)
23 23
; -- runtime: 0.1 s ("Time: 132.596 ms") @starscream
24 24

  
25 25
SELECT mk_derived_col((:table_str, 'recordedBy__additional__4'),
26
$$_join_words("COLLECTOR 5 FIRST NAME", "COLLECTOR 5 LAST NAME")$$)
26
$$_join_words("recordedBy__additional__4__first", "recordedBy__additional__4__last")$$)
27 27
; -- runtime: 0.1 s ("Time: 132.078 ms") @starscream
28 28

  
29 29
SELECT mk_derived_col((:table_str, 'recordedBy'),
......
32 32

  
33 33

  
34 34
SELECT mk_derived_col((:table_str, 'identifiedBy'),
35
$$_join_words("DETERMINER FIRST NAME", "DETERMINER LAST NAME")$$)
35
$$_join_words("identifiedBy__first", "identifiedBy__last")$$)
36 36
; -- runtime: 0.3 s ("Time: 267.310 ms") @starscream
inputs/TEX/Specimen2/run
1
#!/bin/bash -e
2
. "$(dirname "${BASH_SOURCE[0]}")"/../table.run
0 3

  
inputs/TEX/Specimen2/map.csv
44 44
DET DATE,dateIdentified,,
45 45
DETERMINER INSTITUTION,*DETERMINER INSTITUTION,,
46 46
DET NOTES,identificationRemarks,,
47
dateCollected,dateCollected,,
48
recordedBy__primary,recordedBy__primary,,
49
recordedBy__additional__1,recordedBy__additional__1,,
50
recordedBy__additional__2,recordedBy__additional__2,,
51
recordedBy__additional__3,recordedBy__additional__3,,
52
recordedBy__additional__4,recordedBy__additional__4,,
53
recordedBy,recordedBy,,
54
identifiedBy,identifiedBy,,
inputs/TEX/Specimen2/test.xml.ref
11 11
                            <_units>
12 12
                                <to>m</to>
13 13
                                <to></to>
14
                                <value>$ELEVATION</value>
14
                                <value>$verbatimElevation</value>
15 15
                            </_units>
16 16
                        </elevation_m>
17 17
                        <iscultivated>
18 18
                            <_locationnarrative_is_cultivated>
19 19
                                <locationnarrative>
20 20
                                    <_join>
21
                                        <1>$LOCALITY</1>
22
                                        <3>$VEGETATION</3>
21
                                        <1>$locality</1>
22
                                        <3>$habitat</3>
23 23
                                    </_join>
24 24
                                </locationnarrative>
25 25
                            </_locationnarrative_is_cultivated>
......
28 28
                            <taxonoccurrence>
29 29
                                <aggregateoccurrence>
30 30
                                    <collectiondate>$dateCollected</collectiondate>
31
                                    <notes>$PLANT DATA</notes>
31
                                    <notes>$occurrenceRemarks</notes>
32 32
                                    <plantobservation>
33
                                        <authorplantcode>$COLLECTOR NUMBER</authorplantcode>
34
                                        <reproductivecondition>$PHENOLOGY</reproductivecondition>
33
                                        <authorplantcode>$collectorNumber</authorplantcode>
34
                                        <reproductivecondition>$reproductiveCondition</reproductivecondition>
35 35
                                        <specimenreplicate>
36
                                            <collectioncode_dwc>$HERBARIUM</collectioncode_dwc>
37
                                            <collectionnumber>$COLLECTOR NUMBER</collectionnumber>
36
                                            <collectioncode_dwc>$collection</collectioncode_dwc>
37
                                            <collectionnumber>$collectorNumber</collectionnumber>
38 38
                                        </specimenreplicate>
39 39
                                    </plantobservation>
40 40
                                </aggregateoccurrence>
......
44 44
                                        <cultivated>t</cultivated>
45 45
                                        <wild>f</wild>
46 46
                                        <*></*>
47
                                        <value>$ORIGIN</value>
47
                                        <value>$establishmentMeans</value>
48 48
                                    </_map>
49 49
                                </iscultivated>
50 50
                                <isnative>
......
52 52
                                        <native>t</native>
53 53
                                        <exotic>f</exotic>
54 54
                                        <*></*>
55
                                        <value>$ORIGIN</value>
55
                                        <value>$establishmentMeans</value>
56 56
                                    </_map>
57 57
                                </isnative>
58 58
                                <taxondetermination>
......
72 72
                                                                            <parent_id>
73 73
                                                                                <taxonlabel>
74 74
                                                                                    <rank>variety</rank>
75
                                                                                    <taxonepithet>$VARIETY</taxonepithet>
75
                                                                                    <taxonepithet>$variety</taxonepithet>
76 76
                                                                                    <parent_id>
77 77
                                                                                        <taxonlabel>
78 78
                                                                                            <rank>subspecies</rank>
79
                                                                                            <taxonepithet>$SUBSPECIES</taxonepithet>
79
                                                                                            <taxonepithet>$subspecies</taxonepithet>
80 80
                                                                                            <parent_id>
81 81
                                                                                                <taxonlabel>
82 82
                                                                                                    <rank>species</rank>
83
                                                                                                    <taxonepithet>$SPECIES</taxonepithet>
83
                                                                                                    <taxonepithet>$specificEpithet</taxonepithet>
84 84
                                                                                                    <parent_id>
85 85
                                                                                                        <taxonlabel>
86 86
                                                                                                            <rank>genus</rank>
87
                                                                                                            <taxonepithet>$GENUS</taxonepithet>
87
                                                                                                            <taxonepithet>$genus</taxonepithet>
88 88
                                                                                                            <parent_id>
89 89
                                                                                                                <taxonlabel>
90 90
                                                                                                                    <rank>family</rank>
91
                                                                                                                    <taxonepithet>$FAMILY</taxonepithet>
91
                                                                                                                    <taxonepithet>$family</taxonepithet>
92 92
                                                                                                                </taxonlabel>
93 93
                                                                                                            </parent_id>
94 94
                                                                                                        </taxonlabel>
......
107 107
                                                    </parent_id>
108 108
                                                    <taxonomicname>
109 109
                                                        <_merge_prefix>
110
                                                            <prefix><_taxon_family_require_std><family>$FAMILY</family></_taxon_family_require_std></prefix>
110
                                                            <prefix><_taxon_family_require_std><family>$family</family></_taxon_family_require_std></prefix>
111 111
                                                            <value>
112 112
                                                                <_join_words>
113 113
                                                                    <1>
114 114
                                                                        <_join_words>
115
                                                                            <2><_filter_genus><value>$GENUS</value></_filter_genus></2>
116
                                                                            <3>$SPECIES</3>
117
                                                                            <4>$SUBSPECIES</4>
115
                                                                            <2><_filter_genus><value>$genus</value></_filter_genus></2>
116
                                                                            <3>$specificEpithet</3>
117
                                                                            <4>$subspecies</4>
118 118
                                                                            <6>
119 119
                                                                                <_join_words>
120 120
                                                                                    <1>var. </1>
121
                                                                                    <2>$VARIETY</2>
121
                                                                                    <2>$variety</2>
122 122
                                                                                </_join_words>
123 123
                                                                            </6>
124 124
                                                                        </_join_words>
125 125
                                                                    </1>
126
                                                                    <2>$SPECIES AUTHORITY</2>
126
                                                                    <2>$scientificNameAuthorship</2>
127 127
                                                                </_join_words>
128 128
                                                            </value>
129 129
                                                        </_merge_prefix>
130 130
                                                    </taxonomicname>
131 131
                                                </taxonlabel>
132 132
                                            </taxonlabel_id>
133
                                            <author>$SPECIES AUTHORITY</author>
134
                                            <family>$FAMILY</family>
135
                                            <genus>$GENUS</genus>
136
                                            <specific_epithet>$SPECIES</specific_epithet>
133
                                            <author>$scientificNameAuthorship</author>
134
                                            <family>$family</family>
135
                                            <genus>$genus</genus>
136
                                            <specific_epithet>$specificEpithet</specific_epithet>
137 137
                                        </taxonverbatim>
138 138
                                    </taxonverbatim_id>
139
                                    <determinationdate><_dateRangeStart><value>$DET DATE</value></_dateRangeStart></determinationdate>
139
                                    <determinationdate><_dateRangeStart><value>$dateIdentified</value></_dateRangeStart></determinationdate>
140 140
                                </taxondetermination>
141 141
                            </taxonoccurrence>
142 142
                        </locationevent>
143 143
                        <locationnarrative>
144 144
                            <_merge>
145
                                <1>$LOCALITY</1>
145
                                <1>$locality</1>
146 146
                                <3>
147 147
                                    <_label>
148 148
                                        <label>habitat</label>
149
                                        <value>$VEGETATION</value>
149
                                        <value>$habitat</value>
150 150
                                    </_label>
151 151
                                </3>
152
                                <4>$MISC NOTES</4>
152
                                <4>$locationRemarks</4>
153 153
                            </_merge>
154 154
                        </locationnarrative>
155 155
                        <locationplace>
......
157 157
                                <place>
158 158
                                    <coordinates_id>
159 159
                                        <coordinates>
160
                                            <latitude_deg><_dms_to_dd><value>$LATITUDE</value></_dms_to_dd></latitude_deg>
161
                                            <longitude_deg><_dms_to_dd><value>$LONGITUDE</value></_dms_to_dd></longitude_deg>
162
                                            <verbatimlatitude>$LATITUDE</verbatimlatitude>
163
                                            <verbatimlongitude>$LONGITUDE</verbatimlongitude>
160
                                            <latitude_deg><_dms_to_dd><value>$latitude_DMS</value></_dms_to_dd></latitude_deg>
161
                                            <longitude_deg><_dms_to_dd><value>$longitude_DMS</value></_dms_to_dd></longitude_deg>
162
                                            <verbatimlatitude>$latitude_DMS</verbatimlatitude>
163
                                            <verbatimlongitude>$longitude_DMS</verbatimlongitude>
164 164
                                        </coordinates>
165 165
                                    </coordinates_id>
166
                                    <county>$COUNTY</county>
166
                                    <county>$county</county>
167 167
                                    <matched_place_id>
168 168
                                        <place>
169 169
                                            <source_id><source><shortname>geoscrub</shortname></source></source_id>
170 170
                                            <coordinates_id>
171 171
                                                <coordinates>
172 172
                                                    <source_id><source><shortname>geoscrub</shortname></source></source_id>
173
                                                    <latitude_deg><_dms_to_dd><value>$LATITUDE</value></_dms_to_dd></latitude_deg>
174
                                                    <longitude_deg><_dms_to_dd><value>$LONGITUDE</value></_dms_to_dd></longitude_deg>
173
                                                    <latitude_deg><_dms_to_dd><value>$latitude_DMS</value></_dms_to_dd></latitude_deg>
174
                                                    <longitude_deg><_dms_to_dd><value>$longitude_DMS</value></_dms_to_dd></longitude_deg>
175 175
                                                </coordinates>
176 176
                                            </coordinates_id>
177
                                            <county>$COUNTY</county>
178
                                            <stateprovince>$STATE</stateprovince>
177
                                            <county>$county</county>
178
                                            <stateprovince>$stateProvince</stateprovince>
179 179
                                        </place>
180 180
                                    </matched_place_id>
181
                                    <stateprovince>$STATE</stateprovince>
181
                                    <stateprovince>$stateProvince</stateprovince>
182 182
                                </place>
183 183
                            </place_id>
184 184
                        </locationplace>
185
                        <verbatimelevation>$ELEVATION</verbatimelevation>
185
                        <verbatimelevation>$verbatimElevation</verbatimelevation>
186 186
                    </location>
187 187
                </path>
188 188
            </_simplifyPath>
inputs/TEX/Specimen2/VegBIEN.csv
1
TEX,VegBIEN:/_setDefault:[source_id/source/shortname/_env:[name=source]]/path/_simplifyPath:[next=parent_id]/path,Comments
2
HERBARIUM,"/location/_if[@name=""if subplot""]/else/authorlocationcode/_first/3/_if[@name=""if plot""]/else/_alt/2/_if[@name=""if catalogNumber""]/then/_join/2/_join/1",
3
ELEVATION,"/location/elevation_m/_alt/1/_units:[to=m,to=]/value",
4
COLLECTOR NUMBER,"/location/iscultivated/_or/1/_if[@name=""if TaxonOccurrence""]/cond/_exists",
5
LOCALITY,/location/iscultivated/_or/2/_locationnarrative_is_cultivated/locationnarrative/_join/1,
6
VEGETATION,/location/iscultivated/_or/2/_locationnarrative_is_cultivated/locationnarrative/_join/3,
7
DET DATE,"/location/locationevent/taxonoccurrence/_if[@name=""if has accepted name""]/then/taxondetermination:[determinationtype=accepted]/determinationdate/_alt/1/_dateRangeStart/value",
8
dateCollected,/location/locationevent/taxonoccurrence/aggregateoccurrence/collectiondate/_alt/1,
9
PLANT DATA,/location/locationevent/taxonoccurrence/aggregateoccurrence/notes/_join/1, = specimenDescription
10
COLLECTOR NUMBER,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/authorplantcode/_first/2,
11
PHENOLOGY,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/reproductivecondition,
12
HERBARIUM,/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/collectioncode_dwc/_alt/1,Brad: Not sure if mapping correct. DwC element; code for entire collection; often same as InstitutionCode; Aaron: Combining with InstitutionCode to create collection name
13
COLLECTOR NUMBER,"/location/locationevent/taxonoccurrence/aggregateoccurrence/plantobservation/specimenreplicate/collectionnumber/_if[@name=""if indirect voucher""]/else",
14
COLLECTOR NUMBER,"/location/locationevent/taxonoccurrence/authortaxoncode/_if[@name=""if in plot""]/then/_first/2/_first/3",
15
recordedBy,/location/locationevent/taxonoccurrence/collector_id/party/fullname,
16
COLLECTOR NUMBER,"/location/locationevent/taxonoccurrence/iscultivated/_alt/1/_if[@name=""if TaxonOccurrence""]/cond/_exists",
17
ORIGIN,"/location/locationevent/taxonoccurrence/iscultivated/_alt/2/_map:[cultivated=t,wild=f,*=]/value",
18
ORIGIN,"/location/locationevent/taxonoccurrence/isnative/_map:[native=t,exotic=f,*=]/value",
19
identifiedBy,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/party/fullname,
20
VARIETY,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/parent_id/taxonlabel/parent_id/_forEach:[in:[cultivar,forma,],do=""taxonlabel[rank=_val]/parent_id""]/taxonlabel[rank=variety]/taxonepithet",
21
SUBSPECIES,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/parent_id/taxonlabel/parent_id/_forEach:[in:[cultivar,forma,variety,],do=""taxonlabel[rank=_val]/parent_id""]/taxonlabel[rank=subspecies]/taxonepithet",
22
SPECIES,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/parent_id/taxonlabel/parent_id/_forEach:[in:[cultivar,forma,variety,subspecies,],do=""taxonlabel[rank=_val]/parent_id""]/taxonlabel[rank=species]/taxonepithet",
23
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",
24
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",
25
FAMILY,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/prefix/_taxon_family_require_std/family,
26
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,
27
SPECIES,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/1/_alt/2/_join_words/3/_join_words/1,
28
SUBSPECIES,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/1/_alt/2/_join_words/4,
29
VARIETY,"/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/1/_alt/2/_join_words/6/_join_words:[1=""var. ""]/2",
30
SPECIES AUTHORITY,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/*_id/taxonlabel/taxonomicname/_merge_prefix/value/_alt/2/_join_words/2,
31
SPECIES AUTHORITY,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/author,
32
FAMILY,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/family,
33
GENUS,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/genus,
34
SPECIES,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/*_id/taxonverbatim/specific_epithet,
35
DET DATE,/location/locationevent/taxonoccurrence/taxondetermination[!isoriginal]/determinationdate/_alt/1/_dateRangeStart/value,
36
COLLECTOR NUMBER,"/location/locationevent/taxonoccurrence/voucher/*_id/specimenreplicate/collectionnumber/_if[@name=""if indirect voucher""]/then",
37
LOCALITY,/location/locationnarrative/_merge/1,
38
VEGETATION,"/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?"
39
MISC NOTES,/location/locationnarrative/_merge/4,
40
LATITUDE,/location/locationplace/*_id/place/*_id/coordinates/latitude_deg/_dms_to_dd/value,
41
LONGITUDE,/location/locationplace/*_id/place/*_id/coordinates/longitude_deg/_dms_to_dd/value,
42
LATITUDE,/location/locationplace/*_id/place/*_id/coordinates/verbatimlatitude,
43
LONGITUDE,/location/locationplace/*_id/place/*_id/coordinates/verbatimlongitude,
44
COUNTY,/location/locationplace/*_id/place/county,
45
LATITUDE,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/latitude_deg/_dms_to_dd/value",
46
LONGITUDE,"/location/locationplace/*_id/place/matched_place_id/place:[.,source_id/source/shortname=geoscrub]/*_id/coordinates:[source_id/source/shortname=geoscrub]/_first/2/longitude_deg/_dms_to_dd/value",
47
COUNTY,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/county/_first/2,
48
STATE,/location/locationplace/*_id/place/matched_place_id/place:[source_id/source/shortname=geoscrub]/stateprovince/_first/2,
49
STATE,/location/locationplace/*_id/place/stateprovince,
50
ELEVATION,/location/verbatimelevation,
51
BARCODE,,** No join mapping for barcode ** 
52
COLLECTOR 1 FIRST NAME,,** No join mapping for recordedBy__primary__first ** 
53
COLLECTOR 1 LAST NAME,,** No join mapping for recordedBy__primary__last ** 
54
COLLECTOR 2 FIRST NAME,,** No join mapping for recordedBy__additional__1__first ** 
55
COLLECTOR 2 LAST NAME,,** No join mapping for recordedBy__additional__1__last ** 
56
COLLECTOR 3 FIRST NAME,,** No join mapping for recordedBy__additional__2__first ** 
57
COLLECTOR 3 LAST NAME,,** No join mapping for recordedBy__additional__2__last ** 
58
COLLECTOR 4 FIRST NAME,,** No join mapping for recordedBy__additional__3__first ** 
59
COLLECTOR 4 LAST NAME,,** No join mapping for recordedBy__additional__3__last ** 
60
COLLECTOR 5 FIRST NAME,,** No join mapping for recordedBy__additional__4__first ** 
61
COLLECTOR 5 LAST NAME,,** No join mapping for recordedBy__additional__4__last ** 
62
DATABASED BY,,** No join mapping for *DATABASED BY ** 
63
DET NOTES,,** No join mapping for identificationRemarks ** 
64
DETERMINER FIRST NAME,,** No join mapping for identifiedBy__first ** 
65
DETERMINER INSTITUTION,,** No join mapping for *DETERMINER INSTITUTION ** 
66
DETERMINER LAST NAME,,** No join mapping for identifiedBy__last ** 
67
END DATE,,** No non-empty join mapping for UNUSED#END DATE ** 
68
EXACT DATE,,** No join mapping for dateCollected__scrubbed ** 
69
GENERAL DATE,,** No join mapping for dateCollected__verbatim ** 
70
LATLONG DATUM,,** No join mapping for *LATLONG DATUM ** 
71
LATLONG SOURCE,,** No join mapping for *LATLONG SOURCE ** 
72
SUBSPECIES AUTHOR,,** No join mapping for *SUBSPECIES AUTHOR ** 
73
UTM,,** No join mapping for *UTM ** 
74
VARIETY AUTHOR,,** No join mapping for *VARIETY AUTHOR ** 
75
recordedBy__additional__1,,** No join mapping for recordedBy__additional__1 ** 
76
recordedBy__additional__2,,** No join mapping for recordedBy__additional__2 ** 
77
recordedBy__additional__3,,** No join mapping for recordedBy__additional__3 ** 
78
recordedBy__additional__4,,** No join mapping for recordedBy__additional__4 ** 
79
recordedBy__primary,,** No join mapping for recordedBy__primary ** 
80
row_num,,** No join mapping for *row_num ** 
1
link ../../../mappings/VegCore-VegBIEN.csv
81 2

  
inputs/TEX/Specimen2/unmapped_terms.csv
22 22
identifiedBy__last
23 23
*DETERMINER INSTITUTION
24 24
identificationRemarks
25
recordedBy__primary
26
recordedBy__additional__1
27
recordedBy__additional__2
28
recordedBy__additional__3
29
recordedBy__additional__4

Also available in: Unified diff