Project

General

Profile

Revision 943941be

ID943941be945f339ef11c9c231b1d97cad7d8eb30
Parent 473b1c68
Child 4cab2fd1

Added by Andreas Müller about 2 years ago

add parsing of brackets with "&"

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplRegExBase.java
211 211

  
212 212
    protected static String referenceTitleWithoutAuthor = "(" + referenceTitleFirstPart + ")" + "{"+ (authorSeparatorMaxPosition -1) +",}" + dotWord +
213 213
    			anySepChar + referenceTitleWithSepCharactersAndBrackets ;   //separators exist and first separator appears at position authorSeparatorMaxPosition or later
214
    protected static String referenceTitleWithPlaceBracket = referenceTitle + "(" + oWs + "\\(" + capitalWord + "(" + oWs + capitalWord + ")?" + "\\))?" ;
214
    protected static String referenceTitleWithPlaceBracket = referenceTitle + "(" + oWs + "\\(" + capitalWord + "(" + oWs + "(& )?" +  capitalWord + ")?" + "\\))?" ;
215 215

  
216 216
    protected static String editionSeparator = "(" + oWs + "|," + fWs + ")ed\\.?" + oWs;  //
217 217
    protected static String pEdition = nr2;
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplTest.java
1801 1801
    }
1802 1802

  
1803 1803
    @Test
1804
    public final void testTitleBrackets(){
1805
        //Bot. Zhurn. (Moscow & Leningrad)
1806
        String parseStr = "Juncus subcompressus Zakirov & Novopokr. in Bot. Zhurn. (Moscow & Leningrad) 36(1): 77. 1951";
1807
        TaxonName name = parser.parseReferencedName(parseStr);
1808
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1809
        Reference nomRef = name.getNomenclaturalReference();
1810
        Assert.assertFalse("nom.ref. should be parsable", nomRef.isProtectedTitleCache());
1811
        assertEquals(ReferenceType.Article, nomRef.getType());
1812
        assertEquals("Bot. Zhurn. (Moscow & Leningrad)", nomRef.getInReference().getAbbrevTitle());
1813
        assertNull(nomRef.getEdition());
1814
        assertEquals("36(1)", nomRef.getVolume());
1815
    }
1816

  
1817

  
1818

  
1819
    @Test
1804 1820
    public final void testSeriesPart(){
1805 1821
        Pattern seriesPattern = Pattern.compile(NonViralNameParserImplRegExBase.pSeriesPart);
1806 1822
        Matcher matcher = seriesPattern.matcher("ser. 2");

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)