|
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.description.AbsenceTerm;
|
|
25 |
import eu.etaxonomy.cdm.model.description.Feature;
|
|
26 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
|
|
27 |
import eu.etaxonomy.cdm.model.description.PresenceTerm;
|
|
28 |
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
|
|
29 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
|
|
30 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
|
|
31 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType;
|
|
32 |
import eu.etaxonomy.cdm.model.name.Rank;
|
|
33 |
import eu.etaxonomy.cdm.model.name.RankClass;
|
|
34 |
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus;
|
|
35 |
import eu.etaxonomy.cdm.model.reference.ISection;
|
|
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 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 |
public static final UUID uuidEurArea = UUID.fromString("71dd0368-835c-4b53-889a-2bf316e10297");
|
|
114 |
public static final UUID uuidEurMedArea = UUID.fromString("aa6a5b25-3ee3-4771-b4d1-b91918f23fa5");
|
|
115 |
|
|
116 |
|
|
117 |
//Extension Types
|
|
118 |
public static final UUID uuidSpeciesExpertName = UUID.fromString("2e8153d2-7412-49e4-87e1-5c38f4c5153a");
|
|
119 |
public static final UUID uuidExpertName = UUID.fromString("24becb79-a90c-47d3-be35-efc87bb48fd3");
|
|
120 |
|
|
121 |
public static final UUID DETAIL_EXT_UUID = UUID.fromString("c3959b4f-d876-4b7a-a739-9260f4cafd1c");
|
|
122 |
public static final UUID ID_IN_SOURCE_EXT_UUID = UUID.fromString("23dac094-e793-40a4-bad9-649fc4fcfd44");
|
|
123 |
public static final UUID uuidIsoCode = UUID.fromString("048b8153-e3ee-451c-a72c-f1c8bc291c3e");
|
|
124 |
public static final UUID uuidTdwgAreaCode = UUID.fromString("73ad0288-b71b-4a14-9c2e-7f81f1e64a36");
|
|
125 |
public static final UUID uuidMclCode = UUID.fromString("aa27083a-6a96-42aa-a2f8-5541cf057067");
|
|
126 |
|
|
127 |
//Area Level
|
|
128 |
public static final UUID uuidAreaLevelTop = UUID.fromString("190d5758-4b96-4016-9412-6dc9c36ef5fd");
|
|
129 |
public static final UUID uuidAreaLevelFirst = UUID.fromString("d21503e3-875e-4abc-82ec-f812e3cfea84");
|
|
130 |
public static final UUID uuidAreaLevelSecond = UUID.fromString("97ac0bf5-b31c-487a-8ed5-a576f46c902c");
|
|
131 |
|
|
132 |
|
|
133 |
//languages
|
|
134 |
public static final UUID uuidLangMajorcan = UUID.fromString("82d696d7-cb4e-49de-ac89-63a0e12ca766");
|
|
135 |
|
|
136 |
//REFERENCES
|
|
137 |
public static int REF_ARTICLE = 1;
|
|
138 |
public static int REF_PART_OF_OTHER_TITLE = 2;
|
|
139 |
public static int REF_BOOK = 3;
|
|
140 |
public static int REF_DATABASE = 4;
|
|
141 |
public static int REF_INFORMAL = 5;
|
|
142 |
public static int REF_NOT_APPLICABLE = 6;
|
|
143 |
public static int REF_WEBSITE = 7;
|
|
144 |
public static int REF_CD = 8;
|
|
145 |
public static int REF_JOURNAL = 9;
|
|
146 |
public static int REF_UNKNOWN = 10;
|
|
147 |
public static int REF_PRINT_SERIES = 55;
|
|
148 |
public static int REF_CONFERENCE_PROCEEDINGS = 56;
|
|
149 |
public static int REF_JOURNAL_VOLUME = 57;
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
//NameStatus
|
|
154 |
public static int NAME_ST_NOM_INVAL = 1;
|
|
155 |
public static int NAME_ST_NOM_ILLEG = 2;
|
|
156 |
public static int NAME_ST_NOM_NUD = 3;
|
|
157 |
public static int NAME_ST_NOM_REJ = 4;
|
|
158 |
public static int NAME_ST_NOM_REJ_PROP = 5;
|
|
159 |
public static int NAME_ST_NOM_UTIQUE_REJ = 6;
|
|
160 |
public static int NAME_ST_NOM_UTIQUE_REJ_PROP = 7;
|
|
161 |
public static int NAME_ST_NOM_CONS = 8;
|
|
162 |
public static int NAME_ST_NOM_CONS_PROP = 9;
|
|
163 |
public static int NAME_ST_ORTH_CONS = 10;
|
|
164 |
public static int NAME_ST_ORTH_CONS_PROP = 11;
|
|
165 |
public static int NAME_ST_NOM_SUPERFL = 12;
|
|
166 |
public static int NAME_ST_NOM_AMBIG = 13;
|
|
167 |
public static int NAME_ST_NOM_PROVIS = 14;
|
|
168 |
public static int NAME_ST_NOM_DUB = 15;
|
|
169 |
public static int NAME_ST_NOM_NOV = 16;
|
|
170 |
public static int NAME_ST_NOM_CONFUS = 17;
|
|
171 |
public static int NAME_ST_NOM_ALTERN = 18;
|
|
172 |
public static int NAME_ST_COMB_INVAL = 19;
|
|
173 |
|
|
174 |
|
|
175 |
//NameRelationShip
|
|
176 |
public static int NAME_REL_IS_BASIONYM_FOR = 1;
|
|
177 |
public static int NAME_REL_IS_LATER_HOMONYM_OF = 2;
|
|
178 |
public static int NAME_REL_IS_REPLACED_SYNONYM_FOR = 3;
|
|
179 |
public static int NAME_REL_IS_VALIDATION_OF = 4;
|
|
180 |
public static int NAME_REL_IS_LATER_VALIDATION_OF = 5;
|
|
181 |
public static int NAME_REL_IS_TYPE_OF = 6;
|
|
182 |
public static int NAME_REL_IS_CONSERVED_TYPE_OF =7;
|
|
183 |
public static int NAME_REL_IS_REJECTED_TYPE_OF = 8;
|
|
184 |
public static int NAME_REL_IS_FIRST_PARENT_OF = 9;
|
|
185 |
public static int NAME_REL_IS_SECOND_PARENT_OF = 10;
|
|
186 |
public static int NAME_REL_IS_FEMALE_PARENT_OF = 11;
|
|
187 |
public static int NAME_REL_IS_MALE_PARENT_OF = 12;
|
|
188 |
public static int NAME_REL_IS_CONSERVED_AGAINST =13;
|
|
189 |
public static int NAME_REL_IS_REJECTED_IN_FAVOUR_OF = 14;
|
|
190 |
public static int NAME_REL_IS_TREATED_AS_LATER_HOMONYM_OF = 15;
|
|
191 |
public static int NAME_REL_IS_ORTHOGRAPHIC_VARIANT_OF = 16;
|
|
192 |
public static int NAME_REL_IS_ALTERNATIVE_NAME_FOR = 17;
|
|
193 |
public static int NAME_REL_HAS_SAME_TYPE_AS = 18;
|
|
194 |
public static int NAME_REL_IS_LECTOTYPE_OF = 61;
|
|
195 |
public static int NAME_REL_TYPE_NOT_DESIGNATED = 62;
|
|
196 |
|
|
197 |
//NameFacts
|
|
198 |
public static String NAME_FACT_PROTOLOGUE = "Protologue";
|
|
199 |
public static String NAME_FACT_ALSO_PUBLISHED_IN = "Also published in";
|
|
200 |
public static String NAME_FACT_BIBLIOGRAPHY = "Bibliography";
|
|
201 |
|
|
202 |
//TaxonRelationShip
|
|
203 |
public static int TAX_REL_IS_INCLUDED_IN = 1;
|
|
204 |
public static int TAX_REL_IS_SYNONYM_OF = 2;
|
|
205 |
public static int TAX_REL_IS_MISAPPLIED_NAME_OF = 3;
|
|
206 |
public static int TAX_REL_IS_PROPARTE_SYN_OF = 4;
|
|
207 |
public static int TAX_REL_IS_PARTIAL_SYN_OF = 5;
|
|
208 |
public static int TAX_REL_IS_HETEROTYPIC_SYNONYM_OF = 6;
|
|
209 |
public static int TAX_REL_IS_HOMOTYPIC_SYNONYM_OF = 7;
|
|
210 |
public static int TAX_REL_IS_PROPARTE_HOMOTYPIC_SYNONYM_OF = 101;
|
|
211 |
public static int TAX_REL_IS_PROPARTE_HETEROTYPIC_SYNONYM_OF = 102;
|
|
212 |
public static int TAX_REL_IS_PARTIAL_HOMOTYPIC_SYNONYM_OF = 103;
|
|
213 |
public static int TAX_REL_IS_PARTIAL_HETEROTYPIC_SYNONYM_OF = 104;
|
|
214 |
|
|
215 |
|
|
216 |
|
|
217 |
//TaxonStatus
|
|
218 |
public static int T_STATUS_ACCEPTED = 1;
|
|
219 |
public static int T_STATUS_SYNONYM = 2;
|
|
220 |
public static int T_STATUS_PARTIAL_SYN = 3;
|
|
221 |
public static int T_STATUS_PRO_PARTE_SYN = 4;
|
|
222 |
public static int T_STATUS_UNRESOLVED = 5;
|
|
223 |
public static int T_STATUS_ORPHANED = 6;
|
|
224 |
|
|
225 |
|
|
226 |
//Facts
|
|
227 |
public static int FACT_DESCRIPTION = 1;
|
|
228 |
public static int FACT_GROWTH_FORM = 2;
|
|
229 |
public static int FACT_HARDINESS = 3;
|
|
230 |
public static int FACT_ECOLOGY = 4;
|
|
231 |
public static int FACT_PHENOLOGY = 5;
|
|
232 |
public static int FACT_KARYOLOGY = 6;
|
|
233 |
public static int FACT_ILLUSTRATION = 7;
|
|
234 |
public static int FACT_IDENTIFICATION = 8;
|
|
235 |
public static int FACT_OBSERVATION = 9;
|
|
236 |
public static int FACT_DISTRIBUTION_EM = 10;
|
|
237 |
public static int FACT_DISTRIBUTION_WORLD = 11;
|
|
238 |
//E+M
|
|
239 |
public static final UUID uuidFeatureMaps = UUID.fromString("8367730e-f3c3-4361-8360-a2057e4295ed");
|
|
240 |
public static final UUID uuidFeatureConservationStatus = UUID.fromString("a32f33cd-1966-4a22-986c-94c5e688bbd1");
|
|
241 |
public static final UUID uuidFeatureUse = UUID.fromString("199bbbd8-2db6-4335-b454-2e92ae02b699");
|
|
242 |
public static final UUID uuidFeatureComments = UUID.fromString("31cc2b92-5cad-44e9-b50f-b8af591a527c");
|
|
243 |
public static final UUID uuidFeatureDistrEM = UUID.fromString("a5ba7e7f-ca7f-4f50-afc7-73e76b3231d4");
|
|
244 |
public static final UUID uuidFeatureDistrWorld = UUID.fromString("e4e24080-7017-47e6-924e-d2560fa68fb8");
|
|
245 |
public static final UUID uuidFeatureEditorBrackets = UUID.fromString("b3b5bc1a-7ba8-4a39-9c0d-63ba599eb5d8");
|
|
246 |
public static final UUID uuidFeatureEditorParenthesis = UUID.fromString("6ee10a2e-ff02-4cf4-a520-89630edc5b44");
|
|
247 |
public static final UUID uuidFeatureInedited = UUID.fromString("c93e2968-bc52-4165-9755-ce37611faf01");
|
|
248 |
public static final UUID uuidFeatureCommentsEditing = UUID.fromString("7a155021-158a-48bb-81d0-9a72b718e2de");
|
|
249 |
|
|
250 |
|
|
251 |
|
|
252 |
public static UUID uuidNomStatusCombIned = UUID.fromString("dde8a2e7-bf9e-42ec-b186-d5bde9c9c128");
|
|
253 |
public static UUID uuidNomStatusSpNovIned = UUID.fromString("1a359ca1-9364-43bc-93e4-834bdcd52b72");
|
|
254 |
public static UUID uuidNomStatusNomOrthCons = UUID.fromString("0f838183-ffa0-4014-928e-0e3a27eb3918");
|
|
255 |
|
|
256 |
static NomenclaturalStatusType nomStatusCombIned;
|
|
257 |
static NomenclaturalStatusType nomStatusSpNovIned;
|
|
258 |
static NomenclaturalStatusType nomStatusNomOrthCons;
|
|
259 |
|
|
260 |
public static NomenclaturalStatusType nomStatusTypeAbbrev2NewNomStatusType(String nomStatus){
|
|
261 |
NomenclaturalStatusType result = null;
|
|
262 |
if (nomStatus == null){
|
|
263 |
return null;
|
|
264 |
}else if (nomStatus.equalsIgnoreCase("comb. ined.")){
|
|
265 |
if (nomStatusCombIned == null){
|
|
266 |
nomStatusCombIned = NomenclaturalStatusType.NewInstance("comb. ined.", "comb. ined.", "comb. ined.", Language.LATIN());
|
|
267 |
nomStatusCombIned.setUuid(uuidNomStatusCombIned);
|
|
268 |
NomenclaturalStatusType.ALTERNATIVE().getVocabulary().addTerm(nomStatusCombIned);
|
|
269 |
}
|
|
270 |
result = nomStatusCombIned;
|
|
271 |
}else if (nomStatus.equalsIgnoreCase("sp. nov. ined.")){
|
|
272 |
if (nomStatusSpNovIned == null){
|
|
273 |
nomStatusSpNovIned = NomenclaturalStatusType.NewInstance("sp. nov. ined.", "sp. nov. ined.", "sp. nov. ined.", Language.LATIN());
|
|
274 |
nomStatusSpNovIned.setUuid(uuidNomStatusSpNovIned);
|
|
275 |
NomenclaturalStatusType.ALTERNATIVE().getVocabulary().addTerm(nomStatusSpNovIned);
|
|
276 |
}
|
|
277 |
result = nomStatusSpNovIned;
|
|
278 |
}else if (nomStatus.equalsIgnoreCase("nom. & orth. cons.")){
|
|
279 |
if (nomStatusNomOrthCons == null){
|
|
280 |
nomStatusNomOrthCons = NomenclaturalStatusType.NewInstance("nom. & orth. cons.", "nom. & orth. cons.", "nom. & orth. cons.", Language.LATIN());
|
|
281 |
nomStatusNomOrthCons.setUuid(uuidNomStatusNomOrthCons);
|
|
282 |
NomenclaturalStatusType.ALTERNATIVE().getVocabulary().addTerm(nomStatusNomOrthCons);
|
|
283 |
}
|
|
284 |
result = nomStatusNomOrthCons;
|
|
285 |
}
|
|
286 |
return result;
|
|
287 |
}
|
|
288 |
|
|
289 |
|
|
290 |
public static NomenclaturalStatus nomStatusFkToNomStatus(int nomStatusFk, String nomStatusLabel) throws UnknownCdmTypeException{
|
|
291 |
if (nomStatusFk == NAME_ST_NOM_INVAL){
|
|
292 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.INVALID());
|
|
293 |
}else if (nomStatusFk == NAME_ST_NOM_ILLEG){
|
|
294 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ILLEGITIMATE());
|
|
295 |
}else if (nomStatusFk == NAME_ST_NOM_NUD){
|
|
296 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.NUDUM());
|
|
297 |
}else if (nomStatusFk == NAME_ST_NOM_REJ){
|
|
298 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.REJECTED());
|
|
299 |
}else if (nomStatusFk == NAME_ST_NOM_REJ_PROP){
|
|
300 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.REJECTED_PROP());
|
|
301 |
}else if (nomStatusFk == NAME_ST_NOM_UTIQUE_REJ){
|
|
302 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.UTIQUE_REJECTED());
|
|
303 |
}else if (nomStatusFk == NAME_ST_NOM_UTIQUE_REJ_PROP){
|
|
304 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.UTIQUE_REJECTED_PROP());
|
|
305 |
}else if (nomStatusFk == NAME_ST_NOM_CONS){
|
|
306 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.CONSERVED());
|
|
307 |
}else if (nomStatusFk == NAME_ST_NOM_CONS_PROP){
|
|
308 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.CONSERVED_PROP());
|
|
309 |
}else if (nomStatusFk == NAME_ST_ORTH_CONS){
|
|
310 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED());
|
|
311 |
}else if (nomStatusFk == NAME_ST_ORTH_CONS_PROP){
|
|
312 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED_PROP());
|
|
313 |
}else if (nomStatusFk == NAME_ST_NOM_SUPERFL){
|
|
314 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.SUPERFLUOUS());
|
|
315 |
}else if (nomStatusFk == NAME_ST_NOM_AMBIG){
|
|
316 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.AMBIGUOUS());
|
|
317 |
}else if (nomStatusFk == NAME_ST_NOM_PROVIS){
|
|
318 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.PROVISIONAL());
|
|
319 |
}else if (nomStatusFk == NAME_ST_NOM_DUB){
|
|
320 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.DOUBTFUL());
|
|
321 |
}else if (nomStatusFk == NAME_ST_NOM_NOV){
|
|
322 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.NOVUM());
|
|
323 |
}else if (nomStatusFk == NAME_ST_NOM_CONFUS){
|
|
324 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.CONFUSUM());
|
|
325 |
}else if (nomStatusFk == NAME_ST_NOM_ALTERN){
|
|
326 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.ALTERNATIVE());
|
|
327 |
}else if (nomStatusFk == NAME_ST_COMB_INVAL){
|
|
328 |
return NomenclaturalStatus.NewInstance(NomenclaturalStatusType.COMBINATION_INVALID());
|
|
329 |
}else {
|
|
330 |
NomenclaturalStatusType statusType = nomStatusTypeAbbrev2NewNomStatusType(nomStatusLabel);
|
|
331 |
NomenclaturalStatus result = NomenclaturalStatus.NewInstance(statusType);
|
|
332 |
if (result != null){
|
|
333 |
return result;
|
|
334 |
}
|
|
335 |
throw new UnknownCdmTypeException("Unknown NomenclaturalStatus (id=" + Integer.valueOf(nomStatusFk).toString() + ")");
|
|
336 |
}
|
|
337 |
}
|
|
338 |
|
|
339 |
|
|
340 |
//TypeDesignation
|
|
341 |
public static SpecimenTypeDesignationStatus typeStatusId2TypeStatus (int typeStatusId) throws UnknownCdmTypeException{
|
|
342 |
switch (typeStatusId){
|
|
343 |
case 0: return null;
|
|
344 |
case 1: return SpecimenTypeDesignationStatus.HOLOTYPE();
|
|
345 |
case 2: return SpecimenTypeDesignationStatus.LECTOTYPE();
|
|
346 |
case 3: return SpecimenTypeDesignationStatus.NEOTYPE();
|
|
347 |
case 4: return SpecimenTypeDesignationStatus.EPITYPE();
|
|
348 |
case 5: return SpecimenTypeDesignationStatus.ISOLECTOTYPE();
|
|
349 |
case 6: return SpecimenTypeDesignationStatus.ISONEOTYPE();
|
|
350 |
case 7: return SpecimenTypeDesignationStatus.ISOTYPE();
|
|
351 |
case 8: return SpecimenTypeDesignationStatus.PARANEOTYPE();
|
|
352 |
case 9: return SpecimenTypeDesignationStatus.PARATYPE();
|
|
353 |
case 10: return SpecimenTypeDesignationStatus.SECOND_STEP_LECTOTYPE();
|
|
354 |
case 11: return SpecimenTypeDesignationStatus.SECOND_STEP_NEOTYPE();
|
|
355 |
case 12: return SpecimenTypeDesignationStatus.SYNTYPE();
|
|
356 |
case 21: return SpecimenTypeDesignationStatus.ICONOTYPE();
|
|
357 |
case 22: return SpecimenTypeDesignationStatus.PHOTOTYPE();
|
|
358 |
default: {
|
|
359 |
throw new UnknownCdmTypeException("Unknown TypeDesignationStatus (id=" + Integer.valueOf(typeStatusId).toString() + ")");
|
|
360 |
}
|
|
361 |
}
|
|
362 |
}
|
|
363 |
|
|
364 |
//TypeDesignation
|
|
365 |
public static TaxonRelationshipType taxonRelId2TaxonRelType (int relTaxonTypeId, ResultWrapper<Boolean> isInverse) throws UnknownCdmTypeException{
|
|
366 |
isInverse.setValue(false);
|
|
367 |
switch (relTaxonTypeId){
|
|
368 |
case 0: return null;
|
|
369 |
case 11: return TaxonRelationshipType.CONGRUENT_TO();
|
|
370 |
case 12: isInverse.setValue(true); return TaxonRelationshipType.INCLUDES();
|
|
371 |
case 13: isInverse.setValue(true); return TaxonRelationshipType.CONGRUENT_OR_INCLUDES();
|
|
372 |
case 14: return TaxonRelationshipType.INCLUDES();
|
|
373 |
case 15: return TaxonRelationshipType.CONGRUENT_OR_INCLUDES();
|
|
374 |
case 16: return TaxonRelationshipType.INCLUDED_OR_INCLUDES();
|
|
375 |
case 17: return TaxonRelationshipType.CONGRUENT_OR_INCLUDED_OR_INCLUDES();
|
|
376 |
case 18: return TaxonRelationshipType.OVERLAPS();
|
|
377 |
case 19: return TaxonRelationshipType.CONGRUENT_OR_OVERLAPS();
|
|
378 |
case 20: isInverse.setValue(true); return TaxonRelationshipType.INCLUDES_OR_OVERLAPS();
|
|
379 |
case 21: isInverse.setValue(true); return TaxonRelationshipType.CONGRUENT_OR_INCLUDES_OR_OVERLAPS();
|
|
380 |
case 22: return TaxonRelationshipType.INCLUDES_OR_OVERLAPS();
|
|
381 |
case 23: return TaxonRelationshipType.CONGRUENT_OR_INCLUDES_OR_OVERLAPS();
|
|
382 |
case 24: return TaxonRelationshipType.INCLUDED_OR_INCLUDES_OR_OVERLAPS();
|
|
383 |
|
|
384 |
case 26: return TaxonRelationshipType.EXCLUDES();
|
|
385 |
|
|
386 |
//TODO other relationshipTypes
|
|
387 |
|
|
388 |
case 40: return TaxonRelationshipType.NOT_CONGRUENT_TO();
|
|
389 |
|
|
390 |
//FIXME doubtful
|
|
391 |
case 43: return TaxonRelationshipType.CONGRUENT_TO();
|
|
392 |
default: {
|
|
393 |
throw new UnknownCdmTypeException("Unknown TypeDesignationStatus (id=" + Integer.valueOf(relTaxonTypeId).toString() + ")");
|
|
394 |
}
|
|
395 |
}
|
|
396 |
}
|
|
397 |
|
|
398 |
//TypeDesignation
|
|
399 |
public static HybridRelationshipType relNameId2HybridRel (int relNameId) throws UnknownCdmTypeException{
|
|
400 |
switch (relNameId){
|
|
401 |
case 0: return null;
|
|
402 |
case 9: return HybridRelationshipType.FIRST_PARENT();
|
|
403 |
case 10: return HybridRelationshipType.SECOND_PARENT();
|
|
404 |
case 11: return HybridRelationshipType.FEMALE_PARENT();
|
|
405 |
case 12: return HybridRelationshipType.MALE_PARENT();
|
|
406 |
default: {
|
|
407 |
throw new UnknownCdmTypeException("Unknown HybridRelationshipType (id=" + Integer.valueOf(relNameId).toString() + ")");
|
|
408 |
}
|
|
409 |
}
|
|
410 |
}
|
|
411 |
|
|
412 |
//OccStatus
|
|
413 |
public static PresenceAbsenceTermBase<?> occStatus2PresenceAbsence (int occStatusId) throws UnknownCdmTypeException{
|
|
414 |
switch (occStatusId){
|
|
415 |
case 0: return null;
|
|
416 |
case 110: return AbsenceTerm.CULTIVATED_REPORTED_IN_ERROR();
|
|
417 |
case 120: return PresenceTerm.CULTIVATED();
|
|
418 |
case 210: return AbsenceTerm.INTRODUCED_REPORTED_IN_ERROR();
|
|
419 |
case 220: return PresenceTerm.INTRODUCED_PRESENCE_QUESTIONABLE();
|
|
420 |
case 230: return AbsenceTerm.INTRODUCED_FORMERLY_INTRODUCED();
|
|
421 |
case 240: return PresenceTerm.INTRODUCED_DOUBTFULLY_INTRODUCED();
|
|
422 |
case 250: return PresenceTerm.INTRODUCED();
|
|
423 |
case 260: return PresenceTerm.INTRODUCED_UNCERTAIN_DEGREE_OF_NATURALISATION();
|
|
424 |
case 270: return PresenceTerm.INTRODUCED_ADVENTITIOUS();
|
|
425 |
case 280: return PresenceTerm.INTRODUCED_NATURALIZED();
|
|
426 |
case 310: return AbsenceTerm.NATIVE_REPORTED_IN_ERROR();
|
|
427 |
case 320: return PresenceTerm.NATIVE_PRESENCE_QUESTIONABLE();
|
|
428 |
case 330: return AbsenceTerm.NATIVE_FORMERLY_NATIVE();
|
|
429 |
case 340: return PresenceTerm.NATIVE_DOUBTFULLY_NATIVE();
|
|
430 |
case 350: return PresenceTerm.NATIVE();
|
|
431 |
case 999: {
|
|
432 |
logger.info("endemic for EM can not be transformed in legal status. Used 'PRESENT' instead");
|
|
433 |
//TODO preliminary
|
|
434 |
return PresenceTerm.PRESENT();
|
|
435 |
}
|
|
436 |
default: {
|
|
437 |
throw new UnknownCdmTypeException("Unknown occurrence status (id=" + Integer.valueOf(occStatusId).toString() + ")");
|
|
438 |
}
|
|
439 |
}
|
|
440 |
}
|
|
441 |
|
|
442 |
|
|
443 |
//FactCategory
|
|
444 |
public static Feature factCategory2Feature (int factCategoryId) throws UnknownCdmTypeException{
|
|
445 |
switch (factCategoryId){
|
|
446 |
case 0: return null;
|
|
447 |
case 1: return Feature.DESCRIPTION();
|
|
448 |
case 4: return Feature.ECOLOGY();
|
|
449 |
case 5: return Feature.PHENOLOGY();
|
|
450 |
case 12: return Feature.COMMON_NAME();
|
|
451 |
case 13: return Feature.OCCURRENCE();
|
|
452 |
case 99: return Feature.CITATION();
|
|
453 |
default: {
|
|
454 |
throw new UnknownCdmTypeException("Unknown FactCategory (id=" + Integer.valueOf(factCategoryId).toString() + ")");
|
|
455 |
}
|
|
456 |
}
|
|
457 |
}
|
|
458 |
|
|
459 |
public static UUID getFeatureUuid(String key) throws UndefinedTransformerMethodException {
|
|
460 |
if (key == null){
|
|
461 |
return null;
|
|
462 |
}else if (key.equalsIgnoreCase("14-Maps")){ return uuidFeatureMaps;
|
|
463 |
}else if (key.equalsIgnoreCase("301-Conservation Status")){ return uuidFeatureConservationStatus;
|
|
464 |
}else if (key.equalsIgnoreCase("302-Use")){ return uuidFeatureUse;
|
|
465 |
}else if (key.equalsIgnoreCase("303-Comments")){ return uuidFeatureComments;
|
|
466 |
|
|
467 |
}else if (key.equalsIgnoreCase("10-general distribution (Euro+Med)")){ return uuidFeatureDistrEM;
|
|
468 |
}else if (key.equalsIgnoreCase("11-general distribution (world)")){ return uuidFeatureDistrWorld;
|
|
469 |
}else if (key.equalsIgnoreCase("250-Editor_Brackets")){ return uuidFeatureEditorBrackets;
|
|
470 |
}else if (key.equalsIgnoreCase("251-Editor_Parenthesis")){ return uuidFeatureEditorParenthesis;
|
|
471 |
}else if (key.equalsIgnoreCase("252-Inedited")){ return uuidFeatureInedited;
|
|
472 |
}else if (key.equalsIgnoreCase("253-Comments on editing process")){ return uuidFeatureCommentsEditing;
|
|
473 |
|
|
474 |
}else{
|
|
475 |
return null;
|
|
476 |
}
|
|
477 |
}
|
|
478 |
|
|
479 |
|
|
480 |
static Rank collSpeciesRank;
|
|
481 |
/**
|
|
482 |
* @param i
|
|
483 |
* @return
|
|
484 |
*/
|
|
485 |
private static Rank rankId2NewRank(Integer rankId, boolean switchRank) {
|
|
486 |
Rank result = null;
|
|
487 |
if (rankId == null){
|
|
488 |
return null;
|
|
489 |
}else if (rankId == 57){
|
|
490 |
|
|
491 |
if (collSpeciesRank == null){
|
|
492 |
collSpeciesRank = Rank.NewInstance(RankClass.SpeciesGroup, "Collective species", "Coll. species", "coll.");
|
|
493 |
collSpeciesRank.setUuid(uuidRankCollSpecies);
|
|
494 |
OrderedTermVocabulary<Rank> voc = (OrderedTermVocabulary<Rank>)Rank.SPECIES().getVocabulary();
|
|
495 |
voc.addTermBelow(collSpeciesRank, Rank.SPECIESGROUP());
|
|
496 |
}
|
|
497 |
result = collSpeciesRank;
|
|
498 |
}
|
|
499 |
return result;
|
|
500 |
}
|
|
501 |
|
|
502 |
|
|
503 |
public static Rank rankId2Rank (ResultSet rs, boolean useUnknown, boolean switchSpeciesGroup) throws UnknownCdmTypeException{
|
|
504 |
Rank result;
|
|
505 |
try {
|
|
506 |
int rankId = rs.getInt("rankFk");
|
|
507 |
|
|
508 |
String abbrev = rs.getString("rankAbbrev");
|
|
509 |
String rankName = rs.getString("rank");
|
|
510 |
if (logger.isDebugEnabled()){logger.debug(rankId);}
|
|
511 |
if (logger.isDebugEnabled()){logger.debug(abbrev);}
|
|
512 |
if (logger.isDebugEnabled()){logger.debug(rankName);}
|
|
513 |
|
|
514 |
if (switchSpeciesGroup){
|
|
515 |
if (rankId == 59){
|
|
516 |
rankId = 57;
|
|
517 |
}else if (rankId == 57){
|
|
518 |
rankId = 59;
|
|
519 |
}
|
|
520 |
}
|
|
521 |
try {
|
|
522 |
result = Rank.getRankByNameOrIdInVoc(abbrev);
|
|
523 |
} catch (UnknownCdmTypeException e) {
|
|
524 |
try {
|
|
525 |
result = Rank.getRankByNameOrIdInVoc(rankName);
|
|
526 |
} catch (UnknownCdmTypeException e1) {
|
|
527 |
switch (rankId){
|
|
528 |
case 0: return null;
|
|
529 |
case 1: return Rank.KINGDOM();
|
|
530 |
case 3: return Rank.SUBKINGDOM();
|
|
531 |
case 5: return Rank.PHYLUM();
|
|
532 |
case 7: return Rank.SUBPHYLUM();
|
|
533 |
case 8: return Rank.DIVISION();
|
|
534 |
case 9: return Rank.SUBDIVISION();
|
|
535 |
case 10: return Rank.CLASS();
|
|
536 |
case 13: return Rank.SUBCLASS();
|
|
537 |
case 16: return Rank.SUPERORDER();
|
|
538 |
case 18: return Rank.ORDER();
|
|
539 |
case 19: return Rank.SUBORDER();
|
|
540 |
case 20: return Rank.FAMILY();
|
|
541 |
case 25: return Rank.SUBFAMILY();
|
|
542 |
case 30: return Rank.TRIBE();
|
|
543 |
case 35: return Rank.SUBTRIBE();
|
|
544 |
case 40: return Rank.GENUS();
|
|
545 |
case 42: return Rank.SUBGENUS();
|
|
546 |
case 45: return Rank.SECTION_BOTANY();
|
|
547 |
case 47: return Rank.SUBSECTION_BOTANY();
|
|
548 |
case 50: return Rank.SERIES();
|
|
549 |
case 52: return Rank.SUBSERIES();
|
|
550 |
case 58: return Rank.SPECIESAGGREGATE();
|
|
551 |
case 59: return Rank.SPECIESGROUP();
|
|
552 |
case 60: return Rank.SPECIES();
|
|
553 |
case 61: return Rank.GREX();
|
|
554 |
case 65: return Rank.SUBSPECIES();
|
|
555 |
case 66: {System.out.println("Rank 66 not yet implemented"); throw new UnknownCdmTypeException("Unknown Rank id" + Integer.valueOf(rankId).toString());}
|
|
556 |
case 67: {System.out.println("Rank 67 not yet implemented"); throw new UnknownCdmTypeException("Unknown Rank id" + Integer.valueOf(rankId).toString());}
|
|
557 |
case 68: return Rank.CONVAR();
|
|
558 |
case 70: return Rank.VARIETY();
|
|
559 |
case 73: return Rank.SUBVARIETY();
|
|
560 |
case 80: return Rank.FORM();
|
|
561 |
case 82: return Rank.SUBFORM();
|
|
562 |
case 84: return Rank.SPECIALFORM();
|
|
563 |
case 98: return Rank.INFRAGENERICTAXON();
|
|
564 |
case 99: return Rank.INFRASPECIFICTAXON();
|
|
565 |
|
|
566 |
case 750: return Rank.SUPERCLASS();
|
|
567 |
case 780: return Rank.INFRACLASS();
|
|
568 |
case 820: return Rank.INFRAORDER();
|
|
569 |
|
|
570 |
case 830: return Rank.SUPERFAMILY();
|
|
571 |
|
|
572 |
default: {
|
|
573 |
Rank rank = rankId2NewRank(57, switchSpeciesGroup);
|
|
574 |
if (rank != null){
|
|
575 |
return rank;
|
|
576 |
}
|
|
577 |
if (useUnknown){
|
|
578 |
logger.error("Rank unknown: " + rankId + ". Created UNKNOWN_RANK");
|
|
579 |
return Rank.UNKNOWN_RANK();
|
|
580 |
}
|
|
581 |
throw new UnknownCdmTypeException("Unknown Rank id" + Integer.valueOf(rankId).toString());
|
|
582 |
}
|
|
583 |
}
|
|
584 |
}
|
|
585 |
}
|
|
586 |
return result;
|
|
587 |
} catch (SQLException e) {
|
|
588 |
e.printStackTrace();
|
|
589 |
logger.warn("Exception occurred. Created UNKNOWN_RANK instead");
|
|
590 |
return Rank.UNKNOWN_RANK();
|
|
591 |
}
|
|
592 |
}
|
|
593 |
|
|
594 |
|
|
595 |
public static Integer rank2RankId (Rank rank){
|
|
596 |
if (rank == null){
|
|
597 |
return null;
|
|
598 |
}
|
|
599 |
else if (rank.equals(Rank.KINGDOM())){ return 1;}
|
|
600 |
else if (rank.equals(Rank.SUBKINGDOM())){ return 3;}
|
|
601 |
else if (rank.equals(Rank.PHYLUM())){ return 5;}
|
|
602 |
else if (rank.equals(Rank.SUBPHYLUM())){ return 7;}
|
|
603 |
else if (rank.equals(Rank.DIVISION())){ return 8;}
|
|
604 |
else if (rank.equals(Rank.SUBDIVISION())){ return 9;}
|
|
605 |
|
|
606 |
else if (rank.equals(Rank.CLASS())){ return 10;}
|
|
607 |
else if (rank.equals(Rank.SUBCLASS())){ return 13;}
|
|
608 |
else if (rank.equals(Rank.SUPERORDER())){ return 16;}
|
|
609 |
else if (rank.equals(Rank.ORDER())){ return 18;}
|
|
610 |
else if (rank.equals(Rank.SUBORDER())){ return 19;}
|
|
611 |
else if (rank.equals(Rank.FAMILY())){ return 20;}
|
|
612 |
else if (rank.equals(Rank.SUBFAMILY())){ return 25;}
|
|
613 |
else if (rank.equals(Rank.TRIBE())){ return 30;}
|
|
614 |
else if (rank.equals(Rank.SUBTRIBE())){ return 35;}
|
|
615 |
else if (rank.equals(Rank.GENUS())){ return 40;}
|
|
616 |
else if (rank.equals(Rank.SUBGENUS())){ return 42;}
|
|
617 |
else if (rank.equals(Rank.SECTION_BOTANY())){ return 45;}
|
|
618 |
else if (rank.equals(Rank.SUBSECTION_BOTANY())){ return 47;}
|
|
619 |
else if (rank.equals(Rank.SERIES())){ return 50;}
|
|
620 |
else if (rank.equals(Rank.SUBSERIES())){ return 52;}
|
|
621 |
else if (rank.equals(Rank.SPECIESAGGREGATE())){ return 58;}
|
|
622 |
//TODO
|
|
623 |
// else if (rank.equals(Rank.XXX())){ return 59;}
|
|
624 |
else if (rank.equals(Rank.SPECIES())){ return 60;}
|
|
625 |
else if (rank.equals(Rank.SUBSPECIES())){ return 65;}
|
|
626 |
else if (rank.equals(Rank.CONVAR())){ return 68;}
|
|
627 |
else if (rank.equals(Rank.VARIETY())){ return 70;}
|
|
628 |
else if (rank.equals(Rank.SUBVARIETY())){ return 73;}
|
|
629 |
else if (rank.equals(Rank.FORM())){ return 80;}
|
|
630 |
else if (rank.equals(Rank.SUBFORM())){ return 82;}
|
|
631 |
else if (rank.equals(Rank.SPECIALFORM())){ return 84;}
|
|
632 |
else if (rank.equals(Rank.INFRAGENERICTAXON())){ return 98;}
|
|
633 |
else if (rank.equals(Rank.INFRASPECIFICTAXON())){ return 99;}
|
|
634 |
|
|
635 |
else if (rank.equals(Rank.SUPERCLASS())){ return 750;}
|
|
636 |
else if (rank.equals(Rank.INFRACLASS())){ return 780;}
|
|
637 |
else if (rank.equals(Rank.INFRAORDER())){ return 820;}
|
|
638 |
else if (rank.equals(Rank.SUPERFAMILY())){ return 830;}
|
|
639 |
|
|
640 |
else {
|
|
641 |
//TODO Exception
|
|
642 |
logger.warn("Rank not yet supported in Berlin Model: "+ rank.getLabel());
|
|
643 |
return null;
|
|
644 |
}
|
|
645 |
}
|
|
646 |
|
|
647 |
public static Integer textData2FactCategoryFk (Feature feature){
|
|
648 |
if (feature == null){return null;}
|
|
649 |
if (feature.equals(Feature.DESCRIPTION())){
|
|
650 |
return 1;
|
|
651 |
}else if (feature.equals(Feature.ECOLOGY())){
|
|
652 |
return 4;
|
|
653 |
}else if (feature.equals(Feature.PHENOLOGY())){
|
|
654 |
return 5;
|
|
655 |
}else if (feature.equals(Feature.COMMON_NAME())){
|
|
656 |
return 12;
|
|
657 |
}else if (feature.equals(Feature.OCCURRENCE())){
|
|
658 |
return 13;
|
|
659 |
}else if (feature.equals(Feature.CITATION())){
|
|
660 |
return 99;
|
|
661 |
}else{
|
|
662 |
logger.debug("Unknown Feature.");
|
|
663 |
return null;
|
|
664 |
}
|
|
665 |
}
|
|
666 |
|
|
667 |
|
|
668 |
public static Integer taxonBase2statusFk (TaxonBase<?> taxonBase){
|
|
669 |
if (taxonBase == null){return null;}
|
|
670 |
if (taxonBase.isInstanceOf(Taxon.class)){
|
|
671 |
return T_STATUS_ACCEPTED;
|
|
672 |
}else if (taxonBase.isInstanceOf(Synonym.class)){
|
|
673 |
return T_STATUS_SYNONYM;
|
|
674 |
}else{
|
|
675 |
logger.warn("Unknown ");
|
|
676 |
return T_STATUS_UNRESOLVED;
|
|
677 |
}
|
|
678 |
//TODO
|
|
679 |
// public static int T_STATUS_PARTIAL_SYN = 3;
|
|
680 |
// public static int T_STATUS_PRO_PARTE_SYN = 4;
|
|
681 |
// public static int T_STATUS_UNRESOLVED = 5;
|
|
682 |
// public static int T_STATUS_ORPHANED = 6;
|
|
683 |
}
|
|
684 |
|
|
685 |
public static Integer ref2refCategoryId (Reference<?> ref){
|
|
686 |
if (ref == null){
|
|
687 |
return null;
|
|
688 |
}
|
|
689 |
else if (ref.getType().equals(ReferenceType.Article)){ return REF_ARTICLE;}
|
|
690 |
else if (ref instanceof ISection){ return REF_PART_OF_OTHER_TITLE;}
|
|
691 |
else if (ref.getType().equals(ReferenceType.Book)){ return REF_BOOK;}
|
|
692 |
else if (ref.getType().equals(ReferenceType.Database)){ return REF_DATABASE;}
|
|
693 |
// else if (ref instanceof SectionBas){ return REF_INFORMAL;}
|
|
694 |
// else if (ref instanceof SectionBas){ return REF_NOT_APPLICABLE;}
|
|
695 |
else if (ref.getType().equals(ReferenceType.WebPage)){ return REF_WEBSITE;}
|
|
696 |
else if (ref.getType().equals(ReferenceType.CdDvd)){ return REF_CD;}
|
|
697 |
else if (ref.getType().equals(ReferenceType.Journal)){ return REF_JOURNAL;}
|
|
698 |
else if (ref.getType().equals(ReferenceType.Generic)){ return REF_UNKNOWN;}
|
|
699 |
else if (ref.getType().equals(ReferenceType.PrintSeries)){
|
|
700 |
logger.warn("Print Series is not a standard Berlin Model category");
|
|
701 |
return REF_PRINT_SERIES;
|
|
702 |
}
|
|
703 |
else if (ref.getType().equals(ReferenceType.Proceedings)){
|
|
704 |
logger.warn("Proceedings is not a standard Berlin Model category");
|
|
705 |
return REF_CONFERENCE_PROCEEDINGS;
|
|
706 |
}
|
|
707 |
// else if (ref instanceof ){ return REF_JOURNAL_VOLUME;}
|
|
708 |
else if (ref.getType().equals(ReferenceType.Patent)){ return REF_NOT_APPLICABLE;}
|
|
709 |
else if (ref.getType().equals(ReferenceType.PersonalCommunication)){ return REF_INFORMAL;}
|
|
710 |
else if (ref.getType().equals(ReferenceType.Report)){ return REF_NOT_APPLICABLE;}
|
|
711 |
else if (ref.getType().equals(ReferenceType.Thesis)){ return REF_NOT_APPLICABLE;}
|
|
712 |
else if (ref.getType().equals(ReferenceType.Report)){ return REF_NOT_APPLICABLE;}
|
|
713 |
|
|
714 |
else {
|
|
715 |
//TODO Exception
|
|
716 |
logger.warn("Reference type not yet supported in Berlin Model: "+ ref.getClass().getSimpleName());
|
|
717 |
return null;
|
|
718 |
}
|
|
719 |
}
|
|
720 |
|
|
721 |
|
|
722 |
public static Integer taxRelation2relPtQualifierFk (RelationshipBase<?,?,?> rel){
|
|
723 |
if (rel == null){
|
|
724 |
return null;
|
|
725 |
}
|
|
726 |
// else if (rel instanceof SynonymRelationship){
|
|
727 |
// return ;
|
|
728 |
// }else if (rel instanceof TaxonRelationship){
|
|
729 |
RelationshipTermBase<?> type = rel.getType();
|
|
730 |
if (type.equals(TaxonRelationshipType.TAXONOMICALLY_INCLUDED_IN())) {return TAX_REL_IS_INCLUDED_IN;
|
|
731 |
}else if (type.equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())) {return TAX_REL_IS_MISAPPLIED_NAME_OF;
|
|
732 |
}else if (type.equals(SynonymRelationshipType.SYNONYM_OF())) {return TAX_REL_IS_SYNONYM_OF;
|
|
733 |
}else if (type.equals(SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF())) {return TAX_REL_IS_HOMOTYPIC_SYNONYM_OF;
|
|
734 |
}else if (type.equals(SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF())) {return TAX_REL_IS_HETEROTYPIC_SYNONYM_OF;
|
|
735 |
}else if (type.equals(TaxonRelationshipType.CONGRUENT_TO())) {return 11;
|
|
736 |
// public static int TAX_REL_IS_PROPARTE_SYN_OF = 4;
|
|
737 |
// public static int TAX_REL_IS_PARTIAL_SYN_OF = 5;
|
|
738 |
// public static int TAX_REL_IS_PROPARTE_HOMOTYPIC_SYNONYM_OF = 101;
|
|
739 |
// public static int TAX_REL_IS_PROPARTE_HETEROTYPIC_SYNONYM_OF = 102;
|
|
740 |
// public static int TAX_REL_IS_PARTIAL_HOMOTYPIC_SYNONYM_OF = 103;
|
|
741 |
// public static int TAX_REL_IS_PARTIAL_HETEROTYPIC_SYNONYM_OF = 104;
|
|
742 |
|
|
743 |
}else {
|
|
744 |
//TODO Exception
|
|
745 |
logger.warn("Relationship type not yet supported by Berlin Model export: "+ rel.getType());
|
|
746 |
return null;
|
|
747 |
}
|
|
748 |
}
|
|
749 |
|
|
750 |
public static Integer nomStatus2nomStatusFk (NomenclaturalStatusType status){
|
|
751 |
if (status == null){
|
|
752 |
return null;
|
|
753 |
}
|
|
754 |
if (status.equals(NomenclaturalStatusType.INVALID())) {return NAME_ST_NOM_INVAL;
|
|
755 |
}else if (status.equals(NomenclaturalStatusType.ILLEGITIMATE())) {return NAME_ST_NOM_ILLEG;
|
|
756 |
}else if (status.equals(NomenclaturalStatusType.NUDUM())) {return NAME_ST_NOM_NUD;
|
|
757 |
}else if (status.equals(NomenclaturalStatusType.REJECTED())) {return NAME_ST_NOM_REJ;
|
|
758 |
}else if (status.equals(NomenclaturalStatusType.REJECTED_PROP())) {return NAME_ST_NOM_REJ_PROP;
|
|
759 |
}else if (status.equals(NomenclaturalStatusType.UTIQUE_REJECTED())) {return NAME_ST_NOM_UTIQUE_REJ;
|
|
760 |
}else if (status.equals(NomenclaturalStatusType.UTIQUE_REJECTED_PROP())) {return NAME_ST_NOM_UTIQUE_REJ_PROP;
|
|
761 |
}else if (status.equals(NomenclaturalStatusType.CONSERVED())) {return NAME_ST_NOM_CONS;
|
|
762 |
|
|
763 |
}else if (status.equals(NomenclaturalStatusType.CONSERVED_PROP())) {return NAME_ST_NOM_CONS_PROP;
|
|
764 |
}else if (status.equals(NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED())) {return NAME_ST_ORTH_CONS;
|
|
765 |
}else if (status.equals(NomenclaturalStatusType.ORTHOGRAPHY_CONSERVED_PROP())) {return NAME_ST_ORTH_CONS_PROP;
|
|
766 |
}else if (status.equals(NomenclaturalStatusType.SUPERFLUOUS())) {return NAME_ST_NOM_SUPERFL;
|
|
767 |
}else if (status.equals(NomenclaturalStatusType.AMBIGUOUS())) {return NAME_ST_NOM_AMBIG;
|
|
768 |
}else if (status.equals(NomenclaturalStatusType.PROVISIONAL())) {return NAME_ST_NOM_PROVIS;
|
|
769 |
}else if (status.equals(NomenclaturalStatusType.DOUBTFUL())) {return NAME_ST_NOM_DUB;
|
|
770 |
}else if (status.equals(NomenclaturalStatusType.NOVUM())) {return NAME_ST_NOM_NOV;
|
|
771 |
|
|
772 |
}else if (status.equals(NomenclaturalStatusType.CONFUSUM())) {return NAME_ST_NOM_CONFUS;
|
|
773 |
}else if (status.equals(NomenclaturalStatusType.ALTERNATIVE())) {return NAME_ST_NOM_ALTERN;
|
|
774 |
}else if (status.equals(NomenclaturalStatusType.COMBINATION_INVALID())) {return NAME_ST_COMB_INVAL;
|
|
775 |
//TODO
|
|
776 |
}else {
|
|
777 |
//TODO Exception
|
|
778 |
logger.warn("NomStatus type not yet supported by Berlin Model export: "+ status);
|
|
779 |
return null;
|
|
780 |
}
|
|
781 |
}
|
|
782 |
|
|
783 |
|
|
784 |
|
|
785 |
public static Integer nameRel2RelNameQualifierFk (RelationshipBase<?,?,?> rel){
|
|
786 |
if (rel == null){
|
|
787 |
return null;
|
|
788 |
}
|
|
789 |
RelationshipTermBase<?> type = rel.getType();
|
|
790 |
if (type.equals(NameRelationshipType.BASIONYM())) {return NAME_REL_IS_BASIONYM_FOR;
|
|
791 |
}else if (type.equals(NameRelationshipType.LATER_HOMONYM())) {return NAME_REL_IS_LATER_HOMONYM_OF;
|
|
792 |
}else if (type.equals(NameRelationshipType.REPLACED_SYNONYM())) {return NAME_REL_IS_REPLACED_SYNONYM_FOR;
|
|
793 |
//TODO
|
|
794 |
}else if (type.equals(NameRelationshipType.VALIDATED_BY_NAME())) {return NAME_REL_IS_VALIDATION_OF;
|
|
795 |
}else if (type.equals(NameRelationshipType.LATER_VALIDATED_BY_NAME())) {return NAME_REL_IS_LATER_VALIDATION_OF;
|
|
796 |
}else if (type.equals(NameRelationshipType.CONSERVED_AGAINST())) {return NAME_REL_IS_CONSERVED_AGAINST;
|
|
797 |
|
|
798 |
|
|
799 |
}else if (type.equals(NameRelationshipType.TREATED_AS_LATER_HOMONYM())) {return NAME_REL_IS_TREATED_AS_LATER_HOMONYM_OF;
|
|
800 |
}else if (type.equals(NameRelationshipType.ORTHOGRAPHIC_VARIANT())) {return NAME_REL_IS_ORTHOGRAPHIC_VARIANT_OF;
|
|
801 |
}else {
|
|
802 |
//TODO Exception
|
|
803 |
logger.warn("Relationship type not yet supported by Berlin Model export: "+ rel.getType());
|
|
804 |
return null;
|
|
805 |
}
|
|
806 |
|
|
807 |
//NameRelationShip
|
|
808 |
|
|
809 |
// }else if (type.equals(NameRelationshipType.())) {return NAME_REL_IS_REJECTED_IN_FAVOUR_OF;
|
|
810 |
|
|
811 |
// public static int NAME_REL_IS_FIRST_PARENT_OF = 9;
|
|
812 |
// public static int NAME_REL_IS_SECOND_PARENT_OF = 10;
|
|
813 |
// public static int NAME_REL_IS_FEMALE_PARENT_OF = 11;
|
|
814 |
// public static int NAME_REL_IS_MALE_PARENT_OF = 12;
|
|
815 |
//
|
|
816 |
// public static int NAME_REL_IS_REJECTED_IN_FAVOUR_OF = 14;
|
|
817 |
// }else if (type.equals(NameRelationshipType.)) {return NAME_REL_IS_REJECTED_TYPE_OF;
|
|
818 |
//
|
|
819 |
// public static int NAME_REL_HAS_SAME_TYPE_AS = 18;
|
|
820 |
// public static int NAME_REL_IS_LECTOTYPE_OF = 61;
|
|
821 |
// public static int NAME_REL_TYPE_NOT_DESIGNATED = 62;
|
|
822 |
|
|
823 |
// }else if (type.equals(NameRelationshipType.LATER_VALIDATED_BY_NAME())) {return NAME_REL_IS_TYPE_OF;
|
|
824 |
|
|
825 |
|
|
826 |
}
|
|
827 |
|
|
828 |
public static UUID getWebMarkerUuid (int markerCategoryId){
|
|
829 |
if (markerCategoryId == 1){
|
|
830 |
return UUID.fromString("d8554418-d1ae-471d-a1bd-a0cbc7ab860c"); //any as not to find in cichorieae
|
|
831 |
}else if (markerCategoryId == 2){
|
|
832 |
return UUID.fromString("7f189c48-8632-4870-9ec8-e4d2489f324e");
|
|
833 |
}else if (markerCategoryId == 3){
|
|
834 |
return UUID.fromString("9a115e6b-8210-4dd3-825a-6fed11016c63");
|
|
835 |
}else if (markerCategoryId == 4){
|
|
836 |
return UUID.fromString("1d287011-2054-41c5-a919-17ac1d0a9270");
|
|
837 |
}else if (markerCategoryId == 9){
|
|
838 |
return UUID.fromString("cc5eca5c-1ae5-4feb-9a95-507fc167b0c9");
|
|
839 |
}else{
|
|
840 |
logger.warn("Unknown webMarker category: " + markerCategoryId);
|
|
841 |
return null;
|
|
842 |
}
|
|
843 |
|
|
844 |
}
|
|
845 |
|
|
846 |
}
|
add berlin model import + export to pesi