-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
278 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#' CSWDescribeRecord | ||
#' | ||
#' @docType class | ||
#' @export | ||
#' @keywords OGC CSW DescribeRecord | ||
#' @return Object of \code{\link{R6Class}} for modelling a CSW DescribeRecord request | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{new(url, version, namespace, ...)}}{ | ||
#' This method is used to instantiate a CSWDescribeRecord object | ||
#' } | ||
#' } | ||
#' | ||
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com> | ||
#' | ||
CSWDescribeRecord <- R6Class("CSWDescribeRecord", | ||
inherit = OWSRequest, | ||
private = list( | ||
name = "DescribeRecord", | ||
defaultNamespace = "csw:http://www.opengis.net/cat/csw/2.0.2" | ||
), | ||
public = list( | ||
initialize = function(op, url, version, namespace = NULL, logger = NULL, ...) { | ||
namedParams <- list(request = private$name, version = version) | ||
|
||
#default output schema | ||
if(is.null(namespace)){ | ||
namespace <- private$defaultNamespace | ||
} | ||
|
||
#other default params | ||
#note: normally typeName not mandatory in DescribeRecord | ||
typeName <- switch(namespace, | ||
"gmd:http://www.isotc211.org/2005/gmd" = "gmd:MD_Metadata", | ||
"gfc:http://www.isotc211.org/2005/gfc" = "gfc:FC_FeatureCatalogue", | ||
"csw:http://www.opengis.net/cat/csw/2.0.2" = "csw:Record", | ||
"dcat:http://www.w3.org/ns/dcat#" = "dcat" | ||
) | ||
namedParams <- c(namedParams, namespace = namespace, typeName = typeName) | ||
|
||
super$initialize(op, url, namedParams, mimeType = "text/xml", logger = logger, ...) | ||
|
||
#binding to XML schema | ||
xsdObjs <- getNodeSet(self$response, "//ns:schema", c(ns = "http://www.w3.org/2001/XMLSchema")) | ||
if(length(xsdObjs)>0){ | ||
xsdObj <- xsdObjs[[1]] | ||
tempf = tempfile() | ||
destfile = paste(tempf,".xsd",sep='') | ||
saveXML(xsdObj, destfile) | ||
self$response <- xmlSchemaParse(destfile) | ||
}else{ | ||
self$response <- NULL | ||
} | ||
} | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#' CSWGetRecords | ||
#' | ||
#' @docType class | ||
#' @export | ||
#' @keywords OGC CSW GetRecords | ||
#' @return Object of \code{\link{R6Class}} for modelling a CSW GetRecords request | ||
#' @format \code{\link{R6Class}} object. | ||
#' | ||
#' @section Methods: | ||
#' \describe{ | ||
#' \item{\code{new(url, version, constraints, ...)}}{ | ||
#' This method is used to instantiate a CSWGetRecords object | ||
#' } | ||
#' } | ||
#' | ||
#' @author Emmanuel Blondel <emmanuel.blondel1@@gmail.com> | ||
#' | ||
CSWGetRecords <- R6Class("CSWGetRecords", | ||
inherit = OWSRequest, | ||
private = list( | ||
name = "GetRecords", | ||
defaultOutputSchema = "http://www.opengis.net/cat/csw/2.0.2" | ||
), | ||
public = list( | ||
initialize = function(op, url, version, constraint = NULL, logger = NULL, ...) { | ||
namedParams <- list(request = private$name, version = version) | ||
if(!is.null(constraint)) namedParams <- c(namedParams, constraint = constraint) | ||
|
||
#default output schema | ||
outputSchema <- list(...)$outputSchema | ||
if(is.null(outputSchema)){ | ||
outputSchema <- private$defaultOutputSchema | ||
namedParams <- c(namedParams, outputSchema = outputSchema) | ||
} | ||
|
||
#other default params | ||
typeNames <- switch(outputSchema, | ||
"http://www.isotc211.org/2005/gmd" = "gmd:MD_Metadata", | ||
"http://www.isotc211.org/2005/gfc" = "gfc:FC_FeatureCatalogue", | ||
"http://www.opengis.net/cat/csw/2.0.2" = "csw:Record", | ||
"http://www.w3.org/ns/dcat#" = "dcat" | ||
) | ||
namedParams <- c(namedParams, typeNames = typeNames) | ||
namedParams[["resultType"]] <- "results" | ||
namedParams[["CONSTRAINTLANGUAGE"]] <- "CQL_TEXT" | ||
|
||
super$initialize(op, url, namedParams, mimeType = "text/xml", logger = logger, ...) | ||
|
||
#bindings | ||
self$response <- switch(outputSchema, | ||
"http://www.isotc211.org/2005/gmd" = { | ||
out <- NULL | ||
xmlObjs <- getNodeSet(self$response, "//ns:MD_Metadata", c(ns = outputSchema)) | ||
if(length(xmlObjs)>0){ | ||
out <- lapply(xmlObjs,function(xmlObj){ | ||
out.obj <- geometa::ISOMetadata$new() | ||
out.obj$decode(xml = xmlObj) | ||
return(out.obj) | ||
}) | ||
} | ||
out | ||
}, | ||
"http://www.isotc211.org/2005/gfc" = { | ||
out <- NULL | ||
xmlObjs <- getNodeSet(self$response, "//ns:FC_FeatureCatalogue", c(ns = outputSchema)) | ||
if(length(xmlObjs)>0){ | ||
out <- lapply(xmlObjs,function(xmlObj){ | ||
out.obj <- geometa::ISOFeatureCatalogue$new() | ||
out.obj$decode(xml = xmlObj) | ||
return(out.obj) | ||
}) | ||
} | ||
out | ||
}, | ||
"http://www.opengis.net/cat/csw/2.0.2" = { | ||
warnings(sprintf("R binding not yet supported for '%s'", outputSchema)) | ||
self$response | ||
}, | ||
"http://www.w3.org/ns/dcat#" = { | ||
warnings(sprintf("R binding not yet supported for '%s'", outputSchema)) | ||
self$response | ||
} | ||
) | ||
} | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.