Project

General

Profile

« Previous | Next » 

Revision 7ec0eb3f

Added by Andreas Müller over 11 years ago

caryophyllales import final version

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/caryophyllales/CaryoActivator.java
43 43
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_test_local_mysql();
44 44
//	static final ICdmDataSource cdmDestination = CdmDestinations.cdm_local_postgres_CdmTest();
45 45
	
46
	static final String classificationName = "Caryophyllales";
46 47
	
47 48
	//classification
48 49
	static final UUID classificationUuid = UUID.fromString("9edc58b5-de3b-43aa-9f31-1ede7c009c2b");
......
52 53
	
53 54
	//taxa
54 55
	static final boolean doTaxa = true;
55
	static final boolean doDeduplicate = false;
56
	static final boolean doDeduplicate = true;
56 57
	
57 58
	
58 59
	private void doImport(ICdmDataSource cdmDestination){
......
64 65
		config.setDoTaxa(doTaxa);
65 66
		config.setDbSchemaValidation(hbm2dll);
66 67
		config.setSourceReferenceTitle("NCU - Caryophyllales, v0.4");
68
		config.setClassificationName(classificationName);
67 69
		
68 70
		CdmDefaultImport<CaryoImportConfigurator> myImport = new CdmDefaultImport<CaryoImportConfigurator>();
69 71

  
app-import/src/main/java/eu/etaxonomy/cdm/io/caryo/CaryoTaxonImport.java
26 26
import eu.etaxonomy.cdm.model.agent.Person;
27 27
import eu.etaxonomy.cdm.model.agent.Team;
28 28
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
29
import eu.etaxonomy.cdm.model.common.Annotation;
29 30
import eu.etaxonomy.cdm.model.common.CdmBase;
30 31
import eu.etaxonomy.cdm.model.common.Language;
31 32
import eu.etaxonomy.cdm.model.common.TimePeriod;
......
196 197
		}
197 198
	}
198 199

  
199
	
200
	private INonViralNameParser parser = NonViralNameParserImpl.NewInstance();
201 200
	private void handleBasionym(CaryoImportState state, ResultSet rs, Taxon taxon, String basioStr, Integer id) {
202 201
		if (StringUtils.isNotBlank(basioStr)){
203 202
			BotanicalName name = (BotanicalName) taxon.getName();
204
			BotanicalName basionym = BotanicalName.PARSED_NAME(basioStr);
203
			BotanicalName basionym = BotanicalName.PARSED_REFERENCE(basioStr);
204
			if (basionym.hasProblem()){
205
				logger.warn("Problem when parsing basionym ("+id+"): " +  basioStr);
206
			}
205 207
			name.addBasionym(basionym);
206 208
			Synonym syn = Synonym.NewInstance(basionym, state.getTransactionalSourceReference());
207 209
			taxon.addSynonym(syn, SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF());
......
216 218
	private void handleTypes(CaryoImportState state, ResultSet rs, Taxon taxon, String origType, Integer id) {
217 219
		NameTypeDesignation desig = NameTypeDesignation.NewInstance();
218 220
		String type = origType;
219
		if (StringUtils.isBlank(type) ){
221
		if (StringUtils.isBlank(type) || "to be designated".equalsIgnoreCase(type)){
220 222
			return;
221 223
		}else{
222 224
			BotanicalName name = (BotanicalName)taxon.getName();
......
229 231
				if (! type.startsWith(genus.substring(0,1) + ". " )){
230 232
					int i = type.indexOf(" ");
231 233
					String genusOrig = type.substring(0, i);
232
					logger.warn("First genus letter not recognized: " + genusOrig + "-" + genus + ":"+  id);
234
					logger.info("First genus letter not recognized: " + genusOrig + "-" + genus + ":"+  id);
233 235
					typeName.setGenusOrUninomial(genusOrig);
234 236
					type = type.substring(i + 1).trim();
235 237
				}else{
......
246 248
					int posBracket = type.indexOf("(", 2);
247 249
					if (posBracket > 0){
248 250
						String bracket = type.substring(posBracket);
249
						//TODO
250 251
//						logger.warn("Type has bracket("+id+"): " + bracket);
251
						//TODO Annotation
252
						taxon.addAnnotation(Annotation.NewInstance("Type-bracket: " + bracket, Language.DEFAULT()));
252 253
						type = type.substring(0, posBracket).trim();
254
					}else{
255
						Taxon speciesTaxon = Taxon.NewInstance(typeName, state.getTransactionalSourceReference());
256
						classification.addParentChild(taxon, speciesTaxon, null, null);
253 257
					}
254 258
					type = makeTypeNomStatus(typeName, type);
255 259

  
......
289 293
			} catch (UnknownCdmTypeException e) {
290 294
				if (nomStatusStr.startsWith("nom. rej. prop.")){
291 295
					nomStatusType = NomenclaturalStatusType.REJECTED_PROP();
292
					logger.warn("in favour not supported ("+id+"): " + nomStatusStr);
296
					logger.info("in favour not supported ("+id+"): " + nomStatusStr);
293 297
				}else if (nomStatusStr.startsWith("nom. rej. in favour")){
294 298
					nomStatusType = NomenclaturalStatusType.REJECTED();
295
					logger.warn("in favour not supported ("+id+"): " + nomStatusStr);
299
					logger.info("in favour not supported ("+id+"): " + nomStatusStr);
296 300
				}else if (nomStatusStr.startsWith("nom. cons. against")){
297 301
					nomStatusType = NomenclaturalStatusType.CONSERVED();
298
					logger.warn("against not supported ("+id+"): " + nomStatusStr);
302
					logger.info("against not supported ("+id+"): " + nomStatusStr);
299 303
				}else if (nomStatusStr.startsWith("nom. cons. prop. against")){
300 304
					nomStatusType = NomenclaturalStatusType.CONSERVED_PROP();
301
					logger.warn("against not supported ("+id+"): " + nomStatusStr);
305
					logger.info("against not supported ("+id+"): " + nomStatusStr);
302 306
				}else{
303 307
					logger.warn("Unknown status type ("+id+"): " + nomStatusStr);
304 308
					nomStatusType = NomenclaturalStatusType.DOUBTFUL();
......
369 373

  
370 374
		tp.setStartYear(year1.intValue());
371 375
		Integer[] preDate1 = getDay(pre1,id);
372
		tp.setStartMonth(preDate1[1]);
373
		tp.setStartDay(preDate1[0]);
376
//		tp.setStartMonth(preDate1[1]);
377
//		tp.setStartDay(preDate1[0]);
374 378
		if (year2 != null){
375 379
			tp.setEndYear(year2.intValue());
376 380
		}
377 381
		Integer[] preDate2 = getDay(pre2, id);
378
		tp.setEndMonth(preDate2[1]);
379
		tp.setEndDay(preDate2[0]);
382
//		tp.setEndMonth(preDate2[1]);
383
//		tp.setEndDay(preDate2[0]);
380 384
		
381
		if (StringUtils.isNotBlank(modi1) || StringUtils.isNotBlank(modi2)){
382
			tp.setFreeText(date);
383
		}
385
//		if (StringUtils.isNotBlank(modi1) || StringUtils.isNotBlank(modi2)){
386
//			tp.setFreeText(date);
387
//		}
384 388
		ref.setDatePublished(tp);
385 389
	}
386 390

  
......
685 689
		if (author != null){
686 690
			String[]  split = author.split("\\sex\\s");
687 691
			if (split.length > 1){
688
				//TODO richtige Reihenfolge ?
689 692
				result[0] = split[1].trim();
690 693
				result[1] = split[0].trim();
691 694
			}else{

Also available in: Unified diff