Project

General

Profile

« Previous | Next » 

Revision a7ffd739

Added by Andreas Müller almost 6 years ago

ref #7109 update test data for nom. val. and in parser

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NomenclaturalStatusType.java
861 861
     * @return
862 862
     */
863 863
    private static String normalizeStatusAbbrev(String statusAbbreviation) {
864
        //#7109 should not happen anymore
864 865
        if (statusAbbreviation.equalsIgnoreCase("nom. valid")){
865
            statusAbbreviation = "nom. val.";  //#7109
866
            statusAbbreviation = "nom. val.";
866 867
        }
867 868
        return statusAbbreviation;
868 869
    }
cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplRegExBase.java
236 236
    protected static Pattern referenceSineDetailPattern = Pattern.compile(pReferenceSineDetail);
237 237

  
238 238
    protected static String pNomStatusNom =
239
            "nom\\." + fWs + "(ambig\\.|dub\\.|confus\\.|superfl\\.|nud\\.|illeg\\.|inval\\.|cons\\.(\\s*(prop|des)\\.)?|altern(ativ)?\\.|subnud\\.|nov\\.|legit\\.|sanct\\.|valid|"+
239
            "nom\\." + fWs + "(ambig\\.|dub\\.|confus\\.|superfl\\.|nud\\.|illeg\\.|inval\\.|cons\\.(\\s*(prop|des)\\.)?|altern(ativ)?\\.|subnud\\.|nov\\.|legit\\.|sanct\\.|val\\.|"+
240 240
    			"rej\\.("+ fWs + "prop\\.)?|provis\\.|utique"+fWs+"rej\\.("+fWs+"prop\\.)?|orth\\."+fWs+"cons\\.("+fWs+"prop\\.)?)";
241 241
    protected static String pNomStatusOrthVar = "orth\\." + fWs + "(var\\.|rej\\.)";
242 242
    protected static String pNomStatusComb = "comb\\." + fWs + "(inval\\.|illeg\\.|nov\\.)";
cdmlib-model/src/test/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImplTest.java
1087 1087
        assertTrue(nameTestStatus.getStatus().size()== 1);
1088 1088
        assertEquals( NomenclaturalStatusType.PROVISIONAL(), nameTestStatus.getStatus().iterator().next().getType());
1089 1089

  
1090
        //nom. valid
1091
        strTestStatus = "Abies alba Mill., Sp. Pl. 4: 455. 1987, nom. valid";
1090
        //nom. val.
1091
        strTestStatus = "Abies alba Mill., Sp. Pl. 4: 455. 1987, nom. val.";
1092 1092
        nameTestStatus = parser.parseReferencedName(strTestStatus, null, Rank.SPECIES());
1093 1093
        assertFullRefStandard(nameTestStatus);
1094 1094
        assertTrue(nameTestStatus.getStatus().size()== 1);
......
1166 1166
        String strFullWhiteSpcaceAndDot = "Abies alba Mill.,  Sp.   Pl.  4:  455 .  1987 .";
1167 1167
        INonViralName namefullWhiteSpcaceAndDot = parser.parseReferencedName(strFullWhiteSpcaceAndDot, null, rankSpecies);
1168 1168
        assertFullRefStandard(namefullWhiteSpcaceAndDot);
1169
        assertTrue(((Reference)namefullWhiteSpcaceAndDot.getNomenclaturalReference()).getType().equals(eu.etaxonomy.cdm.model.reference.ReferenceType.Book));
1169
        assertTrue(namefullWhiteSpcaceAndDot.getNomenclaturalReference().getType().equals(eu.etaxonomy.cdm.model.reference.ReferenceType.Book));
1170 1170
        assertEquals( "Abies alba Mill., Sp. Pl. 4: 455. 1987", namefullWhiteSpcaceAndDot.getFullTitleCache());
1171 1171

  
1172 1172
        //Book
1173 1173
        String fullReference = "Abies alba Mill., Sp. Pl. 4: 455. 1987";
1174 1174
        INonViralName name1 = parser.parseReferencedName(fullReference, null, rankSpecies);
1175 1175
        assertFullRefStandard(name1);
