Skip to content

Commit

Permalink
#181 M5 rdoc for CIT + missing fields/methods
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Dec 9, 2024
1 parent 5889cf7 commit 8980579
Show file tree
Hide file tree
Showing 33 changed files with 599 additions and 169 deletions.
57 changes: 54 additions & 3 deletions R/ISOAddress.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#' xml <- md$encode()
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_CI_Address}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/cit/2.0/cit/#element_CI_Address}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand All @@ -32,15 +34,15 @@ ISOAddress <- R6Class("ISOAddress",
),
public = list(
#'@field deliveryPoint delivery point
deliveryPoint = NULL,
deliveryPoint = list(),
#'@field city city
city = NULL,
#'@field postalCode postal code
postalCode = NULL,
#'@field country country
country = NULL,
#'@field electronicMailAddress email
electronicMailAddress = NULL,
electronicMailAddress = list(),

#'@description Initializes object
#'@param xml object of class \link{XMLInternalNode-class}
Expand All @@ -52,13 +54,38 @@ ISOAddress <- R6Class("ISOAddress",
#'@param deliveryPoint delivery point
#'@param locales list of localized names
setDeliveryPoint = function(deliveryPoint, locales = NULL){
self$stopIfMetadataStandardIsNot("19139")
if(!is(deliveryPoint,"character")) deliveryPoint <- as.character(deliveryPoint)
self$deliveryPoint <- deliveryPoint
if(!is.null(locales)){
self$deliveryPoint <- self$createLocalisedProperty(deliveryPoint, locales)
}
},

#'@description Adds delivery point
#'@param deliveryPoint delivery point
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addDeliveryPoint = function(deliveryPoint, locales = NULL){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(deliveryPoint,"character")) deliveryPoint <- as.character(deliveryPoint)
if(!is.null(locales)){
deliveryPoint <- self$createLocalisedProperty(deliveryPoint, locales)
}
return(self$addListElement("deliveryPoint", deliveryPoint))
},

#'@description Deletes delivery point
#'@param deliveryPoint delivery point
#'@return \code{TRUE} if added, \code{FALSE} otherwise
delDeliveryPoint = function(deliveryPoint, locales = NULL){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(deliveryPoint,"character")) deliveryPoint <- as.character(deliveryPoint)
if(!is.null(locales)){
deliveryPoint <- self$createLocalisedProperty(deliveryPoint, locales)
}
return(self$delListElement("deliveryPoint", deliveryPoint))
},

#'@description Set city
#'@param city city
#'@param locales list of localized names
Expand Down Expand Up @@ -100,6 +127,30 @@ ISOAddress <- R6Class("ISOAddress",
if(!is.null(locales)){
self$electronicMailAddress <- self$createLocalisedProperty(email, locales)
}
},

#'@description Adds email
#'@param email email
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addEmail = function(email, locales = NULL){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(email,"character")) email <- as.character(email)
if(!is.null(locales)){
email <- self$createLocalisedProperty(email, locales)
}
return(self$addListElement("email", email))
},

#'@description Deletes email
#'@param email email
#'@return \code{TRUE} if deleted, \code{FALSE} otherwise
delEmail = function(email, locales = NULL){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(email,"character")) email <- as.character(email)
if(!is.null(locales)){
email <- self$createLocalisedProperty(email, locales)
}
return(self$delListElement("email", email))
}

)
Expand Down
114 changes: 55 additions & 59 deletions R/ISOCitation.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
#' xml <- md$encode()
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_CI_Citation}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/cit/2.0/cit/#element_CI_Citation}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down Expand Up @@ -77,12 +79,16 @@ ISOCitation<- R6Class("ISOCitation",
series = NULL,
#'@field otherCitationDetails other citation details
otherCitationDetails = NULL,
#'@field collectiveTitle collective title
#'@field collectiveTitle collective title (for ISO 19139)
collectiveTitle = NULL,
#'@field ISBN ISBN
ISBN = NULL,
#'@field ISSN ISSN
ISSN = NULL,
#'@field onlineResource online resource (for ISO 19115-3)
onlineResource = list(),
#'@field graphic graphic (for ISO 19115-3)
graphic = list(),

#'@description Initializes object
#'@param xml object of class \link{XMLInternalNode-class}
Expand All @@ -108,35 +114,11 @@ ISOCitation<- R6Class("ISOCitation",
stop("Title should be an object of class 'character' or 'ISOAnchor'")
}
self$title <- title
if(!is.null(locales)){
if(!is.null(locales)){
self$title <- self$createLocalisedProperty(title, locales)
}
},

