\r
import org.apache.log4j.Logger;\r
\r
+import eu.etaxonomy.cdm.io.berlinModel.BerlinModelTransformer;\r
import eu.etaxonomy.cdm.io.pesi.erms.ErmsTransformer;\r
import eu.etaxonomy.cdm.model.common.CdmBase;\r
import eu.etaxonomy.cdm.model.common.Language;\r
*\r
*/\r
public final class PesiTransformer {\r
+ \r
private static final Logger logger = Logger.getLogger(PesiTransformer.class);\r
\r
public static final String auctString = "auct.";\r
public static int IS_POTENTIAL_COMBINATION_FOR = 303;\r
\r
public static String STR_IS_BASIONYM_FOR = "is basionym for";\r
+ public static String STR_IS_BASIONYM_FOR_ZOOL = "is original combination for";\r
public static String STR_IS_LATER_HOMONYM_OF = "is later homonym of";\r
public static String STR_IS_REPLACED_SYNONYM_FOR = "is replaced synonym for";\r
public static String STR_IS_VALIDATION_OF = "is validation of";\r
public static String STR_IS_PRO_PARTE_SYNONYM_OF = "is pro parte synonym of";\r
public static String STR_IS_PARTIAL_SYNONYM_OF = "is partial synonym of";\r
public static String STR_IS_HETEROTYPIC_SYNONYM_OF = "is heterotypic synonym of";\r
+ public static String STR_IS_HETEROTYPIC_SYNONYM_OF_ZOOL = "is subjective synonym of";\r
public static String STR_IS_HOMOTYPIC_SYNONYM_OF = "is homotypic synonym of";\r
+ private static final String STR_IS_HOMOTYPIC_SYNONYM_OF_ZOOL = "is objective synonym of";\r
public static String STR_IS_PRO_PARTE_AND_HOMOTYPIC_SYNONYM_OF = "is pro parte and homotypic synonym of";\r
public static String STR_IS_PRO_PARTE_AND_HETEROTYPIC_SYNONYM_OF = "is pro parte and heterotypic synonym of";\r
public static String STR_IS_PARTIAL_AND_HOMOTYPIC_SYNONYM_OF = "is partial and homotypic synonym of";\r
public static int Plantae_Aggregate = 216;\r
public static int Plantae_Coll_Species = 218;\r
public static int Plantae_Species = 220;\r
+ public static int Plantae_Grex = 225;\r
public static int Plantae_Subspecies = 230;\r
public static int Plantae_Proles = 232;\r
public static int Plantae_Race = 234;\r
public static String Plantae_STR_Aggregate = "Aggregate";\r
public static String Plantae_STR_Coll_Species = "Coll. Species";\r
public static String Plantae_STR_Species = "Species";\r
+ public static String Plantae_STR_Grex = "Grex";\r
public static String Plantae_STR_Subspecies = "Subspecies";\r
public static String Plantae_STR_Proles = "Proles";\r
public static String Plantae_STR_Race = "Race";\r
public static String Plantae_Abbrev_Aggregate = "aggr.";\r
public static String Plantae_Abbrev_Coll_Species = "coll. sp.";\r
public static String Plantae_Abbrev_Species = "sp.";\r
+ public static String Plantae_Abbrev_Grex = "grex";\r
public static String Plantae_Abbrev_Subspecies = "subsp.";\r
public static String Plantae_Abbrev_Proles = "prol.";\r
public static String Plantae_Abbrev_Race = "race";\r
* @param feature\r
* @return\r
*/\r
- public static Integer textData2NodeCategoryFk(Feature feature) {\r
+ public static Integer feature2NodeCategoryFk(Feature feature) {\r
if (feature == null) {\r
return null;\r
}\r
return NoteCategory_Identification;\r
} else if (feature.getUuid().equals(ErmsTransformer.uuidSynonymy)) {\r
return NoteCategory_Synonymy;\r
-// } else if (feature.equals(Feature.CITATION())) {\r
-// return;\r
+ } else if (feature.equals(Feature.CITATION())) {\r
+ return null; //citations are handled differently\r
\r
// TODO: Unknown NodeCategories\r
// NoteCategory_general_distribution_euromed = 10;\r
// NoteCategory_Host = 283;\r
\r
}else{\r
- logger.warn("Unknown Feature: " + feature.getTitleCache());\r
+ logger.warn("Unhandled Feature: " + feature.getTitleCache());\r
return null;\r
}\r
}\r
result = Plantae_STR_Series;\r
} else if (rank.equals(Rank.SUBSERIES())) {\r
result = Plantae_STR_Subseries;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_STR_Aggregate;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_STR_Coll_Species;\r
+ } else if (rank.equals(Rank.SPECIESAGGREGATE() )) {\r
+ result = Plantae_STR_Aggregate;\r
+ } else if (rank.equals(Rank.SPECIESGROUP())) {\r
+ logger.warn("Rank Species Group not yet implemented");\r
+ result = null;\r
+ } else if (rank.getUuid().equals(BerlinModelTransformer.uuidRankCollSpecies)) { \r
+ result = Plantae_STR_Coll_Species;\r
} else if (rank.equals(Rank.SPECIES())) {\r
result = Plantae_STR_Species;\r
} else if (rank.equals(Rank.SUBSPECIES())) {\r
result = Plantae_STR_Subspecies;\r
+ } else if (rank.equals(Rank.GREX())) {\r
+ result = Plantae_STR_Grex;\r
// } else if (rank.equals(Rank.)) { // not yet specified\r
// result = Plantae_STR_Proles;\r
// } else if (rank.equals(Rank.)) { // not yet specified\r
result = Plantae_STR_Subforma;\r
// } else if (rank.equals(Rank.)) { // not yet specified\r
// result = Plantae_STR_Forma_spec;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_STR_Taxa_infragen;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_STR_Taxa_infraspec;\r
+ } else if (rank.equals(Rank.INFRAGENERICTAXON())) { \r
+ result = Plantae_STR_Taxa_infragen;\r
+ } else if (rank.equals(Rank.INFRASPECIFICTAXON())) { \r
+ result = Plantae_STR_Taxa_infraspec;\r
} else {\r
//TODO Exception\r
logger.warn("Rank for Kingdom Plantae not yet supported in CDM: "+ rank.getLabel());\r
result = Plantae_Abbrev_Series;\r
} else if (rank.equals(Rank.SUBSERIES())) {\r
result = Plantae_Abbrev_Subseries;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_Abbrev_Aggregate;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_Abbrev_Coll_Species;\r
+ } else if (rank.equals(Rank.SPECIESAGGREGATE() )) { \r
+ result = Plantae_Abbrev_Aggregate;\r
+ } else if (rank.getUuid().equals(BerlinModelTransformer.uuidRankCollSpecies)) { \r
+ result = Plantae_Abbrev_Coll_Species;\r
} else if (rank.equals(Rank.SPECIES())) {\r
result = Plantae_Abbrev_Species;\r
+ } else if (rank.equals(Rank.GREX())) {\r
+ result = Plantae_Abbrev_Grex;\r
} else if (rank.equals(Rank.SUBSPECIES())) {\r
result = Plantae_Abbrev_Subspecies;\r
// } else if (rank.equals(Rank.)) { // not yet specified\r
result = Plantae_Abbrev_Subforma;\r
// } else if (rank.equals(Rank.)) { // not yet specified\r
// result = Plantae_Abbrev_Forma_spec;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_Abbrev_Taxa_infragen;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_Abbrev_Taxa_infraspec;\r
+ } else if (rank.equals(Rank.INFRAGENERICTAXON())) { \r
+ result = Plantae_Abbrev_Taxa_infragen;\r
+ } else if (rank.equals(Rank.INFRASPECIFICTAXON())) { \r
+ result = Plantae_Abbrev_Taxa_infraspec;\r
} else {\r
//TODO Exception\r
logger.warn("Abbreviation for Rank of Kingdom Plantae not supported in CDM: "+ rank.getLabel());\r
}\r
return result;\r
}\r
-\r
- /**\r
- * Returns the NomenclaturalCode for a given TaxonNameBase.\r
- * @param taxonName\r
- * @return\r
- */\r
- public static NomenclaturalCode getNomenclaturalCode(TaxonNameBase taxonName) {\r
- NomenclaturalCode code = null;\r
- if (taxonName.isInstanceOf(ZoologicalName.class)) {\r
- code = NomenclaturalCode.ICZN;\r
- } else if (taxonName.isInstanceOf(BotanicalName.class)) {\r
- code = NomenclaturalCode.ICBN;\r
- } else if (taxonName.isInstanceOf(BacterialName.class)) {\r
- code = NomenclaturalCode.ICNB;\r
-// } else if (taxonName.isInstanceOf(NonViralName.class)) { // Biota\r
-// code = NomenclaturalCode.\r
- } else {\r
- logger.error("NomenclaturalCode could not be determined for this TaxonName: " + taxonName.getUuid() + " (" + taxonName.getTitleCache() + ")");\r
- logger.error("");\r
- }\r
- return code;\r
- }\r
\r
/**\r
* Returns the RankId for a Rank.\r
result = Plantae_Series;\r
} else if (rank.equals(Rank.SUBSERIES())) {\r
result = Plantae_Subseries;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_Aggregate;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_Coll_Species;\r
+ } else if (rank.equals(Rank.SPECIESAGGREGATE() )) {\r
+ result = Plantae_Aggregate;\r
+ } else if (rank.equals(Rank.SPECIESGROUP())) {\r
+ logger.warn("Rank Species Group not yet implemented");\r
+ result = null;\r
+ } else if (rank.getUuid().equals(BerlinModelTransformer.uuidRankCollSpecies)) { \r
+ result = Plantae_Coll_Species;\r
} else if (rank.equals(Rank.SPECIES())) {\r
result = Plantae_Species;\r
} else if (rank.equals(Rank.SUBSPECIES())) {\r
result = Plantae_Subspecies;\r
+ } else if (rank.equals(Rank.GREX())) {\r
+ result = Plantae_Grex;\r
// } else if (rank.equals(Rank.)) { // not yet specified\r
// result = Plantae_Proles;\r
// } else if (rank.equals(Rank.)) { // not yet specified\r
result = Plantae_Subforma;\r
// } else if (rank.equals(Rank.)) { // not yet specified\r
// result = Plantae_Forma_spec;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_Taxa_infragen;\r
-// } else if (rank.equals(Rank.)) { // not yet specified\r
-// result = Plantae_Taxa_infraspec;\r
+ } else if (rank.equals(Rank.INFRAGENERICTAXON())) { \r
+ result = Plantae_Taxa_infragen;\r
+ } else if (rank.equals(Rank.INFRASPECIFICTAXON())) { \r
+ result = Plantae_Taxa_infraspec;\r
} else {\r
//TODO Exception\r
logger.warn("Rank for Kingdom Plantae not yet supported in CDM: "+ rank.getLabel());\r
}else if (status.equals(NomenclaturalStatusType.COMBINATION_INVALID())) {return NAME_ST_STR_COMB_INVAL;\r
}else if (status.equals(NomenclaturalStatusType.LEGITIMATE())) {return NAME_ST_STR_LEGITIMATE;\r
\r
+ }else if (status.getUuid().equals(BerlinModelTransformer.uuidRelNameCombIned)) {return NAME_ST_STR_COMB_INED;\r
+ \r
+ \r
// The following are non-existent in CDM\r
// }else if (status.equals(NomenclaturalStatusType.)) {return NAME_ST_STR_COMB_INED;\r
// }else if (status.equals(NomenclaturalStatusType.)) {return NAME_ST_STR_COMB_AND_STAT_INED;\r
}else if (status.equals(NomenclaturalStatusType.COMBINATION_INVALID())) {return NAME_ST_COMB_INVAL;\r
}else if (status.equals(NomenclaturalStatusType.LEGITIMATE())) {return NAME_ST_LEGITIMATE;\r
\r
+ }else if (status.getUuid().equals(BerlinModelTransformer.uuidRelNameCombIned)) {return NAME_ST_COMB_INED;\r
+ \r
+ \r
// The following are non-existent in CDM\r
-// }else if (status.equals(NomenclaturalStatusType.)) {return NAME_ST_COMB_INED;\r
// }else if (status.equals(NomenclaturalStatusType.)) {return NAME_ST_COMB_AND_STAT_INED;\r
// }else if (status.equals(NomenclaturalStatusType.)) {return NAME_ST_NOM_AND_ORTH_CONS;\r
// }else if (status.equals(NomenclaturalStatusType.)) {return NAME_ST_NOM_NOV_INED;\r
* @param relation\r
* @return\r
*/\r
- public static String taxonRelation2RelTaxonQualifierCache(RelationshipBase<?,?,?> relation){\r
- if (relation == null) {\r
- return null;\r
- }\r
- RelationshipTermBase<?> type = relation.getType();\r
- if (type.equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())) {\r
- return STR_IS_MISAPPLIED_NAME_FOR;\r
- } else if (type.equals(SynonymRelationshipType.SYNONYM_OF())) {\r
- return STR_IS_SYNONYM_OF;\r
- } else if (type.equals(SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF())) {\r
- return STR_IS_HOMOTYPIC_SYNONYM_OF;\r
- } else if (type.equals(SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF())) {\r
- return STR_IS_HETEROTYPIC_SYNONYM_OF;\r
- } else if (type.equals(SynonymRelationshipType.INFERRED_EPITHET_OF())) {\r
- return STR_IS_INFERRED_EPITHET_FOR;\r
- } else if (type.equals(SynonymRelationshipType.INFERRED_GENUS_OF())) {\r
- return STR_IS_INFERRED_GENUS_FOR;\r
- } else if (type.equals(SynonymRelationshipType.POTENTIAL_COMBINATION_OF())) {\r
- return STR_IS_POTENTIAL_COMBINATION_FOR;\r
- } else if (type.equals(NameRelationshipType.BASIONYM())) {\r
- return STR_IS_BASIONYM_FOR;\r
- } else if (type.equals(NameRelationshipType.LATER_HOMONYM())) {\r
- return STR_IS_LATER_HOMONYM_OF;\r
- } else if (type.equals(NameRelationshipType.REPLACED_SYNONYM())) {\r
- return STR_IS_REPLACED_SYNONYM_FOR;\r
- } else if (type.equals(NameRelationshipType.VALIDATED_BY_NAME())) {\r
- return STR_IS_VALIDATION_OF;\r
- } else if (type.equals(NameRelationshipType.LATER_VALIDATED_BY_NAME())) {\r
- return STR_IS_LATER_VALIDATION_OF;\r
- } else if (type.equals(NameRelationshipType.CONSERVED_AGAINST())) {\r
- return STR_IS_CONSERVED_AGAINST;\r
- } else if (type.equals(NameRelationshipType.TREATED_AS_LATER_HOMONYM())) {\r
- return STR_IS_TREATED_AS_LATER_HOMONYM_OF;\r
- } else if (type.equals(NameRelationshipType.ORTHOGRAPHIC_VARIANT())) {\r
- return STR_IS_ORTHOGRAPHIC_VARIANT_OF;\r
- } else if (type.equals(NameRelationshipType.ALTERNATIVE_NAME())) {\r
- return STR_IS_ALTERNATIVE_NAME_FOR;\r
- } else {\r
- logger.warn("No equivalent RelationshipType found in datawarehouse for: " + type.getTitleCache());\r
- }\r
- \r
- // The following have no equivalent attribute in CDM\r
-// IS_TYPE_OF\r
-// IS_CONSERVED_TYPE_OF\r
-// IS_REJECTED_TYPE_OF\r
-// IS_FIRST_PARENT_OF\r
-// IS_SECOND_PARENT_OF\r
-// IS_FEMALE_PARENT_OF\r
-// IS_MALE_PARENT_OF\r
-// IS_REJECTED_IN_FAVOUR_OF\r
-// HAS_SAME_TYPE_AS\r
-// IS_LECTOTYPE_OF\r
-// TYPE_NOT_DESIGNATED\r
-// IS_PRO_PARTE_SYNONYM_OF\r
-// IS_PARTIAL_SYNONYM_OF\r
-// IS_PRO_PARTE_AND_HOMOTYPIC_SYNONYM_OF\r
-// IS_PRO_PARTE_AND_HETEROTYPIC_SYNONYM_OF\r
-// IS_PARTIAL_AND_HOMOTYPIC_SYNONYM_OF\r
-// IS_PARTIAL_AND_HETEROTYPIC_SYNONYM_OF\r
-\r
- return null;\r
- }\r
- \r
- /**\r
- * Returns the RelTaxonQualifierCache for a given zoological taxonRelation.\r
- * @param relation\r
- * @return\r
- */\r
- public static String zoologicalTaxonRelation2RelTaxonQualifierCache(RelationshipBase<?,?,?> relation){\r
+ public static String taxonRelation2RelTaxonQualifierCache(RelationshipBase<?,?,?> relation, NomenclaturalCode code){\r
if (relation == null) {\r
return null;\r
}\r
} else if (type.equals(SynonymRelationshipType.SYNONYM_OF())) {\r
return STR_IS_SYNONYM_OF;\r
} else if (type.equals(SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF())) {\r
- return "is objective synonym of";\r
+ if (code.equals(NomenclaturalCode.ICZN)){\r
+ return STR_IS_HOMOTYPIC_SYNONYM_OF_ZOOL;\r
+ }else{\r
+ return STR_IS_HOMOTYPIC_SYNONYM_OF;\r
+ }\r
} else if (type.equals(SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF())) {\r
- return "is subjective synonym of";\r
+ if (code.equals(NomenclaturalCode.ICZN)){\r
+ return STR_IS_HETEROTYPIC_SYNONYM_OF_ZOOL;\r
+ }else{\r
+ return STR_IS_HETEROTYPIC_SYNONYM_OF;\r
+ }\r
} else if (type.equals(SynonymRelationshipType.INFERRED_EPITHET_OF())) {\r
return STR_IS_INFERRED_EPITHET_FOR;\r
} else if (type.equals(SynonymRelationshipType.INFERRED_GENUS_OF())) {\r
} else if (type.equals(SynonymRelationshipType.POTENTIAL_COMBINATION_OF())) {\r
return STR_IS_POTENTIAL_COMBINATION_FOR;\r
} else if (type.equals(NameRelationshipType.BASIONYM())) {\r
- return "is original combination for";\r
+ if (code.equals(NomenclaturalCode.ICZN)){\r
+ return STR_IS_BASIONYM_FOR_ZOOL;\r
+ }else{\r
+ return STR_IS_BASIONYM_FOR;\r
+ }\r
} else if (type.equals(NameRelationshipType.LATER_HOMONYM())) {\r
return STR_IS_LATER_HOMONYM_OF;\r
} else if (type.equals(NameRelationshipType.REPLACED_SYNONYM())) {\r