Project

General

Profile

« Previous | Next » 

Revision 74bd19b1

Added by Andreas Müller almost 7 years ago

Implement parser for parsing species with infrageneric epithet #5881

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java
818 818
				nameToBeFilled.setGenusOrUninomial(epi[0]);
819 819
				nameToBeFilled.setSpecificEpithet(epi[1]);
820 820
			}
821
			 //species
821
		     //species
822 822
			 else if (speciesPattern.matcher(fullNameString).matches()){
823 823
				nameToBeFilled.setRank(Rank.SPECIES());
824 824
				nameToBeFilled.setGenusOrUninomial(epi[0]);
825 825
				nameToBeFilled.setSpecificEpithet(epi[1]);
826 826
				authorString = fullNameString.substring(epi[0].length() + 1 + epi[1].length());
827 827
			}
828
		    //species with infra generic epithet
829
			 else if (speciesWithInfraGenPattern.matcher(fullNameString).matches()){
830
			     nameToBeFilled.setRank(Rank.SPECIES());
831
	             nameToBeFilled.setGenusOrUninomial(epi[0]);
832
                 nameToBeFilled.setInfraGenericEpithet(epi[2]);
833
	             nameToBeFilled.setSpecificEpithet(epi[4]);
834
	             authorString = fullNameString.substring(epi[0].length() + 2 + epi[2].length() + 2 + epi[4].length() + 1);
835
			 }
828 836
			 //autonym
829 837
			 else if (autonymPattern.matcher(fullNameString).matches()){
830 838
				nameToBeFilled.setRank(Rank.getRankByIdInVoc(epi[epi.length - 2]));
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplRegExBase.java
249 249
    protected static String infraGenus = capitalEpiWord + oWs + InfraGenusMarker + oWs + capitalEpiWord;
250 250
    protected static String aggrOrGroup = capitalEpiWord + oWs + nonCapitalEpiWord + oWs + aggrOrGroupMarker;
251 251
    protected static String species = genusOrSupraGenus + oWs + "("+hybridPart+")?" + nonCapitalEpiWord;
252
    protected static String speciesWithInfraGen = genusOrSupraGenus + oWs + "\\(" + capitalEpiWord + "\\)" + oWs + nonCapitalEpiWord;
253

  
252 254
    protected static String infraSpecies = species + oWs + infraSpeciesMarker + oWs + "("+hybridPart+")?" + nonCapitalEpiWord;
253 255
    protected static String zooInfraSpecies = species + oWs + "(" + infraSpeciesMarker + oWs +")?" + "("+hybridPart+")?" + nonCapitalEpiWord;
254 256
    protected static String oldInfraSpecies = capitalEpiWord + oWs +  nonCapitalEpiWord + oWs + oldInfraSpeciesMarker + oWs + nonCapitalEpiWord;
......
260 262
    protected static String anyBotanicName = "(" + genusOrSupraGenus + "|" + infraGenus + "|" + aggrOrGroup + "|" + species + "|" +
261 263
					infraSpecies + "|" + oldInfraSpecies + "|" + autonym   + ")+";
262 264
    protected static String anyZooName = "(" + genusOrSupraGenus + "|" + infraGenus + "|" + aggrOrGroup + "|" + species + "|" +
263
    				zooInfraSpecies + "|" +  oldInfraSpecies + ")+";
265
                    speciesWithInfraGen + "|" +zooInfraSpecies + "|" +  oldInfraSpecies + ")+";
264 266
    protected static String anyBotanicFullName = "(" + autonym2 + "|" + anyBotanicName + oWs + fullBotanicAuthorString + ")"  ;
265 267
    protected static String anyZooFullName = anyZooName + oWs + fullZooAuthorString ;
266 268
    protected static String anyFullName = "(" + anyBotanicFullName + "|" + anyZooFullName + ")";
......
276 278
    protected static Pattern infraGenusPattern = Pattern.compile(pStart + infraGenus + facultFullAuthorString2 + end);
277 279
    protected static Pattern aggrOrGroupPattern = Pattern.compile(pStart + aggrOrGroup + fWs + end); //aggr. or group has no author string
278 280
    protected static Pattern speciesPattern = Pattern.compile(pStart + species + facultFullAuthorString2 + end);
281
    protected static Pattern speciesWithInfraGenPattern = Pattern.compile(pStart + speciesWithInfraGen + facultFullAuthorString2 + end);
279 282
    protected static Pattern infraSpeciesPattern = Pattern.compile(pStart + infraSpecies + facultFullAuthorString2 + end);
280 283
    protected static Pattern zooInfraSpeciesPattern = Pattern.compile(pStart + zooInfraSpecies + facultFullAuthorString2 + end);
281 284
    protected static Pattern oldInfraSpeciesPattern = Pattern.compile(pStart + oldInfraSpecies + facultFullAuthorString2 + end);
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplTest.java
194 194
	 */
195 195
	@Test
196 196
	public final void testParseSubGenericFullName() {
197
		logger.warn("Not yet implemented"); // TODO
197
		String zooSpeciesWithSubgenus = "Bacanius (Mullerister) rombophorus (Aube, 1843)";
198
		ZoologicalName zooName = (ZoologicalName)parser.parseFullName(zooSpeciesWithSubgenus, NomenclaturalCode.ICZN, Rank.SPECIES());
199
		Assert.assertTrue(zooName.getParsingProblems().isEmpty());
200
		Assert.assertEquals("Mullerister", zooName.getInfraGenericEpithet());
201
		Assert.assertEquals(Integer.valueOf(1843), zooName.getOriginalPublicationYear());
202

  
203
		String botSpeciesWithSubgenus = "Bacanius (Mullerister) rombophorus (Aube) Mill.";
204
        BotanicalName botName = (BotanicalName)parser.parseFullName(botSpeciesWithSubgenus, NomenclaturalCode.ICNAFP, Rank.SPECIES());
205
        Assert.assertTrue(botName.getParsingProblems().isEmpty());
206
        Assert.assertEquals("Mullerister", botName.getInfraGenericEpithet());
207
        Assert.assertEquals("rombophorus", botName.getSpecificEpithet());
208
        Assert.assertEquals("Aube", botName.getBasionymAuthorship().getTitleCache());
198 209
	}
199 210

  
200 211
	/**

Also available in: Unified diff