2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.name
;
12 import java
.util
.ArrayList
;
13 import java
.util
.List
;
15 import java
.util
.UUID
;
17 import javax
.xml
.bind
.annotation
.XmlEnum
;
18 import javax
.xml
.bind
.annotation
.XmlEnumValue
;
19 import javax
.xml
.bind
.annotation
.XmlType
;
21 import org
.apache
.commons
.lang3
.StringUtils
;
22 import org
.apache
.logging
.log4j
.LogManager
;
23 import org
.apache
.logging
.log4j
.Logger
;
25 import eu
.etaxonomy
.cdm
.common
.DOI
;
26 import eu
.etaxonomy
.cdm
.common
.URI
;
27 import eu
.etaxonomy
.cdm
.model
.agent
.Person
;
28 import eu
.etaxonomy
.cdm
.model
.agent
.Team
;
29 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableSource
;
30 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
31 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
32 import eu
.etaxonomy
.cdm
.model
.reference
.ReferenceFactory
;
33 import eu
.etaxonomy
.cdm
.model
.term
.EnumeratedTermVoc
;
34 import eu
.etaxonomy
.cdm
.model
.term
.IEnumTerm
;
35 import eu
.etaxonomy
.cdm
.strategy
.parser
.TimePeriodParser
;
38 * The class for the nomenclature code edition of the 5 nomenclatural codes (ICNP, ICBN, ICNCP, ICZN and ICVCN)
39 * ruling {@link TaxonName taxon names}.
41 * See also https://www.wikidata.org/wiki/Q693148
43 * @see NomenclaturalCode
49 @XmlType(name
= "NomenclaturalCodeEdition")
51 public enum NomenclaturalCodeEdition
implements IEnumTerm
<NomenclaturalCodeEdition
> {
55 * International Code of Nomenclature for algae, fungi, and plants.
57 * 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
59 @XmlEnumValue("Shenzhen")
60 ICN_2017_SHENZHEN(UUID
.fromString("87e8ac37-97c4-43c7-a016-43f1a5c3503f"), "ICN", "Shenzhen", 2017, NomenclaturalCode
.ICNAFP
, "Q56701992","10.12705/Code.2018" ),
64 * International Code of Nomenclature for algae, fungi, and plants.
67 @XmlEnumValue("Melbourne")
68 ICN_2011_MELBOURNE(UUID
.fromString("ea2ebf9e-e3eb-4aaf-8007-c6f9f8877451"), "ICN", "Melbourne", 2011, NomenclaturalCode
.ICNAFP
, "Q15895076", null),
72 * International Code of Botanical Nomenclature.
75 @XmlEnumValue("Vienna")
76 ICN_2005_VIENNA(UUID
.fromString("d8f9f3d6-96af-4d83-a8d5-04ff62ba4d9c"), "ICBN", "Vienna", 2005, NomenclaturalCode
.ICNAFP
, "Q15895126", null),
80 * International Code of Botanical Nomenclature.
83 @XmlEnumValue("Saint Louis")
84 ICN_1999_ST_LOUIS(UUID
.fromString("2746b72e-43be-4073-90d0-494a7afac271"), "ICBN", "Saint Louis", 1999, NomenclaturalCode
.ICNAFP
, "Q15895151", null),
88 * International Code of Botanical Nomenclature.
91 @XmlEnumValue("Tokyo")
92 ICN_1993_TOKYO(UUID
.fromString("5a846761-839f-4f77-b614-7181b9b29355"), "ICBN", "Tokyo", 1993, NomenclaturalCode
.ICNAFP
, "Q15895201", null),
96 * International Code of Botanical Nomenclature.
99 @XmlEnumValue("Berlin")
100 ICN_1987_BERLIN(UUID
.fromString("5702fc16-e194-4ad2-bdaf-4451af523db2"), "ICBN", "Berlin", 1987, NomenclaturalCode
.ICNAFP
, null, null),
104 * International Code of Botanical Nomenclature.
107 @XmlEnumValue("Sydney")
108 ICN_1981_Sydney(UUID
.fromString("f956c556-6d79-4e0f-adeb-ed9d81f2fa24"), "ICBN", "Sydney", 1981, NomenclaturalCode
.ICNAFP
, null, null),
112 * International Code of Botanical Nomenclature.
115 @XmlEnumValue("Leningrad")
116 ICN_1975_TOKYO(UUID
.fromString("f52e50b4-4c75-42dd-8efe-39cd966da712"), "ICBN", "Leningrad", 1975, NomenclaturalCode
.ICNAFP
, null, null),
120 * International Code of Botanical Nomenclature.
123 @XmlEnumValue("Seattle")
124 ICN_1969_Seattle(UUID
.fromString("2d19b5af-27cc-428e-affb-8a06563ff9cd"), "ICBN", "Seattle", 1969, NomenclaturalCode
.ICNAFP
, null, null),
128 * International Code of Botanical Nomenclature.
131 @XmlEnumValue("Stockholm")
132 ICN_1952_Stockholm(UUID
.fromString("a0c07e5f-9b2b-4cd7-9f14-acd4729f175a"), "ICBN", "Stockholm", 1952, NomenclaturalCode
.ICNAFP
, null, null),
136 * International Code of Botanical Nomenclature.
137 * Cambridge Rules 1935
139 @XmlEnumValue("Cambridge")
140 //TODO abbrev correct?
141 ICN_1935_CAMBRIDGE(UUID
.fromString("e6f7e578-2ce5-434d-9904-aaf2a6e06c43"), "ICBN", "Cambrdige", 1935, NomenclaturalCode
.ICNAFP
, null, null),
145 * International Code of Botanical Nomenclature.
148 @XmlEnumValue("Vienna 1905")
149 //TODO abbrev correct?
150 ICN_1905_VIENNA(UUID
.fromString("23781153-540f-4c54-a5ae-5d6b6f490332"), "ICBN", "Vienna", 1905, NomenclaturalCode
.ICNAFP
, null, null),
154 * International Code of Botanical Nomenclature.
155 * Laws of botanical nomenclature 1867
157 @XmlEnumValue("Laws")
158 //TODO abbrev correct?
159 ICN_1867_LAWS(UUID
.fromString("230314c3-0bb0-4488-8597-f4ef63d27781"), "ICBN", "Laws of botanical nomenclature", 1867, NomenclaturalCode
.ICNAFP
, null, null),
165 * International Code of Zoological Nomenclature. Fourth edition. The International Trust for Zoological Nomenclature, London, UK.
166 * https://en.wikipedia.org/wiki/International_Code_of_Zoological_Nomenclature#Versions
168 @XmlEnumValue("ICZN_1999")
169 ICZN_1999(UUID
.fromString("98f61693-67c5-40e1-a802-4989cb5ac4eb"), "ICZN", null, 1999, NomenclaturalCode
.ICZN
, null, "10.5962/bhl.title.50608"),
173 * International Code of Zoological Nomenclature. Third edition. The International Trust for Zoological Nomenclature, London, UK.
174 * https://en.wikipedia.org/wiki/International_Code_of_Zoological_Nomenclature#Versions
176 @XmlEnumValue("ICZN_1985")
177 ICZN_1985(UUID
.fromString("093110c8-f7e8-4f86-a794-e8e7b17c99d6"), "ICZN", null, 1985, NomenclaturalCode
.ICZN
, null, "10.5962/bhl.title.50611"),
181 * International Code of Zoological Nomenclature. Second edition. The International Trust for Zoological Nomenclature, London, UK.
182 * https://en.wikipedia.org/wiki/International_Code_of_Zoological_Nomenclature#Versions
184 @XmlEnumValue("ICZN_1964")
185 ICZN_1964(UUID
.fromString("2b4a9e59-45dd-444b-bf93-741bc727c38c"), "ICZN", null, 1964, NomenclaturalCode
.ICZN
, null, "10.5962/bhl.title.50606"),
189 * International Code of Zoological Nomenclature: adopted by the XV International Congress of Zoology. The International Trust for Zoological Nomenclature, London, UK.
190 * https://en.wikipedia.org/wiki/International_Code_of_Zoological_Nomenclature#Versions
192 @XmlEnumValue("ICZN_1961")
193 ICZN_1961(UUID
.fromString("b9de5507-1171-496c-8a8d-8af47e42724e"), "ICZN", null, 1961, NomenclaturalCode
.ICZN
, null, "10.5962/bhl.title.50303"),
195 //TODO older versions, see wikipedia
199 * Parker, C.T., Tindall, B.J. & Garrity, G.M. (2019) International Code of Nomenclature of Prokaryotes. 2008 Revision. Microbiology Society
200 * https://en.wikipedia.org/wiki/International_Code_of_Nomenclature_of_Prokaryotes#Versions
202 @XmlEnumValue("ICNP_2008")
203 ICNP_2008(UUID
.fromString("1297a8e9-dfde-4db7-9f93-672453e8b3e6"), "ICNP", null, 2008, NomenclaturalCode
.ICNP
, null, "10.1099/ijsem.0.000778"),
207 * 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
208 * https://en.wikipedia.org/wiki/International_Code_of_Nomenclature_of_Prokaryotes#Versions
210 @XmlEnumValue("ICNP_1990")
211 ICNP_1990(UUID
.fromString("fd5d6dd3-de58-4244-8290-c8d89323f163"), "ICNB", null, 1990, NomenclaturalCode
.ICNP
, null, "10.5962/bhl.title.50303"),
215 * 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
216 * https://en.wikipedia.org/wiki/International_Code_of_Nomenclature_of_Prokaryotes#Versions
218 @XmlEnumValue("ICNP_1975")
219 ICNP_1975(UUID
.fromString("2dafaf3c-abf6-4baf-82db-3332db25d654"), "ICNB", null, 1975, NomenclaturalCode
.ICNP
, null, null),
223 * ISHS Secretariat: ICNCP - International Code for the Nomenclature for Cultivated Plants (9th edition). International Society for Horticultural Science, 15. Juni 2016
224 * https://www.ishs.org/news/icncp-international-code-nomenclature-cultivated-plants-9th-edition
226 @XmlEnumValue("ICNCP_2016")
227 ICNCP_2016(UUID
.fromString("e395e7be-405f-4214-a3a2-2b19eef6a055"), "ICNCP", null, 2016, NomenclaturalCode
.ICNCP
, null, null),
231 * International Code of Nomenclature for Cultivated Plants. 8th edition. [Scripta Horticulturae 10]
232 * https://www.ishs.org/news/icncp-international-code-nomenclature-cultivated-plants-9th-edition
234 @XmlEnumValue("ICNCP_2009")
235 ICNCP_2009(UUID
.fromString("bc66202a-0ffb-4cf3-a1c9-520efd5e76e9"), "ICNCP", null, 2009, NomenclaturalCode
.ICNCP
, null, null),
239 * 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.
240 * https://de.wikipedia.org/wiki/Internationaler_Code_der_Nomenklatur_der_Kulturpflanzen
242 @XmlEnumValue("ICNCP_2004")
243 ICNCP_2004(UUID
.fromString("a29abcee-1f34-4320-afad-eb7ee23cc473"), "ICNCP", null, 2004, NomenclaturalCode
.ICNCP
, null, null),
247 * https://talk.ictvonline.org/ictv-reports/ictv_online_report/
250 @XmlEnumValue("ICVCN_2018")
251 //TODO abbrev correct?
252 ICVCN_2018(UUID
.fromString("6a0debf3-7932-4b0c-b1b1-46641c273f36"), "ICVCN", null, 2019, NomenclaturalCode
.ICVCN
, null, null),
256 * https://talk.ictvonline.org/ictv-reports/ictv_9th_report/
259 @XmlEnumValue("ICVCN_2011")
260 //TODO abbrev correct?
261 ICVCN_2011(UUID
.fromString("b55c0209-59e2-4fa2-9d64-63addfb15d6b"), "ICVCN", null, 2011, NomenclaturalCode
.ICVCN
, null, null),
265 @SuppressWarnings("unused")
266 private static final Logger logger
= LogManager
.getLogger();
268 private static final String WIKIDATA_BASE_URL
= "https://www.wikidata.org/wiki/";
270 private String location
;
272 private Integer year
;
274 private NomenclaturalCode code
;
276 private String wikiDataId
;
280 private String abbrev
;
282 private Reference citation
;
284 private NomenclaturalCodeEdition(UUID uuid
, String abbrev
, String location
, Integer year
, NomenclaturalCode code
, String wikiDataId
, String strDoi
){
285 delegateVocTerm
= EnumeratedTermVoc
.addTerm(getClass(), this, uuid
, makeTitleCache(location
, code
, year
), code
.getKey() + year
, null);
286 this.location
= location
;
289 this.wikiDataId
= wikiDataId
;
290 this.doi
= (strDoi
==null) ?
null:DOI
.fromString(strDoi
);
299 private String
makeTitleCache(String location
, NomenclaturalCode code
, Integer year
) {
300 return (StringUtils
.isNotBlank(location
)? location
: code
.getTitleCache()) + " " + year
;
303 public String
getTitleCache() {
308 public String
toString() {
312 public boolean isNonViral() {
313 return this.code
.isNonViral();
315 public boolean isZoological() {
316 return this.code
.isZoological();
318 public boolean isBotanical() {
319 return this.code
.isBotanical();
321 public boolean isCultivar() {
322 return this.code
.isCultivar();
324 public boolean isBacterial() {
325 return this.code
.isBacterial();
327 public boolean isViral() {
328 return this.code
.isViral();
330 public boolean isFungus() {
331 return this.code
.isFungus();
335 // public static NomenclaturalCodeEdition fromString(String string){
337 // for(NomenclaturalCodeEdition code : NomenclaturalCodeEdition.values()){
338 // if(code.name().equalsIgnoreCase(string)) {
345 public static List
<NomenclaturalCodeEdition
> forCode(NomenclaturalCode code
){
346 List
<NomenclaturalCodeEdition
> result
= new ArrayList
<>();
348 Set
<NomenclaturalCode
> allCodes
= code
.getGeneralizationOf(true);
351 for(NomenclaturalCodeEdition edition
: NomenclaturalCodeEdition
.values()){
352 for (NomenclaturalCode nomCode
: allCodes
){
353 if(edition
.getCode().equals(nomCode
) && !result
.contains(nomCode
)) {
361 public String
getAbbrev() {
365 public String
getLocation() {
368 public Integer
getYear() {
371 public NomenclaturalCode
getCode() {
374 public String
getWikiDataId() {
377 public URI
getWikiDataUri() {
378 return StringUtils
.isEmpty(wikiDataId
)?
null: URI
.create(WIKIDATA_BASE_URL
+ wikiDataId
);
380 public DOI
getDoi() {
384 private Reference
getCitation() {
385 if (this.citation
== null) {
386 if (this == NomenclaturalCodeEdition
.ICN_2017_SHENZHEN
) {
387 citation
= ReferenceFactory
.newBook();
388 citation
.setTitle("International Code of Nomenclature for algae, fungi, and plants (Shenzhen Code), adopted by the Nineteenth International Botanical Congress, Shenzhen, China, July 2017.");
389 Team team
= Team
.NewInstance();
390 citation
.setAuthorship(team
);
391 team
.addTeamMember(Person
.NewInstance(null, "Turland", "N.J.", null));
392 team
.addTeamMember(Person
.NewInstance(null, "Wiersema", "J.H.", null));
393 team
.addTeamMember(Person
.NewInstance(null, "Barrie", "F.R.", null));
394 team
.addTeamMember(Person
.NewInstance(null, "Greuter", "W.", null));
395 team
.addTeamMember(Person
.NewInstance(null, "Hawksworth", "D.L.", null));
396 team
.addTeamMember(Person
.NewInstance(null, "Herendeen", "P.S.", null));
397 team
.addTeamMember(Person
.NewInstance(null, "Knapp", "S.", null));
398 team
.addTeamMember(Person
.NewInstance(null, "Kusber", "W.-H.", null));
399 team
.addTeamMember(Person
.NewInstance(null, "Li", "D.-Z.", null));
400 team
.addTeamMember(Person
.NewInstance(null, "Marhold", "K.", null));
401 team
.addTeamMember(Person
.NewInstance(null, "May", "T.W.", null));
402 team
.addTeamMember(Person
.NewInstance(null, "McNeill", "J.", null));
403 team
.addTeamMember(Person
.NewInstance(null, "Monro", "A.M.", null));
404 team
.addTeamMember(Person
.NewInstance(null, "Prado", "J.", null));
405 team
.addTeamMember(Person
.NewInstance(null, "Price", "M.J.", null));
407 team
.addTeamMember(Person
.NewInstance(null, "Smith", "G.F. (eds.)", null));
408 citation
.setDatePublished(TimePeriodParser
.parseStringVerbatim("2018"));
409 citation
.setPlacePublished("Glashütten");
410 citation
.setPublisher("Koeltz Botanical Books", "Glashütten");
411 citation
.setDoi(ICN_2017_SHENZHEN
.getDoi());
412 citation
.setSeriesPart("Regnum Vegetabile 159");
414 //TODO other nom codes not yet implemented
420 public IdentifiableSource
getSource() {
421 if (getCitation() != null) {
422 return IdentifiableSource
.NewPrimaryMediaSourceInstance(getCitation(), null);
428 // *************************** DELEGATE **************************************/
430 private static EnumeratedTermVoc
<NomenclaturalCodeEdition
> delegateVoc
;
431 private IEnumTerm
<NomenclaturalCodeEdition
> delegateVocTerm
;
434 delegateVoc
= EnumeratedTermVoc
.getVoc(NomenclaturalCodeEdition
.class);
438 public String
getKey(){return delegateVocTerm
.getKey();}
441 public String
getLabel(){return delegateVocTerm
.getLabel();}
444 public String
getLabel(Language language
){return delegateVocTerm
.getLabel(language
);}
448 public UUID
getUuid() {return delegateVocTerm
.getUuid();}
451 public NomenclaturalCodeEdition
getKindOf() {return delegateVocTerm
.getKindOf();}
454 public Set
<NomenclaturalCodeEdition
> getGeneralizationOf() {return delegateVocTerm
.getGeneralizationOf();}
457 public boolean isKindOf(NomenclaturalCodeEdition ancestor
) {return delegateVocTerm
.isKindOf(ancestor
); }
460 public Set
<NomenclaturalCodeEdition
> getGeneralizationOf(boolean recursive
) {return delegateVocTerm
.getGeneralizationOf(recursive
);}
463 public static NomenclaturalCodeEdition
getByKey(String key
){return delegateVoc
.getByKey(key
);}
464 public static NomenclaturalCodeEdition
getByUuid(UUID uuid
) {return delegateVoc
.getByUuid(uuid
);}