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