DataObject is a wrapper class that associates raw data or a data file with system-level metadata
describing the data. The system metadata includes attributes such as the object's identifier,
type, size, checksum, owner, version relationship to other objects, access rules, and other critical metadata.
The SystemMetadata is compliant with the DataONE federated repository network's definition of SystemMetadata, and
is encapsulated as a separate object of type
SystemMetadata that can be manipulated as needed. Additional science-level and
domain-specific metadata is out-of-scope for SystemMetadata, which is intended only for critical metadata for
managing objects in a repository system.
A DataObject can be constructed by passing the data and SystemMetadata to the new() method, or by passing an identifier, data, format, user, and DataONE node identifier, in which case a SystemMetadata instance will be generated with these fields and others that are calculated (such as size and checksum).
Data are associated with the DataObject either by passing it as a
'raw' value to the
parameter in the constructor, which is then stored in memory, or by passing a fully qualified file path to the
data in the
'filename' parameter, which is then stored on disk. One of dataobj or filename is required.
'filename' approach when data are too large to be managed effectively in memory. Callers can
'filename' slot to get direct access to the file, or can call
'getData()' to retrieve the
contents of the data or file as a raw value (but this will read all of the data into memory).
A value of type
"SystemMetadata", containing the metadata about the object
A value of type
"raw", containing the data represented in this object
A character value that contains the fully-qualified path to the object data on disk
A character value for the URL used to load data into this DataObject
A hash containing logical values which indicate if system metadata or the data object have been updated since object creation.
A character string containing the previous identifier used, before a
initialize: Initialize a DataObject
addAccessRule: Add a Rule to the AccessPolicy
canRead: Test whether the provided subject can read an object.
getData: Get the data content of a specified data object
getFormatId: Get the FormatId of the DataObject
getIdentifier: Get the Identifier of the DataObject
hasAccessRule: Determine if an access rules exists for a DataObject.
setPublicAccess: Add a Rule to the AccessPolicy to make the object publicly readable.
updateXML: Update selected elements of the xml content of a DataObject
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
data <- charToRaw("1,2,3\n4,5,6\n") do <- new("DataObject", "id1", dataobj=data, "text/csv", "uid=jones,DC=example,DC=com", "urn:node:KNB") getIdentifier(do) getFormatId(do) getData(do) canRead(do, "uid=anybody,DC=example,DC=com") do <- setPublicAccess(do) canRead(do, "public") canRead(do, "uid=anybody,DC=example,DC=com") # Also can create using a file for storage, rather than memory ## Not run: tf <- tempfile() con <- file(tf, "wb") writeBin(data, con) close(con) do <- new("DataObject", "id1", format="text/csv", user="uid=jones,DC=example,DC=com", mnNodeId="urn:node:KNB", filename=tf) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.