Skip to content

Commit

Permalink
#298 work on ISO 19110
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Feb 21, 2023
1 parent d92fd79 commit 4e47ffa
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
22 changes: 19 additions & 3 deletions inst/actions/geometa_create_iso_19110.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,31 @@ 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")
fc$setVersionNumber(versionNumber)
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
Expand Down Expand Up @@ -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)){
Expand Down
29 changes: 27 additions & 2 deletions inst/metadata/dictionary/dictionary_handler_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down

0 comments on commit 4e47ffa

Please sign in to comment.