Project

General

Profile

Download (31 KB) Statistics
| Branch: | Tag: | Revision:
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 892efc69 Andreas Kohlbecker
import java.util.HashMap;
13 e9baa019 Andreas Müller
import java.util.HashSet;
14 d0b0c36b Andreas Müller
import java.util.List;
15 892efc69 Andreas Kohlbecker
import java.util.Map;
16 e9baa019 Andreas Müller
import java.util.Set;
17 892efc69 Andreas Kohlbecker
import java.util.UUID;
18 f6765014 ben.clark
19 892efc69 Andreas Kohlbecker
import javax.persistence.Entity;
20 049c97d7 a.babadshanjan
import javax.xml.bind.annotation.XmlAccessType;
21
import javax.xml.bind.annotation.XmlAccessorType;
22 9d0d8d15 a.babadshanjan
import javax.xml.bind.annotation.XmlRootElement;
23 049c97d7 a.babadshanjan
import javax.xml.bind.annotation.XmlType;
24
25 892efc69 Andreas Kohlbecker
import org.apache.log4j.Logger;
26
import org.hibernate.envers.Audited;
27
28
import eu.etaxonomy.cdm.model.common.RelationshipTermBase;
29 1c39686b Andreas Müller
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
30
import eu.etaxonomy.cdm.model.term.TermType;
31
import eu.etaxonomy.cdm.model.term.TermVocabulary;
32 9479da48 Andreas Müller
33
34
/**
35 b9d0e8d2 m.geoffroy
 * The class representing categories of {@link TaxonRelationship taxon relationships}
36
 * (like "is congruent to" or "is misapplied name for").
37
 * <P>
38
 * A standard (ordered) list of taxon relationship type instances will be
39
 * automatically created as the project starts. But this class allows to extend
40
 * this standard list by creating new instances of additional taxon
41 2aa73e7b Cherian Mathew
 * relationship types if needed.
42 b9d0e8d2 m.geoffroy
 * <P>
43
 * This class corresponds in part to: <ul>
44
 * <li> TaxonRelationshipTerm according to the TDWG ontology
45
 * <li> RelationshipType according to the TCS
46
 * </ul>
47 2aa73e7b Cherian Mathew
 *
48 9479da48 Andreas Müller
 * @author m.doering
49 a88578ce Andreas Müller
 * @since 08-Nov-2007 13:06:17
50 9479da48 Andreas Müller
 */
