Skip to content

Commit

Permalink
refactor ISOCodelistValue -> ISOCTCodelistValue (CAT), ISOCodeListIte…
Browse files Browse the repository at this point in the history
…m -> ISOCodeListValue (GCO)
  • Loading branch information
eblondel committed Dec 31, 2024
1 parent dfe05dc commit 9ce9746
Show file tree
Hide file tree
Showing 110 changed files with 227 additions and 227 deletions.
4 changes: 2 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ export(ISOCitationSeries)
export(ISOClassification)
export(ISOCodeDefinition)
export(ISOCodeListDictionary)
export(ISOCodeListItem)
export(ISOCodeListValue)
export(ISOCodelist)
export(ISOCodelistCatalogue)
export(ISOCodelistValue)
export(ISOCTCodelistValue)
export(ISOCompletenessCommission)
export(ISOCompletenessOmission)
export(ISOConceptualConsistency)
Expand Down
6 changes: 3 additions & 3 deletions R/ISOAbstractObject.R
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ ISOAbstractObject <- R6Class("ISOAbstractObject",
})]

if(!inherits(self, "GMLElement") && !inherits(self, "SWEElement")) cat(crayon::white(paste0("<", crayon::underline(self$getClassName()), ">")))
if(is(self, "ISOCodeListItem")){
if(is(self, "ISOCodeListValue")){
clVal <- self$printAttrs$codeListValue
if("value" %in% names(clVal)) clVal = clVal$value
clDes <- self$codelistId$codeEntry[sapply(self$codelistId$codeEntry, function(ce){
Expand Down Expand Up @@ -361,7 +361,7 @@ ISOAbstractObject <- R6Class("ISOAbstractObject",
}
cat(paste0("\n", paste(rep(shift, depth), collapse=""),"|-- ", crayon::italic(field), " ", attrs_str))
item$print(depth = depth+1, add_codelist_description = add_codelist_description)
if(is(item, "ISOCodeListItem")){
if(is(item, "ISOCodeListValue")){
clVal <- item$printAttrs$codeListValue
clDes <- item$codelistId$entries[item$codelistId$entries$value == clVal,"description"]
cat(paste0(": ", clVal, if(add_codelist_description) crayon::cyan(paste0(" {",clDes,"}")) else ""))
Expand Down Expand Up @@ -1512,7 +1512,7 @@ ISOAbstractObject$getISOClasses = function(extended = FALSE, pretty = FALSE){
if(r6Predicate){
if(!is.null(clazz$classname)){
includePredicate <- !(clazz$classname %in% c("geometaLogger", "INSPIREMetadataValidator",
"ISOCodelist", "ISOCodeListItem", "ISOMetadataNamespace", "ISOTimePeriod","ISOAttributes",
"ISOCodelist", "ISOCodeListValue", "ISOMetadataNamespace", "ISOTimePeriod","ISOAttributes",
"pivot_format"))
}
}
Expand Down
4 changes: 2 additions & 2 deletions R/ISOAssociationType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOAssociationType <- R6Class("ISOAssociationType",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "DS_AssociationTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOAssociationType <- R6Class("ISOAssociationType",
)

ISOAssociationType$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOAssociationType, labels))
return(ISOCodeListValue$values(ISOAssociationType, labels))
}
4 changes: 2 additions & 2 deletions R/ISOCodelistValue.R → R/ISOCTCodelistValue.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @name ISOCodelistValue
#' @name ISOCTCodelistValue
#'
#' @docType class
#' @importFrom R6 R6Class
Expand All @@ -14,7 +14,7 @@
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCodelistValue <- R6Class("ISOCodelistValue",
ISOCTCodelistValue <- R6Class("ISOCTCodelistValue",
inherit = ISOAbstractObject,
private = list(
metadataStandardCompliance = FALSE,
Expand Down
4 changes: 2 additions & 2 deletions R/ISOCellGeometry.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCellGeometry <- R6Class("ISOCellGeometry",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MD_CellGeometryCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOCellGeometry <- R6Class("ISOCellGeometry",
)

ISOCellGeometry$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOCellGeometry, labels))
return(ISOCodeListValue$values(ISOCellGeometry, labels))
}
4 changes: 2 additions & 2 deletions R/ISOCharacterSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCharacterSet <- R6Class("ISOCharacterSet",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MD_CharacterSetCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOCharacterSet <- R6Class("ISOCharacterSet",
)

ISOCharacterSet$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOCharacterSet, labels))
return(ISOCodeListValue$values(ISOCharacterSet, labels))
}
4 changes: 2 additions & 2 deletions R/ISOClassification.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOClassification <- R6Class("ISOClassification",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MD_ClassificationCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOClassification <- R6Class("ISOClassification",
)

ISOClassification$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOClassification, labels))
return(ISOCodeListValue$values(ISOClassification, labels))
}
8 changes: 4 additions & 4 deletions R/ISOCodeDefinition.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ ISOCodeDefinition <- R6Class("ISOCodeDefinition",
super$initialize(xml = xml)
},

#'@description Converts to \link{ISOCodelistValue}
#'@return object of class \link{ISOCodelistValue}
toISOCodelistValue = function(){
clv = ISOCodelistValue$new()
#'@description Converts to \link{ISOCTCodelistValue}
#'@return object of class \link{ISOCTCodelistValue}
toISOCTCodelistValue = function(){
clv = ISOCTCodelistValue$new()
clv$identifier = self$identifier$value
clv$description = self$description$value
return(clv)
Expand Down
2 changes: 1 addition & 1 deletion R/ISOCodeListDictionary.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ISOCodeListDictionary <- R6Class("ISOCodeListDictionary",
cl$identifier = identifier
cl$description = self$description$value
cl$codeEntry = lapply(self$codeEntry, function(codeEntry){
codeEntry$toISOCodelistValue()
codeEntry$toISOCTCodelistValue()
})
return(cl)
}
Expand Down
8 changes: 4 additions & 4 deletions R/ISOCodeListItem.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @name ISOCodeListItem
#' @name ISOCodeListValue
#'
#' @docType class
#' @importFrom R6 R6Class
Expand All @@ -14,7 +14,7 @@
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCodeListItem <- R6Class("ISOCodeListItem",
ISOCodeListValue <- R6Class("ISOCodeListValue",
inherit = ISOAbstractObject,
private = list(
printAttrs = list(),
Expand All @@ -31,7 +31,7 @@ ISOCodeListItem <- R6Class("ISOCodeListItem",
#'@field valueDescription value description
valueDescription = NULL,

#'@description Method used to instantiate an \link{ISOCodeListItem}. By default,
#'@description Method used to instantiate an \link{ISOCodeListValue}. By default,
#' \code{addCodeListAttrs = TRUE}, to add codelist atributes to root XML. The
#' parameter \code{addCodeSpaceAttr = TRUE} by default, and ignored if the valueof
#' \code{addCodeLisAttrs} is set to \code{FALSE}. The argument \code{setValue}
Expand Down Expand Up @@ -154,7 +154,7 @@ ISOCodeListItem <- R6Class("ISOCodeListItem",
)
)

ISOCodeListItem$values = function(class, labels = FALSE){
ISOCodeListValue$values = function(class, labels = FALSE){
fields <- "value"
if(labels) fields <- c(fields, "name", "description")
element <- class$private_fields$xmlElement
Expand Down
6 changes: 3 additions & 3 deletions R/ISOCodelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ISOCodelist <- R6Class("ISOCodelist",
codeEntry <- codeEntry[,c("alpha3", "english", "english")]
colnames(codeEntry) <- c("value","name", "description")
self$codeEntry = lapply(1:nrow(codeEntry), function(i){
clv = ISOCodelistValue$new()
clv = ISOCTCodelistValue$new()
clv$identifier = codeEntry[i,]$value; clv$description = codeEntry[i,]$description
return(clv)
})
Expand Down Expand Up @@ -163,7 +163,7 @@ ISOCodelist <- R6Class("ISOCodelist",
}))
colnames(codeEntry) <- c("value", "name", "description")
self$codeEntry = lapply(1:nrow(codeEntry), function(i){
clv = ISOCodelistValue$new()
clv = ISOCTCodelistValue$new()
clv$identifier = codeEntry[i,]$value; clv$description = codeEntry[i,]$description;
return(clv)
})
Expand Down Expand Up @@ -267,7 +267,7 @@ getISOCodelists <- function(){
clazz <- eval(parse(text=classname))
if(is(clazz, "R6ClassGenerator")){
if(!is.null(clazz$inherit)){
if(clazz$inherit == "ISOCodeListItem"){
if(clazz$inherit == "ISOCodeListValue"){
cl_classes <- c(cl_classes, clazz)
}
}
Expand Down
2 changes: 1 addition & 1 deletion R/ISOCodelistCatalogue.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ISOCodelistCatalogue <- R6Class("ISOCodelistCatalogue",
# cl$identifier = ISOScopedName$new(xml = xmlChildren(xml_cl$name)[[1]])
# cl$codeEntry = lapply(xml_cl[names(xml_cl)=="codeEntry"], function(y){
# xml_clval = XML::xmlChildren(y)[[1]]
# clval = ISOCodelistValue$new(xml = xml_clval)
# clval = ISOCTCodelistValue$new(xml = xml_clval)
# xml_clval_c = xmlChildren(xml_clval)
# clval$identifier = ISOScopedName$new(xml = xmlChildren(xml_clval_c$name)[[1]])
# })
Expand Down
4 changes: 2 additions & 2 deletions R/ISOCountry.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCountry <- R6Class("ISOCountry",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = list(
"19139" = "Country",
Expand All @@ -47,5 +47,5 @@ ISOCountry <- R6Class("ISOCountry",
)

ISOCountry$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOCountry, labels))
return(ISOCodeListValue$values(ISOCountry, labels))
}
4 changes: 2 additions & 2 deletions R/ISOCouplingType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOCouplingType <- R6Class("ISOCouplingType",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "SV_CouplingType",
xmlNamespacePrefix = "SRV"
Expand All @@ -41,5 +41,5 @@ ISOCouplingType <- R6Class("ISOCouplingType",
)

ISOCouplingType$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOCouplingType, labels))
return(ISOCodeListValue$values(ISOCouplingType, labels))
}
4 changes: 2 additions & 2 deletions R/ISOCoverageContentType.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#' - 19115-3 \url{https://schemas.isotc211.org/19115/-3/mrc/1.0/mrc/#element_MD_CoverageContentTypeCode}
#'
ISOCoverageContentType <- R6Class("ISOCoverageContentType",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MD_CoverageContentTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -51,5 +51,5 @@ ISOCoverageContentType <- R6Class("ISOCoverageContentType",
)

ISOCoverageContentType$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOCoverageContentType, labels))
return(ISOCodeListValue$values(ISOCoverageContentType, labels))
}
4 changes: 2 additions & 2 deletions R/ISODCPList.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODCPList <- R6Class("ISODCPList",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "DCPList",
xmlNamespacePrefix = "SRV"
Expand All @@ -41,5 +41,5 @@ ISODCPList <- R6Class("ISODCPList",
)

ISODCPList$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISODCPList, labels))
return(ISOCodeListValue$values(ISODCPList, labels))
}
4 changes: 2 additions & 2 deletions R/ISODatatype.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODatatype <- R6Class("ISODatatype",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MD_DatatypeCode",
xmlNamespacePrefix = "GMD"
Expand All @@ -39,5 +39,5 @@ ISODatatype <- R6Class("ISODatatype",
)

ISODatatype$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISODatatype, labels))
return(ISOCodeListValue$values(ISODatatype, labels))
}
4 changes: 2 additions & 2 deletions R/ISODateType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODateType <- R6Class("ISODateType",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "CI_DateTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISODateType <- R6Class("ISODateType",
)

ISODateType$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISODateType, labels))
return(ISOCodeListValue$values(ISODateType, labels))
}
4 changes: 2 additions & 2 deletions R/ISODimensionNameType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODimensionNameType <- R6Class("ISODimensionNameType",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MD_DimensionNameTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISODimensionNameType <- R6Class("ISODimensionNameType",
)

ISODimensionNameType$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISODimensionNameType, labels))
return(ISOCodeListValue$values(ISODimensionNameType, labels))
}
2 changes: 1 addition & 1 deletion R/ISODistributionUnits.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISODistributionUnits <- R6Class("ISODistributionUnits",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MD_DistributionUnits",
xmlNamespacePrefix = "GMD"
Expand Down
4 changes: 2 additions & 2 deletions R/ISOEvaluationMethodType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOEvaluationMethodType <- R6Class("ISOEvaluationMethodType",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "DQ_EvaluationMethodTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOEvaluationMethodType <- R6Class("ISOEvaluationMethodType",
)

ISOEvaluationMethodType$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOEvaluationMethodType, labels))
return(ISOCodeListValue$values(ISOEvaluationMethodType, labels))
}
4 changes: 2 additions & 2 deletions R/ISOGeometricObjectType.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOGeometricObjectType <- R6Class("ISOGeometricObjectType",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MD_GeometricObjectTypeCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOGeometricObjectType <- R6Class("ISOGeometricObjectType",
)

ISOGeometricObjectType$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOGeometricObjectType, labels))
return(ISOCodeListValue$values(ISOGeometricObjectType, labels))
}
4 changes: 2 additions & 2 deletions R/ISOImageryBandDefinition.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOImageryBandDefinition <- R6Class("ISOImageryBandDefinition",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MI_BandDefinition",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOImageryBandDefinition <- R6Class("ISOImageryBandDefinition",
)

ISOImageryBandDefinition$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOImageryBandDefinition, labels))
return(ISOCodeListValue$values(ISOImageryBandDefinition, labels))
}
4 changes: 2 additions & 2 deletions R/ISOImageryContext.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOImageryContext <- R6Class("ISOImageryContext",
inherit = ISOCodeListItem,
inherit = ISOCodeListValue,
private = list(
xmlElement = "MI_ContextCode",
xmlNamespacePrefix = list(
Expand All @@ -44,5 +44,5 @@ ISOImageryContext <- R6Class("ISOImageryContext",
)

ISOImageryContext$values <- function(labels = FALSE){
return(ISOCodeListItem$values(ISOImageryContext, labels))
return(ISOCodeListValue$values(ISOImageryContext, labels))
}
Loading

0 comments on commit 9ce9746

Please sign in to comment.