From ae7ccdaba9d42343b84f0d4b60b9365ec2ea7b11 Mon Sep 17 00:00:00 2001 From: eblondel Date: Tue, 11 Jun 2024 23:00:21 +0200 Subject: [PATCH] #390 manage DOI & HTTP relations as resources --- inst/actions/metadataeditr_create_project.R | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/inst/actions/metadataeditr_create_project.R b/inst/actions/metadataeditr_create_project.R index 42686cc..5a73820 100644 --- a/inst/actions/metadataeditr_create_project.R +++ b/inst/actions/metadataeditr_create_project.R @@ -350,6 +350,33 @@ function(action, entity, config){ } } + #DOI resource + if(!is.null(entity$identifiers[["doi"]])){ + metadataeditr::resources_add( + idno = entity$identifiers[["id"]], + dctype = "web", + title = "DOI", + description = "Digital Object Identifier", + file_path = paste0("http://dx.doi.org/", entity$identifiers[["doi"]]) + ) + } + + #entity HTTP(S) resources + if(length(entity$relations)>0){ + http_relations <- entity$relations[sapply(entity$relations, function(x){ + x$key %in% c("ftp","http", "download") | any(startsWith(x$key, c("wfs", "wms", "wcs", "csw"))) + })] + for(http_relation in http_relations){ + metadataeditr::resources_add( + idno = entity$identifiers[["id"]], + dctype = "web", + title = http_relation$name, + description = http_relation$description, + file_path = http_relation$link + ) + } + } + #files if(depositWithFiles){ #data