From 39641c4cfcc2cd51db29f466beddd0f6114acc8e Mon Sep 17 00:00:00 2001 From: eblondel Date: Thu, 16 Apr 2020 23:44:00 +0200 Subject: [PATCH] adding iso 19110 default minoccurs/maxoccurs options --- R/geoflow_action.R | 4 +++- R/geoflow_action_geometa_create_iso_19110.R | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/R/geoflow_action.R b/R/geoflow_action.R index 9b5dd216..0b46da38 100644 --- a/R/geoflow_action.R +++ b/R/geoflow_action.R @@ -90,7 +90,9 @@ register_actions <- function(){ doi = list(desc = "Add entity DOI - if defined - as metadata identifier and online resource", default = FALSE), exclude_attributes = list(desc = "Attributes that should be excluded from the ISO 19110 production", default = list()), exclude_values_for_attributes = list(desc = "Attribute names for which listed values should not be produced", default = list()), - extra_attributes = list(desc = "Extra attributes to add as feature catalog attributes although not in data", default = list()) + extra_attributes = list(desc = "Extra attributes to add as feature catalog attributes although not in data", default = list()), + default_min_occurs = list(desc = "The default min occurs value for feature attributes cardinality", default = 1L), + default_max_occurs = list(desc = "The default max occurs value for feature attribute cardinality", default = Inf) ) ), geoflow_action$new( diff --git a/R/geoflow_action_geometa_create_iso_19110.R b/R/geoflow_action_geometa_create_iso_19110.R index 405b8577..6c1e09a6 100644 --- a/R/geoflow_action_geometa_create_iso_19110.R +++ b/R/geoflow_action_geometa_create_iso_19110.R @@ -15,6 +15,8 @@ geometa_create_iso_19110 <- function(entity, config, options){ exclude_attributes <- if(!is.null(options$exclude_attributes)) options$exclude_attributes else list() exclude_values_for_attributes <- if(!is.null(options$exclude_values_for_attributes)) options$exclude_values_for_attributes else list() extra_attributes <- if(!is.null(options$extra_attributes)) options$extra_attributes else list() + default_min_occurs <- if(!is.null(options$default_min_occurs)) options$default_min_occurs else 1L + default_max_occurs <- if(!is.null(options$default_max_occurs)) options$default_max_occurs else Inf #feature catalogue creation #----------------------------------------------------------------------------------------------------- @@ -151,8 +153,8 @@ geometa_create_iso_19110 <- function(entity, config, options){ } fat$setMemberName(memberName) fat$setDefinition(fat_attr$def) - minOccurs <- 1L; if(!is.null(fat_attr)) minOccurs <- fat_attr$minOccurs - maxOccurs <- 1L; if(!is.null(fat_attr)) maxOccurs <- fat_attr$maxOccurs + minOccurs <- default_min_occurs; if(!is.null(fat_attr)) minOccurs <- fat_attr$minOccurs + maxOccurs <- default_max_occurs; if(!is.null(fat_attr)) maxOccurs <- fat_attr$maxOccurs if(maxOccurs == "Inf") maxOccurs <- Inf fat$setCardinality(lower = minOccurs, upper = maxOccurs) #code