Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AccessRight: 'open','embargoed', 'restricted','closed' #352

Merged
merged 11 commits into from
Sep 6, 2023
4 changes: 2 additions & 2 deletions R/geoflow_validator.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
},

Expand Down Expand Up @@ -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)
}
)
Expand Down
108 changes: 55 additions & 53 deletions doc/Summary_metadata.csv
Original file line number Diff line number Diff line change
@@ -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",,,,,,,,,,,,
34 changes: 32 additions & 2 deletions inst/actions/zen4R_deposit_record.R
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down
Loading