Skip to content

Commit

Permalink
#39 fix wrong logic with the_doi
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 30, 2019
1 parent b579974 commit 164df41
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions R/geoflow_action_geometa_create_iso_19115.R
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 164df41

Please sign in to comment.