diff --git a/inst/actions/geometa_create_iso_19110.R b/inst/actions/geometa_create_iso_19110.R index a654d60..1ceebef 100644 --- a/inst/actions/geometa_create_iso_19110.R +++ b/inst/actions/geometa_create_iso_19110.R @@ -28,8 +28,13 @@ function(action, entity, config){ fcIdentifier <- paste0(entity$identifiers[["id"]],"_dsd") #produce feature catalogue fc <- ISOFeatureCatalogue$new(uuid = fcIdentifier) - fc$setName(paste0(entity$titles[["title"]], " - Feature Catalogue")) - fc$addFieldOfApplication("Open Science") + fc_title_locales <- geoflow::get_locales_from(entity$titles[["title"]]) + if(!is.null(fc_title_locales)){ + fc_title_locale_names <- names(fc_title_locales) + fc_title_locales <- lapply(fc_title_locales, function(x){paste0(x, " - Feature Catalogue")}) + names(fc_title_locales) <- fc_title_locale_names + } + fc$setName(paste0(entity$titles[["title"]], " - Feature Catalogue"), locales = fc_title_locales) fc$addFieldOfApplication("FAIR") versionDate <- as.POSIXct(Sys.time()) versionNumber <- format(versionDate, "%Y%m%dT%H%M%S") @@ -37,6 +42,17 @@ function(action, entity, config){ fc$setVersionDate(versionDate) fc$setFunctionalLanguage(entity$language) + #locales (i18n/i10n support) + if(length(entity$locales)>0){ + for(locale in entity$locales){ + a_locale <- ISOLocale$new() + a_locale$setId(locale) + a_locale$setLanguage(locale) + a_locale$setCharacterSet("utf8") + fc$addLocale(a_locale) + } + } + #add scopes #-------------------------------------------------------------------------- #-> geoflow scope @@ -77,7 +93,7 @@ function(action, entity, config){ res$setLinkage(main_entity$websiteUrl) res$setName(main_entity$websiteName) contact$setOnlineResource(res) - producer$setContactInfo(contact) + producer$setContactInfo(contact) orcid = main_entity$identifiers[["orcid"]] if(!is.null(orcid)){ diff --git a/inst/metadata/dictionary/dictionary_handler_df.R b/inst/metadata/dictionary/dictionary_handler_df.R index a60adcd..a786944 100644 --- a/inst/metadata/dictionary/dictionary_handler_df.R +++ b/inst/metadata/dictionary/dictionary_handler_df.R @@ -31,11 +31,36 @@ handle_dictionary_df <- function(config, source){ if(!is.na(defSource)){ defSource <- geoflow::extract_kvp(paste0("str:",defSource))$values[[1]] } + + #memberName + src_membername <- geoflow::sanitize_str(ftm$MemberName) + memberName <- src_membername + if(!is.na(src_membername)){ + if(!startsWith(src_membername, "name:")) src_membername <- paste0("name:", src_membername) + } + membernames <- if(!is.na(src_membername)) geoflow::extract_cell_components(src_membername) else list() + if(length(membernames)>0){ + kvps <- geoflow::extract_kvps(membernames, collapse=",") + memberName <- kvps[[1]]$values + } + + #definition + src_memberdef <- geoflow::sanitize_str(ftm$Definition) + memberDef <- src_memberdef + if(!is.na(src_memberdef)){ + if(!startsWith(src_memberdef, "def:")) src_memberdef <- paste0("def:", src_memberdef) + } + memberdefs <- if(!is.na(src_memberdef)) geoflow::extract_cell_components(src_memberdef) else list() + if(length(memberdefs)>0){ + kvps <- geoflow::extract_kvps(memberdefs, collapse=",") + memberDef <- kvps[[1]]$values + } + member <- geoflow::geoflow_featuremember$new( type = ftm$MemberType, code = ftm$MemberCode, - name = ftm$MemberName, - def = ftm$Definition, + name = memberName, #i18n support + def = memberDef, #i18n support defSource = defSource, registerId = ftm$RegisterId )