1176
        assertTrue(((Reference)name1.getNomenclaturalReference()).getType().equals(eu.etaxonomy.cdm.model.reference.ReferenceType.Book));
1176
        assertTrue(name1.getNomenclaturalReference().getType().equals(eu.etaxonomy.cdm.model.reference.ReferenceType.Book));
1177 1177
        assertEquals(fullReference, name1.getFullTitleCache());
1178
        assertTrue("Name author and reference author should be the same", name1.getCombinationAuthorship() == ((Reference)name1.getNomenclaturalReference()).getAuthorship());
1178
        assertTrue("Name author and reference author should be the same", name1.getCombinationAuthorship() == name1.getNomenclaturalReference().getAuthorship());
1179 1179

  
1180 1180
        //Book Section
1181 1181
        fullReference = "Abies alba Mill. in Otto, Sp. Pl. 4(6): 455. 1987";
......
1193 1193
        assertEquals("Otto, Sp. Pl. 4(6)", inBook.getTitleCache());
1194 1194
        assertEquals("Sp. Pl.", inBook.getAbbrevTitle());
1195 1195
        assertEquals("4(6)", inBook.getVolume());
1196
        assertTrue("Name author and reference author should be the same", name2.getCombinationAuthorship() == ((Reference)name2.getNomenclaturalReference()).getAuthorship());
1196
        assertTrue("Name author and reference author should be the same", name2.getCombinationAuthorship() == name2.getNomenclaturalReference().getAuthorship());
1197 1197

  
1198 1198
        //Article
1199 1199
        fullReference = "Abies alba Mill. in Sp. Pl. 4(6): 455. 1987";
......
1917 1917
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1918 1918
        TeamOrPersonBase<?> combinationAuthor = name.getCombinationAuthorship();
1919 1919
        assertEquals( "Borhidi", combinationAuthor.getNomenclaturalTitle());
1920
        Reference nomRef = (Reference)name.getNomenclaturalReference();
1920
        Reference nomRef = name.getNomenclaturalReference();
1921 1921
        assertEquals(ReferenceType.Article, nomRef.getType());
1922 1922
        assertEquals("46 (1-2)", nomRef.getVolume());
1923 1923

  
......
1927 1927
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1928 1928
        combinationAuthor = name.getCombinationAuthorship();
1929 1929
        assertEquals( "Rzed.", combinationAuthor.getNomenclaturalTitle());
1930
        nomRef = (Reference)name.getNomenclaturalReference();
1930
        nomRef = name.getNomenclaturalReference();
1931 1931
        assertEquals(ReferenceType.Article, nomRef.getType());
1932 1932
        assertEquals("44", nomRef.getVolume());
1933 1933
        assertEquals("72, fig. 1", name.getNomenclaturalMicroReference());
......
1938 1938
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1939 1939
        combinationAuthor = name.getCombinationAuthorship();
1940 1940
        assertEquals( "Dwyer & Lorence", combinationAuthor.getNomenclaturalTitle());
1941
        nomRef = (Reference)name.getNomenclaturalReference();
1941
        nomRef = name.getNomenclaturalReference();
1942 1942
        assertEquals(ReferenceType.Article, nomRef.getType());
1943 1943
        assertEquals("4", nomRef.getVolume());
1944 1944
        assertEquals("428. fig 4a-c", name.getNomenclaturalMicroReference());
......
1949 1949
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1950 1950
        combinationAuthor = name.getCombinationAuthorship();
1951 1951
        assertEquals( "Borhidi", combinationAuthor.getNomenclaturalTitle());
1952
        nomRef = (Reference)name.getNomenclaturalReference();
1952
        nomRef = name.getNomenclaturalReference();
1953 1953
        assertEquals(ReferenceType.Article, nomRef.getType());
1954 1954
        assertEquals("33 (3" + UTF8.EN_DASH + "4)", nomRef.getVolume());
1955 1955
        assertEquals("303", name.getNomenclaturalMicroReference());
......
1960 1960
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1961 1961
        combinationAuthor = name.getCombinationAuthorship();
1962 1962
        assertEquals( "Terrell", combinationAuthor.getNomenclaturalTitle());
