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.taxon;
|
11
|
|
12
|
|
13
|
import java.util.HashMap;
|
14
|
import java.util.Map;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import javax.persistence.Entity;
|
18
|
import javax.xml.bind.annotation.XmlAccessType;
|
19
|
import javax.xml.bind.annotation.XmlAccessorType;
|
20
|
import javax.xml.bind.annotation.XmlType;
|
21
|
|
22
|
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
|
23
|
import org.hibernate.envers.Audited;
|
24
|
|
25
|
import eu.etaxonomy.cdm.model.common.RelationshipTermBase;
|
26
|
import eu.etaxonomy.cdm.model.term.TermType;
|
27
|
import eu.etaxonomy.cdm.model.term.TermVocabulary;
|
28
|
|
29
|
/**
|
30
|
* The class representing categories of {@link Synonym synonyms}
|
31
|
* (like "heterotypic synonym of").
|
32
|
* <P>
|
33
|
* A standard (ordered) list of synonym type instances will be
|
34
|
* automatically created as the project starts. But this class allows to extend
|
35
|
* this standard list by creating new instances of additional synonym
|
36
|
* types if needed.
|
37
|
* <P>
|
38
|
* This class corresponds in part to: <ul>
|
39
|
* <li> TaxonRelationshipTerm according to the TDWG ontology
|
40
|
* <li> RelationshipType according to the TCS
|
41
|
* </ul>
|
42
|
*
|
43
|
* @author m.doering
|
44
|
* @since 08-Nov-2007 13:06:55
|
45
|
*/
|
46
|
@XmlAccessorType(XmlAccessType.FIELD)
|
47
|
@XmlType(name = "SynonymType")
|
48
|
@Entity
|
49
|
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
|
50
|
//@Indexed(index = "eu.etaxonomy.cdm.model.term.DefinedTermBase")
|
51
|
@Audited
|
52
|
public class SynonymType extends RelationshipTermBase<SynonymType> {
|
53
|
|
54
|
private static final long serialVersionUID = -3775216614202923889L;
|
55
|
@SuppressWarnings("unused")
|
56
|
private static final Logger logger = LogManager.getLogger(SynonymType.class);
|
57
|
|
58
|
protected static Map<UUID, SynonymType> termMap = null;
|
59
|
|
60
|
public static final UUID uuidSynonymOf = UUID.fromString("1afa5429-095a-48da-8877-836fa4fe709e");
|
61
|
public static final UUID uuidHomotypicSynonymOf = UUID.fromString("294313a9-5617-4ed5-ae2d-c57599907cb2");
|
62
|
public static final UUID uuidHeterotypicSynonymOf = UUID.fromString("4c1e2c59-ca55-41ac-9a82-676894976084");
|
63
|
public static final UUID uuidInferredSynonymOf = UUID.fromString("cb5bad12-9dbc-4b38-9977-162e45089c11");
|
64
|
public static final UUID uuidInferredGenusOf = UUID.fromString("f55a574b-c1de-45cc-9ade-1aa2e098c3b5");
|
65
|
public static final UUID uuidInferredEpithetOf = UUID.fromString("089c1926-eb36-47e7-a2d1-fd5f3918713d");
|
66
|
public static final UUID uuidPotentialCombinationOf = UUID.fromString("7c45871f-6dc5-40e7-9f26-228318d0f63a");
|
67
|
|
68
|
|
69
|
//********************************** CONSTRUCTOR *********************************/
|
70
|
|
71
|
//for hibernate use only
|
72
|
@Deprecated
|
73
|
protected SynonymType() {
|
74
|
super(TermType.SynonymType);
|
75
|
}
|
76
|
|
77
|
/**
|
78
|
* Class constructor: creates an additional synonym type
|
79
|
* instance with a description (in the {@link Language#DEFAULT() default language}), a label and
|
80
|
* a label abbreviation. Synonym types can be neither
|
81
|
* symmetric nor transitive.
|
82
|
*
|
83
|
* @param term the string (in the default language) describing the
|
84
|
* new synonym type to be created
|
85
|
* @param label the string identifying the new synonym
|
86
|
* type to be created
|
87
|
* @param labelAbbrev the string identifying (in abbreviated form) the
|
88
|
* new synonym type to be created
|
89
|
* @see #SynonymType()
|
90
|
*/
|
91
|
private SynonymType(String term, String label, String labelAbbrev) {
|
92
|
super(TermType.SynonymType, term, label, labelAbbrev, false, false);
|
93
|
}
|
94
|
|
95
|
|
96
|
//************************** METHODS ********************************
|
97
|
|
98
|
@Override
|
99
|
public void resetTerms(){
|
100
|
termMap = null;
|
101
|
}
|
102
|
|
103
|
|
104
|
protected static SynonymType getTermByUuid(UUID uuid){
|
105
|
if (termMap == null || termMap.isEmpty()){
|
106
|
return getTermByClassAndUUID(SynonymType.class, uuid);
|
107
|
} else {
|
108
|
return termMap.get(uuid);
|
109
|
}
|
110
|
}
|
111
|
|
112
|
/**
|
113
|
* Returns the synonym type "is synonym of". This indicates
|
114
|
* that the reference asserting the synonym relationship does not know
|
115
|
* whether both {@link name.TaxonName taxon names} involved are typified by the same type or
|
116
|
* not.
|
117
|
*
|
118
|
* @see #HOMOTYPIC_SYNONYM_OF()
|
119
|
* @see #HETEROTYPIC_SYNONYM_OF()
|
120
|
*/
|
121
|
public static final SynonymType SYNONYM_OF(){
|
122
|
return getTermByUuid(uuidSynonymOf);
|
123
|
}
|
124
|
|
125
|
/**
|
126
|
* Returns the synonym relationship type "is homotypic synonym of"
|
127
|
* ("is nomenclatural synonym of" in zoology). This indicates that the
|
128
|
* the reference asserting the synonym relationship holds that
|
129
|
* the {@link name.TaxonName taxon name} used as a {@link Synonym synonym} and the taxon name used as the
|
130
|
* ("accepted/correct") {@link Taxon taxon} are typified by the same type.
|
131
|
* In this case they should belong to the same {@link name.HomotypicalGroup homotypical group}.
|
132
|
*
|
133
|
* @see #HETEROTYPIC_SYNONYM_OF()
|
134
|
* @see #SYNONYM_OF()
|
135
|
*/
|
136
|
public static final SynonymType HOMOTYPIC_SYNONYM_OF(){
|
137
|
return getTermByUuid(uuidHomotypicSynonymOf);
|
138
|
}
|
139
|
|
140
|
/**
|
141
|
* Returns the synonym relationship type "is heterotypic synonym of"
|
142
|
* ("is taxonomic synonym of" in zoology). This indicates that the
|
143
|
* the reference asserting the synonym relationship holds that
|
144
|
* the {@link name.TaxonName taxon name} used as a {@link Synonym synonym} and the taxon name used as the
|
145
|
* ("accepted/correct") {@link Taxon taxon} are not typified by the same type.
|
146
|
* In this case they should not belong to the same {@link name.HomotypicalGroup homotypical group}.
|
147
|
*
|
148
|
* @see #HOMOTYPIC_SYNONYM_OF()
|
149
|
* @see #SYNONYM_OF()
|
150
|
*/
|
151
|
public static final SynonymType HETEROTYPIC_SYNONYM_OF(){
|
152
|
return getTermByUuid(uuidHeterotypicSynonymOf);
|
153
|
}
|
154
|
|
155
|
/**
|
156
|
* Returns the synonym relationship type "is inferred synonym of".
|
157
|
* This synonym relationship type is used in zoology whenever a synonymy relationship on species or infraspecific
|
158
|
* level is derived from a genus synonymy.
|
159
|
*/
|
160
|
public static final SynonymType INFERRED_SYNONYM_OF(){
|
161
|
return getTermByUuid(uuidInferredSynonymOf);
|
162
|
}
|
163
|
|
164
|
/**
|
165
|
* Returns the synonym relationship type "is inferred genus of".
|
166
|
* This synonym relationship type is used in zoology whenever a synonymy relationship on species or infraspecific
|
167
|
* level is derived from a epithet synonymy.
|
168
|
*/
|
169
|
public static final SynonymType INFERRED_GENUS_OF(){
|
170
|
return getTermByUuid(uuidInferredGenusOf);
|
171
|
}
|
172
|
|
173
|
/**
|
174
|
* Returns the synonym relationship type "is inferred synonym of".
|
175
|
* This synonym relationship type is used in zoology whenever a synonymy relationship on species or infraspecific
|
176
|
* level is derived from a genus synonymy.
|
177
|
*/
|
178
|
public static final SynonymType INFERRED_EPITHET_OF(){
|
179
|
return getTermByUuid(uuidInferredEpithetOf);
|
180
|
}
|
181
|
|
182
|
public static SynonymType POTENTIAL_COMBINATION_OF() {
|
183
|
return getTermByUuid(uuidPotentialCombinationOf);
|
184
|
}
|
185
|
|
186
|
|
187
|
@Override
|
188
|
protected void setDefaultTerms(TermVocabulary<SynonymType> termVocabulary) {
|
189
|
termMap = new HashMap<>();
|
190
|
for (SynonymType term : termVocabulary.getTerms()){
|
191
|
termMap.put(term.getUuid(), term);
|
192
|
}
|
193
|
}
|
194
|
|
195
|
|
196
|
|
197
|
}
|