Project

General

Profile

« Previous | Next » 

Revision 09549132

Added by Patrick Plitzner over 7 years ago

#5448 Support corner cases

  • SPI and KMB as ranks
  • nomenclatural status type
  • HYB name checking

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java
383 383
                    NomenclaturalStatus status = NomenclaturalStatus.NewInstance(statusType);
384 384
                    //special case for invalid names where the DB entry contains
385 385
                    //additional information in brackets e.g. "nom. inval. (sine basion.)"
386
                    if(statusType.equals(NomenclaturalStatusType.INVALID())){
386
                    if(statusType.equals(NomenclaturalStatusType.INVALID()) || statusType.equals(NomenclaturalStatusType.REJECTED()) ){
387 387
                        Pattern pattern = Pattern.compile("\\((.*?)\\)");
388 388
                        Matcher matcher = pattern.matcher(nomZusatzString);
389 389
                        if (matcher.find()){
......
413 413
                else if(hybString.equals(RedListUtil.HYB_G)){
414 414
                    name.setMonomHybrid(true);
415 415
                }
416
                else if(hybString.equals(RedListUtil.HYB_XF)){
416
                else if(hybString.equals(RedListUtil.HYB_XF) || hybString.equals(RedListUtil.HYB_XU)){
417 417
                    name.setHybridFormula(true);
418 418
                    if(ep1String.contains(RedListUtil.HYB_SIGN)){
419 419
                        RedListUtil.logMessage(id, "EPI1 has hybrid signs but with flag: "+RedListUtil.HYB_XF, logger);
......
475 475
            }
476 476
        }
477 477

  
478
        if(rangString.equals("SPI")){
479
            addAnnotation("Rank in source: subspecies principes", name);
480
        }
481

  
482 478
        //add source
483 479
        ImportHelper.setOriginalSource(name, state.getTransactionalSourceReference(), id, RedListUtil.NAME_NAMESPACE);
484 480

  
......
524 520

  
525 521
    private void checkTaxonConsistency(long id, String taxNameString, String hybString, String epi1String, TaxonBase<?> taxonBase, RedListGefaesspflanzenImportState state) {
526 522
        if(taxNameString.split(RedListUtil.HYB_SIGN).length>2){
527
            RedListUtil.logMessage(id, "multiple hybrid signs. No name check for "+taxNameString, logger);
523
            RedListUtil.logInfoMessage(id, "multiple hybrid signs. No name check for "+taxNameString, logger);
528 524
            return;
529 525
        }
530 526

  
......
544 540
            taxNameString = taxNameString.replace("X ", RedListUtil.HYB_SIGN);
545 541
        }
546 542
        else if(hybString.equals(RedListUtil.HYB_GF)){
547
            taxNameString = taxNameString.replace(" "+RedListUtil.HYB_SIGN, " x");
543
            taxNameString = taxNameString.replace(" "+RedListUtil.HYB_SIGN+" ", " "+RedListUtil.HYB_SIGN);
548 544
        }
549 545
        else if(hybString.equals(RedListUtil.HYB_XF)){
550 546
            nameCache = taxonBase.getName().getTitleCache();
......
611 607
            else if(rankStr.equals("LUS")){
612 608
                return getRank(state, RedListUtil.uuidRankLusus, "Lusus", "Lusus", "lusus", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.Infraspecific);
613 609
            }
610
            else if(rankStr.equals("SPI")){
611
                return getRank(state, RedListUtil.uuidRankSubspeciesPrincipes, "Subspecies principes", "Subspecies principes", "subsp. princ.", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.Infraspecific);
612
            }
613
            else if(rankStr.equals("KMB")){
614
                return getRank(state, RedListUtil.uuidRankCombination, "Combination", "Combination", "", (OrderedTermVocabulary<Rank>) Rank.GENUS().getVocabulary(), null, RankClass.Infraspecific);
615
            }
614 616
            else{
615 617
                rank = state.getTransformer().getRankByKey(rankStr);
616 618
            }

Also available in: Unified diff