diff --git a/R/geoflow_validator.R b/R/geoflow_validator.R index 1e3a246..da85930 100644 --- a/R/geoflow_validator.R +++ b/R/geoflow_validator.R @@ -456,7 +456,7 @@ geoflow_validator_entity_Date <- R6Class("geoflow_validator_entity_Date", #'@param j col index (internal index to be used for graphical \pkg{geoflow} validation handlers) #'@param str string to validate initialize = function(i, j, str){ - valid_keys <- list("creation","publication","edition") + valid_keys <- list("creation","publication","edition","embargo") super$initialize(TRUE,TRUE, TRUE, valid_keys, "creation",FALSE, TRUE, TRUE, i, j, as(str,"character")) }, @@ -763,7 +763,7 @@ geoflow_validator_entity_Rights <- R6Class("geoflow_validator_entity_Rights", #'@param j col index (internal index to be used for graphical \pkg{geoflow} validation handlers) #'@param str string to validate initialize = function(i, j, str){ - valid_keys <- list("license","use","useLimitation", "useConstraint", "accessConstraint", "otherConstraint") + valid_keys <- list("license","use","useLimitation", "useConstraint", "accessConstraint", "otherConstraint", "accessRight", "accessConditions") super$initialize(TRUE,TRUE, TRUE, valid_keys, NULL,TRUE, FALSE, TRUE, i, j, str) } ) diff --git a/doc/Summary_metadata.csv b/doc/Summary_metadata.csv index be1e815..dfe4171 100644 --- a/doc/Summary_metadata.csv +++ b/doc/Summary_metadata.csv @@ -1,53 +1,55 @@ -element,key,i18n_elegible,i18n_supported,geometa_create_iso_19115,geometa_create_iso_19110,geonapi_publish_iso_19139,ows4R_publish_iso_19139,geosapi_publish_ogc_services,zen4R_deposit_record,eml_create_eml,atom4R_dataverse_deposit_record,dataone_upload_datapackage -Identifier,id,,,x,x,x,x,x,x,x,x, -Identifier,doi,,,x,,,,,x,x,x, -Identifier,uuid,,,,,x,x,,,,, -Identifier,packageId,,,,,,,,,,,x -Title,title,x,x,x,x,,,x,x,,, -Title,alternative,x,x,x,x,,,,,,, -Description,abstract,x,x,x,,,,x,x,x,x, -Description,purpose,x,x,x,,,,,,,, -Description,credit,x,x,x,,,,,,,, -Description,info,x,x,x,,,,,x,,, -Description,edition,x,x,x,,,,,x,,, -Description,status,,,x,,,,,,,, -Subject,"[free key, best practice to use ISO keyword types, see `geometa::ISOKeywordType$values()` ]",x,x,x,,,,x,,,, -Creator,owner,,,x,,,,,,x,x, -Creator,metadata,,,x,,,,,,x,, -Creator,pointOfContact,,,x,,,,,,x,, -Creator,publisher,,,x,,,,,,x,x, -Creator,processor,,,x,,,,,,,, -Date,publication,,,x,,,,,x,x,, -Date,creation,,,x,,,,,,,x, -Date,edition,,,x,,,,,,,, -Type,generic,,,x,,,,,x,,x, -Type,zenodoUploadType,,,,,,,,x,,, -Type,zenodoPublicationType,,,,,,,,x,,, -Type,zenodoImageType,,,,,,,,x,,, -Language,,,,x,,,,,,x,, -SpatialCoverage,ewkt,,,x,,,,x,,,, -SpatialCoverage,wkt,,,x,,,,x,,,, -SpatialCoverage,srid,,,x,,,,x,,,, -TemporalCoverage,,,,x,,,,,,,, -Relation,thumbnail,x,,x,,,,,,x,, -Relation,resource,x,,x,,,,,,,, -Relation,parent,,,x,,,,,,x,, -Relation,ftp,x,,x,,,,,,x,, -Relation,http,x,,x,,,,,,x,, -Relation,download,x,,x,,,,,,x,, -Relation,wms,,,x,,,,,,x,, -Relation,wfs,,,x,,,,,,x,, -Relation,wcs,,,x,,,,,,,, -Relation,ref,x,,,,,,,x,,, -Relation,grant,,,,,,,,x,,, -Rights,use,x,x,x,,,,,,,, -Rights,useLimitation,x,x,x,,,,,,,, -Rights,useConstraint,,,x,,,,,,x,x, -Rights,accessConstraint,,,x,,,,,,x,, -Rights,otherConstraint,x,x,x,,,,,,x,, -Rights,license,x,x,x,,,,,x,x,,x -Provenance,statement,x,x,x,,,,,,,, -Provenance,process,x,x,x,,,,,,,, -Format,ressource,,,x,,,,,,,, -Format,distribution,,,x,,,,,,,, -Data,,,,,,,,,,,, +"element","key","i18n_elegible","i18n_supported","geometa_create_iso_19115","geometa_create_iso_19110","geonapi_publish_iso_19139","ows4R_publish_iso_19139","geosapi_publish_ogc_services","zen4R_deposit_record","eml_create_eml","atom4R_dataverse_deposit_record","dataone_upload_datapackage" +"Identifier","id",,,"x","x","x","x","x","x","x","x", +"Identifier","doi",,,"x",,,,,"x","x","x", +"Identifier","uuid",,,,,"x","x",,,,, +"Identifier","packageId",,,,,,,,,,,"x" +"Title","title","x","x","x","x",,,"x","x",,, +"Title","alternative","x","x","x","x",,,,,,, +"Description","abstract","x","x","x",,,,"x","x","x","x", +"Description","purpose","x","x","x",,,,,,,, +"Description","credit","x","x","x",,,,,,,, +"Description","info","x","x","x",,,,,,,, +"Description","edition","x","x","x",,,,,"x",,, +"Description","status",,,"x",,,,,,,, +"Subject","[free key, best practice to use ISO keyword types, see `geometa::ISOKeywordType$values()` ]","x","x","x",,,,"x",,,, +"Creator","owner",,,"x",,,,,,"x","x", +"Creator","metadata",,,"x",,,,,,"x",, +"Creator","pointOfContact",,,"x",,,,,,"x",, +"Creator","publisher",,,"x",,,,,,"x","x", +"Creator","processor",,,"x",,,,,,,, +"Date","publication",,,"x",,,,,"x","x",, +"Date","creation",,,"x",,,,,,,"x", +"Date","edition",,,"x",,,,,,,, +"Date","embargo",,,,,,,,"x",,, +"Type","generic",,,"x",,,,,"x",,"x", +"Type","zenodoUploadType",,,,,,,,"x",,, +"Type","zenodoPublicationType",,,,,,,,"x",,, +"Type","zenodoImageType",,,,,,,,"x",,, +"Language",,,,"x",,,,,,"x",, +"SpatialCoverage","ewkt",,,"x",,,,"x",,,, +"SpatialCoverage","wkt",,,"x",,,,"x",,,, +"SpatialCoverage","srid",,,"x",,,,"x",,,, +"TemporalCoverage",,,,"x",,,,,,,, +"Relation","thumbnail","x",,"x",,,,,,"x",, +"Relation","resource","x",,"x",,,,,,,, +"Relation","parent",,,"x",,,,,,"x",, +"Relation","ftp","x",,"x",,,,,,"x",, +"Relation","http","x",,"x",,,,,,"x",, +"Relation","wms",,,"x",,,,,,"x",, +"Relation","wfs",,,"x",,,,,,"x",, +"Relation","wcs",,,"x",,,,,,,, +"Relation","ref","x",,,,,,,"x",,, +"Relation","grant",,,,,,,,"x",,, +"Rights","use","x","x","x",,,,,,,, +"Rights","useLimitation","x","x","x",,,,,,,, +"Rights","useConstraint",,,"x",,,,,,"x","x", +"Rights","accessConstraint",,,"x",,,,,,"x",, +"Rights","otherConstraint","x","x","x",,,,,,"x",, +"Rights","license","x","x","x",,,,,"x","x",,"x" +"Rights","accessRight",,,,,,,,"x",,, +"Rights","accessConditions",,,,,,,,"x",,, +"Provenance","statement","x","x","x",,,,,,,, +"Provenance","process","x","x","x",,,,,,,, +"Format","ressource",,,"x",,,,,,,, +"Format","distribution",,,"x",,,,,,,, +"Data",,,,,,,,,,,, \ No newline at end of file diff --git a/inst/actions/zen4R_deposit_record.R b/inst/actions/zen4R_deposit_record.R index 4e32428..cce07ce 100644 --- a/inst/actions/zen4R_deposit_record.R +++ b/inst/actions/zen4R_deposit_record.R @@ -233,8 +233,38 @@ function(action, entity, config){ } } } - - #TODO myrec$setAccessRight + + # AccessRight + # Access right with the following values: 'open','embargoed', 'restricted','closed' + if(length(entity$rights)>0){ + accessRights <- entity$rights[sapply(entity$rights, function(x){tolower(x$key) == "accessright"})] + config$logger.info(sprintf("accessRight: '%s'", accessRights)) + if(length(accessRights)>0){ + accessRight <- accessRights[[1]]$values[[1]] + config$logger.info(sprintf("accessRight Value: '%s'", accessRight)) + zenodo_metadata$setAccessRight(accessRight)- + if ("embargoed" %in% accessRight) { + config$logger.info(sprintf("Embargoed! Looking for embargoed date...")) + # embargoDate <- as.Date(entity$dates[sapply(entity$dates, function(x){tolower(x$key) == "embargo"})][[1]]$values[[1]]) + embargoDates <- entity$dates[sapply(entity$dates, function(date){date$key == "embargo"})] + embargoDate <- if(length(embargoDates)>0) embargoDates[[1]]$values[[1]] else config$logger.error(sprintf("Zenodo: 'embargo' not set in entity$dates whereas 'embargoed' is set in entity$rights. Please check your entities !")) + zenodo_metadata$setEmbargoDate(embargoDate) + } + else if ("restricted" %in% accessRight) { + config$logger.info(sprintf("Restricted! :/ :/ Looking for accessConditions...")) + accessConditions <- entity$rights[sapply(entity$rights, function(x){tolower(x$key) == "accessconditions"})][[1]]$values[[1]] + zenodo_metadata$setAccessConditions(accessConditions) + } + } + else{ + config$logger.info(sprintf("Zenodo: accessRight specified in entity not available. accessRight will be set to open!")) + zenodo_metadata$setAccessRight("open") + } + } + else{ + config$logger.info(sprintf("Zenodo: Rights is empty. accessRight will be set to open!")) + zenodo_metadata$setAccessRight("open") + } #references if(length(entity$relations)>0){