Skip to content

Commit

Permalink
#181 support M5 - MRL classes
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 8, 2024
1 parent a9e0948 commit 2c0427f
Show file tree
Hide file tree
Showing 16 changed files with 798 additions and 92 deletions.
4 changes: 3 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,13 @@ export(ISOOperationChainMetadata)
export(ISOOperationMetadata)
export(ISOOrganisation)
export(ISOOtherAggregate)
export(ISOParameter)
export(ISOParameterDirection)
export(ISOPeriodDuration)
export(ISOPixelOrientation)
export(ISOPlatform)
export(ISOPortrayalCatalogueReference)
export(ISOPresentationForm)
export(ISOProcessParameter)
export(ISOProcessStep)
export(ISOProductionSeries)
export(ISOProgress)
Expand All @@ -340,6 +340,8 @@ export(ISOResponsibleParty)
export(ISORestriction)
export(ISORole)
export(ISORoleType)
export(ISOSRVParameter)
export(ISOSRVParameterDirection)
export(ISOSRVServiceIdentification)
export(ISOSampleDimension)
export(ISOScale)
Expand Down
127 changes: 127 additions & 0 deletions R/ISOAbstractParameter.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,137 @@ ISOAbstractParameter <- R6Class("ISOAbstractParameter",
),
public = list(

#'@field name name [1..1]: character|ISOMemberName
name = NULL,
#'@field direction direction [0..1]: ISOParameterDirection
direction = NULL,
#'@field description description [0..1]: character
description = NULL,
#'@field optionality optionality [1..1]: logical
optionality = FALSE,
#'@field repeatability repeatability [1..1]: logical
repeatability = FALSE,
#'@field valueType valueType [1..1]: ISORecordType
valueType = NULL,
#'@field value value [0..*] : ISORecord
value = list(),
#'@field resource resource [0..*] : ISOSource
resource = list(),

#'@description Initializes object
#'@param xml object of class \link{XMLInternalNode-class}
initialize = function(xml = NULL){
super$initialize(xml = xml)
},

#'@description Set name
#'@param name name
#'@param attributeType attribute type
#'@param locales list of localized texts. Default is \code{NULL}
setName = function(name, attributeType, locales = NULL){
if(!is(attributeType, "ISOMemberName")){
attrType <- ISOMemberName$new()
attrType$setName(attributeType)
if(!is.null(locales)){
attrType$setName(attributeType, locales = locales)
}
attributeType <- attrType
}
self$name <- ISOElementSequence$new(aName = name, attributeType = attributeType)
},

#'@description Set direction
#'@param direction object of class \link{ISOParameterDirection} or \link{character}
#' among values returned by \code{ISOParameterDirection$values()}
setDirection = function(direction){
if(!is(direction, "ISOParameterDirection")){
direction <- ISOParameterDirection$new(value = direction)
}
self$direction <- direction
},

#'@description Set description
#'@param description description
#'@param locales list of localized texts. Default is \code{NULL}
setDescription = function(description, locales = NULL){
self$description <- as.character(description)
if(!is.null(locales)){
self$description <- self$createLocalisedProperty(description, locales)
}
},

#'@description Set optionality
#'@param optional object of class \link{logical}
setOptionality = function(optional){
if(!is(optional, "logical")){
optional <- as.logical(optional)
if(is.na(optional)){
stop("The argument value should be an object of class 'logical' or coercable to 'logical'")
}
}
self$optionality <- optional
},

#'@description Set repeatability
#'@param repeatable object of class \link{logical}
setRepeatability = function(repeatable){
if(!is(repeatable, "logical")){
repeatable <- as.logical(repeatable)
if(is.na(repeatable)){
stop("The argument value should be an object of class 'logical' or coercable to 'logical'")
}
}
self$repeatability <- repeatable
},

#'@description Set value type
#'@param valueType object of class \link{ISORecordType}
setValueType = function(valueType){
if(!is(valueType, "ISORecordType")){
valueType = ISORecordType$new(value = valueType)
}
self$valueType <- valueType
},

#'@description Adds value
#'@param value object of class \link{ISORecord}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addValue = function(value){
if(!is(value, "ISORecord")){
value = ISORecord$new(value = value)
}
return(self$addListElement("value", value))
},

#'@description Deletes value
#'@param value object of class \link{ISORecord}
#'@return \code{TRUE} if deleted, \code{FALSE} otherwise
delValue = function(value){
if(!is(value, "ISORecord")){
value = ISORecord$new(value = value)
}
return(self$delListElement("value", value))
},

#'@description Adds resource
#'@param resource object of class \link{ISOSource}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addResource = function(resource){
if(!is(resource, "ISOSource")){
stop("The argument should be an object of class 'ISOSource'")
}
return(self$addListElement("resource", resource))
},


