Skip to content

Commit

Permalink
#181 use 19139 instead of 19115-1/2
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 1, 2024
1 parent 28b8887 commit 313df1b
Showing 74 changed files with 167 additions and 124 deletions.
6 changes: 3 additions & 3 deletions R/ISOAbstractObject.R
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ ISOAbstractObject <- R6Class("ISOAbstractObject",
metadataStandardCompliance = TRUE,
xmlElement = "AbstractObject",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
),
encoding = options("encoding"),
@@ -705,7 +705,7 @@ ISOAbstractObject <- R6Class("ISOAbstractObject",
rootXMLAttrs <- rootXMLAttrs[!is.na(rootXMLAttrs)]
}
freeTextAttr <- list("xsi:type" = switch(getMetadataStandard(),
"19115-1/2" = "gmd:PT_FreeText_PropertyType",
"19139" = "gmd:PT_FreeText_PropertyType",
"19115-3" = "lan:PT_FreeText_PropertyType",
))

@@ -1472,7 +1472,7 @@ ISOAbstractObject$getStandardByPrefix = function(prefix){
return(std)
}

ISOAbstractObject$getISOStandard = function(clazz, version = "19115-1/2"){
ISOAbstractObject$getISOStandard = function(clazz, version = "19139"){
std <- NA
if(is.null(clazz$private_fields)) return(std)
if(is.null(clazz$private_fields$xmlNamespacePrefix)) return(std)
2 changes: 1 addition & 1 deletion R/ISOAddress.R
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ ISOAddress <- R6Class("ISOAddress",
private = list(
xmlElement = "CI_Address",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "CIT"
)
),
2 changes: 1 addition & 1 deletion R/ISOAnchor.R
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ ISOAnchor <- R6Class("ISOAnchor",
private = list(
xmlElement = "Anchor",
xmlNamespacePrefix = list(
"19115-1/2" = "GMX",
"19139" = "GMX",
"19115-3" = "GCX"
)
),
2 changes: 1 addition & 1 deletion R/ISOAngle.R
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ ISOAngle <- R6Class("ISOAngle",
private = list(
xmlElement = "Angle",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOApplicationSchemaInformation.R
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ ISOApplicationSchemaInformation <- R6Class("ISOApplicationSchemaInformation",
private = list(
xmlElement = "MD_ApplicationSchemaInformation",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "MAS"
)
),
2 changes: 1 addition & 1 deletion R/ISOBaseBoolean.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOBaseBoolean <- R6Class("ISOBaseBoolean",
private = list(
xmlElement = "Boolean",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOBaseCharacterString.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOBaseCharacterString <- R6Class("ISOBaseCharacterString",
private = list(
xmlElement = "CharacterString",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOBaseDate.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOBaseDate <- R6Class("ISOBaseDate",
private = list(
xmlElement = "Date",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOBaseDateTime.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOBaseDateTime <- R6Class("ISOBaseDateTime",
private = list(
xmlElement = "DateTime",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOBaseDecimal.R
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ ISOBaseDecimal <- R6Class("ISOBaseDecimal",
private = list(
xmlElement = "Decimal",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
),

2 changes: 1 addition & 1 deletion R/ISOBaseInteger.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOBaseInteger <- R6Class("ISOBaseInteger",
private = list(
xmlElement = "Integer",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOBaseReal.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOBaseReal <- R6Class("ISOBaseReal",
private = list(
xmlElement = "Real",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOBinary.R
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ ISOBinary <- R6Class("ISOBinary",
private = list(
xmlElement = "Binary",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOBoundingPolygon.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOBoundingPolygon <- R6Class("ISOBoundingPolygon",
private = list(
xmlElement = "EX_BoundingPolygon",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "GEX"
)
),
2 changes: 1 addition & 1 deletion R/ISOBrowseGraphic.R
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ ISOBrowseGraphic <- R6Class("ISOBrowseGraphic",
private = list(
xmlElement = "MD_BrowseGraphic",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "MCC"
)
),
2 changes: 1 addition & 1 deletion R/ISOCharacterSet.R
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ ISOCharacterSet <- R6Class("ISOCharacterSet",
private = list(
xmlElement = "MD_CharacterSetCode",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "LAN"
)
),
2 changes: 1 addition & 1 deletion R/ISOCitation.R
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ ISOCitation<- R6Class("ISOCitation",
private = list(
xmlElement = "CI_Citation",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "CIT"
)
),
2 changes: 1 addition & 1 deletion R/ISOCitationSeries.R
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ ISOCitationSeries <- R6Class("ISOCitationSeries",
private = list(
xmlElement = "CI_Series",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "CIT"
)
),
2 changes: 1 addition & 1 deletion R/ISOClassification.R
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ ISOClassification <- R6Class("ISOClassification",
private = list(
xmlElement = "MD_ClassificationCode",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "MCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOCodeDefinition.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOCodeDefinition <- R6Class("ISOCodeDefinition",
private = list(
xmlElement = "CodeDefinition",
xmlNamespacePrefix = list(
"19115-1/2" = "GMX"
"19139" = "GMX"
)
),
public = list(
2 changes: 1 addition & 1 deletion R/ISOCodeListDictionary.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOCodeListDictionary <- R6Class("ISOCodeListDictionary",
private = list(
xmlElement = "CodeListDictionary",
xmlNamespacePrefix = list(
"19115-1/2" = "GMX"
"19139" = "GMX"
)
),
public = list(
52 changes: 49 additions & 3 deletions R/ISOCodelistCatalogue.R
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ ISOCodelistCatalogue <- R6Class("ISOCodelistCatalogue",
private = list(
xmlElement = "CT_CodelistCatalogue",
xmlNamespacePrefix = list(
"19115-1/2" = "GMX",
"19139" = "GMX",
"19115-3" = "CAT"
)
),
@@ -37,10 +37,56 @@ ISOCodelistCatalogue <- R6Class("ISOCodelistCatalogue",

#'@description Initializes object
#'@param xml object of class \link{XMLInternalNode-class}
initialize = function(xml = NULL){
super$initialize(xml = xml)
#'@param refFile ref file
initialize = function(xml = NULL, refFile = NULL){
if(!is.null(refFile)){
xml = XML::xmlParse(refFile)
xml <- methods::as(xml, "character")
xml <- gsub("<!--.*?-->", "", xml)
xml <- XML::xmlParse(xml, asText = TRUE)
}
if(!is.null(xml)){
super$initialize(xml = xml)
}
},

#'@description Decodes and builds an \code{ISOCodelistCatalogue} from XML. This is done
#'specifically for this class, without using the generic \code{ISOAbstractObject}
#'decoder, to make it fully decodable on package load.
#'@param xml object of class \link{XMLInternalNode-class}
# decode = function(xml){
# message("custom decode")
# xml = XML::xmlRoot(xml)
# children = XML::xmlChildren(xml)
# self$codelistItem = lapply(children[names(children)=="codelistItem"], function(x){
# xml_dict = XML::xmlChildren(x)[[1]]
# the_dict = switch(xmlName(xml_dict),
# "CodeListDictionary" = {
# dict = ISOCodeListDictionary$new(xml = xml_dict)
# xml_dict_c = xmlChildren(xml_dict)
# dict$codeEntry = lapply(xml_dict_c[names(xml_dict_c)=="codeEntry"], function(y){
# xml_ce = XML::xmlChildren(y)[[1]]
# ISOCodeDefinition$new(xml = xml_ce)
# })
# dict
# },
# "CT_Codelist" = {
# cl = ISOCodelist$new(xml = xml_dict)
# xml_cl = xmlChildren(xml_dict)
# 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)
# xml_clval_c = xmlChildren(xml_clval)
# clval$identifier = ISOScopedName$new(xml = xmlChildren(xml_clval_c$name)[[1]])
# })
# cl
# }
# )
# return(the_dict)
# })
# },

#'@description Get codelists. The method ensure an harmonized output made of objects of
#' class \link{ISOCodelist}. In the catalogue is built of objects of class \link{ISOCodeListDictionary}, these
#' will be mapped as \link{ISOCodelist}, to facilitate the consumption of codelists by \pkg{geometa}
2 changes: 1 addition & 1 deletion R/ISOCodelistValueNew.R
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ ISOCodelistValue <- R6Class("ISOCodelistValue",
metadataStandardCompliance = FALSE,
xmlElement = "CT_CodelistValue",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO", #fake to allow codelist value harmonization
"19139" = "GCO", #fake to allow codelist value harmonization
"19115-3" = "CAT"
)
),
2 changes: 1 addition & 1 deletion R/ISOConstraints.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOConstraints<- R6Class("ISOConstraints",
private = list(
xmlElement = "MD_Constraints",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "MCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOContact.R
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ ISOContact <- R6Class("ISOContact",
private = list(
xmlElement = "CI_Contact",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "CIT"
)
),
4 changes: 2 additions & 2 deletions R/ISOCountry.R
Original file line number Diff line number Diff line change
@@ -23,11 +23,11 @@ ISOCountry <- R6Class("ISOCountry",
inherit = ISOCodeListValue,
private = list(
xmlElement = list(
"19115-1/2" = "Country",
"19139" = "Country",
"19115-3" = "CountryCode"
),
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "LAN"
)
),
2 changes: 1 addition & 1 deletion R/ISODate.R
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ ISODate <- R6Class("ISODate",
private = list(
xmlElement = "CI_Date",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "CIT"
)
),
2 changes: 1 addition & 1 deletion R/ISODateType.R
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ ISODateType <- R6Class("ISODateType",
private = list(
xmlElement = "CI_DateTypeCode",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "CIT"
)
),
2 changes: 1 addition & 1 deletion R/ISODistance.R
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ ISODistance <- R6Class("ISODistance",
private = list(
xmlElement = "Distance",
xmlNamespacePrefix = list(
"19115-1/2" = "GCO",
"19139" = "GCO",
"19115-3" = "GCO"
)
),
2 changes: 1 addition & 1 deletion R/ISOExtent.R
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ ISOExtent <- R6Class("ISOExtent",
private = list(
xmlElement = "EX_Extent",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "GEX"
)
),
2 changes: 1 addition & 1 deletion R/ISOFileName.R
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ ISOFileName <- R6Class("ISOFileName",
private = list(
xmlElement = "FileName",
xmlNamespacePrefix = list(
"19115-1/2" = "GMX",
"19139" = "GMX",
"19115-3" = "GCX"
)
),
2 changes: 1 addition & 1 deletion R/ISOFreeText.R
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ ISOFreeText <- R6Class("ISOFreeText",
private = list(
xmlElement = "PT_FreeText",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "LAN"
)
),
2 changes: 1 addition & 1 deletion R/ISOGeographicBoundingBox.R
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ ISOGeographicBoundingBox <- R6Class("ISOGeographicBoundingBox",
private = list(
xmlElement = "EX_GeographicBoundingBox",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "GEX"
)
),
2 changes: 1 addition & 1 deletion R/ISOGeographicDescription.R
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ ISOGeographicDescription <- R6Class("ISOGeographicDescription",
private = list(
xmlElement = "EX_GeographicDescription",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "GEX"
)
),
2 changes: 1 addition & 1 deletion R/ISOGeographicExtent.R
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ ISOGeographicExtent <- R6Class("ISOGeographicExtent",
private = list(
xmlElement = "AbstractEX_GeographicExtent",
xmlNamespacePrefix = list(
"19115-1/2" = "GMD",
"19139" = "GMD",
"19115-3" = "GEX"
)
),
Loading

0 comments on commit 313df1b

Please sign in to comment.