Project

General

Profile

Download (15 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.cdm.model.name;
11

    
12
import java.util.ArrayList;
13
import java.util.List;
14
import java.util.Set;
15
import java.util.UUID;
16

    
17
import javax.xml.bind.annotation.XmlEnum;
18
import javax.xml.bind.annotation.XmlEnumValue;
19
import javax.xml.bind.annotation.XmlType;
20

    
21
import org.apache.commons.lang3.StringUtils;
22
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
23

    
24
import eu.etaxonomy.cdm.common.DOI;
25
import eu.etaxonomy.cdm.common.URI;
26
import eu.etaxonomy.cdm.model.common.Language;
27
import eu.etaxonomy.cdm.model.term.EnumeratedTermVoc;
28
import eu.etaxonomy.cdm.model.term.IEnumTerm;
29

    
30
/**
31
 * The class for the nomenclature code edition of the 5 nomenclatural codes (ICNP, ICBN, ICNCP, ICZN and ICVCN)
32
 * ruling {@link TaxonName taxon names}.
33
 * <P>
34
 * See also https://www.wikidata.org/wiki/Q693148
35
 * <P>
36
 * @see NomenclaturalCode
37
 *
38
 * @author a.mueller
39
 * @since 23.07.2019
40
 */
41

    
42
@XmlType(name = "NomenclaturalCodeEdition")
43
@XmlEnum
44
public enum NomenclaturalCodeEdition implements IEnumTerm<NomenclaturalCodeEdition> {
45

    
46
    //0
47
    /**
48
     * International Code of Nomenclature for algae, fungi, and plants.
49
     * Shenzhen 2017
50
     * Turland, N. J., Wiersema, J. H., Barrie, F. R., Greuter, W., Hawksworth, D. L., Herendeen, P. S., Knapp, S., Kusber, W.-H., Li, D.-Z., Marhold, K., May, T. W., McNeill, J., Monro, A. M., Prado, J., Price, M. J. & Smith, G. F. (eds.) 2018: International Code of Nomenclature for algae, fungi, and plants (Shenzhen Code) adopted by the Nineteenth International Botanical Congress Shenzhen, China, July 2017. Regnum Vegetabile 159. Glashütten: Koeltz Botanical Books. DOI https://doi.org/10.12705/Code.2018
51
     */
52
    @XmlEnumValue("Shenzhen")
53
    ICN_2017_SHENZHEN(UUID.fromString("87e8ac37-97c4-43c7-a016-43f1a5c3503f"), "ICN", "Shenzhen", 2017, NomenclaturalCode.ICNAFP, "Q56701992","10.12705/Code.2018" ),
54

    
55
    //1
56
    /**
57
     * International Code of Nomenclature for algae, fungi, and plants.
58
     * Melbourne 2011
59
     */
60
    @XmlEnumValue("Melbourne")
61
    ICN_2011_MELBOURNE(UUID.fromString("ea2ebf9e-e3eb-4aaf-8007-c6f9f8877451"), "ICN", "Melbourne", 2011, NomenclaturalCode.ICNAFP, "Q15895076", null),
62

    
63
    //2
64
    /**
65
     * International Code of Botanical Nomenclature.
66
     * Vienna 2005
67
     */
68
    @XmlEnumValue("Vienna")
69
    ICN_2005_VIENNA(UUID.fromString("d8f9f3d6-96af-4d83-a8d5-04ff62ba4d9c"), "ICBN", "Vienna", 2005, NomenclaturalCode.ICNAFP, "Q15895126", null),
70

    
71
    //3
72
    /**
73
     * International Code of Botanical Nomenclature.
74
     * Saint Louis 1999
75
     */
76
    @XmlEnumValue("Saint Louis")
77
    ICN_1999_ST_LOUIS(UUID.fromString("2746b72e-43be-4073-90d0-494a7afac271"), "ICBN", "Saint Louis", 1999, NomenclaturalCode.ICNAFP, "Q15895151", null),
78

    
79
    //4
80
    /**
81
     * International Code of Botanical Nomenclature.
82
     * Tokyo 1993
83
     */
84
    @XmlEnumValue("Tokyo")
85
    ICN_1993_TOKYO(UUID.fromString("5a846761-839f-4f77-b614-7181b9b29355"), "ICBN", "Tokyo", 1993, NomenclaturalCode.ICNAFP, "Q15895201", null),
86

    
87
    //5
88
    /**
89
     * International Code of Botanical Nomenclature.
90
     * Berlin 1987
91
     */
92
    @XmlEnumValue("Berlin")
93
    ICN_1987_BERLIN(UUID.fromString("5702fc16-e194-4ad2-bdaf-4451af523db2"), "ICBN", "Berlin", 1987, NomenclaturalCode.ICNAFP, null, null),
94

    
95
    //6
96
    /**
97
     * International Code of Botanical Nomenclature.
98
     * Sydney 1981
99
     */
100
    @XmlEnumValue("Sydney")
101
    ICN_1981_Sydney(UUID.fromString("f956c556-6d79-4e0f-adeb-ed9d81f2fa24"), "ICBN", "Sydney", 1981, NomenclaturalCode.ICNAFP, null, null),
102

    
103
    //7
104
    /**
105
     * International Code of Botanical Nomenclature.
106
     * Leningrad 1975
107
     */
108
    @XmlEnumValue("Leningrad")
109
    ICN_1975_TOKYO(UUID.fromString("f52e50b4-4c75-42dd-8efe-39cd966da712"), "ICBN", "Leningrad", 1975, NomenclaturalCode.ICNAFP, null, null),
110

    
111
    //8
112
    /**
113
     * International Code of Botanical Nomenclature.
114
     * Seattle 1969
115
     */
116
    @XmlEnumValue("Seattle")
117
    ICN_1969_Seattle(UUID.fromString("2d19b5af-27cc-428e-affb-8a06563ff9cd"), "ICBN", "Seattle", 1969, NomenclaturalCode.ICNAFP, null, null),
118

    
119
    //9
120
    /**
121
     * International Code of Botanical Nomenclature.
122
     * Stockholm 1952
123
     */
124
    @XmlEnumValue("Stockholm")
125
    ICN_1952_Stockholm(UUID.fromString("a0c07e5f-9b2b-4cd7-9f14-acd4729f175a"), "ICBN", "Stockholm", 1952, NomenclaturalCode.ICNAFP, null, null),
126

    
127
    //10
128
    /**
129
     * International Code of Botanical Nomenclature.
130
     * Cambridge Rules 1935
131
     */
132
    @XmlEnumValue("Cambridge")
133
    //TODO abbrev correct?
134
    ICN_1935_CAMBRIDGE(UUID.fromString("e6f7e578-2ce5-434d-9904-aaf2a6e06c43"), "ICBN", "Cambrdige", 1935, NomenclaturalCode.ICNAFP, null, null),
135

    
136
    //11
137
    /**
138
     * International Code of Botanical Nomenclature.
139
     * Vienna Rules 1905
140
     */
141
    @XmlEnumValue("Vienna 1905")
142
    //TODO abbrev correct?
143
    ICN_1905_VIENNA(UUID.fromString("23781153-540f-4c54-a5ae-5d6b6f490332"), "ICBN", "Vienna", 1905, NomenclaturalCode.ICNAFP, null, null),
144

    
145
    //12
146
    /**
147
     * International Code of Botanical Nomenclature.
148
     * Laws of botanical nomenclature 1867
149
     */
150
    @XmlEnumValue("Laws")
151
    //TODO abbrev correct?
152
    ICN_1867_LAWS(UUID.fromString("230314c3-0bb0-4488-8597-f4ef63d27781"), "ICBN", "Laws of botanical nomenclature", 1867, NomenclaturalCode.ICNAFP, null, null),
153

    
154

    
155
    //*** ICZN **/
156
    //z1
157
    /**
158
     * International Code of Zoological Nomenclature. Fourth edition. The International Trust for Zoological Nomenclature, London, UK.
159
     * https://en.wikipedia.org/wiki/International_Code_of_Zoological_Nomenclature#Versions
160
     */
161
    @XmlEnumValue("ICZN_1999")
162
    ICZN_1999(UUID.fromString("98f61693-67c5-40e1-a802-4989cb5ac4eb"), "ICZN", null, 1999, NomenclaturalCode.ICZN, null, "10.5962/bhl.title.50608"),
163

    
164
    //z2
165
    /**
166
     * International Code of Zoological Nomenclature. Third edition. The International Trust for Zoological Nomenclature, London, UK.
167
     * https://en.wikipedia.org/wiki/International_Code_of_Zoological_Nomenclature#Versions
168
     */
169
    @XmlEnumValue("ICZN_1985")
170
    ICZN_1985(UUID.fromString("093110c8-f7e8-4f86-a794-e8e7b17c99d6"), "ICZN", null, 1985, NomenclaturalCode.ICZN, null, "10.5962/bhl.title.50611"),
171

    
172
    //z3
173
    /**
174
     * International Code of Zoological Nomenclature. Second edition. The International Trust for Zoological Nomenclature, London, UK.
175
     * https://en.wikipedia.org/wiki/International_Code_of_Zoological_Nomenclature#Versions
176
     */
177
    @XmlEnumValue("ICZN_1964")
178
    ICZN_1964(UUID.fromString("2b4a9e59-45dd-444b-bf93-741bc727c38c"), "ICZN", null, 1964, NomenclaturalCode.ICZN, null, "10.5962/bhl.title.50606"),
179

    
180
    //z4
181
    /**
182
     * International Code of Zoological Nomenclature: adopted by the XV International Congress of Zoology. The International Trust for Zoological Nomenclature, London, UK.
183
     * https://en.wikipedia.org/wiki/International_Code_of_Zoological_Nomenclature#Versions
184
     */
185
    @XmlEnumValue("ICZN_1961")
186
    ICZN_1961(UUID.fromString("b9de5507-1171-496c-8a8d-8af47e42724e"), "ICZN", null, 1961, NomenclaturalCode.ICZN, null, "10.5962/bhl.title.50303"),
187

    
188
    //TODO older versions, see wikipedia
189

    
190
   //bact1
191
    /**
192
     * Parker, C.T., Tindall, B.J. & Garrity, G.M. (2019) International Code of Nomenclature of Prokaryotes. 2008 Revision. Microbiology Society
193
     * https://en.wikipedia.org/wiki/International_Code_of_Nomenclature_of_Prokaryotes#Versions
194
     */
195
    @XmlEnumValue("ICNP_2008")
196
    ICNP_2008(UUID.fromString("1297a8e9-dfde-4db7-9f93-672453e8b3e6"), "ICNP", null, 2008, NomenclaturalCode.ICNP, null, "10.1099/ijsem.0.000778"),
197

    
198
    //bact2
199
    /**
200
     * Lapage, S.P., Sneath, P.H.A., Lessel, E.F., Skerman, V.B.D., Seeliger, H.P.R. & Clark, W.A. (1992). International Code of Nomenclature of Bacteria. Bacteriological Code. 1990 Revision. American Society for Microbiology, Washington, D.C., ISBN 1-55581-039-X
201
     * https://en.wikipedia.org/wiki/International_Code_of_Nomenclature_of_Prokaryotes#Versions
202
     */
203
    @XmlEnumValue("ICNP_1990")
204
    ICNP_1990(UUID.fromString("fd5d6dd3-de58-4244-8290-c8d89323f163"), "ICNB", null, 1990, NomenclaturalCode.ICNP, null, "10.5962/bhl.title.50303"),
205

    
206
    //bact3
207
    /**
208
     * Lapage, S.P., Sneath, P.H.A., Lessel, E.F., Skerman, V.B.D., Seeliger, H.P.R. & Clark, W.A. (1975). International Code of Nomenclature of Bacteria. 1975 Revision. American Society of Microbiology, Washington, D.C
209
     * https://en.wikipedia.org/wiki/International_Code_of_Nomenclature_of_Prokaryotes#Versions
210
     */
211
    @XmlEnumValue("ICNP_1975")
212
    ICNP_1975(UUID.fromString("2dafaf3c-abf6-4baf-82db-3332db25d654"), "ICNB", null, 1975, NomenclaturalCode.ICNP, null, null),
213

    
214
    //cult plants 1
215
    /**
216
     * ISHS Secretariat: ICNCP - International Code for the Nomenclature for Cultivated Plants (9th edition). International Society for Horticultural Science, 15. Juni 2016
217
     * https://www.ishs.org/news/icncp-international-code-nomenclature-cultivated-plants-9th-edition
218
     */
219
    @XmlEnumValue("ICNCP_2016")
220
    ICNCP_2016(UUID.fromString("e395e7be-405f-4214-a3a2-2b19eef6a055"), "ICNCP", null, 2016, NomenclaturalCode.ICNCP, null, null),
221

    
222
    //cult plants 2
223
    /**
224
     * International Code of Nomenclature for Cultivated Plants. 8th edition. [Scripta Horticulturae 10]
225
     * https://www.ishs.org/news/icncp-international-code-nomenclature-cultivated-plants-9th-edition
226
     */
227
    @XmlEnumValue("ICNCP_2009")
228
    ICNCP_2009(UUID.fromString("bc66202a-0ffb-4cf3-a1c9-520efd5e76e9"), "ICNCP", null, 2009, NomenclaturalCode.ICNCP, null, null),
229

    
230
    //cult plants 3
231
    /**
232
     * SHS (International Society for Horticultural Science; Hrsg.): International Code of Nomenclature for Cultivated Plants, 7th edition. In: Acta Horticulturae Band 647, 2004. ISBN 90-6605-527-8.
233
     * https://de.wikipedia.org/wiki/Internationaler_Code_der_Nomenklatur_der_Kulturpflanzen
234
     */
235
    @XmlEnumValue("ICNCP_2004")
236
    ICNCP_2004(UUID.fromString("a29abcee-1f34-4320-afad-eb7ee23cc473"), "ICNCP", null, 2004, NomenclaturalCode.ICNCP, null, null),
237

    
238
    //virus1
239
    /**
240
     * https://talk.ictvonline.org/ictv-reports/ictv_online_report/
241
     * 10th report
242
     */
243
    @XmlEnumValue("ICVCN_2018")
244
    //TODO abbrev correct?
245
    ICVCN_2018(UUID.fromString("6a0debf3-7932-4b0c-b1b1-46641c273f36"), "ICVCN", null, 2019, NomenclaturalCode.ICVCN, null, null),
246

    
247
    //virus2
248
    /**
249
     * https://talk.ictvonline.org/ictv-reports/ictv_9th_report/
250
     * 9th report
251
     */
252
    @XmlEnumValue("ICVCN_2011")
253
    //TODO abbrev correct?
254
    ICVCN_2011(UUID.fromString("b55c0209-59e2-4fa2-9d64-63addfb15d6b"), "ICVCN", null, 2011, NomenclaturalCode.ICVCN, null, null),
255

    
256
    ;
257

    
258

    
259
    @SuppressWarnings("unused")
260
    private static final Logger logger = LogManager.getLogger(NomenclaturalCodeEdition.class);
261

    
262
    private static final String WIKIDATA_BASE_URL = "https://www.wikidata.org/wiki/";
263

    
264
	private String location;
265

    
266
	private Integer year;
267

    
268
	private NomenclaturalCode code;
269

    
270
	private String wikiDataId;
271

    
272
	private DOI doi;
273

    
274
	private String abbrev;
275

    
276
	private NomenclaturalCodeEdition(UUID uuid, String abbrev, String location, Integer year, NomenclaturalCode code, String wikiDataId, String strDoi ){
277
		delegateVocTerm = EnumeratedTermVoc.addTerm(getClass(), this, uuid, makeTitleCache(location, code, year), code.getKey() + year, null);
278
		this.location = location;
279
		this.year=year;
280
		this.code=code;
281
		this.wikiDataId = wikiDataId;
282
		this.doi = (strDoi==null) ? null:DOI.fromString(strDoi);
283
	}
284

    
285
    /**
286
     * @param location
287
     * @param code
288
     * @param year
289
     * @return
290
     */
291
    private String makeTitleCache(String location, NomenclaturalCode code, Integer year) {
292
        return (StringUtils.isNotBlank(location)? location: code.getTitleCache()) + " " + year;
293
    }
294

    
295
    public String getTitleCache() {
296
        return getLabel();
297
    }
298

    
299
	@Override
300
	public String toString() {
301
		return this.name();
302
	}
303

    
304
    public boolean isNonViral() {
305
        return this.code.isNonViral();
306
    }
307
    public boolean isZoological() {
308
        return this.code.isZoological();
309
    }
310
    public boolean isBotanical() {
311
        return this.code.isBotanical();
312
    }
313
    public boolean isCultivar() {
314
        return this.code.isCultivar();
315
    }
316
    public boolean isBacterial() {
317
        return this.code.isBacterial();
318
     }
319
     public boolean isViral() {
320
         return this.code.isViral();
321
     }
322
     public boolean isFungus() {
323
         return this.code.isFungus();
324
     }
325

    
326

    
327
//	public static NomenclaturalCodeEdition fromString(String string){
328
//		xx;
329
//	    for(NomenclaturalCodeEdition code : NomenclaturalCodeEdition.values()){
330
//			if(code.name().equalsIgnoreCase(string)) {
331
//				return code;
332
//			}
333
//		}
334
//		return null;
335
//	}
336

    
337
    public static List<NomenclaturalCodeEdition> forCode(NomenclaturalCode code){
338
        List<NomenclaturalCodeEdition> result = new ArrayList<>();
339

    
340
        Set<NomenclaturalCode> allCodes = code.getGeneralizationOf(true);
341
        allCodes.add(code);
342

    
343
        for(NomenclaturalCodeEdition edition : NomenclaturalCodeEdition.values()){
344
            for (NomenclaturalCode nomCode: allCodes){
345
                if(edition.getCode().equals(nomCode) && !result.contains(nomCode)) {
346
                    result.add(edition);
347
                }
348
            }
349
        }
350
        return result;
351
    }
352

    
353
    public String getAbbrev() {
354
          return abbrev;
355
    }
356

    
357
    public String getLocation() {
358
        return location;
359
    }
360
    public Integer getYear() {
361
        return year;
362
    }
363
    public NomenclaturalCode getCode() {
364
        return code;
365
    }
366
    public String getWikiDataId() {
367
        return wikiDataId;
368
    }
369
    public URI getWikiDataUri() {
370
        return StringUtils.isEmpty(wikiDataId)? null: URI.create(WIKIDATA_BASE_URL + wikiDataId);
371
    }
372
    public DOI getDoi() {
373
        return this.doi;
374
    }
375

    
376
// *************************** DELEGATE **************************************/
377

    
378
	private static EnumeratedTermVoc<NomenclaturalCodeEdition> delegateVoc;
379
	private IEnumTerm<NomenclaturalCodeEdition> delegateVocTerm;
380

    
381
	static {
382
		delegateVoc = EnumeratedTermVoc.getVoc(NomenclaturalCodeEdition.class);
383
	}
384

    
385
	@Override
386
	public String getKey(){return delegateVocTerm.getKey();}
387

    
388
	@Override
389
    public String getLabel(){return delegateVocTerm.getLabel();}
390

    
391
	@Override
392
    public String getLabel(Language language){return delegateVocTerm.getLabel(language);}
393

    
394

    
395
	@Override
396
    public UUID getUuid() {return delegateVocTerm.getUuid();}
397

    
398
	@Override
399
    public NomenclaturalCodeEdition getKindOf() {return delegateVocTerm.getKindOf();}
400

    
401
	@Override
402
    public Set<NomenclaturalCodeEdition> getGeneralizationOf() {return delegateVocTerm.getGeneralizationOf();}
403

    
404
	@Override
405
	public boolean isKindOf(NomenclaturalCodeEdition ancestor) {return delegateVocTerm.isKindOf(ancestor);	}
406

    
407
	@Override
408
    public Set<NomenclaturalCodeEdition> getGeneralizationOf(boolean recursive) {return delegateVocTerm.getGeneralizationOf(recursive);}
409

    
410

    
411
	public static NomenclaturalCodeEdition getByKey(String key){return delegateVoc.getByKey(key);}
412
    public static NomenclaturalCodeEdition getByUuid(UUID uuid) {return delegateVoc.getByUuid(uuid);}
413
}
(21-21/39)