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