1963
        nomRef = (Reference)name.getNomenclaturalReference();
1963
        nomRef = name.getNomenclaturalReference();
1964 1964
        assertEquals(ReferenceType.Article, nomRef.getType());
1965 1965
        assertEquals("19(4)", nomRef.getVolume());
1966 1966
        assertEquals("901" + UTF8.EN_DASH + "911, f. 1" + UTF8.EN_DASH + "2", name.getNomenclaturalMicroReference());
......
1971 1971
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1972 1972
        combinationAuthor = name.getCombinationAuthorship();
1973 1973
        assertEquals( "Wiggins", combinationAuthor.getNomenclaturalTitle());
1974
        nomRef = (Reference)name.getNomenclaturalReference();
1974
        nomRef = name.getNomenclaturalReference();
1975 1975
        assertEquals(ReferenceType.Article, nomRef.getType());
1976 1976
        assertEquals("3", nomRef.getVolume());
1977 1977
        assertEquals("75, figs 4-6", name.getNomenclaturalMicroReference());
......
1982 1982
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1983 1983
        combinationAuthor = name.getCombinationAuthorship();
1984 1984
        assertEquals( "Wiggins", combinationAuthor.getNomenclaturalTitle());
1985
        nomRef = (Reference)name.getNomenclaturalReference();
1985
        nomRef = name.getNomenclaturalReference();
1986 1986
        assertEquals(ReferenceType.Article, nomRef.getType());
1987 1987
        assertEquals("3", nomRef.getVolume());
1988 1988
        assertEquals("75, pl. 19, figs 4-6", name.getNomenclaturalMicroReference());
......
1994 1994
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
1995 1995
        combinationAuthor = name.getCombinationAuthorship();
1996 1996
        assertEquals( "Aubl.", combinationAuthor.getNomenclaturalTitle());
1997
        nomRef = (Reference)name.getNomenclaturalReference();
1997
        nomRef = name.getNomenclaturalReference();
1998 1998
        assertEquals(ReferenceType.Article, nomRef.getType());
1999 1999
        assertEquals("1", nomRef.getVolume());
2000 2000
        assertEquals("167, pl. 64", name.getNomenclaturalMicroReference());
......
2005 2005
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2006 2006
        combinationAuthor = name.getCombinationAuthorship();
2007 2007
        assertEquals( "Lorence", combinationAuthor.getNomenclaturalTitle());
2008
        nomRef = (Reference)name.getNomenclaturalReference();
2008
        nomRef = name.getNomenclaturalReference();
2009 2009
        assertEquals(ReferenceType.Article, nomRef.getType());
2010 2010
        assertEquals("4", nomRef.getVolume());
2011 2011
        assertEquals("121. fig. 2a, b", name.getNomenclaturalMicroReference());
......
2016 2016
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2017 2017
        combinationAuthor = name.getCombinationAuthorship();
2018 2018
        assertEquals( "Lorence", combinationAuthor.getNomenclaturalTitle());
2019
        nomRef = (Reference)name.getNomenclaturalReference();
2019
        nomRef = name.getNomenclaturalReference();
2020 2020
        assertEquals(ReferenceType.Article, nomRef.getType());
2021 2021
        assertEquals("4", nomRef.getVolume());
2022 2022
        assertEquals("399. figs 1e, 2", name.getNomenclaturalMicroReference());
......
2027 2027
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2028 2028
        combinationAuthor = name.getCombinationAuthorship();
2029 2029
        assertEquals( "Wernham", combinationAuthor.getNomenclaturalTitle());
2030
        nomRef = (Reference)name.getNomenclaturalReference();
2030
        nomRef = name.getNomenclaturalReference();
2031 2031
        assertEquals(ReferenceType.Article, nomRef.getType());
2032 2032
        assertEquals("57(Suppl.)", nomRef.getVolume());
2033 2033
        assertEquals("38", name.getNomenclaturalMicroReference());
......
2038 2038
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2039 2039
        combinationAuthor = name.getCombinationAuthorship();
2040 2040
        assertEquals( "W.R. Anderson", combinationAuthor.getNomenclaturalTitle());
