* @param tbSegment
* @param xmlAnnotatable
*/
private void copyDarwinCoreAnnotations(RowSegment tbSegment, Annotatable xmlAnnotatable) {
SpecimenLabel tbSpec = tbSegment.getSpecimenLabel();
Map<String,String> predicateToObjectMap = new HashMap<String,String>();
predicateToObjectMap.put("DwC:institutionCode", tbSpec.getInstAcronym());
predicateToObjectMap.put("DwC:collectionCode", tbSpec.getCollectionCode());
predicateToObjectMap.put("DwC:catalogNumber", tbSpec.getCatalogNumber());
predicateToObjectMap.put("DwC:associatedSequences", tbSpec.getGenBankAccession());
predicateToObjectMap.put("DwC:otherCatalogNumbers", tbSpec.getOtherAccession());
predicateToObjectMap.put("DwC:eventDate", tbSpec.getSampleDateString());
predicateToObjectMap.put("DwC:scientificName", tbSegment.getSpecimenTaxonLabelAsString());
predicateToObjectMap.put("DwC:recordedBy", tbSpec.getCollector());
predicateToObjectMap.put("DwC:country", tbSpec.getCountry());
predicateToObjectMap.put("DwC:locality", tbSpec.getLocality());
predicateToObjectMap.put("DwC:stateProvince", tbSpec.getState());
predicateToObjectMap.put("DwC:datasetName", tbSegment.getTitle());
predicateToObjectMap.put("DwC:occurenceRemarks", tbSpec.getNotes());
for ( String predicate : predicateToObjectMap.keySet() ) {
String objectString = predicateToObjectMap.get(predicate);
if ( ! TreebaseUtil.isEmpty(objectString) ) {
xmlAnnotatable.addAnnotationValue(predicate, Constants.DwCURI, objectString);
}
}
//output geographic latitude in decimal degrees using geodeticDatum spatial reference system
Double latitude = tbSpec.getLatitude();
if ( null != latitude ) {
xmlAnnotatable.addAnnotationValue("DwC:decimalLatitude", Constants.DwCURI, latitude);
}
//output geographic longitude in decimal degrees using geodeticDatum spatial reference system
Double longitude = tbSpec.getLongitude();
if ( null != longitude ) {
xmlAnnotatable.addAnnotationValue("DwC:decimalLongitude", Constants.DwCURI, longitude);
}
//there are two different Darwin Core terms for elevation depending on elevation value
//outputs geographic elevation of sample
Double elevation = tbSpec.getElevation();
if ( null != elevation ) {
if ( elevation >= 0) {
//above local surface in meters
xmlAnnotatable.addAnnotationValue("DwC:verbatimElevation", Constants.DwCURI, elevation);
}