Project

General

Profile

Download (26.9 KB) Statistics
| Branch: | Tag: | Revision:
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.name;
11

    
12

    
13
import java.util.HashMap;
14
import java.util.List;
15
import java.util.Map;
16
import java.util.UUID;
17

    
18
import javax.persistence.Entity;
19
import javax.persistence.Transient;
20
import javax.validation.constraints.NotNull;
21
import javax.xml.bind.annotation.XmlAccessType;
22
import javax.xml.bind.annotation.XmlAccessorType;
23
import javax.xml.bind.annotation.XmlAttribute;
24
import javax.xml.bind.annotation.XmlType;
25

    
26
import org.apache.log4j.Logger;
27
import org.hibernate.annotations.Type;
28
import org.hibernate.envers.Audited;
29

    
30
import eu.etaxonomy.cdm.model.common.RelationshipTermBase;
31
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
32
import eu.etaxonomy.cdm.model.term.TermType;
33
import eu.etaxonomy.cdm.model.term.TermVocabulary;
34

    
35
/**
36
 * The class representing the categories of {@link NameRelationship taxon name relationships} between
37
 * two {@link TaxonName taxon names}. These name relationship types are
38
 * based on the concrete {@link NomenclaturalCode nomenclatural code} governing
39
 * the taxon names involved in the name relationship or on decisions taken by
40
 * the competent authorities; they do not depend on the use made of these
41
 * taxon names in a particular reference or in a particular taxonomic treatment.
42
 * Most relationships are to be understood as 'is .... of': for instance
43
 * <i>Linum radiola</i> L. is a replaced synonym of <i>Radiola linoides</i> Roth or
44
 * <i>Astragalus rhizanthus</i> Boiss. is a later homonym of
45
 * <i>Astragalus rhizanthus</i> Royle.
46
 * <P>
47
 * A standard (ordered) list of name relationship type instances will be
48
 * automatically created as the project starts. But this class allows to extend
49
 * this standard list by creating new instances of additional name relationship
50
 * types if needed.
51
 * <P>
52
 * This class corresponds partially to: <ul>
53
 * <li> TaxonRelationshipTerm and NomenclaturalNoteTypeTerm according to the TDWG ontology
54
 * <li> RelationshipType and NomenclaturalNoteType according to the TCS
55
 * </ul>
56
 *
57
 * @author m.doering
58
 * @since 08-Nov-2007 13:06:38
59
 */
