1
- <cfoutput >
2
- <cfquery name =" ids" datasource =" uam_god" >
3
- select * from (
4
- select
5
- taxon_name_id
6
- from
7
- identification_taxonomy
8
- where
9
- taxon_name_id not in (select taxon_name_id from taxon_name)
10
- group by taxon_name_id
11
- ) where rownum< 21
12
-
13
- </cfquery >
14
-
15
- <cfdump var =#ids #>
16
- <cfloop query =" ids" >
17
- <!--- ----
18
- ------->
19
- <cfthread action =" run" name =" t#taxon_name_id #" taxon _name_id=" #taxon_name_id #" >
20
-
21
- <cfquery name =" d" datasource =" uam_god" >
22
- select * from taxonomy where taxon_name_id= ' #taxon_name_id #'
23
- </cfquery >
24
- <p >running for #d .SCIENTIFIC_NAME #</p >
25
- <cfquery name =" tt" datasource =" uam_god" >
26
- insert into taxon_name (taxon_name_id,scientific_name) values (#d .taxon_name_id #,' #d .SCIENTIFIC_NAME #' )
27
- </cfquery >
28
- <cfset orderedTerms = " KINGDOM,PHYLUM,PHYLCLASS,SUBCLASS,PHYLORDER,SUBORDER,SUPERFAMILY,FAMILY,SUBFAMILY,TRIBE,GENUS,SUBGENUS,SPECIES,SUBSPECIES" >
29
- <cfset pos = 1 >
30
- <!--- arctos "source_id" is just the taxon_name_id ---->
31
- <cfloop list =" #orderedTerms #" index =" termtype" >
32
- <cfset this TermVal = evaluate (" d." & termtype ) >
33
- <cfset this TermType = termtype >
34
- <cfif len (this TermVal ) gt 0 >
35
- <cfif this TermType is " SUBSPECIES" and len (d .INFRASPECIFIC_RANK ) gt 0 >
36
- <cfset this TermType = d .INFRASPECIFIC_RANK >
37
- </cfif >
38
- <cfquery name =" meta" datasource =" uam_god" >
39
- insert into taxon_term (
40
- taxon_term_id,
41
- taxon_name_id,
42
- term,
43
- term_type,
44
- source,
45
- position_in_classification,
46
- classification_id
47
- ) values (
48
- sq_taxon_term_id .nextval ,
49
- # d.taxon_name_id#,
50
- ' #this TermVal #' ,
51
- ' #lcase (this TermType ) #' ,
52
- ' Arctos' ,
53
- # pos#,
54
- ' #d .taxon_name_id #'
55
- )
56
- </cfquery >
57
- <cfset pos = pos + 1 >
58
- </cfif >
59
- </cfloop >
60
- <cfset orderedTerms = " VALID_CATALOG_TERM_FG|SOURCE_AUTHORITY|AUTHOR_TEXT|TAXON_REMARKS|NOMENCLATURAL_CODE|INFRASPECIFIC_AUTHOR|DISPLAY_NAME|TAXON_STATUS" >
61
- <cfloop list =" #orderedTerms #" index =" termtype" delimiters =" |" >
62
- <cfset this TermVal = evaluate (" d." & termtype ) >
63
- <cfif len (this TermVal ) gt 0 >
64
- <cfquery name =" meta" datasource =" uam_god" >
65
- insert into taxon_term (
66
- taxon_term_id,
67
- taxon_name_id,
68
- term,
69
- term_type,
70
- source
71
- ) values (
72
- sq_taxon_term_id .nextval ,
73
- # d.taxon_name_id#,
74
- ' #this TermVal #' ,
75
- ' #lcase (termtype ) #' ,
76
- ' Arctos'
77
- )
78
- </cfquery >
79
- <cfset pos = pos + 1 >
80
- </cfif >
81
- </cfloop >
82
- <cfhttp url =" http://resolver.globalnames.org/name_resolvers.json?names=#d .scientific_name #" ></cfhttp >
83
- <cfset x = DeserializeJSON (cfhttp .filecontent ) >
84
- <cfloop from =" 1" to =" #ArrayLen (x .data [1 ].results ) #" index =" i" >
85
- <cfset pos = 1 >
86
- <!--- because lists are stupid and ignore NULLs.... ---->
87
- <cfif structKeyExists (x .data [1 ].results [i ]," classification_path" ) and structKeyExists (x .data [1 ].results [i ]," classification_path_ranks" ) >
88
- <cfset cterms = ListToArray (x .data [1 ].results [i ].classification_path , " |" , true ) >
89
- <cfset cranks = ListToArray (x .data [1 ].results [i ].classification_path_ranks , " |" , true ) >
90
-
91
- <cfset this Source = x .data [1 ].results [i ].data_source_title >
92
- <!--- try to use something from them to uniquely identify the hierarchy---->
93
- <!---- failing that, make a local identifier useful only in patching the hierarchy back together ---->
94
- <cfset this SourceID = x .data [1 ].results [i ].classification_path_ids >
95
- <cfif len (this SourceID ) is 0 >
96
- <cfset this SourceID = CreateUUID () >
97
- </cfif >
98
- <cfset this Score = x .data [1 ].results [i ].score >
99
- <cfif len (this Score ) is 0 ><cfset this Score = 0 ></cfif >
100
- <cfset this NameString = x .data [1 ].results [i ].name_string >
101
- <cfset this CanonicalFormName = x .data [1 ].results [i ].canonical_form >
102
-
103
- <cfloop from =" 1" to =" #arrayLen (cterms ) #" index =" listPos" >
104
- <cfset this Term = cterms [listpos ] >
105
- <br >thisTerm: #this Term #
106
- <cfif ArrayIsDefined (cranks , listpos ) >
107
- <cfset this Rank = cranks [listpos ] >
108
- <cfelse >
109
- <cfset this Rank = ' ' >
110
- </cfif >
111
-
112
- <cfif len (this Term ) gt 0 >
113
- <cfquery name =" meta" datasource =" uam_god" >
114
- insert into taxon_term (
115
- taxon_term_id,
116
- taxon_name_id,
117
- term,
118
- term_type,
119
- source,
120
- position_in_classification,
121
- classification_id,
122
- gn_score
123
- ) values (
124
- sq_taxon_term_id .nextval ,
125
- # d.taxon_name_id#,
126
- ' #this Term #' ,
127
- ' #lcase (this Rank ) #' ,
128
- ' #this Source #' ,
129
- # pos#,
130
- ' #this SourceID #' ,
131
- # thisScore#
132
- )
133
- </cfquery >
134
- <cfset pos = pos + 1 >
135
- </cfif >
136
- </cfloop >
137
- <cfif len (this NameString ) gt 0 >
138
- <cfquery name =" meta" datasource =" uam_god" >
139
- insert into taxon_term (
140
- taxon_term_id,
141
- taxon_name_id,
142
- term,
143
- term_type,
144
- source
145
- ) values (
146
- sq_taxon_term_id .nextval ,
147
- # d.taxon_name_id#,
148
- ' #this NameString #' ,
149
- ' name string' ,
150
- ' #this Source #'
151
- )
152
- </cfquery >
153
- </cfif >
154
- <cfif len (this CanonicalFormName ) gt 0 >
155
- <cfquery name =" meta" datasource =" uam_god" >
156
- insert into taxon_term (
157
- taxon_term_id,
158
- taxon_name_id,
159
- term,
160
- term_type,
161
- source
162
- ) values (
163
- sq_taxon_term_id .nextval ,
164
- # d.taxon_name_id#,
165
- ' #this CanonicalFormName #' ,
166
- ' canonical name' ,
167
- ' #this Source #'
168
- )
169
- </cfquery >
170
- </cfif >
171
- </cfif >
172
- </cfloop >
173
- </cfthread >
174
-
175
- <!--- -----
176
- -------->
177
- </cfloop >
178
- </cfoutput >
1
+ use the version in 5.4.7
0 commit comments