Revision 1a924f2f
Added by Andreas Kohlbecker about 7 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/iapt/IAPTExcelImport.java | ||
---|---|---|
68 | 68 |
private static final Pattern nomRefPubYearExtractP = Pattern.compile("(.*?)(1[7,8,9][0-9]{2}).*$|^.*?[0-9]{1,2}([\\./])[0-1]?[0-9]\\3([0-9]{2})\\.$"); // 1700 - 1999 |
69 | 69 |
|
70 | 70 |
private MarkerType markerTypeFossil = null; |
71 |
private Rank rankUnrankedPseudoClass = null; |
|
71 |
private Rank rankUnrankedSupraGeneric = null; |
|
72 |
private Rank familyIncertisSedis = null; |
|
73 |
private AnnotationType annotationTypeCaveats = null; |
|
72 | 74 |
|
73 | 75 |
private Taxon makeTaxon(HashMap<String, String> record, SimpleExcelTaxonImportState<CONFIG> state, |
74 | 76 |
TaxonNode higherTaxonNode, boolean isSynonym, boolean isFossil) { |
... | ... | |
81 | 83 |
String nomRefStr = getValue(record, LITSTRING, true); |
82 | 84 |
String authorsSpelling = getValue(record, AUTHORSSPELLING, true); |
83 | 85 |
String notesTxt = getValue(record, NOTESTXT, true); |
86 |
String caveats = getValue(record, CAVEATS, true); |
|
84 | 87 |
|
85 | 88 |
String nomRefTitle = null; |
86 | 89 |
String nomRefDetail = null; |
... | ... | |
159 | 162 |
titleCacheCompareStr = titleCacheCompareStr.replace(" x ", " ×"); |
160 | 163 |
nameCompareStr = nameCompareStr.replace(" x ", " ×"); |
161 | 164 |
} |
162 |
if(taxonName.isBinomHybrid()){
|
|
165 |
if(taxonName.isMonomHybrid()){
|
|
163 | 166 |
titleCacheCompareStr = titleCacheCompareStr.replaceAll("^X ", "× "); |
164 | 167 |
nameCompareStr = nameCompareStr.replace("^X ", "× "); |
165 | 168 |
} |
169 |
if(authorStr.contains(" et ")){ |
|
170 |
titleCacheCompareStr = titleCacheCompareStr.replaceAll(" et ", " & "); |
|
171 |
} |
|
166 | 172 |
if (!taxonNameTitleCache.equals(titleCacheCompareStr)) { |
167 | 173 |
logger.warn(line + "The generated titleCache differs from the imported string : " + taxonNameTitleCache + " <> " + titleCacheStr + " will restore original titleCacheStr"); |
168 | 174 |
doRestoreTitleCacheStr = true; |
... | ... | |
197 | 203 |
notesTxt = notesTxt.replace("Notes: ", "").trim(); |
198 | 204 |
taxonName.addAnnotation(Annotation.NewInstance(notesTxt, AnnotationType.EDITORIAL(), Language.DEFAULT())); |
199 | 205 |
} |
206 |
if(!StringUtils.isEmpty(caveats)){ |
|
207 |
caveats = caveats.replace("Caveats: ", "").trim(); |
|
208 |
taxonName.addAnnotation(Annotation.NewInstance(caveats, annotationTypeCaveats(), Language.DEFAULT())); |
|
209 |
} |
|
210 |
// |
|
200 | 211 |
|
201 | 212 |
// Namerelations |
202 | 213 |
if(!StringUtils.isEmpty(authorsSpelling)){ |
... | ... | |
399 | 410 |
|
400 | 411 |
if(name.matches("^Plantae$|^Fungi$")){ |
401 | 412 |
return Rank.KINGDOM(); |
402 |
} else if(name.matches("Incertae sedis$|^No group assigned$")){ |
|
403 |
return Rank.FAMILY();
|
|
413 |
} else if(name.matches("^Incertae sedis$|^No group assigned$")){
|
|
414 |
return rankFamilyIncertisSedis();
|
|
404 | 415 |
} else if(name.matches(".*phyta$|.*mycota$")){ |
405 | 416 |
return Rank.SECTION_BOTANY(); |
406 | 417 |
} else if(name.matches(".*phytina$|.*mycotina$")){ |
407 | 418 |
return Rank.SUBSECTION_BOTANY(); |
408 | 419 |
} else if(name.matches("Gymnospermae$|.*ones$")){ // Monocotyledones, Dicotyledones |
409 |
return rankUnrankedPseudoClass();
|
|
420 |
return rankUnrankedSupraGeneric();
|
|
410 | 421 |
} else if(name.matches(".*opsida$|.*phyceae$|.*mycetes$|.*ones$|^Musci$|^Hepaticae$")){ |
411 | 422 |
return Rank.CLASS(); |
412 | 423 |
} else if(name.matches(".*idae$|.*phycidae$|.*mycetidae$")){ |
... | ... | |
431 | 442 |
return Rank.UNKNOWN_RANK(); |
432 | 443 |
} |
433 | 444 |
|
434 |
private Rank rankUnrankedPseudoClass() { |
|
445 |
private Rank rankUnrankedSupraGeneric() { |
|
446 |
|
|
447 |
if(rankUnrankedSupraGeneric == null){ |
|
448 |
rankUnrankedSupraGeneric = Rank.NewInstance(RankClass.Suprageneric, "Unranked supra generic", " ", " "); |
|
449 |
getTermService().save(rankUnrankedSupraGeneric); |
|
450 |
} |
|
451 |
return rankUnrankedSupraGeneric; |
|
452 |
} |
|
453 |
|
|
454 |
private Rank rankFamilyIncertisSedis() { |
|
455 |
|
|
456 |
if(familyIncertisSedis == null){ |
|
457 |
familyIncertisSedis = Rank.NewInstance(RankClass.Suprageneric, "Family incertis sedis", " ", " "); |
|
458 |
getTermService().save(familyIncertisSedis); |
|
459 |
} |
|
460 |
return familyIncertisSedis; |
|
461 |
} |
|
435 | 462 |
|
436 |
if(rankUnrankedPseudoClass == null){ |
|
437 |
rankUnrankedPseudoClass = Rank.NewInstance(RankClass.Suprageneric, "Unranked pseudo class", " ", " "); |
|
438 |
getTermService().save(rankUnrankedPseudoClass); |
|
463 |
private AnnotationType annotationTypeCaveats(){ |
|
464 |
if(annotationTypeCaveats == null){ |
|
465 |
annotationTypeCaveats = AnnotationType.NewInstance("Caveats", "Caveats", ""); |
|
466 |
getTermService().save(annotationTypeCaveats); |
|
439 | 467 |
} |
440 |
return rankUnrankedPseudoClass;
|
|
468 |
return annotationTypeCaveats;
|
|
441 | 469 |
} |
442 | 470 |
|
443 | 471 |
|
Also available in: Unified diff
ref #6026 multiple improvements