Learn R Programming

dataone (version 2.2.2)

MNode-class: Provides R API to DataONE Member Node services.

Description

MNode provides functions that interact with a DataONE Member Node (MN). A MN is a repository that provides access for reading and writing data and metadata using the DataONE MN service API. The MN API includes functions for retrieving data and metadata based on its unique persistent identifier (pid), as well as for creating, updating, and archiving these data and metadata objects.

Arguments

Slots

endpoint

The url to access node services, which is the baseURL plus the version string

Methods

  • MNode: Create a MNode object representing a DataONE Member Node repository.

  • createObject: Create an object on a Member Node.

  • getObject: Get the bytes associated with an object on the Member Node

  • getCapabilities: Get the node capabilities description, and store the information in the MNode.

  • generateIdentifier: Get a unique identifier that is generated by the Member Node repository and guaranteed to be unique.

  • getPackage: Download a data package from a member node.

  • updateObject: Update an object to a Member Node, by creating a new object that replaces an original.

  • updateSystemMetadata: Update the system metadata associated with an object.

Details

Methods that perform write operations (such as createObject and updateObject) on the MN generally require authentication. For MNs that have implemented the DataONE API version 2.0 and higher, these operations can utilize an authentication token to provide credentials for write operations in DataONE. The authentication token is obtained from DataONE (see your account profile on https://search.dataone.org). See the vignette("dataone-overview") for details. Alternatively, the version 1.0 approach of using an X.509 certificate in a default location of the file system can also be used. This certificate provides authentication credentials from CILogon https://cilogon.org/?skin=DataONE.

See Also

dataone package description.

Examples

Run this code
# NOT RUN {
library(dataone)
library(uuid)
library(digest)
cn <- CNode("STAGING")
mn <- getMNode(cn, "urn:node:mnStageUCSB2")
mnid <- mn@identifier
# Have Dataone create an identifier for you (requires authentication)
\dontrun{
newid <- generateIdentifier(mn, "UUID")
}
# Create an identifier manually
newid <- paste("urn:uuid:", UUIDgenerate(), sep="")
testdf <- data.frame(x=1:10,y=11:20)
csvfile <- paste(tempfile(), ".csv", sep="")
write.csv(testdf, csvfile, row.names=FALSE)
f <- "text/csv"
size <- file.info(csvfile)$size
sha256 <- digest(csvfile, algo="sha256", serialize=FALSE, file=TRUE)
sysmeta <- new("SystemMetadata", identifier=newid, formatId=f, size=size,
    checksum=sha256, originMemberNode=mnid, authoritativeMemberNode=mnid)
# Upload data to DataONE (requires authentication)
\dontrun{
response <- createObject(mn, newid, csvfile, sysmeta)
}
# }

Run the code above in your browser using DataLab