2041
        nomRef = (Reference)name.getNomenclaturalReference();
2041
        nomRef = name.getNomenclaturalReference();
2042 2042
        assertEquals(ReferenceType.Article, nomRef.getType());
2043 2043
        assertEquals("22", nomRef.getVolume());
2044 2044
        assertEquals("75", name.getNomenclaturalMicroReference());
......
2049 2049
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2050 2050
        combinationAuthor = name.getCombinationAuthorship();
2051 2051
        assertEquals( "Benth.", combinationAuthor.getNomenclaturalTitle());
2052
        nomRef = (Reference)name.getNomenclaturalReference();
2052
        nomRef = name.getNomenclaturalReference();
2053 2053
        assertEquals(ReferenceType.Article, nomRef.getType());
2054 2054
        assertEquals("3", nomRef.getVolume());
2055 2055
        assertEquals("219", name.getNomenclaturalMicroReference());
......
2060 2060
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2061 2061
        combinationAuthor = name.getCombinationAuthorship();
2062 2062
        assertEquals( "Griseb.", combinationAuthor.getNomenclaturalTitle());
2063
        nomRef = (Reference)name.getNomenclaturalReference();
2063
        nomRef = name.getNomenclaturalReference();
2064 2064
        assertEquals(ReferenceType.Article, nomRef.getType());
2065 2065
        assertEquals("6 (1)", nomRef.getVolume());
2066 2066
        assertEquals("8", name.getNomenclaturalMicroReference());
......
2071 2071
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2072 2072
        combinationAuthor = name.getCombinationAuthorship();
2073 2073
        assertEquals( "Borhidi & Jarai-Koml.", combinationAuthor.getNomenclaturalTitle());
2074
        nomRef = (Reference)name.getNomenclaturalReference();
2074
        nomRef = name.getNomenclaturalReference();
2075 2075
        assertEquals(ReferenceType.Article, nomRef.getType());
2076 2076
        assertEquals("29(1\u20134)", nomRef.getVolume());
2077 2077
        assertEquals("16, f. 1\u20132, t. 1-8", name.getNomenclaturalMicroReference());
......
2084 2084
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2085 2085
        combinationAuthor = name.getCombinationAuthorship();
2086 2086
        assertEquals( "Borhidi & Jarai-Koml.", combinationAuthor.getNomenclaturalTitle());
2087
        nomRef = (Reference)name.getNomenclaturalReference();
2087
        nomRef = name.getNomenclaturalReference();
2088 2088
        assertEquals(ReferenceType.Article, nomRef.getType());
2089 2089
        assertEquals("29(1-4)", nomRef.getVolume());
2090 2090
        assertEquals("16, f. 1-2", name.getNomenclaturalMicroReference());
......
2097 2097
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2098 2098
        combinationAuthor = name.getCombinationAuthorship();
2099 2099
        assertEquals( "Borhidi & Jarai-Koml.", combinationAuthor.getNomenclaturalTitle());
2100
        nomRef = (Reference)name.getNomenclaturalReference();
2100
        nomRef = name.getNomenclaturalReference();
2101 2101
        assertEquals(ReferenceType.Article, nomRef.getType());
2102 2102
        assertEquals("29(1-4)", nomRef.getVolume());
2103 2103
        assertEquals("16, f. 1-2", name.getNomenclaturalMicroReference());
......
2110 2110
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2111 2111
        combinationAuthor = name.getCombinationAuthorship();
2112 2112
        assertEquals( "Ruiz & Pav.", combinationAuthor.getNomenclaturalTitle());
2113
        nomRef = (Reference)name.getNomenclaturalReference();
2113
        nomRef = name.getNomenclaturalReference();
2114 2114
        assertEquals(ReferenceType.Article, nomRef.getType());
2115 2115
        assertEquals("2", nomRef.getVolume());
2116 2116
        assertEquals("59, pl. 206, fig. a", name.getNomenclaturalMicroReference());
......
2121 2121
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2122 2122
        combinationAuthor = name.getCombinationAuthorship();
2123 2123
        assertEquals( "Planch.", combinationAuthor.getNomenclaturalTitle());
