From 164df4135f3ed0be1a9d3c893798c63b36396459 Mon Sep 17 00:00:00 2001 From: eblondel Date: Wed, 30 Oct 2019 15:50:24 +0100 Subject: [PATCH] #39 fix wrong logic with the_doi --- R/geoflow_action_geometa_create_iso_19115.R | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/R/geoflow_action_geometa_create_iso_19115.R b/R/geoflow_action_geometa_create_iso_19115.R index 708f926e..93203d11 100644 --- a/R/geoflow_action_geometa_create_iso_19115.R +++ b/R/geoflow_action_geometa_create_iso_19115.R @@ -22,6 +22,11 @@ geometa_create_iso_19115 <- function(entity, config, options){ md <- ISOMetadata$new() mdId <- entity$identifiers[["id"]] md$setFileIdentifier(mdId) + + the_doi <- entity$identifiers[["doi"]] + if(is.null(the_doi)) the_doi <- entity$identifiers[["conceptdoi_to_save"]] + if(is.null(the_doi)) the_doi <- entity$identifiers[["doi_to_save"]] + if(length(entity$relations)>0){ parent_rels <- entity$relations[sapply(entity$relations, function(x){x$key == "parent"})] if(length(parent_rels)>0){ @@ -168,10 +173,7 @@ geometa_create_iso_19115 <- function(entity, config, options){ if(doi){ #methodology to set DOI inspired by NOAA wiki #https://geo-ide.noaa.gov/wiki/index.php?title=DOI_Minting_Procedure#Third.2C_Include_the_DOI_and_citation_text_in_the_ISO_Metadata_Record - the_doi <- entity$identifiers[["doi"]] - if(is.null(the_doi)) the_doi <- entity$identifiers[["conceptdoi_to_save"]] - if(is.null(the_doi)) the_doi <- entity$identifiers[["doi_to_save"]] - if(!is.null(the_doi) & doi){ + if(!is.null(the_doi)){ mdIdentifier <- ISOAnchor$new( name = paste0("doi:", the_doi), href = paste0("http://dx.doi.org/", the_doi)