Project

General

Profile

Revision c0411992

IDc0411992560ff35558fd24587bf4a10da0e11e7a
Parent c12d2903
Child 744bd412

Added by Andreas Müller 10 months ago

ref #1444, ref #7976 fix erronous subgenus formatting in ERMS

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/erms/ErmsTaxonImport.java
354 354
			taxonName.setNameCache(displayName);
355 355
			logger.warn("Set name cache: " +  displayName + "; id =" + meId);
356 356
		}
357
        if (!taxonName.getNameCache().equals(displayName)){
357
        if (!taxonName.getNameCache().equals(displayName) && !isErroneousSubgenus(taxonName, displayName)){
358 358
            int pos = CdmUtils.diffIndex(taxonName.getNameCache(), displayName);
359 359
            logger.warn("Computed name cache differs at "+pos+".\n Computed   : " + taxonName.getNameCache()+"\n DisplayName: " +displayName);
360 360
            taxonName.setNameCache(displayName, true);
......
363 363
        return taxonName;
364 364
    }
365 365

  
366
    private static boolean isErroneousSubgenus(TaxonName taxonName, String displayName) {
367
        //this is an error in ERMS formatting in v2019 for ICNafp names, that hopefully soon will be corrected
368
        return (Rank.SPECIES().equals(taxonName.getRank()) && displayName.contains(" subg. "));
369
    }
370

  
366 371
    @SuppressWarnings("unused")  //used by MethodMapper
367 372
    private static TaxonBase<?> appendedPhraseForMisapplications(ResultSet rs, ErmsImportState state) throws SQLException{
368 373
        TaxonBase<?> taxon = (TaxonBase<?>)state.getRelatedObject(DbImportStateBase.CURRENT_OBJECT_NAMESPACE, DbImportStateBase.CURRENT_OBJECT_ID);
......
398 403
        String displayName = rs.getString("tu_displayname");
399 404
        displayName = displayName == null ? null : displayName.trim();
400 405
        String titleCache = taxonName.resetTitleCache(); //calling titleCache should always be kept to have a computed titleCache in the CDM DB.
406
        titleCache = CdmUtils.concat(" ", titleCache, taxon.getAppendedPhrase());
401 407
        String expectedTitleCache = getExpectedTitleCache(rs);
402 408
        //TODO check titleCache, but beware of autonyms
403
        if (!titleCache.equals(expectedTitleCache)){
409
        if (!titleCache.equals(expectedTitleCache) && !isErroneousSubgenus(taxonName, displayName)){
404 410
            int pos = CdmUtils.diffIndex(titleCache, expectedTitleCache);
405 411
            logger.warn("Computed title cache differs at "+pos+".\n Computed             : " + titleCache + "\n DisplayName+Authority: " + expectedTitleCache);
406 412
            taxonName.setNameCache(displayName, true);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)