2124
        nomRef = (Reference)name.getNomenclaturalReference();
2124
        nomRef = name.getNomenclaturalReference();
2125 2125
        assertEquals(ReferenceType.Article, nomRef.getType());
2126 2126
        assertEquals("5", nomRef.getVolume());
2127 2127
        assertEquals("442A", name.getNomenclaturalMicroReference());
......
2132 2132
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2133 2133
        combinationAuthor = name.getCombinationAuthorship();
2134 2134
        assertEquals( "L.O. Williams", combinationAuthor.getNomenclaturalTitle());
2135
        nomRef = (Reference)name.getNomenclaturalReference();
2135
        nomRef = name.getNomenclaturalReference();
2136 2136
        assertEquals(ReferenceType.Article, nomRef.getType());
2137 2137
        assertEquals("26 (6)", nomRef.getVolume());
2138 2138
        assertEquals("488-489, f", name.getNomenclaturalMicroReference());
......
2143 2143
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2144 2144
        combinationAuthor = name.getCombinationAuthorship();
2145 2145
        assertEquals( "Nees & Mart.", combinationAuthor.getNomenclaturalTitle());
2146
        nomRef = (Reference)name.getNomenclaturalReference();
2146
        nomRef = name.getNomenclaturalReference();
2147 2147
        assertEquals(ReferenceType.Article, nomRef.getType());
2148 2148
        assertEquals("Nova Acta Phys.-Med. Acad. Caes.\u2013Leop. Nat. Cur.", nomRef.getInReference().getAbbrevTitle());
2149 2149
        assertEquals("12", nomRef.getVolume());
......
2170 2170
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2171 2171
        combinationAuthor = name.getCombinationAuthorship();
2172 2172
        assertEquals( "Schinz", combinationAuthor.getNomenclaturalTitle());
2173
        nomRef = (Reference)name.getNomenclaturalReference();
2173
        nomRef = name.getNomenclaturalReference();
2174 2174
        Assert.assertFalse("Reference should be parsable", nomRef.isProtectedTitleCache());
2175 2175
        assertEquals(ReferenceType.Book, nomRef.getType());
2176 2176
        assertEquals("Nat. Pflanzenfam.", nomRef.getAbbrevTitle());
......
2192 2192
        //Vorabdr.
2193 2193
        name = parser.parseReferencedName("Ophrys hystera  Kreutz & Ruedi Peter in J. Eur. Orchideen 30(Vorabdr.): 128. 1997");
2194 2194
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2195
        assertEquals( "30(Vorabdr.)", ((Reference)name.getNomenclaturalReference()).getVolume());
2195
        assertEquals( "30(Vorabdr.)", name.getNomenclaturalReference().getVolume());
2196 2196

  
2197 2197
        //#6100  jun.
2198 2198
        String nameStr = "Swida \u00D7 friedlanderi (W.H.Wagner jun.) Holub";
......
2280 2280
        nameStr = "Nepenthes deaniana Macfarl. in Engl., Mein Pflanzenr. IV. 111 (Heft 36): 57. 1908.";
2281 2281
        name = parser.parseReferencedName(nameStr);
2282 2282
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2283
        Reference ref = (Reference)name.getNomenclaturalReference();
2283
        Reference ref = name.getNomenclaturalReference();
2284 2284
        Assert.assertFalse("Reference should be parsable", ref.hasProblem());
2285 2285
        //or even better IV. 111 (Heft 36), but this is currently not implemented
2286 2286
        assertEquals("111 (Heft 36)", ref.getInReference().getVolume());
......
2291 2291
        Assert.assertFalse("Name should be parsable", name.isProtectedTitleCache());
2292 2292
        String author = name.getAuthorshipCache();
2293 2293
        assertEquals("Chrtek & Krisa", author);
2294
        ref = (Reference)name.getNomenclaturalReference();
2294
        ref = name.getNomenclaturalReference();
2295 2295
        Assert.assertNotNull("Nomenclatural reference should be an article and therefore have an in reference", ref.getInReference());
2296 2296
        Assert.assertEquals(ReferenceType.Journal, ref.getInReference().getType());
2297 2297

  

Also available in: Unified diff