Class Dataset
public class Dataset : FileOrDir
- Inheritance
-
Dataset
- Derived
- Inherited Members
Constructors
Dataset()
public Dataset()
Dataset(ROCrate?, string?, JsonObject?, string?, string?, bool, bool)
public Dataset(ROCrate? crate = null, string? identifier = null, JsonObject? properties = null, string? source = null, string? destPath = null, bool fetchRemote = false, bool validateUrl = false)
Parameters
crateROCrateidentifierstringpropertiesJsonObjectsourcestringdestPathstringfetchRemoteboolvalidateUrlbool
Methods
Deserialize(string, ROCrate)
Create a Dataset from JSON properties.
public static Dataset? Deserialize(string entityJson, ROCrate roCrate)
Parameters
Returns
Serialize()
Convert Dataset to JSON string.
public override string Serialize()
Returns
Write(string)
Write the contents of a Dataset to disk.
If the Dataset's source is remote, the contents will be downloaded to basePath.
If the source is on disk, the contents will be copied under basePath.
public override void Write(string basePath)
Parameters
basePathstringThe path under which the
Dataset's parts will be written.
Examples
var url = "https://hdruk.github.io/hutch/docs/devs";
var dirName = url.Split('/').Last();
var dataset = new Models.Dataset(
new ROCrate("myCrate.zip"),
source: url,
validateUrl: true,
fetchRemote: true);
dataset.Write("myCrate");
Assert.True(Directory.Exists(Path.Combine("myCrate", dirName)));
Exceptions
- DirectoryNotFoundException
Thrown when the source directory is not a URL, but it doesn't exist.
_empty()
protected JsonObject _empty()