Skip to content

Commit

Permalink
#298 impl for description fields + test ISO 19115
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Dec 20, 2022
1 parent e2c0fae commit 36a444f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion R/geoflow_validator.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ geoflow_validator_cell <- R6Class("geoflow_validator_cell",
}
}
}
if("locale" %in% names(kvp)){
if("locale" %in% names(kvp)) if(!is.null(kvp$locale)){
if(nchar(kvp$locale)!= 2){
report <- rbind(report, data.frame(type = "ERROR", message = sprintf("Locale value '%s' is invalid, it should be a locale ISO 2 code", kvp$locale)))
}
Expand Down
8 changes: 4 additions & 4 deletions inst/actions/geometa_create_iso_19115.R
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ function(action, entity, config){

#Data identification
ident <- ISODataIdentification$new()
ident$setAbstract(entity$descriptions[["abstract"]])
ident$setPurpose(entity$descriptions[["purpose"]])
ident$addCredit(entity$descriptions[["credit"]])
ident$setAbstract(entity$descriptions[["abstract"]], locales = geoflow::get_locales_from(entity$descriptions[["abstract"]]))
ident$setPurpose(entity$descriptions[["purpose"]], locales = geoflow::get_locales_from(entity$descriptions[["purpose"]]))
ident$addCredit(entity$descriptions[["credit"]], locales = geoflow::get_locales_from(entity$descriptions[["credit"]]))
ident$addStatus(entity$descriptions[["status"]])
ident$addLanguage(entity$language)
ident$addCharacterSet("utf8")
Expand Down Expand Up @@ -510,7 +510,7 @@ function(action, entity, config){
ident$addKeywords(kwds)
}

ident$setSupplementalInformation(entity$descriptions[["info"]])
ident$setSupplementalInformation(entity$descriptions[["info"]], locales = geoflow::get_locales_from(entity$descriptions[["info"]]))
if(!is.null(entity$data)) ident$addSpatialRepresentationType(entity$data$spatialRepresentationType)
md$identificationInfo = c(md$identificationInfo,ident)

Expand Down
11 changes: 3 additions & 8 deletions inst/metadata/entity/entity_handler_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,9 @@ handle_entities_df <- function(config, source){
}
descriptions <- if(!is.na(src_description)) extract_cell_components(src_description) else list()
if(length(descriptions)>0){
if(length(descriptions)==1){
des_kvp <- extract_kvp(descriptions)
entity$setDescription("abstract", paste(des_kvp$values, collapse=","))
}else{
for(description in descriptions){
des_kvp <- extract_kvp(description)
entity$setDescription(des_kvp$key, paste(des_kvp$values, collapse=","))
}
kvps <- extract_kvps(descriptions, collapse=",")
for(kvp in kvps){
entity$setDescription(kvp$key, kvp$values)
}
}

Expand Down

0 comments on commit 36a444f

Please sign in to comment.