Project

General

Profile

« Previous | Next » 

Revision 066bfef4

Added by Andreas Müller almost 7 years ago

ref #6286 latest changes for Flora of Greece import

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/greece/FloraHellenicaSynonymImport.java
59 59
        return "synonyms";
60 60
    }
61 61

  
62
    boolean isFirst = true;
62 63
    /**
63 64
     * {@inheritDoc}
64 65
     */
......
74 75
                logger.warn(line + "Unexpected Key: " + key);
75 76
            }
76 77
        }
78
        if (isFirst){
79
            System.out.println("Start excluded taxa");
80
            isFirst = false;
81
        }
77 82

  
78 83
        String row = "row" + state.getCurrentLine();
79 84
        TaxonBase<?> relatedTaxon = makeSynonym(state, line, record, row);
......
111 116
        boolean isNec = hasNonAuthor && parsedSynStr[2].contains(" nec ");
112 117

  
113 118

  
119
        String misappliedNecAuthor = null;
114 120
        if (isMisapplied && hasNonAuthor && !isNec){
115 121
            parsedSynStr[0] = parsedSynStr[0] + " " + parsedSynStr[2];
122
        }else if (isMisapplied && hasNonAuthor && isNec){
123
            misappliedNecAuthor = parsedSynStr[2];
116 124
        }
117 125

  
118 126
        INonViralName nvn = parser.parseFullName(parsedSynStr[0], NomenclaturalCode.ICNAFP, null);
119 127
        if (nvn.isProtectedTitleCache()){
120
            logger.warn(line + "Name could not be parsed: " + synonymStr);
128
            logger.warn(line + "Name could not be parsed: " + parsedSynStr[0]  + "  (full:"  + synonymStr + ")");
129
        }
130
        if (misappliedNecAuthor != null){
131
            nvn.setAuthorshipCache(misappliedNecAuthor);
121 132
        }
133

  
134

  
122 135
        TaxonNameBase<?,?> name = TaxonNameBase.castAndDeproxy(nvn);
123 136
        if (hasStatus){
124 137
            try {
......
136 149
            result = Taxon.NewInstance(name, getMisappliedRef(state, parsedSynStr[1]));
137 150
            acceptedTaxon.addMisappliedName((Taxon)result, getSecReference(state), null);
138 151
            if (isNec){
139
                logger.warn(line + "nec not yet handled for misapplied names: " + synonymStr);
152
                logger.warn(line + "nec for misapplied names still needs to be checked: " + synonymStr);
140 153
            }
141 154
        }else{
142 155
            SynonymType synType = null;
......
161 174
    private void handleSynonymNon(SimpleExcelTaxonImportState<CONFIG> state,
162 175
            TaxonNameBase<?, ?> name, String nonPart, String line) {
163 176
        String[] splits = nonPart.split(" nec ");
177

  
178
        TaxonNameBase<?,?> lastHomonym = null;
164 179
        for (String split : splits){
165 180
            split = split.trim();
166 181
//            Saponaria illyrica Ard.
......
169 184
//            S. columnae Aurnier nec (Rchb. f.) H. Fleischm.
170 185
//            T. glaucescens Rchb.
171 186
            TaxonNameBase<?,?> nonName;
172
            if (split.matches("(Saponaria illyrica Ard.|Crepis nemausensis Gouan|S. columnae Aurnier|T. glaucescens Rchb.)"
187
            if (split.matches("(Saponaria illyrica Ard.|Crepis nemausensis Gouan|S. columnae Aurnier|T. glaucescens Rchb.|Linaria stricta Guss.)"
173 188
                    + "")){
174 189
                if (split.startsWith("S.")){
175 190
                    split = split.replace("S.", "Serapias");
......
180 195
                nonName = replaceNameAuthorsAndReferences(state, nonName);
181 196
                name.addRelationshipFromName(nonName, NameRelationshipType.BLOCKING_NAME_FOR(), null);
182 197
            }else{
183
                String nameStr = name.getNameCache() + " " + split;
198
                String nameStr = name.getNameCache().replace(" hort.", "") + " " + split;
184 199
                nonName = TaxonNameBase.castAndDeproxy(this.parser.parseFullName(nameStr));
185 200
                nonName = replaceNameAuthorsAndReferences(state, nonName);
186 201
                name.addRelationshipToName(nonName, NameRelationshipType.LATER_HOMONYM(), null);
202
                if (lastHomonym != null){
203
                    nonName.addRelationshipToName(lastHomonym, NameRelationshipType.LATER_HOMONYM(), null);
204
                }
205
                lastHomonym = nonName;
187 206
            }
188 207
            getNameService().saveOrUpdate(nonName);
189 208
            if (nonName.isProtectedTitleCache()){
190 209
                logger.warn(line + "Non-Name could not be parsed: " + nonName.getTitleCache());
191 210
            }
192 211
        }
193
        if (splits.length>1){
194
            logger.warn(line + "nec synonyms maybe not yet correctly implemented: " + name.getTitleCache() + "; " + nonPart);
195
        }
212
        //seems to work correctly
213
//        if (splits.length>1){
214
//            logger.warn(line + "nec synonyms maybe not yet correctly implemented: " + name.getTitleCache() + "; " + nonPart);
215
//        }
196 216
    }
197 217

  
198 218
    private Reference flGraecReference;

Also available in: Unified diff