1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.cdm.app.eflora;
|
11
|
|
12
|
import java.net.URI;
|
13
|
import java.util.HashSet;
|
14
|
import java.util.List;
|
15
|
import java.util.Set;
|
16
|
import java.util.UUID;
|
17
|
|
18
|
import org.apache.log4j.Logger;
|
19
|
import org.springframework.transaction.TransactionStatus;
|
20
|
|
21
|
import eu.etaxonomy.cdm.api.service.ITermService;
|
22
|
import eu.etaxonomy.cdm.database.DbSchemaValidation;
|
23
|
import eu.etaxonomy.cdm.database.ICdmDataSource;
|
24
|
import eu.etaxonomy.cdm.io.common.CdmDefaultImport;
|
25
|
import eu.etaxonomy.cdm.io.common.IImportConfigurator.CHECK;
|
26
|
import eu.etaxonomy.cdm.io.common.events.IIoObserver;
|
27
|
import eu.etaxonomy.cdm.io.common.events.LoggingIoObserver;
|
28
|
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
|
29
|
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
|
30
|
import eu.etaxonomy.cdm.io.eflora.floraMalesiana.FloraMalesianaTransformer;
|
31
|
import eu.etaxonomy.cdm.io.markup.MarkupImportConfigurator;
|
32
|
import eu.etaxonomy.cdm.model.description.Feature;
|
33
|
import eu.etaxonomy.cdm.model.description.FeatureNode;
|
34
|
import eu.etaxonomy.cdm.model.description.FeatureTree;
|
35
|
import eu.etaxonomy.cdm.model.description.PolytomousKey;
|
36
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
37
|
import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
|
38
|
|
39
|
/**
|
40
|
* @author a.mueller
|
41
|
* @created 20.06.2008
|
42
|
*/
|
43
|
public class FloraMalesianaActivator extends EfloraActivatorBase {
|
44
|
private static final Logger logger = Logger.getLogger(FloraMalesianaActivator.class);
|
45
|
|
46
|
//database validation status (create, update, validate ...)
|
47
|
static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
|
48
|
|
49
|
|
50
|
|
51
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_malesiana_preview();
|
52
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_flora_malesiana_production();
|
53
|
static final ICdmDataSource cdmDestination = CdmDestinations.localH2();
|
54
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
|
55
|
// static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql_test();
|
56
|
|
57
|
private final boolean includeBase = false;
|
58
|
|
59
|
//5880 / 121834
|
60
|
//2 footnote issues
|
61
|
//habitat: 6 syso, + ???
|
62
|
private final boolean includeVol04 = includeBase;
|
63
|
//6258 / 110625
|
64
|
//11 sysos, + ??
|
65
|
private final boolean includeVol05 = includeBase;
|
66
|
//8097 / 177845
|
67
|
//2 sysos (<sub>
|
68
|
//102 keys
|
69
|
private final boolean includeVol06 = includeBase;
|
70
|
|
71
|
//2283 /49700
|
72
|
//no syso, 120 lifecycle, few of them references! and figureRef?
|
73
|
private final boolean includeVol07_1 = includeBase;
|
74
|
//1640
|
75
|
//keys: 1 nothofagus; 4 quercus
|
76
|
//12 syso, no uncovered, >>100 lifecycle, >10 references, figureRefs?
|
77
|
private final boolean includeVol07_2 = includeBase;
|
78
|
//4225
|
79
|
//430 syso (10 subheadings),no uncovered, 43 figureRef, references and lifecycle
|
80
|
private final boolean includeVol07_3_09_1 = includeBase;
|
81
|
//561 / 12440
|
82
|
//no syso, 14 lifecycle, 1 reference
|
83
|
private final boolean includeVol07_4 = includeBase;
|
84
|
|
85
|
//223 / 5986
|
86
|
//no syso, 5 lifecycle
|
87
|
private final boolean includeVol08_1 = includeBase;
|
88
|
//2830 / 53189
|
89
|
//keys: 23 S. Moore -> Symplocos Moore (handle manually before import)
|
90
|
//4syso, <= uncovered, <150 lifecycle, figureRef and references
|
91
|
private final boolean includeVol08_2 = includeBase;
|
92
|
//2912 / 54235
|
93
|
//no syso
|
94
|
private final boolean includeVol08_3 = includeBase;
|
95
|
//4641 / 94566
|
96
|
//184 syso!! (30 subheadings), <=3 uncovered, <50 lifecycle and figureRef
|
97
|
private final boolean includeVol09 = includeBase;
|
98
|
//845 / 19098
|
99
|
//no syso, <= 5 uncovered, <=50 lifecycle
|
100
|
private final boolean includeVol10_1 = includeBase;
|
101
|
//1211 / 32334
|
102
|
//6 syso, <=3 uncovered, <50 lifecycle
|
103
|
private final boolean includeVol10_2 = includeBase;
|
104
|
//1993 / 49034
|
105
|
//2 syso habitats, 2 fast, many lifcycle
|
106
|
private final boolean includeVol10_3 = includeBase;
|
107
|
//533 / 13553
|
108
|
//no syso, 1 uncovered, 1 figureRef, 10 lifecycle
|
109
|
private final boolean includeVol10_4 = includeBase;
|
110
|
//1529 / 36379
|
111
|
//keys: 1 manually (a sect. botrycephalae)
|
112
|
//no syso, <= 10 uncovered, < 100 lifecycle
|
113
|
private final boolean includeVol11_1 = includeBase;
|
114
|
//1271 / 24775
|
115
|
//keys: 2 cultivar groups (a cultivar group aggregatum; b cultivar group common onion)
|
116
|
//no syso, 1 uncovered, 1 lifecycle, 2 references
|
117
|
private final boolean includeVol11_2 = includeBase;
|
118
|
//4582 / 52747
|
119
|
//1 empty "[]"
|
120
|
//no syso habitat, <10 uncovered, > 100 lifecycles
|
121
|
private final boolean includeVol11_3 = includeBase;
|
122
|
//6135 / 116737
|
123
|
//keys: 10 apostrophs
|
124
|
//habitat: no syso, 200 - 400 uncovered, different types
|
125
|
private final boolean includeVol12 = includeBase;
|
126
|
//2865 / 43764
|
127
|
//keys: 1 manual (Loranthaceae)
|
128
|
//no syso, 1 uncovered habitat
|
129
|
private final boolean includeVol13 = includeBase;
|
130
|
//4843 / 55501
|
131
|
//no syso habitat, 100-150 uncovered, most of them flowering and fruiting lifecycle
|
132
|
private final boolean includeVol14 = includeBase;
|
133
|
//1775 / 16415
|
134
|
//no syso, 5 uncovered, 2 of them epiphytic
|
135
|
private final boolean includeVol15 = includeBase;
|
136
|
//1471 / 22049
|
137
|
//no syso, <= 60 uncovered, very different types
|
138
|
private final boolean includeVol16 = includeBase;
|
139
|
|
140
|
//4113 / 116956
|
141
|
//no syso, medium # uncovered habitat (some or)
|
142
|
private final boolean includeVol17 = includeBase;
|
143
|
//6422 / 71151
|
144
|
//no syso habitat, <20 uncovered
|
145
|
private final boolean includeVol18 = includeBase;
|
146
|
//2612 / 27663
|
147
|
//no syso habitat, <= 50 uncovered, mostly untagged lifecycle, some errors
|
148
|
private final boolean includeVol19 = includeBase;
|
149
|
//563 / 5866
|
150
|
//no syso, < 20 uncovered, mostly untagged lifecycle
|
151
|
private final boolean includeVol20 = includeBase;
|
152
|
//1735 / 19469
|
153
|
//no syso, no covered, medium # lifecycle and very few references
|
154
|
private final boolean includeVol21 = ! includeBase;
|
155
|
|
156
|
//Ser II
|
157
|
//5798 / 123.627
|
158
|
//2 manually, 9 non standard(?), 2 hybrids(?)
|
159
|
//no syso habitat, only figureRef and references as habitat issues
|
160
|
private final boolean includeVol2_1 = includeBase;
|
161
|
//1054 / 25100
|
162
|
//2 hybrid formulas
|
163
|
//no syso, no habitat issue
|
164
|
private final boolean includeVol2_2 = includeBase;
|
165
|
//2382 / 52100
|
166
|
//no syso, 10-15 uncovered, 2 unexpected attributes: extra
|
167
|
private final boolean includeVol2_3 = includeBase;
|
168
|
//1045 / 12240
|
169
|
//no syso, 1 <br>
|
170
|
private final boolean includeVol2_4 = includeBase;
|
171
|
|
172
|
|
173
|
static final URI fmSource04 = EfloraSources.fm_04();
|
174
|
static final URI fmSource05 = EfloraSources.fm_05();
|
175
|
static final URI fmSource06 = EfloraSources.fm_06();
|
176
|
static final URI fmSource07_1 = EfloraSources.fm_07_1();
|
177
|
static final URI fmSource07_2 = EfloraSources.fm_07_2();
|
178
|
static final URI fmSource07_3_09_1 = EfloraSources.fm_07_3_09_1();
|
179
|
static final URI fmSource07_4 = EfloraSources.fm_07_4();
|
180
|
|
181
|
static final URI fmSource08_1 = EfloraSources.fm_08_1();
|
182
|
static final URI fmSource08_2 = EfloraSources.fm_08_2();
|
183
|
static final URI fmSource08_3 = EfloraSources.fm_08_3();
|
184
|
|
185
|
static final URI fmSource09 = EfloraSources.fm_09();
|
186
|
|
187
|
static final URI fmSource10_1 = EfloraSources.fm_10_1();
|
188
|
static final URI fmSource10_2 = EfloraSources.fm_10_2();
|
189
|
static final URI fmSource10_3 = EfloraSources.fm_10_3();
|
190
|
static final URI fmSource10_4 = EfloraSources.fm_10_4();
|
191
|
|
192
|
|
193
|
static final URI fmSource11_1 = EfloraSources.fm_11_1();
|
194
|
static final URI fmSource11_2 = EfloraSources.fm_11_2();
|
195
|
static final URI fmSource11_3 = EfloraSources.fm_11_3();
|
196
|
static final URI fmSource12_1 = EfloraSources.fm_12();
|
197
|
static final URI fmSource13 = EfloraSources.fm_13();
|
198
|
static final URI fmSource14 = EfloraSources.fm_14();
|
199
|
static final URI fmSource15 = EfloraSources.fm_15();
|
200
|
static final URI fmSource16 = EfloraSources.fm_16();
|
201
|
static final URI fmSource17 = EfloraSources.fm_17();
|
202
|
static final URI fmSource17_1 = EfloraSources.fm_17_1();
|
203
|
static final URI fmSource17_2 = EfloraSources.fm_17_2();
|
204
|
static final URI fmSource18 = EfloraSources.fm_18();
|
205
|
static final URI fmSource19 = EfloraSources.fm_19();
|
206
|
static final URI fmSource20 = EfloraSources.fm_20();
|
207
|
static final URI fmSource21 = EfloraSources.fm_21();
|
208
|
|
209
|
static final URI fmSource_Ser2_01 = EfloraSources.fm_ser2_1();
|
210
|
static final URI fmSource_Ser2_02 = EfloraSources.fm_ser2_2();
|
211
|
static final URI fmSource_Ser2_03 = EfloraSources.fm_ser2_3();
|
212
|
static final URI fmSource_Ser2_04 = EfloraSources.fm_ser2_4();
|
213
|
|
214
|
private final boolean h2ForCheck = true;
|
215
|
|
216
|
static final boolean reuseState = true; //when running multiple imports
|
217
|
|
218
|
//feature tree uuid
|
219
|
public static final UUID featureTreeUuid = UUID.fromString("168df0c6-6429-484c-b26f-ded1f7e44bd9");
|
220
|
private static final String featureTreeTitle = "Flora Malesiana Presentation Feature Tree";
|
221
|
|
222
|
//classification
|
223
|
static final UUID classificationUuid = UUID.fromString("ca4e4bcb-a1d1-4124-a358-a3d3c41dd450");
|
224
|
static final String classificationTitle = "Flora Malesiana";
|
225
|
|
226
|
//check - import
|
227
|
static CHECK check = CHECK.IMPORT_WITHOUT_CHECK;
|
228
|
|
229
|
static boolean doPrintKeys = false;
|
230
|
|
231
|
//taxa
|
232
|
static final boolean doTaxa = true;
|
233
|
|
234
|
|
235
|
private final boolean replaceStandardKeyTitles = false;
|
236
|
|
237
|
private final IIoObserver observer = new LoggingIoObserver();
|
238
|
private final Set<IIoObserver> observerList = new HashSet<IIoObserver>();
|
239
|
|
240
|
|
241
|
private void doImport(ICdmDataSource cdmDestination){
|
242
|
observerList.add(observer);
|
243
|
if (h2ForCheck && cdmDestination.getDatabaseType().equals(CdmDestinations.localH2().getDatabaseType())){
|
244
|
check = CHECK.CHECK_ONLY;
|
245
|
}
|
246
|
|
247
|
//make Source
|
248
|
// URI source = fmSource13_small;
|
249
|
URI source = null;
|
250
|
|
251
|
MarkupImportConfigurator markupConfig= MarkupImportConfigurator.NewInstance(source, cdmDestination);
|
252
|
markupConfig.setClassificationUuid(classificationUuid);
|
253
|
markupConfig.setClassificationName(classificationTitle);
|
254
|
markupConfig.setDoTaxa(doTaxa);
|
255
|
markupConfig.setCheck(check);
|
256
|
markupConfig.setDoPrintKeys(doPrintKeys);
|
257
|
markupConfig.setDbSchemaValidation(hbm2dll);
|
258
|
markupConfig.setObservers(observerList);
|
259
|
markupConfig.setReplaceStandardKeyTitles(replaceStandardKeyTitles);
|
260
|
markupConfig.setReuseExistingState(reuseState);
|
261
|
|
262
|
markupConfig.setSourceReference(getSourceReference("Flora Malesiana - Vol. 13"));
|
263
|
|
264
|
CdmDefaultImport<MarkupImportConfigurator> myImport = new CdmDefaultImport<MarkupImportConfigurator>();
|
265
|
|
266
|
//Vol04
|
267
|
doSource(includeVol04, fmSource04, "Flora Malesiana - vol. 4", markupConfig, myImport);
|
268
|
//Vol05
|
269
|
doSource(includeVol05, fmSource05, "Flora Malesiana - vol. 5", markupConfig, myImport);
|
270
|
//Vol06
|
271
|
doSource(includeVol06, fmSource06, "Flora Malesiana - vol. 6", markupConfig, myImport);
|
272
|
//Vol07_1
|
273
|
doSource(includeVol07_1, fmSource07_1, "Flora Malesiana - vol. 7, pt.1", markupConfig, myImport);
|
274
|
//Vol07_2
|
275
|
doSource(includeVol07_2, fmSource07_2, "Flora Malesiana - vol. 7, pt.2", markupConfig, myImport);
|
276
|
//Vol07_3
|
277
|
doSource(includeVol07_3_09_1, fmSource07_3_09_1, "Flora Malesiana - vol. 7, pt.3 and vol. 9 pt.1", markupConfig, myImport);
|
278
|
//Vol07_4
|
279
|
doSource(includeVol07_4, fmSource07_4, "Flora Malesiana - vol. 7, pt.4", markupConfig, myImport);
|
280
|
|
281
|
//Vol08_1
|
282
|
doSource(includeVol08_1, fmSource08_1, "Flora Malesiana - vol. 8, pt.1", markupConfig, myImport);
|
283
|
|
284
|
//Vol08_2
|
285
|
doSource(includeVol08_2, fmSource08_2, "Flora Malesiana - vol. 8, pt.2", markupConfig, myImport);
|
286
|
|
287
|
//Vol08_3
|
288
|
doSource(includeVol08_3, fmSource08_3, "Flora Malesiana - vol. 8, pt.3", markupConfig, myImport);
|
289
|
|
290
|
//Vol09
|
291
|
doSource(includeVol09, fmSource09, "Flora Malesiana - vol. 9", markupConfig, myImport);
|
292
|
|
293
|
//Vol10_1
|
294
|
doSource(includeVol10_1, fmSource10_1, "Flora Malesiana - vol. 10, pt.1", markupConfig, myImport);
|
295
|
|
296
|
//Vol10_2
|
297
|
doSource(includeVol10_2, fmSource10_2, "Flora Malesiana - vol. 10, pt.2", markupConfig, myImport);
|
298
|
|
299
|
//Vol10_3
|
300
|
doSource(includeVol10_3, fmSource10_3, "Flora Malesiana - vol. 10, pt.3", markupConfig, myImport);
|
301
|
|
302
|
//Vol10_4
|
303
|
doSource(includeVol10_4, fmSource10_4, "Flora Malesiana - vol. 10, pt.4", markupConfig, myImport);
|
304
|
|
305
|
//Vol11_1
|
306
|
doSource(includeVol11_1, fmSource11_1, "Flora Malesiana - vol. 11, pt.1", markupConfig, myImport);
|
307
|
|
308
|
//Vol11_2
|
309
|
doSource(includeVol11_2, fmSource11_2, "Flora Malesiana - vol. 11, pt.2", markupConfig, myImport);
|
310
|
|
311
|
//Vol11_3
|
312
|
doSource(includeVol11_3, fmSource11_3, "Flora Malesiana - vol. 11, pt.3", markupConfig, myImport);
|
313
|
|
314
|
//Vol12_1
|
315
|
doSource(includeVol12, fmSource12_1, "Flora Malesiana - vol. 12", markupConfig, myImport);
|
316
|
|
317
|
//Vol13_large
|
318
|
doSource(includeVol13, fmSource13, "Flora Malesiana - vol. 13", markupConfig, myImport);
|
319
|
|
320
|
//Vol14
|
321
|
doSource(includeVol14, fmSource14, "Flora Malesiana - vol. 14", markupConfig, myImport);
|
322
|
|
323
|
//Vol15
|
324
|
doSource(includeVol15, fmSource15, "Flora Malesiana - vol. 15", markupConfig, myImport);
|
325
|
|
326
|
//Vol16
|
327
|
doSource(includeVol16, fmSource16, "Flora Malesiana - vol. 16", markupConfig, myImport);
|
328
|
|
329
|
//Vol17, part1+2
|
330
|
doSource(includeVol17, fmSource17, "Flora Malesiana - vol. 17, part I and II", markupConfig, myImport);
|
331
|
|
332
|
// //Vol17, part1
|
333
|
// doSource(includeVol17_1, fmSource17_1, "Flora Malesiana - vol. 17, part I", markupConfig, myImport);
|
334
|
//
|
335
|
// //Vol17, part2
|
336
|
// doSource(includeVol17_2, fmSource17_2, "Flora Malesiana - vol. 17, part II", markupConfig, myImport);
|
337
|
|
338
|
//Vol18
|
339
|
doSource(includeVol18, fmSource18, "Flora Malesiana - vol. 18", markupConfig, myImport);
|
340
|
|
341
|
//Vol19
|
342
|
doSource(includeVol19, fmSource19, "Flora Malesiana - vol. 19", markupConfig, myImport);
|
343
|
|
344
|
//Vol20
|
345
|
doSource(includeVol20, fmSource20, "Flora Malesiana - vol. 20", markupConfig, myImport);
|
346
|
|
347
|
//Vol21
|
348
|
doSource(includeVol21, fmSource21, "Flora Malesiana - vol. 21", markupConfig, myImport);
|
349
|
|
350
|
//Vol_2_1
|
351
|
doSource(includeVol2_1, fmSource_Ser2_01, "Flora Malesiana - Ser.2, vol. 1", markupConfig, myImport);
|
352
|
|
353
|
//Vol_2_2
|
354
|
doSource(includeVol2_2, fmSource_Ser2_02, "Flora Malesiana - Ser.2, vol. 2", markupConfig, myImport);
|
355
|
|
356
|
//Vol_2_3
|
357
|
doSource(includeVol2_3, fmSource_Ser2_03, "Flora Malesiana - Ser.2, vol. 3", markupConfig, myImport);
|
358
|
|
359
|
//Vol_2_3
|
360
|
doSource(includeVol2_4, fmSource_Ser2_04, "Flora Malesiana - Ser.2, vol. 4", markupConfig, myImport);
|
361
|
|
362
|
|
363
|
makeAutomatedFeatureTree(myImport.getCdmAppController(), markupConfig.getState(),
|
364
|
featureTreeUuid, featureTreeTitle);
|
365
|
|
366
|
// makeGeoService();
|
367
|
|
368
|
FeatureTree tree = makeFeatureNode(myImport.getCdmAppController().getTermService());
|
369
|
myImport.getCdmAppController().getFeatureTreeService().saveOrUpdate(tree);
|
370
|
|
371
|
//check keys
|
372
|
if (doPrintKeys){
|
373
|
TransactionStatus tx = myImport.getCdmAppController().startTransaction();
|
374
|
List<PolytomousKey> keys = myImport.getCdmAppController().getPolytomousKeyService().list(PolytomousKey.class, null, null, null, null);
|
375
|
for(PolytomousKey key : keys){
|
376
|
key.print(System.out);
|
377
|
System.out.println();
|
378
|
}
|
379
|
myImport.getCdmAppController().commitTransaction(tx);
|
380
|
}
|
381
|
|
382
|
}
|
383
|
|
384
|
private void doSource(boolean doInclude, URI source, String sourceTitle, MarkupImportConfigurator markupConfig,
|
385
|
CdmDefaultImport<MarkupImportConfigurator> myImport) {
|
386
|
if (doInclude){
|
387
|
System.out.println("\nStart import from ("+ source.toString() + ") ...");
|
388
|
markupConfig.setSource(source);
|
389
|
markupConfig.setSourceReference(getSourceReference(sourceTitle));
|
390
|
myImport.invoke(markupConfig);
|
391
|
System.out.println("End import from ("+ source.toString() + ")...");
|
392
|
}
|
393
|
}
|
394
|
|
395
|
private Reference getSourceReference(String string) {
|
396
|
Reference result = ReferenceFactory.newGeneric();
|
397
|
result.setTitleCache(string, true);
|
398
|
return result;
|
399
|
}
|
400
|
|
401
|
private FeatureTree makeFeatureNode(ITermService service){
|
402
|
FloraMalesianaTransformer transformer = new FloraMalesianaTransformer();
|
403
|
|
404
|
FeatureTree result = FeatureTree.NewInstance(UUID.randomUUID());
|
405
|
result.setTitleCache("Flora Malesiana Presentation Feature Tree - Old", true);
|
406
|
FeatureNode root = result.getRoot();
|
407
|
FeatureNode newNode;
|
408
|
|
409
|
newNode = FeatureNode.NewInstance(Feature.DESCRIPTION());
|
410
|
root.addChild(newNode);
|
411
|
|
412
|
addFeataureNodesByStringList(descriptionFeatureList, newNode, transformer, service);
|
413
|
|
414
|
addFeataureNodesByStringList(generellDescriptionsUpToAnatomyList, root, transformer, service);
|
415
|
newNode = FeatureNode.NewInstance(Feature.ANATOMY());
|
416
|
addFeataureNodesByStringList(anatomySubfeatureList, newNode, transformer, service);
|
417
|
|
418
|
newNode = addFeataureNodesByStringList(generellDescriptionsFromAnatomyToPhytoChemoList, root, transformer, service);
|
419
|
addFeataureNodesByStringList(phytoChemoSubFeaturesList, newNode, transformer, service);
|
420
|
|
421
|
newNode = addFeataureNodesByStringList(generellDescriptionsFromPhytoChemoList, root, transformer, service);
|
422
|
|
423
|
|
424
|
newNode = FeatureNode.NewInstance(Feature.DISTRIBUTION());
|
425
|
root.addChild(newNode);
|
426
|
|
427
|
newNode = FeatureNode.NewInstance(Feature.ECOLOGY());
|
428
|
root.addChild(newNode);
|
429
|
addFeataureNodesByStringList(habitatEcologyList, root, transformer, service);
|
430
|
|
431
|
newNode = FeatureNode.NewInstance(Feature.USES());
|
432
|
root.addChild(newNode);
|
433
|
|
434
|
addFeataureNodesByStringList(chomosomesList, root, transformer, service);
|
435
|
|
436
|
newNode = FeatureNode.NewInstance(Feature.CITATION());
|
437
|
root.addChild(newNode);
|
438
|
|
439
|
return result;
|
440
|
}
|
441
|
|
442
|
private static String [] chomosomesList = new String[]{
|
443
|
"Chromosomes",
|
444
|
};
|
445
|
|
446
|
|
447
|
private static String [] habitatEcologyList = new String[]{
|
448
|
"Habitat",
|
449
|
"Habitat & Ecology"
|
450
|
};
|
451
|
|
452
|
|
453
|
private static String [] generellDescriptionsUpToAnatomyList = new String[]{
|
454
|
"Fossils",
|
455
|
"Morphology and anatomy",
|
456
|
"Morphology",
|
457
|
"Vegetative morphology and anatomy",
|
458
|
};
|
459
|
|
460
|
|
461
|
private static String [] anatomySubfeatureList = new String[]{
|
462
|
"Leaf anatomy",
|
463
|
"Wood anatomy"
|
464
|
};
|
465
|
|
466
|
private static String [] generellDescriptionsFromAnatomyToPhytoChemoList = new String[]{
|
467
|
"Flower morphology",
|
468
|
"Palynology",
|
469
|
"Pollination",
|
470
|
"Pollen morphology",
|
471
|
"embryology",
|
472
|
"cytology",
|
473
|
"Life cycle",
|
474
|
"Fruits and embryology",
|
475
|
"Dispersal",
|
476
|
"Chromosome numbers",
|
477
|
"Phytochemistry and Chemotaxonomy",
|
478
|
};
|
479
|
|
480
|
|
481
|
private static String [] phytoChemoSubFeaturesList = new String[]{
|
482
|
"Alkaloids",
|
483
|
"Iridoid glucosides",
|
484
|
"Leaf phenolics",
|
485
|
"Storage products of seeds",
|
486
|
"Aluminium",
|
487
|
"Chemotaxonomy",
|
488
|
};
|
489
|
|
490
|
|
491
|
private static String [] generellDescriptionsFromPhytoChemoList = new String[]{
|
492
|
"Phytochemistry",
|
493
|
"Taxonomy",
|
494
|
"history",
|
495
|
"cultivation",
|
496
|
"Notes"
|
497
|
};
|
498
|
|
499
|
|
500
|
private static String [] descriptionFeatureList = new String[]{
|
501
|
"lifeform",
|
502
|
"Bark",
|
503
|
//new
|
504
|
"wood",
|
505
|
"Indumentum",
|
506
|
"endophytic body",
|
507
|
"flowering buds",
|
508
|
"Branchlets",
|
509
|
"Branches",
|
510
|
"Branch",
|
511
|
"Flowering branchlets",
|
512
|
"Trees",
|
513
|
"Twigs",
|
514
|
"stem",
|
515
|
"Stems",
|
516
|
"stem leaves",
|
517
|
"Leaves",
|
518
|
"flower-bearing stems",
|
519
|
"Petiole",
|
520
|
"Petiolules",
|
521
|
"Leaflets",
|
522
|
"Thyrsus",
|
523
|
"Thyrses",
|
524
|
"Inflorescences",
|
525
|
"Inflorescence",
|
526
|
"Young inflorescences",
|
527
|
"Male inflorescences",
|
528
|
"Female inflorescences",
|
529
|
"Bracts",
|
530
|
"Pedicels",
|
531
|
"flowering buds",
|
532
|
"scales",
|
533
|
"Buds",
|
534
|
"Flowers",
|
535
|
"Flower",
|
536
|
"Flowering",
|
537
|
"Stigma",
|
538
|
"perianth",
|
539
|
"Sepals",
|
540
|
"Sepal",
|
541
|
"Outer Sepals",
|
542
|
"Axillary",
|
543
|
"cymes",
|
544
|
"Calyx",
|
545
|
"Petal",
|
546
|
"Petals",
|
547
|
"perigone",
|
548
|
"perigone lobes",
|
549
|
"perigone tube",
|
550
|
"Disc",
|
551
|
"corolla",
|
552
|
"Stamens",
|
553
|
"Staminodes",
|
554
|
"Ovary",
|
555
|
"Anthers",
|
556
|
"anther",
|
557
|
"Pistil",
|
558
|
"Pistillode",
|
559
|
"Ovules",
|
560
|
"androecium",
|
561
|
"gynoecium",
|
562
|
"Filaments",
|
563
|
"Style",
|
564
|
"annulus",
|
565
|
"female flowers",
|
566
|
"Male flowers",
|
567
|
"Female",
|
568
|
"Infructescences", //order not consistent (sometimes before "Flowers")
|
569
|
"Fruit",
|
570
|
"Fruits",
|
571
|
"fruiting axes",
|
572
|
"drupes",
|
573
|
"Arillode",
|
574
|
"seed",
|
575
|
"Seeds",
|
576
|
"Seedling",
|
577
|
"flower tube",
|
578
|
"nutlets",
|
579
|
"pollen",
|
580
|
"secondary xylem",
|
581
|
"chromosome number",
|
582
|
|
583
|
"figure",
|
584
|
"fig",
|
585
|
"figs",
|
586
|
|
587
|
|
588
|
|
589
|
};
|
590
|
|
591
|
public FeatureNode addFeataureNodesByStringList(String[] featureStringList, FeatureNode root, IInputTransformer transformer, ITermService termService){
|
592
|
FeatureNode lastChild = null;
|
593
|
try {
|
594
|
for (String featureString : featureStringList){
|
595
|
UUID featureUuid;
|
596
|
featureUuid = transformer.getFeatureUuid(featureString);
|
597
|
Feature feature = (Feature)termService.find(featureUuid);
|
598
|
if (feature != null){
|
599
|
FeatureNode child = FeatureNode.NewInstance(feature);
|
600
|
root.addChild(child);
|
601
|
}
|
602
|
}
|
603
|
|
604
|
} catch (UndefinedTransformerMethodException e) {
|
605
|
logger.error("getFeatureUuid is not implemented in transformer. Features could not be added");
|
606
|
}
|
607
|
return lastChild;
|
608
|
}
|
609
|
|
610
|
|
611
|
|
612
|
/**
|
613
|
* @param args
|
614
|
*/
|
615
|
public static void main(String[] args) {
|
616
|
FloraMalesianaActivator me = new FloraMalesianaActivator();
|
617
|
me.doImport(cdmDestination);
|
618
|
System.exit(0);
|
619
|
}
|
620
|
|
621
|
}
|