Revision 5cdaf78e
Added by Andreas Müller about 8 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/cuba/CubaExcelImport.java | ||
---|---|---|
61 | 61 |
private static final long serialVersionUID = -747486709409732371L; |
62 | 62 |
private static final Logger logger = Logger.getLogger(CubaExcelImport.class); |
63 | 63 |
|
64 |
private static final String HOMONYM_MARKER = ".*\\s+homon.?$";
|
|
64 |
private static final String HOMONYM_MARKER = "\\s+homon.?$"; |
|
65 | 65 |
private static final String DOUBTFUL_MARKER = "^\\?\\s?"; |
66 | 66 |
|
67 | 67 |
|
... | ... | |
302 | 302 |
private static final String heterotypicRegExStr_TEST = "([^\\(]{5,}" +"(\\(.+\\))?" + "[^\\)\\(]{2,})" |
303 | 303 |
+"(\\((.{6,})\\))?"; |
304 | 304 |
private static final String auctRegExStr = "auct\\." |
305 |
+"((\\sFC(\\-S)?(\\s&\\sA&S)?)|(\\sA&S))?(\\s+p\\.\\s*p\\.)?"; |
|
306 |
private static final String missapliedRegExStr = "“(.*{5,})”\\s+(" + auctRegExStr + "|sensu\\s+.{2,})"; |
|
305 |
+"((\\sFC(\\-S)?(\\s&\\sA&S)?)|(\\sA&S)|\\sSagra|\\sBritton|\\sGriseb\\.|\\sWright|\\sFRC|\\sCoL|\\sUrb\\.)?(\\s+p\\.\\s*p\\.)?";
|
|
306 |
private static final String missapliedRegExStr = "(\\?\\s)?“(.*{5,})”\\s+(" + auctRegExStr + "|sensu\\s+.{2,})";
|
|
307 | 307 |
private static final String nomInvalRegExStr = "“(.*{5,})”\\s+nom\\.\\s+inval\\."; |
308 | 308 |
private static final String homonymRegExStr = "\\s*(\\[.*\\])*\\s*"; |
309 | 309 |
|
... | ... | |
340 | 340 |
|
341 | 341 |
List<BotanicalName> homonyms = new ArrayList<>(); |
342 | 342 |
if (missapliedMatcher.matches()){ |
343 |
String firstPart = missapliedMatcher.group(1); |
|
343 |
boolean doubtful = missapliedMatcher.group(1) != null; |
|
344 |
String firstPart = missapliedMatcher.group(2); |
|
344 | 345 |
BotanicalName name = (BotanicalName)nameParser.parseSimpleName(firstPart, state.getConfig().getNomenclaturalCode(), Rank.SPECIES()); |
345 | 346 |
|
346 |
String secondPart = missapliedMatcher.group(2);
|
|
347 |
String secondPart = missapliedMatcher.group(3);
|
|
347 | 348 |
Taxon misappliedNameTaxon = Taxon.NewInstance(name, null); |
349 |
misappliedNameTaxon.setDoubtful(doubtful); |
|
348 | 350 |
if (secondPart.startsWith("sensu")){ |
349 | 351 |
secondPart = secondPart.substring(5).trim(); |
350 | 352 |
if (secondPart.contains(" ")){ |
351 |
logger.warn(line + "Second part contains more than 1 word. Check if this is correct: " + secondPart); |
|
353 |
logger.warn(line + "CHECK: Second part contains more than 1 word. Check if this is correct: " + secondPart);
|
|
352 | 354 |
} |
353 | 355 |
Reference<?> sensu = ReferenceFactory.newGeneric(); |
354 | 356 |
Team team = Team.NewTitledInstance(secondPart, null); |
... | ... | |
378 | 380 |
String secondPart = heterotypicMatcher.groupCount() < 3 ? null : heterotypicMatcher.group(3); |
379 | 381 |
String homonymPart = heterotypicMatcher.groupCount() < 4 ? null : heterotypicMatcher.group(4); |
380 | 382 |
boolean isDoubtful = firstPart.matches("^\\?\\s*.*"); |
381 |
boolean isHomonym = firstPart.trim().matches(HOMONYM_MARKER); |
|
383 |
boolean isHomonym = firstPart.trim().matches(".*" + HOMONYM_MARKER);
|
|
382 | 384 |
firstPart = normalizeStatus(firstPart); |
383 | 385 |
BotanicalName synName = (BotanicalName)nameParser.parseReferencedName(firstPart, state.getConfig().getNomenclaturalCode(), Rank.SPECIES()); |
384 | 386 |
if (synName.isProtectedTitleCache()){ |
... | ... | |
423 | 425 |
BotanicalName currentBasionym = homotypicName; |
424 | 426 |
String[] splits = homotypicStr.split("\\s*,\\s*"); |
425 | 427 |
for (String split : splits){ |
426 |
boolean isHomonym = split.trim().matches(HOMONYM_MARKER); |
|
428 |
boolean isHomonym = split.trim().matches(".*" + HOMONYM_MARKER);
|
|
427 | 429 |
String singleName = normalizeStatus(split); |
428 | 430 |
BotanicalName newName = (BotanicalName)nameParser.parseReferencedName(singleName, state.getConfig().getNomenclaturalCode(), Rank.SPECIES()); |
429 | 431 |
if (newName.isProtectedTitleCache()){ |
... | ... | |
492 | 494 |
basionymName = name2; |
493 | 495 |
newCombination = currentBasionym; |
494 | 496 |
} |
497 |
// newCombination.getHomotypicalGroup().removeGroupBasionym(xxx); |
|
495 | 498 |
if (matchAuthor(basionymName.getCombinationAuthorship(), newCombination.getBasionymAuthorship())){ |
496 | 499 |
newCombination.getHomotypicalGroup().setGroupBasionym(basionymName); |
497 | 500 |
} |
... | ... | |
591 | 594 |
|
592 | 595 |
|
593 | 596 |
private static final String[] nomStatusStrings = new String[]{"nom. cons.", "ined.", "nom. illeg.", |
594 |
"nom. rej.","nom. cons. prop.","nom. altern."}; |
|
597 |
"nom. rej.","nom. cons. prop.","nom. altern.","nom. confus.","nom. dub."};
|
|
595 | 598 |
/** |
596 | 599 |
* @param taxonStr |
597 | 600 |
* @return |
Also available in: Unified diff
Latest cuba import changes