| CSWClient {ows4R} | R Documentation |
CSWClient
Description
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
Public 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
Usage
CSWClient$new( url, serviceVersion = NULL, user = NULL, pwd = NULL, token = NULL, headers = c(), config = httr::config(), cas_url = NULL, logger = NULL )
Arguments
urlurl
serviceVersionCSW service version
useruser
pwdpassword
tokentoken
headersheaders
configconfig
cas_urlCentral Authentication Service (CAS) URL
loggerlogger
Method getCapabilities()
Get CSW capabilities
Usage
CSWClient$getCapabilities()
Returns
an object of class CSWCapabilities
Method reloadCapabilities()
Reloads CSW capabilities
Usage
CSWClient$reloadCapabilities()
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
Usage
CSWClient$describeRecord(namespace, ...)
Arguments
namespacenamespace
...any other parameter to pass to the CSWDescribeRecord service request
Returns
the service record description
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.
Usage
CSWClient$getRecordById(id, elementSetName = "full", ...)
Arguments
idrecord id
elementSetNameelement set name. Default is "full"
...any other parameter to pass to CSWGetRecordById service request
Returns
the fetched record, NULL otherwise
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
queryan object of class CSWQuery. By default, an empty query is set.
maxRecordsmax number of total records. Default is
NULLmeaning all records are returned.maxRecordsPerRequestmax number of records to return per request. Default set to 10.
...any other parameter to be passed to CSWGetRecords service request
Returns
the list of records. By default each record will be returned as Dublin Core list object. In case
ISO 19115/19139 is set as outputSchema, each record will be object of class ISOMetadata from
geometa.
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
Usage
CSWClient$transaction( type, record = NULL, recordProperty = NULL, constraint = NULL, ... )
Arguments
typeof transaction either "Insert", "Update" or "Delete"
recordthe record subject of the transaction
recordPropertyrecord property, object of class CSWRecordProperty
constraintconstraint, object of class CSWConstraint
...any other parameter to pass to CSWTransaction service request
Returns
TRUE if transaction succeeded, FALSE otherwise
Method insertRecord()
Inserts a new record
Usage
CSWClient$insertRecord(record, ...)
Arguments
recordrecord subject of the Insertion
...any other parameter to pass to the transaction
Returns
TRUE if insertion succeeded, FALSE otherwise
Method updateRecord()
Updates an existing record
Usage
CSWClient$updateRecord( record = NULL, recordProperty = NULL, constraint = NULL, ... )
Arguments
recordrecord subject of the Insertion
recordPropertyrecord property, object of class CSWRecordProperty
constraintconstraint, object of class CSWConstraint
...any other parameter to pass to the transaction
Returns
TRUE if update succeeded, FALSE otherwise
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.
Usage
CSWClient$deleteRecord(record = NULL, constraint = NULL, ...)
Arguments
recordrecord subject of the Insertion
constraintconstraint, object of class CSWConstraint
...any other parameter to pass to the transaction
Returns
TRUE if deletion succeeded, FALSE otherwise
Method deleteRecordById()
Deletes an existing record by identifier (constraint used to identify the record based on its identifier).
Usage
CSWClient$deleteRecordById(id)
Arguments
idrecord id
Returns
TRUE if deletion succeeded, FALSE otherwise
Method harvestRecord()
Harvests a single record from a sourceUrl, given a resourceType (by default "http://www.isotc211.org/2005/gmd").
Usage
CSWClient$harvestRecord( sourceUrl, resourceType = "http://www.isotc211.org/2005/gmd" )
Arguments
sourceUrlsource URL
resourceTyperesource type. Default is "http://www.isotc211.org/2005/gmd"
Returns
TRUE if harvesting succeeded, FALSE otherwise
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
urlCSW node URL
querya CSW query, object of class CSWQuery
resourceTyperesource type. Default is "http://www.isotc211.org/2005/gmd"
sourceBaseUrlsource base URL
Returns
an object of class list giving the number of records found and those actually harvested
Method clone()
The objects of this class are cloneable with this method.
Usage
CSWClient$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Author(s)
Emmanuel Blondel <emmanuel.blondel1@gmail.com>
Examples
## Not run:
#example based on CSW endpoint responding at http://localhost:8000/csw
csw <- CSWClient$new("http://localhost:8000/csw", serviceVersion = "2.0.2")
#get capabilities
caps <- csw$getCapabilities()
#get records
records <- csw$getRecords()
#get record by id
record <- csw$getRecordById("my-metadata-id")
#Advanced examples at https://github.com/eblondel/ows4R/wiki#csw
## End(Not run)