Project

General

Profile

Download (14.6 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.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 (ICNB, 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"), "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"), "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"), "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"), "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"), "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"), "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"), "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"), "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"), "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"), "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
    ICN_1935_CAMBRIDGE(UUID.fromString("e6f7e578-2ce5-434d-9904-aaf2a6e06c43"), "Cambrdige", 1935, NomenclaturalCode.ICNAFP, null, null),
134

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

    
143
    //12
144
    /**
145
     * International Code of Botanical Nomenclature.
146
     * Laws of botanical nomenclature 1867
147
     */
148
    @XmlEnumValue("Laws")
149
    ICN_1867_LAWS(UUID.fromString("230314c3-0bb0-4488-8597-f4ef63d27781"), "Laws of botanical nomenclature", 1867, NomenclaturalCode.ICNAFP, null, null),
150

    
151

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

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

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

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

    
185
    //TODO older versions, see wikipedia
186

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

    
195
    //bact2
196
    /**
197
     * 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
198
     * https://en.wikipedia.org/wiki/International_Code_of_Nomenclature_of_Prokaryotes#Versions
199
     */
200
    @XmlEnumValue("ICNB_1990")
201
    ICNB_1990(UUID.fromString("fd5d6dd3-de58-4244-8290-c8d89323f163"), null, 1990, NomenclaturalCode.ICNB, null, "10.5962/bhl.title.50303"),
202

    
203
    //bact3
204
    /**
205
     * 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
206
     * https://en.wikipedia.org/wiki/International_Code_of_Nomenclature_of_Prokaryotes#Versions
207
     */
208
    @XmlEnumValue("ICNB_1975")
209
    ICNB_1975(UUID.fromString("2dafaf3c-abf6-4baf-82db-3332db25d654"), null, 1975, NomenclaturalCode.ICNB, null, null),
210

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

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

    
227
    //cult plants 3
228
    /**
229
     * 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.
230
     * https://de.wikipedia.org/wiki/Internationaler_Code_der_Nomenklatur_der_Kulturpflanzen
231
     */
232
    @XmlEnumValue("ICNCP_2004")
233
    ICNB_2004(UUID.fromString("a29abcee-1f34-4320-afad-eb7ee23cc473"), null, 2004, NomenclaturalCode.ICNCP, null, null),
234

    
235
    //virus1
236
    /**
237
     * https://talk.ictvonline.org/ictv-reports/ictv_online_report/
238
     * 10th report
239
     */
240
    @XmlEnumValue("ICVCN_2018")
241
    ICVCN_2018(UUID.fromString("6a0debf3-7932-4b0c-b1b1-46641c273f36"), null, 2019, NomenclaturalCode.ICVCN, null, null),
242

    
243
    //virus2
244
    /**
245
     * https://talk.ictvonline.org/ictv-reports/ictv_9th_report/
246
     * 9th report
247
     */
248
    @XmlEnumValue("ICVCN_2011")
249
    ICVCN_2011(UUID.fromString("b55c0209-59e2-4fa2-9d64-63addfb15d6b"), null, 2011, NomenclaturalCode.ICVCN, null, null),
250

    
251
    ;
252

    
253
    @SuppressWarnings("unused")
254
    private static final Logger logger = Logger.getLogger(NomenclaturalCodeEdition.class);
255

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

    
258
	private String location;
259

    
260
	private Integer year;
261

    
262
	private NomenclaturalCode code;
263

    
264
	private String wikiDataId;
265

    
266
	private DOI doi;
267

    
268
	private NomenclaturalCodeEdition(UUID uuid, String location, Integer year, NomenclaturalCode code, String wikiDataId, String strDoi ){
269
		delegateVocTerm = EnumeratedTermVoc.addTerm(getClass(), this, uuid, makeTitleCache(location, code, year), code.getKey() + year, null);
270
		this.location = location;
271
		this.year=year;
272
		this.code=code;
273
		this.wikiDataId = wikiDataId;
274
		this.doi = (strDoi==null) ? null:DOI.fromString(strDoi);
275
	}
276

    
277
    /**
278
     * @param location
279
     * @param code
280
     * @param year
281
     * @return
282
     */
283
    private String makeTitleCache(String location, NomenclaturalCode code, Integer year) {
284
        return (StringUtils.isNotBlank(location)? location: code.getTitleCache()) + " " + year;
285
    }
286

    
287
    public String getTitleCache() {
288
        return getLabel();
289
    }
290

    
291
	@Override
292
	public String toString() {
293
		return this.name();
294
	}
295

    
296
    public boolean isNonViral() {
297
        return this.code.isNonViral();
298
    }
299
    public boolean isZoological() {
300
        return this.code.isZoological();
301
    }
302
    public boolean isBotanical() {
303
        return this.code.isBotanical();
304
    }
305
    public boolean isCultivar() {
306
        return this.code.isCultivar();
307
    }
308
    public boolean isBacterial() {
309
        return this.code.isBacterial();
310
     }
311
     public boolean isViral() {
312
         return this.code.isViral();
313
     }
314
     public boolean isFungus() {
315
         return this.code.isFungus();
316
     }
317

    
318

    
319
//	public static NomenclaturalCodeEdition fromString(String string){
320
//		xx;
321
//	    for(NomenclaturalCodeEdition code : NomenclaturalCodeEdition.values()){
322
//			if(code.name().equalsIgnoreCase(string)) {
323
//				return code;
324
//			}
325
//		}
326
//		return null;
327
//	}
328

    
329
      public static List<NomenclaturalCodeEdition> forCode(NomenclaturalCode code){
330
          List<NomenclaturalCodeEdition> result = new ArrayList<>();
331

    
332
          Set<NomenclaturalCode> allCodes = code.getGeneralizationOf(true);
333
          allCodes.add(code);
334

    
335
          for(NomenclaturalCodeEdition edition : NomenclaturalCodeEdition.values()){
336
              for (NomenclaturalCode nomCode: allCodes){
337
                  if(edition.getCode().equals(nomCode) && !result.contains(nomCode)) {
338
                      result.add(edition);
339
                  }
340
              }
341
          }
342
          return result;
343
     }
344

    
345

    
346
    public String getLocation() {
347
        return location;
348
    }
349
    public Integer getYear() {
350
        return year;
351
    }
352
    public NomenclaturalCode getCode() {
353
        return code;
354
    }
355
    public String getWikiDataId() {
356
        return wikiDataId;
357
    }
358
    public URI getWikiDataUri() {
359
        return StringUtils.isEmpty(wikiDataId)? null: URI.create(WIKIDATA_BASE_URL + wikiDataId);
360
    }
361
    public DOI getDoi() {
362
        return this.doi;
363
    }
364

    
365
// *************************** DELEGATE **************************************/
366

    
367
	private static EnumeratedTermVoc<NomenclaturalCodeEdition> delegateVoc;
368
	private IEnumTerm<NomenclaturalCodeEdition> delegateVocTerm;
369

    
370
	static {
371
		delegateVoc = EnumeratedTermVoc.getVoc(NomenclaturalCodeEdition.class);
372
	}
373

    
374
	@Override
375
	public String getKey(){return delegateVocTerm.getKey();}
376

    
377
	@Override
378
    public String getLabel(){return delegateVocTerm.getLabel();}
379

    
380
	@Override
381
    public String getLabel(Language language){return delegateVocTerm.getLabel(language);}
382

    
383

    
384
	@Override
385
    public UUID getUuid() {return delegateVocTerm.getUuid();}
386

    
387
	@Override
388
    public NomenclaturalCodeEdition getKindOf() {return delegateVocTerm.getKindOf();}
389

    
390
	@Override
391
    public Set<NomenclaturalCodeEdition> getGeneralizationOf() {return delegateVocTerm.getGeneralizationOf();}
392

    
393
	@Override
394
	public boolean isKindOf(NomenclaturalCodeEdition ancestor) {return delegateVocTerm.isKindOf(ancestor);	}
395

    
396
	@Override
397
    public Set<NomenclaturalCodeEdition> getGeneralizationOf(boolean recursive) {return delegateVocTerm.getGeneralizationOf(recursive);}
398

    
399

    
400
	public static NomenclaturalCodeEdition getByKey(String key){return delegateVoc.getByKey(key);}
401
    public static NomenclaturalCodeEdition getByUuid(UUID uuid) {return delegateVoc.getByUuid(uuid);}
402

    
403

    
404
}
(23-23/43)