Skip to content

Commit 4e47ffa

Browse files
committed
#298 work on ISO 19110
1 parent d92fd79 commit 4e47ffa

File tree

2 files changed

+46
-5
lines changed

2 files changed

+46
-5
lines changed

inst/actions/geometa_create_iso_19110.R

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,31 @@ function(action, entity, config){
2828
fcIdentifier <- paste0(entity$identifiers[["id"]],"_dsd")
2929
#produce feature catalogue
3030
fc <- ISOFeatureCatalogue$new(uuid = fcIdentifier)
31-
fc$setName(paste0(entity$titles[["title"]], " - Feature Catalogue"))
32-
fc$addFieldOfApplication("Open Science")
31+
fc_title_locales <- geoflow::get_locales_from(entity$titles[["title"]])
32+
if(!is.null(fc_title_locales)){
33+
fc_title_locale_names <- names(fc_title_locales)
34+
fc_title_locales <- lapply(fc_title_locales, function(x){paste0(x, " - Feature Catalogue")})
35+
names(fc_title_locales) <- fc_title_locale_names
36+
}
37+
fc$setName(paste0(entity$titles[["title"]], " - Feature Catalogue"), locales = fc_title_locales)
3338
fc$addFieldOfApplication("FAIR")
3439
versionDate <- as.POSIXct(Sys.time())
3540
versionNumber <- format(versionDate, "%Y%m%dT%H%M%S")
3641
fc$setVersionNumber(versionNumber)
3742
fc$setVersionDate(versionDate)
3843
fc$setFunctionalLanguage(entity$language)
3944

45+
#locales (i18n/i10n support)
46+
if(length(entity$locales)>0){
47+
for(locale in entity$locales){
48+
a_locale <- ISOLocale$new()
49+
a_locale$setId(locale)
50+
a_locale$setLanguage(locale)
51+
a_locale$setCharacterSet("utf8")
52+
fc$addLocale(a_locale)
53+
}
54+
}
55+
4056
#add scopes
4157
#--------------------------------------------------------------------------
4258
#-> geoflow scope
@@ -77,7 +93,7 @@ function(action, entity, config){
7793
res$setLinkage(main_entity$websiteUrl)
7894
res$setName(main_entity$websiteName)
7995
contact$setOnlineResource(res)
80-
producer$setContactInfo(contact)
96+
producer$setContactInfo(contact)
8197

8298
orcid = main_entity$identifiers[["orcid"]]
8399
if(!is.null(orcid)){

inst/metadata/dictionary/dictionary_handler_df.R

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,36 @@ handle_dictionary_df <- function(config, source){
3131
if(!is.na(defSource)){
3232
defSource <- geoflow::extract_kvp(paste0("str:",defSource))$values[[1]]
3333
}
34+
35+
#memberName
36+
src_membername <- geoflow::sanitize_str(ftm$MemberName)
37+
memberName <- src_membername
38+
if(!is.na(src_membername)){
39+
if(!startsWith(src_membername, "name:")) src_membername <- paste0("name:", src_membername)
40+
}
41+
membernames <- if(!is.na(src_membername)) geoflow::extract_cell_components(src_membername) else list()
42+
if(length(membernames)>0){
43+
kvps <- geoflow::extract_kvps(membernames, collapse=",")
44+
memberName <- kvps[[1]]$values
45+
}
46+
47+
#definition
48+
src_memberdef <- geoflow::sanitize_str(ftm$Definition)
49+
memberDef <- src_memberdef
50+
if(!is.na(src_memberdef)){
51+
if(!startsWith(src_memberdef, "def:")) src_memberdef <- paste0("def:", src_memberdef)
52+
}
53+
memberdefs <- if(!is.na(src_memberdef)) geoflow::extract_cell_components(src_memberdef) else list()
54+
if(length(memberdefs)>0){
55+
kvps <- geoflow::extract_kvps(memberdefs, collapse=",")
56+
memberDef <- kvps[[1]]$values
57+
}
58+
3459
member <- geoflow::geoflow_featuremember$new(
3560
type = ftm$MemberType,
3661
code = ftm$MemberCode,
37-
name = ftm$MemberName,
38-
def = ftm$Definition,
62+
name = memberName, #i18n support
63+
def = memberDef, #i18n support
3964
defSource = defSource,
4065
registerId = ftm$RegisterId
4166
)

0 commit comments

Comments
 (0)