51 049c97d7 a.babadshanjan
@XmlAccessorType(XmlAccessType.FIELD)
52
@XmlType(name = "TaxonRelationshipType")
53 9d0d8d15 a.babadshanjan
@XmlRootElement(name = "TaxonRelationshipType")
54 9479da48 Andreas Müller
@Entity
55 c70a7f0f Andreas Kohlbecker
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
56 1c39686b Andreas Müller
//@Indexed(index = "eu.etaxonomy.cdm.model.term.DefinedTermBase")
57 ee91bcd9 ben.clark
@Audited
58 6686d850 Andreas Müller
public class TaxonRelationshipType extends RelationshipTermBase<TaxonRelationshipType> {
59 95d79c4d Andreas Müller
	private static final long serialVersionUID = 6575652105931691670L;
60
	@SuppressWarnings("unused")
61
	private static final Logger logger = Logger.getLogger(TaxonRelationshipType.class);
62 9479da48 Andreas Müller
63 2aa73e7b Cherian Mathew
	protected static Map<UUID, TaxonRelationshipType> termMap = null;
64
65 9479da48 Andreas Müller
	private static final UUID uuidTaxonomicallyIncludedIn = UUID.fromString("d13fecdf-eb44-4dd7-9244-26679c05df1c");
66 909d16e8 Andreas Müller
67 aaafab4d Andreas Müller
	public static final UUID uuidMisappliedNameFor = UUID.fromString("1ed87175-59dd-437e-959e-0d71583d8417");
68 8de7ec9f Andreas Müller
	public static final UUID uuidProParteMisappliedNameFor = UUID.fromString("b59b4bd2-11ff-45d1-bae2-146efdeee206");
69
	public static final UUID uuidPartialMisappliedNameFor = UUID.fromString("859fb615-b0e8-440b-866e-8a19f493cd36");
70 4010183a Andreas Müller
	public static final UUID uuidProParteSynonymFor = UUID.fromString("8a896603-0fa3-44c6-9cd7-df2d8792e577");
71
	public static final UUID uuidPartialSynonymFor = UUID.fromString("9d7a5e56-973c-474c-b6c3-a1cb00833a3c");
72 9479da48 Andreas Müller
	private static final UUID uuidInvalidDesignationFor = UUID.fromString("605b1d01-f2b1-4544-b2e0-6f08def3d6ed");
73 2aa73e7b Cherian Mathew
74 9479da48 Andreas Müller
	private static final UUID uuidContradiction = UUID.fromString("a8f03491-2ad6-4fae-a04c-2a4c117a2e9b");
75
	private static final UUID uuidCongruentTo = UUID.fromString("60974c98-64ab-4574-bb5c-c110f6db634d");
76
	private static final UUID uuidIncludes = UUID.fromString("0501c385-cab1-4fbe-b945-fc747419bb13");
77
	private static final UUID uuidOverlaps = UUID.fromString("2046a0fd-4fd6-45a1-b707-2b91547f3ec7");
78
	private static final UUID uuidExcludes = UUID.fromString("4535a63c-4a3f-4d69-9350-7bf02e2c23be");
79
	private static final UUID uuidDoesNotExclude = UUID.fromString("0e5099bb-87c0-400e-abdc-bcfed5b5eece");
80
	private static final UUID uuidDoesNotOverlap = UUID.fromString("ecd2382b-3d94-4169-9dd2-2c4ea1d24605");
81
	private static final UUID uuidNotIncludedIn = UUID.fromString("89dffa4e-e004-4d42-b0d1-ae1827529e43");
82
	private static final UUID uuidNotCongruentTo = UUID.fromString("6c16c33b-cfc5-4a00-92bd-a9f9e448f389");
83 2aa73e7b Cherian Mathew
84
85 f38dbbf8 Andreas Müller
	private static final UUID uuidCongruentToOrIncludes = UUID.fromString("b55cb3a2-6e20-4ca3-95bc-12b59d3235b0");
86
	private static final UUID uuidIncludedInOrIncludes = UUID.fromString("c3ed5089-6779-4051-bb24-f5ea0eca80d5");
87
	private static final UUID uuidCongruentIncludedInOrIncludes = UUID.fromString("0170cd83-93ad-43c2-9ad1-7ac879300e2f");
88
	private static final UUID uuidCongruentToOrOverlaps = UUID.fromString("78355cfa-5200-432f-8e00-82b97afad0ed");
89
	private static final UUID uuidIncludesOrOverlaps = UUID.fromString("f1ec567b-3c73-436b-8625-b4fd53588abb");
90 2aa73e7b Cherian Mathew
91 f38dbbf8 Andreas Müller
	private static final UUID uuidCongruentToOrIncludesOrOverlaps = UUID.fromString("2d923b1a-6c0f-414c-ac9b-bbc502e18078");
92
	private static final UUID uuidIncludedInOrIncludesOrOverlaps = UUID.fromString("43466aa9-e431-4f37-8bca-febfd9f63716");
93
	private static final UUID uuidCongruentToOrExcludes = UUID.fromString("758e6cf3-05a0-49ed-9496-d8c4a9fd02ae");
94
	private static final UUID uuidIncludesOrExcludes = UUID.fromString("6ee440bc-fd3d-4da2-ad85-906d35a94731");
95
	private static final UUID uuidCongruentToOrIncludesOrExcludes = UUID.fromString("d5c6953d-aa53-46f8-aafc-ebc6428ad5d0");
96
	private static final UUID uuidIncludedInOrIncludesOrExcludes = UUID.fromString("43d8492c-8bd5-4f38-a633-f1ad910a34dd");
97
	private static final UUID uuidOverlapsOrExcludes = UUID.fromString("623ecdeb-ff1f-471d-a8dc-0d75b2fe8d94");
98
	private static final UUID uuidCongruentToOrOverlapsOrExcludes = UUID.fromString("6fabef72-5264-44f1-bfc0-8e2e141375f2");
99
	private static final UUID uuidIncludesOrOverlapsOrExcludes = UUID.fromString("b7153c89-cc6c-4f8c-bf74-216f10feac46");
100 2aa73e7b Cherian Mathew
101 892efc69 Andreas Kohlbecker
	private static final UUID uuidAllRelationships = UUID.fromString("831fcd88-e5c9-49e0-b06e-bbb67d1c05c9");
102 2aa73e7b Cherian Mathew
103 46b49536 Andreas Müller
	private static final UUID uuidUnclear = UUID.fromString("4c48ba25-c1d0-4bdd-9260-c1fa2e42a5d3");
104
    private static final UUID uuidNotYetWorkedOn = UUID.fromString("8d47e59a-790d-428f-8060-01d443519166");
105
106 8588c491 Andreas Müller
    //currently only used for ERMS import for synonym relationship where the synonym needs to be of class
107
    //Taxon for some reason.
108
    public static final UUID uuidHeterotypicSynonymTaxonRelationship = UUID.fromString("8f1be54b-c693-4d58-ab36-6f389fc9bd1f");
109
    public static final UUID uuidHomotypicSynonymTaxonRelationship = UUID.fromString("bfe114b9-1a25-4199-b8b0-6599eb53ae8a");
110
    public static final UUID uuidSynonymOfTaxonRelationship = UUID.fromString("cc648276-0823-47b1-9deb-fa7c046e4afd");
111 46b49536 Andreas Müller
112
113
114 9e3239f6 Andreas Müller
	public static TaxonRelationshipType NewInstance(String term, String label, String labelAbbrev, boolean symmetric, boolean transitive) {
115
		return new TaxonRelationshipType(term, label, labelAbbrev, symmetric, transitive);
116 2aa73e7b Cherian Mathew
	}
117
118
119
//********************************** CONSTRUCTOR *********************************/
120 892efc69 Andreas Kohlbecker
121 df45d7a7 Andreas Müller
  	/**
122
  	 * @deprecated for inner (hibernate) use only
123
  	 */
124 9e3239f6 Andreas Müller
  	@Deprecated
125
  	protected TaxonRelationshipType() {
126
		super(TermType.TaxonRelationshipType);
127 9479da48 Andreas Müller
	}
128 2aa73e7b Cherian Mathew
	/**
129 b9d0e8d2 m.geoffroy
	 * Class constructor: creates an additional taxon relationship type
130 695ba85a m.geoffroy
	 * instance with a description (in the {@link eu.etaxonomy.cdm.model.common.Language#DEFAULT() default language}), a label,
131 ee39c1d4 m.geoffroy
	 * a label abbreviation and the flags indicating whether this new taxon
132
	 * relationship type is symmetric and/or transitive.
133 2aa73e7b Cherian Mathew
	 *
134 b9d0e8d2 m.geoffroy
	 * @param	term  		 the string (in the default language) describing the
135 2aa73e7b Cherian Mathew
	 * 						 new taxon relationship type to be created
136 b9d0e8d2 m.geoffroy
	 * @param	label  		 the string identifying the new taxon relationship
137
	 * 						 type to be created
138
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
139
	 * 						 new taxon relationship type to be created
140
	 * @param	symmetric	 the boolean indicating whether the new taxon
141
	 * 						 relationship type to be created is symmetric
142
	 * @param	transitive	 the boolean indicating whether the new taxon
143
	 * 						 relationship type to be created is transitive
144
	 * @see 				 #TaxonRelationshipType()
145
	 */
146 9e3239f6 Andreas Müller
	private TaxonRelationshipType(String term, String label, String labelAbbrev, boolean symmetric, boolean transitive) {
147 533cbb43 Andreas Müller
		super(TermType.TaxonRelationshipType, term, label, labelAbbrev, symmetric, transitive);
148 9479da48 Andreas Müller
	}
149
150 2aa73e7b Cherian Mathew
151 892efc69 Andreas Kohlbecker
//************************** METHODS ********************************
152 2aa73e7b Cherian Mathew
153 8cc82a87 Andreas Müller
	@Override
154
	public void resetTerms(){
155
		termMap = null;
156
	}
157
158 2aa73e7b Cherian Mathew
159 892efc69 Andreas Kohlbecker
	protected static TaxonRelationshipType getTermByUuid(UUID uuid){
160 2aa73e7b Cherian Mathew
	    if (termMap == null || termMap.isEmpty()){
161
            return getTermByClassAndUUID(TaxonRelationshipType.class, uuid);
162
        } else {
163
            return termMap.get(uuid);
164
        }
165 892efc69 Andreas Kohlbecker
	}
166 2aa73e7b Cherian Mathew
167 e9baa019 Andreas Müller
    /**
168
     * <code>true</code> if this relationship type is {@link #isAnyMisappliedName()
169
     * any of the misapplied name relationship types} or an
170
     * {@link #INVALID_DESIGNATION_FOR() invalid designation}
171
     *
172
     * @see #isAnyMisappliedName()()
173
     */
174
	public boolean isMisappliedNameOrInvalidDesignation(){
175
        if (this.isAnyMisappliedName()){
176
            return true;
177 891e2f48 Andreas Müller
        }else if (isInvalidDesignation()){
178
            return true;
179
        }
180
        return false;
181
    }
182
183
    /**
184
     * <code>true</code> if this relationship type is an
185
     * {@link #INVALID_DESIGNATION_FOR() invalid designation}
186
     *
187
     * @see #isAnyMisappliedName()()
188
     */
189
    public boolean isInvalidDesignation(){
190
        if (this.equals(INVALID_DESIGNATION_FOR())){
191 e9baa019 Andreas Müller
            return true;
192
        }
193
        return false;
194
    }
195
196
    /**
197
     * <code>true</code> if this relationship type is any
198
     * of the misapplied name relationships such as
199
     * {@link #MISAPPLIED_NAME_FOR()} or {@link #PRO_PARTE_MISAPPLIED_NAME_FOR()}
200
     *
201
     * @see #isMisappliedNameOrInvalidDesignation()
202
     */
203
    public boolean isAnyMisappliedName(){
204
        return (allMisappliedNameTypes().contains(this));
205
    }
206
207 72c9224a Andreas Müller
208
    /**
209
     * <code>true</code> if this relationship type is any
210
     * of the pro parte or partial synonym relationship types
211
     * {@link #PRO_PARTE_SYNONYM_FOR()} or {@link #PARTIAL_SYNONYM_FOR()}
212
     *
213
     * @see #isAnyMisappliedName()
214
     */
215
    public boolean isAnySynonym(){
216
        return (allSynonymTypes().contains(this));
217
    }
218
219
    /**
220
     * <code>true</code> if this relationship type is either
221
     * a pro parte synonym or a pro parte misapplied name relationship type
222
     * {@link #PRO_PARTE_SYNONYM_FOR()} or {@link #PRO_PARTE_MISAPPLIED_NAME_FOR}
223
     */
224
    public boolean isProParte(){
225
        return (allProParteTypes().contains(this));
226
    }
227
228
    /**
229
     * <code>true</code> if this relationship type is either
230
     * a partial synonym or a partial misapplied name relationship type
231
     * {@link #PARTIAL_SYNONYM_FOR()} or {@link #PARTIAL_MISAPPLIED_NAME_FOR}
232
     *
233
     * @see #isProParte()
234
     */
235
    public boolean isPartial(){
236
        return (allPartialTypes().contains(this));
237
    }
238
239 e9baa019 Andreas Müller
    /**
240
     * Returns a list of all misapplied name relationship
241
     * types such as "misapplied name for" and
242
     * "pro parte misapplied name for".
243
     *
244
     * @see #MISAPPLIED_NAME_FOR()
245
     * @see #PRO_PARTE_MISAPPLIED_NAME_FOR()
246
     */
247
    public static Set<TaxonRelationshipType> allMisappliedNameTypes(){
248
        Set<TaxonRelationshipType> result = new HashSet<>();
249
        result.add(MISAPPLIED_NAME_FOR());
250
        result.add(PRO_PARTE_MISAPPLIED_NAME_FOR());
251 72c9224a Andreas Müller
        result.add(PARTIAL_MISAPPLIED_NAME_FOR());
252
        return result;
253
    }
254
255
    public static Set<TaxonRelationshipType> allSynonymTypes(){
256
        Set<TaxonRelationshipType> result = new HashSet<>();
257
        result.add(PRO_PARTE_SYNONYM_FOR());
258
        result.add(PARTIAL_SYNONYM_FOR());
259
        return result;
260
    }
261
262
    public static Set<TaxonRelationshipType> allProParteTypes(){
263
        Set<TaxonRelationshipType> result = new HashSet<>();
264
        result.add(PRO_PARTE_SYNONYM_FOR());
265
        result.add(PRO_PARTE_MISAPPLIED_NAME_FOR());
266 e9baa019 Andreas Müller
        return result;
267
    }
268
269 72c9224a Andreas Müller
    public static Set<TaxonRelationshipType> allPartialTypes(){
270
        Set<TaxonRelationshipType> result = new HashSet<>();
271
        result.add(PARTIAL_SYNONYM_FOR());
272
        result.add(PARTIAL_MISAPPLIED_NAME_FOR());
273
        return result;
274
    }
275 e9baa019 Andreas Müller
276 2aa73e7b Cherian Mathew
277 9039d75a Andreas Müller
	/**
278 e9baa019 Andreas Müller
	 * Returns <code>true</code>, if this relationship type is not a <i>misapplied name for<i>
279 9039d75a Andreas Müller
	 * and also no <i>taxonomically included in</i> relationship.<BR>
280
	 * It assumes that all other relationships are concept relationships.
281
	 * @return
282
	 */
283
	public boolean isConceptRelationship(){
284 e9baa019 Andreas Müller
		if (this.isMisappliedNameOrInvalidDesignation()){
285 9039d75a Andreas Müller
			return false;
286 e9baa019 Andreas Müller
        }else if (this.equals(TAXONOMICALLY_INCLUDED_IN())){
287 9039d75a Andreas Müller
			return false;
288
		}
289
		return true;
290
	}
291 9479da48 Andreas Müller
292 b9d0e8d2 m.geoffroy
	/**
293
	 * Returns the taxon relationship type "is taxonomically included in". This
294
	 * indicates that the {@link TaxonRelationship#getFromTaxon() source taxon}
295
	 * in such a {@link TaxonRelationship taxon relationship} has the target {@link Taxon taxon}
296 1d36aa54 Andreas Müller
	 * as immediate next higher parent within the classification. Generally
297 b9d0e8d2 m.geoffroy
	 * the {@link Taxon#getSec() concept reference} of both taxa are the same
298
	 * except if the concept reference follows the taxonomical opinion of
299
	 * another reference.<BR>
300
	 * This type is neither symmetric nor transitive.
301 892efc69 Andreas Kohlbecker
	 * @deprecated will be removed in version 3.0
302 b9d0e8d2 m.geoffroy
	 */
303 2aa73e7b Cherian Mathew
	@Deprecated
304 b81d5788 m.doering
	public static final TaxonRelationshipType TAXONOMICALLY_INCLUDED_IN(){
305 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidTaxonomicallyIncludedIn);
306 9479da48 Andreas Müller
	}
