CSWClient
CSWClient
Format
R6Class
object.
Value
Object of R6Class
with methods for interfacing an OGC
Catalogue Service for the Web.
Super classes
ows4R::OGCAbstractObject
-> ows4R::OWSClient
-> CSWClient
Methods
Inherited methods
ows4R::OGCAbstractObject$ERROR()
ows4R::OGCAbstractObject$INFO()
ows4R::OGCAbstractObject$WARN()
ows4R::OGCAbstractObject$encode()
ows4R::OGCAbstractObject$getClass()
ows4R::OGCAbstractObject$getClassName()
ows4R::OGCAbstractObject$getNamespaceDefinition()
ows4R::OGCAbstractObject$isFieldInheritedFrom()
ows4R::OGCAbstractObject$logger()
ows4R::OGCAbstractObject$print()
ows4R::OWSClient$getCASUrl()
ows4R::OWSClient$getConfig()
ows4R::OWSClient$getHeaders()
ows4R::OWSClient$getPwd()
ows4R::OWSClient$getToken()
ows4R::OWSClient$getUrl()
ows4R::OWSClient$getUser()
ows4R::OWSClient$getVersion()
Method new()
This method is used to instantiate a CSWClient with the url
of the
OGC service. Authentication is supported using basic auth (using user
/pwd
arguments),
bearer token (using token
argument), or custom (using headers
argument). By default, the logger
argument will be set to NULL
(no logger). This argument accepts two possible
values: INFO
: to print only ows4R logs, DEBUG
: to print more verbose logs
Method describeRecord()
Describe records. Retrieves the XML schema for CSW records. By default, returns the XML schema
for the CSW records (http://www.opengis.net/cat/csw/2.0.2). For other schemas, specify the
outputSchema
required, e.g. http://www.isotc211.org/2005/gmd for ISO 19115/19139 schema
Arguments
namespace
namespace
...
any other parameter to pass to the CSWDescribeRecord service request
Method getRecordById()
Get a record by Id. By default, the record will be returned following the CSW schema
(http://www.opengis.net/cat/csw/2.0.2). For other schemas, specify the outputSchema
required, e.g. http://www.isotc211.org/2005/gmd for ISO 19115/19139 records.
The parameter elementSetName
should among values "full", "brief", "summary". The default
"full" corresponds to the full metadata sheet returned. "brief" and "summary" will contain only
a subset of the metadata content.
Arguments
id
record id
elementSetName
element set name. Default is "full"
...
any other parameter to pass to CSWGetRecordById service request
Method getRecords()
Get records based on a query, object of class CSWQuery
. The maximum number of records can be
set either for the full query (maxRecords
) or per request (maxRecordsPerRequest
, default set to 10 records)
considering this operation is paginated. By default, the record will be returned following the CSW schema
(http://www.opengis.net/cat/csw/2.0.2). For other schemas, specify the outputSchema
required, e.g. http://www.isotc211.org/2005/gmd for ISO 19115/19139 records.
Usage
CSWClient$getRecords(
query = CSWQuery$new(),
maxRecords = NULL,
maxRecordsPerRequest = 10L,
...
)
Arguments
query
an object of class CSWQuery. By default, an empty query is set.
maxRecords
max number of total records. Default is
NULL
meaning all records are returned.maxRecordsPerRequest
max number of records to return per request. Default set to 10.
...
any other parameter to be passed to CSWGetRecords service request
Method transaction()
Generic transaction method. Used for inserting, updating or deleting metadata using the transactional CSW service.
The type
gives the type of transaction (Insert, Update, or Delete). The record
Arguments
type
of transaction either "Insert", "Update" or "Delete"
record
the record subject of the transaction
recordProperty
record property, object of class CSWRecordProperty
constraint
constraint, object of class CSWConstraint
...
any other parameter to pass to CSWTransaction service request
Method updateRecord()
Updates an existing record
Arguments
record
record subject of the Insertion
recordProperty
record property, object of class CSWRecordProperty
constraint
constraint, object of class CSWConstraint
...
any other parameter to pass to the transaction
Method deleteRecord()
Deletes an existing (set of) record(s). A constraint (object of class CSWConstraint
)
can be specified to limit the deletion to some records.
Arguments
record
record subject of the Insertion
constraint
constraint, object of class CSWConstraint
...
any other parameter to pass to the transaction
Method deleteRecordById()
Deletes an existing record by identifier (constraint used to identify the record based on its identifier).
Method harvestRecord()
Harvests a single record from a sourceUrl
, given a resourceType
(by default "http://www.isotc211.org/2005/gmd").
Method harvestNode()
Harvests a CSW node (having its endpoint defined by an url
). A query
(object of class CSWQuery
) can be
specificed if needed to restrain the harvesting to a subset. The resourceType
defines the type of resources to be harvested
(by default "http://www.isotc211.org/2005/gmd")
Usage
CSWClient$harvestNode(
url,
query = CSWQuery$new(),
resourceType = "http://www.isotc211.org/2005/gmd",
sourceBaseUrl
)
Arguments
url
CSW node URL
query
a CSW query, object of class CSWQuery
resourceType
resource type. Default is "http://www.isotc211.org/2005/gmd"
sourceBaseUrl
source base URL
Examples
# \dontrun{
#example based on CSW endpoint responding at http://localhost:8000/csw
csw <- CSWClient$new("http://localhost:8000/csw", serviceVersion = "2.0.2")
#> Error in curl::curl_fetch_memory(url, handle = handle): Failed to connect to localhost port 8000 after 0 ms: Connection refused
#get capabilities
caps <- csw$getCapabilities()
#> Error in eval(expr, envir, enclos): object 'csw' not found
#get records
records <- csw$getRecords()
#> Error in eval(expr, envir, enclos): object 'csw' not found
#get record by id
record <- csw$getRecordById("my-metadata-id")
#> Error in eval(expr, envir, enclos): object 'csw' not found
#Advanced examples at https://github.com/eblondel/ows4R/wiki#csw
# }