Revision 3d438891
Added by Patrick Plitzner over 7 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java | ||
---|---|---|
195 | 195 |
|
196 | 196 |
long id = rs.getLong(RedListUtil.NAMNR); |
197 | 197 |
String taxNameString = rs.getString(RedListUtil.TAXNAME); |
198 |
String epi1String = rs.getString(RedListUtil.EPI1); |
|
198 | 199 |
String gueltString = rs.getString(RedListUtil.GUELT); |
199 | 200 |
String trivialString = rs.getString(RedListUtil.TRIVIAL); |
200 | 201 |
String authorBasiString = rs.getString(RedListUtil.AUTOR_BASI); |
... | ... | |
237 | 238 |
addAnnotation(RedListUtil.WISSK+": "+wisskString, taxonBase); |
238 | 239 |
|
239 | 240 |
//check taxon name consistency |
240 |
checkTaxonConsistency(id, taxNameString, hybString, taxonBase, state); |
|
241 |
checkTaxonConsistency(id, taxNameString, hybString, epi1String, taxonBase, state);
|
|
241 | 242 |
return taxonBase; |
242 | 243 |
} |
243 | 244 |
|
... | ... | |
420 | 421 |
String[] split = ep2String.split(RedListUtil.HYB_SIGN); |
421 | 422 |
String hybridFormula1 = ep1String+" "+split[0].trim(); |
422 | 423 |
String hybridFormula2 = ep1String+" "+split[1].trim(); |
423 |
//check if the specific epithets are from the same genus or not like e.g. EPI2 = pratensis × Lolium multiflorum
|
|
424 |
//check if the genus is mentioned in EP2 or not
|
|
424 | 425 |
String[] secondHybrid = split[1].trim().split(" "); |
425 |
if(secondHybrid.length>1 && secondHybrid[0].matches("[A-Z].*")){ |
|
426 |
//check if the genus is abbreviated like e.g. Centaurea jacea × C. decipiens |
|
427 |
if(secondHybrid.length>1 && secondHybrid[0].matches("[A-Z]\\.")){ |
|
428 |
hybridFormula2 = ep1String+" "+split[1].trim().substring(2); |
|
429 |
} |
|
430 |
else if(secondHybrid.length>1 && secondHybrid[0].matches("[A-Z].*")){ |
|
426 | 431 |
hybridFormula2 = split[1]; |
427 | 432 |
} |
428 | 433 |
if(CdmUtils.isNotBlank(ep3String)){ |
... | ... | |
436 | 441 |
String[] split = ep3String.split(RedListUtil.HYB_SIGN); |
437 | 442 |
String hybridFormula1 = ep1String+" "+ep2String+" "+split[0]; |
438 | 443 |
String hybridFormula2 = ep1String+" "+ep2String+" "+split[1]; |
444 |
//check if the genus is mentioned in EP3 or not |
|
445 |
String[] secondHybrid = split[1].trim().split(" "); |
|
446 |
//check if the genus is abbreviated like e.g. Centaurea jacea jacea × C. jacea subsp. decipiens |
|
447 |
if(secondHybrid.length>1 && secondHybrid[0].matches("[A-Z]\\.")){ |
|
448 |
hybridFormula2 = ep1String+" "+split[1].trim().substring(2); |
|
449 |
} |
|
450 |
else if(secondHybrid.length>1 && secondHybrid[0].matches("[A-Z].*")){ |
|
451 |
hybridFormula2 = split[1]; |
|
452 |
} |
|
439 | 453 |
String fullFormula = hybridFormula1+" "+RedListUtil.HYB_SIGN+" "+hybridFormula2; |
440 | 454 |
name = NonViralNameParserImpl.NewInstance().parseFullName(fullFormula, NomenclaturalCode.ICNAFP, rank); |
441 | 455 |
} |
... | ... | |
502 | 516 |
} |
503 | 517 |
} |
504 | 518 |
|
505 |
private void checkTaxonConsistency(long id, String taxNameString, String hybString, TaxonBase<?> taxonBase, RedListGefaesspflanzenImportState state) { |
|
519 |
private void checkTaxonConsistency(long id, String taxNameString, String hybString, String epi1String, TaxonBase<?> taxonBase, RedListGefaesspflanzenImportState state) { |
|
520 |
if(taxNameString.split(RedListUtil.HYB_SIGN).length>2){ |
|
521 |
RedListUtil.logMessage(id, "multiple hybrid signs. No name check for "+taxNameString, logger); |
|
522 |
return; |
|
523 |
} |
|
524 |
|
|
506 | 525 |
String nameCache = HibernateProxyHelper.deproxy(taxonBase.getName(), NonViralName.class).getNameCache().trim(); |
507 | 526 |
taxNameString = taxNameString.trim(); |
508 | 527 |
taxNameString = taxNameString.replaceAll(" +", " "); |
... | ... | |
521 | 540 |
else if(hybString.equals(RedListUtil.HYB_GF)){ |
522 | 541 |
taxNameString = taxNameString.replace(" "+RedListUtil.HYB_SIGN, " x"); |
523 | 542 |
} |
543 |
else if(hybString.equals(RedListUtil.HYB_XF)){ |
|
544 |
nameCache = taxonBase.getName().getTitleCache(); |
|
545 |
if(nameCache.contains("sec")){ |
|
546 |
nameCache = nameCache.substring(0, nameCache.indexOf("sec")); |
|
547 |
} |
|
548 |
if(taxNameString.matches((".*[A-Z]\\..*"))){ |
|
549 |
taxNameString = taxNameString.replaceAll("[A-Z]\\.", epi1String); |
|
550 |
} |
|
551 |
if(taxNameString.matches((".*"+RedListUtil.HYB_SIGN+"\\s[a-z].*"))){ |
|
552 |
taxNameString = taxNameString.replaceAll(RedListUtil.HYB_SIGN+" ", RedListUtil.HYB_SIGN+" "+epi1String+" "); |
|
553 |
} |
|
554 |
} |
|
524 | 555 |
|
525 | 556 |
if(taxNameString.endsWith("- Gruppe")){ |
526 | 557 |
taxNameString = taxNameString.replaceAll("- Gruppe", "species group"); |
... | ... | |
565 | 596 |
else if(rankStr.equals("SAM")){ |
566 | 597 |
return getRank(state, RedListUtil.uuidRankCollectionSpecies, "Collective Species", "Collective Species", "\"Coll. Species\"", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.SpeciesGroup); |
567 | 598 |
} |
599 |
else if(rankStr.equals("SPR")){ |
|
600 |
return getRank(state, RedListUtil.uuidRankSubproles, "Subproles", "Subproles", "subproles", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.Infraspecific); |
|
601 |
} |
|
602 |
else if(rankStr.equals("MOD")){ |
|
603 |
return getRank(state, RedListUtil.uuidRankModification, "Modification", "Modification", "modificatio", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.Infraspecific); |
|
604 |
} |
|
605 |
else if(rankStr.equals("LUS")){ |
|
606 |
return getRank(state, RedListUtil.uuidRankLusus, "Lusus", "Lusus", "lusus", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.Infraspecific); |
|
607 |
} |
|
568 | 608 |
else{ |
569 | 609 |
rank = state.getTransformer().getRankByKey(rankStr); |
570 | 610 |
} |
Also available in: Unified diff
#5448 Import non-CDM ranks