307 b9d0e8d2 m.geoffroy
	/**
308
	 * Returns the taxon relationship type "is misapplied name for". This
309 df45d7a7 Andreas Müller
	 * indicates that the {@link eu.etaxonomy.cdm.model.name.TaxonName taxon name}
310
	 * of the {@link TaxonRelationship#getFromTaxon() source taxon}
311 b9d0e8d2 m.geoffroy
	 * in such a {@link TaxonRelationship taxon relationship} has been erroneously used by
312
	 * the {@link TaxonBase#getSec() concept reference} to denominate the same real taxon
313
	 * as the one meant by the target {@link Taxon taxon}.<BR>
314
	 * This type is neither symmetric nor transitive.
315
	 */
316 a895dbd0 Andreas Müller
	public static final TaxonRelationshipType MISAPPLIED_NAME_FOR(){
317 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidMisappliedNameFor);
318 9479da48 Andreas Müller
	}
319 e9baa019 Andreas Müller
    /**
320
     * Returns the taxon relationship type "is pro parte misapplied name for". This
321
     * indicates that the {@link eu.etaxonomy.cdm.model.name.TaxonName taxon name} of the
322
     * {@link TaxonRelationship#getFromTaxon() source taxon}
323
     * in such a {@link TaxonRelationship taxon relationship} has been erroneously used by
324
     * the {@link TaxonBase#getSec() concept reference} to (partly) denominate the same real taxon
325
     * as the one meant by the target {@link Taxon taxon}. Additionaly another real taxon
326 630df75e Andreas Müller
     * is (partly) denominated by the given name in the concept reference. Therefore it is called
327 e9baa019 Andreas Müller
     * pro parte. <BR>
328
     * This type is neither symmetric nor transitive.
329
     *
330
     * @see #MISAPPLIED_NAME_FOR()
331 84046c2e Andreas Müller
     * @see #PRO_PARTE_SYNONYM_FOR()
332 e9baa019 Andreas Müller
     */
