Serialize A DataPackage into a BagIt Archive File

Description

The BagIt packaging format https://tools.ietf.org/html/draft-kunze-bagit-08 is used to prepare an archive file that contains the contents of a DataPackage.

Usage

1
2
3
4
5
6
7
serializeToBagIt(x, ...)

## S4 method for signature 'DataPackage'
serializeToBagIt(x, mapId = as.character(NA),
  syntaxName = as.character(NA), namespaces = data.frame(),
  mimeType = as.character(NA), syntaxURI = as.character(NA),
  resolveURI = as.character(NA), ...)

Arguments

x

A DataPackage object

...

Additional arguments

mapId

A unique identifier for the package resource map. If not specified, one will be automatically generated.

syntaxName

The name of the syntax to use for the resource map serialization, defaults to "rdfxml"

namespaces

An optional data frame containing one or more namespaces and their associated prefix for the resource map serialization.

mimeType

The mimetype for the resource map serialization, defaults to "application/rdf+xml".

syntaxURI

An optional string specifying the URI for the resource map serialization.

resolveURI

A character string containing a URI to prepend to datapackage identifiersa for the resource map.

Details

A BagIt Archive File is created by copying each member of a DataPackge, and preparing files that describe the files in the archive, including information about the size of the files and a checksum for each file. An OAI-ORE resource map is automatically created and added to the archive. These metadata files and the data files are then packaged into a single zip file.

Value

The file name that contains the BagIt zip archive.

See Also

DataPackage-class

For more information and examples regarding the parameters specifying the creation of the resource map, see serializePackage.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Create the first data object
dp <- new("DataPackage")
data <- charToRaw("1,2,3\n4,5,6")
do <- new("DataObject", id="do1", dataobj=data, format="text/csv", user="jsmith")
dp <- addData(dp, do)
# Create a second data object
data2 <- charToRaw("7,8,9\n4,10,11")
do2 <- new("DataObject", id="do2", dataobj=data2, format="text/csv", user="jsmith")
dp <- addData(dp, do2)
# Create a relationship between the two data objects
recordDerivation(dp, "do2", "do2")
# Write out the data package to a BagIt file
## Not run: 
bagitFile <- serializeToBagIt(dp, syntaxName="json", mimeType="application/json")

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.