From 7129c25db4d6b9a0d6d8ac5361414c1d48e1d85d Mon Sep 17 00:00:00 2001 From: eblondel Date: Sat, 30 Nov 2024 02:35:01 +0100 Subject: [PATCH] consolidate csw handler --- inst/metadata/entity/entity_handler_csw.R | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/inst/metadata/entity/entity_handler_csw.R b/inst/metadata/entity/entity_handler_csw.R index 973ae99..7bb2539 100644 --- a/inst/metadata/entity/entity_handler_csw.R +++ b/inst/metadata/entity/entity_handler_csw.R @@ -155,11 +155,17 @@ handle_entities_csw <- function(handler, source, config, handle = TRUE){ if(length(altitles)>0) for(altitle in altitles) entity$setTitle("alternative", altitle) #description entity$setDescription("abstract", rec$identificationInfo[[1]]$abstract) - entity$setDescription("purpose", rec$identificationInfo[[1]]$purpose) + if(!is.null(rec$identificationInfo[[1]]$purpose)) if(!is.na(rec$identificationInfo[[1]]$purpose)){ + entity$setDescription("purpose", rec$identificationInfo[[1]]$purpose) + } credits = rec$identificationInfo[[1]]$credit if(length(credits)>0) entity$setDescription("credit", credits[[1]]) - entity$setDescription("info", rec$identificationInfo[[1]]$supplementalInformation) - entity$setDescription("edition", rec$identificationInfo[[1]]$citation$edition) + if(!is.null(rec$identificationInfo[[1]]$supplementalInformation)) if(!is.na(rec$identificationInfo[[1]]$supplementalInformation)){ + entity$setDescription("info", rec$identificationInfo[[1]]$supplementalInformation) + } + if(!is.null(rec$identificationInfo[[1]]$citation$edition)) if(!is.na(rec$identificationInfo[[1]]$citation$edition)){ + entity$setDescription("edition", rec$identificationInfo[[1]]$citation$edition) + } status = rec$identificationInfo[[1]]$status if(length(status)>0) entity$setDescription("status", status[[1]]$attrs$codeListValue) #subject