333
    public static final TaxonRelationshipType PRO_PARTE_MISAPPLIED_NAME_FOR(){
334
        return getTermByUuid(uuidProParteMisappliedNameFor);
335
    }
336 84046c2e Andreas Müller
    /**
337
     * Returns the taxon relationship type "is partial misapplied name for". This
338
     * indicates that the {@link eu.etaxonomy.cdm.model.name.TaxonName taxon name} of the
339
     * {@link TaxonRelationship#getFromTaxon() source taxon}
340
     * in such a {@link TaxonRelationship taxon relationship} has been erroneously used by
341
     * the {@link TaxonBase#getSec() concept reference} to (partly) denominate the same real taxon
342
     * as the one meant by the target {@link Taxon taxon}. In contrary to a
343
     * {@link #PRO_PARTE_MISAPPLIED_NAME_FOR() pro parte misapplied name} no other real taxon
344
     * is (partly) demoninated by the given name in the concept reference. Therefore it is called
345
     * partial.<BR>
346
     * This type is neither symmetric nor transitive.
347
     *
348
     * @see #MISAPPLIED_NAME_FOR()
349
     * @see #PRO_PARTE_MISAPPLIED_NAME_FOR()
350
     * @see #PARTIAL_SYNONYM_FOR()
351
     * @see #INCLUDES()
352
     */