#'@description Set alternate title
#'@param alternateTitle alternate title
#'@param locales list of localized names. Default is \code{NULL}
setAlternateTitle = function(alternateTitle, locales = NULL){
warning("'setAlternateTitle' is deprecated, use 'addAlternateTitle' instead")
classPass <- TRUE
if(is.null(alternateTitle)){
classPath <- FALSE
}else{
if(!inherits(alternateTitle,"ISOAbstractObject")){
if(!(is.na(alternateTitle) || is(alternateTitle, "character"))) classPass <- FALSE
}else{
if(is(alternateTitle,"ISOAnchor")){ classPass <- TRUE }else{ classPass <- FALSE }
}
}
if(!classPass){
stop("Alternate title should be an object of class 'character' or 'ISOAnchor'")
}
self$alternateTitle <- alternateTitle
if(!is.null(locales)){
self$alternateTitle <- self$createLocalisedProperty(alternateTitle, locales)
}
},

#'@description Adds alternate title
#'@param alternateTitle alternate title
#'@param locales list of localized titles. Default is \code{NULL}
Expand Down Expand Up @@ -219,16 +201,6 @@ ISOCitation<- R6Class("ISOCitation",
self$editionDate <- editionDate
},

#'@description Set identifier
#'@param identifier identifier, object of class \link{ISOMetaIdentifier}
setIdentifier = function(identifier){
warning("'setIdentifier' method is deprecated, use 'addIdentifier' instead")
if(!is(identifier, "ISOMetaIdentifier")){
stop("The argument should be a 'ISOMetaIdentifier' object")
}
self$addIdentifier(identifier)
},

#'@description Adds identifier
#'@param identifier identifier, object of class \link{ISOMetaIdentifier}
#'@param locales list of localized identifiers. Default is \code{NULL}
Expand All @@ -251,16 +223,6 @@ ISOCitation<- R6Class("ISOCitation",
return(self$delListElement("identifier", identifier))
},

#'@description Set cited responsible party
#'@param rp cited responsible party, object of class \link{ISOResponsibleParty}
setCitedResponsibleParty = function(rp){
warning("'setCitedResponsibleParty' method is deprecated, use 'addCitedResponsibleParty' instead")
if(!is(rp, "ISOResponsibleParty")){
stop("The argument should be a 'ISOResponsibleParty' object")
}
self$addCitedResponsibleParty(rp)
},

#'@description Adds cited responsible party
#'@param rp cited responsible party, object of class \link{ISOResponsibleParty} (in ISO 19139) or
#'\link{ISOResponsibility} (in ISO 19115-3)
Expand Down Expand Up @@ -303,17 +265,6 @@ ISOCitation<- R6Class("ISOCitation",
return(self$delListElement("citedResponsibleParty", rp))
},

#'@description Sets presentation form
#'@param presentationForm presentation form, object of class \link{ISOPresentationForm} or \link{character} among values
#' returned by \code{ISOPresentationForm$values()}
setPresentationForm = function(presentationForm){
warning("'setPresentationForm' method is deprecated, use 'addPresentationForm' instead")
if(is(presentationForm, "character")){
presentationForm <- ISOPresentationForm$new(value = presentationForm)
}
self$addPresentationForm(presentationForm)
},

#'@description Adds presentation form
#'@param presentationForm presentation form, object of class \link{ISOPresentationForm} or
#' \link{character} among values returned by \code{ISOPresentationForm$values()}
Expand Down Expand Up @@ -359,6 +310,7 @@ ISOCitation<- R6Class("ISOCitation",
#'@param collectiveTitle collective title
#'@param locales list of localized titles. Default is \code{NULL}
setCollectiveTitle = function(collectiveTitle, locales = NULL){
self$stopIfMetadataStandardIsNot("19139")
self$collectiveTitle <- collectiveTitle
if(!is.null(locales)){
self$collectiveTitle <- self$createLocalisedProperty(collectiveTitle, locales)
Expand All @@ -375,7 +327,51 @@ ISOCitation<- R6Class("ISOCitation",
#'@param issn issn
setISSN = function(issn){
self$ISSN <- issn
}
},

#'@description Adds online resource
#'@param onlineResource object of class \link{ISOOnlineResource}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addOnlineResource = function(onlineResource){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(onlineResource, "ISOOnlineResource")){
stop("The argument should be a 'ISOOnlineResource' object")
}
return(self$addListElement("onlineResource", onlineResource))
},

#'@description Deletes online resource
#'@param onlineResource object of class \link{ISOOnlineResource}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
delOnlineResource = function(onlineResource){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(onlineResource, "ISOOnlineResource")){
stop("The argument should be a 'ISOOnlineResource' object")
}
return(self$delListElement("onlineResource", onlineResource))
},

