When initializing a DataObject using passed in data, one can either pass
in the 'id'
param as a 'SystemMetadata'
object, or as a 'character'
string
representing the identifier for an object along with parameters for format, user,and associated member node.
If 'data'
is not missing, the 'data'
param holds the 'raw'
data. Otherwise, the
'filename'
parameter must be provided, and points at a file containing the bytes of the data.
# S4 method for DataObject
initialize(
.Object,
id = NA_character_,
dataobj = NA,
format = NA_character_,
user = NA_character_,
mnNodeId = NA_character_,
filename = NA_character_,
seriesId = NA_character_,
mediaType = NA_character_,
mediaTypeProperty = list(),
dataURL = NA_character_,
targetPath = NA_character_,
checksumAlgorithm = "SHA-256"
)
the DataObject instance to be initialized
the identifier for the DataObject, unique within its repository. Optionally this can be an existing SystemMetadata object
the bytes of the data for this object in 'raw'
format, optional if 'filename'
is provided
the format identifier for the object, e.g."text/csv", "eml://ecoinformatics.org/eml-2.1.1"
the identity of the user owning the package, typically in X.509 format
the node identifier for the repository to which this object belongs.
the filename for the fully qualified path to the data on disk, optional if 'data'
is provided
A unique string to identifier the latest of multiple revisions of the object.
The When specified, indicates the IANA Media Type (aka MIME-Type) of the object. The value should include the media type and subtype (e.g. text/csv).
A list, indicates IANA Media Type properties to be associated with the parameter "mediaType"
A character string containing a URL to remote data (a repository) that this DataObject represents.
An optional string that denotes where the file should go in a downloaded package
A character string specifying the checksum algorithm to use
If filesystem storage is used for the data associated with a DataObject, care must be
taken to not modify or remove that file in R or via other facilities while the DataObject exists in the R session.
Changes to the object are not detected and will result in unexpected results. Also, if the 'dataobj'
parameter
is used to specify the data source, then 'filename'
argument may also be specified, but in this case
the value 'filename'
parameter is used to tell DataONE the filename to create when this file is
downloaded from a repository.
# NOT RUN {
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", targetPath="data/rasters/data.tiff")
# }
Run the code above in your browser using DataLab