353
    public static final TaxonRelationshipType PARTIAL_MISAPPLIED_NAME_FOR(){
354
        return getTermByUuid(uuidPartialMisappliedNameFor);
355
    }
356
    /**
357
     * Returns the taxon relationship type "is pro parte synonym for". This
358
     * indicates that the {@link eu.etaxonomy.cdm.model.name.TaxonName taxon name} of the
359
     * {@link TaxonRelationship#getFromTaxon() source taxon}
360
     * in such a {@link TaxonRelationship taxon relationship} has been used as a
361
     * pro parte synonym.<BR>
362
     * This type is neither symmetric nor transitive.
363
     *
364
     * @see #PRO_PARTE_MISAPPLIED_NAME_FOR()
365
     */
366
    public static final TaxonRelationshipType PRO_PARTE_SYNONYM_FOR(){
367
        return getTermByUuid(uuidProParteSynonymFor);
368
    }
369
    /**
370
     * Returns the taxon relationship type "is partial synonym for". This
371
     * indicates that the {@link eu.etaxonomy.cdm.model.name.TaxonName taxon name} of the
372
     * {@link TaxonRelationship#getFromTaxon() source taxon}
373
     * in such a {@link TaxonRelationship taxon relationship} has been used as a
374
     * partial synonym.<BR>
375
     * This type is neither symmetric nor transitive.
376
     *
377
     * @see #PRO_PARTE_SYNONYM_FOR()
378
     * @see #PARTIAL_MISAPPLIED_NAME_FOR()
379
     */
380
    public static final TaxonRelationshipType PARTIAL_SYNONYM_FOR(){
381
        return getTermByUuid(uuidPartialSynonymFor);
382
    }
383 e9baa019 Andreas Müller
384 b9d0e8d2 m.geoffroy
	/**
385
	 * Returns the taxon relationship type "is invalid designation for". This
386 9dc896c9 Andreas Müller
	 * indicates that the {@link eu.etaxonomy.cdm.model.name.TaxonName taxon name} of the {@link TaxonRelationship#getFromTaxon() source taxon}
387 695ba85a m.geoffroy
	 * in such a {@link TaxonRelationship taxon relationship} has
388
	 * {@link eu.etaxonomy.cdm.model.name.NomenclaturalStatusType#isInvalidType() not been validly published} but was intended to denominate
389 a895dbd0 Andreas Müller
	 * a real taxon which is the same as the one meant by the target {@link Taxon taxon}.<BR>
390 2aa73e7b Cherian Mathew
	 * According to the nomenclature codes a not validly published taxon name is
391 a895dbd0 Andreas Müller
	 * not a taxon name at all.<BR>
392 b9d0e8d2 m.geoffroy
	 * This type is neither symmetric nor transitive.
393
	 */
394 a895dbd0 Andreas Müller
	public static final TaxonRelationshipType INVALID_DESIGNATION_FOR(){
395 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidInvalidDesignationFor);
396 9479da48 Andreas Müller
	}
397 b9d0e8d2 m.geoffroy
	/**
398
	 * Returns the (concept) taxon relationship type "is impossible"
399
	 * (contradiction). This is a concept relationship type which means that the
400
	 * circumscriptions (the set of organisms/specimens that belong to a {@link Taxon taxon}
401
	 * according to the -maybe implicit- opinion of the {@link TaxonBase#getSec() concept reference})
402
	 * of both taxa involved in such a {@link TaxonRelationship taxon relationship} are
403
	 * beeing compared. In a concept relationship the concept references of the
404
	 * involved taxa must be distinct. <BR>
405
	 * The "is impossible" (contradiction) taxon relationship type arises
406
	 * logically if two or more incompatible (concept) taxon relationships
407
	 * between the two taxa already exist (for instance with the types
408
	 * "is congruent to" and "excludes").<BR>
409
	 * This type is symmetric but not transitive.
410
	 */
411 b81d5788 m.doering
	public static final TaxonRelationshipType CONTRADICTION(){
412 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidContradiction);
413 9479da48 Andreas Müller
	}
414 b9d0e8d2 m.geoffroy
	/**
415
	 * Returns the (concept) taxon relationship type "is congruent to".
416
	 * This is a concept relationship type which means that the circumscriptions
417
	 * (the set of organisms/specimens that belong to a {@link Taxon taxon} according
418
	 * to the -maybe implicit- opinion of the {@link TaxonBase#getSec() concept reference})
419
	 * of both taxa involved in such a {@link TaxonRelationship taxon relationship} are
420
	 * beeing compared. In a concept relationship the concept references of the
421
	 * involved taxa must be distinct. <BR>
422
	 * The "is congruent to" taxon relationship type indicates that the
423
	 * circumscriptions of both taxa involved in the taxon relationship are
424
	 * identical.<BR>
425
	 * This type is symmetric and transitive.
426
	 */
427 a895dbd0 Andreas Müller
	public static final TaxonRelationshipType CONGRUENT_TO(){
428 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidCongruentTo);
429 9479da48 Andreas Müller
	}
