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.io.berlinModel;
|
11
|
|
12
|
import java.sql.ResultSet;
|
13
|
import java.sql.SQLException;
|
14
|
import java.util.UUID;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
import eu.etaxonomy.cdm.common.ResultWrapper;
|
19
|
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
|
20
|
import eu.etaxonomy.cdm.model.common.Language;
|
21
|
import eu.etaxonomy.cdm.model.common.OrderedTermVocabulary;
|
22
|
import eu.etaxonomy.cdm.model.common.RelationshipBase;
|
23
|
import eu.etaxonomy.cdm.model.common.RelationshipTermBase;
|
24
|
import eu.etaxonomy.cdm.model.common.Representation;
|
25
|
import eu.etaxonomy.cdm.model.description.AbsenceTerm;
|
26
|
import eu.etaxonomy.cdm.model.description.Feature;
|
27
|
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
|
28
|
import eu.etaxonomy.cdm.model.description.PresenceTerm;
|
29
|
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
|
30
|
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
|
31
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
|
32
|
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
|
33
|
import eu.etaxonomy.cdm.model.name.Rank;
|
34
|
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
|
35
|
import eu.etaxonomy.cdm.model.reference.ISectionBase;
|
36
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
37
|
import eu.etaxonomy.cdm.model.reference.ReferenceType;
|
38
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
39
|
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
|
40
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
41
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
42
|
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
|
43
|
import eu.etaxonomy.cdm.strategy.exceptions.UnknownCdmTypeException;
|
44
|
|
45
|
/**
|
46
|
* @author a.mueller
|
47
|
* @created 20.03.2008
|
48
|
* @version 1.0
|
49
|
*/
|
50
|
public final class BerlinModelTransformer {
|
51
|
private static final Logger logger = Logger.getLogger(BerlinModelTransformer.class);
|
52
|
|
53
|
//ranks
|
54
|
public static UUID uuidRankCollSpecies = UUID.fromString("e14630ee-9446-4bb4-a7b7-4c3881bc5d94");
|
55
|
public static UUID uuidRankProles = UUID.fromString("8810d1ba-6a34-4ae3-a355-919ccd1cd1a5");
|
56
|
public static UUID uuidRankRace = UUID.fromString("196dee39-cfd8-4460-8bf0-88b83da27f62");
|
57
|
public static UUID uuidRankSublusus = UUID.fromString("1fafa596-a8e7-4e62-a378-3cc8cb3627ca");
|
58
|
|
59
|
//named areas
|
60
|
public static UUID euroMedUuid = UUID.fromString("9fe09988-58c0-4c06-8474-f660a0c50014");
|
61
|
|
62
|
public static UUID uuidEasternEuropeanRussia = UUID.fromString("3f013375-0e0a-40c3-8a14-84c0535fab40");
|
63
|
public static UUID uuidSerbiaMontenegro = UUID.fromString("8926dbe6-863e-47a9-98a0-7dc9ed2c57f7");
|
64
|
public static UUID uuidSerbia = UUID.fromString("4ffed197-3d7e-4cd9-8984-e64b8dee9512");
|
65
|
public static UUID uuidLebanonSyria = UUID.fromString("0c45f250-99da-4b19-aa89-c3e56cfdf103");
|
66
|
public static UUID uuidUssr = UUID.fromString("a512e00a-45f3-4be5-82fa-bba8d675696f");
|
67
|
public static UUID uuidSicilyMalta = UUID.fromString("424d81ee-d272-4ae8-9600-0a334049cd72");
|
68
|
|
69
|
public static UUID uuidDesertas = UUID.fromString("36f5e93e-34e8-45b5-a401-f0e0faad21cf");
|
70
|
public static UUID uuidMadeira = UUID.fromString("086e27ee-78ff-4236-aca9-9850850cd355");
|
71
|
public static UUID uuidPortoSanto = UUID.fromString("1f9ab6a0-a402-4dfe-8c5b-b1844eb4d8e5");
|
72
|
//azores
|
73
|
public static UUID uuidFlores = UUID.fromString("ef0067c2-8bbb-4e37-8462-97b03f51ba43");
|
74
|
public static UUID uuidCorvo = UUID.fromString("b1e6117c-2be1-43a3-9233-227dd90bdee9");
|
75
|
public static UUID uuidFaial = UUID.fromString("14f6dcdb-6524-4700-b80c-66424952ef2b");
|
76
|
public static UUID uuidGraciosa = UUID.fromString("05f93a7b-d813-4833-864f-eedbba747133");
|
77
|
public static UUID uuidSaoJorge = UUID.fromString("578e0ecd-b5e3-4c87-8ecc-0fc4c7e217d9");
|
78
|
public static UUID uuidSaoMiguel = UUID.fromString("0e2f6ad8-7afb-4f01-b134-4f71991e877a");
|
79
|
public static UUID uuidPico = UUID.fromString("98cc566f-4110-43d5-830f-68436a009f49");
|
80
|
public static UUID uuidSantaMaria = UUID.fromString("bd5e5d4a-22b7-41aa-8e58-1d1d73a9954d");
|
81
|
public static UUID uuidTerceira = UUID.fromString("6fc257c0-a131-41f0-b6c3-51ef9c4fa962");
|
82
|
//Canyry islands
|
83
|
public static UUID uuidGranCanaria = UUID.fromString("a0240c35-0e05-4157-8321-67ba8e31fdb9");
|
84
|
public static UUID uuidFuerteventura = UUID.fromString("549ce2c1-6d49-4bf3-b75d-cf3f4b5a1398");
|
85
|
public static UUID uuidGomera = UUID.fromString("895fab09-7478-4210-b42a-423d23c6f85e");
|
86
|
public static UUID uuidHierro = UUID.fromString("d137b6a5-31bc-418c-9403-f042017dc04b");
|
87
|
public static UUID uuidLanzaroteWithGraciosa = UUID.fromString("c9b08dc1-f301-4d9d-b447-b8744602c776");
|
88
|
public static UUID uuidLaPalma = UUID.fromString("fdb3f2b2-f154-4f04-9f31-240a47a0e780");
|
89
|
public static UUID uuidTenerife = UUID.fromString("73658c7e-a568-465e-bd84-4554fc93ca56");
|
90
|
//Baleares
|
91
|
public static UUID uuidIbizaWithFormentera = UUID.fromString("1cda2a33-3469-49d5-8e77-cb5451110519");
|
92
|
public static UUID uuidMallorca = UUID.fromString("a10cba04-b4b5-4a4b-b69a-fcd4b3916fec");
|
93
|
public static UUID uuidMenorca = UUID.fromString("9f6ede48-27f8-4270-bf4e-c97eaa86aab7");
|
94
|
|
95
|
//russia
|
96
|
public static UUID uuidRussiaNorthern = UUID.fromString("c23bc1c9-a775-4426-b883-07d4d7d47eed");
|
97
|
public static UUID uuidRussiaBaltic = UUID.fromString("579dad44-9439-4b19-8716-ab90d8f27944");
|
98
|
public static UUID uuidRussiaCentral = UUID.fromString("8bbc8c6a-2ef2-4024-ad51-66fe34c70092");
|
99
|
public static UUID uuidRussiaSouthWest = UUID.fromString("daa5c207-5567-4690-8742-5e4d153b6a64");
|
100
|
public static UUID uuidRussiaSouthEast = UUID.fromString("e8516598-b529-489e-9ee8-63bbbd295c1b");
|
101
|
public static UUID uuidEastAegeanIslands = UUID.fromString("1c429593-c493-46e6-971a-0d70be690da8");
|
102
|
public static UUID uuidTurkishEastAegeanIslands = UUID.fromString("ba35dba3-ac70-41ae-81c2-2070943f44f2");
|
103
|
public static UUID uuidBalticStates = UUID.fromString("bf9d64f6-3183-4fa5-8e90-73090e7a2282");
|
104
|
public static final UUID uuidTurkey = UUID.fromString("d344ee2c-14c8-438d-b03d-11538edb1268");
|
105
|
public static final UUID uuidCaucasia = UUID.fromString("ebfd3fd1-3859-4e5e-95c7-f66010599d7e");
|
106
|
|
107
|
//language areas
|
108
|
public static final UUID uuidUkraineAndCrimea = UUID.fromString("99d4d1c2-09f6-416e-86a3-bdde5cae52af");
|
109
|
public static final UUID uuidAzerbaijanNakhichevan = UUID.fromString("232fbef0-9f4a-4cab-8ac1-e14c717e9de6");
|
110
|
|
111
|
//Marker Types
|
112
|
public static final UUID uuidMisappliedCommonName = UUID.fromString("25f5cfc3-16ab-4aba-a008-0db0f2cf7f9d");
|
113
|
|
114
|
//Extension Types
|
115
|
public static final UUID uuidSpeciesExpertName = UUID.fromString("2e8153d2-7412-49e4-87e1-5c38f4c5153a");
|
116
|
public static final UUID uuidExpertName = UUID.fromString("24becb79-a90c-47d3-be35-efc87bb48fd3");
|
117
|
|
118
|
public static final UUID DETAIL_EXT_UUID = UUID.fromString("c3959b4f-d876-4b7a-a739-9260f4cafd1c");
|
119
|
public static final UUID ID_IN_SOURCE_EXT_UUID = UUID.fromString("23dac094-e793-40a4-bad9-649fc4fcfd44");
|
120
|
|
121
|
//languages
|
122
|
public static final UUID uuidLangMajorcan = UUID.fromString("82d696d7-cb4e-49de-ac89-63a0e12ca766");
|
123
|
|
124
|
//REFERENCES
|
125
|
public static int REF_ARTICLE = 1;
|
126
|
public static int REF_PART_OF_OTHER_TITLE = 2;
|
127
|
public static int REF_BOOK = 3;
|
128
|
public static int REF_DATABASE = 4;
|
129
|
public static int REF_INFORMAL = 5;
|
130
|
public static int REF_NOT_APPLICABLE = 6;
|
131
|
public static int REF_WEBSITE = 7;
|
132
|
public static int REF_CD = 8;
|
133
|
public static int REF_JOURNAL = 9;
|
134
|
public static int REF_UNKNOWN = 10;
|
135
|
public static int REF_PRINT_SERIES = 55;
|
136
|
public static int REF_CONFERENCE_PROCEEDINGS = 56;
|
137
|
public static int REF_JOURNAL_VOLUME = 57;
|
138
|
|
139
|
|
140
|
|
141
|
//NameStatus
|
142
|
public static int NAME_ST_NOM_INVAL = 1;
|
143
|
public static int NAME_ST_NOM_ILLEG = 2;
|
144
|
public static int NAME_ST_NOM_NUD = 3;
|
145
|
public static int NAME_ST_NOM_REJ = 4;
|
146
|
public static int NAME_ST_NOM_REJ_PROP = 5;
|
147
|
public static int NAME_ST_NOM_UTIQUE_REJ = 6;
|
148
|
public static int NAME_ST_NOM_UTIQUE_REJ_PROP = 7;
|
149
|
public static int NAME_ST_NOM_CONS = 8;
|
150
|
public static int NAME_ST_NOM_CONS_PROP = 9;
|
151
|
public static int NAME_ST_ORTH_CONS = 10;
|
152
|
public static int NAME_ST_ORTH_CONS_PROP = 11;
|
153
|
public static int NAME_ST_NOM_SUPERFL = 12;
|
154
|
public static int NAME_ST_NOM_AMBIG = 13;
|
155
|
public static int NAME_ST_NOM_PROVIS = 14;
|
156
|
public static int NAME_ST_NOM_DUB = 15;
|
157
|
public static int NAME_ST_NOM_NOV = 16;
|
158
|
public static int NAME_ST_NOM_CONFUS = 17;
|
159
|
public static int NAME_ST_NOM_ALTERN = 18;
|
160
|
public static int NAME_ST_COMB_INVAL = 19;
|
161
|
|
162
|
|
163
|
//NameRelationShip
|
164
|
public static int NAME_REL_IS_BASIONYM_FOR = 1;
|
165
|
public static int NAME_REL_IS_LATER_HOMONYM_OF = 2;
|
166
|
public static int NAME_REL_IS_REPLACED_SYNONYM_FOR = 3;
|
167
|
public static int NAME_REL_IS_VALIDATION_OF = 4;
|
168
|
public static int NAME_REL_IS_LATER_VALIDATION_OF = 5;
|
169
|
public static int NAME_REL_IS_TYPE_OF = 6;
|
170
|
public static int NAME_REL_IS_CONSERVED_TYPE_OF =7;
|
171
|
public static int NAME_REL_IS_REJECTED_TYPE_OF = 8;
|
172
|
public static int NAME_REL_IS_FIRST_PARENT_OF = 9;
|
173
|
public static int NAME_REL_IS_SECOND_PARENT_OF = 10;
|
174
|
public static int NAME_REL_IS_FEMALE_PARENT_OF = 11;
|
175
|
public static int NAME_REL_IS_MALE_PARENT_OF = 12;
|
176
|
public static int NAME_REL_IS_CONSERVED_AGAINST =13;
|
177
|
public static int NAME_REL_IS_REJECTED_IN_FAVOUR_OF = 14;
|
178
|
public static int NAME_REL_IS_TREATED_AS_LATER_HOMONYM_OF = 15;
|
179
|
public static int NAME_REL_IS_ORTHOGRAPHIC_VARIANT_OF = 16;
|
180
|
public static int NAME_REL_IS_ALTERNATIVE_NAME_FOR = 17;
|
181
|
public static int NAME_REL_HAS_SAME_TYPE_AS = 18;
|
182
|
public static int NAME_REL_IS_LECTOTYPE_OF = 61;
|
183
|
public static int NAME_REL_TYPE_NOT_DESIGNATED = 62;
|
184
|
|
185
|
//NameFacts
|
186
|
public static String NAME_FACT_PROTOLOGUE = "Protologue";
|
187
|
public static String NAME_FACT_ALSO_PUBLISHED_IN = "Also published in";
|
188
|
public static String NAME_FACT_BIBLIOGRAPHY = "Bibliography";
|
189
|
|
190
|
//TaxonRelationShip
|
191
|
public static int TAX_REL_IS_INCLUDED_IN = 1;
|
192
|
public static int TAX_REL_IS_SYNONYM_OF = 2;
|
193
|
public static int TAX_REL_IS_MISAPPLIED_NAME_OF = 3;
|
194
|
public static int TAX_REL_IS_PROPARTE_SYN_OF = 4;
|
195
|
public static int TAX_REL_IS_PARTIAL_SYN_OF = 5;
|
196
|
public static int TAX_REL_IS_HETEROTYPIC_SYNONYM_OF = 6;
|
197
|
public static int TAX_REL_IS_HOMOTYPIC_SYNONYM_OF = 7;
|
198
|
public static int TAX_REL_IS_PROPARTE_HOMOTYPIC_SYNONYM_OF = 101;
|
199
|
public static int TAX_REL_IS_PROPARTE_HETEROTYPIC_SYNONYM_OF = 102;
|
200
|
public static int TAX_REL_IS_PARTIAL_HOMOTYPIC_SYNONYM_OF = 103;
|
201
|
public static int TAX_REL_IS_PARTIAL_HETEROTYPIC_SYNONYM_OF = 104;
|
202
|
|
203
|
|
204
|
|
205
|
//TaxonStatus
|
206
|
public static int T_STATUS_ACCEPTED = 1;
|
207
|
public static int T_STATUS_SYNONYM = 2;
|
208
|
public static int T_STATUS_PARTIAL_SYN = 3;
|
209
|
public static int T_STATUS_PRO_PARTE_SYN = 4;
|
210
|
public static int T_STATUS_UNRESOLVED = 5;
|
211
|
public static int T_STATUS_ORPHANED = 6;
|
212
|
|
213
|
|
214
|
//Facts
|
215
|
public static int FACT_DESCRIPTION = 1;
|
216
|
public static int FACT_GROWTH_FORM = 2;
|
217
|
public static int FACT_HARDINESS = 3;
|
218
|
public static int FACT_ECOLOGY = 4;
|
219
|
public static int FACT_PHENOLOGY = 5;
|
220
|
public static int FACT_KARYOLOGY = 6;
|
221
|
public static int FACT_ILLUSTRATION = 7;
|
222
|
public static int FACT_IDENTIFICATION = 8;
|
223
|
public static int FACT_OBSERVATION = 9;
|
224
|
public static int FACT_DISTRIBUTION_EM = 10;
|
225
|
public static int FACT_DISTRIBUTION_WORLD = 11;
|
226
|
//E+M
|
227
|
public static final UUID uuidFeatureMaps = UUID.fromString("8367730e-f3c3-4361-8360-a2057e4295ed");
|
228
|
public static final UUID uuidFeatureConservationStatus = UUID.fromString("a32f33cd-1966-4a22-986c-94c5e688bbd1");
|
229
|
public static final UUID uuidFeatureUse = UUID.fromString("199bbbd8-2db6-4335-b454-2e92ae02b699");
|
230
|
public static final UUID uuidFeatureComments = UUID.fromString("31cc2b92-5cad-44e9-b50f-b8af591a527c");
|
231
|
public static final UUID uuidFeatureDistrEM = UUID.fromString("a5ba7e7f-ca7f-4f50-afc7-73e76b3231d4");
|
232
|
public static final UUID uuidFeatureDistrWorld = UUID.fromString("e4e24080-7017-47e6-924e-d2560fa68fb8");
|
233
|
public static final UUID uuidFeatureEditorBrackets = UUID.fromString("b3b5bc1a-7ba8-4a39-9c0d-63ba599eb5d8");
|
234
|
public static final UUID uuidFeatureEditorParenthesis = UUID.fromString("6ee10a2e-ff02-4cf4-a520-89630edc5b44");
|
235
|
public static final UUID uuidFeatureInedited = UUID.fromString("c93e2968-bc52-4165-9755-ce37611faf01");
|
236
|
public static final UUID uuidFeatureCommentsEditing = UUID.fromString("7a155021-158a-48bb-81d0-9a72b718e2de");
|
237
|
|
238
|
|
239
|
|
240
|
public static UUID uuidNomStatusCombIned = UUID.fromString("dde8a2e7-bf9e-42ec-b186-d5bde9c9c128");
|
241
|
public static UUID uuidNomStatusSpNovIned = UUID.fromString("1a359ca1-9364-43bc-93e4-834bdcd52b72");
|
242
|
public static UUID uuidNomStatusNomOrthCons = UUID.fromString("0f838183-ffa0-4014-928e-0e3a27eb3918");
|
243
|
|
244
|
static NomenclaturalStatusType nomStatusCombIned;
|
245
|
static NomenclaturalStatusType nomStatusSpNovIned;
|
246
|
static NomenclaturalStatusType nomStatusNomOrthCons;
|
247
|
|
248
|
public static NomenclaturalStatusType nomStatusTypeAbbrev2NewNomStatusType(String nomStatus){
|
249
|
NomenclaturalStatusType result = null;
|
250
|
if (nomStatus == null){
|
251
|
return null;
|
252
|
}else if (nomStatus.equalsIgnoreCase("comb. ined.")){
|
253
|
if (nomStatusCombIned == null){
|
254
|
nomStatusCombIned = new NomenclaturalStatusType();
|
255
|
Representation representation = Representation.NewInstance("comb. ined.", "comb. ined.", "comb. ined.", Language.LATIN());
|
256
|
nomStatusCombIned.addRepresentation(representation);
|
257
|
nomStatusCombIned.setUuid(uuidNomStatusCombIned);
|
258
|
NomenclaturalStatusType.ALTERNATIVE().getVocabulary().addTerm(nomStatusCombIned);
|
259
|
}
|
260
|
result = nomStatusCombIned;
|
261
|
}else if (nomStatus.equalsIgnoreCase("sp. nov. ined.")){
|
262
|
if (nomStatusSpNovIned == null){
|
263
|
nomStatusSpNovIned = new NomenclaturalStatusType();
|
264
|
Representation representation = Representation.NewInstance("sp. nov. ined.", "sp. nov. ined.", "sp. nov. ined.", Language.LATIN());
|
265
|
nomStatusSpNovIned.addRepresentation(representation);
|
266
|
nomStatusSpNovIned.setUuid(uuidNomStatusSpNovIned);
|
267
|
NomenclaturalStatusType.ALTERNATIVE().getVocabulary().addTerm(nomStatusSpNovIned);
|
268
|
}
|
269
|
result = nomStatusSpNovIned;
|
270
|
}else if (nomStatus.equalsIgnoreCase("nom. & orth. cons.")){
|
271
|
if (nomStatusNomOrthCons == null){
|
272
|
nomStatusNomOrthCons = new NomenclaturalStatusType();
|
273
|
Representation representation = Representation.NewInstance("nom. & orth. cons.", "nom. & orth. cons.", "nom. & orth. cons.", Language.LATIN());
|
274
|
nomStatusNomOrthCons.addRepresentation(representation);
|
275
|
nomStatusNomOrthCons.setUuid(uuidNomStatusNomOrthCons);
|
276
|
NomenclaturalStatusType.ALTERNATIVE().getVocabulary().addTerm(nomStatusNomOrthCons);
|
277
|
}
|
278
|
result = nomStatusNomOrthCons;
|
279
|
}
|
280
|
return result;
|
281
|
}
|
282
|
|
283
|
|
284
|
public static NomenclaturalStatus nomStatusFkToNomStatus(int nomStatusFk, String nomStatusLabel) throws UnknownCdmTypeException{
|
285
|
if (nomStatusFk == NAME_ST_NOM_INVAL){
|
286
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.INVALID());
|
287
|
}else if (nomStatusFk == NAME_ST_NOM_ILLEG){
|
288
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ILLEGITIMATE());
|
289
|
}else if (nomStatusFk == NAME_ST_NOM_NUD){
|
290
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.NUDUM());
|
291
|
}else if (nomStatusFk == NAME_ST_NOM_REJ){
|
292
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.REJECTED());
|
293
|
}else if (nomStatusFk == NAME_ST_NOM_REJ_PROP){
|
294
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.REJECTED_PROP());
|
295
|
}else if (nomStatusFk == NAME_ST_NOM_UTIQUE_REJ){
|
296
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.UTIQUE_REJECTED());
|
297
|
}else if (nomStatusFk == NAME_ST_NOM_UTIQUE_REJ_PROP){
|
298
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.UTIQUE_REJECTED_PROP());
|
299
|
}else if (nomStatusFk == NAME_ST_NOM_CONS){
|
300
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.CONSERVED());
|
301
|
}else if (nomStatusFk == NAME_ST_NOM_CONS_PROP){
|
302
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.CONSERVED_PROP());
|
303
|
}else if (nomStatusFk == NAME_ST_ORTH_CONS){
|
304
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED());
|
305
|
}else if (nomStatusFk == NAME_ST_ORTH_CONS_PROP){
|
306
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED_PROP());
|
307
|
}else if (nomStatusFk == NAME_ST_NOM_SUPERFL){
|
308
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.SUPERFLUOUS());
|
309
|
}else if (nomStatusFk == NAME_ST_NOM_AMBIG){
|
310
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.AMBIGUOUS());
|
311
|
}else if (nomStatusFk == NAME_ST_NOM_PROVIS){
|
312
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.PROVISIONAL());
|
313
|
}else if (nomStatusFk == NAME_ST_NOM_DUB){
|
314
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.DOUBTFUL());
|
315
|
}else if (nomStatusFk == NAME_ST_NOM_NOV){
|
316
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.NOVUM());
|
317
|
}else if (nomStatusFk == NAME_ST_NOM_CONFUS){
|
318
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.CONFUSUM());
|
319
|
}else if (nomStatusFk == NAME_ST_NOM_ALTERN){
|
320
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ALTERNATIVE());
|
321
|
}else if (nomStatusFk == NAME_ST_COMB_INVAL){
|
322
|
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.COMBINATION_INVALID());
|
323
|
}else {
|
324
|
NomenclaturalStatusType statusType = nomStatusTypeAbbrev2NewNomStatusType(nomStatusLabel);
|
325
|
NomenclaturalStatus result = NomenclaturalStatus.NewInstance(statusType);
|
326
|
if (result != null){
|
327
|
return result;
|
328
|
}
|
329
|
throw new UnknownCdmTypeException("Unknown NomenclaturalStatus (id=" + Integer.valueOf(nomStatusFk).toString() + ")");
|
330
|
}
|
331
|
}
|
332
|
|
333
|
|
334
|
//TypeDesignation
|
335
|
public static SpecimenTypeDesignationStatus typeStatusId2TypeStatus (int typeStatusId) throws UnknownCdmTypeException{
|
336
|
switch (typeStatusId){
|
337
|
case 0: return null;
|
338
|
case 1: return SpecimenTypeDesignationStatus.HOLOTYPE();
|
339
|
case 2: return SpecimenTypeDesignationStatus.LECTOTYPE();
|
340
|
case 3: return SpecimenTypeDesignationStatus.NEOTYPE();
|
341
|
case 4: return SpecimenTypeDesignationStatus.EPITYPE();
|
342
|
case 5: return SpecimenTypeDesignationStatus.ISOLECTOTYPE();
|
343
|
case 6: return SpecimenTypeDesignationStatus.ISONEOTYPE();
|
344
|
case 7: return SpecimenTypeDesignationStatus.ISOTYPE();
|
345
|
case 8: return SpecimenTypeDesignationStatus.PARANEOTYPE();
|
346
|
case 9: return SpecimenTypeDesignationStatus.PARATYPE();
|
347
|
case 10: return SpecimenTypeDesignationStatus.SECOND_STEP_LECTOTYPE();
|
348
|
case 11: return SpecimenTypeDesignationStatus.SECOND_STEP_NEOTYPE();
|
349
|
case 12: return SpecimenTypeDesignationStatus.SYNTYPE();
|
350
|
case 21: return SpecimenTypeDesignationStatus.ICONOTYPE();
|
351
|
case 22: return SpecimenTypeDesignationStatus.PHOTOTYPE();
|
352
|
default: {
|
353
|
throw new UnknownCdmTypeException("Unknown TypeDesignationStatus (id=" + Integer.valueOf(typeStatusId).toString() + ")");
|
354
|
}
|
355
|
}
|
356
|
}
|
357
|
|
358
|
//TypeDesignation
|
359
|
public static TaxonRelationshipType taxonRelId2TaxonRelType (int relTaxonTypeId, ResultWrapper<Boolean> isInverse) throws UnknownCdmTypeException{
|
360
|
isInverse.setValue(false);
|
361
|
switch (relTaxonTypeId){
|
362
|
case 0: return null;
|
363
|
case 11: return TaxonRelationshipType.CONGRUENT_TO();
|
364
|
case 12: isInverse.setValue(true); return TaxonRelationshipType.INCLUDES();
|
365
|
case 13: isInverse.setValue(true); return TaxonRelationshipType.CONGRUENT_OR_INCLUDES();
|
366
|
case 14: return TaxonRelationshipType.INCLUDES();
|
367
|
case 15: return TaxonRelationshipType.CONGRUENT_OR_INCLUDES();
|
368
|
case 16: return TaxonRelationshipType.INCLUDED_OR_INCLUDES();
|
369
|
case 17: return TaxonRelationshipType.CONGRUENT_OR_INCLUDED_OR_INCLUDES();
|
370
|
case 18: return TaxonRelationshipType.OVERLAPS();
|
371
|
case 19: return TaxonRelationshipType.CONGRUENT_OR_OVERLAPS();
|
372
|
case 20: isInverse.setValue(true); return TaxonRelationshipType.INCLUDES_OR_OVERLAPS();
|
373
|
case 21: isInverse.setValue(true); return TaxonRelationshipType.CONGRUENT_OR_INCLUDES_OR_OVERLAPS();
|
374
|
case 22: return TaxonRelationshipType.INCLUDES_OR_OVERLAPS();
|
375
|
case 23: return TaxonRelationshipType.CONGRUENT_OR_INCLUDES_OR_OVERLAPS();
|
376
|
case 24: return TaxonRelationshipType.INCLUDED_OR_INCLUDES_OR_OVERLAPS();
|
377
|
|
378
|
case 26: return TaxonRelationshipType.OVERLAPS();
|
379
|
//TODO other relationshipTypes
|
380
|
|
381
|
case 40: return TaxonRelationshipType.NOT_CONGRUENT_TO();
|
382
|
|
383
|
//FIXME doubtful
|
384
|
case 43: return TaxonRelationshipType.CONGRUENT_TO();
|
385
|
default: {
|
386
|
throw new UnknownCdmTypeException("Unknown TypeDesignationStatus (id=" + Integer.valueOf(relTaxonTypeId).toString() + ")");
|
387
|
}
|
388
|
}
|
389
|
}
|
390
|
|
391
|
//TypeDesignation
|
392
|
public static HybridRelationshipType relNameId2HybridRel (int relNameId) throws UnknownCdmTypeException{
|
393
|
switch (relNameId){
|
394
|
case 0: return null;
|
395
|
case 9: return HybridRelationshipType.FIRST_PARENT();
|
396
|
case 10: return HybridRelationshipType.SECOND_PARENT();
|
397
|
case 11: return HybridRelationshipType.FEMALE_PARENT();
|
398
|
case 12: return HybridRelationshipType.MALE_PARENT();
|
399
|
default: {
|
400
|
throw new UnknownCdmTypeException("Unknown HybridRelationshipType (id=" + Integer.valueOf(relNameId).toString() + ")");
|
401
|
}
|
402
|
}
|
403
|
}
|
404
|
|
405
|
//OccStatus
|
406
|
public static PresenceAbsenceTermBase<?> occStatus2PresenceAbsence (int occStatusId) throws UnknownCdmTypeException{
|
407
|
switch (occStatusId){
|
408
|
case 0: return null;
|
409
|
case 110: return AbsenceTerm.CULTIVATED_REPORTED_IN_ERROR();
|
410
|
case 120: return PresenceTerm.CULTIVATED();
|
411
|
case 210: return AbsenceTerm.INTRODUCED_REPORTED_IN_ERROR();
|
412
|
case 220: return PresenceTerm.INTRODUCED_PRESENCE_QUESTIONABLE();
|
413
|
case 230: return AbsenceTerm.INTRODUCED_FORMERLY_INTRODUCED();
|
414
|
case 240: return PresenceTerm.INTRODUCED_DOUBTFULLY_INTRODUCED();
|
415
|
case 250: return PresenceTerm.INTRODUCED();
|
416
|
case 260: return PresenceTerm.INTRODUCED_UNCERTAIN_DEGREE_OF_NATURALISATION();
|
417
|
case 270: return PresenceTerm.INTRODUCED_ADVENTITIOUS();
|
418
|
case 280: return PresenceTerm.INTRODUCED_NATURALIZED();
|
419
|
case 310: return AbsenceTerm.NATIVE_REPORTED_IN_ERROR();
|
420
|
case 320: return PresenceTerm.NATIVE_PRESENCE_QUESTIONABLE();
|
421
|
case 330: return AbsenceTerm.NATIVE_FORMERLY_NATIVE();
|
422
|
case 340: return PresenceTerm.NATIVE_DOUBTFULLY_NATIVE();
|
423
|
case 350: return PresenceTerm.NATIVE();
|
424
|
case 999: {
|
425
|
logger.info("endemic for EM can not be transformed in legal status. Used 'PRESENT' instead");
|
426
|
//TODO preliminary
|
427
|
return PresenceTerm.PRESENT();
|
428
|
}
|
429
|
default: {
|
430
|
throw new UnknownCdmTypeException("Unknown occurrence status (id=" + Integer.valueOf(occStatusId).toString() + ")");
|
431
|
}
|
432
|
}
|
433
|
}
|
434
|
|
435
|
|
436
|
//FactCategory
|
437
|
public static Feature factCategory2Feature (int factCategoryId) throws UnknownCdmTypeException{
|
438
|
switch (factCategoryId){
|
439
|
case 0: return null;
|
440
|
case 1: return Feature.DESCRIPTION();
|
441
|
case 4: return Feature.ECOLOGY();
|
442
|
case 5: return Feature.PHENOLOGY();
|
443
|
case 12: return Feature.COMMON_NAME();
|
444
|
case 13: return Feature.OCCURRENCE();
|
445
|
case 99: return Feature.CITATION();
|
446
|
default: {
|
447
|
throw new UnknownCdmTypeException("Unknown FactCategory (id=" + Integer.valueOf(factCategoryId).toString() + ")");
|
448
|
}
|
449
|
}
|
450
|
}
|
451
|
|
452
|
public static UUID getFeatureUuid(String key) throws UndefinedTransformerMethodException {
|
453
|
if (key == null){
|
454
|
return null;
|
455
|
}else if (key.equalsIgnoreCase("14-Maps")){ return uuidFeatureMaps;
|
456
|
}else if (key.equalsIgnoreCase("301-Conservation Status")){ return uuidFeatureConservationStatus;
|
457
|
}else if (key.equalsIgnoreCase("302-Use")){ return uuidFeatureUse;
|
458
|
}else if (key.equalsIgnoreCase("303-Comments")){ return uuidFeatureComments;
|
459
|
|
460
|
}else if (key.equalsIgnoreCase("10-general distribution (Euro+Med)")){ return uuidFeatureDistrEM;
|
461
|
}else if (key.equalsIgnoreCase("11-general distribution (world)")){ return uuidFeatureDistrWorld;
|
462
|
}else if (key.equalsIgnoreCase("250-Editor_Brackets")){ return uuidFeatureEditorBrackets;
|
463
|
}else if (key.equalsIgnoreCase("251-Editor_Parenthesis")){ return uuidFeatureEditorParenthesis;
|
464
|
}else if (key.equalsIgnoreCase("252-Inedited")){ return uuidFeatureInedited;
|
465
|
}else if (key.equalsIgnoreCase("253-Comments on editing process")){ return uuidFeatureCommentsEditing;
|
466
|
|
467
|
}else{
|
468
|
return null;
|
469
|
}
|
470
|
}
|
471
|
|
472
|
|
473
|
static Rank collSpeciesRank;
|
474
|
/**
|
475
|
* @param i
|
476
|
* @return
|
477
|
*/
|
478
|
private static Rank rankId2NewRank(Integer rankId, boolean switchRank) {
|
479
|
Rank result = null;
|
480
|
if (rankId == null){
|
481
|
return null;
|
482
|
}else if (rankId == 57){
|
483
|
|
484
|
if (collSpeciesRank == null){
|
485
|
collSpeciesRank = new Rank();
|
486
|
Representation representation = Representation.NewInstance("Collective species", "Coll. species", "coll.", Language.ENGLISH());
|
487
|
collSpeciesRank.addRepresentation(representation);
|
488
|
collSpeciesRank.setUuid(uuidRankCollSpecies);
|
489
|
OrderedTermVocabulary<Rank> voc = (OrderedTermVocabulary<Rank>)Rank.SPECIES().getVocabulary();
|
490
|
voc.addTermBelow(collSpeciesRank, Rank.SPECIESGROUP());
|
491
|
}
|
492
|
result = collSpeciesRank;
|
493
|
}
|
494
|
return result;
|
495
|
}
|
496
|
|
497
|
|
498
|
public static Rank rankId2Rank (ResultSet rs, boolean useUnknown, boolean switchSpeciesGroup) throws UnknownCdmTypeException{
|
499
|
Rank result;
|
500
|
try {
|
501
|
int rankId = rs.getInt("rankFk");
|
502
|
|
503
|
String abbrev = rs.getString("rankAbbrev");
|
504
|
String rankName = rs.getString("rank");
|
505
|
if (logger.isDebugEnabled()){logger.debug(rankId);}
|
506
|
if (logger.isDebugEnabled()){logger.debug(abbrev);}
|
507
|
if (logger.isDebugEnabled()){logger.debug(rankName);}
|
508
|
|
509
|
if (switchSpeciesGroup){
|
510
|
if (rankId == 59){
|
511
|
rankId = 57;
|
512
|
}else if (rankId == 57){
|
513
|
rankId = 59;
|
514
|
}
|
515
|
}
|
516
|
try {
|
517
|
result = Rank.getRankByNameOrAbbreviation(abbrev);
|
518
|
} catch (UnknownCdmTypeException e) {
|
519
|
try {
|
520
|
result = Rank.getRankByNameOrAbbreviation(rankName);
|
521
|
} catch (UnknownCdmTypeException e1) {
|
522
|
switch (rankId){
|
523
|
case 0: return null;
|
524
|
case 1: return Rank.KINGDOM();
|
525
|
case 3: return Rank.SUBKINGDOM();
|
526
|
case 5: return Rank.PHYLUM();
|
527
|
case 7: return Rank.SUBPHYLUM();
|
528
|
case 8: return Rank.DIVISION();
|
529
|
case 9: return Rank.SUBDIVISION();
|
530
|
case 10: return Rank.CLASS();
|
531
|
case 13: return Rank.SUBCLASS();
|
532
|
case 16: return Rank.SUPERORDER();
|
533
|
case 18: return Rank.ORDER();
|
534
|
case 19: return Rank.SUBORDER();
|
535
|
case 20: return Rank.FAMILY();
|
536
|
case 25: return Rank.SUBFAMILY();
|
537
|
case 30: return Rank.TRIBE();
|
538
|
case 35: return Rank.SUBTRIBE();
|
539
|
case 40: return Rank.GENUS();
|
540
|
case 42: return Rank.SUBGENUS();
|
541
|
case 45: return Rank.SECTION_BOTANY();
|
542
|
case 47: return Rank.SUBSECTION_BOTANY();
|
543
|
case 50: return Rank.SERIES();
|
544
|
case 52: return Rank.SUBSERIES();
|
545
|
case 58: return Rank.SPECIESAGGREGATE();
|
546
|
case 59: return Rank.SPECIESGROUP();
|
547
|
case 60: return Rank.SPECIES();
|
548
|
case 61: return Rank.GREX();
|
549
|
case 65: return Rank.SUBSPECIES();
|
550
|
case 68: return Rank.CONVAR();
|
551
|
case 70: return Rank.VARIETY();
|
552
|
case 73: return Rank.SUBVARIETY();
|
553
|
case 80: return Rank.FORM();
|
554
|
case 82: return Rank.SUBFORM();
|
555
|
case 84: return Rank.SPECIALFORM();
|
556
|
case 98: return Rank.INFRAGENERICTAXON();
|
557
|
case 99: return Rank.INFRASPECIFICTAXON();
|
558
|
|
559
|
case 750: return Rank.SUPERCLASS();
|
560
|
case 780: return Rank.INFRACLASS();
|
561
|
case 820: return Rank.INFRAORDER();
|
562
|
|
563
|
case 830: return Rank.SUPERFAMILY();
|
564
|
|
565
|
default: {
|
566
|
Rank rank = rankId2NewRank(57, switchSpeciesGroup);
|
567
|
if (rank != null){
|
568
|
return rank;
|
569
|
}
|
570
|
if (useUnknown){
|
571
|
logger.error("Rank unknown: " + rankId + ". Created UNKNOWN_RANK");
|
572
|
return Rank.UNKNOWN_RANK();
|
573
|
}
|
574
|
throw new UnknownCdmTypeException("Unknown Rank id" + Integer.valueOf(rankId).toString());
|
575
|
}
|
576
|
}
|
577
|
}
|
578
|
}
|
579
|
return result;
|
580
|
} catch (SQLException e) {
|
581
|
e.printStackTrace();
|
582
|
logger.warn("Exception occurred. Created UNKNOWN_RANK instead");
|
583
|
return Rank.UNKNOWN_RANK();
|
584
|
}
|
585
|
}
|
586
|
|
587
|
|
588
|
public static Integer rank2RankId (Rank rank){
|
589
|
if (rank == null){
|
590
|
return null;
|
591
|
}
|
592
|
else if (rank.equals(Rank.KINGDOM())){ return 1;}
|
593
|
else if (rank.equals(Rank.SUBKINGDOM())){ return 3;}
|
594
|
else if (rank.equals(Rank.PHYLUM())){ return 5;}
|
595
|
else if (rank.equals(Rank.SUBPHYLUM())){ return 7;}
|
596
|
else if (rank.equals(Rank.DIVISION())){ return 8;}
|
597
|
else if (rank.equals(Rank.SUBDIVISION())){ return 9;}
|
598
|
|
599
|
else if (rank.equals(Rank.CLASS())){ return 10;}
|
600
|
else if (rank.equals(Rank.SUBCLASS())){ return 13;}
|
601
|
else if (rank.equals(Rank.SUPERORDER())){ return 16;}
|
602
|
else if (rank.equals(Rank.ORDER())){ return 18;}
|
603
|
else if (rank.equals(Rank.SUBORDER())){ return 19;}
|
604
|
else if (rank.equals(Rank.FAMILY())){ return 20;}
|
605
|
else if (rank.equals(Rank.SUBFAMILY())){ return 25;}
|
606
|
else if (rank.equals(Rank.TRIBE())){ return 30;}
|
607
|
else if (rank.equals(Rank.SUBTRIBE())){ return 35;}
|
608
|
else if (rank.equals(Rank.GENUS())){ return 40;}
|
609
|
else if (rank.equals(Rank.SUBGENUS())){ return 42;}
|
610
|
else if (rank.equals(Rank.SECTION_BOTANY())){ return 45;}
|
611
|
else if (rank.equals(Rank.SUBSECTION_BOTANY())){ return 47;}
|
612
|
else if (rank.equals(Rank.SERIES())){ return 50;}
|
613
|
else if (rank.equals(Rank.SUBSERIES())){ return 52;}
|
614
|
else if (rank.equals(Rank.SPECIESAGGREGATE())){ return 58;}
|
615
|
//TODO
|
616
|
// else if (rank.equals(Rank.XXX())){ return 59;}
|
617
|
else if (rank.equals(Rank.SPECIES())){ return 60;}
|
618
|
else if (rank.equals(Rank.SUBSPECIES())){ return 65;}
|
619
|
else if (rank.equals(Rank.CONVAR())){ return 68;}
|
620
|
else if (rank.equals(Rank.VARIETY())){ return 70;}
|
621
|
else if (rank.equals(Rank.SUBVARIETY())){ return 73;}
|
622
|
else if (rank.equals(Rank.FORM())){ return 80;}
|
623
|
else if (rank.equals(Rank.SUBFORM())){ return 82;}
|
624
|
else if (rank.equals(Rank.SPECIALFORM())){ return 84;}
|
625
|
else if (rank.equals(Rank.INFRAGENERICTAXON())){ return 98;}
|
626
|
else if (rank.equals(Rank.INFRASPECIFICTAXON())){ return 99;}
|
627
|
|
628
|
else if (rank.equals(Rank.SUPERCLASS())){ return 750;}
|
629
|
else if (rank.equals(Rank.INFRACLASS())){ return 780;}
|
630
|
else if (rank.equals(Rank.INFRAORDER())){ return 820;}
|
631
|
else if (rank.equals(Rank.SUPERFAMILY())){ return 830;}
|
632
|
|
633
|
else {
|
634
|
//TODO Exception
|
635
|
logger.warn("Rank not yet supported in Berlin Model: "+ rank.getLabel());
|
636
|
return null;
|
637
|
}
|
638
|
}
|
639
|
|
640
|
public static Integer textData2FactCategoryFk (Feature feature){
|
641
|
if (feature == null){return null;}
|
642
|
if (feature.equals(Feature.DESCRIPTION())){
|
643
|
return 1;
|
644
|
}else if (feature.equals(Feature.ECOLOGY())){
|
645
|
return 4;
|
646
|
}else if (feature.equals(Feature.PHENOLOGY())){
|
647
|
return 5;
|
648
|
}else if (feature.equals(Feature.COMMON_NAME())){
|
649
|
return 12;
|
650
|
}else if (feature.equals(Feature.OCCURRENCE())){
|
651
|
return 13;
|
652
|
}else if (feature.equals(Feature.CITATION())){
|
653
|
return 99;
|
654
|
}else{
|
655
|
logger.debug("Unknown Feature.");
|
656
|
return null;
|
657
|
}
|
658
|
}
|
659
|
|
660
|
|
661
|
public static Integer taxonBase2statusFk (TaxonBase<?> taxonBase){
|
662
|
if (taxonBase == null){return null;}
|
663
|
if (taxonBase.isInstanceOf(Taxon.class)){
|
664
|
return T_STATUS_ACCEPTED;
|
665
|
}else if (taxonBase.isInstanceOf(Synonym.class)){
|
666
|
return T_STATUS_SYNONYM;
|
667
|
}else{
|
668
|
logger.warn("Unknown ");
|
669
|
return T_STATUS_UNRESOLVED;
|
670
|
}
|
671
|
//TODO
|
672
|
// public static int T_STATUS_PARTIAL_SYN = 3;
|
673
|
// public static int T_STATUS_PRO_PARTE_SYN = 4;
|
674
|
// public static int T_STATUS_UNRESOLVED = 5;
|
675
|
// public static int T_STATUS_ORPHANED = 6;
|
676
|
}
|
677
|
|
678
|
public static Integer ref2refCategoryId (Reference<?> ref){
|
679
|
if (ref == null){
|
680
|
return null;
|
681
|
}
|
682
|
else if (ref.getType().equals(ReferenceType.Article)){ return REF_ARTICLE;}
|
683
|
else if (ref instanceof ISectionBase){ return REF_PART_OF_OTHER_TITLE;}
|
684
|
else if (ref.getType().equals(ReferenceType.Book)){ return REF_BOOK;}
|
685
|
else if (ref.getType().equals(ReferenceType.Database)){ return REF_DATABASE;}
|
686
|
// else if (ref instanceof SectionBas){ return REF_INFORMAL;}
|
687
|
// else if (ref instanceof SectionBas){ return REF_NOT_APPLICABLE;}
|
688
|
else if (ref.getType().equals(ReferenceType.WebPage)){ return REF_WEBSITE;}
|
689
|
else if (ref.getType().equals(ReferenceType.CdDvd)){ return REF_CD;}
|
690
|
else if (ref.getType().equals(ReferenceType.Journal)){ return REF_JOURNAL;}
|
691
|
else if (ref.getType().equals(ReferenceType.Generic)){ return REF_UNKNOWN;}
|
692
|
else if (ref.getType().equals(ReferenceType.PrintSeries)){
|
693
|
logger.warn("Print Series is not a standard Berlin Model category");
|
694
|
return REF_PRINT_SERIES;
|
695
|
}
|
696
|
else if (ref.getType().equals(ReferenceType.Proceedings)){
|
697
|
logger.warn("Proceedings is not a standard Berlin Model category");
|
698
|
return REF_CONFERENCE_PROCEEDINGS;
|
699
|
}
|
700
|
// else if (ref instanceof ){ return REF_JOURNAL_VOLUME;}
|
701
|
else if (ref.getType().equals(ReferenceType.Patent)){ return REF_NOT_APPLICABLE;}
|
702
|
else if (ref.getType().equals(ReferenceType.PersonalCommunication)){ return REF_INFORMAL;}
|
703
|
else if (ref.getType().equals(ReferenceType.Report)){ return REF_NOT_APPLICABLE;}
|
704
|
else if (ref.getType().equals(ReferenceType.Thesis)){ return REF_NOT_APPLICABLE;}
|
705
|
else if (ref.getType().equals(ReferenceType.Report)){ return REF_NOT_APPLICABLE;}
|
706
|
|
707
|
else {
|
708
|
//TODO Exception
|
709
|
logger.warn("Reference type not yet supported in Berlin Model: "+ ref.getClass().getSimpleName());
|
710
|
return null;
|
711
|
}
|
712
|
}
|
713
|
|
714
|
|
715
|
public static Integer taxRelation2relPtQualifierFk (RelationshipBase<?,?,?> rel){
|
716
|
if (rel == null){
|
717
|
return null;
|
718
|
}
|
719
|
// else if (rel instanceof SynonymRelationship){
|
720
|
// return ;
|
721
|
// }else if (rel instanceof TaxonRelationship){
|
722
|
RelationshipTermBase<?> type = rel.getType();
|
723
|
if (type.equals(TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN())) {return TAX_REL_IS_INCLUDED_IN;
|
724
|
}else if (type.equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())) {return TAX_REL_IS_MISAPPLIED_NAME_OF;
|
725
|
}else if (type.equals(SynonymRelationshipType.SYNONYM_OF())) {return TAX_REL_IS_SYNONYM_OF;
|
726
|
}else if (type.equals(SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF())) {return TAX_REL_IS_HOMOTYPIC_SYNONYM_OF;
|
727
|
}else if (type.equals(SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF())) {return TAX_REL_IS_HETEROTYPIC_SYNONYM_OF;
|
728
|
}else if (type.equals(TaxonRelationshipType.CONGRUENT_TO())) {return 11;
|
729
|
// public static int TAX_REL_IS_PROPARTE_SYN_OF = 4;
|
730
|
// public static int TAX_REL_IS_PARTIAL_SYN_OF = 5;
|
731
|
// public static int TAX_REL_IS_PROPARTE_HOMOTYPIC_SYNONYM_OF = 101;
|
732
|
// public static int TAX_REL_IS_PROPARTE_HETEROTYPIC_SYNONYM_OF = 102;
|
733
|
// public static int TAX_REL_IS_PARTIAL_HOMOTYPIC_SYNONYM_OF = 103;
|
734
|
// public static int TAX_REL_IS_PARTIAL_HETEROTYPIC_SYNONYM_OF = 104;
|
735
|
|
736
|
}else {
|
737
|
//TODO Exception
|
738
|
logger.warn("Relationship type not yet supported by Berlin Model export: "+ rel.getType());
|
739
|
return null;
|
740
|
}
|
741
|
}
|
742
|
|
743
|
public static Integer nomStatus2nomStatusFk (NomenclaturalStatusType status){
|
744
|
if (status == null){
|
745
|
return null;
|
746
|
}
|
747
|
if (status.equals(NomenclaturalStatusType.INVALID())) {return NAME_ST_NOM_INVAL;
|
748
|
}else if (status.equals(NomenclaturalStatusType.ILLEGITIMATE())) {return NAME_ST_NOM_ILLEG;
|
749
|
}else if (status.equals(NomenclaturalStatusType.NUDUM())) {return NAME_ST_NOM_NUD;
|
750
|
}else if (status.equals(NomenclaturalStatusType.REJECTED())) {return NAME_ST_NOM_REJ;
|
751
|
}else if (status.equals(NomenclaturalStatusType.REJECTED_PROP())) {return NAME_ST_NOM_REJ_PROP;
|
752
|
}else if (status.equals(NomenclaturalStatusType.UTIQUE_REJECTED())) {return NAME_ST_NOM_UTIQUE_REJ;
|
753
|
}else if (status.equals(NomenclaturalStatusType.UTIQUE_REJECTED_PROP())) {return NAME_ST_NOM_UTIQUE_REJ_PROP;
|
754
|
}else if (status.equals(NomenclaturalStatusType.CONSERVED())) {return NAME_ST_NOM_CONS;
|
755
|
|
756
|
}else if (status.equals(NomenclaturalStatusType.CONSERVED_PROP())) {return NAME_ST_NOM_CONS_PROP;
|
757
|
}else if (status.equals(NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED())) {return NAME_ST_ORTH_CONS;
|
758
|
}else if (status.equals(NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED_PROP())) {return NAME_ST_ORTH_CONS_PROP;
|
759
|
}else if (status.equals(NomenclaturalStatusType.SUPERFLUOUS())) {return NAME_ST_NOM_SUPERFL;
|
760
|
}else if (status.equals(NomenclaturalStatusType.AMBIGUOUS())) {return NAME_ST_NOM_AMBIG;
|
761
|
}else if (status.equals(NomenclaturalStatusType.PROVISIONAL())) {return NAME_ST_NOM_PROVIS;
|
762
|
}else if (status.equals(NomenclaturalStatusType.DOUBTFUL())) {return NAME_ST_NOM_DUB;
|
763
|
}else if (status.equals(NomenclaturalStatusType.NOVUM())) {return NAME_ST_NOM_NOV;
|
764
|
|
765
|
}else if (status.equals(NomenclaturalStatusType.CONFUSUM())) {return NAME_ST_NOM_CONFUS;
|
766
|
}else if (status.equals(NomenclaturalStatusType.ALTERNATIVE())) {return NAME_ST_NOM_ALTERN;
|
767
|
}else if (status.equals(NomenclaturalStatusType.COMBINATION_INVALID())) {return NAME_ST_COMB_INVAL;
|
768
|
//TODO
|
769
|
}else {
|
770
|
//TODO Exception
|
771
|
logger.warn("NomStatus type not yet supported by Berlin Model export: "+ status);
|
772
|
return null;
|
773
|
}
|
774
|
}
|
775
|
|
776
|
|
777
|
|
778
|
public static Integer nameRel2RelNameQualifierFk (RelationshipBase<?,?,?> rel){
|
779
|
if (rel == null){
|
780
|
return null;
|
781
|
}
|
782
|
RelationshipTermBase<?> type = rel.getType();
|
783
|
if (type.equals(NameRelationshipType.BASIONYM())) {return NAME_REL_IS_BASIONYM_FOR;
|
784
|
}else if (type.equals(NameRelationshipType.LATER_HOMONYM())) {return NAME_REL_IS_LATER_HOMONYM_OF;
|
785
|
}else if (type.equals(NameRelationshipType.REPLACED_SYNONYM())) {return NAME_REL_IS_REPLACED_SYNONYM_FOR;
|
786
|
//TODO
|
787
|
}else if (type.equals(NameRelationshipType.VALIDATED_BY_NAME())) {return NAME_REL_IS_VALIDATION_OF;
|
788
|
}else if (type.equals(NameRelationshipType.LATER_VALIDATED_BY_NAME())) {return NAME_REL_IS_LATER_VALIDATION_OF;
|
789
|
}else if (type.equals(NameRelationshipType.CONSERVED_AGAINST())) {return NAME_REL_IS_CONSERVED_AGAINST;
|
790
|
|
791
|
|
792
|
}else if (type.equals(NameRelationshipType.TREATED_AS_LATER_HOMONYM())) {return NAME_REL_IS_TREATED_AS_LATER_HOMONYM_OF;
|
793
|
}else if (type.equals(NameRelationshipType.ORTHOGRAPHIC_VARIANT())) {return NAME_REL_IS_ORTHOGRAPHIC_VARIANT_OF;
|
794
|
}else {
|
795
|
//TODO Exception
|
796
|
logger.warn("Relationship type not yet supported by Berlin Model export: "+ rel.getType());
|
797
|
return null;
|
798
|
}
|
799
|
|
800
|
//NameRelationShip
|
801
|
|
802
|
// }else if (type.equals(NameRelationshipType.())) {return NAME_REL_IS_REJECTED_IN_FAVOUR_OF;
|
803
|
|
804
|
// public static int NAME_REL_IS_FIRST_PARENT_OF = 9;
|
805
|
// public static int NAME_REL_IS_SECOND_PARENT_OF = 10;
|
806
|
// public static int NAME_REL_IS_FEMALE_PARENT_OF = 11;
|
807
|
// public static int NAME_REL_IS_MALE_PARENT_OF = 12;
|
808
|
//
|
809
|
// public static int NAME_REL_IS_REJECTED_IN_FAVOUR_OF = 14;
|
810
|
// }else if (type.equals(NameRelationshipType.)) {return NAME_REL_IS_REJECTED_TYPE_OF;
|
811
|
//
|
812
|
// public static int NAME_REL_HAS_SAME_TYPE_AS = 18;
|
813
|
// public static int NAME_REL_IS_LECTOTYPE_OF = 61;
|
814
|
// public static int NAME_REL_TYPE_NOT_DESIGNATED = 62;
|
815
|
|
816
|
// }else if (type.equals(NameRelationshipType.LATER_VALIDATED_BY_NAME())) {return NAME_REL_IS_TYPE_OF;
|
817
|
|
818
|
|
819
|
}
|
820
|
|
821
|
public static UUID getWebMarkerUuid (int markerCategoryId){
|
822
|
if (markerCategoryId == 1){
|
823
|
return UUID.fromString("d8554418-d1ae-471d-a1bd-a0cbc7ab860c"); //any as not to find in cichorieae
|
824
|
}else if (markerCategoryId == 2){
|
825
|
return UUID.fromString("7f189c48-8632-4870-9ec8-e4d2489f324e");
|
826
|
}else if (markerCategoryId == 3){
|
827
|
return UUID.fromString("9a115e6b-8210-4dd3-825a-6fed11016c63");
|
828
|
}else if (markerCategoryId == 4){
|
829
|
return UUID.fromString("1d287011-2054-41c5-a919-17ac1d0a9270");
|
830
|
}else if (markerCategoryId == 9){
|
831
|
return UUID.fromString("cc5eca5c-1ae5-4feb-9a95-507fc167b0c9");
|
832
|
}else{
|
833
|
logger.warn("Unknown webMarker category: " + markerCategoryId);
|
834
|
return null;
|
835
|
}
|
836
|
|
837
|
}
|
838
|
|
839
|
}
|