From c956eb0022048f7327193a26009ffbf4611767d2 Mon Sep 17 00:00:00 2001 From: eblondel Date: Mon, 26 Sep 2022 23:48:41 +0200 Subject: [PATCH] support SWE DataRecord #187 --- NAMESPACE | 1 + R/SWEDataRecord.R | 50 +++++++++++++++++++ .../coverage/geometa_coverage_inventory.csv | 2 +- .../coverage/geometa_coverage_summary.csv | 2 +- .../coverage/geometa_coverage_summary.md | 2 +- man/SWEDataRecord.Rd | 49 ++++++++++++++++++ 6 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 R/SWEDataRecord.R create mode 100644 man/SWEDataRecord.Rd diff --git a/NAMESPACE b/NAMESPACE index 1809d9ba..532df353 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -326,6 +326,7 @@ export(SWECategory) export(SWECategoryRange) export(SWECount) export(SWECountRange) +export(SWEDataRecord) export(SWEQuantity) export(SWEQuantityRange) export(SWEText) diff --git a/R/SWEDataRecord.R b/R/SWEDataRecord.R new file mode 100644 index 00000000..2f9daf1b --- /dev/null +++ b/R/SWEDataRecord.R @@ -0,0 +1,50 @@ +#' SWEDataRecord +#' +#' @docType class +#' @importFrom R6 R6Class +#' @export +#' @keywords ISO SWE +#' @return Object of \code{\link{R6Class}} for modelling an SWE data record +#' @format \code{\link{R6Class}} object. +#' +#' @note Class used internally by geometa +#' +#' @references +#' SWE Common Data Model Encoding Standard. https://www.ogc.org/standards/swecommon +#' +#' @author Emmanuel Blondel +#' +SWEDataRecord <- R6Class("SWEDataRecord", + inherit = SWEAbstractDataComponent, + private = list( + xmlElement = "DataRecord", + xmlNamespacePrefix = "SWE" + ), + public = list( + #'@field field field + field = list(), + + #'@description Initializes an object of class \link{SWEDataRecord} + #'@param xml object of class \link{XMLInternalNode-class} from \pkg{XML} + #'@param element element + #'@param updatable updatable + #'@param optional optional + #'@param definition definition + initialize = function(xml = NULL, element = NULL, updatable = NULL, optional = FALSE, definition = NULL){ + if(is.null(element)) element <- private$xmlElement + super$initialize(xml, element = element, updatable = updatable, optional = optional, definition = definition) + }, + + #'@description Adds field + #'@param field field + addField = function(field){ + return(self$addListElement("field", field)) + }, + + #'@description Deletes field + #'@param field field + delField = function(field){ + return(self$delListElement("field", field)) + } + ) +) \ No newline at end of file diff --git a/inst/extdata/coverage/geometa_coverage_inventory.csv b/inst/extdata/coverage/geometa_coverage_inventory.csv index db5ad460..4e311440 100644 --- a/inst/extdata/coverage/geometa_coverage_inventory.csv +++ b/inst/extdata/coverage/geometa_coverage_inventory.csv @@ -490,7 +490,7 @@ "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","CountRange","SWECountRange",TRUE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataArray","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataChoice","",FALSE -"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataRecord","",FALSE +"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataRecord","SWEDataRecord",TRUE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","DataStream","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","Matrix","",FALSE "SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE","NilValues","",FALSE diff --git a/inst/extdata/coverage/geometa_coverage_summary.csv b/inst/extdata/coverage/geometa_coverage_summary.csv index 0511c562..fc07af78 100644 --- a/inst/extdata/coverage/geometa_coverage_summary.csv +++ b/inst/extdata/coverage/geometa_coverage_summary.csv @@ -8,4 +8,4 @@ "GML 3.2.1 (ISO 19136)","Geographic Markup Language","GML",63,106,37.28 "GML 3.2.1 Coverage (OGC GMLCOV)","OGC GML Coverage Implementation Schema","GMLCOV",1,0,100 "GML 3.3 Referenceable Grid (OGC GML)","OGC GML Referenceable Grid","GMLRGRID",5,0,100 -"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE",11,19,36.67 +"SWE 2.0","Sensor Web Enablement (SWE) Common Data Model","SWE",12,18,40 diff --git a/inst/extdata/coverage/geometa_coverage_summary.md b/inst/extdata/coverage/geometa_coverage_summary.md index ad67cd96..c6bea958 100644 --- a/inst/extdata/coverage/geometa_coverage_summary.md +++ b/inst/extdata/coverage/geometa_coverage_summary.md @@ -9,4 +9,4 @@ |GML 3.2.1 (ISO 19136) |Geographic Markup Language |GML |[![GML 3.2.1 (ISO 19136)](https://img.shields.io/badge/-37%25-ff0c0c.svg)](https://github.com/eblondel/geometa) | 63| 106| |GML 3.2.1 Coverage (OGC GMLCOV) |OGC GML Coverage Implementation Schema |GMLCOV |[![GML 3.2.1 Coverage (OGC GMLCOV)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) | 1| 0| |GML 3.3 Referenceable Grid (OGC GML) |OGC GML Referenceable Grid |GMLRGRID |[![GML 3.3 Referenceable Grid (OGC GML)](https://img.shields.io/badge/-100%25-4a4ea8.svg)](https://github.com/eblondel/geometa) | 5| 0| -|SWE 2.0 |Sensor Web Enablement (SWE) Common Data Model |SWE |[![SWE 2.0](https://img.shields.io/badge/-37%25-ff0c0c.svg)](https://github.com/eblondel/geometa) | 11| 19| +|SWE 2.0 |Sensor Web Enablement (SWE) Common Data Model |SWE |[![SWE 2.0](https://img.shields.io/badge/-40%25-f9ae2c.svg)](https://github.com/eblondel/geometa) | 12| 18| diff --git a/man/SWEDataRecord.Rd b/man/SWEDataRecord.Rd new file mode 100644 index 00000000..bbf02e91 --- /dev/null +++ b/man/SWEDataRecord.Rd @@ -0,0 +1,49 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/SWEDataRecord.R +\docType{class} +\name{SWEDataRecord} +\alias{SWEDataRecord} +\title{SWEDataRecord} +\format{ +\code{\link{R6Class}} object. +} +\arguments{ +\item{xml}{object of class \link{XMLInternalNode-class} from \pkg{XML}} + +\item{element}{element} + +\item{updatable}{updatable} + +\item{optional}{optional} + +\item{definition}{definition} + +\item{field}{field} +} +\value{ +Object of \code{\link{R6Class}} for modelling an SWE data record +} +\description{ +Initializes an object of class \link{SWEDataRecord} + +Adds field + +Deletes field +} +\section{Fields}{ + +\describe{ +\item{\code{field}}{field} +}} + +\note{ +Class used internally by geometa +} +\references{ +SWE Common Data Model Encoding Standard. https://www.ogc.org/standards/swecommon +} +\author{ +Emmanuel Blondel +} +\keyword{ISO} +\keyword{SWE}