430 b9d0e8d2 m.geoffroy
	/**
431
	 * Returns the (concept) taxon relationship type "includes".
432
	 * This is a concept relationship type which means that the circumscriptions
433
	 * (the set of organisms/specimens that belong to a {@link Taxon taxon} according
434
	 * to the -maybe implicit- opinion of the {@link TaxonBase#getSec() concept reference})
435
	 * of both taxa involved in such a {@link TaxonRelationship taxon relationship} are
436
	 * beeing compared. In a concept relationship the concept references of the
437
	 * involved taxa must be distinct. <BR>
438
	 * The "includes" taxon relationship type indicates that each element
439
	 * belonging to the circumscription of the target taxon involved in the
440
	 * taxon relationship belongs to the circumscription of the source taxon,
441
	 * but that some elements belonging to the circumscription of the source
442
	 * taxon do not belong to the circumscription of the target taxon.<BR>
443
	 * This type is not symmetric but transitive.
444
	 */
445 b81d5788 m.doering
	public static final TaxonRelationshipType INCLUDES(){
446 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidIncludes);
447 9479da48 Andreas Müller
	}
448 b9d0e8d2 m.geoffroy
	/**
449
	 * Returns the (concept) taxon relationship type "overlaps".
450
	 * This is a concept relationship type which means that the circumscriptions
451
	 * (the set of organisms/specimens that belong to a {@link Taxon taxon} according
452
	 * to the -maybe implicit- opinion of the {@link TaxonBase#getSec() concept reference})
453
	 * of both taxa involved in such a {@link TaxonRelationship taxon relationship} are
454
	 * beeing compared. In a concept relationship the concept references of the
455
	 * involved taxa must be distinct. <BR>
456
	 * The "overlaps" taxon relationship type indicates that both
457
	 * circumscriptions have common elements but that some elements belonging
458
	 * to the circumscription of the source taxon do not belong to the
459
	 * circumscription of the target taxon and vice-versa.<BR>
460
	 * This type is symmetric but not transitive.
461
	 */
462 b81d5788 m.doering
	public static final TaxonRelationshipType OVERLAPS(){
463 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidOverlaps);
464 9479da48 Andreas Müller
	}
465 b9d0e8d2 m.geoffroy
	/**
466
	 * Returns the (concept) taxon relationship type "excludes".
467
	 * This is a concept relationship type which means that the circumscriptions
468
	 * (the set of organisms/specimens that belong to a {@link Taxon taxon} according
469
	 * to the -maybe implicit- opinion of the {@link TaxonBase#getSec() concept reference})
470
	 * of both taxa involved in such a {@link TaxonRelationship taxon relationship} are
471
	 * beeing compared. In a concept relationship the concept references of the
472
	 * involved taxa must be distinct. <BR>
473
	 * The "excludes" taxon relationship type indicates that both
474
	 * circumscriptions have no common elements.<BR>
475
	 * This type is symmetric but not transitive.
476
	 */
477 b81d5788 m.doering
	public static final TaxonRelationshipType EXCLUDES(){
478 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidExcludes);
479 9479da48 Andreas Müller
	}
480 b9d0e8d2 m.geoffroy
	/**
481
	 * Returns the (concept) taxon relationship type "does not exclude".
482
	 * This is a concept relationship type which means that the circumscriptions
483
	 * (the set of organisms/specimens that belong to a {@link Taxon taxon} according
484
	 * to the -maybe implicit- opinion of the {@link TaxonBase#getSec() concept reference})
485
	 * of both taxa involved in such a {@link TaxonRelationship taxon relationship} are
486
	 * beeing compared. In a concept relationship the concept references of the
487
	 * involved taxa must be distinct. <BR>
488
	 * The "does not exclude" taxon relationship type indicates that both
489
	 * circumscriptions have common elements. This type is a generalisation of
490 695ba85a m.geoffroy
	 * {@link #CONGRUENT_TO() "is congruent to"}, {@link #INCLUDES() "includes"} and {@link #OVERLAPS() "overlaps"}.<BR>
491 b9d0e8d2 m.geoffroy
	 * This type is symmetric but not transitive.
492 2aa73e7b Cherian Mathew
	 *
493 695ba85a m.geoffroy
	 * @see		#EXCLUDES()
494 b9d0e8d2 m.geoffroy
	 */
495 a895dbd0 Andreas Müller
	public static final TaxonRelationshipType DOES_NOT_EXCLUDE(){
496 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidDoesNotExclude);
497 9479da48 Andreas Müller
	}
498 b9d0e8d2 m.geoffroy
	/**
499
	 * Returns the (concept) taxon relationship type "does not overlap".
500
	 * This is a concept relationship type which means that the circumscriptions
501
	 * (the set of organisms/specimens that belong to a {@link Taxon taxon} according
502
	 * to the -maybe implicit- opinion of the {@link TaxonBase#getSec() concept reference})
503
	 * of both taxa involved in such a {@link TaxonRelationship taxon relationship} are
504
	 * beeing compared. In a concept relationship the concept references of the
505
	 * involved taxa must be distinct. <BR>
506
	 * The "does not overlap" taxon relationship type is a generalisation of
507 695ba85a m.geoffroy
	 * {@link #CONGRUENT_TO() "is congruent to"}, {@link #INCLUDES() "includes"} and {@link #EXCLUDES() "excludes"}.<BR>
508 b9d0e8d2 m.geoffroy
	 * This type is symmetric but not transitive.
509 2aa73e7b Cherian Mathew
	 *
510 695ba85a m.geoffroy
	 * @see		#OVERLAPS()
511 b9d0e8d2 m.geoffroy
	 */
