Project

General

Profile

Revision c3977a0e

IDc3977a0e807ba181d4f415d39c34599314d77be2
Parent 5767d3eb
Child 43636c6c

Added by Andreas Müller almost 4 years ago

#5909 Improve referenced name parser, fix encoding and place published for article

View differences:

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

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

  
199 200
    protected static String editionSeparator = "(" + oWs + "|," + fWs + ")ed\\.?" + oWs;  //
200 201
    protected static String pEdition = nr2;
......
204 205
    protected static String pEditionVolPart = editionSeparator +  pEdition + fWs + "," + volumeSeparator +  volume;
205 206
    protected static String pEditionVolAlternative = "(" + pEditionPart + "|" + pVolPart + "|" + pEditionVolPart + ")?";
206 207

  
207
    protected static String pVolRefTitle = referenceTitle + "(" + pVolPart + ")?";
208
//    protected static String pVolRefTitle = referenceTitle + "(" + pVolPart + ")?";
209
    protected static String pVolRefTitle = referenceTitleWithPlaceBracket + "(" + pVolPart + ")?";
208 210
    protected static String softEditionVolRefTitle = referenceTitleWithSepCharactersAndBrackets + pEditionVolAlternative;
209 211
    protected static String softVolNoAuthorRefTitle = referenceTitleWithoutAuthor + "(" + volumeSeparator +  volume + ")?";
210 212

  
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplTest.java
990 990
		assertEquals(fullReference, name2.getFullTitleCache());
991 991
		assertFalse(name2.hasProblem());
992 992
		INomenclaturalReference ref = name2.getNomenclaturalReference();
993
		assertEquals(eu.etaxonomy.cdm.model.reference.ReferenceType.BookSection, ((Reference)ref).getType());
993
		assertEquals(ReferenceType.BookSection, ((Reference)ref).getType());
994 994
		IBookSection bookSection = (IBookSection) ref;
995 995
		IBook inBook = bookSection.getInBook();
996 996
		assertNotNull(inBook);
......
1708 1708

  
1709 1709
        //Canabio, detail with fig.
1710 1710
        name = parser.parseReferencedName("Didymaea floribunda Rzed."
1711
                + " in Bol. Soc. Bot. Méx. 44: 72, fig. 1. 1983");
1711
                + " in Bol. Soc. Bot. Mex. 44: 72, fig. 1. 1983");
1712 1712
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1713 1713
        combinationAuthor = name.getCombinationAuthorship();
1714 1714
        assertEquals( "Rzed.", combinationAuthor.getNomenclaturalTitle());
......
1730 1730

  
1731 1731
        //issue with EN_DASH (3–4)
1732 1732
        name = parser.parseReferencedName("Arachnothryx tacanensis (Lundell) Borhidi"
1733
              + " in Acta Bot. Hung. 33 (34): 303. 1987");
1733
              + " in Acta Bot. Hung. 33 (3" + UTF8.EN_DASH + "4): 303. 1987");
1734 1734
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1735 1735
        combinationAuthor = name.getCombinationAuthorship();
1736 1736
        assertEquals( "Borhidi", combinationAuthor.getNomenclaturalTitle());
1737 1737
        nomRef = (Reference)name.getNomenclaturalReference();
1738 1738
        assertEquals(ReferenceType.Article, nomRef.getType());
1739
        assertEquals("33 (34)", nomRef.getVolume());
1739
        assertEquals("33 (3" + UTF8.EN_DASH + "4)", nomRef.getVolume());
1740 1740
        assertEquals("303", name.getNomenclaturalMicroReference());
1741 1741

  
1742 1742
        //fig with f.
1743 1743
        name = parser.parseReferencedName("Stenotis Terrell"
1744
                + " in Sida 19(4): 901–911, f. 1–2. 2001");
1744
                + " in Sida 19(4): 901" + UTF8.EN_DASH + "911, f. 1" + UTF8.EN_DASH + "2. 2001");
1745 1745
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1746 1746
        combinationAuthor = name.getCombinationAuthorship();
1747 1747
        assertEquals( "Terrell", combinationAuthor.getNomenclaturalTitle());
1748 1748
        nomRef = (Reference)name.getNomenclaturalReference();
1749 1749
        assertEquals(ReferenceType.Article, nomRef.getType());
1750 1750
        assertEquals("19(4)", nomRef.getVolume());
1751
        assertEquals("901–911, f. 1–2", name.getNomenclaturalMicroReference());
1751
        assertEquals("901" + UTF8.EN_DASH + "911, f. 1" + UTF8.EN_DASH + "2", name.getNomenclaturalMicroReference());
1752 1752

  
1753 1753
        //pl
1754 1754
        name = parser.parseReferencedName("Carapichea  Aubl."
......
1806 1806
        assertEquals("219", name.getNomenclaturalMicroReference());
1807 1807

  
1808 1808
        //
1809
//      //(Hannover) place published
1810
//      name = parser.parseReferencedName("Pittoniotis trichantha Griseb."
1811
//              + " in Bonplandia (Hannover) 6 (1): 8. 1858");
1812
//      Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1813
//      combinationAuthor = name.getCombinationAuthorship();
1814
//      assertEquals( "Griseb.", combinationAuthor.getNomenclaturalTitle());
1815
//      nomRef = (Reference)name.getNomenclaturalReference();
1816
//      assertEquals(ReferenceType.Article, nomRef.getType());
1817
//      assertEquals("6 (1)", nomRef.getVolume());
1818
//      assertEquals("8", name.getNomenclaturalMicroReference());
1809
        //(Hannover) place published
1810
        name = parser.parseReferencedName("Pittoniotis trichantha Griseb."
1811
                  + " in Bonplandia (Hannover) 6 (1): 8. 1858");
1812
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1813
        combinationAuthor = name.getCombinationAuthorship();
1814
        assertEquals( "Griseb.", combinationAuthor.getNomenclaturalTitle());
1815
        nomRef = (Reference)name.getNomenclaturalReference();
1816
        assertEquals(ReferenceType.Article, nomRef.getType());
1817
        assertEquals("6 (1)", nomRef.getVolume());
1818
        assertEquals("8", name.getNomenclaturalMicroReference());
1819 1819
 }
1820 1820

  
1821 1821
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)