#'@description Deletes resource
#'@param resource object of class \link{ISOSource}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
delResource = function(resource){
if(!is(resource, "ISOSource")){
stop("The argument should be an object of class 'ISOSource'")
}
return(self$delListElement("resource", resource))
}
)
)
37 changes: 20 additions & 17 deletions R/ISOParameterDirection.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,30 @@
#' paramDir <- ISOParameterDirection$new(value = "in")
#'
#' @references
#' ISO 19119:2005 - Geographic information -- Services
#' - ISO 19115-3 \url{https://schemas.isotc211.org/19115/-3/mrl/2.0/mrl/#element_LE_ParameterDirection}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOParameterDirection <- R6Class("ISOParameterDirection",
inherit = ISOCodeListValue,
private = list(
xmlElement = "SV_ParameterDirection",
xmlNamespacePrefix = "SRV"
),
public = list(

#'@description Initializes object
#'@param xml object of class \link{XMLInternalNode-class}
#'@param value value
#'@param description description
initialize = function(xml = NULL, value, description = NULL){
super$initialize(xml = xml, id = private$xmlElement, value = value, description = description,
addCodeListAttrs = FALSE, setValue = FALSE)
}
)
inherit = ISOCodeListValue,
private = list(
xmlElement = "LE_ParameterDirection",
xmlNamespacePrefix = list(
"19139" = "SRV",
"19115-3" = "MRL"
)
),
public = list(

#'@description Initializes object
#'@param xml object of class \link{XMLInternalNode-class}
#'@param value value
#'@param description description
initialize = function(xml = NULL, value, description = NULL){
super$initialize(xml = xml, id = private$xmlElement, value = value, description = description,
addCodeListAttrs = FALSE, setValue = FALSE)
}
)
)

ISOParameterDirection$values <- function(labels = FALSE){
Expand Down
31 changes: 31 additions & 0 deletions R/ISOProcessParameter.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#' ISOProcessParameter
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO process parameter
#' @return Object of \code{\link{R6Class}} for modelling an ISO process parameter
#' @format \code{\link{R6Class}} object.
#'
#' @references
#' - ISO 19115-3 \url{https://schemas.isotc211.org/19115/-3/mrl/2.0/mrl/#element_LE_ProcessParameter}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOProcessParameter <- R6Class("ISOProcessParameter",
inherit = ISOAbstractParameter,
private = list(
xmlElement = "LE_ProcessParameter",
xmlNamespacePrefix = list(
"19115-3" = "MRL"
)
),
public = list(

#'@description Initializes object
#'@param xml object of class \link{XMLInternalNode-class}
initialize = function(xml = NULL){
super$initialize(xml = xml)
}
)
)
23 changes: 14 additions & 9 deletions R/ISOParameter.R → R/ISOSRVParameter.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#' ISOParameter
#' ISOSRVParameter
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO parameter
#' @return Object of \code{\link{R6Class}} for modelling an ISOParameter
#' @return Object of \code{\link{R6Class}} for modelling an ISOSRVParameter
#' @format \code{\link{R6Class}} object.
#'
#' @examples
#' md <- ISOParameter$new()
#' md <- ISOSRVParameter$new()
#' md$setName("name", "attType")
#' md$setDirection("in")
#' md$setDescription("description")
Expand All @@ -18,15 +18,20 @@
#' xml <- md$encode()
#'
#' @references
#' ISO 19119:2005 - Geographic information -- Services
#' - ISO 19119 \url{https://schemas.isotc211.org/19119/srv/srv/#element_SV_Parameter}