#'@description Adds graphic
#'@param graphic object of class \link{ISOBrowseGraphic}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addGraphic = function(graphic){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(graphic, "ISOBrowseGraphic")){
stop("The argument should be a 'ISOBrowseGraphic' object")
}
return(self$addListElement("graphic", graphic))
},

#'@description Adds graphic
#'@param graphic object of class \link{ISOBrowseGraphic}
#'@return \code{TRUE} if deleted, \code{FALSE} otherwise
delGraphic = function(graphic){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(graphic, "ISOBrowseGraphic")){
stop("The argument should be a 'ISOBrowseGraphic' object")
}
return(self$delListElement("graphic", graphic))
}

)
)
49 changes: 48 additions & 1 deletion R/ISOContact.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#' xml <- md$encode()
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_CI_Contact}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/cit/2.0/cit/#element_CI_Contact}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down Expand Up @@ -160,6 +162,51 @@ ISOContact <- R6Class("ISOContact",
}
if(is.null(self$onlineResource)) self$onlineResource = list()
return(self$delListElement("onlineResource", onlineResource))
},

#'@description Adds hours of service (with ISO 19115-3)
#'@param hoursOfService object of class \link{character}
#'@return \code{TRUE} if added, \code{FALSE} otherwise
addHoursOfService = function(hoursOfService){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(hoursOfService, "character")) hoursOfService = as.character(hoursOfService)
if(is.null(self$hoursOfService)) self$hoursOfService = list()
return(self$addListElement("hoursOfService", hoursOfService))
},

#'@description Deletes hours of service (with ISO 19115-3)
#'@param hoursOfService object of class \link{character}
#'@return \code{TRUE} if deleted, \code{FALSE} otherwise
delHoursOfService = function(hoursOfService){
self$stopIfMetadataStandardIsNot("19115-3")
if(!is(hoursOfService, "character")) hoursOfService = as.character(hoursOfService)
if(is.null(self$hoursOfService)) self$hoursOfService = list()
return(self$delListElement("hoursOfService", hoursOfService))
},

#'@description Set contact instructions
#'@param contactInstructions contact instructions
#'@param locales list of localized editions. Default is \code{NULL}
setContactInstructions = function(contactInstructions, locales = NULL){
if(!is.null(locales)){
contactInstructions = self$createLocalisedProperty(contactInstructions, locales)
}else{
contactInstructions = as.character(contactInstructions)
}
self$contactInstructions = contactInstructions
},

#'@description Set contact type
#'@param contactType contact type
#'@param locales list of localized editions. Default is \code{NULL}
setContactType = function(contactType, locales = NULL){
if(!is.null(locales)){
contactType = self$createLocalisedProperty(contactType, locales)
}else{
contactType = as.character(contactType)
}
self$contactType = contactType
}

)
)
4 changes: 3 additions & 1 deletion R/ISODate.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#' xml <- md$encode()
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_CI_Date}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/cit/2.0/cit/#element_CI_Date}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
4 changes: 3 additions & 1 deletion R/ISODateType.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#' creation <- ISODateType$new(value = "creation")
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_CI_DateTypeCode}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/cit/2.0/cit/#element_CI_DateTypeCode}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
2 changes: 1 addition & 1 deletion R/ISOIndividual.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @format \code{\link{R6Class}} object.
#'
#' @references
#' ISO 19115-1:2014 Geographic information — Metadata Part 1: Fundamentals
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/cit/2.0/cit/#element_CI_Individual}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
4 changes: 3 additions & 1 deletion R/ISOOnLineFunction.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#' download <- ISOOnLineFunction$new(value = "download")
#'
#' @references
#' ISO 19115:2003 - Geographic information -- Metadata
#' - ISO 19139 \link{https://schemas.isotc211.org/19139/-/gmd/1.0/gmd/#element_CI_OnlineFunctionCode}
#'
#' - ISO 19115-3 \link{https://schemas.isotc211.org/19115/-3/cit/2.0/cit/#element_CI_OnlineFunctionCode}
#'
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com>
#'
Expand Down
Loading

0 comments on commit 8980579

Please sign in to comment.