60
@XmlAccessorType(XmlAccessType.FIELD)
61
@XmlType(name = "NameRelationshipType", propOrder = {
62
    "nomenclaturalStanding",
63
    "nomenclaturalStandingInverse"}
64
)
65
@Entity
66
//@Indexed disabled to reduce clutter in indexes, since this type is not used by any search
67
//@Indexed(index = "eu.etaxonomy.cdm.model.term.DefinedTermBase")
68
@Audited
69
public class NameRelationshipType extends RelationshipTermBase<NameRelationshipType>
70
        implements INomenclaturalStanding {
71

    
72
    private static final long serialVersionUID = 8504916205254159334L;
73
	static Logger logger = Logger.getLogger(NameRelationshipType.class);
74

    
75
	private static final UUID uuidOrthographicVariant = UUID.fromString("eeaea868-c4c1-497f-b9fe-52c9fc4aca53");
76
	private static final UUID uuidMisspelling = UUID.fromString("c6f9afcb-8287-4a2b-a6f6-4da3a073d5de");
77
	private static final UUID uuidEmendation = UUID.fromString("6e23ad45-3f2a-462b-ad87-d2389cd6e26c");
78
	private static final UUID uuidLaterHomonym = UUID.fromString("80f06f65-58e0-4209-b811-cb40ad7220a6");
79
	private static final UUID uuidTreatedAsLaterHomonym = UUID.fromString("2990a884-3302-4c8b-90b2-dfd31aaa2778");
80
	private static final UUID uuidAlternativeName = UUID.fromString("049c6358-1094-4765-9fae-c9972a0e7780");
81
	private static final UUID uuidBasionym = UUID.fromString("25792738-98de-4762-bac1-8c156faded4a");
82
	private static final UUID uuidReplacedSynonym = UUID.fromString("71c67c38-d162-445b-b0c2-7aba56106696");
83
	private static final UUID uuidConservedAgainst = UUID.fromString("e6439f95-bcac-4ebb-a8b5-69fa5ce79e6a");
84
	private static final UUID uuidValidatedByName = UUID.fromString("a176c9ad-b4c2-4c57-addd-90373f8270eb");
85
	private static final UUID uuidLaterValidatedByName = UUID.fromString("a25ee4c1-863a-4dab-9499-290bf9b89639");
86
	private static final UUID uuidBlockingNameFor = UUID.fromString("1dab357f-2e12-4511-97a4-e5153589e6a6");
87
	private static final UUID uuidLaterIsonym = UUID.fromString("29ab238d-598d-45b9-addd-003cf39ccc3e");
88
	private static final UUID uuidNonUnspecific = UUID.fromString("78360e2a-159d-4e2f-893e-8666805840fa");
89

    
90

    
91
	public static NameRelationshipType NewInstance(String term, String label, String labelAbbrev, boolean symmetric, boolean transitive) {
92
		return new NameRelationshipType(term, label, labelAbbrev, symmetric, transitive);
93
	}
94

    
95
    /**
96
     * The {@link NomenclaturalStanding nomenclatural standing} of a name status type for
97
     * the "from"-name in a name relationship.
98
     * It is usually needed for correct formatting of a name in a synonymy by e.g. using
99
     * a dash instead of equal sign in front.
100
     */
101
    @XmlAttribute(name ="NomenclaturalStanding")
102
    @NotNull
103
    @Type(type = "eu.etaxonomy.cdm.hibernate.EnumUserType",
104
        parameters = {@org.hibernate.annotations.Parameter(name="enumClass", value="eu.etaxonomy.cdm.model.name.NomenclaturalStanding")}
105
    )
106
    @Audited
107
	private NomenclaturalStanding nomenclaturalStanding;
108

    
109
    /**
110
     * The {@link NomenclaturalStanding nomenclatural standing} of a name status type for
111
     * the "to"-name in a name relationship.
112
     * It is usually needed for correct formatting of a name in a synonymy by e.g. using
113
     * a dash instead of equal sign in front.
114
     */
115
    @XmlAttribute(name ="NomenclaturalStanding")
116
    @NotNull
117
    @Type(type = "eu.etaxonomy.cdm.hibernate.EnumUserType",
118
        parameters = {@org.hibernate.annotations.Parameter(name="enumClass", value="eu.etaxonomy.cdm.model.name.NomenclaturalStanding")}
119
    )
120
    @Audited
121
    private NomenclaturalStanding nomenclaturalStandingInverse;
122

    
123
	protected static Map<UUID, NameRelationshipType> termMap = null;
124

    
125
	protected static NameRelationshipType findTermByUuid(UUID uuid){
126
		if (termMap == null || termMap.isEmpty()){
127
		    return getTermByClassAndUUID(NameRelationshipType.class, uuid);
128
		} else {
129
		    return termMap.get(uuid);
130
		}
131
	}
132

    
133
//********************************** Constructor *********************************/
134

    
135
  	//for hibernate use only
136
  	@Deprecated
137
  	protected  NameRelationshipType() {
138
		super(TermType.NameRelationshipType);
139
	}
140

    
141
	/**
142
	 * Class constructor: creates an additional name relationship type
143
	 * instance with a description, a label, a label abbreviation and the flags
144
	 * indicating whether <i>this</i> new name relationship type is symmetric and/or
145
	 * transitive.
146
	 *
147
	 * @param	term  		 the string (in the default language) describing the
148
	 * 						 new name relationship type to be created
149
	 * @param	label  		 the string identifying the new name relationship
150
	 * 						 type to be created
151
	 * @param	labelAbbrev  the string identifying (in abbreviated form) the
152
	 * 						 new name relationship type to be created
153
	 * @param	symmetric	 the boolean indicating whether the new name
154
	 * 						 relationship type to be created is symmetric
155
	 * @param	transitive	 the boolean indicating whether the new name
156
	 * 						 relationship type to be created is transitive
157
	 * @see 				 #NameRelationshipType()
158
	 */
159
	private NameRelationshipType(String term, String label, String labelAbbrev, boolean symmetric, boolean transitive) {
160
		super(TermType.NameRelationshipType, term, label, labelAbbrev, symmetric, transitive);
161
	}
162

    
163
// ************************ GETTER / SETTER ******************/
164

    
165
    public NomenclaturalStanding getNomenclaturalStanding() {
166
        return nomenclaturalStanding;
167
    }
168
    public void setNomenclaturalStanding(NomenclaturalStanding nomenclaturalStanding) {
169
        this.nomenclaturalStanding = nomenclaturalStanding;
170
    }
171

    
172
    public NomenclaturalStanding getNomenclaturalStandingInverse() {
173
        return nomenclaturalStandingInverse;
174
    }
175
    public void setNomenclaturalStandingInverse(NomenclaturalStanding nomenclaturalStandingInverse) {
176
        this.nomenclaturalStandingInverse = nomenclaturalStandingInverse;
177
    }
178

    
179
//************************** METHODS ********************************
180

    
181
	@Override
182
	public void resetTerms(){
183
		termMap = null;
184
	}
185

    
186
    @Override
187
    @Transient
188
    public boolean isInvalidExplicit() {
189
        return this.nomenclaturalStanding.isInvalidExplicit();
190
    }
191
    @Transient
192
    public boolean isInvalidExplicitInverse() {
193
        return this.nomenclaturalStandingInverse.isInvalidExplicit();
194
    }
195

    
196
    @Override
197
    @Transient
198
    public boolean isIllegitimate() {
199
        return this.nomenclaturalStanding.isLegitimate();
200
    }
201
    @Transient
202
    public boolean isIllegitimateInverse() {
203
        return this.nomenclaturalStandingInverse.isLegitimate();
204
    }
205

    
206
    @Override
207
    @Transient
208
    public boolean isValidExplicit() {
209
        return this.nomenclaturalStanding.isValidExplicit();
210
    }
211
    @Transient
212
    public boolean isValidExplicitInverse() {
213
        return this.nomenclaturalStandingInverse.isValidExplicit();
214
    }
215

    
216
    @Override
217
    @Transient
218
    public boolean isNoStatus() {
219
        return this.nomenclaturalStanding.isNoStatus();
220
    }
221
    @Transient
222
    public boolean isNoStatusInverse() {
223
        return this.nomenclaturalStandingInverse.isNoStatus();
224
    }
225

    
226
    @Override
227
    @Transient
228
    public boolean isInvalid() {
229
        return this.nomenclaturalStanding.isInvalid();
230
    }
231
    @Transient
232
    public boolean isInvalidInverse() {
233
        return this.nomenclaturalStandingInverse.isInvalid();
234
    }
235

    
236
    @Override
237
    @Transient
238
    public boolean isLegitimate() {
239
        //later homonym, treated as later homonym, ...
240
        return this.nomenclaturalStanding.isLegitimate();
241
    }
242
    @Transient
243
    public boolean isLegitimateInverse() {
244
        return this.nomenclaturalStandingInverse.isLegitimate();
245
    }
246

    
247
    @Override
248
    @Transient
249
    public boolean isValid() {
250
        return this.nomenclaturalStanding.isValid();
251
    }
252
    @Transient
253
    public boolean isValidInverse() {
254
        return this.nomenclaturalStandingInverse.isValid();
255
    }
256

    
257
    @Override
258
    @Transient
259
    public boolean isDesignationOnly(){
260
        return this.nomenclaturalStanding.isDesignationOnly();
261
    }
262
    @Transient
263
    public boolean isDesignationOnlyInverse(){
264
        return this.nomenclaturalStandingInverse.isDesignationOnly();
265
    }
266

    
267
	@Transient
268
	protected boolean isRelationshipType(NameRelationshipType type) {
269
	    if (type == null){
270
	        throw new IllegalStateException("NameRelationships have not been initialized yet. Please initialize DefinedTerms first");
271
	    }
272
	    return this.equals(type);
273
	}
274

    
275
	@Transient
276
	public boolean isBasionymRelation(){
277
        return isRelationshipType(BASIONYM());
278
	}
279

    
280
	@Transient
281
	public boolean isReplacedSynonymRelation(){
282
        return isRelationshipType(REPLACED_SYNONYM());
283
	}
284

    
285

    
286
	/**
287
	 * Returns the "orthographic variant" name relationship type. The first
288
	 * {@link TaxonName taxon name} involved in such a relationship is an
289
	 * orthographic variant of the second taxon name. The two {@link TaxonName taxon names}
290
	 * involved in such a relationship must have the same {@link NonViralName#getAuthorshipCache() authorship}
291
	 * and {@link Rank rank}, belong to the same {@link HomotypicalGroup homotypical group} and their name parts
292
	 * must be almost identical (so one usually does not differentiate them).<BR>
293
	 * For instance <i>Angelica silvestris</i> L. is an orthographic variant of
294
	 * <i>Angelica sylvestris</i> L.
295
	 * <BR>
296
	 * This type is symmetric and transitive but usually orthographic
297
	 * variant relationships should be organized in a star schema with the (only!)
298
	 * correct variant in the middle and other variants pointing to it.
299
	 * <BR>
300
	 * ICNAFP: Art. 61.2. "For the purpose of this Code, orthographical variants are the various spelling,
301
	 * compounding, and inflectional forms of a name or its final epithet (including typographical errors)
302
	 * when only one nomenclatural type is involved."<BR>
303
	 * Art. 61.1. "Only one orthographical variant of any one name is treated as validly published:
304
	 * the form that appears in the original publication (but see Art. 6.10), except
305
	 *
306
	 * @see #MISSPELLING()
307
	 */
308
	public static final NameRelationshipType ORTHOGRAPHIC_VARIANT(){
309
		  return findTermByUuid(uuidOrthographicVariant);
310
	}
311

    
312
	/**
313
	 * Returns the "misspelling" name relationship type. The first
314
	 * {@link TaxonName taxon name} involved in such a relationship is a
315
	 * misspelling of the second taxon name. The two {@link TaxonName taxon names}
316
	 * involved in such a relationship must have the same {@link NonViralName#getAuthorshipCache() authorship}
317
	 * and {@link Rank rank}, belong to the same {@link HomotypicalGroup homotypical group} and their name parts
318
	 * must be almost identical (so one usually does not differentiate them).<BR>
319
	 * For instance <i>Anhelica silvestris</i> L. is a misspelling of
320
	 * <i>Angelica silvestris</i> L.<BR>
321
	 * A misspelling is always accicentally (not on purpose). Therefore misspellings are overlapping with
322
	 * {@link #ORTHOGRAPHIC_VARIANT orthographic variants} (in an old version of this documentation they
323
	 * were called a subset but it seems doubtful that certain typos are orth. vars. according to Art. 61.2 (ICNAFP).
324
     * and are complementary to {@link #EMENDATION() emendations}.
325
	 * This type is symmetric and transitive but usually the misspelling relationships should be organized
326
	 * in a star schema with the correct variant in the middle and the misspellings pointing to it.<BR>
327
	 * Misspellings are not handled in the ICNAFP.
328
	 *
329
	 * @see https://dev.e-taxonomy.eu/redmine/issues/9386 for discussion on symmetry of this relation
330
	 *
331
	 * @see #ORTHOGRAPHIC_VARIANT()
332
	 */
333
	public static final NameRelationshipType MISSPELLING(){
334
		  return findTermByUuid(uuidMisspelling);
335
	}
336
	/**
337
	 * Returns the "emendation" name relationship type. The first
338
	 * {@link TaxonName taxon name} involved in such a relationship is a
339
	 * misspelling of the second taxon name. The two {@link TaxonName taxon names}
340
	 * involved in such a relationship must have the same {@link NonViralName#getAuthorshipCache() authorship}
341
	 * and {@link Rank rank}, belong to the same {@link HomotypicalGroup homotypical group} and their name parts
342
	 * must be almost identical (so one usually does not differentiate them).<BR>
343
	 * For instance <i>Angelica silvestris</i> L. is a emendation of
344
	 * <i>Angelica sylvestris</i> L.<BR>
345
	 * The name corrected by an emendation has originally been used on purpose (not accidentially)
346
	 * Therefore emendations are a subset of {@link #ORTHOGRAPHIC_VARIANT orthographic variants} and are
347
	 * complementary to {@link #MISSPELLING missepllings}. An emendation is always an
348
	 * {@link #ORTHOGRAPHIC_VARIANT orthographic variant}, too.<BR>
349
	 * This type is symmetric and transitive but usually the misspelling relationships should be organized
350
	 * in a star schema with the correct variant in the middle and the misspellings pointing to it.
351
	 *
352
	 * TODO IN ICNAFP Art. 47.1 emendations are used for alterations of the diagnostic characters, this
353
	 * is something completely different. We need to check where the above definition comes from (zoology?)
354
	 */
355
	public static final NameRelationshipType EMENDATION(){
356
		  return findTermByUuid(uuidEmendation);
357
	}
358
	/**
359
	 * Returns the "later homonym" name relationship type. The first
360
	 * {@link TaxonName taxon name} involved in such a relationship should
361
	 * have been published after the second taxon name. The two {@link TaxonName taxon names}
362
	 * involved in such a relationship must belong to different
363
	 * {@link HomotypicalGroup homotypical groups}, have in general different
364
	 * {@link NonViralName#getAuthorshipCache() authorship} and their name parts (excluding infraspecific
365
	 * {@link Rank ranks}) must be (almost) identical, so one could be mistaken for
366
	 * the other one. The first taxon name is "illegitimate" and the second one
367
	 * is "legitimate" (this corresponds to "invalid" and "valid" in case of
368
	 * {@link IZoologicalName zoological names}).<BR>
369
	 * For instance <i>Astragalus rhizanthus</i> Boiss. is a later homonym of
370
	 * <i>Astragalus rhizanthus</i> Royle.<BR>
371
	 * This type is not symmetric but transitive.
372
	 *
373
	 * @see	NomenclaturalStatusType#isIllegitimate()
374
	 * @see	NomenclaturalStatusType#isLegitimate()
375
	 */
376
	public static final NameRelationshipType LATER_HOMONYM(){
377
	  return findTermByUuid(uuidLaterHomonym);
378
	}
379

    
380

    
381
	/**
382
	 * Returns the "treated as later homonym" name relationship type. The first
383
	 * {@link TaxonName taxon name} involved in such a relationship is
384
	 * treated as an homonym although it has been published before the second
385
	 * taxon name. The two taxon names involved must belong to different
386
	 * {@link HomotypicalGroup homotypical groups} and their name parts (excluding
387
	 * {@link Rank#isInfraSpecific() infraspecific ranks} and {@link NonViralName#getAuthorshipCache() authorship}) must be
388
	 * almost identical (so one could be mistaken for the other). The first
389
	 * taxon name is "illegitimate" and the second one is "legitimate" (this
390
	 * corresponds to "invalid" and "valid" in case of {@link IZoologicalName zoological names}).<BR>
391
	 * This type is not symmetric but transitive.
392
	 *
393
	 * @see	#LATER_HOMONYM()
394
	 * @see	NomenclaturalStatusType#isIllegitimate()
395
	 * @see	NomenclaturalStatusType#isLegitimate()
396
	 */
397
	public static final NameRelationshipType TREATED_AS_LATER_HOMONYM(){
398
	  return findTermByUuid(uuidTreatedAsLaterHomonym);
399
	}
400

    
401
	/**
402
	 * Returns the "later isonym" name relationship type where the first
403
	 * {@link TaxonName taxon name} involved has been published after the second taxon name.<BR>
404
	 * In contrast to the {@link #LATER_HOMONYM() later homonym} relationship the two
405
	 * {@link TaxonName taxon names} involved have the type(s) so they belong to the
406
	 * same {@link HomotypicalGroup homotypical groups}. As later homonyms they have in general
407
	 * different {@link NonViralName#getAuthorshipCache() authorship} and their name parts
408
	 * must be (almost) identical, so one could be mistaken for the other one.<BR>
409
	 * Later isonyms are validly published names but with a wrong citation. So there are rather errors
410
	 * then independent names.<BR>
411
	 * Isonyms are handled in Article 6, Note 2 of the ICNAFP (Melbourne Code):
412
	 * <code>When the same name, based on the same type, has been published independently at different
413
	 *  times perhaps by different authors, then only the earliest of these �isonyms� has
414
	 *  nomenclatural status. The name is always to be cited from its original
415
	 *  place of valid publication, and later isonyms may be disregarded (but see Art. 14.15).</code>
416
	 * <BR><BR>
417
	 * See discussion at: <a href=https://dev.e-taxonomy.eu/redmine/issues/2901>#2901</a>
418
	 *
419
	 */
420
	public static final NameRelationshipType LATER_ISONYM(){
421
		return findTermByUuid(uuidLaterIsonym);
422
	}
423

    
424
	/**
425
	 * Returns the "alternative name" name relationship type. Both {@link TaxonName taxon names}
426
	 * involved in such a relationship are family names. The first one is a
427
	 * classical name long in use, in some cases, even before 1753 and is considered as
428
	 * {@link NomenclaturalStatusType#VALID() valid} and also {@link NomenclaturalStatusType#isLegitimate() legitimate}
429
	 * although it does not follow the rules for family names (see Article 18 of
430
	 * the ICBN). An alternative name is typified by the type of the name
431
	 * it is alternative to (so both must belong to the same
432
	 * {@link HomotypicalGroup homotypical group}).<BR>
433
	 * For instance <i>Cruciferae</i> Adans is an alternative name to
434
	 * <i>Brassicaceae</i> Lindl.<BR>
435
	 * This type is neither symmetric nor transitive.
436
	 */
437
	public static final NameRelationshipType ALTERNATIVE_NAME(){
438
	  return findTermByUuid(uuidAlternativeName);
439
	}
440
	/**
441
	 * Returns the "basionym" name relationship type. The first {@link TaxonName taxon name}
442
	 * involved in such a relationship is the "basionym" of the second taxon
443
	 * name. Both taxon names belong to the same {@link HomotypicalGroup homotypical group}).
444
	 * The basionym is the epithet-bringing taxon name (first taxon name
445
	 * ever validly published given to the same {@link Rank#isInfraGeneric() infrageneric}
446
	 * taxon, the epithet of which is the same as in the second taxon name
447
	 * originated through a reclassification).<BR>
448
	 * According to the ICBN the author of the basionym must be mentioned in the
449
	 * later taxon name (by placing it in parentheses before the authority of
450
	 * the new combination). For instance <i>Pinus abies</i> L. is the basionym of
451
	 * <i>Picea abies</i> (L.) H. Karst.<BR>
452
	 * This type is neither symmetric nor transitive.
453
	 */
454
	public static final NameRelationshipType BASIONYM(){
455
	  return findTermByUuid(uuidBasionym);
456
	}
457
	/**
458
	 * Returns the "replaced synonym" name relationship type. The first
459
	 * {@link TaxonName taxon name} involved in such a relationship is the
460
	 * "replaced synonym" of the second taxon name. Both taxon names belong to
461
	 * the same {@link HomotypicalGroup homotypical group}. The replaced synonym is the
462
	 * first taxon name ever validly published given to the same
463
	 * {@link Rank#isInfraGeneric() infrageneric} taxon that is either itself a
464
	 * "later homonym" or the epithet of which could not be used in the new
465
	 * taxon name originated through a reclassification. A new epithet must be
466
	 * proposed if the use of the original epithet leads to an already existing
467
	 * taxon name (for another taxon) or in botany to autonyms (since the ICBN
468
	 * does not allow such names where epithet and genus name are the same).<BR>
469
	 * For instance <i>Spartium biflorum</i> Desf. is the replaced synonym of
470
	 * of <i>Cytisus fontanesii</i> Spach ("novum" taxon name) because at the time
471
	 * of reclassification a taxon name <i>Cytisus biflorum</i> had been already
472
	 * published by L'H�r.<BR>
473
	 * This type is neither symmetric nor transitive.
474
	 *
475
	 * @see #BASIONYM()
476
	 * @see #LATER_HOMONYM()
477
	 * @see NomenclaturalStatusType#NOVUM()
478
	 */
479
	public static final NameRelationshipType REPLACED_SYNONYM(){
480
	  return findTermByUuid(uuidReplacedSynonym);
481
	}
482
	/**
483
	 * Returns the "conserved against" name relationship type. Both {@link TaxonName taxon names}
484
	 * involved in such a relationship belong to the same {@link HomotypicalGroup homotypical group}.
485
	 * Competent authorities decided, regardless of the general
486
	 * nomenclatural rules, to handle the first one as the "legitimate"
487
	 * one and the second taxon name as "illegitimate" (this corresponds to
488
	 * "valid" and "invalid" in case of {@link IZoologicalName zoological names}).<BR>
489
	 * For instance <i>Cephaloziella</i> (Spruce) Schiffn. is conserved against
490
	 * <i>Dichiton</i> Mont.<BR>
491
	 * This type is neither symmetric nor transitive.
492
	 *
493
	 * @see NomenclaturalStatusType#CONSERVED()
494
	 * @see NomenclaturalStatusType#REJECTED()
495
	 * @see NomenclaturalStatusType#isLegitimate()
496
	 * @see NomenclaturalStatusType#isIllegitimate()
497
	 */
498
	public static final NameRelationshipType CONSERVED_AGAINST(){
499
	  return findTermByUuid(uuidConservedAgainst);
500
	}
501
	/**
502
	 * Returns the "validated by name" name relationship type. The two
503
	 * {@link TaxonName taxon names} involved in such a relationship were published
504
	 * in order to define the same taxonomical group but the first
505
	 * (earlier) taxon name was invalidly published whereas the second (later)
506
	 * taxon name is the one which was validly published for the first time.<BR>
507
	 * This type is neither symmetric nor transitive.
508
	 *
509
	 * @see		NomenclaturalStatusType#isInvalid()
510
	 * @see		NomenclaturalStatusType#VALID()
511
	 */
512
	public static final NameRelationshipType VALIDATED_BY_NAME(){
513
	  return findTermByUuid(uuidValidatedByName);
514
	}
515
	/**
516
	 * Returns the "later validated by name" name relationship type. The two
517
	 * {@link TaxonName taxon names} involved in such a relationship were published
518
	 * in order to define the same taxonomical group but the first
519
	 * (earlier) taxon name was invalidly published whereas the second (later)
520
	 * taxon name is the one which was validly published for the first time.<BR>
521
	 * This type is neither symmetric nor transitive.
522
	 *
523
	 * @see		NomenclaturalStatusType#isInvalid()
524
	 * @see		NomenclaturalStatusType#VALID()
525
	 */
526
	public static final NameRelationshipType LATER_VALIDATED_BY_NAME(){
527
	  return findTermByUuid(uuidLaterValidatedByName);
528
	}
529
	/**
530
	 * Returns the "blocking name" name relationship type. The first
531
	 * {@link TaxonName taxon name} involved in such a relationship is the
532
	 * "blocking name" for the second taxon name. Both taxon names belong to
533
	 * different {@link HomotypicalGroup homotypical groups}). The blocking taxon name is the
534
	 * {@link Rank#isInfraGeneric() infrageneric} taxon name, already published at the time of
535
	 * reclassification, which makes illegitim (because of homonymy) the use of
536
	 * the epithet in the second taxon name originated through a reclassification.
537
	 * Therefore a "replaced synonym" name relationship arises.<BR>
538
	 * For instance  <i>Cytisus biflorum</i> L'H�r. is the blocking name for
539
	 * <i>Cytisus fontanesii</i> Spach ("novum" taxon name) when reclassifying
540
	 * <i>Spartium biflorum</i> Desf. from <i>Spartium</i> to <i>Cytisus</i>.<BR>
541
	 * This type is neither symmetric nor transitive.
542
	 *
543
	 * @see #REPLACED_SYNONYM()
544
	 * @see #LATER_HOMONYM()
545
	 * @see NomenclaturalStatusType#NOVUM()
546
	 */
547
	public static final NameRelationshipType BLOCKING_NAME_FOR(){
548
	  return  findTermByUuid(uuidBlockingNameFor);
549
	}
550

    
551
	/**
552
     * Returns the unspecific 'non' name relationship type. Name A in this
553
     * relationship is unspecificly marked as not being name B.
554
     * This relationship should only be used if in the given
555
     * context no further information exists to more specifically
556
     * define what kind of non-relationship is meant.
557
     * <BR>
558
     * When cleaning data this relationship type should be replaced
559
     * by one of the below mentioned more specific relationship types.
560
     *
561
     * This type is neither symmetric nor transitive.
562
     *
563
     * @see     #LATER_HOMONYM()
564
     * @see     #TREATED_AS_LATER_HOMONYM()
565
     * @see     #BLOCKING_NAME_FOR()
566
     */
567
	//#5655, #5640
568
    public static final NameRelationshipType UNSPECIFIC_NON(){
569
      return findTermByUuid(uuidNonUnspecific);
570
    }
571

    
572
	@Override
573
	protected void setDefaultTerms(TermVocabulary<NameRelationshipType> termVocabulary) {
574
		termMap = new HashMap<UUID, NameRelationshipType>();
575
		for (NameRelationshipType term : termVocabulary.getTerms()){
576
			termMap.put(term.getUuid(), term);
577
		}
578
	}
579

    
580
	@Override
581
	public NameRelationshipType readCsvLine(Class<NameRelationshipType> termClass, List<String> csvLine, TermType termType,
582
	        Map<UUID,DefinedTermBase> terms, boolean abbrevAsId) {
583
		NameRelationshipType result = super.readCsvLine(termClass, csvLine, termType, terms, abbrevAsId);
584
		String nomenclaturalStanding = csvLine.get(10).trim();  //not in use yet?
585
        result.setNomenclaturalStanding(NomenclaturalStanding.getByKey(nomenclaturalStanding));
586
        String nomenclaturalStandingInverse = csvLine.get(11).trim();  //not in use yet?
587
        result.setNomenclaturalStandingInverse(NomenclaturalStanding.getByKey(nomenclaturalStandingInverse));
588
        String kindOfString = csvLine.get(12).trim();  //not in use yet?
589
		if (isNotBlank(kindOfString)){
590
			UUID uuidKindOf = UUID.fromString(kindOfString);
591
			DefinedTermBase<?> kindOf = terms.get(uuidKindOf);
592
			result.setKindOf((NameRelationshipType)kindOf);
593
		}
594
		return result;
595
	}
596

    
597
}
(17-17/39)