#' - ISO 19115-3 \url{https://schemas.isotc211.org/19115/-3/srv/2.0/srv/#element_SV_Parameter}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOParameter <- R6Class("ISOParameter",
ISOSRVParameter <- R6Class("ISOSRVParameter",
inherit = ISOAbstractObject,
private = list(
xmlElement = "SV_Parameter",
xmlNamespacePrefix = "SRV"
xmlNamespacePrefix = list(
"19139" = "SRV",
"19115-3" = "SRV"
)
),
public = list(

Expand All @@ -40,7 +45,7 @@ ISOParameter <- R6Class("ISOParameter",
optionality = "Mandatory",
#'@field repeatability repeatability [1..1]: logical
repeatability = FALSE,
#'@field valueType valueType [1..1]: ISOTypeName
#'@field valueType valueType [1..1]: ISOTypeName (=> ISO 19139)
valueType = NULL,

#'@description Initializes object
Expand All @@ -54,8 +59,8 @@ ISOParameter <- R6Class("ISOParameter",
#'@param attributeType attribute type
#'@param locales list of localized texts. Default is \code{NULL}
setName = function(name, attributeType, locales = NULL){
if(!is(attributeType, "ISOTypeName")){
attrType <- ISOTypeName$new()
if(!is(attributeType, "ISOMemberName")){
attrType <- ISOMemberName$new()
attrType$setName(attributeType)
if(!is.null(locales)){
attrType$setName(attributeType, locales = locales)
Expand Down
48 changes: 48 additions & 0 deletions R/ISOSRVParameterDirection.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#' ISOSRVParameterDirection
#'
#' @docType class
#' @importFrom R6 R6Class
#' @export
#' @keywords ISO parameter direction
#' @return Object of \code{\link{R6Class}} for modelling an ISOSRVParameterDirection
#' @format \code{\link{R6Class}} object.
#'
#' @examples
#' #possible values
#' values <- ISOSRVParameterDirection$values(labels = TRUE)
#'
#' #paramDir
#' paramDir <- ISOSRVParameterDirection$new(value = "in")
#'
#' @references
#' - ISO 19119 \url{https://schemas.isotc211.org/19119/srv/srv/#element_SV_ParameterDirection}
#'
#' - ISO 19115-3 \url{https://schemas.isotc211.org/19115/-3/srv/2.0/srv/#element_SV_ParameterDirection}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
ISOSRVParameterDirection <- R6Class("ISOSRVParameterDirection",
inherit = ISOCodeListValue,
private = list(
xmlElement = "SV_ParameterDirection",
xmlNamespacePrefix = list(
"19139" = "SRV",
"19115-3" = "SRV"
)
),
public = list(

#'@description Initializes object
#'@param xml object of class \link{XMLInternalNode-class}
#'@param value value
#'@param description description
initialize = function(xml = NULL, value, description = NULL){
super$initialize(xml = xml, id = private$xmlElement, value = value, description = description,
addCodeListAttrs = FALSE, setValue = FALSE)
}
)
)

ISOSRVParameterDirection$values <- function(labels = FALSE){
return(ISOCodeListValue$values(ISOSRVParameterDirection, labels))
}
12 changes: 6 additions & 6 deletions inst/extdata/coverage/geometa_coverage_inventory.csv
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_OperationChainMetadata","ISOOperationChainMetadata",TRUE,TRUE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_OperationMetadata","ISOOperationMetadata",TRUE,FALSE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_OperationModel","<missing>",FALSE,FALSE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_Parameter","ISOParameter",TRUE,FALSE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_ParameterDirection","ISOParameterDirection",TRUE,FALSE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_Parameter","ISOSRVParameter",TRUE,TRUE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_ParameterDirection","ISOSRVParameterDirection",TRUE,TRUE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_PlatformNeutralServiceSpecification","<missing>",FALSE,FALSE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_PlatformSpecificServiceSpecification","<missing>",FALSE,FALSE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
"ISO/TS 19139:2007","ISO 19119:2005","Geographic Information - Service Metadata","SRV","SV_Port","<missing>",FALSE,FALSE,"ISO/TS 19139:2007 - ISO 19119:2005 - SRV"
Expand Down Expand Up @@ -671,9 +671,9 @@
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Identification (MRI) Version: 1.0","MRI","MD_Usage","ISOUsage",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRI"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_Algorithm","ISOImageryAlgorithm",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_NominalResolution","ISOImageryNominalResolution",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_ParameterDirection","<missing>",FALSE,FALSE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_ParameterDirection","ISOParameterDirection",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_Processing","ISOImageryProcessing",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_ProcessParameter","<missing>",FALSE,FALSE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_ProcessParameter","ISOProcessParameter",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_ProcessStep","ISOImageryProcessStep",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_ProcessStepReport","ISOImageryProcessStepReport",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for Resource Lineage (MRL) Version: 2.0","MRL","LE_Source","ISOImagerySource",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - MRL"
Expand Down Expand Up @@ -704,8 +704,8 @@
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for SeRVices (SRV) Version: 2.0","SRV","SV_CouplingType","ISOCouplingType",TRUE,FALSE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - SRV"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for SeRVices (SRV) Version: 2.0","SRV","SV_OperationChainMetadata","ISOOperationChainMetadata",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - SRV"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for SeRVices (SRV) Version: 2.0","SRV","SV_OperationMetadata","ISOOperationMetadata",TRUE,FALSE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - SRV"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for SeRVices (SRV) Version: 2.0","SRV","SV_Parameter","ISOParameter",TRUE,FALSE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - SRV"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for SeRVices (SRV) Version: 2.0","SRV","SV_ParameterDirection","ISOParameterDirection",TRUE,FALSE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - SRV"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for SeRVices (SRV) Version: 2.0","SRV","SV_Parameter","ISOSRVParameter",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - SRV"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for SeRVices (SRV) Version: 2.0","SRV","SV_ParameterDirection","ISOSRVParameterDirection",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - SRV"
"ISO/TS 19115-3:2023","ISO 19115-1:2014","Metadata for SeRVices (SRV) Version: 2.0","SRV","SV_ServiceIdentification","ISOSRVServiceIdentification",TRUE,FALSE,"ISO/TS 19115-3:2023 - ISO 19115-1:2014 - SRV"
"ISO/TS 19115-3:2023","ISO 19157","Data Quality abstract Classes (DQC) Version 1.0","DQC","Abstract_DataQuality","ISOAbstractDataQuality",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19157 - DQC"
"ISO/TS 19115-3:2023","ISO 19157","Data Quality abstract Classes (DQC) Version 1.0","DQC","Abstract_QualityElement","ISOAbstractQualityElement",TRUE,TRUE,"ISO/TS 19115-3:2023 - ISO 19157 - DQC"
Expand Down
Loading

0 comments on commit 2c0427f

Please sign in to comment.