512 a895dbd0 Andreas Müller
	public static final TaxonRelationshipType DOES_NOT_OVERLAP(){
513 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidDoesNotOverlap);
514 9479da48 Andreas Müller
	}
515 b9d0e8d2 m.geoffroy
	/**
516
	 * Returns the (concept) taxon relationship type "is not included in".
517
	 * This is a concept relationship type which means that the circumscriptions
518
	 * (the set of organisms/specimens that belong to a {@link Taxon taxon} according
519
	 * to the -maybe implicit- opinion of the {@link TaxonBase#getSec() concept reference})
520
	 * of both taxa involved in such a {@link TaxonRelationship taxon relationship} are
521
	 * beeing compared. In a concept relationship the concept references of the
522
	 * involved taxa must be distinct. <BR>
523
	 * The "is not included in" taxon relationship type indicates that at least
524
	 * one element belonging to the circumscription of the source taxon involved
525
	 * in the taxon relationship does not belong to the circumscription of the
526
	 * target taxon. <BR>
527
	 * This type is neither symmetric nor transitive.
528 2aa73e7b Cherian Mathew
	 *
529 695ba85a m.geoffroy
	 * @see		#INCLUDES()
530 b9d0e8d2 m.geoffroy
	 */
531 a895dbd0 Andreas Müller
	public static final TaxonRelationshipType NOT_INCLUDED_IN(){
532 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidNotIncludedIn);
533 9479da48 Andreas Müller
	}
534 b9d0e8d2 m.geoffroy
	/**
535
	 * Returns the (concept) taxon relationship type "is not congruent to".
536
	 * This is a concept relationship type which means that the circumscriptions
537
	 * (the set of organisms/specimens that belong to a {@link Taxon taxon} according
538
	 * to the -maybe implicit- opinion of the {@link TaxonBase#getSec() concept reference})
539
	 * of both taxa involved in such a {@link TaxonRelationship taxon relationship} are
540
	 * beeing compared. In a concept relationship the concept references of the
541
	 * involved taxa must be distinct. <BR>
542
	 * The "is not congruent to" taxon relationship type indicates that at least
543
	 * one element belonging to one of both circumscriptions does not belong to
544
	 * the other circumscription. This type is a generalisation of
545 695ba85a m.geoffroy
	 * {@link #INCLUDES() "includes"}, {@link #OVERLAPS() "overlaps"} and {@link #EXCLUDES() "excludes"}.<BR>
546 b9d0e8d2 m.geoffroy
	 * This type is symmetric but not transitive.
547 2aa73e7b Cherian Mathew
	 *
548 695ba85a m.geoffroy
	 * @see		#CONGRUENT_TO()
549 b9d0e8d2 m.geoffroy
	 */
550 a895dbd0 Andreas Müller
	public static final TaxonRelationshipType NOT_CONGRUENT_TO(){
551 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidNotCongruentTo);
552 9479da48 Andreas Müller
	}
553
554 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType CONGRUENT_OR_INCLUDES(){
555 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidCongruentToOrIncludes);
556 f38dbbf8 Andreas Müller
	}
557
	public static final TaxonRelationshipType INCLUDED_OR_INCLUDES(){
558 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidIncludedInOrIncludes);
559 f38dbbf8 Andreas Müller
	}
560
	public static final TaxonRelationshipType CONGRUENT_OR_INCLUDED_OR_INCLUDES(){
561 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidCongruentIncludedInOrIncludes);
562 f38dbbf8 Andreas Müller
	}
563
	public static final TaxonRelationshipType CONGRUENT_OR_OVERLAPS(){
564 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidCongruentToOrOverlaps);
565 f38dbbf8 Andreas Müller
	}
566 2aa73e7b Cherian Mathew
567 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType INCLUDES_OR_OVERLAPS(){
568 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidIncludesOrOverlaps);
569 f38dbbf8 Andreas Müller
	}
570
571
	public static final TaxonRelationshipType CONGRUENT_OR_INCLUDES_OR_EXCLUDES(){
572 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidCongruentToOrIncludesOrExcludes);
573 f38dbbf8 Andreas Müller
	}
574 2aa73e7b Cherian Mathew
575 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType INCLUDES_OR_EXCLUDES(){
576 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidIncludesOrExcludes);
577 f38dbbf8 Andreas Müller
	}
578 2aa73e7b Cherian Mathew
579 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType CONGRUENT_OR_EXCLUDES(){
580 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidCongruentToOrExcludes);
581 f38dbbf8 Andreas Müller
	}
582 2aa73e7b Cherian Mathew
583 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType INCLUDED_OR_INCLUDES_OR_OVERLAPS(){
584 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidIncludedInOrIncludesOrOverlaps);
585 f38dbbf8 Andreas Müller
	}
586 2aa73e7b Cherian Mathew
587 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType CONGRUENT_OR_INCLUDES_OR_OVERLAPS(){
588 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidCongruentToOrIncludesOrOverlaps);
589 f38dbbf8 Andreas Müller
	}
590 2aa73e7b Cherian Mathew
591 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType INCLUDES_OR_OVERLAPS_OR_EXCLUDES(){
592 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidIncludesOrOverlapsOrExcludes);
593 f38dbbf8 Andreas Müller
	}
594 2aa73e7b Cherian Mathew
595 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType CONGRUENT_OR_OVERLAPS_OR_EXCLUDES(){
596 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidCongruentToOrOverlapsOrExcludes);
597 f38dbbf8 Andreas Müller
	}
598 2aa73e7b Cherian Mathew
599 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType OVERLAPS_OR_EXCLUDES(){
600 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidOverlapsOrExcludes);
601 f38dbbf8 Andreas Müller
	}
