From 83e198cfc638d472502458b827f79c1fc3e98bac Mon Sep 17 00:00:00 2001 From: eblondel Date: Tue, 27 Jun 2017 00:45:56 +0200 Subject: [PATCH] #69 AbstractCoordinateOperation + #71 ISO*PositionalAccuracy GMD classes --- NAMESPACE | 6 + R/GMLAbstractCoordinateOperation.R | 8 +- R/ISOAbsoluteExternalPositionalAccuracy.R | 56 ++++++ R/ISOAbstractPositionalAccuracy.R | 31 ++++ R/ISOCodelist.R | 3 +- R/ISODataQuality.R | 2 +- R/ISODataQualityAbstractElement.R | 159 ++++++++++++++++++ R/ISOEvaluationMethodType.R | 46 +++++ R/ISOGriddedDataPositionalAccuracy.R | 56 ++++++ R/ISORelativeInternalPositionalAccuracy.R | 56 ++++++ man/GMLAbstractCoordinateOperation.Rd | 4 +- man/ISOAbsoluteExternalPositionalAccuracy.Rd | 67 ++++++++ man/ISOAbstractPositionalAccuracy.Rd | 41 +++++ man/ISODataQuality.Rd | 2 +- man/ISODataQualityAbstractElement.Rd | 86 ++++++++++ man/ISOEvaluationMethodType.Rd | 45 +++++ man/ISOGriddedDataPositionalAccuracy.Rd | 66 ++++++++ man/ISORelativeInternalPositionalAccuracy.Rd | 67 ++++++++ .../test_ISODataQualityAbstractElement.R | 50 ++++++ tests/testthat/test_ISOPositionalAccuracy.R | 141 ++++++++++++++++ 20 files changed, 983 insertions(+), 9 deletions(-) create mode 100644 R/ISOAbsoluteExternalPositionalAccuracy.R create mode 100644 R/ISOAbstractPositionalAccuracy.R create mode 100644 R/ISODataQualityAbstractElement.R create mode 100644 R/ISOEvaluationMethodType.R create mode 100644 R/ISOGriddedDataPositionalAccuracy.R create mode 100644 R/ISORelativeInternalPositionalAccuracy.R create mode 100644 man/ISOAbsoluteExternalPositionalAccuracy.Rd create mode 100644 man/ISOAbstractPositionalAccuracy.Rd create mode 100644 man/ISODataQualityAbstractElement.Rd create mode 100644 man/ISOEvaluationMethodType.Rd create mode 100644 man/ISOGriddedDataPositionalAccuracy.Rd create mode 100644 man/ISORelativeInternalPositionalAccuracy.Rd create mode 100644 tests/testthat/test_ISODataQualityAbstractElement.R create mode 100644 tests/testthat/test_ISOPositionalAccuracy.R diff --git a/NAMESPACE b/NAMESPACE index 0e61c035..62f5968e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -33,8 +33,10 @@ export(GMLTimePeriod) export(GMLUnitDefinition) export(GMLUserDefinedCS) export(GMLVerticalCS) +export(ISOAbsoluteExternalPositionalAccuracy) export(ISOAbstractCatalogue) export(ISOAbstractObject) +export(ISOAbstractPositionalAccuracy) export(ISOAddress) export(ISOAngle) export(ISOAssociationRole) @@ -62,6 +64,7 @@ export(ISOCoverageContentType) export(ISOCoverageDescription) export(ISODataIdentification) export(ISODataQuality) +export(ISODataQualityAbstractElement) export(ISODate) export(ISODateType) export(ISODefinitionReference) @@ -73,6 +76,7 @@ export(ISODistance) export(ISODistribution) export(ISODistributor) export(ISODomainConsistency) +export(ISOEvaluationMethodType) export(ISOExtent) export(ISOFeatureAttribute) export(ISOFeatureCatalogue) @@ -87,6 +91,7 @@ export(ISOGeometricObjectType) export(ISOGeometricObjects) export(ISOGeoreferenceable) export(ISOGridSpatialRepresentation) +export(ISOGriddedDataPositionalAccuracy) export(ISOHierarchyLevel) export(ISOIdentification) export(ISOIdentifier) @@ -116,6 +121,7 @@ export(ISORecord) export(ISORecordType) export(ISOReferenceIdentifier) export(ISOReferenceSystem) +export(ISORelativeInternalPositionalAccuracy) export(ISORepresentativeFraction) export(ISOResponsibleParty) export(ISORestriction) diff --git a/R/GMLAbstractCoordinateOperation.R b/R/GMLAbstractCoordinateOperation.R index cb26f332..163a4557 100644 --- a/R/GMLAbstractCoordinateOperation.R +++ b/R/GMLAbstractCoordinateOperation.R @@ -21,10 +21,10 @@ #' Sets version #' } #' \item{\code{addAccuracy(accuracy)}}{ -#' Adds coordinate operation accuracty +#' Adds coordinate operation accuracy, object extending \code{ISOAbstractPositionalAccuracy} #' } #' \item{\code{delAccuracy(accuracy)}}{ -#' Deletes coordinate operation accuracty +#' Deletes coordinate operation accuracy, object extending \code{ISOAbstractPositionalAccuracy} #' } #' \item{\code{setSourceCRS(sourceCRS)}}{ #' Sets the source CRS, object extending \code{GMLAbstractSingleCRS} @@ -83,8 +83,8 @@ GMLAbstractCoordinateOperation <- R6Class("GMLAbstractCoordinateOperation", #delAccuracy delAccuracy = function(accuracy){ - if(!inherits(accuracy, "ISOPositionalAccuracy")){ - stop("The argument value should be an object of class 'ISOPositionalAccuracy") + if(!inherits(accuracy, "ISOAbstractPositionalAccuracy")){ + stop("The argument value should be an object of class 'ISOAbstractPositionalAccuracy") } return(self$delListElement("coordinateOperationAccuracy", GMLElement$create("coordinateOperationAccuracy", diff --git a/R/ISOAbsoluteExternalPositionalAccuracy.R b/R/ISOAbsoluteExternalPositionalAccuracy.R new file mode 100644 index 00000000..ab732c1c --- /dev/null +++ b/R/ISOAbsoluteExternalPositionalAccuracy.R @@ -0,0 +1,56 @@ +#' ISOAbsoluteExternalPositionalAccuracy +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO data quality absolute external positional accuracy +#' @return Object of \code{\link{R6Class}} for modelling an ISOAbsoluteExternalPositionalAccuracy +#' @format \code{\link{R6Class}} object. +#' +#' @section Inherited methods from \code{ISODataQualityAbstractElement} +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml)}}{ +#' This method is used to instantiate an ISOAbsoluteExternalPositionalAccuracy +#' } +#' } +#' +#' @examples +#' #encoding +#' dq <- ISOAbsoluteExternalPositionalAccuracy$new() +#' dq$addNameOfMeasure("measure") +#' metaId <- ISOMetaIdentifier$new(code = "measure-id") +#' dq$setMeasureIdentification(metaId) +#' dq$setMeasureDescription("description") +#' dq$setEvaluationMethodDescription("method description") +#' dq$setEvaluationMethodType("indirect") +#' dq$setDateTime(ISOdate(2015,1,1,12,10,49)) +#' spec <- ISOCitation$new() +#' spec$setTitle("specification title") +#' spec$setAlternateTitle("specification alternate title") +#' d <- ISODate$new() +#' d$setDate(ISOdate(2015, 1, 1, 1)) +#' d$setDateType("publication") +#' spec$addDate(d) +#' dq$setEvaluationProcedure(spec) +#' result <- ISOConformanceResult$new() +#' result$setSpecification(spec) +#' result$setExplanation("some explanation about the conformance") +#' result$setPass(TRUE) +#' dq$addResult(result) +#' xml <- dq$encode() +#' +#' @references +#' ISO 19115:2003 - Geographic information -- Metadata +#' +#' @author Emmanuel Blondel +#' +ISOAbsoluteExternalPositionalAccuracy <- R6Class("ISOAbsoluteExternalPositionalAccuracy", + inherit = ISOAbstractPositionalAccuracy, + private = list( + xmlElement = "DQ_AbsoluteExternalPositionalAccuracy", + xmlNamespacePrefix = "GMD" + ), + public = list() +) \ No newline at end of file diff --git a/R/ISOAbstractPositionalAccuracy.R b/R/ISOAbstractPositionalAccuracy.R new file mode 100644 index 00000000..5a49180d --- /dev/null +++ b/R/ISOAbstractPositionalAccuracy.R @@ -0,0 +1,31 @@ +#' ISOAbstractPositionalAccuracy +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO data quality abstract positional accuracy +#' @return Object of \code{\link{R6Class}} for modelling an ISOAbstractPositionalAccuracy +#' @format \code{\link{R6Class}} object. +#' +#' @section Inherited methods from \code{ISODataQualityAbstractElement} +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml)}}{ +#' This method is used to instantiate an ISOAbstractPositionalAccuracy +#' } +#' } +#' +#' @references +#' ISO 19115:2003 - Geographic information -- Metadata +#' +#' @author Emmanuel Blondel +#' +ISOAbstractPositionalAccuracy <- R6Class("ISOAbstractPositionalAccuracy", + inherit = ISODataQualityAbstractElement, + private = list( + xmlElement = "AbstractDQ_PositionalAccuracy", + xmlNamespacePrefix = "GMD" + ), + public = list() +) \ No newline at end of file diff --git a/R/ISOCodelist.R b/R/ISOCodelist.R index 28ef309f..8cc5fbaa 100644 --- a/R/ISOCodelist.R +++ b/R/ISOCodelist.R @@ -122,7 +122,8 @@ fetchISOCodelists <- function(){ ISOCodelist$new(gmxCL, "MD_ClassificationCode"), ISOCodelist$new(gmxCL, "MD_CellGeometryCode"), ISOCodelist$new(gmxCL, "MD_DimensionNameTypeCode"), - ISOCodelist$new(gmxCL, "MD_CoverageContentTypeCode") + ISOCodelist$new(gmxCL, "MD_CoverageContentTypeCode"), + ISOCodelist$new(gmxCL, "DQ_EvaluationMethodTypeCode") ) names(codelists) <- sapply(codelists, function(cl){cl$identifier}) .geometa.iso$codelists <- codelists diff --git a/R/ISODataQuality.R b/R/ISODataQuality.R index ee915104..06e0c3d4 100644 --- a/R/ISODataQuality.R +++ b/R/ISODataQuality.R @@ -13,7 +13,7 @@ #' #' @section Methods: #' \describe{ -#' \item{\code{new(xml,value)}}{ +#' \item{\code{new(xml)}}{ #' This method is used to instantiate an ISODataQuality #' } #' \item{\code{setScope(scope)}}{ diff --git a/R/ISODataQualityAbstractElement.R b/R/ISODataQualityAbstractElement.R new file mode 100644 index 00000000..8a631838 --- /dev/null +++ b/R/ISODataQualityAbstractElement.R @@ -0,0 +1,159 @@ +#' ISODataQualityAbstractElement +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO data quality abstract element +#' @return Object of \code{\link{R6Class}} for modelling an ISODataQualityAbstractElement +#' @format \code{\link{R6Class}} object. +#' +#' @field nameOfMeasure +#' @field measureIdentification +#' @field measureDescription +#' @field evaluationMethodType +#' @field evaluationMethodDescription +#' @field evaluationProcedure +#' @field dateTime +#' @field result +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml)}}{ +#' This method is used to instantiate an ISODataQuality +#' } +#' \item{\code{addNameOfMeasure(name)}}{ +#' Add name +#' } +#' \item{\code{delNameOfMeasure(name)}}{ +#' Deletes name +#' } +#' \item{\code{setMeasureIdentification(identification)}}{ +#' Sets measure identifier, an object of class \code{ISOMetaIdentifier} +#' } +#' \item{\code{setMeasureDescription(description)}}{ +#' Sets measure description +#' } +#' \item{\code{setEvaluationMethodType(type)}}{ +#' Sets the type of evaluation method, an object of class \code{ISOEvaluationMethodType} +#' or any \code{character} value among code{ISOEvaluationMethodType$values()} +#' } +#' \item{\code{setEvaluationMethodDescription(description)}}{ +#' Sets the description of evaluation method +#' } +#' \item{\code{setEvaluationMethodProcedure(procedure)}}{ +#' Sets the procedure as an object of class \code{ISOCitation} +#' } +#' \item{\code{setDateTime(dateTime)}}{ +#' Sets datetime, object class 'POSIXct'/'POSIXt' +#' } +#' \item{\code{addResult(result)}}{ +#' Sets conformance result, object of class \code{ISOConformanceResult} +#' } +#' \item{\code{delResult(result)}}{ +#' Deletes conformance result, object of class \code{ISOConformanceResult} +#' } +#' } +#' +#' @references +#' ISO 19115:2003 - Geographic information -- Metadata +#' +#' @author Emmanuel Blondel +#' +ISODataQualityAbstractElement <- R6Class("ISODataQualityAbstractElement", + inherit = ISOAbstractObject, + private = list( + xmlElement = "AbstractDQ_Element", + xmlNamespacePrefix = "GMD" + ), + public = list( + + #+ nameOfMeasure [0..*]: character + nameOfMeasure = list(), + #+ measureIdentification [0..1]: ISOMetaIdentifier + measureIdentification = NULL, + #+ measureDescription [0..1]: character + measureDescription = NULL, + #+ evaluationMethodType [0..1]: ISOEvaluationMethodType + evaluationMethodType = NULL, + #+ evaluationMethodDescription [0..1]: character + evaluationMethodDescription = NULL, + #+ evaluationProcedure [0..1]: ISOCitation + evaluationProcedure = NULL, + #+ dateTime [0..1]: ISODateTime + dateTime = NULL, + #+ result [1..2]: ISOConformanceResult + result = list(), + + initialize = function(xml = NULL){ + super$initialize(xml = xml) + }, + + #addNameOfMeasure + addNameOfMeasure = function(name){ + return(self$addListElement("nameOfMeasure", name)) + }, + + #delNameOfMeasure + delNameOfMeasure = function(name){ + return(self$delListElement("nameOfMeasure", name)) + }, + + #setMeasureIdentification + setMeasureIdentification = function(identification){ + if(!is(identification, "ISOMetaIdentifier")){ + stop("The argument value should be an object of class 'ISOMetaIdentifier") + } + self$measureIdentification = identification + }, + + #setMeasureDescription + setMeasureDescription = function(description){ + self$measureDescription <- description + }, + + #setEvaluationMethodType + setEvaluationMethodType = function(type){ + if(!is(type, "ISOEvaluationMethodType")){ + type <- ISOEvaluationMethodType$new(value = type) + } + self$evaluationMethodType <- type + }, + + #setEvaluationMethodDescription + setEvaluationMethodDescription = function(description){ + self$evaluationMethodDescription <- description + }, + + #setEvaluationProcedure + setEvaluationProcedure = function(procedure){ + if(!is(procedure, "ISOCitation")){ + stop("The argument value should be an object of class 'ISOCitation'") + } + self$evaluationProcedure <- procedure + }, + + #setDateTime + setDateTime = function(dateTime){ + if(!all(class(dateTime) == c("POSIXct","POSIXt"))){ + stop("The argument should be an 'POSIXct'/'POSIXt' object") + } + self$dateTime <- dateTime + }, + + #addResult + addResult = function(result){ + if(!is(result, "ISOConformanceResult")){ + stop("The argument value should be an object of class 'ISOConformanceResult'") + } + return(self$addListElement("result", result)) + }, + + #delResult + delResult = function(result){ + if(!is(result, "ISOConformanceResult")){ + stop("The argument value should be an object of class 'ISOConformanceResult'") + } + return(self$delListElement("result", result)) + } + ) +) \ No newline at end of file diff --git a/R/ISOEvaluationMethodType.R b/R/ISOEvaluationMethodType.R new file mode 100644 index 00000000..aab4f860 --- /dev/null +++ b/R/ISOEvaluationMethodType.R @@ -0,0 +1,46 @@ +#' ISOEvaluationMethodType +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO EvaluationMethodType +#' @return Object of \code{\link{R6Class}} for modelling an ISO EvaluationMethodType +#' @format \code{\link{R6Class}} object. +#' +#' @field value +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml,value)}}{ +#' This method is used to instantiate an ISOEvaluationMethodType +#' } +#' } +#' +#' @examples +#' #possible values +#' values <- ISOEvaluationMethodType$values(labels = TRUE) +#' +#' #example of EvaluationMethodType +#' indirect <- ISOEvaluationMethodType$new(value = "indirect") +#' +#' @references +#' ISO 19115:2003 - Geographic information -- Metadata +#' +#' @author Emmanuel Blondel +#' +ISOEvaluationMethodType <- R6Class("ISOEvaluationMethodType", + inherit = ISOCodeListValue, + private = list( + xmlElement = "DQ_EvaluationMethodTypeCode", + xmlNamespacePrefix = "GMD" + ), + public = list( + initialize = function(xml = NULL, value){ + super$initialize(xml = xml, id = private$xmlElement, value = value, setValue = FALSE) + } + ) +) + +ISOEvaluationMethodType$values <- function(labels = FALSE){ + return(ISOCodeListValue$values(ISOEvaluationMethodType, labels)) +} \ No newline at end of file diff --git a/R/ISOGriddedDataPositionalAccuracy.R b/R/ISOGriddedDataPositionalAccuracy.R new file mode 100644 index 00000000..3e7d0ea0 --- /dev/null +++ b/R/ISOGriddedDataPositionalAccuracy.R @@ -0,0 +1,56 @@ +#' ISOGriddedDataPositionalAccuracy +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO data quality gridded data positional accuracy +#' @return Object of \code{\link{R6Class}} for modelling an ISOGriddedDataPositionalAccuracy +#' @format \code{\link{R6Class}} object. +#' +#' @section Inherited methods from \code{ISODataQualityAbstractElement} +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml)}}{ +#' This method is used to instantiate an ISOGriddedDataPositionalAccuracy +#' } +#' } +#' +#' @examples +#' #encoding +#' dq <- ISOGriddedDataPositionalAccuracy$new() +#' dq$addNameOfMeasure("measure") +#' metaId <- ISOMetaIdentifier$new(code = "measure-id") +#' dq$setMeasureIdentification(metaId) +#' dq$setMeasureDescription("description") +#' dq$setEvaluationMethodDescription("method description") +#' dq$setEvaluationMethodType("indirect") +#' dq$setDateTime(ISOdate(2015,1,1,12,10,49)) +#' spec <- ISOCitation$new() +#' spec$setTitle("specification title") +#' spec$setAlternateTitle("specification alternate title") +#' d <- ISODate$new() +#' d$setDate(ISOdate(2015, 1, 1, 1)) +#' d$setDateType("publication") +#' spec$addDate(d) +#' dq$setEvaluationProcedure(spec) +#' result <- ISOConformanceResult$new() +#' result$setSpecification(spec) +#' result$setExplanation("some explanation about the conformance") +#' result$setPass(TRUE) +#' dq$addResult(result) +#' xml <- dq$encode() +#' +#' @references +#' ISO 19115:2003 - Geographic information -- Metadata +#' +#' @author Emmanuel Blondel +#' +ISOGriddedDataPositionalAccuracy <- R6Class("ISOGriddedDataPositionalAccuracy", + inherit = ISOAbstractPositionalAccuracy, + private = list( + xmlElement = "DQ_GriddedDataPositionalAccuracy", + xmlNamespacePrefix = "GMD" + ), + public = list() +) \ No newline at end of file diff --git a/R/ISORelativeInternalPositionalAccuracy.R b/R/ISORelativeInternalPositionalAccuracy.R new file mode 100644 index 00000000..5534192c --- /dev/null +++ b/R/ISORelativeInternalPositionalAccuracy.R @@ -0,0 +1,56 @@ +#' ISORelativeInternalPositionalAccuracy +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO data quality relative internal positional accuracy +#' @return Object of \code{\link{R6Class}} for modelling an ISORelativeInternalPositionalAccuracy +#' @format \code{\link{R6Class}} object. +#' +#' @section Inherited methods from \code{ISODataQualityAbstractElement} +#' +#' @section Methods: +#' \describe{ +#' \item{\code{new(xml)}}{ +#' This method is used to instantiate an ISORelativeInternalPositionalAccuracy +#' } +#' } +#' +#' @examples +#' #encoding +#' dq <- ISORelativeInternalPositionalAccuracy$new() +#' dq$addNameOfMeasure("measure") +#' metaId <- ISOMetaIdentifier$new(code = "measure-id") +#' dq$setMeasureIdentification(metaId) +#' dq$setMeasureDescription("description") +#' dq$setEvaluationMethodDescription("method description") +#' dq$setEvaluationMethodType("indirect") +#' dq$setDateTime(ISOdate(2015,1,1,12,10,49)) +#' spec <- ISOCitation$new() +#' spec$setTitle("specification title") +#' spec$setAlternateTitle("specification alternate title") +#' d <- ISODate$new() +#' d$setDate(ISOdate(2015, 1, 1, 1)) +#' d$setDateType("publication") +#' spec$addDate(d) +#' dq$setEvaluationProcedure(spec) +#' result <- ISOConformanceResult$new() +#' result$setSpecification(spec) +#' result$setExplanation("some explanation about the conformance") +#' result$setPass(TRUE) +#' dq$addResult(result) +#' xml <- dq$encode() +#' +#' @references +#' ISO 19115:2003 - Geographic information -- Metadata +#' +#' @author Emmanuel Blondel +#' +ISORelativeInternalPositionalAccuracy <- R6Class("ISORelativeInternalPositionalAccuracy", + inherit = ISOAbstractPositionalAccuracy, + private = list( + xmlElement = "DQ_RelativeInternalPositionalAccuracy", + xmlNamespacePrefix = "GMD" + ), + public = list() +) \ No newline at end of file diff --git a/man/GMLAbstractCoordinateOperation.Rd b/man/GMLAbstractCoordinateOperation.Rd index 26f307a5..ba230f3a 100644 --- a/man/GMLAbstractCoordinateOperation.Rd +++ b/man/GMLAbstractCoordinateOperation.Rd @@ -35,10 +35,10 @@ GMLAbstractCoordinateOperation Sets version } \item{\code{addAccuracy(accuracy)}}{ - Adds coordinate operation accuracty + Adds coordinate operation accuracy, object extending \code{ISOAbstractPositionalAccuracy} } \item{\code{delAccuracy(accuracy)}}{ - Deletes coordinate operation accuracty + Deletes coordinate operation accuracy, object extending \code{ISOAbstractPositionalAccuracy} } \item{\code{setSourceCRS(sourceCRS)}}{ Sets the source CRS, object extending \code{GMLAbstractSingleCRS} diff --git a/man/ISOAbsoluteExternalPositionalAccuracy.Rd b/man/ISOAbsoluteExternalPositionalAccuracy.Rd new file mode 100644 index 00000000..17c81312 --- /dev/null +++ b/man/ISOAbsoluteExternalPositionalAccuracy.Rd @@ -0,0 +1,67 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/ISOAbsoluteExternalPositionalAccuracy.R +\docType{class} +\name{ISOAbsoluteExternalPositionalAccuracy} +\alias{ISOAbsoluteExternalPositionalAccuracy} +\title{ISOAbsoluteExternalPositionalAccuracy} +\format{\code{\link{R6Class}} object.} +\usage{ +ISOAbsoluteExternalPositionalAccuracy +} +\value{ +Object of \code{\link{R6Class}} for modelling an ISOAbsoluteExternalPositionalAccuracy +} +\description{ +ISOAbsoluteExternalPositionalAccuracy +} +\section{Inherited methods from \code{ISODataQualityAbstractElement}}{ + +} + +\section{Methods}{ + +\describe{ + \item{\code{new(xml)}}{ + This method is used to instantiate an ISOAbsoluteExternalPositionalAccuracy + } +} +} +\examples{ +#encoding + dq <- ISOAbsoluteExternalPositionalAccuracy$new() + dq$addNameOfMeasure("measure") + metaId <- ISOMetaIdentifier$new(code = "measure-id") + dq$setMeasureIdentification(metaId) + dq$setMeasureDescription("description") + dq$setEvaluationMethodDescription("method description") + dq$setEvaluationMethodType("indirect") + dq$setDateTime(ISOdate(2015,1,1,12,10,49)) + spec <- ISOCitation$new() + spec$setTitle("specification title") + spec$setAlternateTitle("specification alternate title") + d <- ISODate$new() + d$setDate(ISOdate(2015, 1, 1, 1)) + d$setDateType("publication") + spec$addDate(d) + dq$setEvaluationProcedure(spec) + result <- ISOConformanceResult$new() + result$setSpecification(spec) + result$setExplanation("some explanation about the conformance") + result$setPass(TRUE) + dq$addResult(result) + xml <- dq$encode() +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19115:2003 - Geographic information -- Metadata +} +\keyword{ISO} +\keyword{absolute} +\keyword{accuracy} +\keyword{data} +\keyword{external} +\keyword{positional} +\keyword{quality} + diff --git a/man/ISOAbstractPositionalAccuracy.Rd b/man/ISOAbstractPositionalAccuracy.Rd new file mode 100644 index 00000000..956b3bca --- /dev/null +++ b/man/ISOAbstractPositionalAccuracy.Rd @@ -0,0 +1,41 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/ISOAbstractPositionalAccuracy.R +\docType{class} +\name{ISOAbstractPositionalAccuracy} +\alias{ISOAbstractPositionalAccuracy} +\title{ISOAbstractPositionalAccuracy} +\format{\code{\link{R6Class}} object.} +\usage{ +ISOAbstractPositionalAccuracy +} +\value{ +Object of \code{\link{R6Class}} for modelling an ISOAbstractPositionalAccuracy +} +\description{ +ISOAbstractPositionalAccuracy +} +\section{Inherited methods from \code{ISODataQualityAbstractElement}}{ + +} + +\section{Methods}{ + +\describe{ + \item{\code{new(xml)}}{ + This method is used to instantiate an ISOAbstractPositionalAccuracy + } +} +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19115:2003 - Geographic information -- Metadata +} +\keyword{ISO} +\keyword{abstract} +\keyword{accuracy} +\keyword{data} +\keyword{positional} +\keyword{quality} + diff --git a/man/ISODataQuality.Rd b/man/ISODataQuality.Rd index 740a4eb3..c92b80ca 100644 --- a/man/ISODataQuality.Rd +++ b/man/ISODataQuality.Rd @@ -26,7 +26,7 @@ ISODataQuality \section{Methods}{ \describe{ - \item{\code{new(xml,value)}}{ + \item{\code{new(xml)}}{ This method is used to instantiate an ISODataQuality } \item{\code{setScope(scope)}}{ diff --git a/man/ISODataQualityAbstractElement.Rd b/man/ISODataQualityAbstractElement.Rd new file mode 100644 index 00000000..a70d1870 --- /dev/null +++ b/man/ISODataQualityAbstractElement.Rd @@ -0,0 +1,86 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/ISODataQualityAbstractElement.R +\docType{class} +\name{ISODataQualityAbstractElement} +\alias{ISODataQualityAbstractElement} +\title{ISODataQualityAbstractElement} +\format{\code{\link{R6Class}} object.} +\usage{ +ISODataQualityAbstractElement +} +\value{ +Object of \code{\link{R6Class}} for modelling an ISODataQualityAbstractElement +} +\description{ +ISODataQualityAbstractElement +} +\section{Fields}{ + +\describe{ +\item{\code{nameOfMeasure}}{} + +\item{\code{measureIdentification}}{} + +\item{\code{measureDescription}}{} + +\item{\code{evaluationMethodType}}{} + +\item{\code{evaluationMethodDescription}}{} + +\item{\code{evaluationProcedure}}{} + +\item{\code{dateTime}}{} + +\item{\code{result}}{} +}} +\section{Methods}{ + +\describe{ + \item{\code{new(xml)}}{ + This method is used to instantiate an ISODataQuality + } + \item{\code{addNameOfMeasure(name)}}{ + Add name + } + \item{\code{delNameOfMeasure(name)}}{ + Deletes name + } + \item{\code{setMeasureIdentification(identification)}}{ + Sets measure identifier, an object of class \code{ISOMetaIdentifier} + } + \item{\code{setMeasureDescription(description)}}{ + Sets measure description + } + \item{\code{setEvaluationMethodType(type)}}{ + Sets the type of evaluation method, an object of class \code{ISOEvaluationMethodType} + or any \code{character} value among code{ISOEvaluationMethodType$values()} + } + \item{\code{setEvaluationMethodDescription(description)}}{ + Sets the description of evaluation method + } + \item{\code{setEvaluationMethodProcedure(procedure)}}{ + Sets the procedure as an object of class \code{ISOCitation} + } + \item{\code{setDateTime(dateTime)}}{ + Sets datetime, object class 'POSIXct'/'POSIXt' + } + \item{\code{addResult(result)}}{ + Sets conformance result, object of class \code{ISOConformanceResult} + } + \item{\code{delResult(result)}}{ + Deletes conformance result, object of class \code{ISOConformanceResult} + } +} +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19115:2003 - Geographic information -- Metadata +} +\keyword{ISO} +\keyword{abstract} +\keyword{data} +\keyword{element} +\keyword{quality} + diff --git a/man/ISOEvaluationMethodType.Rd b/man/ISOEvaluationMethodType.Rd new file mode 100644 index 00000000..185b11ae --- /dev/null +++ b/man/ISOEvaluationMethodType.Rd @@ -0,0 +1,45 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/ISOEvaluationMethodType.R +\docType{class} +\name{ISOEvaluationMethodType} +\alias{ISOEvaluationMethodType} +\title{ISOEvaluationMethodType} +\format{\code{\link{R6Class}} object.} +\usage{ +ISOEvaluationMethodType +} +\value{ +Object of \code{\link{R6Class}} for modelling an ISO EvaluationMethodType +} +\description{ +ISOEvaluationMethodType +} +\section{Fields}{ + +\describe{ +\item{\code{value}}{} +}} +\section{Methods}{ + +\describe{ + \item{\code{new(xml,value)}}{ + This method is used to instantiate an ISOEvaluationMethodType + } +} +} +\examples{ +#possible values + values <- ISOEvaluationMethodType$values(labels = TRUE) + + #example of EvaluationMethodType + indirect <- ISOEvaluationMethodType$new(value = "indirect") +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19115:2003 - Geographic information -- Metadata +} +\keyword{EvaluationMethodType} +\keyword{ISO} + diff --git a/man/ISOGriddedDataPositionalAccuracy.Rd b/man/ISOGriddedDataPositionalAccuracy.Rd new file mode 100644 index 00000000..227fce77 --- /dev/null +++ b/man/ISOGriddedDataPositionalAccuracy.Rd @@ -0,0 +1,66 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/ISOGriddedDataPositionalAccuracy.R +\docType{class} +\name{ISOGriddedDataPositionalAccuracy} +\alias{ISOGriddedDataPositionalAccuracy} +\title{ISOGriddedDataPositionalAccuracy} +\format{\code{\link{R6Class}} object.} +\usage{ +ISOGriddedDataPositionalAccuracy +} +\value{ +Object of \code{\link{R6Class}} for modelling an ISOGriddedDataPositionalAccuracy +} +\description{ +ISOGriddedDataPositionalAccuracy +} +\section{Inherited methods from \code{ISODataQualityAbstractElement}}{ + +} + +\section{Methods}{ + +\describe{ + \item{\code{new(xml)}}{ + This method is used to instantiate an ISOGriddedDataPositionalAccuracy + } +} +} +\examples{ +#encoding + dq <- ISOGriddedDataPositionalAccuracy$new() + dq$addNameOfMeasure("measure") + metaId <- ISOMetaIdentifier$new(code = "measure-id") + dq$setMeasureIdentification(metaId) + dq$setMeasureDescription("description") + dq$setEvaluationMethodDescription("method description") + dq$setEvaluationMethodType("indirect") + dq$setDateTime(ISOdate(2015,1,1,12,10,49)) + spec <- ISOCitation$new() + spec$setTitle("specification title") + spec$setAlternateTitle("specification alternate title") + d <- ISODate$new() + d$setDate(ISOdate(2015, 1, 1, 1)) + d$setDateType("publication") + spec$addDate(d) + dq$setEvaluationProcedure(spec) + result <- ISOConformanceResult$new() + result$setSpecification(spec) + result$setExplanation("some explanation about the conformance") + result$setPass(TRUE) + dq$addResult(result) + xml <- dq$encode() +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19115:2003 - Geographic information -- Metadata +} +\keyword{ISO} +\keyword{accuracy} +\keyword{data} +\keyword{gridded} +\keyword{positional} +\keyword{quality} + diff --git a/man/ISORelativeInternalPositionalAccuracy.Rd b/man/ISORelativeInternalPositionalAccuracy.Rd new file mode 100644 index 00000000..6ce3a280 --- /dev/null +++ b/man/ISORelativeInternalPositionalAccuracy.Rd @@ -0,0 +1,67 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/ISORelativeInternalPositionalAccuracy.R +\docType{class} +\name{ISORelativeInternalPositionalAccuracy} +\alias{ISORelativeInternalPositionalAccuracy} +\title{ISORelativeInternalPositionalAccuracy} +\format{\code{\link{R6Class}} object.} +\usage{ +ISORelativeInternalPositionalAccuracy +} +\value{ +Object of \code{\link{R6Class}} for modelling an ISORelativeInternalPositionalAccuracy +} +\description{ +ISORelativeInternalPositionalAccuracy +} +\section{Inherited methods from \code{ISODataQualityAbstractElement}}{ + +} + +\section{Methods}{ + +\describe{ + \item{\code{new(xml)}}{ + This method is used to instantiate an ISORelativeInternalPositionalAccuracy + } +} +} +\examples{ +#encoding + dq <- ISORelativeInternalPositionalAccuracy$new() + dq$addNameOfMeasure("measure") + metaId <- ISOMetaIdentifier$new(code = "measure-id") + dq$setMeasureIdentification(metaId) + dq$setMeasureDescription("description") + dq$setEvaluationMethodDescription("method description") + dq$setEvaluationMethodType("indirect") + dq$setDateTime(ISOdate(2015,1,1,12,10,49)) + spec <- ISOCitation$new() + spec$setTitle("specification title") + spec$setAlternateTitle("specification alternate title") + d <- ISODate$new() + d$setDate(ISOdate(2015, 1, 1, 1)) + d$setDateType("publication") + spec$addDate(d) + dq$setEvaluationProcedure(spec) + result <- ISOConformanceResult$new() + result$setSpecification(spec) + result$setExplanation("some explanation about the conformance") + result$setPass(TRUE) + dq$addResult(result) + xml <- dq$encode() +} +\author{ +Emmanuel Blondel +} +\references{ +ISO 19115:2003 - Geographic information -- Metadata +} +\keyword{ISO} +\keyword{accuracy} +\keyword{data} +\keyword{internal} +\keyword{positional} +\keyword{quality} +\keyword{relative} + diff --git a/tests/testthat/test_ISODataQualityAbstractElement.R b/tests/testthat/test_ISODataQualityAbstractElement.R new file mode 100644 index 00000000..f6599687 --- /dev/null +++ b/tests/testthat/test_ISODataQualityAbstractElement.R @@ -0,0 +1,50 @@ +# test_ISODataQualityAbstractElement.R +# Author: Emmanuel Blondel +# +# Description: Unit tests for ISODataQualityAbstractElement.R +#======================= +require(geometa, quietly = TRUE) +require(testthat) + +context("ISODataQualityAbstractElement") + +test_that("encoding",{ + + #encoding + dq <- ISODataQualityAbstractElement$new() + dq$addNameOfMeasure("measure") + metaId <- ISOMetaIdentifier$new(code = "measure-id") + dq$setMeasureIdentification(metaId) + dq$setMeasureDescription("description") + dq$setEvaluationMethodDescription("method description") + dq$setEvaluationMethodType("indirect") + dq$setDateTime(ISOdate(2015,1,1,12,10,49)) + + #procedure + spec <- ISOCitation$new() + spec$setTitle("specification title") + spec$setAlternateTitle("specification alternate title") + d <- ISODate$new() + d$setDate(ISOdate(2015, 1, 1, 1)) + d$setDateType("publication") + spec$addDate(d) + dq$setEvaluationProcedure(spec) + + #result + result <- ISOConformanceResult$new() + result$setSpecification(spec) + result$setExplanation("some explanation about the conformance") + result$setPass(TRUE) + dq$addResult(result) + + #xml + xml <- dq$encode(validate=F) + expect_is(xml, "XMLInternalNode") + + #decoding + dq2 <- ISODataQualityAbstractElement$new(xml = xml) + xml2 <- dq2$encode(validate=F) + + expect_true(ISOAbstractObject$compare(dq, dq2)) + +}) \ No newline at end of file diff --git a/tests/testthat/test_ISOPositionalAccuracy.R b/tests/testthat/test_ISOPositionalAccuracy.R new file mode 100644 index 00000000..f75c9eaf --- /dev/null +++ b/tests/testthat/test_ISOPositionalAccuracy.R @@ -0,0 +1,141 @@ +# test_ISOPositionalAccuracy.R +# Author: Emmanuel Blondel +# +# Description: Unit tests for ISOPositionalAccuracy.R +#======================= +require(geometa, quietly = TRUE) +require(testthat) + +context("ISOPositionalAccuracy") + +test_that("ISOAbstractPositionalAccuracy",{ + #encoding + dq <- ISOAbstractPositionalAccuracy$new() + dq$addNameOfMeasure("measure") + metaId <- ISOMetaIdentifier$new(code = "measure-id") + dq$setMeasureIdentification(metaId) + dq$setMeasureDescription("description") + dq$setEvaluationMethodDescription("method description") + dq$setEvaluationMethodType("indirect") + dq$setDateTime(ISOdate(2015,1,1,12,10,49)) + spec <- ISOCitation$new() + spec$setTitle("specification title") + spec$setAlternateTitle("specification alternate title") + d <- ISODate$new() + d$setDate(ISOdate(2015, 1, 1, 1)) + d$setDateType("publication") + spec$addDate(d) + dq$setEvaluationProcedure(spec) + result <- ISOConformanceResult$new() + result$setSpecification(spec) + result$setExplanation("some explanation about the conformance") + result$setPass(TRUE) + dq$addResult(result) + xml <- dq$encode(validate=F) + expect_is(xml, "XMLInternalNode") + #decoding + dq2 <- ISOAbstractPositionalAccuracy$new(xml = xml) + xml2 <- dq2$encode(validate=F) + #identity + expect_true(ISOAbstractObject$compare(dq, dq2)) + +}) + +test_that("ISORelativeInternalPositionalAccuracy",{ + #encoding + dq <- ISORelativeInternalPositionalAccuracy$new() + dq$addNameOfMeasure("measure") + metaId <- ISOMetaIdentifier$new(code = "measure-id") + dq$setMeasureIdentification(metaId) + dq$setMeasureDescription("description") + dq$setEvaluationMethodDescription("method description") + dq$setEvaluationMethodType("indirect") + dq$setDateTime(ISOdate(2015,1,1,12,10,49)) + spec <- ISOCitation$new() + spec$setTitle("specification title") + spec$setAlternateTitle("specification alternate title") + d <- ISODate$new() + d$setDate(ISOdate(2015, 1, 1, 1)) + d$setDateType("publication") + spec$addDate(d) + dq$setEvaluationProcedure(spec) + result <- ISOConformanceResult$new() + result$setSpecification(spec) + result$setExplanation("some explanation about the conformance") + result$setPass(TRUE) + dq$addResult(result) + xml <- dq$encode() + expect_is(xml, "XMLInternalNode") + #decoding + dq2 <- ISORelativeInternalPositionalAccuracy$new(xml = xml) + xml2 <- dq2$encode() + #identity + expect_true(ISOAbstractObject$compare(dq, dq2)) + +}) + +test_that("ISOGriddedDataPositionalAccuracy",{ + #encoding + dq <- ISOGriddedDataPositionalAccuracy$new() + dq$addNameOfMeasure("measure") + metaId <- ISOMetaIdentifier$new(code = "measure-id") + dq$setMeasureIdentification(metaId) + dq$setMeasureDescription("description") + dq$setEvaluationMethodDescription("method description") + dq$setEvaluationMethodType("indirect") + dq$setDateTime(ISOdate(2015,1,1,12,10,49)) + spec <- ISOCitation$new() + spec$setTitle("specification title") + spec$setAlternateTitle("specification alternate title") + d <- ISODate$new() + d$setDate(ISOdate(2015, 1, 1, 1)) + d$setDateType("publication") + spec$addDate(d) + dq$setEvaluationProcedure(spec) + result <- ISOConformanceResult$new() + result$setSpecification(spec) + result$setExplanation("some explanation about the conformance") + result$setPass(TRUE) + dq$addResult(result) + xml <- dq$encode() + expect_is(xml, "XMLInternalNode") + #decoding + dq2 <- ISOGriddedDataPositionalAccuracy$new(xml = xml) + xml2 <- dq2$encode() + #identity + expect_true(ISOAbstractObject$compare(dq, dq2)) + +}) + +test_that("ISOAbsoluteExternalPositionalAccuracy",{ + #encoding + dq <- ISOAbsoluteExternalPositionalAccuracy$new() + dq$addNameOfMeasure("measure") + metaId <- ISOMetaIdentifier$new(code = "measure-id") + dq$setMeasureIdentification(metaId) + dq$setMeasureDescription("description") + dq$setEvaluationMethodDescription("method description") + dq$setEvaluationMethodType("indirect") + dq$setDateTime(ISOdate(2015,1,1,12,10,49)) + spec <- ISOCitation$new() + spec$setTitle("specification title") + spec$setAlternateTitle("specification alternate title") + d <- ISODate$new() + d$setDate(ISOdate(2015, 1, 1, 1)) + d$setDateType("publication") + spec$addDate(d) + dq$setEvaluationProcedure(spec) + result <- ISOConformanceResult$new() + result$setSpecification(spec) + result$setExplanation("some explanation about the conformance") + result$setPass(TRUE) + dq$addResult(result) + xml <- dq$encode() + expect_is(xml, "XMLInternalNode") + #decoding + dq2 <- ISOAbsoluteExternalPositionalAccuracy$new(xml = xml) + xml2 <- dq2$encode() + #identity + expect_true(ISOAbstractObject$compare(dq, dq2)) + +}) \ No newline at end of file