602 2aa73e7b Cherian Mathew
603 f38dbbf8 Andreas Müller
	public static final TaxonRelationshipType INCLUDED_OR_INCLUDES_OR_EXCLUDES(){
604 892efc69 Andreas Kohlbecker
		return getTermByUuid(uuidIncludedInOrIncludesOrExcludes);
605 f38dbbf8 Andreas Müller
	}
606 2aa73e7b Cherian Mathew
607 46b49536 Andreas Müller
	public static final TaxonRelationshipType UNCLEAR(){
608
	    return getTermByUuid(uuidUnclear);
609
	}
610
611
    public static final TaxonRelationshipType NOT_YET_WORKED_ON(){
612
        return getTermByUuid(uuidNotYetWorkedOn);
613
    }
614
615
616 2aa73e7b Cherian Mathew
	@Override
617
    protected void setDefaultTerms(TermVocabulary<TaxonRelationshipType> termVocabulary) {
618 1c39686b Andreas Müller
		termMap = new HashMap<>();
619 892efc69 Andreas Kohlbecker
		for (TaxonRelationshipType term : termVocabulary.getTerms()){
620 2aa73e7b Cherian Mathew
			termMap.put(term.getUuid(), term);
621
		}
622 f6765014 ben.clark
	}
623
624 59b17733 Andreas Müller
	//TODO other relationshipTypes
625 9479da48 Andreas Müller
626 892efc69 Andreas Kohlbecker
	public static final TaxonRelationshipType ALL_RELATIONSHIPS(){
627
		return getTermByUuid(uuidAllRelationships);
628
	}
629 2aa73e7b Cherian Mathew
630 d0b0c36b Andreas Müller
    @Override
631 64cf9d1d Andreas Müller
    public TaxonRelationshipType readCsvLine(Class<TaxonRelationshipType> termClass, List<String> csvLine, TermType termType,
632
            Map<UUID,DefinedTermBase> terms, boolean abbrevAsId) {
633
        TaxonRelationshipType newInstance = super.readCsvLine(termClass, csvLine, termType, terms, abbrevAsId);
634 d0b0c36b Andreas Müller
635
        newInstance.setSymbol(newInstance.getIdInVocabulary());
636 46b49536 Andreas Müller
        String inverseLabelAbbrev = csvLine.get(7).trim();
637 d0b0c36b Andreas Müller
        newInstance.setInverseSymbol(inverseLabelAbbrev);
638
        return newInstance;
639
    }
640 5fb16579 Andreas Müller
641
    /**
642
     * @return a set containing all UUIDs of relationship types representing
643
     * a pro parte or partial synonym relationship (e.g.
644
     * {@link #PRO_PARTE_SYNONYM_FOR()} or {@link #PARTIAL_SYNONYM_FOR()}
645
     */
646
    public static Set<UUID> proParteOrPartialSynonymUuids() {
647
        Set<UUID> result = new HashSet<>();
648
        result.add(uuidProParteSynonymFor);
649
        result.add(uuidPartialSynonymFor);
650
        return result;
651
    }
652
653
    /**
654
     * @return a set containing all UUIDs of relationship types representing
655
     * a misapplied name relationship (e.g. {@link #MISAPPLIED_NAME_FOR()},
656
     * {@link #PRO_PARTE_MISAPPLIED_NAME_FOR()} and {@link #PARTIAL_MISAPPLIED_NAME_FOR()}
657
     */
658
    public static Set<UUID> misappliedNameUuids() {
659
        Set<UUID> result = new HashSet<>();
660
        result.add(uuidMisappliedNameFor);
661
        result.add(uuidProParteMisappliedNameFor);
662
        result.add(uuidPartialMisappliedNameFor);
663
        return result;
664
    }
665
666 891031f6 Andreas Müller
667
    /**
668
     * @return a set containing all UUIDs of relationship types representing
669
     * a partial relationship (e.g. {@link #PARTIAL_SYNONYM_FOR()} and
670
     * {@link #PARTIAL_MISAPPLIED_NAME_FOR()})
671
     */
672
    public static Set<UUID> partialUuids() {
673
        Set<UUID> result = new HashSet<>();
674
        result.add(uuidPartialSynonymFor);
675
        result.add(uuidPartialSynonymFor);
676
        return result;
677
    }
678
679
    /**
680
     * @return a set containing all UUIDs of relationship types representing
681
     * a pro parte relationship (e.g. {@link #PRO_PARTE_SYNONYM_FOR()} and
682
     * {@link #PRO_PARTE_MISAPPLIED_NAME_FOR()})
683
     */
684
    public static Set<UUID> proParteUuids() {
685
        Set<UUID> result = new HashSet<>();
686
        result.add(uuidProParteSynonymFor);
687
        result.add(uuidProParteMisappliedNameFor);
688
        return result;
689
    }
690
691 b8fc4ee4 Andreas Müller
    /**
692
     * @return a set containing all UUIDs of relationship types representing
693
     * a pseudo taxon relationship (a synonym relationship expressed as
694
     * taxon relationship as the synonym side for some reason must be
695
     * handled as pseudo accepted taxon, e.g. because factual data
696
     * is attached from an import)
697
     */
698
    public static Set<UUID> pseudoTaxonUuids() {
699
        Set<UUID> result = new HashSet<>();
700
        result.add(uuidHomotypicSynonymTaxonRelationship);
701
        result.add(uuidHeterotypicSynonymTaxonRelationship);
702
        result.add(uuidSynonymOfTaxonRelationship);
703
        return result;
704
    }
705
706 d45008d0 Andreas Kohlbecker
}